Commit e66675fc authored by sumpfralle's avatar sumpfralle

added various "help" buttons (linked to the wiki)

fixed visualization update of toolpath table changes


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1008 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 6c1bcd63
...@@ -39,16 +39,17 @@ ...@@ -39,16 +39,17 @@
<menuitem action="HelpModelTransformations"/> <menuitem action="HelpModelTransformations"/>
<menuitem action="HelpGCodeExport"/> <menuitem action="HelpGCodeExport"/>
<menuitem action="HelpSimulation"/> <menuitem action="HelpSimulation"/>
<menuitem action="Help3DView"/>
<menuitem action="HelpServerMode"/> <menuitem action="HelpServerMode"/>
<menuitem action="HelpCommandLine"/> <menuitem action="HelpCommandLine"/>
<menuitem action="HelpHotkeys"/> <menuitem action="HelpHotkeys"/>
<menuitem action="HelpTouchOff"/>
</menu> </menu>
<menu action="HelpMenuGUI"> <menu action="HelpMenuGUI">
<menuitem action="HelpToolTypes"/> <menuitem action="HelpToolTypes"/>
<menuitem action="HelpProcessSettings"/> <menuitem action="HelpProcessSettings"/>
<menuitem action="HelpBoundsSettings"/> <menuitem action="HelpBoundsSettings"/>
<menuitem action="HelpTaskSetup"/> <menuitem action="HelpTaskSetup"/>
<menuitem action="Help3DView"/>
</menu> </menu>
<separator /> <separator />
<menuitem action="ProjectWebsite"/> <menuitem action="ProjectWebsite"/>
......
This diff is collapsed.
...@@ -331,7 +331,7 @@ class ProjectGui: ...@@ -331,7 +331,7 @@ class ProjectGui:
("OpenModel", self.load_model_file, None, "<Control>o"), ("OpenModel", self.load_model_file, None, "<Control>o"),
("SaveModel", self.save_model, lambda: self.last_model_filename, "<Control>s"), ("SaveModel", self.save_model, lambda: self.last_model_filename, "<Control>s"),
("SaveAsModel", self.save_model, None, "<Control><Shift>s"), ("SaveAsModel", self.save_model, None, "<Control><Shift>s"),
("ExportGCodeAll", self.save_toolpath, None, "<Control><Shift>e"), ("ExportGCodeAll", self.save_toolpath, False, "<Control><Shift>e"),
("ExportGCodeVisible", self.save_toolpath, True, None), ("ExportGCodeVisible", self.save_toolpath, True, None),
("ExportEMCToolDefinition", self.export_emc_tools, None, None), ("ExportEMCToolDefinition", self.export_emc_tools, None, None),
("Quit", self.destroy, None, "<Control>q"), ("Quit", self.destroy, None, "<Control>q"),
...@@ -350,6 +350,7 @@ class ProjectGui: ...@@ -350,6 +350,7 @@ class ProjectGui:
("HelpBoundsSettings", self.show_help, "BoundsSettings", None), ("HelpBoundsSettings", self.show_help, "BoundsSettings", None),
("HelpTaskSetup", self.show_help, "TaskSetup", None), ("HelpTaskSetup", self.show_help, "TaskSetup", None),
("HelpGCodeExport", self.show_help, "GCodeExport", None), ("HelpGCodeExport", self.show_help, "GCodeExport", None),
("HelpTouchOff", self.show_help, "TouchOff", None),
("HelpSimulation", self.show_help, "Simulation", None), ("HelpSimulation", self.show_help, "Simulation", None),
("Help3DView", self.show_help, "3D_View", None), ("Help3DView", self.show_help, "3D_View", None),
("HelpServerMode", self.show_help, "ServerMode", None), ("HelpServerMode", self.show_help, "ServerMode", None),
...@@ -865,6 +866,10 @@ class ProjectGui: ...@@ -865,6 +866,10 @@ class ProjectGui:
self.gui.get_object("toolpath_crop").connect("clicked", self.toolpath_table_event, "crop") self.gui.get_object("toolpath_crop").connect("clicked", self.toolpath_table_event, "crop")
self.gui.get_object("ToolpathGrid").connect("clicked", self.toolpath_table_event, "grid") self.gui.get_object("ToolpathGrid").connect("clicked", self.toolpath_table_event, "grid")
self.gui.get_object("ExitSimulationButton").connect("clicked", self.finish_toolpath_simulation) self.gui.get_object("ExitSimulationButton").connect("clicked", self.finish_toolpath_simulation)
self.gui.get_object("ExportAllToolpathsButton").connect("clicked",
self.save_toolpath, False)
self.gui.get_object("ExportVisibleToolpathsButton").connect("clicked",
self.save_toolpath, True)
speed_factor_widget = self.gui.get_object("SimulationSpeedFactor") speed_factor_widget = self.gui.get_object("SimulationSpeedFactor")
self.settings.add_item("simulation_speed_factor", self.settings.add_item("simulation_speed_factor",
lambda: pow(10, speed_factor_widget.get_value()), lambda: pow(10, speed_factor_widget.get_value()),
...@@ -1149,6 +1154,7 @@ class ProjectGui: ...@@ -1149,6 +1154,7 @@ class ProjectGui:
self.update_ode_settings() self.update_ode_settings()
self.update_parallel_processes_settings() self.update_parallel_processes_settings()
self.update_model_type_related_controls() self.update_model_type_related_controls()
self.update_toolpath_related_controls()
def update_gcode_controls(self, widget=None): def update_gcode_controls(self, widget=None):
# path mode # path mode
...@@ -3350,8 +3356,9 @@ class ProjectGui: ...@@ -3350,8 +3356,9 @@ class ProjectGui:
path = None path = None
if (not path is None) and (path < len(self.toolpath)): if (not path is None) and (path < len(self.toolpath)):
self.toolpath[path].visible = not self.toolpath[path].visible self.toolpath[path].visible = not self.toolpath[path].visible
# hide/show toolpaths according to the new setting tp_model = self.toolpath_table.get_model()
self.update_view() tp_model[path][2] = self.toolpath[path].visible
self.update_toolpath_related_controls()
elif action == "simulate": elif action == "simulate":
index = self._treeview_get_active_index(self.toolpath_table, index = self._treeview_get_active_index(self.toolpath_table,
self.toolpath) self.toolpath)
...@@ -3372,7 +3379,7 @@ class ProjectGui: ...@@ -3372,7 +3379,7 @@ class ProjectGui:
self._treeview_button_event(self.toolpath_table, self.toolpath, self._treeview_button_event(self.toolpath_table, self.toolpath,
action, self.update_toolpath_table) action, self.update_toolpath_table)
# do some post-processing ... # do some post-processing ...
if action in ("delete", "crop", "grid"): if action in ("toggle_visibility", "delete", "crop", "grid"):
self.update_view() self.update_view()
def update_toolpath_grid_window(self, widget=None): def update_toolpath_grid_window(self, widget=None):
...@@ -3423,6 +3430,7 @@ class ProjectGui: ...@@ -3423,6 +3430,7 @@ class ProjectGui:
toolpath.visible = False toolpath.visible = False
new_toolpath.visible = True new_toolpath.visible = True
self.toolpath.append(new_toolpath) self.toolpath.append(new_toolpath)
self.update_toolpath_table()
dialog.hide() dialog.hide()
@progress_activity_guard @progress_activity_guard
...@@ -3443,14 +3451,7 @@ class ProjectGui: ...@@ -3443,14 +3451,7 @@ class ProjectGui:
self.update_progress_bar("Cropping the toolpath") self.update_progress_bar("Cropping the toolpath")
toolpath.crop(contour.get_polygons(), callback=self.update_progress_bar) toolpath.crop(contour.get_polygons(), callback=self.update_progress_bar)
def update_toolpath_table(self, new_index=None, skip_model_update=False): def update_toolpath_related_controls(self):
def get_time_string(minutes):
if minutes > 180:
return "%d hours" % int(round(minutes / 60))
elif minutes > 3:
return "%d minutes" % int(round(minutes))
else:
return "%d seconds" % int(round(minutes * 60))
# show or hide the "toolpath" tab # show or hide the "toolpath" tab
toolpath_tab = self.gui.get_object("ToolPathTab") toolpath_tab = self.gui.get_object("ToolPathTab")
if not self.toolpath: if not self.toolpath:
...@@ -3461,8 +3462,21 @@ class ProjectGui: ...@@ -3461,8 +3462,21 @@ class ProjectGui:
toolpath_tab.show() toolpath_tab.show()
# enable/disable the export menu item # enable/disable the export menu item
self.gui.get_object("ExportGCodeAll").set_sensitive(len(self.toolpath) > 0) self.gui.get_object("ExportGCodeAll").set_sensitive(len(self.toolpath) > 0)
visible_toolpaths = [tp for tp in self.toolpath if tp.visible] toolpaths_are_visible = any([tp.visible for tp in self.toolpath])
self.gui.get_object("ExportGCodeVisible").set_sensitive(len(visible_toolpaths) > 0) self.gui.get_object("ExportGCodeVisible").set_sensitive(
toolpaths_are_visible)
self.gui.get_object("ExportVisibleToolpathsButton").set_sensitive(
toolpaths_are_visible)
def update_toolpath_table(self, new_index=None, skip_model_update=False):
def get_time_string(minutes):
if minutes > 180:
return "%d hours" % int(round(minutes / 60))
elif minutes > 3:
return "%d minutes" % int(round(minutes))
else:
return "%d seconds" % int(round(minutes * 60))
self.update_toolpath_related_controls()
# reset the model data and the selection # reset the model data and the selection
if new_index is None: if new_index is None:
# keep the old selection - this may return "None" if nothing is selected # keep the old selection - this may return "None" if nothing is selected
......
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