Exemplo n.º 1
0
    def _get_key_help(self, key, state):
        page = self.screen.get_visible_page()
        originating_plugin = page.originating_plugin
        if originating_plugin:
            import gnome15.g15pluginmanager as g15pluginmanager
            actions = g15pluginmanager.get_actions(
                g15pluginmanager.get_module_for_id(
                    originating_plugin.__module__), self.screen.device)
            active_profile = g15profile.get_active_profile(
                self.screen.driver.device
            ) if self.screen.driver is not None else None
            for action_id in actions:
                # First try the active profile to see if the action has been re-mapped
                action_binding = active_profile.get_binding_for_action(
                    state, action_id)
                if action_binding is None:
                    # No other keys bound to action, try the device defaults
                    device_info = g15devices.get_device_info(
                        self.screen.driver.get_model_name())
                    if action_id in device_info.action_keys:
                        action_binding = device_info.action_keys[action_id]

                if action_binding is not None and key in action_binding.keys:
                    return actions[action_id]

        return "?"
Exemplo n.º 2
0
 def _init_driver(self):      
     logger.info("Initialising GTK driver")
     if self.device.model_id == 'virtual':
         self.mode = self.conf_client.get_string("/apps/gnome15/%s/gtk_mode" % self.device.uid)
     else:
         self.mode = self.device.model_id
     if self.mode == None or self.mode == "":
         self.mode = g15driver.MODEL_G19
     logger.info("Mode is now %s", self.mode)
     self.controls = controls[self.mode]
     import gnome15.g15devices as g15devices
     device_info = g15devices.get_device_info(self.mode)
     self.bpp = device_info.bpp
     self.action_keys = device_info.action_keys
     self.lcd_size = device_info.lcd_size
     self.key_layout = device_info.key_layout
     logger.info("Initialised GTK driver")
Exemplo n.º 3
0
 def _get_key_help(self, key, state):
     page = self.screen.get_visible_page()
     originating_plugin = page.originating_plugin
     if originating_plugin:
         import gnome15.g15pluginmanager as g15pluginmanager
         actions = g15pluginmanager.get_actions(g15pluginmanager.get_module_for_id(originating_plugin.__module__), self.screen.device)
         active_profile = g15profile.get_active_profile(self.screen.driver.device) if self.screen.driver is not None else None
         for action_id in actions:
             # First try the active profile to see if the action has been re-mapped
             action_binding = active_profile.get_binding_for_action(state, action_id)
             if action_binding is None:
                 # No other keys bound to action, try the device defaults
                 device_info = g15devices.get_device_info(self.screen.driver.get_model_name())                
                 if action_id in device_info.action_keys:
                     action_binding = device_info.action_keys[action_id]
             
             if action_binding is not None and key in action_binding.keys:
                 return actions[action_id]
         
     return "?"