[Commits] (morgen) Account prefs dialog now should get sized properly on each platform.

commits at osafoundation.org commits at osafoundation.org
Tue Sep 14 12:35:17 PDT 2004


Commit by: morgen
Modified files:
chandler/application/dialogs/AccountPreferences.py 1.4 1.5
chandler/application/dialogs/AccountPreferences.wdr 1.3 1.4
chandler/application/dialogs/AccountPreferences_wdr.xrc 1.3 1.4

Log message:
Account prefs dialog now should get sized properly on each platform.
Previously its size was hardcoded.  Also, when you switch between accounts
the dialog should resize to fit each form.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences.py.diff?r1=text&tr1=1.4&r2=text&tr2=1.5
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences.wdr.diff?r1=text&tr1=1.3&r2=text&tr2=1.4
http://cvs.osafoundation.org/index.cgi/chandler/application/dialogs/AccountPreferences_wdr.xrc.diff?r1=text&tr1=1.3&r2=text&tr2=1.4

Index: chandler/application/dialogs/AccountPreferences_wdr.xrc
diff -u chandler/application/dialogs/AccountPreferences_wdr.xrc:1.3 chandler/application/dialogs/AccountPreferences_wdr.xrc:1.4
--- chandler/application/dialogs/AccountPreferences_wdr.xrc:1.3	Fri Aug 27 14:05:49 2004
+++ chandler/application/dialogs/AccountPreferences_wdr.xrc	Tue Sep 14 12:35:15 2004
@@ -4,74 +4,7 @@
 
 <resource>
 
-<object class="wxDialog" name="AccountPrefsDialog">
-    <title>Account Preferences</title>
-    <object class="wxBoxSizer" name="OUTER_SIZER">
-        <orient>wxVERTICAL</orient>
-        <object class="sizeritem">
-            <flag>wxALL</flag>
-            <border>5</border>
-            <object class="wxBoxSizer" name="LIST_AND_DETAILS_SIZER">
-                <orient>wxHORIZONTAL</orient>
-                <object class="sizeritem">
-                    <flag>wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
-                    <border>5</border>
-                    <object class="wxBoxSizer" name="LIST_SIZER">
-                        <orient>wxVERTICAL</orient>
-                        <object class="sizeritem">
-                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
-                            <border>5</border>
-                            <object class="wxStaticText" name="ID_TEXT">
-                                <label>Accounts</label>
-                            </object>
-                        </object>
-                        <object class="sizeritem">
-                            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
-                            <border>5</border>
-                            <object class="wxListBox" name="ACCOUNTS_LIST">
-                                <size>150,180</size>
-                                <style>wxLB_SINGLE</style>
-                                <content>
-                                </content>
-                            </object>
-                        </object>
-                    </object>
-                </object>
-                <object class="sizeritem">
-                    <flag>wxALIGN_CENTER_HORIZONTAL|wxALL</flag>
-                    <border>5</border>
-                    <object class="wxPanel" name="DETAILS_PANEL">
-                        <size>330,270</size>
-                    </object>
-                </object>
-            </object>
-        </object>
-        <object class="sizeritem">
-            <flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</flag>
-            <border>5</border>
-            <object class="wxBoxSizer">
-                <orient>wxHORIZONTAL</orient>
-                <object class="sizeritem">
-                    <flag>wxALIGN_CENTER|wxALL</flag>
-                    <border>5</border>
-                    <object class="wxButton" name="OK_BUTTON">
-                        <label>OK</label>
-                        <default>1</default>
-                    </object>
-                </object>
-                <object class="sizeritem">
-                    <flag>wxALIGN_CENTER|wxALL</flag>
-                    <border>5</border>
-                    <object class="wxButton" name="CANCEL_BUTTON">
-                        <label>Cancel</label>
-                    </object>
-                </object>
-            </object>
-        </object>
-    </object>
-</object>
-
-<object class="wxPanel" name="SMTPPane">
+<object class="wxPanel" name="SMTPPanel">
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
@@ -217,7 +150,7 @@
     </object>
 </object>
 
-<object class="wxPanel" name="IMAPPane">
+<object class="wxPanel" name="IMAPPanel">
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
@@ -383,7 +316,7 @@
     </object>
 </object>
 
-<object class="wxPanel" name="WebDAVPane">
+<object class="wxPanel" name="WebDAVPanel">
     <object class="wxBoxSizer">
         <orient>wxVERTICAL</orient>
         <object class="sizeritem">
@@ -532,4 +465,48 @@
     </object>
 </object>
 
+<object class="wxPanel" name="AccountsPanel">
+    <object class="wxBoxSizer">
+        <orient>wxVERTICAL</orient>
+        <object class="sizeritem">
+            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+            <border>5</border>
+            <object class="wxStaticText" name="ID_TEXT">
+                <label>Accounts</label>
+            </object>
+        </object>
+        <object class="sizeritem">
+            <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+            <border>5</border>
+            <object class="wxListBox" name="ACCOUNTS_LIST">
+                <size>150,180</size>
+                <style>wxLB_SINGLE</style>
+                <content>
+                </content>
+            </object>
+        </object>
+    </object>
+</object>
+
+<object class="wxPanel" name="OkCancelPanel">
+    <object class="wxBoxSizer">
+        <orient>wxHORIZONTAL</orient>
+        <object class="sizeritem">
+            <flag>wxALIGN_CENTER|wxALL</flag>
+            <border>5</border>
+            <object class="wxButton" name="OK_BUTTON">
+                <label>OK</label>
+                <default>1</default>
+            </object>
+        </object>
+        <object class="sizeritem">
+            <flag>wxALIGN_CENTER|wxALL</flag>
+            <border>5</border>
+            <object class="wxButton" name="CANCEL_BUTTON">
+                <label>Cancel</label>
+            </object>
+        </object>
+    </object>
+</object>
+
 </resource>

