def _on_tray_icon_command(self, cmd): lg.out(2, "initializer._on_tray_icon_command : [%s]" % cmd) try: if cmd == "exit": shutdowner.A("stop", "exit") elif cmd == "restart": # appList = bpio.find_process(['bpgui.',]) # if len(appList) > 0: # shutdowner.A('stop', 'restartnshow') # ('restart', 'show')) # else: # shutdowner.A('stop', 'restart') # ('restart', '')) shutdowner.A("stop", "restart") elif cmd == "reconnect": from p2p import network_connector if driver.is_started("service_network"): network_connector.A("reconnect") elif cmd == "show": from web import control control.show() elif cmd == "sync": try: from updates import git_proc from system import tray_icon def _sync_callback(result): if result == "error": tray_icon.draw_icon("error") reactor.callLater(5, tray_icon.restore_icon) return elif result == "new-data": tray_icon.draw_icon("updated") reactor.callLater(5, tray_icon.restore_icon) return tray_icon.restore_icon() tray_icon.draw_icon("sync") git_proc.sync(_sync_callback) except: lg.exc() elif cmd == "hide": pass elif cmd == "toolbar": pass else: lg.warn("wrong command: " + str(cmd)) except: lg.exc()
def _on_tray_icon_command(self, cmd): if _Debug: lg.out(_DebugLevel, "initializer._on_tray_icon_command : [%s]" % cmd) try: from main import shutdowner if cmd == 'exit': shutdowner.A('stop', 'exit') elif cmd == 'restart': shutdowner.A('stop', 'restart') elif cmd == 'reconnect': from p2p import network_connector if driver.is_on('service_network'): network_connector.A('reconnect') elif cmd == 'show': # TODO: raise up electron window ? pass elif cmd == 'sync': try: from updates import git_proc from system import tray_icon def _sync_callback(result): if result == 'error': tray_icon.draw_icon('error') reactor.callLater( 5, tray_icon.restore_icon) # @UndefinedVariable return elif result == 'source-code-fetched': tray_icon.draw_icon('updated') reactor.callLater( 5, tray_icon.restore_icon) # @UndefinedVariable return tray_icon.restore_icon() tray_icon.draw_icon('sync') git_proc.sync(_sync_callback, update_method='reset') except: lg.exc() elif cmd == 'hide': pass elif cmd == 'toolbar': pass else: lg.warn('wrong command: ' + str(cmd)) except: lg.exc()
def _on_tray_icon_command(self, cmd): lg.out(2, "initializer._on_tray_icon_command : [%s]" % cmd) try: if cmd == 'exit': shutdowner.A('stop', 'exit') elif cmd == 'restart': # appList = bpio.find_process(['bpgui.',]) # if len(appList) > 0: # shutdowner.A('stop', 'restartnshow') # ('restart', 'show')) # else: # shutdowner.A('stop', 'restart') # ('restart', '')) shutdowner.A('stop', 'restart') elif cmd == 'reconnect': from p2p import network_connector if driver.is_started('service_network'): network_connector.A('reconnect') elif cmd == 'show': from web import control control.show() elif cmd == 'sync': try: from updates import git_proc from system import tray_icon def _sync_callback(result): if result == 'error': tray_icon.draw_icon('error') reactor.callLater(5, tray_icon.restore_icon) return elif result == 'new-data': tray_icon.draw_icon('updated') reactor.callLater(5, tray_icon.restore_icon) return tray_icon.restore_icon() tray_icon.draw_icon('sync') git_proc.sync(_sync_callback) except: lg.exc() elif cmd == 'hide': pass elif cmd == 'toolbar': pass else: lg.warn('wrong command: ' + str(cmd)) except: lg.exc()
def _on_tray_icon_command(self, cmd): lg.out(2, "initializer._on_tray_icon_command : [%s]" % cmd) try: if cmd == 'exit': shutdowner.A('stop', 'exit') elif cmd == 'restart': shutdowner.A('stop', 'restart') elif cmd == 'reconnect': from p2p import network_connector if driver.is_on('service_network'): network_connector.A('reconnect') elif cmd == 'show': from web import control control.show() elif cmd == 'sync': try: from updates import git_proc from system import tray_icon def _sync_callback(result): if result == 'error': tray_icon.draw_icon('error') reactor.callLater(5, tray_icon.restore_icon) return elif result == 'source-code-fetched': tray_icon.draw_icon('updated') reactor.callLater(5, tray_icon.restore_icon) return tray_icon.restore_icon() tray_icon.draw_icon('sync') git_proc.sync(_sync_callback) except: lg.exc() elif cmd == 'hide': pass elif cmd == 'toolbar': pass else: lg.warn('wrong command: ' + str(cmd)) except: lg.exc()