def SetDebugLevel(self, log_level): logger = logging.getLogger() logger.setLevel(g15logging.get_level(log_level))
logger.debug("setproctitle doesn't seem to be available", exc_info=e) pass import optparse parser = optparse.OptionParser() parser.add_option("-l", "--log", dest="log_level", metavar="INFO,DEBUG,WARNING,ERROR,CRITICAL", default="warning", help="Log level") (options, args) = parser.parse_args() if options.log_level is not None: logger.setLevel(g15logging.get_level(options.log_level)) bus = dbus.SessionBus() try: screen = bus.get_object('org.gnome15.Gnome15', '/org/gnome15/Service') except dbus.DBusException as e: logger.error("g15-desktop-service is not running.", exc_info=e) sys.exit(0) plugin = G15NotifyLCD( gconf.Client.get_default(), "/apps/gnome15/plugins/notify-lcd2", screen, bus.get_object('org.gnome15.Gnome15', '/org/gnome15/Driver'), bus) plugin.activate() loop.run()
if __name__ == "__main__": try : import setproctitle setproctitle.setproctitle(os.path.basename(os.path.abspath(sys.argv[0]))) except Exception as e: logger.debug("setproctitle doesn't seem to be available", exc_info = e) pass import optparse parser = optparse.OptionParser() parser.add_option("-l", "--log", dest="log_level", metavar="INFO,DEBUG,WARNING,ERROR,CRITICAL", default="warning" , help="Log level") (options, args) = parser.parse_args() if options.log_level != None: logger.setLevel(g15logging.get_level(options.log_level)) bus = dbus.SessionBus() try : screen = bus.get_object('org.gnome15.Gnome15', '/org/gnome15/Service') except dbus.DBusException as e: logger.error("g15-desktop-service is not running.", exc_info = e) sys.exit(0) plugin = G15NotifyLCD(gconf.client_get_default(), "/apps/gnome15/plugins/notify-lcd2", screen, bus.get_object('org.gnome15.Gnome15', '/org/gnome15/Driver'), bus) plugin.activate() loop.run()