Skip to content

Commit d67d46d

Browse files
committed
0.0.2 release
2 parents 430410f + a3e3960 commit d67d46d

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

CHANGES.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changes
22

3+
## 0.0.2 (2019-09-03)
4+
5+
* Fixed #6: `workbench` does not crash anymore when certain other plugins are loaded. Background: Their UI exposes its Qt parent as a property instead of a method.
6+
* Fixed #7: `workbench` can start even of other plugins contain unnamed UI elements.
7+
38
## 0.0.1 (2019-09-01)
49

510
* Initial release.

metadata.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
name=QGIST Workbench
2323
description=Organizing Toolbars
2424
about=QGIST Workbench is a QGIS plugin for organizing toolbars and dockwidgets.
25-
version=0.0.1
25+
version=0.0.2
2626
qgisMinimumVersion=3.0
2727
author=QGIST project
2828

qgist/workbench/dtype_workbench.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
from ..error import (
5151
QgistTypeError,
5252
QgistValueError,
53+
Qgist_ALL_Errors,
5354
)
55+
from ..msg import msg_warning
5456
from ..util import translate
5557

5658

@@ -181,21 +183,33 @@ def toolbars(self):
181183
def _activate_uielements(uiobjects_dict, uielements_dict):
182184

183185
for name_internal, uiobject in uiobjects_dict.items():
184-
try:
186+
if name_internal in uielements_dict.keys():
185187
uielements_dict[name_internal].push_state_to_uiobject()
186-
except KeyError:
187-
uielement = dtype_uielement_class.from_uiobject(uiobject)
188-
uielements_dict[uielement.name_internal] = uielement
188+
else:
189+
"""try/except-block fixes #7, Certain other plugins inhibit
190+
the start of Workbench because of unnamed UI elements"""
191+
try:
192+
uielement = dtype_uielement_class.from_uiobject(uiobject)
193+
uielements_dict[uielement.name_internal] = uielement
194+
except Qgist_ALL_Errors as e:
195+
msg_warning(e)
189196
for name_internal in (uielements_dict.keys() - uiobjects_dict.keys()):
190197
uielements_dict[name_internal].existence = False
191198

192199
@staticmethod
193200
def _get_uielements_from_mainwindow(mainwindow, uielement_type):
194201

202+
def get_parent(el):
203+
"""Fixes #6, Certain other plugins crash Workbench:
204+
Their UI's parent is exposed as a property instead of a method"""
205+
if hasattr(el.parent, '__call__'):
206+
return el.parent()
207+
return el.parent
208+
195209
return {
196210
uielement.objectName(): uielement
197211
for uielement in mainwindow.findChildren(uielement_type)
198-
if uielement.parent().objectName() == 'QgisApp'
212+
if get_parent(uielement).objectName() == 'QgisApp'
199213
}
200214

201215
@staticmethod

0 commit comments

Comments
 (0)