def action_performed(self, binding): if self.page != None: if binding.action == SELECT_PROFILE: self.screen.raise_page(self.page) elif self.page.is_visible(): if binding.action == g15driver.VIEW: active = g15profile.get_active_profile(self.screen.device) if active.id == self.menu.selected.profile.id: g15profile.set_locked( self.screen.device, not g15profile.is_locked(self.screen.device)) else: if g15profile.is_locked(self.screen.device): g15profile.set_locked(self.screen.device, False) self.menu.selected.profile.make_active() g15profile.set_locked(self.screen.device, True) return True elif binding.action == g15driver.CLEAR: profile = self.menu.selected.profile if self.screen.service.active_application_name is not None: self._configure_profile_with_window_name( profile, self.screen.service.active_application_name) profile.save() elif self.screen.service.active_window_title is not None: self._configure_profile_with_window_name( profile, self.screen.service.active_window_title) profile.save() return True
def activate(self): locked = g15profile.is_locked(self._plugin.screen.device) if locked: g15profile.set_locked(self._plugin.screen.device, False) self.profile.make_active() if locked: g15profile.set_locked(self._plugin.screen.device, True) # Raise the macros page if it is enabled and not raised macros_page = self._plugin.screen.get_page("macros") if macros_page is not None and not macros_page.is_visible(): self._plugin.screen.raise_page(macros_page)
def action_performed(self, binding): if self.page != None: if binding.action == SELECT_PROFILE: self.screen.raise_page(self.page) elif self.page.is_visible(): if binding.action == g15driver.VIEW: active = g15profile.get_active_profile(self.screen.device) if active.id == self.menu.selected.profile.id: g15profile.set_locked(self.screen.device, not g15profile.is_locked(self.screen.device)) else: if g15profile.is_locked(self.screen.device): g15profile.set_locked(self.screen.device, False) self.menu.selected.profile.make_active() g15profile.set_locked(self.screen.device, True) return True elif binding.action == g15driver.CLEAR: profile = self.menu.selected.profile if self.screen.service.active_application_name is not None: self._configure_profile_with_window_name(profile, self.screen.service.active_application_name) profile.save() elif self.screen.service.active_window_title is not None: self._configure_profile_with_window_name(profile, self.screen.service.active_window_title) profile.save() return True
def get_theme_properties(self): locked = self.profile.is_active() and g15profile.is_locked(self._plugin.screen.device) if self.get_screen().device.bpp > 1: locked_icon = g15icontools.get_icon_path(["locked","gdu-encrypted-lock", "status_lock", "stock_lock" ]) else: if self.parent.selected == self: locked_icon = os.path.join(os.path.dirname(__file__), 'bw-locked-inverted.gif') else: locked_icon = os.path.join(os.path.dirname(__file__), 'bw-locked.gif') item_properties = g15theme.MenuItem.get_theme_properties(self) item_properties["item_name"] = self.profile.name item_properties["item_radio"] = True item_properties["item_radio_selected"] = self.profile.is_active() item_properties["item_icon"] = self._surface item_properties["item_alt_icon"] = locked_icon if locked else "" item_properties["item_alt"] = "" return item_properties
def get_theme_properties(self): locked = self.profile.is_active() and g15profile.is_locked( self._plugin.screen.device) if self.get_screen().device.bpp > 1: locked_icon = g15icontools.get_icon_path( ["locked", "gdu-encrypted-lock", "status_lock", "stock_lock"]) else: if self.parent.selected == self: locked_icon = os.path.join(os.path.dirname(__file__), 'bw-locked-inverted.gif') else: locked_icon = os.path.join(os.path.dirname(__file__), 'bw-locked.gif') item_properties = g15theme.MenuItem.get_theme_properties(self) item_properties["item_name"] = self.profile.name item_properties["item_radio"] = True item_properties["item_radio_selected"] = self.profile.is_active() item_properties["item_icon"] = self._surface item_properties["item_alt_icon"] = locked_icon if locked else "" item_properties["item_alt"] = "" return item_properties
def get_theme_properties(self): p = g15plugin.G15MenuPlugin.get_theme_properties(self) p["profile_locked"] = g15profile.is_locked(self.screen.device) return p