Beispiel #1
0
 def __init__(self,
              net_send,
              keyboard_sync=True,
              shortcut_modifiers="auto",
              key_shortcuts=[],
              raw=False,
              layout="",
              layouts=[],
              variant="",
              variants=[],
              options=""):
     self.reset_state()
     self.send = net_send
     self.locked = False
     self.keyboard_sync = keyboard_sync
     self.shortcut_modifiers = shortcut_modifiers
     self.key_shortcuts = self.parse_shortcuts(key_shortcuts)
     #command line overrides:
     self.xkbmap_raw = raw
     self.layout_option = layout
     self.variant_option = variant
     self.layouts_option = layouts
     self.variants_option = variants
     self.options = options
     #the platform class which allows us to map the keys:
     from xpra.platform.keyboard import Keyboard
     self.keyboard = Keyboard()
     log("KeyboardHelper(%s) keyboard=%s",
         (net_send, keyboard_sync, key_shortcuts, raw, layout, layouts,
          variant, variants, options), self.keyboard)
     key_repeat = self.keyboard.get_keyboard_repeat()
     if key_repeat:
         self.key_repeat_delay, self.key_repeat_interval = key_repeat
Beispiel #2
0
 def _keys_changed(self):
     from xpra.server.mixins.input_server import InputServer
     if isinstance(self, InputServer):
         InputServer._keys_changed(self)
         from xpra.platform.keyboard import Keyboard
         log.info("the keymap has been changed: %s",
                  Keyboard().get_layout_spec()[0])
Beispiel #3
0
 def __init__(self, net_send, keyboard_sync, key_shortcuts):
     self.reset_state()
     self.send = net_send
     self.keyboard_sync = keyboard_sync
     self.key_shortcuts = self.parse_shortcuts(key_shortcuts)
     self.keyboard = Keyboard()
     log("KeyboardHelper.__init__(%s, %s, %s) keyboard=%s", net_send,
         keyboard_sync, key_shortcuts, self.keyboard)
Beispiel #4
0
 def __init__(self, net_send, keyboard_sync, key_shortcuts):
     self.reset_state()
     self.send = net_send
     self.locked = False
     self.keyboard_sync = keyboard_sync
     self.key_shortcuts = self.parse_shortcuts(key_shortcuts)
     from xpra.platform.keyboard import Keyboard
     self.keyboard = Keyboard()
     log("KeyboardHelper.__init__(%s, %s, %s) keyboard=%s", net_send, keyboard_sync, key_shortcuts, self.keyboard)
Beispiel #5
0
 def __init__(self, net_send, keyboard_sync, key_shortcuts, raw, layout, layouts, variant, variants, options):
     self.reset_state()
     self.send = net_send
     self.locked = False
     self.keyboard_sync = keyboard_sync
     self.key_shortcuts = self.parse_shortcuts(key_shortcuts)
     #command line overrides:
     self.xkbmap_raw = raw
     self.layout_option = layout
     self.variant_option = variant
     self.layouts_option = layouts
     self.variants_option = variants
     self.options = options
     #the platform class which allows us to map the keys:
     from xpra.platform.keyboard import Keyboard
     self.keyboard = Keyboard()
     log("KeyboardHelper(%s) keyboard=%s", (net_send, keyboard_sync, key_shortcuts, raw, layout, layouts, variant, variants, options), self.keyboard)
Beispiel #6
0
 def show_keymap(self, msg="keymap changed:"):
     self.keymap_change_timer = 0
     from xpra.platform.keyboard import Keyboard
     keyboard = Keyboard()      #pylint: disable=not-callable
     layout, layouts, variant, variants, options = keyboard.get_layout_spec()
     self.add_event_text(msg)
     for k,v in {
         "layout"    : layout,
         "variant"   : variant,
         "layouts"   : layouts,
         "variants"  : variants,
         "options"  : options,
         }.items():
         if v:
             if isinstance(v, (list, tuple)):
                 v = csv(bytestostr(x) for x in v)
             self.add_event_text("%16s: %s" % (k, bytestostr(v)))
     print("do_keymap_changed: %s" % (msg,))
     print("do_keymap_changed: %s" % ((layout, layouts, variant, variants, options),))
Beispiel #7
0
    def populate_form(self):
        btn = link_btn(
            "https://github.com/Xpra-org/xpra/blob/master/docs/Features/Keyboard.md",
            label="Open Keyboard Documentation",
            icon_name=None)
        self.vbox.pack_start(btn, expand=True, fill=False, padding=20)

        tb = self.table()
        if POSIX and not OSX:
            try:
                from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
                init_gdk_display_source()
            except Exception:
                pass
        from xpra.platform.keyboard import Keyboard
        kbd = Keyboard()  #pylint: disable=not-callable
        layouts = {
            "": "auto",
        }
        layouts.update(kbd.get_all_x11_layouts())
        self.combo(tb, "Keyboard Layout", "keyboard-layout", layouts)
        self.bool_cb(tb, "State Synchronization", "keyboard-sync")
        self.bool_cb(tb, "Raw Mode", "keyboard-raw")
        self.combo(
            tb, "Input Method", "input-method", {
                "auto": "auto",
                "none": "default",
                "keep": "unchanged",
                "xim": "xim",
                "IBus": "IBus",
                "SCIM": "SCIM",
                "uim": "uim",
            })
        self.combo(
            tb, "Shortcut Modifiers", "shortcut-modifiers", {
                "auto": "auto",
                "shift + control": "Shift+Control",
                "control + alt": "Control+Alt",
                "shift + alt": "Shift+Alt",
            })
        self.vbox.show_all()
Beispiel #8
0
 def __init__(self, net_send, keyboard_sync, key_shortcuts):
     self.reset_state()
     self.send = net_send
     self.keyboard_sync = keyboard_sync
     self.key_shortcuts = self.parse_shortcuts(key_shortcuts)
     self.keyboard = Keyboard()