- reverted the previous changes to object collection; it is better to create empty methods in FlatCAMScript and FlatCAMDocument objects
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user