• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python module_init.stop_all函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: do_GET

    def do_GET(self):
        try:
            refer = self.headers.getheader("Referer")
            netloc = urlparse.urlparse(refer).netloc
            if not netloc.startswith("127.0.0.1") and not netloc.startswitch("localhost"):
                logging.warn("web control ref:%s refuse", netloc)
                return
        except:
            pass

        logging.debug("launcher web_control %s %s %s ", self.address_string(), self.command, self.path)
        # check for '..', which will leak file
        if re.search(r"(\.{2})", self.path) is not None:
            self.wfile.write(b"HTTP/1.1 404\r\n\r\n")
            logging.warn("%s %s %s haking", self.address_string(), self.command, self.path)
            return

        url_path = urlparse.urlparse(self.path).path
        if url_path == "/":
            return self.req_index_handler()

        if len(url_path.split("/")) >= 3 and url_path.split("/")[1] == "modules":
            module = url_path.split("/")[2]
            # config.load()
            modules_version = config.get(["modules", module, "current_version"], None)
            file_path = os.path.join(root_path, module, modules_version, url_path.split("/")[3:].join("/"))
        else:
            file_path = os.path.join(current_path, "web_ui" + url_path)

        if os.path.isfile(file_path):
            if file_path.endswith(".js"):
                mimetype = "application/javascript"
            elif file_path.endswith(".css"):
                mimetype = "text/css"
            elif file_path.endswith(".html"):
                mimetype = "text/html"
            elif file_path.endswith(".jpg"):
                mimetype = "image/jpeg"
            elif file_path.endswith(".png"):
                mimetype = "image/png"
            else:
                mimetype = "text/plain"

            self.send_file(file_path, mimetype)
        elif url_path == "/config":
            self.req_config_handler()
        elif url_path == "/download":
            self.req_download_handler()
        elif url_path == "/init_module":
            self.req_init_module_handler()
        elif url_path == "/quit":
            self.send_response("text/html", '{"status":"success"}')
            module_init.stop_all()
            os._exit(0)
        elif url_path == "/restart":
            self.send_response("text/html", '{"status":"success"}')
            update_from_github.restart_xxnet()
        else:
            self.wfile.write(b"HTTP/1.1 404\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n404 Not Found")
            logging.info('%s "%s %s HTTP/1.1" 404 -', self.address_string(), self.command, self.path)
开发者ID:hoku85,项目名称:XX-Net,代码行数:60,代码来源:web_control.py


示例2: main

def main():

    # change path to launcher
    global __file__
    __file__ = os.path.abspath(__file__)
    if os.path.islink(__file__):
        __file__ = getattr(os, 'readlink', lambda x: x)(__file__)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    web_control.confirm_xxnet_exit()

    setup_win_python.check_setup()

    module_init.start_all_auto()

    web_control.start()


    if config.get(["modules", "launcher", "show_systray"], 1):
        sys_tray.serve_forever()
    else:
        while True:
            time.sleep(100)

    module_init.stop_all()
    sys.exit()
开发者ID:shenyuan000,项目名称:chrome,代码行数:26,代码来源:start.py


示例3: main

def main():

    # change path to launcher
    global __file__
    __file__ = os.path.abspath(__file__)
    if os.path.islink(__file__):
        __file__ = getattr(os, "readlink", lambda x: x)(__file__)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    web_control.confirm_xxnet_exit()

    setup_win_python.check_setup()

    module_init.start_all_auto()

    web_control.start()

    if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1:
        webbrowser.open("http://127.0.0.1:8085/")

    update.start()

    if config.get(["modules", "launcher", "show_systray"], 1):
        sys_tray.serve_forever()
    else:
        while True:
            time.sleep(100)

    module_init.stop_all()
    sys.exit()
开发者ID:cc419378878,项目名称:XX-Net,代码行数:30,代码来源:start.py


示例4: main

def main():
    # change path to launcher
    global __file__
    __file__ = os.path.abspath(__file__)
    if os.path.islink(__file__):
        __file__ = getattr(os, 'readlink', lambda x: x)(__file__)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    launcher_log.info("start XX-Net %s", update_from_github.current_version())

    web_control.confirm_xxnet_exit()

    setup_win_python.check_setup()

    module_init.start_all_auto()

    web_control.start()


    if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1:
        host_port = config.get(["modules", "launcher", "control_port"], 8085)
        webbrowser.open("http://127.0.0.1:%s/" % host_port)

    update.start()

    if config.get(["modules", "launcher", "show_systray"], 1):
        sys_tray.serve_forever()
    else:
        while True:
            time.sleep(100)

    module_init.stop_all()
    sys.exit()
