Commit 8f1e3ca6 authored by sumpfralle's avatar sumpfralle

added a configuration setting for automatically loading a custom task settings file on startup


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@899 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 4ba42b5a
...@@ -8,6 +8,7 @@ Version 0.4.1 - UNRELEASED ...@@ -8,6 +8,7 @@ Version 0.4.1 - UNRELEASED
* changed "simulation mode" for visualizing the machine moves * changed "simulation mode" for visualizing the machine moves
* added a very simple "pocketing" mode for 2D models * added a very simple "pocketing" mode for 2D models
* added support for DXF feature "LWPOLYLINE" * added support for DXF feature "LWPOLYLINE"
* added a configuration setting for automatically loading a custom task settings file on startup
* unify DropCutter behaviour for models that are higher than the defined bounding box * unify DropCutter behaviour for models that are higher than the defined bounding box
* always move up to safety height in this case * always move up to safety height in this case
* optional visualization of toolpath direction * optional visualization of toolpath direction
......
...@@ -4984,6 +4984,34 @@ ODE can't be used in combination with parallel processing or server mode.</prope ...@@ -4984,6 +4984,34 @@ ODE can't be used in combination with parallel processing or server mode.</prope
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="AutoLoadTaskFile">
<property name="label" translatable="yes">Load custom task settings on startup</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="position">3</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="StartupTaskFileBox">
<property name="visible">True</property>
<property name="left_padding">20</property>
<child>
<object class="GtkFileChooserButton" id="StartupTaskFile">
<property name="visible">True</property>
<property name="title" translatable="yes">Choose custom task settings file loading on startup</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">4</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>
......
...@@ -97,6 +97,7 @@ PREFERENCES_DEFAULTS = { ...@@ -97,6 +97,7 @@ PREFERENCES_DEFAULTS = {
"enable_ode": False, "enable_ode": False,
"boundary_mode": -1, "boundary_mode": -1,
"unit": "mm", "unit": "mm",
"default_task_settings_file": "",
"show_model": True, "show_model": True,
"show_support_grid": True, "show_support_grid": True,
"show_axes": True, "show_axes": True,
...@@ -432,6 +433,36 @@ class ProjectGui: ...@@ -432,6 +433,36 @@ class ProjectGui:
self.change_unit_set_selection, True) self.change_unit_set_selection, True)
self.gui.get_object("UnitChangeSelectNone").connect("clicked", self.gui.get_object("UnitChangeSelectNone").connect("clicked",
self.change_unit_set_selection, False) self.change_unit_set_selection, False)
# autoload task settings file on startup
autoload_enable = self.gui.get_object("AutoLoadTaskFile")
autoload_box = self.gui.get_object("StartupTaskFileBox")
autoload_source = self.gui.get_object("StartupTaskFile")
for one_filter in get_filters_from_list(FILTER_CONFIG):
autoload_source.add_filter(one_filter)
autoload_source.set_filter(one_filter)
def get_autoload_task_file(autoload_source=autoload_source):
if autoload_enable.get_active():
return autoload_source.get_filename()
else:
return ""
def set_autoload_task_file(filename):
if filename:
autoload_enable.set_active(True)
autoload_box.set_visible(True)
autoload_source.set_filename(filename)
else:
autoload_enable.set_active(False)
autoload_box.set_visible(False)
autoload_source.unselect_all()
def autoload_enable_switched(widget, box):
if not widget.get_active():
set_autoload_task_file(None)
else:
autoload_box.set_visible(True)
autoload_enable.connect("toggled", autoload_enable_switched,
autoload_box)
self.settings.add_item("default_task_settings_file",
get_autoload_task_file, set_autoload_task_file)
# boundary mode (move inside/along/around the boundaries) # boundary mode (move inside/along/around the boundaries)
boundary_mode_control = self.gui.get_object("BoundaryModeControl") boundary_mode_control = self.gui.get_object("BoundaryModeControl")
def set_boundary_mode(value): def set_boundary_mode(value):
...@@ -948,6 +979,14 @@ class ProjectGui: ...@@ -948,6 +979,14 @@ class ProjectGui:
self.reset_preferences() self.reset_preferences()
self.load_preferences() self.load_preferences()
self.load_task_settings() self.load_task_settings()
# Without this "gkt.main_iteration" loop the task settings file
# control would not be updated in time.
while gtk.events_pending():
gtk.main_iteration()
autoload_task_filename = self.settings.get("default_task_settings_file")
if autoload_task_filename:
self.load_task_settings_file(filename=autoload_task_filename)
self.last_task_settings_file = autoload_task_filename
self.update_all_controls() self.update_all_controls()
self.no_dialog = no_dialog self.no_dialog = no_dialog
if not self.no_dialog: if not self.no_dialog:
...@@ -2635,6 +2674,7 @@ class ProjectGui: ...@@ -2635,6 +2674,7 @@ class ProjectGui:
# loaded interactively. E.g. ignore the initial task file loading. # loaded interactively. E.g. ignore the initial task file loading.
self.last_task_settings_file = filename self.last_task_settings_file = filename
if filename: if filename:
log.info("Loading task settings file: %s" % str(filename))
self.load_task_settings(filename) self.load_task_settings(filename)
self.add_to_recent_file_list(filename) self.add_to_recent_file_list(filename)
self.update_save_actions() self.update_save_actions()
......
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