use the first python version found when starting the scripts
This commit is contained in:
parent
5c38c33374
commit
4cb9b30466
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
APPNAME = 'Solaar'
|
||||
NAME = 'Solaar'
|
||||
VERSION = '0.7.1'
|
||||
__author__ = "Daniel Pavel <daniel.pavel@gmail.com>"
|
||||
__version__ = '0.7'
|
||||
__version__ = VERSION
|
||||
__license__ = "GPL"
|
||||
|
||||
#
|
||||
|
@ -11,7 +12,7 @@ __license__ = "GPL"
|
|||
|
||||
def _parse_arguments():
|
||||
import argparse
|
||||
arg_parser = argparse.ArgumentParser(prog=APPNAME.lower())
|
||||
arg_parser = argparse.ArgumentParser(prog=NAME.lower())
|
||||
arg_parser.add_argument('-v', '--verbose',
|
||||
action='count', default=0,
|
||||
help='increase the logger verbosity (may be repeated)')
|
||||
|
@ -43,18 +44,13 @@ if __name__ == '__main__':
|
|||
|
||||
# check if the notifications are available and enabled
|
||||
args.notifications &= args.systray
|
||||
if ui.notify.available and ui.notify.init(APPNAME):
|
||||
if ui.notify.available and ui.notify.init(NAME):
|
||||
ui.action.toggle_notifications.set_active(args.notifications)
|
||||
else:
|
||||
ui.action.toggle_notifications = None
|
||||
|
||||
from receiver import (ReceiverListener, DUMMY)
|
||||
|
||||
window = ui.main_window.create(APPNAME,
|
||||
DUMMY.name,
|
||||
DUMMY.max_devices,
|
||||
args.systray)
|
||||
|
||||
from receiver import DUMMY
|
||||
window = ui.main_window.create(NAME, DUMMY.name, DUMMY.max_devices, args.systray)
|
||||
if args.systray:
|
||||
menu_actions = (ui.action.toggle_notifications,
|
||||
ui.action.about)
|
||||
|
@ -79,6 +75,7 @@ if __name__ == '__main__':
|
|||
GObject.timeout_add(5000, check_for_listener)
|
||||
listener = None
|
||||
|
||||
from receiver import ReceiverListener
|
||||
def check_for_listener(retry=True):
|
||||
global listener, notify_missing
|
||||
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
# pass
|
||||
|
||||
APPNAME = 'Solaar'
|
||||
APPVERSION = '0.7'
|
||||
|
||||
from . import (notify, status_icon, main_window, pair_window, action)
|
||||
|
||||
from gi.repository import (GObject, Gtk)
|
||||
GObject.threads_init()
|
||||
|
||||
|
||||
from solaar import NAME as _NAME
|
||||
_APP_ICONS = (_NAME + '-fail', _NAME + '-init', _NAME)
|
||||
def appicon(receiver_status):
|
||||
return (APPNAME + '-fail' if receiver_status < 0 else
|
||||
APPNAME + '-init' if receiver_status < 1 else
|
||||
APPNAME)
|
||||
return (_APP_ICONS[0] if receiver_status < 0 else
|
||||
_APP_ICONS[1] if receiver_status < 1 else
|
||||
_APP_ICONS[2])
|
||||
|
||||
|
||||
_ICON_THEME = Gtk.IconTheme.get_default()
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
#
|
||||
#
|
||||
|
||||
# from sys import version as PYTTHON_VERSION
|
||||
from gi.repository import Gtk
|
||||
|
||||
import ui
|
||||
import ui.notify
|
||||
import ui.pair_window
|
||||
from solaar import NAME as _NAME
|
||||
from solaar import VERSION as _VERSION
|
||||
|
||||
|
||||
def _action(name, label, function, *args):
|
||||
|
@ -27,7 +31,7 @@ def _toggle_action(name, label, function, *args):
|
|||
|
||||
def _toggle_notifications(action):
|
||||
if action.get_active():
|
||||
ui.notify.init(ui.APPNAME)
|
||||
ui.notify.init(_NAME)
|
||||
else:
|
||||
ui.notify.uninit()
|
||||
action.set_sensitive(ui.notify.available)
|
||||
|
@ -36,16 +40,18 @@ toggle_notifications = _toggle_action('notifications', 'Notifications', _toggle_
|
|||
|
||||
def _show_about_window(action):
|
||||
about = Gtk.AboutDialog()
|
||||
about.set_icon_name(ui.APPNAME)
|
||||
about.set_program_name(ui.APPNAME)
|
||||
about.set_logo_icon_name(ui.APPNAME)
|
||||
about.set_version(ui.APPVERSION)
|
||||
about.set_icon_name(_NAME)
|
||||
about.set_program_name(_NAME)
|
||||
about.set_logo_icon_name(_NAME)
|
||||
about.set_version(_VERSION)
|
||||
about.set_license_type(Gtk.License.GPL_2_0)
|
||||
about.set_authors(('Daniel Pavel http://github.com/pwr', ))
|
||||
about.set_website('http://github.com/pwr/Solaar/wiki')
|
||||
about.set_website_label('Solaar Wiki')
|
||||
# about.set_comments('Using Python %s\n' % PYTTHON_VERSION.split(' ')[0])
|
||||
about.run()
|
||||
about.destroy()
|
||||
about = _action('help-about', 'About ' + ui.APPNAME, _show_about_window)
|
||||
about = _action('help-about', 'About ' + _NAME, _show_about_window)
|
||||
|
||||
quit = _action('exit', 'Quit', Gtk.main_quit)
|
||||
|
||||
|
|
|
@ -4,4 +4,5 @@ LIB=`dirname "$0"`/../lib
|
|||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB/native/`arch`
|
||||
export PYTHONPATH=$LIB
|
||||
|
||||
exec python -OOu -m hidapi.hidconsole "$@"
|
||||
PYTHON=`which python python2 python3 | head -n 1`
|
||||
exec $PYTHON -OOu -m hidapi.hidconsole "$@"
|
||||
|
|
3
bin/scan
3
bin/scan
|
@ -4,4 +4,5 @@ LIB=`dirname "$0"`/../lib
|
|||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB/native/`arch`
|
||||
export PYTHONPATH=$LIB
|
||||
|
||||
exec python -OOu -m logitech.scanner "$@"
|
||||
PYTHON=`which python python2 python3 | head -n 1`
|
||||
exec $PYTHON -OOu -m logitech.scanner "$@"
|
||||
|
|
|
@ -9,5 +9,5 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB/native/`arch`
|
|||
export PYTHONPATH=$APP:$LIB
|
||||
export XDG_DATA_DIRS=$SHARE:$XDG_DATA_DIRS
|
||||
|
||||
exec python -OOu -m solaar "$@"
|
||||
#exec python -OOu -m profile -o $TMPDIR/profile.log app/solaar.py "$@"
|
||||
PYTHON=`which python python2 python3 | head -n 1`
|
||||
exec $PYTHON -OOu -m solaar "$@"
|
||||
|
|
|
@ -140,6 +140,6 @@ class EventsListener(_Thread):
|
|||
_log.info("queueing unhandled event %s", event)
|
||||
self._events.put(event)
|
||||
|
||||
def __nonzero__(self):
|
||||
def __bool__(self):
|
||||
return bool(self._active and self._handle)
|
||||
__bool__ = __nonzero__
|
||||
__nonzero__ = __bool__
|
||||
|
|
Loading…
Reference in New Issue