Commit 71dbaaff authored by sumpfralle's avatar sumpfralle

show the name of the currently loaded stl model in the window title


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@581 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent b8cdc088
...@@ -669,6 +669,19 @@ class ProjectGui: ...@@ -669,6 +669,19 @@ class ProjectGui:
self.view3d.glsetup() self.view3d.glsetup()
self.view3d.paint() self.view3d.paint()
def set_model_filename(self, filename):
""" Store the given filename for a possible later "save model" action.
Additionally the window's title is adjusted and the "save" buttons are
updated.
"""
self.last_model_file = filename
if self.last_model_file is None:
self.window.set_title("PyCAM")
else:
short_name = os.path.basename(filename)
self.window.set_title("PyCAM - %s" % short_name)
self.update_save_actions()
def update_save_actions(self): def update_save_actions(self):
self.gui.get_object("SaveTaskSettings").set_sensitive(not self.last_task_settings_file is None) self.gui.get_object("SaveTaskSettings").set_sensitive(not self.last_task_settings_file is None)
save_as_possible = (not self.model is None) \ save_as_possible = (not self.model is None) \
...@@ -1557,8 +1570,7 @@ class ProjectGui: ...@@ -1557,8 +1570,7 @@ class ProjectGui:
filename = self.get_filename_via_dialog("Save model to ...", filename = self.get_filename_via_dialog("Save model to ...",
mode_load=False, type_filter=FILTER_MODEL) mode_load=False, type_filter=FILTER_MODEL)
if filename: if filename:
self.last_model_file = filename self.set_model_filename(filename)
self.update_save_actions()
# no filename given -> exit # no filename given -> exit
if not filename: if not filename:
return return
...@@ -1767,10 +1779,9 @@ class ProjectGui: ...@@ -1767,10 +1779,9 @@ class ProjectGui:
if filename: if filename:
file_type, importer = pycam.Importers.detect_file_type(filename) file_type, importer = pycam.Importers.detect_file_type(filename)
if file_type and callable(importer): if file_type and callable(importer):
self.last_model_file = filename
# TODO: get the "program_locations" # TODO: get the "program_locations"
self.load_model(importer(filename, program_locations=None)) self.load_model(importer(filename, program_locations=None))
self.update_save_actions() self.set_model_filename(filename)
else: else:
log.error("Failed to detect filetype!") log.error("Failed to detect filetype!")
......
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