Commit 7fc0f1c4 authored by Guillaume Seguin's avatar Guillaume Seguin

Add -g/--gauges CLI argument for temp gauges, and improved argparsing.

The gauges options is a CLI parameter as having it as an option would be
too painful to handle for now.
Argument parsing has been improved so that pronterface can add its own CLI
parameters in addition to pronsole's ones.
parent 90e32562
...@@ -165,7 +165,6 @@ class LeftPane(wx.GridBagSizer): ...@@ -165,7 +165,6 @@ class LeftPane(wx.GridBagSizer):
root.zfeedc.SetBackgroundColour((180, 255, 180)) root.zfeedc.SetBackgroundColour((180, 255, 180))
root.zfeedc.SetForegroundColour("black") root.zfeedc.SetForegroundColour("black")
root.display_gauges = True # FIXME : move to options or CLI options
if root.display_gauges: if root.display_gauges:
root.hottgauge = TempGauge(root.panel, size = (200, 24), title = _("Heater:"), maxval = 300) root.hottgauge = TempGauge(root.panel, size = (200, 24), title = _("Heater:"), maxval = 300)
self.Add(root.hottgauge, pos = (6, 0), span = (1, 6)) self.Add(root.hottgauge, pos = (6, 0), span = (1, 6))
......
...@@ -1207,12 +1207,12 @@ class pronsole(cmd.Cmd): ...@@ -1207,12 +1207,12 @@ class pronsole(cmd.Cmd):
self.log("home e - set extruder position to zero (Using G92)") self.log("home e - set extruder position to zero (Using G92)")
self.log("home xyze - homes all axes and zeroes the extruder (Using G28 and G92)") self.log("home xyze - homes all axes and zeroes the extruder (Using G28 and G92)")
def parse_cmdline(self, args): def add_cmdline_arguments(self, parser):
parser = argparse.ArgumentParser(description = 'Printrun 3D printer interface')
parser.add_argument('-c','--conf','--config', help = _("load this file on startup instead of .pronsolerc ; you may chain config files, if so settings auto-save will use the last specified file"), action = "append", default = []) parser.add_argument('-c','--conf','--config', help = _("load this file on startup instead of .pronsolerc ; you may chain config files, if so settings auto-save will use the last specified file"), action = "append", default = [])
parser.add_argument('-e','--execute', help = _("executes command after configuration/.pronsolerc is loaded ; macros/settings from these commands are not autosaved"), action = "append", default = []) parser.add_argument('-e','--execute', help = _("executes command after configuration/.pronsolerc is loaded ; macros/settings from these commands are not autosaved"), action = "append", default = [])
parser.add_argument('filename', nargs='?', help = _("file to load")) parser.add_argument('filename', nargs='?', help = _("file to load"))
args = parser.parse_args()
def process_cmdline_arguments(self, args):
for config in args.conf: for config in args.conf:
self.load_rc(config) self.load_rc(config)
if not self.rc_loaded: if not self.rc_loaded:
...@@ -1224,6 +1224,12 @@ class pronsole(cmd.Cmd): ...@@ -1224,6 +1224,12 @@ class pronsole(cmd.Cmd):
if args.filename: if args.filename:
self.do_load(args.filename) self.do_load(args.filename)
def parse_cmdline(self, args):
parser = argparse.ArgumentParser(description = 'Printrun 3D printer interface')
self.add_cmdline_arguments(parser)
args = parser.parse_args()
self.process_cmdline_arguments(args)
# We replace this function, defined in cmd.py . # We replace this function, defined in cmd.py .
# It's default behavior with reagrds to Ctr-C # It's default behavior with reagrds to Ctr-C
# and Ctr-D doesn't make much sense... # and Ctr-D doesn't make much sense...
......
...@@ -198,6 +198,14 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -198,6 +198,14 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.filename is not None: if self.filename is not None:
self.do_load(self.filename) self.do_load(self.filename)
def add_cmdline_arguments(self, parser):
pronsole.pronsole.add_cmdline_arguments(self, parser)
parser.add_argument('-g','--gauges', help = _("display graphical temperature gauges in addition to the temperatures graph"), action = "store_true")
def process_cmdline_arguments(self, args):
pronsole.pronsole.process_cmdline_arguments(self, args)
self.display_gauges = args.gauges
def startcb(self): def startcb(self):
self.starttime = time.time() self.starttime = time.time()
print "Print Started at: " + format_time(self.starttime) print "Print Started at: " + format_time(self.starttime)
......
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