]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/XRCed/tree.py
docstring update
[wxWidgets.git] / wxPython / wx / tools / XRCed / tree.py
index cb68fa49a64c5abf66c71d4616a432595b928786..95fa519d1e937491d9d8d74b26da203e4de60e35 100644 (file)
@@ -19,7 +19,10 @@ class MemoryFile:
         self.name = name
         self.buffer = ''
     def write(self, data):
-        self.buffer += data.encode(g.currentEncoding)
+        if g.currentEncoding:
+            self.buffer += data.encode(g.currentEncoding)
+        else:
+            self.buffer += data.encode()
     def close(self):
         wxMemoryFSHandler_AddFile(self.name, self.buffer)
 
@@ -105,6 +108,7 @@ class PullDownMenu:
     ID_EXPAND = wxNewId()
     ID_COLLAPSE = wxNewId()
     ID_PASTE_SIBLING = wxNewId()
+    ID_TOOL_PASTE = wxNewId()
     ID_SUBCLASS = wxNewId()
 
     def __init__(self, parent):
@@ -354,6 +358,8 @@ class HighLightBox:
     def Remove(self):
         map(wxWindow.Destroy, self.lines)
         g.testWin.highLight = None
+    def Refresh(self):
+        map(wxWindow.Refresh, self.lines)
 
 ################################################################################
 
@@ -647,6 +653,7 @@ class XML_Tree(wxTreeCtrl):
             g.testWin.highLight.Replace(pos, size)
         else:
             g.testWin.highLight = HighLightBox(pos, size)
+        g.testWin.highLight.Refresh()
         g.testWin.highLight.item = item
 
     def ShowTestWindow(self, item):
@@ -768,7 +775,7 @@ class XML_Tree(wxTreeCtrl):
         memFile.close()                 # write to wxMemoryFS
         xmlFlags = wxXRC_NO_SUBCLASSING
         # Use translations if encoding is not specified
-        if g.currentEncoding == 'ascii':
+        if not g.currentEncoding:
             xmlFlags != wxXRC_USE_LOCALE
         res = wxXmlResource('', xmlFlags)
         res.Load('memory:xxx.xrc')
@@ -874,7 +881,7 @@ class XML_Tree(wxTreeCtrl):
     def CloseTestWindow(self):
         if not g.testWin: return
         self.SetItemBold(g.testWin.item, False)
-        g.frame.tb.ToggleTool(g.frame.ID_LOCATE_TOOL, False)
+        g.frame.tb.ToggleTool(g.frame.ID_TOOL_LOCATE, False)
         g.testWinPos = g.testWin.GetPosition()
         g.testWin.Destroy()
         g.testWin = None