# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1250446225 -32400
# Node ID 0be2e3b94fd9753d4ce0c13bf750294b4a55b8b1
# Parent  6649b4674f01c10fce6c82b4fa833adf30613c17
thgconfig: fix issue 'Apply' button never enable even if iniparse loaded

this bug was instroduced in <4d53aac5f184> in 'default' branch.
I don't know why 'hasattr' doesn't work. Instead of this, I choose more
explicitly way; add 'readonly' flag as a member variable of ConfigDialog.

diff --git a/hggtk/thgconfig.py b/hggtk/thgconfig.py
--- a/hggtk/thgconfig.py
+++ b/hggtk/thgconfig.py
@@ -515,11 +515,13 @@
         try:
             import iniparse
             iniparse.INIConfig
+            self.readonly = False
         except ImportError:
             dialog.error_dialog(self, _('Iniparse package not found'),
                          _('Please install iniparse package') + '\n' +
                          _('Settings are only shown, no changing is possible'))
             print 'Please install http://code.google.com/p/iniparse/'
+            self.readonly = True

         # Catch close events
         self.connect('response', self.should_live)
@@ -691,7 +693,7 @@

     def dirty_event(self, *args):
         if not self.dirty:
-            self._btn_apply.set_sensitive(not hasattr(self.ini, '_readonly'))
+            self._btn_apply.set_sensitive(not self.readonly)
             self.dirty = True

     def _add_path(self, *args):
@@ -1019,7 +1021,6 @@
             from mercurial import config
             cfg = config.config()
             cfg.read(fn)
-            cfg._readonly = True
             return cfg

     def record_new_value(self, cpath, newvalue, keephistory=True):
@@ -1046,7 +1047,7 @@
         self.history.mrul(cpath).add(newvalue)

     def _apply_clicked(self, *args):
-        if hasattr(self.ini, '_readonly'):
+        if self.readonly:
             #dialog? Read only access, please install ...
             return
         # Reload history, since it may have been modified externally

Attachment: thg-kuy_rev3596.patch
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to