开发者ID:guoyunliang,项目名称:XX-Net,代码行数:33,代码来源:start.py


示例5: do_GET

    def do_GET(self):
        try:
            refer = self.headers.getheader('Referer')
            netloc = urlparse.urlparse(refer).netloc
            if not netloc.startswith("127.0.0.1") and not netloc.startswitch("localhost"):
                logging.warn("web control ref:%s refuse", netloc)
                return
        except:
            pass
        
        logging.debug ('launcher web_control %s "%s %s ', self.address_string(), self.command, self.path)
        # check for '..', which will leak file
        if re.search(r'(\.{2})', self.path) is not None:
            self.wfile.write(b'HTTP/1.1 404\r\n\r\n')
            logging.warn('%s %s %s haking', self.address_string(), self.command, self.path )
            return

        url_path = urlparse.urlparse(self.path).path
        if url_path == '/':
            return self.req_index_handler()

        if len(url_path.split('/')) >= 3 and url_path.split('/')[1] == "modules":
            module = url_path.split('/')[2]
            #config.load()
            modules_versoin = config.get(['modules', module, 'current_version'], None)
            file_path = os.path.join(root_path, module, modules_versoin, url_path.split('/')[3:].join('/'))
        else:
            file_path = os.path.join(current_path, 'web_ui' + url_path)


        if os.path.isfile(file_path):
            if file_path.endswith('.js'):
                mimetype = 'application/javascript'
            elif file_path.endswith('.css'):
                mimetype = 'text/css'
            elif file_path.endswith('.html'):
                mimetype = 'text/html'
            elif file_path.endswith('.jpg'):
                mimetype = 'image/jpeg'
            elif file_path.endswith('.png'):
                mimetype = 'image/png'
            else:
                mimetype = 'text/plain'


            self.send_file(file_path, mimetype)
        elif url_path == '/config':
            self.req_config_handler()
        elif url_path == '/init_module':
            self.req_init_module_handler()
        elif url_path == '/quit':
            self.send_response('text/html', '{"status":"success"}')
            module_init.stop_all()
            os._exit(0)
        elif url_path == '/restart':
            self.send_response('text/html', '{"status":"success"}')
            update_from_github.restart_xxnet()
        else:
            self.wfile.write(b'HTTP/1.1 404\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n404 Not Found')
            logging.info('%s "%s %s HTTP/1.1" 404 -', self.address_string(), self.command, self.path)
开发者ID:juzisan,项目名称:XX-Net,代码行数:60,代码来源:web_control.py


示例6: on_quit

 def on_quit(self, widget, data=None):
     proxy_setting = config.get(["modules", "launcher", "proxy"], "disable")
     if proxy_setting != "disable":
         win32_proxy_manager.disable_proxy()
     module_init.stop_all()
     nid = win32_adapter.NotifyData(self.systray._hwnd, 0)
     win32_adapter.Shell_NotifyIcon(2, ctypes.byref(nid))
     os._exit(0)
开发者ID:GitHublong,项目名称:XX-Net,代码行数:8,代码来源:win_tray.py


示例7: restart_xxnet

def restart_xxnet(version):
    import module_init
    module_init.stop_all()
    import web_control
    web_control.stop()

    start_script = os.path.join(top_path, "code", version, "launcher", "start.py")

    subprocess.Popen([sys.executable, start_script])
    time.sleep(20)
开发者ID:JingLuo2017,项目名称:XX-Net,代码行数:10,代码来源:update_from_github.py


示例8: restart_xxnet

def restart_xxnet():
    import module_init
    module_init.stop_all()
    import web_control
    web_control.stop()

    current_path = os.path.dirname(os.path.abspath(__file__))
    start_sript = os.path.abspath( os.path.join(current_path, os.pardir, "start.py"))

    subprocess.Popen([sys.executable, start_sript], shell=False)
开发者ID:juzisan,项目名称:XX-Net,代码行数:10,代码来源:update_from_github.py


示例9: restart_xxnet

