当前位置: 首页>>代码示例>>Python>>正文


Python server_base.ServerBase类代码示例

本文整理汇总了Python中xpra.server.server_base.ServerBase的典型用法代码示例。如果您正苦于以下问题:Python ServerBase类的具体用法?Python ServerBase怎么用?Python ServerBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServerBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_get_info

 def do_get_info(self, proto, *args):
     info = ServerBase.do_get_info(self, proto, *args)
     ss = self._server_sources.get(proto)
     add_gtk_version_info(info, gtk, "server.", (ss is None) or ss.namespace)
     info["server.type"] = "Python/gtk-x11"
     info["features.randr"] = self.randr
     return info
开发者ID:svn2github,项目名称:Xpra,代码行数:7,代码来源:gtk_server_base.py

示例2: get_ui_info

 def get_ui_info(self, proto, *args):
     info = ServerBase.get_ui_info(self, proto, *args)
     info.setdefault("server", {}).update({
                                           "display"             : gtk.gdk.display_get_default().get_name(),
                                           "root_window_size"    : self.get_root_window_size(),
                                           })
     return info
开发者ID:ljmljz,项目名称:xpra,代码行数:7,代码来源:gtk_server_base.py

示例3: make_hello

 def make_hello(self):
     capabilities = ServerBase.make_hello(self)
     capabilities["display"] = gtk.gdk.display_get_default().get_name()
     capabilities["cursor.default_size"] = gtk.gdk.display_get_default().get_default_cursor_size()
     capabilities["cursor.max_size"] = gtk.gdk.display_get_default().get_maximal_cursor_size()
     add_gtk_version_info(capabilities, gtk, "", True)
     return capabilities
开发者ID:svn2github,项目名称:Xpra,代码行数:7,代码来源:gtk_server_base.py

示例4: do_get_info

 def do_get_info(self, proto, *args):
     info = ServerBase.do_get_info(self, proto, *args)
     updict(info, "server", get_gtk_version_info())
     info.update({
                  "server.type"      : "Python/gtk-x11",
                  "features.randr"   : self.randr})
     return info
开发者ID:svn2github,项目名称:Xpra,代码行数:7,代码来源:gtk_server_base.py

示例5: do_get_info

 def do_get_info(self, proto, *args):
     info = ServerBase.do_get_info(self, proto, *args)
     ss = self._server_sources.get(proto)
     info.update(get_gtk_version_info(prefix="server", new_namespace=(ss is not None) and ss.namespace))
     info.update({
                  "server.type"      : "Python/gtk-x11",
                  "features.randr"   : self.randr})
     return info
开发者ID:svn2github,项目名称:Xpra,代码行数:8,代码来源:gtk_server_base.py

示例6: make_hello

 def make_hello(self):
     capabilities = ServerBase.make_hello(self)
     display = gtk.gdk.display_get_default()
     capabilities.update({
         "display"               : display.get_name(),
         "cursor.default_size"   : display.get_default_cursor_size(),
         "cursor.max_size"       : display.get_maximal_cursor_size()})
     capabilities.update(get_gtk_version_info())
     return capabilities
开发者ID:svn2github,项目名称:Xpra,代码行数:9,代码来源:gtk_server_base.py

示例7: do_get_info

 def do_get_info(self, proto, *args):
     start = time.time()
     info = ServerBase.do_get_info(self, proto, *args)
     vi = get_gtk_version_info()
     vi["type"] = "Python/gtk-x11"
     info.setdefault("server", {}).update(vi)
     info.setdefault("features", {})["randr"] = self.randr
     log("GTKServerBase.do_get_info took %ims", (time.time()-start)*1000)
     return info
开发者ID:svn2github,项目名称:Xpra,代码行数:9,代码来源:gtk_server_base.py

示例8: make_hello

 def make_hello(self, source):
     capabilities = ServerBase.make_hello(self, source)
     if source.wants_display:
         display = gtk.gdk.display_get_default()
         capabilities.update({
             "display"               : display.get_name(),
             "cursor.default_size"   : display.get_default_cursor_size(),
             "cursor.max_size"       : display.get_maximal_cursor_size()})
     if source.wants_versions:
         capabilities.update(flatten_dict(get_gtk_version_info()))
     return capabilities
开发者ID:svn2github,项目名称:Xpra,代码行数:11,代码来源:gtk_server_base.py

示例9: __init__

 def __init__(self):
     log("ServerBase.__init__()")
     self.idle_add = gobject.idle_add
     self.timeout_add = gobject.timeout_add
     self.source_remove = gobject.source_remove
     ServerBase.__init__(self)
开发者ID:svn2github,项目名称:Xpra,代码行数:6,代码来源:gtk_server_base.py

示例10: do_check

 def do_check():
     if self.clipboard_nesting_check(ss):
         ServerBase.process_clipboard_packet(self, ss, packet)
开发者ID:svn2github,项目名称:Xpra,代码行数:3,代码来源:gtk_server_base.py

