def toggle_wicd_gui(self): """ Toggles the wicd GUI. """ if not self.gui_win: self.gui_win = gui.appGui(tray=self) elif not self.gui_win.is_visible: self.gui_win.show_win() else: self.gui_win.exit() return True
def main(argv): """ The main frontend program. Keyword arguments: argv -- The arguments passed to the script. """ try: opts, args = getopt.getopt( sys.argv[1:], 'tnhao', ['help', 'no-tray', 'tray', 'no-animate', 'only-notifications']) except getopt.GetoptError: # Print help information and exit usage() sys.exit(2) use_tray = True animate = True display_app = True for opt, a in opts: if opt in ('-h', '--help'): usage() sys.exit(0) elif opt in ('-t', '--tray'): display_app = False elif opt in ('-n', '--no-tray'): use_tray = False elif opt in ('-a', '--no-animate'): animate = False elif opt in ('-o', '--only-notifications'): print("only displaying notifications") use_tray = False display_app = False else: usage() sys.exit(2) print('Loading...') setup_dbus() atexit.register(on_exit) if display_app and not use_tray or not ICON_AVAIL: gui.appGui(standalone=True) mainloop = gobject.MainLoop() mainloop.run() sys.exit(0) # Set up the tray icon GUI and backend tray_icon = TrayIcon(animate, displaytray=use_tray, displayapp=display_app) # Check to see if wired profile chooser was called before icon # was launched (typically happens on startup or daemon restart). if DBUS_AVAIL and daemon.GetNeedWiredProfileChooser(): daemon.SetNeedWiredProfileChooser(False) tray_icon.icon_info.wired_profile_chooser() bus = dbusmanager.get_bus() bus.add_signal_receiver(tray_icon.icon_info.wired_profile_chooser, 'LaunchChooser', 'org.wicd.daemon') bus.add_signal_receiver(tray_icon.icon_info.update_tray_icon, 'StatusChanged', 'org.wicd.daemon') bus.add_signal_receiver(tray_icon.tr.tray_scan_ended, 'SendEndScanSignal', 'org.wicd.daemon.wireless') bus.add_signal_receiver(tray_icon.tr.tray_scan_started, 'SendStartScanSignal', 'org.wicd.daemon.wireless') bus.add_signal_receiver( lambda: (handle_no_dbus() or tray_icon.icon_info.set_not_connected_state()), "DaemonClosing", 'org.wicd.daemon') bus.add_signal_receiver(lambda: setup_dbus(force=False), "DaemonStarting", "org.wicd.daemon") print('Done loading.') mainloop = gobject.MainLoop() mainloop.run()
def main(argv): """ The main frontend program. Keyword arguments: argv -- The arguments passed to the script. """ try: opts, args = getopt.getopt( sys.argv[1:], 'tnhao', ['help', 'no-tray', 'tray', 'no-animate', 'only-notifications'] ) except getopt.GetoptError: # Print help information and exit usage() sys.exit(2) use_tray = True animate = True display_app = True for opt, a in opts: if opt in ('-h', '--help'): usage() sys.exit(0) elif opt in ('-t', '--tray'): display_app = False elif opt in ('-n', '--no-tray'): use_tray = False elif opt in ('-a', '--no-animate'): animate = False elif opt in ('-o', '--only-notifications'): print "only displaying notifications" use_tray = False display_app = False else: usage() sys.exit(2) print 'Loading...' setup_dbus() atexit.register(on_exit) if display_app and not use_tray or not ICON_AVAIL: gui.appGui(standalone=True) mainloop = gobject.MainLoop() mainloop.run() sys.exit(0) # Set up the tray icon GUI and backend tray_icon = TrayIcon(animate, displaytray=use_tray, displayapp=display_app) # Check to see if wired profile chooser was called before icon # was launched (typically happens on startup or daemon restart). if DBUS_AVAIL and daemon.GetNeedWiredProfileChooser(): daemon.SetNeedWiredProfileChooser(False) tray_icon.icon_info.wired_profile_chooser() bus = dbusmanager.get_bus() bus.add_signal_receiver(tray_icon.icon_info.wired_profile_chooser, 'LaunchChooser', 'org.wicd.daemon') bus.add_signal_receiver(tray_icon.icon_info.update_tray_icon, 'StatusChanged', 'org.wicd.daemon') bus.add_signal_receiver(tray_icon.tr.tray_scan_ended, 'SendEndScanSignal', 'org.wicd.daemon.wireless') bus.add_signal_receiver(tray_icon.tr.tray_scan_started, 'SendStartScanSignal', 'org.wicd.daemon.wireless') bus.add_signal_receiver( lambda: ( handle_no_dbus() or tray_icon.icon_info.set_not_connected_state() ), "DaemonClosing", 'org.wicd.daemon' ) bus.add_signal_receiver(lambda: setup_dbus(force=False), "DaemonStarting", "org.wicd.daemon") print 'Done loading.' mainloop = gobject.MainLoop() mainloop.run()