Commit e1660bd7 authored by D1plo1d's avatar D1plo1d

Removing the web interface bindings from pronsole and pronterface

parent 47f75d10
...@@ -227,9 +227,6 @@ class pronsole(cmd.Cmd): ...@@ -227,9 +227,6 @@ class pronsole(cmd.Cmd):
self.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)") self.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)")
self.helpdict["final_command"] = _("Executable to run when the print is finished") self.helpdict["final_command"] = _("Executable to run when the print is finished")
self.commandprefixes='MGT$' self.commandprefixes='MGT$'
self.webrequested = False
self.web_config = None
self.web_auth_config = None
def set_temp_preset(self, key, value): def set_temp_preset(self, key, value):
if not key.startswith("bed"): if not key.startswith("bed"):
...@@ -1167,17 +1164,11 @@ class pronsole(cmd.Cmd): ...@@ -1167,17 +1164,11 @@ class pronsole(cmd.Cmd):
def parse_cmdline(self, args): def parse_cmdline(self, args):
import getopt import getopt
opts, args = getopt.getopt(args, "c:e:hw", ["conf = ", "config = ", "help", "web", "web-config = ", "web-auth-config = "]) opts, args = getopt.getopt(args, "c:e:hw", ["conf = ", "config = ", "help"])
for o, a in opts: for o, a in opts:
#print repr((o, a)) #print repr((o, a))
if o in ("-c", "--conf", "--config"): if o in ("-c", "--conf", "--config"):
self.load_rc(a) 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"): elif o in ("-h", "--help"):
print "Usage: "+sys.argv[0]+' [-c filename [-c filename2 ... ] ] [-e "command" ...]' print "Usage: "+sys.argv[0]+' [-c filename [-c filename2 ... ] ] [-e "command" ...]'
print " -c | --conf | --config - override startup .pronsolerc file" print " -c | --conf | --config - override startup .pronsolerc file"
......
...@@ -168,21 +168,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -168,21 +168,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.predisconnect_layer = None self.predisconnect_layer = None
self.hsetpoint = 0.0 self.hsetpoint = 0.0
self.bsetpoint = 0.0 self.bsetpoint = 0.0
self.webInterface = None
if self.webrequested:
try :
import cherrypy
from printrun import webinterface
try:
self.webInterface = webinterface.WebInterface(self)
self.webThread = threading.Thread(target = webinterface.StartWebInterfaceThread, args = (self.webInterface, ))
self.webThread.start()
except:
print _("Failed to start web interface")
traceback.print_exc(file = sys.stdout)
self.webInterface = None
except:
print _("CherryPy is not installed. Web Interface Disabled.")
if self.filename is not None: if self.filename is not None:
self.do_load(self.filename) self.do_load(self.filename)
...@@ -334,8 +319,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -334,8 +319,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
print _("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0.") print _("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0.")
except Exception, x: except Exception, x:
print _("You must enter a temperature. (%s)") % (repr(x),) print _("You must enter a temperature. (%s)") % (repr(x),)
if self.webInterface:
self.webInterface.AddLog("You must enter a temperature. (%s)" % (repr(x),))
def do_bedtemp(self, l = ""): def do_bedtemp(self, l = ""):
try: try:
...@@ -352,16 +335,10 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -352,16 +335,10 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.setbedgui(f) self.setbedgui(f)
else: else:
print _("Printer is not online.") print _("Printer is not online.")
if self.webInterface:
self.webInterface.AddLog("Printer is not online.")
else: else:
print _("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0.") print _("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0.")
if self.webInterface:
self.webInterface.AddLog("You cannot set negative temperatures. To turn the bed off entirely, set its temperature to 0.")
except Exception, x: except Exception, x:
print _("You must enter a temperature. (%s)") % (repr(x),) print _("You must enter a temperature. (%s)") % (repr(x),)
if self.webInterface:
self.webInterface.AddLog("You must enter a temperature.")
def end_macro(self): def end_macro(self):
pronsole.pronsole.end_macro(self) pronsole.pronsole.end_macro(self)
...@@ -381,8 +358,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -381,8 +358,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.delete_macro(macro_name) self.delete_macro(macro_name)
return return
print _("Cancelled.") print _("Cancelled.")
if self.webInterface:
self.webInterface.AddLog("Cancelled.")
return return
self.cur_macro_name = macro_name self.cur_macro_name = macro_name
self.cur_macro_def = definition self.cur_macro_def = definition
...@@ -422,8 +397,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -422,8 +397,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
projectlayer.setframe(self,self.p).Show() projectlayer.setframe(self,self.p).Show()
else: else:
print _("Printer is not online.") print _("Printer is not online.")
if self.webInterface:
self.webInterface.AddLog("Printer is not online.")
def popmenu(self): def popmenu(self):
self.menustrip = wx.MenuBar() self.menustrip = wx.MenuBar()
...@@ -500,8 +473,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -500,8 +473,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
old_def = self.macros[macro] old_def = self.macros[macro]
elif len([c for c in macro.encode("ascii", "replace") if not c.isalnum() and c != "_"]): elif len([c for c in macro.encode("ascii", "replace") if not c.isalnum() and c != "_"]):
print _("Macro name may contain only ASCII alphanumeric symbols and underscores") print _("Macro name may contain only ASCII alphanumeric symbols and underscores")
if self.webInterface:
self.webInterface.AddLog("Macro name may contain only alphanumeric symbols and underscores")
return return
elif hasattr(self.__class__, "do_"+macro): elif hasattr(self.__class__, "do_"+macro):
print _("Name '%s' is being used by built-in command") % macro print _("Name '%s' is being used by built-in command") % macro
...@@ -683,8 +654,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -683,8 +654,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def help_button(self): def help_button(self):
print _('Defines custom button. Usage: button <num> "title" [/c "colour"] command') print _('Defines custom button. Usage: button <num> "title" [/c "colour"] command')
if self.webInterface:
self.webInterface.AddLog('Defines custom button. Usage: button <num> "title" [/c "colour"] command')
def do_button(self, argstr): def do_button(self, argstr):
def nextarg(rest): def nextarg(rest):
...@@ -707,8 +676,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -707,8 +676,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
command = argstr.strip() command = argstr.strip()
if num<0 or num>=64: if num<0 or num>=64:
print _("Custom button number should be between 0 and 63") print _("Custom button number should be between 0 and 63")
if self.webInterface:
self.webInterface.AddLog("Custom button number should be between 0 and 63")
return return
while num >= len(self.custombuttons): while num >= len(self.custombuttons):
self.custombuttons.append(None) self.custombuttons.append(None)
...@@ -974,8 +941,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -974,8 +941,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.cur_button = None self.cur_button = None
except: except:
print _("event object missing") print _("event object missing")
if self.webInterface:
self.webInterface.AddLog("event object missing")
self.cur_button = None self.cur_button = None
raise raise
...@@ -995,9 +960,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -995,9 +960,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
except: except:
pass pass
self.Destroy() self.Destroy()
if self.webInterface:
from printrun import webinterface
webinterface.KillWebInterfaceThread()
def do_monitor(self, l = ""): def do_monitor(self, l = ""):
if l.strip()=="": if l.strip()=="":
...@@ -1010,17 +972,11 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1010,17 +972,11 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx.CallAfter(self.monitorbox.SetValue, self.monitor_interval>0) wx.CallAfter(self.monitorbox.SetValue, self.monitor_interval>0)
except: except:
print _("Invalid period given.") print _("Invalid period given.")
if self.webInterface:
self.webInterface.AddLog("Invalid period given.")
self.setmonitor(None) self.setmonitor(None)
if self.monitor: if self.monitor:
print _("Monitoring printer.") print _("Monitoring printer.")
if self.webInterface:
self.webInterface.AddLog("Monitoring printer.")
else: else:
print _("Done monitoring.") print _("Done monitoring.")
if self.webInterface:
self.webInterface.AddLog("Done monitoring.")
def setmonitor(self, e): def setmonitor(self, e):
self.monitor = self.monitorbox.GetValue() self.monitor = self.monitorbox.GetValue()
...@@ -1035,8 +991,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1035,8 +991,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
except: except:
print "attempted to write invalid text to console" print "attempted to write invalid text to console"
pass pass
if self.webInterface:
self.webInterface.AppendLog(text)
def setloud(self,e): def setloud(self,e):
self.p.loud=e.IsChecked() self.p.loud=e.IsChecked()
...@@ -1199,8 +1153,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1199,8 +1153,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
import shlex import shlex
param = self.expandcommand(self.settings.slicecommand).encode() param = self.expandcommand(self.settings.slicecommand).encode()
print "Slicing: ", param print "Slicing: ", param
if self.webInterface:
self.webInterface.AddLog("Slicing: "+param)
pararray = [i.replace("$s", self.filename).replace("$o", self.filename.replace(".stl", "_export.gcode").replace(".STL", "_export.gcode")).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())] pararray = [i.replace("$s", self.filename).replace("$o", self.filename.replace(".stl", "_export.gcode").replace(".STL", "_export.gcode")).encode() for i in shlex.split(param.replace("\\", "\\\\").encode())]
#print pararray #print pararray
self.skeinp = subprocess.Popen(pararray, stderr = subprocess.STDOUT, stdout = subprocess.PIPE) self.skeinp = subprocess.Popen(pararray, stderr = subprocess.STDOUT, stdout = subprocess.PIPE)
...@@ -1212,8 +1164,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1212,8 +1164,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.stopsf = 1 self.stopsf = 1
except: except:
print _("Failed to execute slicing software: ") print _("Failed to execute slicing software: ")
if self.webInterface:
self.webInterface.AddLog("Failed to execute slicing software: ")
self.stopsf = 1 self.stopsf = 1
traceback.print_exc(file = sys.stdout) traceback.print_exc(file = sys.stdout)
...@@ -1306,8 +1256,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1306,8 +1256,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
Xtot, Ytot, Ztot, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax = pronsole.measurements(self.f) Xtot, Ytot, Ztot, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax = pronsole.measurements(self.f)
print pronsole.totalelength(self.f), _("mm of filament used in this print\n") print pronsole.totalelength(self.f), _("mm of filament used in this print\n")
print _("the print goes from %f mm to %f mm in X\nand is %f mm wide\n") % (Xmin, Xmax, Xtot) print _("the print goes from %f mm to %f mm in X\nand is %f mm wide\n") % (Xmin, Xmax, Xtot)
if self.webInterface:
self.webInterface.AddLog(_("the print goes from %f mm to %f mm in X\nand is %f mm wide\n") % (Xmin, Xmax, Xtot))
print _("the print goes from %f mm to %f mm in Y\nand is %f mm wide\n") % (Ymin, Ymax, Ytot) print _("the print goes from %f mm to %f mm in Y\nand is %f mm wide\n") % (Ymin, Ymax, Ytot)
print _("the print goes from %f mm to %f mm in Z\nand is %f mm high\n") % (Zmin, Zmax, Ztot) print _("the print goes from %f mm to %f mm in Z\nand is %f mm high\n") % (Zmin, Zmax, Ztot)
try: try:
......
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