Merged marius_stanciu/flatcam_beta/Beta into Beta
This commit is contained in:
commit
24a12f0fcb
|
@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
|
|||
- promoted some methods to be static
|
||||
- set the default layout on first run to the 'minimal' value
|
||||
- modified the method that detects which tab was closed in the Plot Area so it will no longer depend on it's translated text but on it's objectName set on the QTab creation
|
||||
- fixed the merge methods for all FlatCAM objects
|
||||
|
||||
28.04.2020
|
||||
|
||||
|
|
|
@ -663,7 +663,6 @@ class App(QtCore.QObject):
|
|||
|
||||
self.preferencesUiManager.show_preferences_gui()
|
||||
|
||||
|
||||
# ### End of Data ####
|
||||
|
||||
# ###########################################################################################################
|
||||
|
@ -1683,7 +1682,6 @@ class App(QtCore.QObject):
|
|||
if App.args:
|
||||
self.args_at_startup.emit(App.args)
|
||||
|
||||
|
||||
if self.defaults.old_defaults_found is True:
|
||||
self.inform.emit('[WARNING_NOTCL] %s' % _("Found old default preferences files. "
|
||||
"Please reboot the application to update."))
|
||||
|
@ -1695,26 +1693,6 @@ class App(QtCore.QObject):
|
|||
# #################################################################################################################
|
||||
# #################################################################################################################
|
||||
# #################################################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def copy_and_overwrite(from_path, to_path):
|
||||
|
@ -1880,8 +1858,6 @@ class App(QtCore.QObject):
|
|||
|
||||
fcTranslate.restart_program(app=self)
|
||||
|
||||
|
||||
|
||||
def clear_pool(self):
|
||||
"""
|
||||
Clear the multiprocessing pool and calls garbage collector.
|
||||
|
@ -2410,7 +2386,6 @@ class App(QtCore.QObject):
|
|||
loc = os.path.dirname(__file__)
|
||||
return loc
|
||||
|
||||
|
||||
def info(self, msg):
|
||||
"""
|
||||
Informs the user. Normally on the status bar, optionally
|
||||
|
@ -2509,7 +2484,6 @@ class App(QtCore.QObject):
|
|||
else:
|
||||
self.ui.toolbarshell.setVisible(False)
|
||||
|
||||
|
||||
def on_import_preferences(self):
|
||||
"""
|
||||
Loads the application default settings from a saved file into
|
||||
|
@ -2550,7 +2524,7 @@ class App(QtCore.QObject):
|
|||
self.defaults.report_usage("on_export_preferences")
|
||||
App.log.debug("on_export_preferences()")
|
||||
|
||||
defaults_file_content = None
|
||||
# defaults_file_content = None
|
||||
|
||||
# Show file chooser
|
||||
date = str(datetime.today()).rpartition('.')[0]
|
||||
|
@ -3751,20 +3725,20 @@ class App(QtCore.QObject):
|
|||
root_path = winreg.HKEY_CURRENT_USER
|
||||
|
||||
# create the keys
|
||||
def set_reg(name, root_path, new_reg_path, value):
|
||||
def set_reg(name, root_pth, new_reg_path, value):
|
||||
try:
|
||||
winreg.CreateKey(root_path, new_reg_path)
|
||||
with winreg.OpenKey(root_path, new_reg_path, 0, winreg.KEY_WRITE) as registry_key:
|
||||
winreg.CreateKey(root_pth, new_reg_path)
|
||||
with winreg.OpenKey(root_pth, new_reg_path, 0, winreg.KEY_WRITE) as registry_key:
|
||||
winreg.SetValueEx(registry_key, name, 0, winreg.REG_SZ, value)
|
||||
return True
|
||||
except WindowsError:
|
||||
return False
|
||||
|
||||
# delete key in registry
|
||||
def delete_reg(root_path, reg_path, key_to_del):
|
||||
def delete_reg(root_pth, reg_path, key_to_del):
|
||||
key_to_del_path = reg_path + key_to_del
|
||||
try:
|
||||
winreg.DeleteKey(root_path, key_to_del_path)
|
||||
winreg.DeleteKey(root_pth, key_to_del_path)
|
||||
return True
|
||||
except WindowsError:
|
||||
return False
|
||||
|
@ -4041,7 +4015,7 @@ class App(QtCore.QObject):
|
|||
# if at least one True object is in the list then due of the previous check, all list elements are True objects
|
||||
if True in geo_type_set:
|
||||
def initialize(geo_obj, app):
|
||||
GeometryObject.merge(self, geo_list=objs, geo_final=geo_obj, multigeo=True)
|
||||
GeometryObject.merge(geo_list=objs, geo_final=geo_obj, multigeo=True)
|
||||
app.inform.emit('[success] %s.' % _("Geometry merging finished"))
|
||||
|
||||
# rename all the ['name] key in obj.tools[tooluid]['data'] to the obj_name_multi
|
||||
|
@ -4051,7 +4025,7 @@ class App(QtCore.QObject):
|
|||
self.new_object("geometry", obj_name_multi, initialize)
|
||||
else:
|
||||
def initialize(geo_obj, app):
|
||||
GeometryObject.merge(self, geo_list=objs, geo_final=geo_obj, multigeo=False)
|
||||
GeometryObject.merge(geo_list=objs, geo_final=geo_obj, multigeo=False)
|
||||
app.inform.emit('[success] %s.' % _("Geometry merging finished"))
|
||||
|
||||
# rename all the ['name] key in obj.tools[tooluid]['data'] to the obj_name_multi
|
||||
|
@ -4084,7 +4058,7 @@ class App(QtCore.QObject):
|
|||
return 'fail'
|
||||
|
||||
def initialize(exc_obj, app):
|
||||
ExcellonObject.merge(exc_list=objs, exc_final=exc_obj)
|
||||
ExcellonObject.merge(exc_list=objs, exc_final=exc_obj, decimals=self.decimals)
|
||||
app.inform.emit('[success] %s.' % _("Excellon merging finished"))
|
||||
|
||||
self.new_object("excellon", 'Combo_Excellon', initialize)
|
||||
|
@ -4112,7 +4086,7 @@ class App(QtCore.QObject):
|
|||
return 'fail'
|
||||
|
||||
def initialize(grb_obj, app):
|
||||
GerberObject.merge(self, grb_list=objs, grb_final=grb_obj)
|
||||
GerberObject.merge(grb_list=objs, grb_final=grb_obj)
|
||||
app.inform.emit('[success] %s.' % _("Gerber merging finished"))
|
||||
|
||||
self.new_object("gerber", 'Combo_Gerber', initialize)
|
||||
|
|
|
@ -130,7 +130,8 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
|||
# from predecessors.
|
||||
self.ser_attrs += ['options', 'kind']
|
||||
|
||||
def merge(self, exc_list, exc_final):
|
||||
@staticmethod
|
||||
def merge(exc_list, exc_final, decimals=None):
|
||||
"""
|
||||
Merge Excellon objects found in exc_list parameter into exc_final object.
|
||||
Options are always copied from source .
|
||||
|
@ -146,10 +147,9 @@ class ExcellonObject(FlatCAMObj, Excellon):
|
|||
:return: None
|
||||
"""
|
||||
|
||||
try:
|
||||
decimals_exc = self.decimals
|
||||
except AttributeError:
|
||||
decimals_exc = 4
|
||||
if decimals is None:
|
||||
decimals = 4
|
||||
decimals_exc = decimals
|
||||
|
||||
# flag to signal that we need to reorder the tools dictionary and drills and slots lists
|
||||
flag_order = False
|
||||
|
|
|
@ -2519,10 +2519,10 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
self.ui.plot_cb.setChecked(True)
|
||||
self.ui_connect()
|
||||
|
||||
def merge(self, geo_list, geo_final, multigeo=None):
|
||||
@staticmethod
|
||||
def merge(geo_list, geo_final, multigeo=None):
|
||||
"""
|
||||
Merges the geometry of objects in grb_list into
|
||||
the geometry of geo_final.
|
||||
Merges the geometry of objects in grb_list into the geometry of geo_final.
|
||||
|
||||
:param geo_list: List of GerberObject Objects to join.
|
||||
:param geo_final: Destination GerberObject object.
|
||||
|
@ -2552,7 +2552,7 @@ class GeometryObject(FlatCAMObj, Geometry):
|
|||
|
||||
# Expand lists
|
||||
if type(geo_obj) is list:
|
||||
GeometryObject.merge(self, geo_list=geo_obj, geo_final=geo_final)
|
||||
GeometryObject.merge(geo_list=geo_obj, geo_final=geo_final)
|
||||
# If not list, just append
|
||||
else:
|
||||
if multigeo is None or multigeo is False:
|
||||
|
|
|
@ -39,7 +39,8 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
|
||||
ui_type = GerberObjectUI
|
||||
|
||||
def merge(self, grb_list, grb_final):
|
||||
@staticmethod
|
||||
def merge(grb_list, grb_final):
|
||||
"""
|
||||
Merges the geometry of objects in geo_list into
|
||||
the geometry of geo_final.
|
||||
|
@ -64,7 +65,7 @@ class GerberObject(FlatCAMObj, Gerber):
|
|||
|
||||
# Expand lists
|
||||
if type(grb) is list:
|
||||
GerberObject.merge(grb, grb_final)
|
||||
GerberObject.merge(grb_list=grb, grb_final=grb_final)
|
||||
else: # If not list, just append
|
||||
for option in grb.options:
|
||||
if option != 'name':
|
||||
|
|
|
@ -62,7 +62,7 @@ class TclCommandJoinExcellon(TclCommand):
|
|||
objs.append(obj)
|
||||
|
||||
def initialize(obj_, app):
|
||||
ExcellonObject.merge(self, objs, obj_)
|
||||
ExcellonObject.merge(objs, obj_, decimals=self.app.decimals)
|
||||
|
||||
if objs and len(objs) >= 2:
|
||||
self.app.new_object("excellon", outname, initialize, plot=False)
|
||||
|
|
|
@ -62,7 +62,7 @@ class TclCommandJoinGeometry(TclCommand):
|
|||
objs.append(obj)
|
||||
|
||||
def initialize(obj_, app):
|
||||
GeometryObject.merge(self, objs, obj_)
|
||||
GeometryObject.merge(objs, obj_)
|
||||
|
||||
if objs and len(objs) >= 2:
|
||||
self.app.new_object("geometry", outname, initialize, plot=False)
|
||||
|
|
Loading…
Reference in New Issue