Commit b7eb3665 authored by sumpfralle's avatar sumpfralle

r687@erker: lars | 2010-02-18 23:08:01 +0100

 make the GTK interface the default (TkInter can be selected via "--tk")
 fall back to the alternative, if the first choice is unavailable


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@145 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 97144a7c
......@@ -13,8 +13,11 @@ if __name__ == "__main__":
action="store_true", default=False,
help="don't create the outputfile on the fly - just preset the output filename and show the GUI")
parser.add_option("", "--gtk", dest="gtk_gui",
action="store_true", default=False,
help="use the new GTK interface")
action="store_true", default=True,
help="use the new GTK interface (default)")
parser.add_option("", "--tk", dest="gtk_gui",
action="store_false",
help="use the (old) Tk interface")
(options, args) = parser.parse_args()
if len(args) > 0:
......@@ -24,20 +27,37 @@ if __name__ == "__main__":
if len(args) > 2:
parser.error("too many arguments given (%d instead of %d)" % (len(args), 2))
# try the configured interface first and then try to fall back to the alternative, if necessary
if options.gtk_gui:
try:
from pycam.Gui.Project import ProjectGui
except ImportError, err_msg:
print sys.stderr, "Failed to load GTK bindings for python. Please install the package 'python-gtk2'."
print sys.stderr, "Details: %s" % str(err_msg)
gui = ProjectGui()
except ImportError, err_msg:
print >> sys.stderr, "Failed to load GTK bindings for python. Please install the package 'python-gtk2'."
print >> sys.stderr, "Details: %s" % str(err_msg)
print >> sys.stderr, "I will try to use the alternative Tk interface now ..."
try:
from pycam.Gui.SimpleGui import SimpleGui
gui = SimpleGui()
except ImportError:
gui = None
else:
try:
from pycam.Gui.SimpleGui import SimpleGui
except ImportError, err_msg:
print sys.stderr, "Failed to load TkInter bindings for python. Please install the package 'python-tk'."
print sys.stderr, "Details: %s" % str(err_msg)
gui = SimpleGui()
except ImportError, err_msg:
print >> sys.stderr, "Failed to load TkInter bindings for python. Please install the package 'python-tk'."
print >> sys.stderr, "Details: %s" % str(err_msg)
print >> sys.stderr, "I will try to use the alternative GTK interface now ..."
try:
from pycam.Gui.Project import ProjectGui
gui = ProjectGui()
except ImportError:
gui = None
# exit if no interface is found
if gui is None:
print >> sys.stderr, "Neither the GTK nor the Tk interface is available. Please install the corresponding packages!"
sys.exit(1)
if not inputfile:
from pycam.Importers.TestModel import TestModel
......
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