Patches from Andrea

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-12-22 23:52:32 +00:00
parent c306c1e0f6
commit e1463b9df0

View File

@@ -924,7 +924,7 @@ class TreeTextCtrl(wx.TextCtrl):
else: else:
raise "\n ERROR: You Must Create An Image List To Use Images!" raise Exception("\n ERROR: You Must Create An Image List To Use Images!")
checkimage = item.GetCurrentCheckedImage() checkimage = item.GetCurrentCheckedImage()
@@ -1321,7 +1321,7 @@ class GenericTreeItem:
"""Returns whether the associated window is enabled or not.""" """Returns whether the associated window is enabled or not."""
if not self._wnd: if not self._wnd:
raise "\nERROR: This Item Has No Window Associated" raise Exception("\nERROR: This Item Has No Window Associated")
return self._windowenabled return self._windowenabled
@@ -1330,7 +1330,7 @@ class GenericTreeItem:
"""Sets whether the associated window is enabled or not.""" """Sets whether the associated window is enabled or not."""
if not self._wnd: if not self._wnd:
raise "\nERROR: This Item Has No Window Associated" raise Exception("\nERROR: This Item Has No Window Associated")
self._windowenabled = enable self._windowenabled = enable
self._wnd.Enable(enable) self._wnd.Enable(enable)
@@ -1993,7 +1993,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Toggles the item selection.""" """Toggles the item selection."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
self.SelectItem(item, not self.IsSelected(item)) self.SelectItem(item, not self.IsSelected(item))
@@ -2023,7 +2023,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Enables/disables an item.""" """Enables/disables an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if item.IsEnabled() == enable: if item.IsEnabled() == enable:
return return
@@ -2054,7 +2054,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether an item is enabled or disabled.""" """Returns whether an item is enabled or disabled."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsEnabled() return item.IsEnabled()
@@ -2076,7 +2076,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether an item is checked or not.""" """Returns whether an item is checked or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsChecked() return item.IsChecked()
@@ -2123,7 +2123,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
# Should we raise an error here?!? # Should we raise an error here?!?
if item.GetType() == 0: if item.GetType() == 0:
@@ -2173,7 +2173,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Transverses the tree and toggles the items. Meaningful only for check items.""" """Transverses the tree and toggles the items. Meaningful only for check items."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
child, cookie = self.GetFirstChild(item) child, cookie = self.GetFirstChild(item)
@@ -2193,7 +2193,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Transverses the tree and checks/unchecks the items. Meaningful only for check items.""" """Transverses the tree and checks/unchecks the items. Meaningful only for check items."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
(child, cookie) = self.GetFirstChild(item) (child, cookie) = self.GetFirstChild(item)
@@ -2213,7 +2213,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
Meaningful only for check items.""" Meaningful only for check items."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
parent = item.GetParent() parent = item.GetParent()
if not parent or parent.GetType() != 1: if not parent or parent.GetType() != 1:
@@ -2234,7 +2234,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Programatically check/uncheck item children. Does not generate EVT_TREE_CHECK* events.""" """Programatically check/uncheck item children. Does not generate EVT_TREE_CHECK* events."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if checked == None: if checked == None:
self.AutoToggleChild(item) self.AutoToggleChild(item)
@@ -2270,7 +2270,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Starts editing an item label.""" """Starts editing an item label."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
self.Edit(item) self.Edit(item)
@@ -2305,7 +2305,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether an item has children or not.""" """Returns whether an item has children or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return len(item.GetChildren()) > 0 return len(item.GetChildren()) > 0
@@ -2314,7 +2314,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the item children count.""" """Gets the item children count."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetChildrenCount(recursively) return item.GetChildrenCount(recursively)
@@ -2363,7 +2363,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the item text.""" """Returns the item text."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetText() return item.GetText()
@@ -2372,7 +2372,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the item image.""" """Returns the item image."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetImage(which) return item.GetImage(which)
@@ -2381,7 +2381,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the data associated to an item.""" """Returns the data associated to an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetData() return item.GetData()
@@ -2392,7 +2392,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the item text colour.""" """Returns the item text colour."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.Attr().GetTextColour() return item.Attr().GetTextColour()
@@ -2401,7 +2401,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the item background colour.""" """Returns the item background colour."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.Attr().GetBackgroundColour() return item.Attr().GetBackgroundColour()
@@ -2410,7 +2410,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the item font.""" """Returns the item font."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.Attr().GetFont() return item.Attr().GetFont()
@@ -2419,7 +2419,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether an item is hypertext or not.""" """Returns whether an item is hypertext or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsHyperText() return item.IsHyperText()
@@ -2428,7 +2428,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item text.""" """Sets the item text."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
dc = wx.ClientDC(self) dc = wx.ClientDC(self)
item.SetText(text) item.SetText(text)
@@ -2440,7 +2440,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item image, depending on the item state.""" """Sets the item image, depending on the item state."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.SetImage(image, which) item.SetImage(image, which)
@@ -2453,7 +2453,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the data associated to an item.""" """Sets the data associated to an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.SetData(data) item.SetData(data)
@@ -2464,7 +2464,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Forces the appearance of the button next to the item.""" """Forces the appearance of the button next to the item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.SetHasPlus(has) item.SetHasPlus(has)
self.RefreshLine(item) self.RefreshLine(item)
@@ -2474,7 +2474,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item font bold/unbold.""" """Sets the item font bold/unbold."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
# avoid redrawing the tree if no real change # avoid redrawing the tree if no real change
if item.IsBold() != bold: if item.IsBold() != bold:
@@ -2486,7 +2486,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item font italic/non-italic.""" """Sets the item font italic/non-italic."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if item.IsItalic() != italic: if item.IsItalic() != italic:
itemFont = self.GetItemFont(item) itemFont = self.GetItemFont(item)
@@ -2508,7 +2508,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if highlight: if highlight:
bg = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT) bg = wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT)
@@ -2523,7 +2523,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item text colour.""" """Sets the item text colour."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if self.GetItemTextColour(item) == col: if self.GetItemTextColour(item) == col:
return return
@@ -2536,7 +2536,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item background colour.""" """Sets the item background colour."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.Attr().SetBackgroundColour(col) item.Attr().SetBackgroundColour(col)
self.RefreshLine(item) self.RefreshLine(item)
@@ -2546,7 +2546,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets whether the item is hypertext or not.""" """Sets whether the item is hypertext or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.SetHyperText(hyper) item.SetHyperText(hyper)
self.RefreshLine(item) self.RefreshLine(item)
@@ -2556,7 +2556,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets the item font.""" """Sets the item font."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if self.GetItemFont(item) == font: if self.GetItemFont(item) == font:
return return
@@ -2621,7 +2621,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Sets whether an hypertext item was visited.""" """Sets whether an hypertext item was visited."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
item.SetVisited(visited) item.SetVisited(visited)
self.RefreshLine(item) self.RefreshLine(item)
@@ -2631,7 +2631,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether an hypertext item was visited.""" """Returns whether an hypertext item was visited."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetVisited() return item.GetVisited()
@@ -2803,7 +2803,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the window associated to the item (if any).""" """Returns the window associated to the item (if any)."""
if not item: if not item:
raise "\nERROR: Invalid Item" raise Exception("\nERROR: Invalid Item")
return item.GetWindow() return item.GetWindow()
@@ -2812,7 +2812,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the window associated to the item is enabled.""" """Returns whether the window associated to the item is enabled."""
if not item: if not item:
raise "\nERROR: Invalid Item" raise Exception("\nERROR: Invalid Item")
return item.GetWindowEnabled() return item.GetWindowEnabled()
@@ -2821,7 +2821,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Enables/disables the window associated to the item.""" """Enables/disables the window associated to the item."""
if not item: if not item:
raise "\nERROR: Invalid Item" raise Exception("\nERROR: Invalid Item")
item.SetWindowEnabled(enable) item.SetWindowEnabled(enable)
@@ -2835,7 +2835,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Item" raise Exception("\nERROR: Invalid Item")
return item.GetType() return item.GetType()
@@ -2847,7 +2847,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item is visible or not.""" """Returns whether the item is visible or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
# An item is only visible if it's not a descendant of a collapsed item # An item is only visible if it's not a descendant of a collapsed item
parent = item.GetParent() parent = item.GetParent()
@@ -2880,7 +2880,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item has children or not.""" """Returns whether the item has children or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
# consider that the item does have children if it has the "+" button: it # consider that the item does have children if it has the "+" button: it
# might not have them (if it had never been expanded yet) but then it # might not have them (if it had never been expanded yet) but then it
@@ -2894,7 +2894,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item is expanded or not.""" """Returns whether the item is expanded or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsExpanded() return item.IsExpanded()
@@ -2903,7 +2903,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item is selected or not.""" """Returns whether the item is selected or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsSelected() return item.IsSelected()
@@ -2912,7 +2912,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item font is bold or not.""" """Returns whether the item font is bold or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsBold() return item.IsBold()
@@ -2921,7 +2921,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns whether the item font is italic or not.""" """Returns whether the item font is italic or not."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.IsItalic() return item.IsItalic()
@@ -2934,7 +2934,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the item parent.""" """Gets the item parent."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
return item.GetParent() return item.GetParent()
@@ -2943,7 +2943,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the item first child.""" """Gets the item first child."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
cookie = 0 cookie = 0
return self.GetNextChild(item, cookie) return self.GetNextChild(item, cookie)
@@ -2956,7 +2956,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
children = item.GetChildren() children = item.GetChildren()
@@ -2977,7 +2977,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the item last child.""" """Gets the item last child."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
children = item.GetChildren() children = item.GetChildren()
return (len(children) == 0 and [None] or [children[-1]])[0] return (len(children) == 0 and [None] or [children[-1]])[0]
@@ -2987,7 +2987,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the next sibling of an item.""" """Gets the next sibling of an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
i = item i = item
parent = i.GetParent() parent = i.GetParent()
@@ -3008,7 +3008,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the previous sibling of an item.""" """Gets the previous sibling of an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
i = item i = item
parent = i.GetParent() parent = i.GetParent()
@@ -3028,7 +3028,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the next item. Only for internal use right now.""" """Gets the next item. Only for internal use right now."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
i = item i = item
@@ -3066,7 +3066,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Returns the next visible item.""" """Returns the next visible item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
id = item id = item
@@ -3081,9 +3081,9 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
def GetPrevVisible(self, item): def GetPrevVisible(self, item):
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
raise "\nERROR: Not Implemented" raise Exception("\nERROR: Not Implemented")
return None return None
@@ -3141,13 +3141,13 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Actually inserts an item in the tree.""" """Actually inserts an item in the tree."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if ct_type < 0 or ct_type > 2: if ct_type < 0 or ct_type > 2:
raise "\nERROR: Item Type Should Be 0 (Normal), 1 (CheckBox) or 2 (RadioButton). " raise Exception("\nERROR: Item Type Should Be 0 (Normal), 1 (CheckBox) or 2 (RadioButton). ")
parent = parentId parent = parentId
@@ -3173,16 +3173,16 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Adds a root to the CustomTreeCtrl. Only one root must exist.""" """Adds a root to the CustomTreeCtrl. Only one root must exist."""
if self._anchor: if self._anchor:
raise "\nERROR: Tree Can Have Only One Root" raise Exception("\nERROR: Tree Can Have Only One Root")
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if ct_type < 0 or ct_type > 2: if ct_type < 0 or ct_type > 2:
raise "\nERROR: Item Type Should Be 0 (Normal), 1 (CheckBox) or 2 (RadioButton). " raise Exception("\nERROR: Item Type Should Be 0 (Normal), 1 (CheckBox) or 2 (RadioButton). ")
self._dirty = True # do this first so stuff below doesn't cause flicker self._dirty = True # do this first so stuff below doesn't cause flicker
@@ -3212,10 +3212,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Appends an item as a first child of parent.""" """Appends an item as a first child of parent."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
return self.DoInsertItem(parent, 0, text, ct_type, wnd, image, selImage, data) return self.DoInsertItem(parent, 0, text, ct_type, wnd, image, selImage, data)
@@ -3224,10 +3224,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Auxiliary function to cope with the C++ hideous multifunction.""" """Auxiliary function to cope with the C++ hideous multifunction."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
parent = parentId parent = parentId
@@ -3241,7 +3241,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
try: try:
index = parent.GetChildren().index(idPrevious) index = parent.GetChildren().index(idPrevious)
except: except:
raise "ERROR: Previous Item In CustomTreeCtrl.InsertItem() Is Not A Sibling" raise Exception("ERROR: Previous Item In CustomTreeCtrl.InsertItem() Is Not A Sibling")
return self.DoInsertItem(parentId, index+1, text, ct_type, wnd, image, selImage, data) return self.DoInsertItem(parentId, index+1, text, ct_type, wnd, image, selImage, data)
@@ -3250,10 +3250,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Auxiliary function to cope with the C++ hideous multifunction.""" """Auxiliary function to cope with the C++ hideous multifunction."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
parent = parentId parent = parentId
@@ -3268,10 +3268,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Inserts an item after the given previous.""" """Inserts an item after the given previous."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if type(input) == type(1): if type(input) == type(1):
return self.InsertItemByIndex(parentId, input, text, ct_type, wnd, image, selImage, data) return self.InsertItemByIndex(parentId, input, text, ct_type, wnd, image, selImage, data)
@@ -3283,10 +3283,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Appends an item as a last child of its parent.""" """Appends an item as a last child of its parent."""
if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if wnd is not None and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert Controls You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT): if text.find("\n") >= 0 and not (self._windowStyle & TR_HAS_VARIABLE_ROW_HEIGHT):
raise "\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT" raise Exception("\nERROR: In Order To Append/Insert A MultiLine Text You Have To Use The Style TR_HAS_VARIABLE_ROW_HEIGHT")
parent = parentId parent = parentId
@@ -3344,7 +3344,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Delete item children.""" """Delete item children."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
self._dirty = True # do this first so stuff below doesn't cause flicker self._dirty = True # do this first so stuff below doesn't cause flicker
@@ -3356,7 +3356,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Delete an item.""" """Delete an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
self._dirty = True # do this first so stuff below doesn't cause flicker self._dirty = True # do this first so stuff below doesn't cause flicker
@@ -3433,10 +3433,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if self.HasFlag(TR_HIDE_ROOT) and item == self.GetRootItem(): if self.HasFlag(TR_HIDE_ROOT) and item == self.GetRootItem():
raise "\nERROR: Can't Expand An Hidden Root. " raise Exception("\nERROR: Can't Expand An Hidden Root. ")
if not item.HasPlus(): if not item.HasPlus():
return return
@@ -3469,7 +3469,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Expands all the items.""" """Expands all the items."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if not self.HasFlag(TR_HIDE_ROOT) or item != self.GetRootItem(): if not self.HasFlag(TR_HIDE_ROOT) or item != self.GetRootItem():
self.Expand(item) self.Expand(item)
@@ -3490,10 +3490,10 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if self.HasFlag(TR_HIDE_ROOT) and item == self.GetRootItem(): if self.HasFlag(TR_HIDE_ROOT) and item == self.GetRootItem():
raise "\nERROR: Can't Collapse An Hidden Root. " raise Exception("\nERROR: Can't Collapse An Hidden Root. ")
if not item.IsExpanded(): if not item.IsExpanded():
return return
@@ -3644,7 +3644,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Actually selects/unselects an item, sending a EVT_TREE_SEL_CHANGED event.""" """Actually selects/unselects an item, sending a EVT_TREE_SEL_CHANGED event."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
self._select_me = None self._select_me = None
@@ -3725,7 +3725,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Selects/deselects an item.""" """Selects/deselects an item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
if select: if select:
@@ -3749,7 +3749,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
if item.IsSelected(): if item.IsSelected():
array.append(item) array.append(item)
if item.HasChildren(): if item.HasChildren() and item.IsExpanded():
for child in item.GetChildren(): for child in item.GetChildren():
array = self.FillArray(child, array) array = self.FillArray(child, array)
@@ -3776,7 +3776,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Ensure that an item is visible in CustomTreeCtrl.""" """Ensure that an item is visible in CustomTreeCtrl."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
# first expand all parent branches # first expand all parent branches
parent = item.GetParent() parent = item.GetParent()
@@ -3860,7 +3860,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
""" """
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
children = item.GetChildren() children = item.GetChildren()
@@ -5025,7 +5025,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Gets the bounding rectangle of the item.""" """Gets the bounding rectangle of the item."""
if not item: if not item:
raise "\nERROR: Invalid Tree Item. " raise Exception("\nERROR: Invalid Tree Item. ")
i = item i = item
@@ -5663,7 +5663,7 @@ class CustomTreeCtrl(wx.PyScrolledWindow):
"""Thaw CustomTreeCtrl.""" """Thaw CustomTreeCtrl."""
if self._freezeCount == 0: if self._freezeCount == 0:
raise "\nERROR: Thawing Unfrozen Tree Control?" raise Exception("\nERROR: Thawing Unfrozen Tree Control?")
self._freezeCount = self._freezeCount - 1 self._freezeCount = self._freezeCount - 1