📄 genconfig.py
字号:
"""genconfig.py - Interactive web-based HarvestMan configurationfile generator using web.py .Created Anand B Pillai <abpillai at gmail dot com> May 29 2008Modified Anand B Pillai Moved most code to lib/gui.py Jun 01 2008 and trimmed this modul.eModified Lukasz Szybalski Created main function and will be added to harvestman menu as harvestman --genconfig.Copyright (C) 2008 Anand B Pillai."""import sysimport webbrowserimport threadingimport timeimport webfrom harvestman.lib import guiindex = gui.HarvestManConfigGeneratorurls = ('/', 'index')def open_page(): print 'Opening page...' webbrowser.open("http://localhost:5940")if __name__=="__main__": sys.argv.append("5940") print "Starting web.py at port 5940..." web.internalerror = web.debugerror # Start timer thread to run after 5 seconds print 'Waiting for page to load in browser...' threading.Timer(5.0, open_page).start() web.run(urls, globals(), web.reloader)#Allows to be imported and rundef main(): #if __name__=="__main__": #sys.argv.append("5940") #Because web.py expects the port to be passed on argv[1] I will replace it here. The original argv[1] is '--genconf' sys.argv[1]='5940' print "Starting web.py at port 5940..." web.internalerror = web.debugerror # Start timer thread to run after 5 seconds print 'Waiting for page to load in browser...' threading.Timer(5.0, open_page).start() web.run(urls, globals(), web.reloader)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -