예제 #1
0
 def on_unknown_message(self, daemon, message):
     if not message.startswith("OSD:"):
         return
     if message.startswith("OSD: message"):
         args = split(message)[1:]
         m = Message()
         m.parse_argumets(args)
         m.show()
     elif message.startswith("OSD: keyboard"):
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show keyboard"
             )
         else:
             args = split(message)[1:]
             self._window = Keyboard()
             self._window.connect('destroy', self.on_keyboard_closed)
             # self._window.parse_argumets(args) # TODO: No arguments so far
             self._window.show()
             self._window.use_daemon(self.daemon)
     elif message.startswith("OSD: menu") or message.startswith(
             "OSD: gridmenu"):
         args = split(message)[1:]
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show menu")
         else:
             self._window = GridMenu() if "gridmenu" in message else Menu()
             self._window.connect('destroy', self.on_menu_closed)
             self._window.use_config(self.config)
             if self._window.parse_argumets(args):
                 self._window.show()
                 self._window.use_daemon(self.daemon)
             else:
                 log.error("Failed to show menu")
                 self._window = None
     elif message.startswith("OSD: area"):
         args = split(message)[1:]
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show area")
         else:
             args = split(message)[1:]
             self._window = Area()
             self._window.connect('destroy', self.on_keyboard_closed)
             if self._window.parse_argumets(args):
                 self._window.show()
             else:
                 self._window.quit()
                 self._window = None
     elif message.startswith("OSD: clear"):
         # Clears active OSD window (if any)
         if self._window:
             self._window.quit()
             self._window = None
     else:
         log.warning("Unknown command from daemon: '%s'", message)
예제 #2
0
 def on_unknown_message(self, daemon, message):
     if not message.startswith("OSD:"):
         return
     if message.startswith("OSD: message"):
         args = shsplit(message)[1:]
         m = Message()
         m.parse_argumets(args)
         m.show()
     elif message.startswith("OSD: keyboard"):
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show keyboard"
             )
         else:
             args = shsplit(message)[1:]
             self._window = Keyboard(self.config)
             self._window.connect('destroy', self.on_keyboard_closed)
             self._window.parse_argumets(args)
             self._window.show()
             self._window.use_daemon(self.daemon)
     elif message.startswith("OSD: gesture"):
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show keyboard"
             )
         else:
             args = shsplit(message)[1:]
             self._window = GestureDisplay(self.config)
             self._window.parse_argumets(args)
             self._window.use_daemon(self.daemon)
             self._window.show()
             self._window.connect('destroy', self.on_gesture_recognized)
     elif self._is_menu_message(message):
         args = shsplit(message)[1:]
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show menu")
         else:
             if message.startswith("OSD: hmenu"):
                 self._window = HorizontalMenu()
             elif message.startswith("OSD: radialmenu"):
                 self._window = RadialMenu()
             elif message.startswith("OSD: quickmenu"):
                 self._window = QuickMenu()
             elif message.startswith("OSD: gridmenu"):
                 self._window = GridMenu()
             elif message.startswith("OSD: dialog"):
                 self._window = Dialog()
             else:
                 self._window = Menu()
             self._window.connect('destroy', self.on_menu_closed)
             self._window.use_config(self.config)
             if self._window.parse_argumets(args):
                 self._window.show()
                 self._window.use_daemon(self.daemon)
             else:
                 log.error("Failed to show menu")
                 self._window = None
     elif message.startswith("OSD: area"):
         args = shsplit(message)[1:]
         if self._window:
             log.warning(
                 "Another OSD is already visible - refusing to show area")
         else:
             args = shsplit(message)[1:]
             self._window = Area()
             self._window.connect('destroy', self.on_keyboard_closed)
             if self._window.parse_argumets(args):
                 self._window.show()
             else:
                 self._window.quit()
                 self._window = None
     elif message.startswith("OSD: clear"):
         # Clears active OSD window (if any)
         if self._window:
             self._window.quit()
             self._window = None
     else:
         log.warning("Unknown command from daemon: '%s'", message)
예제 #3
0
def cmd_osd_keyboard(argv0, argv):
    """ Displays on-screen keyboard """
    import_osd()
    from scc.osd.keyboard import Keyboard
    return run_osd_tool(Keyboard(), argv0, argv)
예제 #4
0
def help_osd_keyboard():
    import_osd()
    from scc.osd.keyboard import Keyboard
    return run_osd_tool(Keyboard(), "osd-keyboard", ["--help"])