示例11: send_clipboard_packet

 def send_clipboard_packet(self, *parts):
     #overriden so we can inject the nesting check:
     if self.clipboard_nesting_check(self._clipboard_client):
         ServerBase.send_clipboard_packet(self, *parts)
开发者ID:svn2github,项目名称:Xpra,代码行数:4,代码来源:gtk_server_base.py

示例12: get_ui_info

 def get_ui_info(self, *args):
     info = ServerBase.get_ui_info(self, *args)
     info["server.display"] = gtk.gdk.display_get_default().get_name()
     info["server.root_window_size"] = self.get_root_window_size()
     return info
开发者ID:svn2github,项目名称:Xpra,代码行数:5,代码来源:gtk_server_base.py

示例13: signal_quit

 def signal_quit(self, signum, frame):
     gtk_main_quit_on_fatal_exceptions_disable()
     ServerBase.signal_quit(self, signum, frame)
开发者ID:svn2github,项目名称:Xpra,代码行数:3,代码来源:gtk_server_base.py

示例14: __init__

 def __init__(self):
     log("GTKServerBase.__init__()")
     self.idle_add = glib.idle_add
     self.timeout_add = glib.timeout_add
     self.source_remove = glib.source_remove
     ServerBase.__init__(self)
开发者ID:svn2github,项目名称:Xpra,代码行数:6,代码来源:gtk_server_base.py

示例15: run_server

def run_server(error_cb, opts, mode, xpra_file, extra_args):
    try:
        cwd = os.getcwd()
    except:
        cwd = os.path.expanduser("~")
        sys.stderr.write("current working directory does not exist, using '%s'\n" % cwd)
    if opts.encoding and opts.encoding == "help":
        # avoid errors and warnings:
        opts.encoding = ""
        opts.clipboard = False
        opts.notifications = False
        print("xpra server supports the following encodings:")
        print("(please wait, encoder initialization may take a few seconds)")
        # disable info logging which would be confusing here
        from xpra.log import get_all_loggers, set_default_level
        import logging

        set_default_level(logging.WARN)
        logging.root.setLevel(logging.WARN)
        for x in get_all_loggers():
            x.logger.setLevel(logging.WARN)
        from xpra.server.server_base import ServerBase

        sb = ServerBase()
        sb.init(opts)
        # ensures that the threaded video helper init has completed
        # (by running it again, which will block on the init lock)
        from xpra.codecs.video_helper import getVideoHelper

        getVideoHelper().init()
        sb.init_encodings()
        from xpra.codecs.loader import encoding_help

        for e in sb.encodings:
            print(" * %s" % encoding_help(e))
        return 0

    assert mode in ("start", "upgrade", "shadow", "proxy")
    starting = mode == "start"
    upgrading = mode == "upgrade"
    shadowing = mode == "shadow"
    proxying = mode == "proxy"
    clobber = upgrading or opts.use_display

    # get the display name:
    if shadowing and len(extra_args) == 0:
        if sys.platform.startswith("win") or sys.platform.startswith("darwin"):
            # just a virtual name for the only display available:
            display_name = ":0"
        else:
            from xpra.scripts.main import guess_X11_display

            display_name = guess_X11_display(opts.socket_dir)
    elif upgrading and len(extra_args) == 0:
        from xpra.scripts.main import guess_xpra_display

        display_name = guess_xpra_display(opts.socket_dir)
    else:
        if len(extra_args) > 1:
            error_cb("too many extra arguments: only expected a display number")
        if len(extra_args) == 1:
            display_name = extra_args[0]
            if not shadowing and not proxying:
                display_name_check(display_name)
        else:
            if proxying:
                error_cb("you must specify a free virtual display name to use with the proxy server")
            if not opts.displayfd:
                error_cb("displayfd support is not enabled on this system, you must specify the display to use")
            if opts.use_display:
                # only use automatic guess for xpra displays and not X11 displays:
                from xpra.scripts.main import guess_xpra_display  # @Reimport

                display_name = guess_xpra_display(opts.socket_dir)
            else:
                # We will try to find one automaticaly
                # Use the temporary magic value 'S' as marker:
                display_name = "S" + str(os.getpid())

    if not shadowing and not proxying and not upgrading and opts.exit_with_children and not opts.start_child:
        error_cb("--exit-with-children specified without any children to spawn; exiting immediately")

    atexit.register(run_cleanups)
    # the server class will usually override those:
    signal.signal(signal.SIGINT, deadly_signal)
    signal.signal(signal.SIGTERM, deadly_signal)

    dotxpra = DotXpra(opts.socket_dir)

    # Generate the script text now, because os.getcwd() will
    # change if/when we daemonize:
    script = xpra_runner_shell_script(xpra_file, os.getcwd(), opts.socket_dir)

    stdout = sys.stdout
    stderr = sys.stderr
    # Daemonize:
    if opts.daemon:
        # daemonize will chdir to "/", so try to use an absolute path:
        if opts.password_file:
            opts.password_file = os.path.abspath(opts.password_file)
#.........这里部分代码省略.........
开发者ID:svn2github,项目名称:Xpra,代码行数:101,代码来源:server.py


注:本文中的xpra.server.server_base.ServerBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。