I have a QGIS 2.18.0 plugin which updates a join between two layers (spatial and non-spatial layer).
QGIS crashes when I run the plugin and the attribute table of the joined layer is open. There is no crash when the attribute table is closed or an attribute table of another layer is open.
The last two commands that the plugin runs are:
....
PUNKTE_OS.addJoin(joinObject)
PUNKTE_OS.triggerRepaint()
....
If there is no other solution, how can I close the attribute table of the joined layer before the new join is set?
I know, there is the showAttributeTable()
method. Is there also a closeAttributeTable()
method?
It works when I close the specific attribute table in the def __init__(self, parent):
function on Plugin startup. It doesn't work when I close the specific attribute table in the function where I set the joins (setJoin(self)
).
Here is a sample of my code:
class mask_n_functions(QDialog, Ui_Dialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)
...
attrTables = [d for d in QApplication.instance().allWidgets() if d.objectName() == u'QgsAttributeTableDialog' or d.objectName() == u'AttributeTable' ]
for x in attrTables:
if 'attr_table' in x.windowTitle():
x.close()
def setJoin(self):
prjpath = QgsProject.instance().fileName()
...