comparison easyhg.py @ 210:c5fceb3fe5b4

* OS/X: Add script to run external diff; add space around tab widget; textual fixes * Bail out of easyhg.py in uisetup rather than at extension load time if we can't load PyQt4 -- that way we find out about it in easyhg * Ensure editing the default path works even if hgrc doesn't yet exist; ensure path and branch are reset (to empty and default) if their respective files are absent
author Chris Cannam
date Wed, 05 Jan 2011 14:31:07 +0000
parents 07b908b4fa5f
children 960b782f0a64
comparison
equal deleted inserted replaced
209:0b040abb2aa3 210:c5fceb3fe5b4
24 # 24 #
25 easyhg_import_path = 'NO_EASYHG_IMPORT_PATH' 25 easyhg_import_path = 'NO_EASYHG_IMPORT_PATH'
26 if not easyhg_import_path.startswith('NO_'): 26 if not easyhg_import_path.startswith('NO_'):
27 sys.path.append(easyhg_import_path) 27 sys.path.append(easyhg_import_path)
28 28
29 from PyQt4 import QtGui 29 # Try to load the PyQt4 module that we need. If this fails, we should
30 # bail out later (in uisetup), because if we bail out now, Mercurial
31 # will just continue without us and report success. The invoking
32 # application needs to be able to discover whether the module load
33 # succeeded or not, so we need to ensure that Mercurial itself returns
34 # failure if it didn't.
35 #
36 easyhg_pyqt_ok = True
37 try:
38 from PyQt4 import QtGui
39 except ImportError as err:
40 easyhg_pyqt_ok = False
30 41
31 easyhg_qtapp = None 42 easyhg_qtapp = None
32 43
33 def uisetup(ui): 44 def uisetup(ui):
45 if not easyhg_pyqt_ok:
46 raise util.Abort(_('Failed to load PyQt4 module required by easyhg.py'))
34 ui.__class__.prompt = easyhg_prompt 47 ui.__class__.prompt = easyhg_prompt
35 ui.__class__.getpass = easyhg_getpass 48 ui.__class__.getpass = easyhg_getpass
36 global easyhg_qtapp 49 global easyhg_qtapp
37 easyhg_qtapp = QtGui.QApplication([]) 50 easyhg_qtapp = QtGui.QApplication([])
38 51