[Spambayes-checkins] spambayes/Outlook2000/dialogs dlgcore.py, 1.10, 1.11

Mark Hammond mhammond at users.sourceforge.net
Sun Aug 24 08:07:11 EDT 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv7245

Modified Files:
	dlgcore.py 
Log Message:
Formalize dialog positioning so subclasses always call base OnInitDialog,
and have base OnInitDialog check for processors that refer to invalid
controls.


Index: dlgcore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dlgcore.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** dlgcore.py	24 Aug 2003 03:05:16 -0000	1.10
--- dlgcore.py	24 Aug 2003 14:07:09 -0000	1.11
***************
*** 100,105 ****
          return ret
  
!     def OnInitDialog(self, hwnd, msg, wparam, lparam):
!         self.hwnd = hwnd
          # centre the dialog
          desktop = win32gui.GetDesktopWindow()
--- 100,104 ----
          return ret
  
!     def DoInitialPosition(self):
          # centre the dialog
          desktop = win32gui.GetDesktopWindow()
***************
*** 109,113 ****
          dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
          centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)/2, (dt_b-dt_t)/2) )
!         win32gui.MoveWindow(hwnd, centre_x-(w/2), centre_y-(h/2), w, h, 0)
  
      def OnCommand(self, hwnd, msg, wparam, lparam):
--- 108,116 ----
          dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
          centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)/2, (dt_b-dt_t)/2) )
!         win32gui.MoveWindow(self.hwnd, centre_x-(w/2), centre_y-(h/2), w, h, 0)
!         
!     def OnInitDialog(self, hwnd, msg, wparam, lparam):
!         self.hwnd = hwnd
!         self.DoInitialPosition()
  
      def OnCommand(self, hwnd, msg, wparam, lparam):
***************
*** 209,212 ****
--- 212,222 ----
      def OnInitDialog(self, hwnd, msg, wparam, lparam):
          TooltipDialog.OnInitDialog(self, hwnd, msg, wparam, lparam)
+         if __debug__: # this is just a debugging aid
+             for int_id in self.command_processors:
+                 try:
+                     self.GetDlgItem(int_id)
+                 except win32gui.error:
+                     print "ERROR: Dialog item %s refers to an invalid control" % \
+                           self._GetIDName(int_id)
          self.LoadAllControls()
  
***************
*** 302,310 ****
          ProcessorDialog.__init__(self, parent, manager, config, idd,option_handlers)
          self.yoffset = yoffset
!     def OnInitDialog(self, hwnd, msg, wparam, lparam):
!         self.hwnd = hwnd
          # The hardcoded values are a bit of a hack.
          win32gui.SetWindowPos(self.hwnd, win32con.HWND_TOP, 1, self.yoffset, 0, 0, win32con.SWP_NOSIZE)
-         self.LoadAllControls()
      def CreateWindow(self):
          # modeless. Pages should have the WS_CHILD window style
--- 312,318 ----
          ProcessorDialog.__init__(self, parent, manager, config, idd,option_handlers)
          self.yoffset = yoffset
!     def DoInitialPosition(self):
          # The hardcoded values are a bit of a hack.
          win32gui.SetWindowPos(self.hwnd, win32con.HWND_TOP, 1, self.yoffset, 0, 0, win32con.SWP_NOSIZE)
      def CreateWindow(self):
          # modeless. Pages should have the WS_CHILD window style





More information about the Spambayes-checkins mailing list