@@ -69,29 +69,29 @@ def __init__(self,
6969 ):
7070
7171 if not isinstance (name , str ):
72- raise QgistTypeError (translate ('global' , '"name" must be str' ))
72+ raise QgistTypeError (translate ('global' , '"name" must be str. (dtype_workbench) ' ))
7373 if len (name ) == 0 :
74- raise QgistValueError (translate ('global' , '"name" must not be empty' ))
74+ raise QgistValueError (translate ('global' , '"name" must not be empty. (dtype_workbench) ' ))
7575 self ._name = name
7676
7777 if isinstance (mainwindow_state , str ):
7878 self ._mainwindow_state = base64 .decodebytes (mainwindow_state .encode ('ASCII' ))
7979 elif isinstance (mainwindow_state , bytes ):
8080 self ._mainwindow_state = base64 .decodebytes (mainwindow_state )
8181 else :
82- raise QgistTypeError (translate ('global' , '"mainwindow_state" must either be str or bytes' ))
82+ raise QgistTypeError (translate ('global' , '"mainwindow_state" must either be str or bytes. (dtype_workbench) ' ))
8383
8484 if not isinstance (mainwindow , QMainWindow ):
85- raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow' ))
85+ raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow. (dtype_workbench) ' ))
8686
8787 if not isinstance (toolbars_list , list ):
88- raise QgistTypeError (translate ('global' , '"toolbars_list" must be a list' ))
88+ raise QgistTypeError (translate ('global' , '"toolbars_list" must be a list. (dtype_workbench) ' ))
8989 if not isinstance (dockwidgets_list , list ):
90- raise QgistTypeError (translate ('global' , '"dockwidgets_list" must be a list' ))
90+ raise QgistTypeError (translate ('global' , '"dockwidgets_list" must be a list. (dtype_workbench) ' ))
9191 if any ([not isinstance (item , dict ) for item in toolbars_list ]):
92- raise QgistTypeError (translate ('global' , 'Items in "toolbars_list" must be dicts' ))
92+ raise QgistTypeError (translate ('global' , 'Items in "toolbars_list" must be dicts. (dtype_workbench) ' ))
9393 if any ([not isinstance (item , dict ) for item in dockwidgets_list ]):
94- raise QgistTypeError (translate ('global' , 'Items in "dockwidgets_list" must be dicts' ))
94+ raise QgistTypeError (translate ('global' , 'Items in "dockwidgets_list" must be dicts. (dtype_workbench) ' ))
9595
9696 tmp_toolbars_dict = dtype_workbench_class ._get_uielements_from_mainwindow (mainwindow , QToolBar )
9797 self ._toolbars_dict = {
@@ -114,30 +114,30 @@ def __init__(self,
114114 def __getitem__ (self , value ):
115115
116116 if not isinstance (value , tuple ):
117- raise QgistValueError (translate ('global' , 'Not enough parameters, two expected' ))
117+ raise QgistValueError (translate ('global' , 'Not enough parameters, two expected. (dtype_workbench item) ' ))
118118 if len (value ) != 2 :
119- raise QgistValueError (translate ('global' , 'Wrong number of parameters, two expected' ))
119+ raise QgistValueError (translate ('global' , 'Wrong number of parameters, two expected. (dtype_workbench item) ' ))
120120
121121 item_type , item_name = value
122122
123123 if not isinstance (item_type , str ):
124- raise QgistTypeError (translate ('global' , '"item_type" must be str' ))
124+ raise QgistTypeError (translate ('global' , '"item_type" must be str. (dtype_workbench item) ' ))
125125 if item_type not in ('toolbars' , 'dockwidgets' ):
126- raise QgistValueError (translate ('global' , 'Unknown "item_type"' ))
126+ raise QgistValueError (translate ('global' , 'Unknown "item_type". (dtype_workbench item) ' ))
127127
128128 target_dict = getattr (self , '_{NAME:s}_dict' .format (NAME = item_type ))
129129
130130 if not isinstance (item_name , str ):
131- raise QgistTypeError (translate ('global' , '"item_name" must be str' ))
131+ raise QgistTypeError (translate ('global' , '"item_name" must be str. (dtype_workbench item) ' ))
132132 if item_name not in target_dict .keys ():
133- raise QgistValueError (translate ('global' , '"item_name" is not a known item' ))
133+ raise QgistValueError (translate ('global' , '"item_name" is not a known item. (dtype_workbench item) ' ))
134134
135135 return target_dict [item_name ]
136136
137137 def activate (self , mainwindow ):
138138
139139 if not isinstance (mainwindow , QMainWindow ):
140- raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow' ))
140+ raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow. (dtype_workbench activate) ' ))
141141
142142 qtoolbars_dict = dtype_workbench_class ._get_uielements_from_mainwindow (mainwindow , QToolBar )
143143 qdockwidgets_dict = dtype_workbench_class ._get_uielements_from_mainwindow (mainwindow , QDockWidget )
@@ -150,7 +150,7 @@ def activate(self, mainwindow):
150150 def save (self , mainwindow ):
151151
152152 if not isinstance (mainwindow , QMainWindow ):
153- raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow' ))
153+ raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow. (dtype_workbench save) ' ))
154154
155155 qtoolbars_dict = dtype_workbench_class ._get_uielements_from_mainwindow (mainwindow , QToolBar )
156156 qdockwidgets_dict = dtype_workbench_class ._get_uielements_from_mainwindow (mainwindow , QDockWidget )
@@ -219,9 +219,9 @@ def name(self):
219219 def name (self , value ):
220220
221221 if not isinstance (name , str ):
222- raise QgistTypeError (translate ('global' , 'New value of "name" must be a str' ))
222+ raise QgistTypeError (translate ('global' , 'New value of "name" must be a str. (dtype_workbench name) ' ))
223223 if len (name ) == 0 :
224- raise QgistValueError (translate ('global' , 'New value of "name" must not be empty' ))
224+ raise QgistValueError (translate ('global' , 'New value of "name" must not be empty. (dtype_workbench name) ' ))
225225
226226 self ._name = value
227227
@@ -232,7 +232,7 @@ def from_mainwindow(
232232 ):
233233
234234 if not isinstance (mainwindow , QMainWindow ):
235- raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow' ))
235+ raise QgistTypeError (translate ('global' , '"mainwindow" must be a QGIS mainwindow. (dtype_workbench from_mainwindow) ' ))
236236
237237 toolbars_list = [
238238 dtype_uielement_class .from_uiobject (uiobject ).as_dict ()
0 commit comments