@@ -203,20 +203,20 @@ def initGui(self):
203203 self .dock .lineEditDistance .setValidator (QDoubleValidator ())
204204 self .dock .lineEditAlpha .setValidator (QDoubleValidator ())
205205 self .dock .lineEditPaths .setValidator (QIntValidator ())
206- self .loadSettings ()
207206
208207 #populate the combo with connections
209208 self .reloadMessage = False
210209 self .reloadConnections ()
210+ self .loadSettings ()
211211 Utils .logMessage ("startup version " + str (self .version ))
212212 self .reloadMessage = True
213213
214214 def show (self ):
215215 self .iface .addDockWidget (Qt .LeftDockWidgetArea , self .dock )
216216
217217 def unload (self ):
218- self .saveSettings ()
219218 self .clear ()
219+ self .saveSettings ()
220220 # Remove the plugin menu item and icon
221221 self .iface .removePluginDatabaseMenu ("&pgRouting Layer" , self .action )
222222 self .iface .removeDockWidget (self .dock )
@@ -869,8 +869,10 @@ def clear(self):
869869 for anno in self .canvasItemList ['annotations' ]:
870870 try :
871871 anno .setVisible (False )
872+ self .iface .mapCanvas ().scene ().removeItem (anno )
872873 except RuntimeError , e :
873- Utils .logMessage ("anno.setVisible(False) failed, " + e .message , QgsMessageLog .WARNING )
874+ QApplication .restoreOverrideCursor ()
875+ QMessageBox .critical (self .dock , self .dock .windowTitle (), '%s' % e )
874876 self .canvasItemList ['annotations' ] = []
875877 for path in self .canvasItemList ['paths' ]:
876878 path .reset (Utils .getRubberBandType (False ))
@@ -1202,7 +1204,7 @@ def findNearestLink(self, args, pt):
12021204
12031205 def loadSettings (self ):
12041206 settings = QSettings ()
1205- idx = self .dock .comboConnections .findText (Utils . getStringValue ( settings , '/pgRoutingLayer/Database' , '' ))
1207+ idx = self .dock .comboConnections .findText (settings . value ( '/pgRoutingLayer/Database' , type = str ))
12061208 if idx >= 0 :
12071209 self .dock .comboConnections .setCurrentIndex (idx )
12081210 idx = self .dock .comboBoxFunction .findText (Utils .getStringValue (settings , '/pgRoutingLayer/Function' , 'dijkstra' ))
0 commit comments