示例#1
0
    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)
示例#2
0
文件: profiles.py 项目: FPar/gnome15
 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)
示例#3
0
 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
示例#4
0
文件: profiles.py 项目: FPar/gnome15
 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