- added a parameter to the FlatCAMDefaults class, whenever a value in the self.defaults dict change it will call a callback function and send to it the modified key
- optimized and fixed some issues in the self.on_toggle_units() method - the Exclusion areas will have all the orange color but the color of the outline will differ according to the type of the object from where it was added (cosmetic use only as the Exclusion areas will be applied globally)
This commit is contained in:
10
defaults.py
10
defaults.py
@@ -495,7 +495,7 @@ class FlatCAMDefaults:
|
||||
"tools_transform_offset_x": 0.0,
|
||||
"tools_transform_offset_y": 0.0,
|
||||
"tools_transform_mirror_reference": False,
|
||||
"tools_transform_mirror_point": (0, 0),
|
||||
"tools_transform_mirror_point": "0.0, 0.0",
|
||||
"tools_transform_buffer_dis": 0.0,
|
||||
"tools_transform_buffer_factor": 100.0,
|
||||
"tools_transform_buffer_corner": True,
|
||||
@@ -697,13 +697,19 @@ class FlatCAMDefaults:
|
||||
except Exception as e:
|
||||
log.error("save_factory_defaults() -> %s" % str(e))
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, callback=lambda x: None):
|
||||
"""
|
||||
|
||||
:param callback: A method called each time that one of the values are changed in the self.defaults LouDict
|
||||
"""
|
||||
self.defaults = LoudDict()
|
||||
self.defaults.update(self.factory_defaults)
|
||||
self.current_defaults = {} # copy used for restoring after cancelled prefs changes
|
||||
self.current_defaults.update(self.factory_defaults)
|
||||
self.old_defaults_found = False
|
||||
|
||||
self.defaults.set_change_callback(callback)
|
||||
|
||||
# #### Pass-through to the defaults LoudDict #####
|
||||
def __len__(self):
|
||||
return self.defaults.__len__()
|
||||
|
||||
Reference in New Issue
Block a user