def __init__(self): gobject.GObject.__init__(self) self.logger = logging.getLogger("LBRC.Config") self.paths = path() self.user = None self.system = None self.reread()
def __init__(self): self.paths = path() bus_name = dbus.service.BusName("custom.LBRC", bus=dbus.SessionBus()) dbus.service.Object.__init__(self, bus_name, "/custom/LBRC") self.btserver = BTServer() self.config = config() self.event_listener = [] for i in (UinputDispatcher, CommandExecutor, DBUSCaller, ProfileSwitcher, MPlayer): self._register_listener(i) # load of config data self.cur_profile = None self.reload_config() self.btserver.connect("keycode", self.handler) self.btserver.connect( "connect", lambda btserver, btadress, port: self.connect_cb(bluetooth.lookup_name(btadress), btadress, port) ) self.btserver.connect( "disconnect", lambda btserver, btadress, port: self.disconnect_cb(bluetooth.lookup_name(btadress), btadress, port), ) # load the default profile self._load_default_profile()
def __init__(self, lbrc, **kwds): self.lbrc = lbrc self._config = {} self.config = config() self.paths = path() try: proxy_obj = dbus.SessionBus().get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') self.notify_interface = dbus.Interface(proxy_obj, 'org.freedesktop.Notifications') self.notify_interface.GetServerInformation() except: self.notify_interface = None try: self.bluecontrol = BlueZControl() except: self.bluecontrol = None self._config['icon_size'] = 24 self.icon = gtk.gdk.pixbuf_new_from_file(self.paths.get_datafile('LBRC.svg')) self.trayicon = egg.trayicon.TrayIcon("LBRC") image = gtk.Image() image.set_from_pixbuf(self.icon.scale_simple(self._config['icon_size'],self._config['icon_size'], gtk.gdk.INTERP_BILINEAR)) self._create_menu() eventbox = gtk.EventBox() self.trayicon.add(eventbox) eventbox.add(image) eventbox.add_events(gtk.gdk.BUTTON_PRESS) eventbox.connect('button-press-event', self.popup_menu) self.lbrc.connect_to_signal("shutdown", lambda: gtk.main_quit()) self.lbrc.connect_to_signal("connect_cb", self.connect_cb) self.lbrc.connect_to_signal("disconnect_cb", self.disconnect_cb) self.lbrc.connect_to_signal("profile_change", self.profile_change_cb) self.pid_menu_map[self.lbrc.get_profile()].set_active(1) self.trayicon.show_all() self.config_close_handler = None
def __init__(self, config): """ The method initialises the uinput device and prior to that creates the eventsmap from the profiledata. In this process all uinput events are recorded and the corresponding eventmasks are set on the uinput device. This means, that all uinput events, from any profile have to be present at this point! @param config: configuration data @type config: dictionary """ self.path = path() self.invoked = {} self.config = config self.uinput_dev = None self.uinputbridge = None self._start_uinput_bridge() self._open_uinput_dev() self.init = [] self.actions = {} self.destruct = []
def __init__(self, config): """ @param config: configuration data @type config: dictionary """ Listener.__init__(self, config, "MPlayer") self.path = path() self.querytype = None self.querymap = None self.mplayer = None
def __init__(self, config): """ @param config: configuration data @type config: dictionary """ self.config = config self.init = [] self.actions = {} self.destruct = [] self.path = path() self.mplayer = None
def __init__(self, **kwds): self.logger = logging.getLogger('LBRC') self.shutdown_commands = [] bus_name = dbus.service.BusName(DBUSNAME, bus=dbus.SessionBus()) dbus.service.Object.__init__(self, bus_name, "/core") self.loghandler = DBUSLogHandler(bus_name, "/log") logging.getLogger().addHandler(self.loghandler) if 'debug' in kwds: self.loghandler.setLevel(kwds['debug']) self.paths = path() self.btserver = BTServer() self.config = config() self.profile_control = ProfileControl(self.config) self.dbus_profile_control = DBUSProfileControl(bus_name, "/profile", self.profile_control) self.connection_control = ConnectionControl(bus_name, "/connection", self.btserver) self.event_listener = [] for i in (UinputDispatcher, CommandExecutor, DBUSCaller, ProfileSwitcher, MPlayer, PresentationCompanion, VolumeControl, XInput): self._register_listener(i) self.logger.debug("Register done") self.profile_control.connect("profile_changed", self._profile_change_cb) self.logger.debug("Initial Profile set") self.btserver.connect('keycode', self._dispatch) self.logger.debug("Init dispatcher") self.btserver.connect("connect", self._connection_established_cb) self.btserver.connect("disconnect", self._connection_closed_cb) #load of config data self.reload_config() self.logger.debug("Reload config")
def __init__(self): gobject.GObject.__init__(self) # create widget tree ... self.xml = gtk.glade.XML(osp.join(path().get_guidir(), "config.glade")) self.modified = False self.logger = logging.getLogger("ConfigWindow") # Wrapper to get a widget from glade's xml self.widget = self.xml.get_widget self.widget("config-window").show_all() self._load_config() self.config_applets = [] renderer = gtk.CellRendererText() renderer.set_property("ellipsize", pango.ELLIPSIZE_END) self.widget("profile-combobox").clear() self.widget("profile-combobox").pack_start(renderer) self.widget("profile-combobox").add_attribute(renderer, "text", 0) self.widget("config_notebook").set_scrollable(True) for i in ( 'Init', 'Actions', 'Destruct'): self.config_applets.append( ConfigWindowWidget(self.config, i.lower(), self.configModules) ) self.widget("config_notebook").append_page( self.config_applets[-1], gtk.Label(i)) self.config_applets[-1].connect("changed", self._change_handler) self.widget("config_notebook").show_all() self.widget("config_notebook").set_current_page(1) self._fill_window() #connnect signals self.xml.signal_autoconnect(self)
def __init__( self, config ): """ The method initialises the uinput device and prior to that creates the eventsmap from the profiledata. In this process all uinput events are recorded and the corresponding eventmasks are set on the uinput device. This means, that all uinput events, from any profile have to be present at this point! @param config: configuration data @type config: dictionary """ Listener.__init__(self, config, "UinputDispatcher") self.path = path() self.invoked = {} self.uinput_dev = None self.uinputbridge = None self._start_uinput_bridge() self._open_uinput_dev() self.logger.debug("Loaded succesfully")
def __init__(self): self.paths = path() self.user = None self.system = None self.reread()
def __init__(self): gobject.GObject.__init__(self) self.paths = path() self.user = None self.system = None self.reread()
"""Module initialising l10n for LBRC gui/backend""" import gettext import logging from LBRC.path import path localedir = path().get_localedir() gettext.bindtextdomain("LBRC", localedir) gettext.textdomain("LBRC") lang = gettext.translation("LBRC", localedir, fallback=True) def init_glade_gettext(): # setting locales of glade (if we have glade) try: import gtk.glade gtk.glade.bindtextdomain("LBRC", localedir) gtk.glade.textdomain("LBRC") except ImportError: logging.getLogger("LBRC.l10n").warning("Could not init glade l10n") # Bind "_" as marker for the translation of texts. We bind to ugettext, as # our gui toolkit (gtk2) expects utf-8 strings and the output routines should # break it down correctly _ = lang.ugettext