def restart_xxnet():
    import module_init
    module_init.stop_all()
    import web_control
    web_control.stop()

    current_path = os.path.dirname(os.path.abspath(__file__))
    start_script = os.path.join(current_path, "start.py")

    subprocess.Popen([sys.executable, start_script])
    time.sleep(10)
    os._exit(0)
开发者ID:03013405yujiangfeng,项目名称:XX-Net,代码行数:12,代码来源:update_from_github.py


示例10: main

def main():
    # change path to launcher
    global __file__
    __file__ = os.path.abspath(__file__)
    if os.path.islink(__file__):
        __file__ = getattr(os, 'readlink', lambda x: x)(__file__)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    current_version = update_from_github.current_version()

    xlog.info("start XX-Net %s", current_version)

    web_control.confirm_xxnet_exit()

    setup_win_python.check_setup()

    last_run_version = config.get(["modules", "launcher", "last_run_version"], "0.0.0")
    if last_run_version != current_version:
        import post_update
        post_update.run(last_run_version)
        config.set(["modules", "launcher", "last_run_version"], current_version)
        config.save()

    allow_remote = 0
    if len(sys.argv) > 1:
        for s in sys.argv[1:]:
            xlog.info("command args:%s", s)
            if s == "-allow_remote":
                allow_remote = 1
                module_init.xargs["allow_remote"] = 1

    module_init.start_all_auto()
    web_control.start(allow_remote)

    if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1:
        host_port = config.get(["modules", "launcher", "control_port"], 8085)
        import webbrowser
        webbrowser.open("http://127.0.0.1:%s/" % host_port)

    update.start()

    update_from_github.delete_to_save_disk()
    
    if config.get(["modules", "launcher", "show_systray"], 1):
        sys_tray.serve_forever()
    else:
        while True:
            time.sleep(100)

    module_init.stop_all()
    sys.exit()
开发者ID:LawyerWebber,项目名称:XX-Net,代码行数:51,代码来源:start.py


示例11: install_module

def install_module(module, new_version):
    import module_init
    import os, subprocess, sys

    current_path = os.path.dirname(os.path.abspath(__file__))
    new_module_version_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, module, new_version))

    #check path exist
    if not os.path.isdir(new_module_version_path):
        logging.error("install module %s dir %s not exist", module, new_module_version_path)
        return

    #call setup.py
    setup_script = os.path.join(new_module_version_path, "setup.py")
    if not os.path.isfile(setup_script):
        logging.warn("update %s fail. setup script %s not exist", module, setup_script)
        return


    config.set(["modules", module, "current_version"], str(new_version))
    config.save()

    if module == "launcher":
        module_init.stop_all()
        import web_control
        web_control.stop()


        subprocess.Popen([sys.executable, setup_script], shell=False)

        os._exit(0)

    else:
        logging.info("Setup %s version %s ...", module, new_version)
        try:
            module_init.stop(module)

            subprocess.call([sys.executable, setup_script], shell=False)
            logging.info("Finished new version setup.")

            logging.info("Restarting new version ...")
            module_init.start(module)
        except Exception as e:
            logging.error("install module %s %s fail:%s", module, new_version, e)
开发者ID:ChardRapid,项目名称:XX-Net,代码行数:44,代码来源:update.py


示例12: windowWillClose_

    def windowWillClose_(self, notification):
        listNetworkServicesCommand = 'networksetup -listallnetworkservices'
        executeResult = subprocess.check_output(listNetworkServicesCommand, shell=True)
        services = executeResult.split('\n')
        services = filter(lambda service : service and service.find('*') == -1 and self.getProxyState(service) != 'disable', services) # Remove disabled services and empty lines

        if len(services) > 0:
            disableAutoProxyCommand   = ';'.join(map(self.getDisableAutoProxyCommand, services))
            disableGlobalProxyCommand = ';'.join(map(self.getDisableGlobalProxyCommand, services))
            rootCommand               = """osascript -e 'do shell script "%s;%s" with administrator privileges' """ % (disableAutoProxyCommand, disableGlobalProxyCommand)
            executeCommand            = rootCommand.encode('utf-8')

            xlog.info("try disable proxy:%s", executeCommand)
            os.system(executeCommand)

        self.updateConfig('disable')
        module_init.stop_all()
        os._exit(0)
        NSApp.terminate_(self)