Index: chandler/application/dialogs/AccountPreferences.py
diff -u chandler/application/dialogs/AccountPreferences.py:1.4 chandler/application/dialogs/AccountPreferences.py:1.5
--- chandler/application/dialogs/AccountPreferences.py:1.4	Fri Aug 27 14:05:49 2004
+++ chandler/application/dialogs/AccountPreferences.py	Tue Sep 14 12:35:15 2004
@@ -48,7 +48,7 @@
                 "type" : "boolean",
             },
         },
-        "id" : "IMAPPane",
+        "id" : "IMAPPanel",
     },
     "SMTP" : {
         "fields" : {
@@ -81,7 +81,7 @@
                 "type" : "string",
             },
         },
-        "id" : "SMTPPane",
+        "id" : "SMTPPanel",
     },
     "WebDAV" : {
         "fields" : {
@@ -114,21 +114,39 @@
                 "type" : "boolean",
             },
         },
-        "id" : "WebDAVPane",
+        "id" : "WebDAVPanel",
     },
 }
 
 class AccountPreferencesDialog(wx.Dialog):
-    def __init__(self, parent, resources):
-        pre = wx.PreDialog()
+
+    def __init__(self, parent, title, size=wx.DefaultSize,
+         pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, resources=None):
+
+        wx.Dialog.__init__(self, parent, -1, title, pos, size, style)
+
         self.resources = resources
-        resources.LoadOnDialog(pre, parent, 'AccountPrefsDialog')
-        self.this = pre.this
+
+        # innerSizer will have two children to manage: on the left is the
+        # AccountsPanel and on the right is the switchable detail panel
+        self.innerSizer = wx.BoxSizer(wx.HORIZONTAL)
+        self.accountsPanel = self.resources.LoadPanel(self, "AccountsPanel")
+        self.innerSizer.Add(self.accountsPanel, 0, wx.ALIGN_TOP|wx.ALL, 5)
+
+        # outerSizer will have two children to manage: on top is innerSizer,
+        # and below that is the OkCancelPanel
+        self.outerSizer = wx.BoxSizer(wx.VERTICAL)
+        self.outerSizer.Add(self.innerSizer, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
+        self.okCancelPanel = self.resources.LoadPanel(self, "OkCancelPanel")
+        self.outerSizer.Add(self.okCancelPanel, 0, wx.ALIGN_RIGHT|wx.ALL, 5)
+
+        self.SetSizer(self.outerSizer)
+        self.outerSizer.Fit(self)
 
         self.accountsList = wx.xrc.XRCCTRL(self, "ACCOUNTS_LIST")
-        self.detailsPanel = wx.xrc.XRCCTRL(self, "DETAILS_PANEL")
         self.currentIndex = None # the list index of account in detail panel
         self.currentPanelType = None
+        self.currentPanel = None # whatever detail panel we swap in
         self.data = [ ]
 
         wx.EVT_BUTTON( self, wx.xrc.XRCID( "OK_BUTTON" ), self.OnOk )
@@ -144,7 +162,7 @@
             be editing. """
 
         # Make sure we're sync'ed with any changes other threads have made
-        repo.commit()
+        repo.refresh()
 
         accountKind = pm.lookup(MAIL_MODEL, "AccountBase")
         webDavAccountKind = pm.lookup(WEBDAV_MODEL, "WebDAVAccount")
@@ -184,19 +202,26 @@
             (if any) contents to the data list, destroy current pane, determine
             type of pane to pull in, load it, populated it. """
 
+
+        if index == self.currentIndex: return
+
         if self.currentIndex != None:
             # Get current form data and tuck it away
             self.__StoreFormData(self.currentPanelType, self.currentPanel,
              self.data[self.currentIndex]['values'])
-            self.detailsPanel.DestroyChildren()
+            self.currentPanel.Destroy()
 
         self.currentIndex = index
         self.currentPanelType = self.data[index]['item'].accountType
-        self.currentPanel = self.resources.LoadPanel(self.detailsPanel,
+        self.currentPanel = self.resources.LoadPanel(self,
          PANELS[self.currentPanelType]['id'])
         self.__FetchFormData(self.currentPanelType, self.currentPanel,
          self.data[index]['values'])
 
+        self.innerSizer.Add(self.currentPanel, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
+        self.outerSizer.Fit(self)
+
+
     def __StoreFormData(self, panelType, panel, data):
         for field in PANELS[panelType]['fields'].keys():
             control = wx.xrc.XRCCTRL(panel, field)
@@ -238,7 +263,8 @@
         xrcFile = os.path.join(application.Globals.chandlerDirectory,
          'application', 'dialogs', 'AccountPreferences_wdr.xrc')
         resources = wx.xrc.XmlResource(xrcFile)
-        win = AccountPreferencesDialog(parent, resources)
+        win = AccountPreferencesDialog(parent, "Account Preferences",
+         resources=resources)
         win.CenterOnScreen()
         val = win.ShowModal()
         win.Destroy()



More information about the Commits mailing list