SqlBrowser/SqlConnectionWidget.py

changeset 500
c3abc7895a01
parent 454
d28d558f7484
child 501
5c615a85241a
diff -r 622ab17a68d5 -r c3abc7895a01 SqlBrowser/SqlConnectionWidget.py
--- a/SqlBrowser/SqlConnectionWidget.py	Thu Aug 12 10:11:06 2010 +0200
+++ b/SqlBrowser/SqlConnectionWidget.py	Thu Aug 12 16:11:13 2010 +0200
@@ -15,10 +15,14 @@
     """
     Class implementing a widget showing the SQL connections.
     
-    @signal tableActivated(QString) emitted after the entry for a table has been activated
-    @signal schemaRequested(QString) emitted when the schema display is requested
+    @signal tableActivated(string) emitted after the entry for a table has been activated
+    @signal schemaRequested(string) emitted when the schema display is requested
     @signal cleared() emitted after the connection tree has been cleared
     """
+    tableActivated = pyqtSignal(str)
+    schemaRequested = pyqtSignal(str)
+    cleared = pyqtSignal()
+    
     def __init__(self, parent = None):
         """
         Constructor
@@ -46,12 +50,8 @@
         
         layout.addWidget(self.__connectionTree)
         
-        self.connect(self.__connectionTree, 
-                     SIGNAL("itemActivated(QTreeWidgetItem*, int)"), 
-                     self.__itemActivated)
-        self.connect(self.__connectionTree, 
-                     SIGNAL("currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)"), 
-                     self.__currentItemChanged)
+        self.__connectionTree.itemActivated.connect(self.__itemActivated)
+        self.__connectionTree.currentItemChanged.connect(self.__currentItemChanged)
         
         self.__activeDb = ""
     
@@ -60,7 +60,7 @@
         Public slot to refresh the connection tree.
         """
         self.__connectionTree.clear()
-        self.emit(SIGNAL("cleared()"))
+        self.cleared.emit()
         
         connectionNames = QSqlDatabase.connectionNames()
         
@@ -92,7 +92,7 @@
         if cItm is None or cItm.parent() is None:
             return
         self.__setActive(cItm.parent())
-        self.emit(SIGNAL("schemaRequested(QString)"), cItm.text(0))
+        self.schemaRequested.emit(cItm.text(0))
     
     def __itemActivated(self, itm, column):
         """
@@ -108,7 +108,7 @@
             self.__setActive(itm)
         else:
             self.__setActive(itm.parent())
-            self.emit(SIGNAL("tableActivated(QString)"), itm.text(0))
+            self.tableActivated.emit(itm.text(0))
     
     def __currentItemChanged(self, current, previous):
         """
@@ -169,4 +169,4 @@
         
         self.__setBold(itm, True)
         self.__activeDb = QSqlDatabase.connectionNames()[
-                            self.__connectionTree.indexOfTopLevelItem(itm)]
\ No newline at end of file
+                            self.__connectionTree.indexOfTopLevelItem(itm)]

eric ide

mercurial