daboide Commit
Revision 592
Date: 2006-06-20 11:44:25 -0700 (Tue, 20 Jun 2006)
Author: ed

Changed:
U   trunk/CxnEditor.py

Log:
Incorporated Simen Haugen's fix for the connection dropdown when editing the 
name of the connection.

Also found that a lot of settings weren't being persisted when doing things 
like switching connections or creating new connections. I added a bunch of 
updtFromForm() calls to take care of this.


Diff:
Modified: trunk/CxnEditor.py
===================================================================
--- trunk/CxnEditor.py  2006-06-15 17:59:00 UTC (rev 591)
+++ trunk/CxnEditor.py  2006-06-20 18:44:25 UTC (rev 592)
@@ -13,6 +13,7 @@
 dui.loadUI("wx")
 
 
+
 class EditorForm(dui.dForm):
        def afterSetMenuBar(self):
                self.createMenu()
@@ -169,11 +170,10 @@
                                self.connDict[new]["name"] = new
                                self.currentConn = new
                                self.name = new
+                       self.connectionSelector.PositionValue = idx
                                
 
        def onHit_btnTest(self, evt):
-               # Make sure that changes to the current control are used.
-               self.activeControlValid()
                # Update the values
                self.updtFromForm()
                # Create a connection object.
@@ -194,10 +194,15 @@
        
        
        def onHit_btnOpen(self, evt):
+               # Update the values
+               self.updtFromForm()
+               # Now open the file
                self.openFile()
        
        
        def onHit_btnNewFile(self, evt):
+               # Update the values
+               self.updtFromForm()
                # See if the user wants to save changes (if any)
                if not self.confirmChanges():
                        return
@@ -205,6 +210,9 @@
                
        
        def onHit_btnNewConn(self, evt):
+               # Update the values
+               self.updtFromForm()
+               # Create the new connection
                self.newConnection()
                
                
@@ -213,6 +221,8 @@
                
                
        def onHit_DbType(self, evt):
+               # Update the values
+               self.updtFromForm()
                dbt = self.dbtype
                isSQLite = (dbt == "SQLite")
                self.hostText.Visible = not isSQLite
@@ -235,11 +245,17 @@
                        self.database = dbFile
                self.update()
        
+
+       def onHit_connectionSelector(self, evt):
+               self.updtFromForm()
+               
        
        def updtFromForm(self):
                """ Grab the current values from the form, and update
                the conneciton dictionary with them.
                """
+               # Make sure that changes to the current control are used.
+               self.activeControlValid()
                if self.currentConn is not None:
                        dd = self.connDict[self.currentConn]
                        for fld in dd.keys():
@@ -285,7 +301,8 @@
 
        
        def newConnection(self):
-               self.activeControlValid()
+               # Update the values
+               self.updtFromForm()
                newName = "Connection " + str(len(self.connDict.keys()) + 1)
                self.connDict[newName] = {"dbtype" : u"MySQL",
                                "name" : "",
@@ -300,7 +317,6 @@
                
        
        def saveFile(self):
-               self.activeControlValid()
                self.updtFromForm()
                if self._origConnDict != self.connDict:
                        self.writeChanges()
@@ -310,7 +326,8 @@
        def onConnectionChange(self, evt):
                newConn = self.connectionSelector.GetStringSelection()
                if newConn != self.currentConn:
-                       self.activeControlValid()
+                       # Update the values
+                       self.updtFromForm()
                        self.currentConn = newConn
                        self.populate()
        
@@ -325,9 +342,6 @@
                                if val != self.crypt.decrypt(dd["password"]):
                                        dd[fld] = self.crypt.encrypt(val)
                        else:
-                               
-                               print "SETTING DICT FLD:", fld
-                               
                                dd[fld] = val
                except StandardError, e:
                        print "Can't update:", e
@@ -338,13 +352,6 @@
                self.update()
                conn = self.currentConn
                self.connectionSelector.Value = conn
-#              connInfo = self.connDict[conn]
-#              self.hostText.Value = connInfo["host"]
-#              self.dbTypeSelector.Value = str(connInfo["dbtype"])
-#              self.portText.Value = connInfo["port"]
-#              self.dbText.Value = connInfo["database"]
-#              self.userText.Value = connInfo["user"]
-#              self.pwText.Value = self.crypt.decrypt(connInfo["password"])
                
 
        def openFile(self, connFile=None):




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to