Commit dfdef1e7 authored by sumpfralle's avatar sumpfralle

moved the program's settings to a separate window


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@181 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 23fe6e5e
...@@ -308,13 +308,20 @@ class ProjectGui: ...@@ -308,13 +308,20 @@ class ProjectGui:
self.gui.get_object("Quit").connect("activate", self.destroy) self.gui.get_object("Quit").connect("activate", self.destroy)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
self.gui.get_object("GenerateToolPathButton").connect("clicked", self.generate_toolpath) self.gui.get_object("GenerateToolPathButton").connect("clicked", self.generate_toolpath)
# the settings window
self.gui.get_object("GeneralSettings").connect("activate", self.toggle_settings_window, True)
self.gui.get_object("CloseSettingsWindow").connect("clicked", self.toggle_settings_window, False)
self.settings_window = self.gui.get_object("GeneralSettingsWindow")
self.settings_window.connect("delete-event", self.toggle_settings_window, False)
self._settings_window_position = None
self.model = None self.model = None
self.toolpath = GuiCommon.ToolPathList() self.toolpath = GuiCommon.ToolPathList()
self.physics = None self.physics = None
self.cutter = None
# add some dummies - to be implemented later ... # add some dummies - to be implemented later ...
self.settings.add_item("model", lambda: getattr(self, "model")) self.settings.add_item("model", lambda: self.model)
self.settings.add_item("toolpath", lambda: getattr(self, "toolpath")) self.settings.add_item("toolpath", lambda: self.toolpath)
self.settings.add_item("cutter", lambda: getattr(self, "cutter")) self.settings.add_item("cutter", lambda: self.cutter)
# create the unit field (the default content can't be defined via glade) # create the unit field (the default content can't be defined via glade)
scale_box = self.gui.get_object("unit_box") scale_box = self.gui.get_object("unit_box")
unit_field = gtk.combo_box_new_text() unit_field = gtk.combo_box_new_text()
...@@ -494,12 +501,13 @@ class ProjectGui: ...@@ -494,12 +501,13 @@ class ProjectGui:
if self.gui_is_active: if self.gui_is_active:
return return
self.gui_is_active = True self.gui_is_active = True
func(self, *args, **kwargs) result = func(self, *args, **kwargs)
self.gui_is_active = False self.gui_is_active = False
while self._batch_queue: while self._batch_queue:
batch_func, batch_args, batch_kwargs = self._batch_queue[0] batch_func, batch_args, batch_kwargs = self._batch_queue[0]
del self._batch_queue[0] del self._batch_queue[0]
batch_func(*batch_args, **batch_kwargs) batch_func(*batch_args, **batch_kwargs)
return result
return wrapper return wrapper
def update_view(self, widget=None, data=None): def update_view(self, widget=None, data=None):
...@@ -542,6 +550,21 @@ class ProjectGui: ...@@ -542,6 +550,21 @@ class ProjectGui:
# "material allowance" requires ODE support # "material allowance" requires ODE support
self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode")) self.gui.get_object("MaterialAllowanceControl").set_sensitive(self.settings.get("enable_ode"))
@gui_activity_guard
def toggle_settings_window(self, widget=None, event=None, state=None):
if state is None:
# the "delete-event" issues the additional "event" argument
state = event
if state:
if self._settings_window_position:
self.settings_window.move(*self._settings_window_position)
self.settings_window.show()
else:
self._settings_window_position = self.settings_window.get_position()
self.settings_window.hide()
# don't close the window - just hide it
return True
@gui_activity_guard @gui_activity_guard
def toggle_3d_view(self, widget=None, value=None): def toggle_3d_view(self, widget=None, value=None):
# no interactive mode # no interactive mode
...@@ -954,6 +977,7 @@ class ProjectGui: ...@@ -954,6 +977,7 @@ class ProjectGui:
self.update_progress_bar("Generating collision model") self.update_progress_bar("Generating collision model")
self.update_physics(cutter) self.update_physics(cutter)
self.cutter = cutter
# this offset allows to cut a model with a minimal boundary box correctly # this offset allows to cut a model with a minimal boundary box correctly
offset = radius/2 offset = radius/2
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</data> </data>
</object> </object>
<object class="GtkWindow" id="ProjectWindow"> <object class="GtkWindow" id="ProjectWindow">
<property name="title" translatable="yes">PyCAM Settings</property> <property name="title" translatable="yes">PyCAM</property>
<property name="destroy_with_parent">True</property> <property name="destroy_with_parent">True</property>
<child> <child>
<object class="GtkVBox" id="WindowBox"> <object class="GtkVBox" id="WindowBox">
...@@ -937,204 +937,6 @@ ...@@ -937,204 +937,6 @@
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkFrame" id="GeneralSettingsFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="SettingEnableODE">
<property name="label" translatable="yes">Enable experimental ODE calculations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="GeneralSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator5">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame13">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkCheckButton" id="ShowModelCheckBox">
<property name="label" translatable="yes">Show Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowToolPathCheckBox">
<property name="label" translatable="yes">Show Toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowBoundingCheckBox">
<property name="label" translatable="yes">Show Bounding Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowAxesCheckBox">
<property name="label" translatable="yes">Show Coordinate System</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowDrillProgressCheckBox">
<property name="label" translatable="yes">Show Drill Progress</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="DrillUpdateFPSLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Maximum Frames per Second:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="DrillProgressFrameSkipControl">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property>
<property name="adjustment">DrillProgressMaxFPS</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="VisualSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Display settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="SettingsTabLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Settings</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child> <child>
<object class="GtkVBox" id="ProcessingTab"> <object class="GtkVBox" id="ProcessingTab">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -1989,7 +1791,7 @@ ...@@ -1989,7 +1791,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child type="tab"> <child type="tab">
...@@ -1998,7 +1800,7 @@ ...@@ -1998,7 +1800,7 @@
<property name="label" translatable="yes">Processing</property> <property name="label" translatable="yes">Processing</property>
</object> </object>
<packing> <packing>
<property name="position">2</property> <property name="position">1</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
...@@ -2188,7 +1990,7 @@ ...@@ -2188,7 +1990,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="position">3</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child type="tab"> <child type="tab">
...@@ -2197,7 +1999,7 @@ ...@@ -2197,7 +1999,7 @@
<property name="label" translatable="yes">Toolpaths</property> <property name="label" translatable="yes">Toolpaths</property>
</object> </object>
<packing> <packing>
<property name="position">3</property> <property name="position">2</property>
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
...@@ -2602,8 +2404,6 @@ ...@@ -2602,8 +2404,6 @@
<property name="label">Preferences</property> <property name="label">Preferences</property>
<property name="tooltip">Configure PyCAM</property> <property name="tooltip">Configure PyCAM</property>
<property name="stock_id">gtk-preferences</property> <property name="stock_id">gtk-preferences</property>
<property name="sensitive">False</property>
<property name="visible">False</property>
</object> </object>
<object class="GtkAction" id="Quit"> <object class="GtkAction" id="Quit">
<property name="label">Quit</property> <property name="label">Quit</property>
...@@ -2628,4 +2428,236 @@ ...@@ -2628,4 +2428,236 @@
<property name="tooltip">Save the current model to a new STL file.</property> <property name="tooltip">Save the current model to a new STL file.</property>
<property name="stock_id">gtk-save-as</property> <property name="stock_id">gtk-save-as</property>
</object> </object>
<object class="GtkDialog" id="GeneralSettingsWindow">
<property name="border_width">5</property>
<property name="title" translatable="yes">PyCAM Settings</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkFrame" id="GeneralSettingsFrame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="SettingEnableODE">
<property name="label" translatable="yes">Enable experimental ODE calculations</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="GeneralSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator5">
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame13">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkCheckButton" id="ShowModelCheckBox">
<property name="label" translatable="yes">Show Model</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowToolPathCheckBox">
<property name="label" translatable="yes">Show Toolpath</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowBoundingCheckBox">
<property name="label" translatable="yes">Show Bounding Box</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowAxesCheckBox">
<property name="label" translatable="yes">Show Coordinate System</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="ShowDrillProgressCheckBox">
<property name="label" translatable="yes">Show Drill Progress</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="DrillUpdateFPSLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">Maximum Frames per Second:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="DrillProgressFrameSkipControl">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x2022;</property>
<property name="adjustment">DrillProgressMaxFPS</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="VisualSettingsFrameLabel">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Display settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="CloseSettingsWindow">
<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="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">CloseSettingsWindow</action-widget>
</action-widgets>
</object>
</interface> </interface>
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