dabo Commit
Revision 6464
Date: 2011-02-24 09:19:56 -0800 (Thu, 24 Feb 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6464

Changed:
U   trunk/dabo/ui/uiwx/dTreeView.py

Log:
Fixes for instantiation time wx attribute handling.
As a general rule, using _addWindowStyleFlag() and _constructed() methods 
together should be avoided,
because it prevents passing attributes to the wx class when initialized.
I suppose that other controls are affected too.

Diff:
Modified: trunk/dabo/ui/uiwx/dTreeView.py
===================================================================
--- trunk/dabo/ui/uiwx/dTreeView.py     2011-02-23 16:25:42 UTC (rev 6463)
+++ trunk/dabo/ui/uiwx/dTreeView.py     2011-02-24 17:19:56 UTC (rev 6464)
@@ -1069,12 +1069,9 @@
                return self._hasWindowStyleFlag(wx.TR_EDIT_LABELS)
 
        def _setEditable(self, val):
-               if self._constructed():
-                       self._delWindowStyleFlag(wx.TR_EDIT_LABELS)
-                       if val:
-                               self._addWindowStyleFlag(wx.TR_EDIT_LABELS)
-               else:
-                       self._properties["Editable"] = val
+               self._delWindowStyleFlag(wx.TR_EDIT_LABELS)
+               if val:
+                       self._addWindowStyleFlag(wx.TR_EDIT_LABELS)
 
 
        def _getImageSize(self):
@@ -1154,71 +1151,63 @@
                return self._hasWindowStyleFlag(wx.TR_HAS_BUTTONS)
 
        def _setShowButtons(self, val):
-               if self._constructed():
-                       self._delWindowStyleFlag(wx.TR_HAS_BUTTONS)
+               if val:
                        self._delWindowStyleFlag(wx.TR_NO_BUTTONS)
-                       if val:
-                               self._addWindowStyleFlag(wx.TR_HAS_BUTTONS)
-                       else:
-                               self._addWindowStyleFlag(wx.TR_NO_BUTTONS)
+                       self._addWindowStyleFlag(wx.TR_HAS_BUTTONS)
+               else:
+                       self._delWindowStyleFlag(wx.TR_HAS_BUTTONS)
+                       self._addWindowStyleFlag(wx.TR_NO_BUTTONS)
+               if self._constructed():
                        try:
                                self.refresh()
                        except AttributeError:
                                # Control may not be constructed yet
                                pass
-               else:
-                       self._properties["ShowButtons"] = val
 
 
        def _getShowLines(self):
                return not self._hasWindowStyleFlag(wx.TR_NO_LINES)
 
        def _setShowLines(self, val):
+               self._delWindowStyleFlag(wx.TR_NO_LINES)
+               if not val:
+                       self._addWindowStyleFlag(wx.TR_NO_LINES)
                if self._constructed():
-                       self._delWindowStyleFlag(wx.TR_NO_LINES)
-                       if not val:
-                               self._addWindowStyleFlag(wx.TR_NO_LINES)
                        try:
                                self.refresh()
                        except AttributeError:
                                # Control may not be constructed yet
                                pass
-               else:
-                       self._properties["ShowLines"] = val
 
 
        def _getShowRootNode(self):
                return not self._hasWindowStyleFlag(wx.TR_HIDE_ROOT)
 
        def _setShowRootNode(self, val):
+               self._delWindowStyleFlag(wx.TR_HIDE_ROOT)
+               if not val:
+                       self._addWindowStyleFlag(wx.TR_HIDE_ROOT)
                if self._constructed():
-                       self._delWindowStyleFlag(wx.TR_HIDE_ROOT)
-                       if not val:
-                               self._addWindowStyleFlag(wx.TR_HIDE_ROOT)
                        try:
                                self.refresh()
                        except AttributeError:
                                # Control may not be constructed yet
                                pass
-               else:
-                       self._properties["ShowRootNode"] = val
 
 
        def _getShowRootNodeLines(self):
                return self._hasWindowStyleFlag(wx.TR_LINES_AT_ROOT)
 
        def _setShowRootNodeLines(self, val):
+               self._delWindowStyleFlag(wx.TR_LINES_AT_ROOT)
+               if val:
+                       self._addWindowStyleFlag(wx.TR_LINES_AT_ROOT)
                if self._constructed():
-                       self._delWindowStyleFlag(wx.TR_LINES_AT_ROOT)
-                       if val:
-                               self._addWindowStyleFlag(wx.TR_LINES_AT_ROOT)
                        try:
                                self.refresh()
                        except AttributeError:
                                # Control may not be constructed yet
                                pass
-               else:
-                       self._properties["ShowRootNodeLines"] = val
 
 
        def _getUseNodeToolTips(self):



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to