Commit a54ad3e7 authored by sumpfralle's avatar sumpfralle

moved simulation interface to a separate tab


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@327 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent c6f0edc9
...@@ -297,7 +297,7 @@ class ProjectGui: ...@@ -297,7 +297,7 @@ class ProjectGui:
self.gui.get_object("toolpath_down").connect("clicked", self.toolpath_table_event, "move_down") self.gui.get_object("toolpath_down").connect("clicked", self.toolpath_table_event, "move_down")
self.gui.get_object("toolpath_delete").connect("clicked", self.toolpath_table_event, "delete") self.gui.get_object("toolpath_delete").connect("clicked", self.toolpath_table_event, "delete")
self.gui.get_object("toolpath_simulate").connect("clicked", self.toolpath_table_event, "simulate") self.gui.get_object("toolpath_simulate").connect("clicked", self.toolpath_table_event, "simulate")
self.gui.get_object("ExitSimulationButton").connect("clicked", self.hide_toolpath_simulation) self.gui.get_object("ExitSimulationButton").connect("clicked", self.finish_toolpath_simulation)
self.gui.get_object("UpdateSimulationButton").connect("clicked", self.update_toolpath_simulation) self.gui.get_object("UpdateSimulationButton").connect("clicked", self.update_toolpath_simulation)
# store the original content (for adding the number of current toolpaths in "update_toolpath_table") # store the original content (for adding the number of current toolpaths in "update_toolpath_table")
self._original_toolpath_tab_label = self.gui.get_object("ToolPathTabLabel").get_text() self._original_toolpath_tab_label = self.gui.get_object("ToolPathTabLabel").get_text()
...@@ -1355,9 +1355,12 @@ class ProjectGui: ...@@ -1355,9 +1355,12 @@ class ProjectGui:
def cancel_progress(self, widget=None): def cancel_progress(self, widget=None):
self._progress_cancel_requested = True self._progress_cancel_requested = True
def hide_toolpath_simulation(self, widget=None): def finish_toolpath_simulation(self, widget=None):
self.gui.get_object("SimulationWidget").hide() # hide the simulation tab
self.task_pane.set_sensitive(True) self.gui.get_object("SimulationTab").hide()
# enable all other tabs again
for objname in ("ModelTab", "ModelTabLabel", "TasksTab", "TasksTabLabel", "ToolPathTab", "ToolPathTabLabel"):
self.gui.get_object(objname).set_sensitive(True)
self.settings.set("simulate_object", None) self.settings.set("simulate_object", None)
self.settings.set("show_simulation", False) self.settings.set("show_simulation", False)
self.update_view() self.update_view()
...@@ -1388,7 +1391,7 @@ class ProjectGui: ...@@ -1388,7 +1391,7 @@ class ProjectGui:
self.settings.set("simulation_object", simulation_backend) self.settings.set("simulation_object", simulation_backend)
# disable the simulation widget (avoids confusion regarding "cancel") # disable the simulation widget (avoids confusion regarding "cancel")
if not widget is None: if not widget is None:
self.gui.get_object("SimulationWidget").set_sensitive(False) self.gui.get_object("SimulationTab").set_sensitive(False)
# update the view # update the view
self.update_view() self.update_view()
# calculate the simulation and show it simulteneously # calculate the simulation and show it simulteneously
...@@ -1414,20 +1417,22 @@ class ProjectGui: ...@@ -1414,20 +1417,22 @@ class ProjectGui:
break break
# enable the simulation widget again (if we were started from the GUI) # enable the simulation widget again (if we were started from the GUI)
if not widget is None: if not widget is None:
self.gui.get_object("SimulationWidget").set_sensitive(True) self.gui.get_object("SimulationTab").set_sensitive(True)
def show_toolpath_simulation(self, toolpath): def show_toolpath_simulation(self, toolpath):
# disable the main controls # disable the main controls
for objname in ("ModelTab", "ModelTabLabel", "TasksTab", "TasksTabLabel", "ToolPathTab", "ToolPathTabLabel"):
self.gui.get_object(objname).set_sensitive(False)
# show the simulation controls
self.gui.get_object("SimulationTab").show()
# switch to the simulation tab
self.gui.get_object("MainTabs").set_current_page(3)
# start the simulation
self.settings.set("show_simulation", True) self.settings.set("show_simulation", True)
self.update_toolpath_simulation(toolpath=toolpath) self.update_toolpath_simulation(toolpath=toolpath)
# disable the task pane _after_ the simulation - the progress bar
# decorator code would reset it otherwise
self.task_pane.set_sensitive(False)
# show the simulation controls
self.gui.get_object("SimulationWidget").show()
# hide the controls immediately, if the simulation was cancelled # hide the controls immediately, if the simulation was cancelled
if self._progress_cancel_requested: if self._progress_cancel_requested:
self.hide_toolpath_simulation() self.finish_toolpath_simulation()
@progress_activity_guard @progress_activity_guard
def generate_toolpath(self, tool_settings, process_settings): def generate_toolpath(self, tool_settings, process_settings):
......
...@@ -1091,7 +1091,7 @@ ...@@ -1091,7 +1091,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkVBox" id="vbox17"> <object class="GtkVBox" id="TasksTab">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">3</property> <property name="spacing">3</property>
...@@ -1519,7 +1519,7 @@ This combination is added to the above task list.</property> ...@@ -1519,7 +1519,7 @@ This combination is added to the above task list.</property>
</packing> </packing>
</child> </child>
<child type="tab"> <child type="tab">
<object class="GtkLabel" id="TaskTab"> <object class="GtkLabel" id="TasksTabLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Tasks</property> <property name="label" translatable="yes">Tasks</property>
</object> </object>
...@@ -1742,13 +1742,8 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -1742,13 +1742,8 @@ This feature requires the Open Dynamics Engine (ODE).</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<object class="GtkFrame" id="SimulationWidget"> <object class="GtkFrame" id="SimulationTab">
<property name="label_xalign">0</property> <property name="label_xalign">0</property>
<property name="shadow_type">none</property> <property name="shadow_type">none</property>
<child> <child>
...@@ -1756,46 +1751,9 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -1756,46 +1751,9 @@ This feature requires the Open Dynamics Engine (ODE).</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<object class="GtkTable" id="SimulationWidgetTable"> <object class="GtkVBox" id="vbox23">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">4</property>
<property name="row_spacing">2</property>
<child>
<object class="GtkButton" id="UpdateSimulationButton">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Run the simulation again</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkButton" id="ExitSimulationButton">
<property name="label">gtk-close</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="orientation">vertical</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Leave simulation mode</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<object class="GtkHBox" id="hbox20"> <object class="GtkHBox" id="hbox20">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -1827,8 +1785,7 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -1827,8 +1785,7 @@ This feature requires the Open Dynamics Engine (ODE).</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="x_options">GTK_FILL</property> <property name="position">0</property>
<property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -1839,14 +1796,50 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -1839,14 +1796,50 @@ This feature requires the Open Dynamics Engine (ODE).</property>
"OpenGL: polygon" settings in preferences. "OpenGL: polygon" settings in preferences.
&lt;b&gt;Beware:&lt;/b&gt; the simulation feature is new and &lt;b&gt;Beware:&lt;/b&gt; the simulation feature is new and
experimental. Thus you will quite probably stumble experimental. Thus you will quite probably stumble
upon bugs and weird results.</property> upon interesting bugs and weird results.</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
</object> </object>
<packing> <packing>
<property name="top_attach">1</property> <property name="position">1</property>
<property name="bottom_attach">2</property> </packing>
<property name="x_options"></property> </child>
<property name="y_options"></property> <child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="spacing">3</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="UpdateSimulationButton">
<property name="label">gtk-refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ExitSimulationButton">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -1862,8 +1855,22 @@ upon bugs and weird results.</property> ...@@ -1862,8 +1855,22 @@ upon bugs and weird results.</property>
</child> </child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="position">3</property>
<property name="position">1</property> </packing>
</child>
<child type="tab">
<object class="GtkLabel" id="SimulationTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Simulation</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -1872,7 +1879,7 @@ upon bugs and weird results.</property> ...@@ -1872,7 +1879,7 @@ upon bugs and weird results.</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -1901,7 +1908,7 @@ upon bugs and weird results.</property> ...@@ -1901,7 +1908,7 @@ upon bugs and weird results.</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">3</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
</object> </object>
......
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