Exemplo n.º 1
0
    def init_ui(self, opts):
        """ initialize user interface """
        if not self.readonly:

            def noauto(v):
                if not v:
                    return None
                if str(v).lower() == "auto":
                    return None
                return v

            overrides = [
                noauto(getattr(opts, "keyboard_%s" % x)) for x in (
                    "layout",
                    "layouts",
                    "variant",
                    "variants",
                    "options",
                )
            ]
            try:
                self.keyboard_helper = self.keyboard_helper_class(
                    self.send, opts.keyboard_sync, opts.shortcut_modifiers,
                    opts.key_shortcut, opts.keyboard_raw, *overrides)
            except ImportError as e:
                keylog("error instantiating %s",
                       self.keyboard_helper_class,
                       exc_info=True)
                keylog.warn("Warning: no keyboard support, %s", e)

        if mixin_features.windows:
            self.init_opengl(opts.opengl)

        if ClientExtras is not None:
            self.client_extras = ClientExtras(self, opts)

        if opts.start or opts.start_child:
            from xpra.scripts.main import strip_defaults_start_child
            from xpra.scripts.config import make_defaults_struct
            defaults = make_defaults_struct()
            self.start_new_commands = strip_defaults_start_child(
                opts.start, defaults.start)
            self.start_child_new_commands = strip_defaults_start_child(
                opts.start_child, defaults.start_child)

        if MOUSE_DELAY_AUTO:
            try:
                from xpra.platform.gui import get_vrefresh
                v = get_vrefresh()
                if v <= 0:
                    #some platforms don't detect the vrefresh correctly
                    #(ie: macos in virtualbox?), so use a sane default:
                    v = 60
                self._mouse_position_delay = 1000 // v
                log("mouse delay: %s", self._mouse_position_delay)
            except Exception:
                log("failed to calculate automatic delay", exc_info=True)
Exemplo n.º 2
0
    def init_ui(self, opts, extra_args=[]):
        """ initialize user interface """
        if not self.readonly:

            def noauto(v):
                if not v:
                    return None
                if str(v).lower() == "auto":
                    return None
                return v

            overrides = [
                noauto(getattr(opts, "keyboard_%s" % x))
                for x in ("layout", "layouts", "variant", "variants",
                          "options")
            ]
            self.keyboard_helper = self.keyboard_helper_class(
                self.send, opts.keyboard_sync, opts.shortcut_modifiers,
                opts.key_shortcut, opts.keyboard_raw, *overrides)
        TrayClient.init_ui(self)
        NotificationClient.init_ui(self)

        self.init_opengl(opts.opengl)

        #audio tagging:
        AudioClient.init_audio_tagging(self, opts.tray_icon)

        if ClientExtras is not None:
            self.client_extras = ClientExtras(self, opts)

        WindowClient.init_ui(self, opts, extra_args)

        if MOUSE_DELAY_AUTO:
            try:
                from xpra.platform.gui import get_vrefresh
                v = get_vrefresh()
                if v <= 0:
                    #some platforms don't detect the vrefresh correctly
                    #(ie: macos in virtualbox?), so use a sane default:
                    v = 60
                self._mouse_position_delay = 1000 // v
                log("mouse delay: %s", self._mouse_position_delay)
            except Exception:
                log("failed to calculate automatic delay", exc_info=True)
Exemplo n.º 3
0
 def get_vrefresh(self):
     return get_vrefresh()
Exemplo n.º 4
0
 def get_vrefresh(self):
     #this method is overriden in the GTK client
     from xpra.platform.gui import get_vrefresh  #pylint: disable=import-outside-toplevel
     return get_vrefresh()
Exemplo n.º 5
0
 def get_vrefresh(self):
     #this method is overriden in the GTK client
     from xpra.platform.gui import get_vrefresh
     return get_vrefresh()