Commit by: morgen
Modified files:
chandler/Chandler.py 1.64 1.65
chandler/application/Application.py 1.303 1.304

Log message:
Fix for bug 2277 -- you can execute Chandler.exe multiple times, r=capps


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/Chandler.py.diff?r1=text&tr1=1.64&r2=text&tr2=1.65
http://cvs.osafoundation.org/index.cgi/chandler/application/Application.py.diff?r1=text&tr1=1.303&r2=text&tr2=1.304

Index: chandler/Chandler.py
diff -u chandler/Chandler.py:1.64 chandler/Chandler.py:1.65
--- chandler/Chandler.py:1.64   Tue Mar  1 13:15:01 2005
+++ chandler/Chandler.py        Wed Mar  2 12:55:15 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.64 $"
-__date__ = "$Date: 2005/03/01 21:15:01 $"
+__version__ = "$Revision: 1.65 $"
+__date__ = "$Date: 2005/03/02 20:55:15 $"
 __copyright__ = "Copyright (c) 2003-2005 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm";
 
@@ -68,7 +68,6 @@
                      'stderr':     ('-e', '--stderr',     'b', False, None, 
'Echo error output to log file'),
                      'create':     ('-c', '--create',     'b', False, None, 
'Force creation of a new repository'),
                      'ramdb':      ('-d', '--ramdb',      'b', False, None, 
''),
-                     'exclusive':  ('-x', '--exclusive',  'b', False, None, 
'open repository exclusive'),
                      'repo':       ('-r', '--repo',       's', None,  None, 
'repository to copy during startup'),
                      'recover':    ('-R', '--recover',    'b', False, None, 
'open repository with recovery'),
                      'nocatch':    ('-n', '--nocatch',    'b', False, None, 
''),
@@ -171,7 +170,17 @@
         # The normal way: wrap the app in an exception frame
         try:
             import logging, traceback, wx
+            from repository.persistence.RepositoryError import 
RepositoryOpenDeniedError, ExclusiveOpenDeniedError
             realMain()
+
+        except (RepositoryOpenDeniedError, ExclusiveOpenDeniedError):
+            message = "Another instance of Chandler currently has the " \
+                      "repository open."
+            logging.exception(message)
+            dialog = wx.MessageDialog(None, message, "Chandler", wx.OK | 
wx.ICON_INFORMATION)
+            dialog.ShowModal()
+            dialog.Destroy()
+
         except Exception, exception:
             type, value, stack = sys.exc_info()
             formattedBacktrace = "".join (traceback.format_exception (type, 
value, stack, 5))

Index: chandler/application/Application.py
diff -u chandler/application/Application.py:1.303 
chandler/application/Application.py:1.304
--- chandler/application/Application.py:1.303   Wed Mar  2 08:08:08 2005
+++ chandler/application/Application.py Wed Mar  2 12:55:15 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.303 $"
-__date__ = "$Date: 2005/03/02 16:08:08 $"
+__version__ = "$Revision: 1.304 $"
+__date__ = "$Date: 2005/03/02 20:55:15 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm";
 
@@ -221,19 +221,21 @@
                  'ramdb': options.ramdb,
                  'create': True,
                  'recover': options.recover,
-                 'exclusive': options.exclusive,
+                 'exclusive': True,
                  'refcounted': True }
-                 
+
         if Globals.options.repo:
             kwds['fromPath'] = Globals.options.repo
         wx.Yield()
         self.repository = DBRepository(path)
+
         if Globals.options.create:
             self.repository.create(**kwds)
         else:
             self.repository.open(**kwds)
+
         wx.Yield()
-        
+
         self.UIRepositoryView = self.repository.getCurrentView()
 
         if not self.UIRepositoryView.findPath('//Packs/Schema'):

_______________________________________________
Commits mailing list
Commits@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to