开发者ID:hezma,项目名称:XX-Net,代码行数:19,代码来源:mac_tray.py


示例13: windowWillClose_

    def windowWillClose_(self, notification):
        executeResult = subprocess.check_output(['networksetup', '-listallnetworkservices'])
        services = executeResult.split('\n')
        services = filter(lambda service : service and service.find('*') == -1 and getProxyState(service) != 'disable', services) # Remove disabled services and empty lines

        if len(services) > 0:
            try:
                map(helperDisableAutoProxy, services)
                map(helperDisableGlobalProxy, services)
            except:
                disableAutoProxyCommand   = ';'.join(map(getDisableAutoProxyCommand, services))
                disableGlobalProxyCommand = ';'.join(map(getDisableGlobalProxyCommand, services))
                executeCommand            = 'do shell script "%s;%s" with administrator privileges' % (disableAutoProxyCommand, disableGlobalProxyCommand)

                xlog.info("try disable proxy:%s", executeCommand)
                subprocess.call(['osascript', '-e', executeCommand])

        module_init.stop_all()
        os._exit(0)
        AppKit.NSApp.terminate_(self)
开发者ID:LSLdalong,项目名称:XX-Net,代码行数:20,代码来源:mac_tray.py


示例14: restart_xxnet

def restart_xxnet(version=None):
    import module_init
    module_init.stop_all()

    import web_control
    web_control.stop()
    # New process will hold the listen port
    # We should close all listen port before create new process
    xlog.info("Close web control port.")

    if version is None:
        current_version_file = os.path.join(top_path, "code", "version.txt")
        with open(current_version_file, "r") as fd:
            version = fd.read()

    xlog.info("restart to xx-net version:%s", version)

    start_script = os.path.join(top_path, "code", version, "launcher", "start.py")
    subprocess.Popen([sys.executable, start_script])
    time.sleep(20)

    xlog.info("Exit old process...")
    os._exit(0)
开发者ID:CyrusYzGTt,项目名称:XX-Net,代码行数:23,代码来源:update_from_github.py


示例15: on_restart_goagent

 def on_restart_goagent(self, widget=None, data=None):
     module_init.stop_all()
     module_init.start_all_auto()
开发者ID:dodo2014,项目名称:XX-Net,代码行数:3,代码来源:win_tray.py


示例16: exit_handler

def exit_handler():
    print('Stopping all modules before exit!')
    module_init.stop_all()
    web_control.stop()
开发者ID:DMJackZ,项目名称:XX-Net,代码行数:4,代码来源:start.py


示例17: main

    module_init.start_all_auto()
    web_control.start(allow_remote)

    if has_desktop and config.get(["modules", "launcher", "popup_webui"], 1) == 1:
        host_port = config.get(["modules", "launcher", "control_port"], 8085)
        import webbrowser
        webbrowser.open("http://localhost:%s/" % host_port)

    update.start()

    update_from_github.cleanup()

    if config.get(["modules", "launcher", "show_systray"], 1):
        sys_tray.serve_forever()
    else:
        while True:
            time.sleep(1)


if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:  # Ctrl + C on console
        module_init.stop_all()
        os._exit(0)
        sys.exit()
    except Exception as e:
        xlog.exception("launcher except:%r", e)
        raw_input("Press Enter to continue...")
开发者ID:DMJackZ,项目名称:XX-Net,代码行数:29,代码来源:start.py


示例18: windowWillClose_

 def windowWillClose_(self, notification):
     module_init.stop_all()
     NSApp.terminate_(self)
开发者ID:rojshanliang,项目名称:appified-xx-net,代码行数:3,代码来源:mac_tray.py


示例19: restartEachModule_

 def restartEachModule_(self, _):
     module_init.stop_all()
     module_init.start_all_auto()
开发者ID:CyrusYzGTt,项目名称:XX-Net,代码行数:3,代码来源:mac_tray.py


示例20: on_restart_gae_proxy

 def on_restart_gae_proxy(self, widget=None, data=None):
     module_init.stop_all()
     module_init.start_all_auto()
开发者ID:GitHublong,项目名称:XX-Net,代码行数:3,代码来源:win_tray.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mixins.SimpleVTKClassModuleBase类代码示例发布时间:2022-05-27
下一篇:
Python module_init.stop函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap