Commit 72173c60 authored by Guillaume Seguin's avatar Guillaume Seguin

Add CLI parameters for web config files location (if not in ~/.printrun or cwd)

Also remove the chdir() to pronterface.py directory
parent cc60367a
......@@ -241,7 +241,7 @@ class WebInterface(object):
config = ConfigParser.SafeConfigParser(allow_no_value=True)
else:
config = ConfigParser.SafeConfigParser()
config.read(configfile('auth.config'))
config.read(configfile(pface.web_auth_config or 'auth.config'))
users[config.get("user", "user")] = config.get("user", "pass")
self.pface = pface
global gPronterPtr
......@@ -361,7 +361,7 @@ def KillWebInterfaceThread():
def StartWebInterfaceThread(webInterface):
current_dir = os.path.dirname(os.path.abspath(__file__))
cherrypy.config.update({'engine.autoreload_on':False})
cherrypy.config.update(configfile("http.config"))
cherrypy.config.update(configfile(webInterface.pface.web_config or "http.config"))
conf = {'/css/style.css': {'tools.staticfile.on': True,
'tools.staticfile.filename': sharedfile('css/style.css'),
},
......@@ -371,7 +371,7 @@ def StartWebInterfaceThread(webInterface):
'/images/control_z.png': {'tools.staticfile.on': True,
'tools.staticfile.filename': imagefile('control_z.png'),
}}
cherrypy.config.update(configfile("http.config"))
cherrypy.config.update(configfile(webInterface.pface.web_config or "http.config"))
cherrypy.quickstart(webInterface, '/', config=conf)
if __name__ == '__main__':
......
......@@ -277,6 +277,8 @@ class pronsole(cmd.Cmd):
self.helpdict["final_command"] = _("Executable to run when the print is finished")
self.commandprefixes='MGT$'
self.webrequested=False
self.web_config=None
self.web_auth_config=None
def set_temp_preset(self,key,value):
if not key.startswith("bed"):
......@@ -1211,13 +1213,17 @@ class pronsole(cmd.Cmd):
def parse_cmdline(self,args):
import getopt
opts,args = getopt.getopt(args, "c:e:h:w", ["conf=","config=","help","web"])
opts,args = getopt.getopt(args, "c:e:hw", ["conf=","config=","help","web","web-config=", "web-auth-config="])
for o,a in opts:
#print repr((o,a))
if o in ("-c","--conf","--config"):
self.load_rc(a)
elif o in ("-w","--web"):
self.webrequested = True
elif o == "--web-config":
self.web_config = a
elif o == "--web-auth-config":
self.web_auth_config = a
elif o in ("-h","--help"):
print "Usage: "+sys.argv[0]+' [-c filename [-c filename2 ... ] ] [-e "command" ...]'
print " -c | --conf | --config - override startup .pronsolerc file"
......
......@@ -28,10 +28,7 @@ except:
print _("WX is not installed. This program requires WX to run.")
raise
import sys, glob, time, threading, traceback, cStringIO, subprocess
try:
os.chdir(os.path.split(__file__)[0])
except:
pass
StringIO=cStringIO
thread=threading.Thread
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment