diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f866665..21c93fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ CHANGELOG for FlatCAM beta - added a label in the status bar to show if the workplace is active and what size it is - now the Edit command (either from Menu Edit ->Edit Object) or through the shortcut key (E key) or project tab context menu works also for the CNCJob objects (will open a text Editor with the GCode) - fixed the object collection methods that return a list of objects or names of objects such that they have a parameter now to allow adding to those lists (or not) for the objects of type Script or Document. Thus fixing some of the Tcl commands such Set Origin +- reverted the previous changes to object collection; it is better to create empty methods in FlatCAMScript and FlatCAMDocument objects 16.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 07750ef9..b5fa601b 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -3080,7 +3080,10 @@ class App(QtCore.QObject): :return: None """ - xmin, ymin, xmax, ymax = obj.bounds() + try: + xmin, ymin, xmax, ymax = obj.bounds() + except TypeError: + return obj.options['xmin'] = xmin obj.options['ymin'] = ymin obj.options['xmax'] = xmax diff --git a/assets/resources/dark_resources/etch_32.png b/assets/resources/dark_resources/etch_32.png new file mode 100644 index 00000000..ec8687ab Binary files /dev/null and b/assets/resources/dark_resources/etch_32.png differ diff --git a/assets/resources/etch_32.png b/assets/resources/etch_32.png new file mode 100644 index 00000000..a0c23ce2 Binary files /dev/null and b/assets/resources/etch_32.png differ diff --git a/flatcamObjects/FlatCAMDocument.py b/flatcamObjects/FlatCAMDocument.py index 5f33b73a..ed1e8b56 100644 --- a/flatcamObjects/FlatCAMDocument.py +++ b/flatcamObjects/FlatCAMDocument.py @@ -284,6 +284,27 @@ class DocumentObject(FlatCAMObj): self.ui.sel_color_entry.set_value(new_val) self.app.defaults['document_sel_color'] = new_val + def mirror(self, axis, point): + pass + + def offset(self, vect): + pass + + def rotate(self, angle, point): + pass + + def scale(self, xfactor, yfactor=None, point=None): + pass + + def skew(self, angle_x, angle_y, point): + pass + + def buffer(self, distance, join, factor=None): + pass + + def bounds(self, flatten=False): + return None, None, None, None + def to_dict(self): """ Returns a representation of the object as a dictionary. diff --git a/flatcamObjects/FlatCAMScript.py b/flatcamObjects/FlatCAMScript.py index 946f578f..68a6a423 100644 --- a/flatcamObjects/FlatCAMScript.py +++ b/flatcamObjects/FlatCAMScript.py @@ -228,6 +228,27 @@ class ScriptObject(FlatCAMObj): else: self.script_editor_tab.code_editor.completer_enable = False + def mirror(self, axis, point): + pass + + def offset(self, vect): + pass + + def rotate(self, angle, point): + pass + + def scale(self, xfactor, yfactor=None, point=None): + pass + + def skew(self, angle_x, angle_y, point): + pass + + def buffer(self, distance, join, factor=None): + pass + + def bounds(self, flatten=False): + return None, None, None, None + def to_dict(self): """ Returns a representation of the object as a dictionary. diff --git a/flatcamObjects/ObjectCollection.py b/flatcamObjects/ObjectCollection.py index 56fcbd36..556728a0 100644 --- a/flatcamObjects/ObjectCollection.py +++ b/flatcamObjects/ObjectCollection.py @@ -593,22 +593,16 @@ class ObjectCollection(QtCore.QAbstractItemModel): # always open the notebook on object added to collection self.app.ui.splitter.setSizes([1, 1]) - def get_names(self, sel_all=None): + def get_names(self): """ Gets a list of the names of all objects in the collection. - :param sel_all: Will return all objects if True. If False or None all except Script and Document :return: List of names. :rtype: list """ # log.debug(str(inspect.stack()[1][3]) + " --> OC.get_names()") - if sel_all is None or sel_all is False: - names_list = [x.options['name'] for x in self.get_list()] - else: - names_list = [x.options['name'] for x in self.get_list(sel_all=sel_all)] - - return names_list + return [x.options['name'] for x in self.get_list()] def get_bounds(self): """ @@ -990,20 +984,15 @@ class ObjectCollection(QtCore.QAbstractItemModel): self.app.inform.emit('[ERROR] %s: %s' % (_("Cause of error"), str(e))) raise - def get_list(self, sel_all=None): + def get_list(self): """ Will return a list of all objects currently opened. Except FlatCAMScript and FlatCAMDocuments - :param sel_all: Will return all objects if True. If False or None all except Script and Document :return: """ obj_list = [] for group in self.root_item.child_items: for item in group.child_items: - kind = item.obj.kind - if sel_all is None or sel_all is False: - if kind == 'document' or kind == 'script': - continue obj_list.append(item.obj) return obj_list