Changeset 4d53aac5f184…
Parent 8f47f0b3dfe0…
by
Changes to one file · Browse files at 4d53aac5f184 Showing diff from parent 8f47f0b3dfe0 Diff from another changeset...
@@ -519,10 +519,9 @@ demandimport.enable()
except ImportError:
dialog.error_dialog(self, _('Iniparse package not found'),
- _('Please install iniparse package'))
- self.destroy()
+ _('Please install iniparse package') + '\n' +
+ _('Settings are only shown, no changing is possible'))
print 'Please install http://code.google.com/p/iniparse/'
- return
# Catch close events
self.connect('response', self.should_live)
@@ -615,7 +614,7 @@ self.ini = self.load_config(self.rcpath)
self.refresh_vlist()
self.pathdata.clear()
- if 'paths' in list(self.ini):
+ if 'paths' in self.ini:
for name in self.ini['paths']:
path = self.ini['paths'][name]
safepath = hglib.toutf(url.hidepassword(path))
@@ -694,7 +693,7 @@
def dirty_event(self, *args):
if not self.dirty:
- self._btn_apply.set_sensitive(True)
+ self._btn_apply.set_sensitive(not hasattr(self.ini, '_readonly'))
self.dirty = True
def _add_path(self, *args):
@@ -1015,8 +1014,15 @@ f.write(_('# Generated by tortoisehg-config\n'))
f.close()
self.fn = fn
- import iniparse
- return iniparse.INIConfig(file(fn), optionxformvalue=None)
+ try:
+ import iniparse
+ return iniparse.INIConfig(file(fn), optionxformvalue=None)
+ except ImportError:
+ from mercurial import config
+ cfg = config.config()
+ cfg.read(fn)
+ cfg._readonly = True
+ return cfg
def record_new_value(self, cpath, newvalue, keephistory=True):
# 'newvalue' is converted to local encoding
@@ -1027,7 +1033,7 @@ except KeyError:
pass
return
- if section not in list(self.ini):
+ if section not in self.ini:
if hasattr(self.ini, '_new_namespace'):
self.ini._new_namespace(section)
else:
@@ -1042,6 +1048,9 @@ self.history.mrul(cpath).add(newvalue)
def _apply_clicked(self, *args):
+ if hasattr(self.ini, '_readonly'):
+ #dialog? Read only access, please install ...
+ return
# Reload history, since it may have been modified externally
self.history.read()
@@ -1058,7 +1067,7 @@ cpath = '.'.join(['paths', name])
self.record_new_value(cpath, path, False)
refreshlist.append(name)
- for name in list(self.ini.paths):
+ for name in self.ini.paths:
if name not in refreshlist:
del self.ini['paths'][name]
elif 'paths' in list(self.ini):
|
Loading...