[Spambayes-checkins] spambayes/Outlook2000/dialogs async_processor.py, 1.5, 1.6 dlgcore.py, 1.11, 1.12 processors.py, 1.9, 1.10

Mark Hammond mhammond at users.sourceforge.net
Tue Aug 26 20:11:41 EDT 2003


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

Modified Files:
	async_processor.py dlgcore.py processors.py 
Log Message:
If an async process is running as the dialog dies, wait for it to finish
(otherwise the main thread may be get upset, particularly if it is 
finishing!


Index: async_processor.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/async_processor.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** async_processor.py	24 Aug 2003 12:01:52 -0000	1.5
--- async_processor.py	27 Aug 2003 02:11:38 -0000	1.6
***************
*** 124,142 ****
                                  win32con.MB_OK | win32con.MB_ICONEXCLAMATION)
          return not self.running
!         # Here is an alternative to stop the process and wait for it to finish
!         # But auto-stopping on a tab-switch isn't really what we want.  If we
!         # were *really* clever, we could allow it to continue - but we aren't.
!         #if self.running:
!         #    self.progress.request_stop()
!         #    for i in xrange(500): # 5 seconds
!         #        win32gui.PumpWaitingMessages(0,-1)
!         #        if i % 50 == 0:
!         #            print "Still waiting for async process to finish..."
!         #        time.sleep(0.01)
!         #        if not self.running:
!         #            break
!         #    else:
!         #        print "XXX - eeek - gave up waiting for async process to stop"
!         #return True
  
      def GetMessages(self):
--- 124,140 ----
                                  win32con.MB_OK | win32con.MB_ICONEXCLAMATION)
          return not self.running
!     def Term(self):
!         # The Window is dieing!  We *must* kill it and wait for it to finish
!         # else bad things happen once the main thread dies before us!
!         if self.running:
!             self.progress.request_stop()
!             i = 0
!             while self.running:
!                 win32gui.PumpWaitingMessages(0,-1)
!                 if i % 100 == 0:
!                     print "Still waiting for async process to finish..."
!                 time.sleep(0.01)
!                 i += 1
!         return True
  
      def GetMessages(self):

Index: dlgcore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/dlgcore.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dlgcore.py	24 Aug 2003 14:07:09 -0000	1.11
--- dlgcore.py	27 Aug 2003 02:11:38 -0000	1.12
***************
*** 247,250 ****
--- 247,252 ----
      def OnDestroy(self, hwnd, msg, wparam, lparam):
          #print "OnDestroy"
+         for p in self.all_processors:
+             p.Term()
          TooltipDialog.OnDestroy(self, hwnd, msg, wparam, lparam)
          self.command_processors = None

Index: processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/processors.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** processors.py	27 Aug 2003 00:05:59 -0000	1.9
--- processors.py	27 Aug 2003 02:11:38 -0000	1.10
***************
*** 19,24 ****
      def Init(self):
          pass
!     def Done(self):
          return True
      def GetControl(self, control_id = None):
          control_id = control_id or self.control_id
--- 19,26 ----
      def Init(self):
          pass
!     def Done(self): # done with 'ok' - ie, save options.  May return false.
          return True
+     def Term(self): # closing - can't fail.
+         pass
      def GetControl(self, control_id = None):
          control_id = control_id or self.control_id





More information about the Spambayes-checkins mailing list