0.1.5-2
------- Using wx.GetDefaultPyEncoding/wx.SetDefaultPyEncoding for changing active encoding. Fixed pasting siblings (Ctrl key pressed while pasting). Dealed with ascii build (Python does not recognize 'ascii' as valid encoding). If encoding is not specified it is not written in XRC. Will add more customization in the future. Changed to use SimpleTool instead or Toggle tool (does not work on Win32). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
628eae0bcd
commit
9a69d0aa1d
@ -5,6 +5,12 @@ Using wx.GetDefaultPyEncoding/wx.SetDefaultPyEncoding for changing active encodi
|
||||
|
||||
Fixed pasting siblings (Ctrl key pressed while pasting).
|
||||
|
||||
Dealed with ascii build (Python does not recognize 'ascii' as valid encoding).
|
||||
If encoding is not specified it is not written in XRC. Will add more
|
||||
customization in the future.
|
||||
|
||||
Changed to use SimpleTool instead or Toggle tool (does not work on Win32).
|
||||
|
||||
0.1.5-1
|
||||
-------
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
# Created: 02.12.2002
|
||||
# RCS-ID: $Id$
|
||||
|
||||
import wx
|
||||
from wxPython.wx import *
|
||||
from wxPython.xrc import *
|
||||
try:
|
||||
@ -18,8 +17,10 @@ import sys
|
||||
progname = 'XRCed'
|
||||
version = '0.1.5-2'
|
||||
# Can be changed to set other default encoding different
|
||||
#defaultEncoding = sys.getdefaultencoding()
|
||||
defaultEncoding = wx.GetDefaultPyEncoding()
|
||||
defaultEncoding = ''
|
||||
# you comment above and can uncomment this:
|
||||
#import wx
|
||||
#defaultEncoding = wx.GetDefaultPyEncoding()
|
||||
|
||||
try:
|
||||
True
|
||||
|
@ -13,6 +13,7 @@ class Panel(wxNotebook):
|
||||
def __init__(self, parent, id = -1):
|
||||
if wxPlatform != '__WXMAC__': # some problems with this style on macs
|
||||
wxNotebook.__init__(self, parent, id, style=wxNB_BOTTOM)
|
||||
self.SetBackgroundColour(parent.GetBackgroundColour())
|
||||
else:
|
||||
wxNotebook.__init__(self, parent, id)
|
||||
global panel
|
||||
|
@ -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)
|
||||
|
||||
@ -355,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)
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -648,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):
|
||||
@ -769,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')
|
||||
|
@ -198,9 +198,9 @@ class Frame(wxFrame):
|
||||
tb.AddSimpleTool(wxID_COPY, copy_bmp, 'Copy', 'Copy')
|
||||
tb.AddSimpleTool(self.ID_TOOL_PASTE, paste_bmp, 'Paste', 'Paste')
|
||||
tb.AddControl(wxStaticLine(tb, -1, size=(-1,23), style=wxLI_VERTICAL))
|
||||
tb.AddCheckTool(self.ID_TOOL_LOCATE,
|
||||
images.getLocateBitmap(), images.getLocateArmedBitmap(),
|
||||
'Locate', 'Locate control in test window and select it')
|
||||
tb.AddSimpleTool(self.ID_TOOL_LOCATE,
|
||||
images.getLocateBitmap(), #images.getLocateArmedBitmap(),
|
||||
'Locate', 'Locate control in test window and select it', True)
|
||||
tb.AddControl(wxStaticLine(tb, -1, size=(-1,23), style=wxLI_VERTICAL))
|
||||
tb.AddSimpleTool(self.ID_TEST, images.getTestBitmap(), 'Test', 'Test window')
|
||||
tb.AddSimpleTool(self.ID_REFRESH, images.getRefreshBitmap(),
|
||||
@ -977,6 +977,8 @@ Homepage: http://xrced.sourceforge.net\
|
||||
if dom.encoding:
|
||||
g.currentEncoding = dom.encoding
|
||||
wx.SetDefaultPyEncoding(g.currentEncoding.encode())
|
||||
else:
|
||||
g.currentEncoding = ''
|
||||
# Change dir
|
||||
self.dataFile = path = os.path.abspath(path)
|
||||
dir = os.path.dirname(path)
|
||||
@ -1016,9 +1018,9 @@ Homepage: http://xrced.sourceforge.net\
|
||||
if tree.selection and panel.IsModified():
|
||||
self.OnRefresh(wxCommandEvent())
|
||||
if g.currentEncoding:
|
||||
f = codecs.open(path, 'w', g.currentEncoding)
|
||||
f = codecs.open(path, 'wt', g.currentEncoding)
|
||||
else:
|
||||
f = codecs.open(path, 'w')
|
||||
f = codecs.open(path, 'wt')
|
||||
# Make temporary copy for formatting it
|
||||
# !!! We can't clone dom node, it works only once
|
||||
#self.domCopy = tree.dom.cloneNode(True)
|
||||
|
@ -11,34 +11,26 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxTextCtrl" name="TEXT">
|
||||
|
||||
|
||||
<size>250,100</size>
|
||||
|
||||
|
||||
<style>wxTE_MULTILINE</style>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -47,32 +39,25 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
|
||||
|
||||
<label>OK</label>
|
||||
|
||||
|
||||
<default>1</default>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
|
||||
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
@ -90,17 +75,13 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
|
||||
|
||||
<content/>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -109,77 +90,60 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
|
||||
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
|
||||
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
|
||||
|
||||
<size>10,20</size>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
|
||||
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
|
||||
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -188,32 +152,25 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
|
||||
|
||||
<label>OK</label>
|
||||
|
||||
|
||||
<default>1</default>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
|
||||
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
@ -231,17 +188,13 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckListBox" name="CHECK_LIST">
|
||||
|
||||
|
||||
<content/>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -250,77 +203,60 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_UP">
|
||||
|
||||
|
||||
<label>Move Up</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_DOWN">
|
||||
|
||||
|
||||
<label>Move Down</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="spacer">
|
||||
|
||||
|
||||
<size>10,20</size>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_APPEND">
|
||||
|
||||
|
||||
<label>Append...</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
|
||||
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -329,32 +265,25 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
|
||||
|
||||
<label>OK</label>
|
||||
|
||||
|
||||
<default>1</default>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
|
||||
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
@ -368,29 +297,22 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxCheckListBox" name="CHECK_LIST">
|
||||
|
||||
|
||||
<content/>
|
||||
|
||||
|
||||
<size>250,250</size>
|
||||
|
||||
|
||||
<style></style>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxALL|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -399,32 +321,25 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
|
||||
|
||||
<label>OK</label>
|
||||
|
||||
|
||||
<default>1</default>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
|
||||
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
@ -442,23 +357,17 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxListBox" name="LIST">
|
||||
|
||||
|
||||
<content/>
|
||||
|
||||
|
||||
<size>80,100</size>
|
||||
|
||||
|
||||
<style>wxLB_SORT</style>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -467,43 +376,34 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_ADD">
|
||||
|
||||
|
||||
<label>Add...</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM</flag>
|
||||
|
||||
|
||||
<border>3</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_REMOVE">
|
||||
|
||||
|
||||
<label>Remove</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxStaticLine"/>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -512,32 +412,25 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_OK">
|
||||
|
||||
|
||||
<label>OK</label>
|
||||
|
||||
|
||||
<default>1</default>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxBOTTOM</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="wxID_CANCEL">
|
||||
|
||||
|
||||
<label>Cancel</label>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
|
||||
|
||||
|
||||
<border>10</border>
|
||||
</object>
|
||||
</object>
|
||||
@ -554,17 +447,14 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxRadioButton" name="RADIO_STD">
|
||||
|
||||
|
||||
<label>art:</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALIGN_CENTRE_VERTICAL</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxComboBox" name="COMBO_STD">
|
||||
|
||||
|
||||
<content>
|
||||
<item>wxART_ADD_BOOKMARK</item>
|
||||
<item>wxART_DEL_BOOKMARK</item>
|
||||
@ -616,20 +506,16 @@
|
||||
</content>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxRadioButton" name="RADIO_FILE">
|
||||
|
||||
|
||||
<label>file:</label>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxALIGN_CENTRE_VERTICAL</flag>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
@ -638,38 +524,30 @@
|
||||
<object class="sizeritem">
|
||||
<object class="wxTextCtrl" name="TEXT_FILE"/>
|
||||
|
||||
|
||||
<option>1</option>
|
||||
|
||||
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<object class="wxButton" name="BUTTON_BROWSE">
|
||||
|
||||
|
||||
<label>Browse...</label>
|
||||
|
||||
|
||||
<size>40,-1d</size>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxRIGHT|wxEXPAND</flag>
|
||||
|
||||
|
||||
<border>5</border>
|
||||
</object>
|
||||
<vgap>2</vgap>
|
||||
<growablecols>1</growablecols>
|
||||
</object>
|
||||
|
||||
|
||||
<flag>wxEXPAND</flag>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -47,12 +47,16 @@ class xxxParam(xxxNode):
|
||||
self.textNode.data = value
|
||||
else:
|
||||
def value(self):
|
||||
return self.textNode.data.encode(g.currentEncoding)
|
||||
try:
|
||||
return self.textNode.data.encode(g.currentEncoding)
|
||||
except LookupError:
|
||||
return self.textNode.data.encode()
|
||||
def update(self, value):
|
||||
try: # handle exception if encoding is wrong
|
||||
self.textNode.data = unicode(value, g.currentEncoding)
|
||||
except UnicodeDecodeError:
|
||||
wxLogMessage("Unicode error: set encoding in file\nglobals.py to something appropriate")
|
||||
self.textNode.data = unicode(value)
|
||||
#wxLogMessage("Unicode error: set encoding in file\nglobals.py to something appropriate")
|
||||
|
||||
# Integer parameter
|
||||
class xxxParamInt(xxxParam):
|
||||
|
Loading…
Reference in New Issue
Block a user