本文整理汇总了Python中module_init.start_all_auto函数的典型用法代码示例。如果您正苦于以下问题:Python start_all_auto函数的具体用法?Python start_all_auto怎么用?Python start_all_auto使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了start_all_auto函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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()
示例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__)))
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()
示例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()
示例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__)))
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()
示例5: 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__)))
if sys.platform == "win32" and config.get(["show_compat_suggest"], 1):
import win_compat_suggest
win_compat_suggest.main()
current_version = update_from_github.current_version()
xlog.info("start XX-Net %s", current_version)
web_control.confirm_xxnet_not_running()
setup_win_python.check_setup()
import post_update
post_update.check()
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://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)
示例6: on_restart_each_module
def on_restart_each_module(self, widget=None, data=None):
module_init.stop_all()
module_init.start_all_auto()
示例7: on_restart_gae_proxy
def on_restart_gae_proxy(self, widget=None, data=None):
module_init.stop_all()
module_init.start_all_auto()
示例8: on_restart_goagent
def on_restart_goagent(self, widget=None, data=None):
module_init.stop_all()
module_init.start_all_auto()
示例9: 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"):
launcher_log.warn("web control ref:%s refuse", netloc)
return
except:
pass
# 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')
launcher_log.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()
url_path_list = self.path.split('/')
if len(url_path_list) >= 3 and url_path_list[1] == "module":
module = url_path_list[2]
if len(url_path_list) >= 4 and url_path_list[3] == "control":
if module not in module_init.proc_handler:
launcher_log.warn("request %s no module in path", url_path)
self.send_not_found()
return
path = '/' + '/'.join(url_path_list[4:])
controler = module_init.proc_handler[module]["imp"].local.web_control.ControlHandler(self.client_address, self.headers, self.command, path, self.rfile, self.wfile)
controler.do_GET()
return
else:
file_path = os.path.join(root_path, module, url_path_list[3:].join('/'))
else:
file_path = os.path.join(current_path, 'web_ui' + url_path)
launcher_log.debug ('launcher web_control %s %s %s ', self.address_string(), self.command, self.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 == '/log':
self.req_log_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"}')
module_init.stop_all()
module_init.start_all_auto()
else:
self.wfile.write(b'HTTP/1.1 404\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n404 Not Found')
launcher_log.info('%s "%s %s HTTP/1.1" 404 -', self.address_string(), self.command, self.path)
示例10: req_config_handler
#.........这里部分代码省略.........
config.set(["modules", "launcher", "popup_webui"], popup_webui)
config.save()
data = '{"res":"success"}'
elif 'allow_remote_switch' in reqs:
allow_remote_switch = int(reqs['allow_remote_switch'][0])
if allow_remote_switch != 0 and allow_remote_switch != 1:
data = '{"res":"fail, allow_remote_connect:%s"}' % allow_remote_switch
else:
config.set(["modules", "launcher", "allow_remote_connect"], allow_remote_switch)
config.save()
try:
del module_init.xargs["allow_remote"]
except:
pass
if allow_remote_switch:
module_init.call_each_module("set_bind_ip", {
"ip": "0.0.0.0"
})
else:
module_init.call_each_module("set_bind_ip", {
"ip": "127.0.0.1"
})
data = '{"res":"success"}'
xlog.debug("restart web control.")
stop()
module_init.stop_all()
time.sleep(1)
start()
module_init.start_all_auto()
xlog.debug("launcher web control restarted.")
elif 'show_systray' in reqs:
show_systray = int(reqs['show_systray'][0])
if show_systray != 0 and show_systray != 1:
data = '{"res":"fail, show_systray:%s"}' % show_systray
else:
config.set(["modules", "launcher", "show_systray"], show_systray)
config.save()
data = '{"res":"success"}'
elif 'show_compat_suggest' in reqs:
show_compat_suggest = int(reqs['show_compat_suggest'][0])
if show_compat_suggest != 0 and show_compat_suggest != 1:
data = '{"res":"fail, show_compat_suggest:%s"}' % show_compat_suggest
else:
config.set(["show_compat_suggest"], show_compat_suggest)
config.save()
data = '{"res":"success"}'
elif 'no_mess_system' in reqs:
no_mess_system = int(reqs['no_mess_system'][0])
if no_mess_system != 0 and no_mess_system != 1:
data = '{"res":"fail, no_mess_system:%s"}' % no_mess_system
else:
config.set(["no_mess_system"], no_mess_system)
config.save()
data = '{"res":"success"}'
elif 'keep_old_ver_num' in reqs:
keep_old_ver_num = int(reqs['keep_old_ver_num'][0])
if keep_old_ver_num < 0 or keep_old_ver_num > 99:
data = '{"res":"fail, keep_old_ver_num:%s not in range 0 to 99"}' % keep_old_ver_num
示例11: restartEachModule_
def restartEachModule_(self, _):
module_init.stop_all()
module_init.start_all_auto()
示例12: on_reset
def on_reset(self, _):
module_init.stop_all()
module_init.start_all_auto()