Merged in sopak/flatcam (pull request #5)
cmdline options for shell direct inputfile
This commit is contained in:
commit
c66fd901a3
|
@ -1,6 +1,7 @@
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
import urllib
|
import urllib
|
||||||
|
import getopt
|
||||||
from copy import copy
|
from copy import copy
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
@ -34,6 +35,22 @@ class App(QtCore.QObject):
|
||||||
The main application class. The constructor starts the GUI.
|
The main application class. The constructor starts the GUI.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
## Get Cmd Line Options
|
||||||
|
|
||||||
|
cmd_line_shellfile=''
|
||||||
|
cmd_line_help="FlatCam.py --shellfile=<cmd_line_shellfile>"
|
||||||
|
try:
|
||||||
|
cmd_line_options, args = getopt.getopt(sys.argv[1:],"h:","shellfile=")
|
||||||
|
except getopt.GetoptError:
|
||||||
|
print cmd_line_help
|
||||||
|
sys.exit(2)
|
||||||
|
for opt, arg in cmd_line_options:
|
||||||
|
if opt == '-h':
|
||||||
|
print cmd_line_help
|
||||||
|
sys.exit()
|
||||||
|
elif opt == '--shellfile':
|
||||||
|
cmd_line_shellfile = arg
|
||||||
|
|
||||||
## Logging ##
|
## Logging ##
|
||||||
log = logging.getLogger('base')
|
log = logging.getLogger('base')
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
|
@ -428,6 +445,8 @@ class App(QtCore.QObject):
|
||||||
### Shell ###
|
### Shell ###
|
||||||
#############
|
#############
|
||||||
# TODO: Move this to its own class
|
# TODO: Move this to its own class
|
||||||
|
|
||||||
|
|
||||||
self.shell = FCShell(self)
|
self.shell = FCShell(self)
|
||||||
self.shell.setWindowIcon(self.ui.app_icon)
|
self.shell.setWindowIcon(self.ui.app_icon)
|
||||||
self.shell.setWindowTitle("FlatCAM Shell")
|
self.shell.setWindowTitle("FlatCAM Shell")
|
||||||
|
@ -439,6 +458,15 @@ class App(QtCore.QObject):
|
||||||
self.tcl = Tkinter.Tcl()
|
self.tcl = Tkinter.Tcl()
|
||||||
self.setup_shell()
|
self.setup_shell()
|
||||||
|
|
||||||
|
if self.cmd_line_shellfile:
|
||||||
|
try:
|
||||||
|
with open (self.cmd_line_shellfile, "r") as myfile:
|
||||||
|
cmd_line_shellfile_text=myfile.read()
|
||||||
|
self.shell._sysShell.exec_command(cmd_line_shellfile_text)
|
||||||
|
except Exception as ext:
|
||||||
|
print "ERROR: ",ext
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
App.log.debug("END of constructor. Releasing control.")
|
App.log.debug("END of constructor. Releasing control.")
|
||||||
|
|
||||||
def defaults_read_form(self):
|
def defaults_read_form(self):
|
||||||
|
|
Loading…
Reference in New Issue