self.name = name
self.buffer = ''
def write(self, data):
- self.buffer += data.encode(g.currentEncoding)
+ if g.currentEncoding:
+ encoding = g.currentEncoding
+ else:
+ encoding = wxGetDefaultPyEncoding()
+ try:
+ self.buffer += data.encode(encoding)
+ except UnicodeEncodeError:
+ self.buffer += data.encode(encoding, 'xmlcharrefreplace')
+
def close(self):
wxMemoryFSHandler_AddFile(self.name, self.buffer)
def Remove(self):
map(wxWindow.Destroy, self.lines)
g.testWin.highLight = None
+ def Refresh(self):
+ map(wxWindow.Refresh, self.lines)
################################################################################
g.panel.SetData(xxx)
# Update tools
g.tools.UpdateUI()
- # Hightlighting is done in OnIdle
+ # Highlighting is done in OnIdle
self.pendingHighLight = self.selection
# Check if item is in testWin subtree
obj, pos = self.FindNodeObject(item), self.FindNodePos(item)
size = obj.GetSize()
# Highlight
- # Nagative positions are not working wuite well
+ # Negative positions are not working quite well
if g.testWin.highLight:
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):
if g.testWin: # Reset old
self.SetItemBold(g.testWin.item, False)
self.CreateTestWin(item)
- # Maybe an error occured, so we need to test
+ # Maybe an error occurred, so we need to test
if g.testWin: self.SetItemBold(g.testWin.item)
# Double-click on Linux
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')