wxGridBahSizer support

exception handling while loading resource

some fixes (GetFirstChild, XRCID instead of FindByName, ...)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25156 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Roman Rolinsky
2004-01-13 18:43:42 +00:00
parent 31be2bd8ea
commit a4c013b2b1
12 changed files with 1527 additions and 1402 deletions

View File

@@ -1,3 +1,13 @@
0.1.2-1
_______
Added support for wxGridBagSizer (supported in wxPython 2.5).
0.1.1-5
-------
Added subclass attribute.
0.1.1-4 0.1.1-4
------- -------

View File

@@ -16,7 +16,7 @@ modernFont = wxFont(sysFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL)
smallerFont = wxFont(sysFont.GetPointSize()-2, wxDEFAULT, wxNORMAL, wxNORMAL) smallerFont = wxFont(sysFont.GetPointSize()-2, wxDEFAULT, wxNORMAL, wxNORMAL)
progname = 'XRCed' progname = 'XRCed'
version = '0.1.1-4' version = '0.1.2-1'
try: try:
True True

File diff suppressed because it is too large Load Diff

View File

@@ -87,13 +87,16 @@ class Panel(wxNotebook):
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.')) sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
else: else:
g.currentXXX = xxx.treeObject() g.currentXXX = xxx.treeObject()
# Normal or SizerItem page
isGBSizerItem = isinstance(xxx.parent, xxxGridBagSizer)
cacheID = (xxx.__class__, isGBSizerItem)
try: try:
page = self.pageCache[xxx.__class__] page = self.pageCache[cacheID]
page.box.SetLabel(xxx.panelName()) page.box.SetLabel(xxx.panelName())
page.Reparent(self.page1) page.Reparent(self.page1)
except KeyError: except KeyError:
page = PropPage(self.page1, xxx.panelName(), xxx) page = PropPage(self.page1, xxx.panelName(), xxx)
self.pageCache[xxx.__class__] = page self.pageCache[cacheID] = page
page.SetValues(xxx) page.SetValues(xxx)
self.pages.append(page) self.pages.append(page)
sizer.Add(page, 1, wxEXPAND) sizer.Add(page, 1, wxEXPAND)

View File

@@ -60,9 +60,9 @@ class ParamBinaryOr(PPanel):
self.text.SetValue(value) self.text.SetValue(value)
self.freeze = False self.freeze = False
def OnButtonChoices(self, evt): def OnButtonChoices(self, evt):
dlg = wxDialog(self, -1, 'Choices') dlg = g.frame.res.LoadDialog(self, 'DIALOG_CHOICES')
topSizer = wxBoxSizer(wxVERTICAL) listBox = XRCCTRL(dlg, 'CHECK_LIST')
listBox = wxCheckListBox(dlg, -1, choices=self.values, size=(250,200)) listBox.InsertItems(self.values, 0)
value = map(string.strip, self.text.GetValue().split('|')) value = map(string.strip, self.text.GetValue().split('|'))
if value == ['']: value = [] if value == ['']: value = []
ignored = [] ignored = []
@@ -76,18 +76,6 @@ class ParamBinaryOr(PPanel):
else: else:
print 'WARNING: unknown flag: %s: ignored.' % i print 'WARNING: unknown flag: %s: ignored.' % i
ignored.append(i) ignored.append(i)
topSizer.Add(listBox, 1, wxEXPAND)
sizer = wxBoxSizer()
buttonOk = wxButton(dlg, wxID_OK, 'OK')
buttonOk.SetDefault()
sizer.Add(buttonOk, 0, wxRIGHT, 10)
sizer.Add((0, 0), 1)
sizer.Add(wxButton(dlg, wxID_CANCEL, 'Cancel'))
topSizer.Add(sizer, 0, wxALL | wxEXPAND, 10)
dlg.SetAutoLayout(True)
dlg.SetSizer(topSizer)
topSizer.Fit(dlg)
dlg.Center()
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
value = [] value = []
for i in range(listBox.GetCount()): for i in range(listBox.GetCount()):
@@ -350,20 +338,6 @@ class ParamUnit(PPanel):
def OnSpinDown(self, evt): def OnSpinDown(self, evt):
self.Change(-1) self.Change(-1)
# Dialog for editing multi-line text
class TextDialog(wxDialog):
def __init__(self, parent, value):
pre = wxPreDialog()
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_TEXT')
self.this = pre.this
self._setOORInfo(self)
self.text = self.FindWindowByName('TEXT')
self.text.SetValue(value)
self.SetAutoLayout(True)
self.SetSize((300,200))
def GetValue(self):
return self.text.GetValue()
class ParamMultilineText(PPanel): class ParamMultilineText(PPanel):
def __init__(self, parent, name, textWidth=-1): def __init__(self, parent, name, textWidth=-1):
PPanel.__init__(self, parent, name) PPanel.__init__(self, parent, name)
@@ -388,9 +362,11 @@ class ParamMultilineText(PPanel):
self.text.SetValue(value) self.text.SetValue(value)
self.freeze = False # disable other handlers self.freeze = False # disable other handlers
def OnButtonEdit(self, evt): def OnButtonEdit(self, evt):
dlg = TextDialog(self, self.text.GetValue()) dlg = g.frame.res.LoadDialog(self, 'DIALOG_TEXT')
textCtrl = XRCCTRL(dlg, 'TEXT')
textCtrl.SetValue(self.text.GetValue())
if dlg.ShowModal() == wxID_OK: if dlg.ShowModal() == wxID_OK:
self.text.SetValue(dlg.GetValue()) self.text.SetValue(textCtrl.GetValue())
self.SetModified() self.SetModified()
dlg.Destroy() dlg.Destroy()
@@ -439,7 +415,7 @@ class ContentDialog(wxDialog):
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT') g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT')
self.this = pre.this self.this = pre.this
self._setOORInfo(self) self._setOORInfo(self)
self.list = self.FindWindowByName('LIST') self.list = XRCCTRL(self, 'LIST')
# Set list items # Set list items
for v in value: for v in value:
self.list.Append(v) self.list.Append(v)
@@ -489,7 +465,7 @@ class ContentCheckListDialog(wxDialog):
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECK_LIST') g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECK_LIST')
self.this = pre.this self.this = pre.this
self._setOORInfo(self) self._setOORInfo(self)
self.list = self.FindWindowByName('CHECK_LIST') self.list = XRCCTRL(self, 'CHECK_LIST')
# Set list items # Set list items
i = 0 i = 0
for v,ch in value: for v,ch in value:
@@ -622,7 +598,7 @@ class IntListDialog(wxDialog):
g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST') g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_INTLIST')
self.this = pre.this self.this = pre.this
self._setOORInfo(self) self._setOORInfo(self)
self.list = self.FindWindowByName('LIST') self.list = XRCCTRL(self, 'LIST')
# Set list items # Set list items
value.sort() value.sort()
for v in value: for v in value:
@@ -718,7 +694,7 @@ class ParamBool(RadioBox):
values = {'yes': '1', 'no': '0'} values = {'yes': '1', 'no': '0'}
seulav = {'1': 'yes', '0': 'no'} seulav = {'1': 'yes', '0': 'no'}
def __init__(self, parent, name): def __init__(self, parent, name):
RadioBox.__init__(self, parent, -1, choices = self.values.keys(), name=name) RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
def GetValue(self): def GetValue(self):
return self.values[self.GetStringSelection()] return self.values[self.GetStringSelection()]
def SetValue(self, value): def SetValue(self, value):
@@ -729,7 +705,7 @@ class ParamOrient(RadioBox):
values = {'horizontal': 'wxHORIZONTAL', 'vertical': 'wxVERTICAL'} values = {'horizontal': 'wxHORIZONTAL', 'vertical': 'wxVERTICAL'}
seulav = {'wxHORIZONTAL': 'horizontal', 'wxVERTICAL': 'vertical'} seulav = {'wxHORIZONTAL': 'horizontal', 'wxVERTICAL': 'vertical'}
def __init__(self, parent, name): def __init__(self, parent, name):
RadioBox.__init__(self, parent, -1, choices = self.values.keys(), name=name) RadioBox.__init__(self, parent, -1, choices=self.values.keys(), name=name)
def GetValue(self): def GetValue(self):
return self.values[self.GetStringSelection()] return self.values[self.GetStringSelection()]
def SetValue(self, value): def SetValue(self, value):
@@ -791,11 +767,11 @@ class ParamBitmap(PPanel):
self._setOORInfo(self) self._setOORInfo(self)
self.modified = self.freeze = False self.modified = self.freeze = False
self.SetBackgroundColour(g.panel.GetBackgroundColour()) self.SetBackgroundColour(g.panel.GetBackgroundColour())
self.radio_std = self.FindWindowByName('RADIO_STD') self.radio_std = XRCCTRL(self, 'RADIO_STD')
self.radio_file = self.FindWindowByName('RADIO_FILE') self.radio_file = XRCCTRL(self, 'RADIO_FILE')
self.combo = self.FindWindowByName('COMBO_STD') self.combo = XRCCTRL(self, 'COMBO_STD')
self.text = self.FindWindowByName('TEXT_FILE') self.text = XRCCTRL(self, 'TEXT_FILE')
self.button = self.FindWindowByName('BUTTON_BROWSE') self.button = XRCCTRL(self, 'BUTTON_BROWSE')
self.textModified = False self.textModified = False
self.SetAutoLayout(True) self.SetAutoLayout(True)
self.GetSizer().SetMinSize((260, -1)) self.GetSizer().SetMinSize((260, -1))
@@ -879,5 +855,3 @@ paramDict = {
'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap, 'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
'encoding': ParamEncoding 'encoding': ParamEncoding
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

View File

@@ -51,6 +51,7 @@ class Tools(wxPanel):
(ID_NEW.STATIC_BOX_SIZER, images.getToolStaticBoxSizerBitmap()), (ID_NEW.STATIC_BOX_SIZER, images.getToolStaticBoxSizerBitmap()),
(ID_NEW.GRID_SIZER, images.getToolGridSizerBitmap()), (ID_NEW.GRID_SIZER, images.getToolGridSizerBitmap()),
(ID_NEW.FLEX_GRID_SIZER, images.getToolFlexGridSizerBitmap()), (ID_NEW.FLEX_GRID_SIZER, images.getToolFlexGridSizerBitmap()),
(ID_NEW.GRID_BAG_SIZER, images.getToolGridBagSizerBitmap()),
(ID_NEW.SPACER, images.getToolSpacerBitmap())], (ID_NEW.SPACER, images.getToolSpacerBitmap())],
["Controls", ["Controls",
(ID_NEW.STATIC_TEXT, images.getToolStaticTextBitmap()), (ID_NEW.STATIC_TEXT, images.getToolStaticTextBitmap()),

View File

@@ -6,6 +6,7 @@
from xxx import * # xxx imports globals and params from xxx import * # xxx imports globals and params
import types import types
import traceback
# Constant to define standart window name # Constant to define standart window name
STD_NAME = '_XRCED_T_W' STD_NAME = '_XRCED_T_W'
@@ -83,6 +84,7 @@ class ID_NEW:
STATIC_BOX_SIZER = wxNewId() STATIC_BOX_SIZER = wxNewId()
GRID_SIZER = wxNewId() GRID_SIZER = wxNewId()
FLEX_GRID_SIZER = wxNewId() FLEX_GRID_SIZER = wxNewId()
GRID_BAG_SIZER = wxNewId()
SPACER = wxNewId() SPACER = wxNewId()
TOOL_BAR = wxNewId() TOOL_BAR = wxNewId()
TOOL = wxNewId() TOOL = wxNewId()
@@ -154,6 +156,7 @@ class PullDownMenu:
ID_NEW.STATIC_BOX_SIZER: 'wxStaticBoxSizer', ID_NEW.STATIC_BOX_SIZER: 'wxStaticBoxSizer',
ID_NEW.GRID_SIZER: 'wxGridSizer', ID_NEW.GRID_SIZER: 'wxGridSizer',
ID_NEW.FLEX_GRID_SIZER: 'wxFlexGridSizer', ID_NEW.FLEX_GRID_SIZER: 'wxFlexGridSizer',
ID_NEW.GRID_BAG_SIZER: 'wxGridBagSizer',
ID_NEW.SPACER: 'spacer', ID_NEW.SPACER: 'spacer',
ID_NEW.UNKNOWN: 'unknown', ID_NEW.UNKNOWN: 'unknown',
} }
@@ -178,6 +181,8 @@ class PullDownMenu:
(ID_NEW.GRID_SIZER, 'GridSizer', 'Create grid sizer'), (ID_NEW.GRID_SIZER, 'GridSizer', 'Create grid sizer'),
(ID_NEW.FLEX_GRID_SIZER, 'FlexGridSizer', (ID_NEW.FLEX_GRID_SIZER, 'FlexGridSizer',
'Create flexgrid sizer'), 'Create flexgrid sizer'),
(ID_NEW.GRID_BAG_SIZER, 'GridBagSizer',
'Create gridbag sizer'),
(ID_NEW.SPACER, 'Spacer', 'Create spacer'), (ID_NEW.SPACER, 'Spacer', 'Create spacer'),
] ]
self.controls = [ self.controls = [
@@ -225,6 +230,8 @@ class PullDownMenu:
(ID_NEW.GRID_SIZER, 'GridSizer', 'Create grid sizer'), (ID_NEW.GRID_SIZER, 'GridSizer', 'Create grid sizer'),
(ID_NEW.FLEX_GRID_SIZER, 'FlexGridSizer', (ID_NEW.FLEX_GRID_SIZER, 'FlexGridSizer',
'Create flexgrid sizer'), 'Create flexgrid sizer'),
(ID_NEW.GRID_BAG_SIZER, 'GridBagSizer',
'Create gridbag sizer'),
(ID_NEW.SPACER, 'Spacer', 'Create spacer'), (ID_NEW.SPACER, 'Spacer', 'Create spacer'),
] ]
] ]
@@ -721,67 +728,77 @@ class XML_Tree(wxTreeCtrl):
xmlFlags != wxXRC_USE_LOCALE xmlFlags != wxXRC_USE_LOCALE
res = wxXmlResource('', xmlFlags) res = wxXmlResource('', xmlFlags)
res.Load('memory:xxx.xrc') res.Load('memory:xxx.xrc')
if xxx.__class__ == xxxFrame: try:
# Frame can't have many children, if xxx.__class__ == xxxFrame:
# but it's first child possibly can... # Frame can't have many children,
# child = self.GetFirstChild(item)[0] # but it's first child possibly can...
# if child.IsOk() and self.GetPyData(child).__class__ == xxxPanel: # child = self.GetFirstChild(item)[0]
# # Clean-up before recursive call or error # if child.IsOk() and self.GetPyData(child).__class__ == xxxPanel:
# wxMemoryFSHandler_RemoveFile('xxx.xrc') # # Clean-up before recursive call or error
# wxEndBusyCursor() # wxMemoryFSHandler_RemoveFile('xxx.xrc')
# self.CreateTestWin(child) # wxEndBusyCursor()
# return # self.CreateTestWin(child)
# This currently works under GTK, but not under MSW # return
testWin = g.testWin = wxPreFrame() # This currently works under GTK, but not under MSW
res.LoadOnFrame(testWin, g.frame, STD_NAME) testWin = g.testWin = wxPreFrame()
# Create status bar res.LoadOnFrame(testWin, g.frame, STD_NAME)
testWin.panel = testWin # Create status bar
testWin.CreateStatusBar() testWin.panel = testWin
testWin.SetClientSize(testWin.GetBestSize()) testWin.CreateStatusBar()
testWin.panel = testWin testWin.SetClientSize(testWin.GetBestSize())
testWin.SetPosition(pos) testWin.panel = testWin
testWin.Show(True) testWin.SetPosition(pos)
elif xxx.__class__ == xxxPanel: testWin.Show(True)
# Create new frame elif xxx.__class__ == xxxPanel:
if not testWin: # Create new frame
testWin = g.testWin = wxFrame(g.frame, -1, 'Panel: ' + name, if not testWin:
testWin = g.testWin = wxFrame(g.frame, -1, 'Panel: ' + name,
pos=pos, name=STD_NAME)
testWin.panel = res.LoadPanel(testWin, STD_NAME)
testWin.SetClientSize(testWin.GetBestSize())
testWin.Show(True)
elif xxx.__class__ == xxxDialog:
testWin = g.testWin = res.LoadDialog(None, STD_NAME)
testWin.panel = testWin
testWin.Layout()
testWin.SetPosition(pos)
testWin.Show(True)
# Dialog's default code does not produce EVT_CLOSE
EVT_BUTTON(testWin, wxID_OK, self.OnCloseTestWin)
EVT_BUTTON(testWin, wxID_CANCEL, self.OnCloseTestWin)
elif xxx.__class__ == xxxMenuBar:
testWin = g.testWin = wxFrame(g.frame, -1, 'MenuBar: ' + name,
pos=pos, name=STD_NAME) pos=pos, name=STD_NAME)
testWin.panel = res.LoadPanel(testWin, STD_NAME) testWin.panel = None
testWin.SetClientSize(testWin.GetBestSize()) # Set status bar to display help
testWin.Show(True) testWin.CreateStatusBar()
elif xxx.__class__ == xxxDialog: testWin.menuBar = res.LoadMenuBar(STD_NAME)
testWin = g.testWin = res.LoadDialog(None, STD_NAME) testWin.SetMenuBar(testWin.menuBar)
testWin.panel = testWin testWin.Show(True)
testWin.Layout() elif xxx.__class__ == xxxToolBar:
testWin.SetPosition(pos) testWin = g.testWin = wxFrame(g.frame, -1, 'ToolBar: ' + name,
testWin.Show(True) pos=pos, name=STD_NAME)
# Dialog's default code does not produce EVT_CLOSE testWin.panel = None
EVT_BUTTON(testWin, wxID_OK, self.OnCloseTestWin) # Set status bar to display help
EVT_BUTTON(testWin, wxID_CANCEL, self.OnCloseTestWin) testWin.CreateStatusBar()
elif xxx.__class__ == xxxMenuBar: testWin.toolBar = res.LoadToolBar(testWin, STD_NAME)
testWin = g.testWin = wxFrame(g.frame, -1, 'MenuBar: ' + name, testWin.SetToolBar(testWin.toolBar)
pos=pos, name=STD_NAME) testWin.Show(True)
testWin.panel = None testWin.item = item
# Set status bar to display help EVT_CLOSE(testWin, self.OnCloseTestWin)
testWin.CreateStatusBar() testWin.highLight = None
testWin.menuBar = res.LoadMenuBar(STD_NAME) if highLight and not self.pendingHighLight:
testWin.SetMenuBar(testWin.menuBar) self.HighLight(highLight)
testWin.Show(True) except:
elif xxx.__class__ == xxxToolBar: if g.testWin:
testWin = g.testWin = wxFrame(g.frame, -1, 'ToolBar: ' + name, self.SetItemBold(item, False)
pos=pos, name=STD_NAME) g.testWinPos = g.testWin.GetPosition()
testWin.panel = None g.testWin.Destroy()
# Set status bar to display help g.testWin = None
testWin.CreateStatusBar() inf = sys.exc_info()
testWin.toolBar = res.LoadToolBar(testWin, STD_NAME) wxLogError(traceback.format_exception(inf[0], inf[1], None)[-1])
testWin.SetToolBar(testWin.toolBar) wxLogError('Error loading resource')
testWin.Show(True)
wxMemoryFSHandler_RemoveFile('xxx.xrc') wxMemoryFSHandler_RemoveFile('xxx.xrc')
testWin.item = item
EVT_CLOSE(testWin, self.OnCloseTestWin)
testWin.highLight = None
if highLight and not self.pendingHighLight:
self.HighLight(highLight)
wxEndBusyCursor() wxEndBusyCursor()
def OnCloseTestWin(self, evt): def OnCloseTestWin(self, evt):

View File

@@ -348,7 +348,7 @@ class Frame(wxFrame):
# Expanded container (must have children) # Expanded container (must have children)
elif tree.IsExpanded(selected) and tree.GetChildrenCount(selected, False): elif tree.IsExpanded(selected) and tree.GetChildrenCount(selected, False):
# Insert as first child # Insert as first child
nextItem = tree.GetFirstChild(selected, 0)[0] nextItem = tree.GetFirstChild(selected)[0]
parentLeaf = selected parentLeaf = selected
else: else:
# No children or unexpanded item - appendChild stays True # No children or unexpanded item - appendChild stays True
@@ -619,7 +619,7 @@ Homepage: http://xrced.sourceforge.net\
# Expanded container (must have children) # Expanded container (must have children)
elif tree.shift and tree.IsExpanded(selected) \ elif tree.shift and tree.IsExpanded(selected) \
and tree.GetChildrenCount(selected, False): and tree.GetChildrenCount(selected, False):
nextItem = tree.GetFirstChild(selected, 0)[0] nextItem = tree.GetFirstChild(selected)[0]
parentLeaf = selected parentLeaf = selected
else: else:
nextItem = wxTreeItemId() nextItem = wxTreeItemId()
@@ -701,7 +701,7 @@ Homepage: http://xrced.sourceforge.net\
xxx = MakeXXXFromDOM(parentXXX, elem) xxx = MakeXXXFromDOM(parentXXX, elem)
# Update parent in child objects # Update parent in child objects
if tree.ItemHasChildren(selected): if tree.ItemHasChildren(selected):
i, cookie = tree.GetFirstChild(selected, 0) i, cookie = tree.GetFirstChild(selected)
while i.IsOk(): while i.IsOk():
x = tree.GetPyData(i) x = tree.GetPyData(i)
x.parent = xxx x.parent = xxx
@@ -1004,6 +1004,7 @@ class App(wxApp):
def main(): def main():
app = App(0, useBestVisual=False) app = App(0, useBestVisual=False)
#app.SetAssertMode(wxPYAPP_ASSERT_LOG)
app.MainLoop() app.MainLoop()
app.OnExit() app.OnExit()
global conf global conf

View File

@@ -10,6 +10,7 @@
<orient>wxHORIZONTAL</orient> <orient>wxHORIZONTAL</orient>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxTextCtrl" name="TEXT"> <object class="wxTextCtrl" name="TEXT">
<size>250,100</size>
<style>wxTE_MULTILINE</style> <style>wxTE_MULTILINE</style>
</object> </object>
<option>1</option> <option>1</option>
@@ -217,6 +218,48 @@
</object> </object>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style> <style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
</object> </object>
<object class="wxDialog" name="DIALOG_CHOICES">
<title>Choices</title>
<centered>1</centered>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxCheckList" 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">
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<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>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
</object>
<object class="wxDialog" name="DIALOG_INTLIST"> <object class="wxDialog" name="DIALOG_INTLIST">
<title>Numbers</title> <title>Numbers</title>
<centered>1</centered> <centered>1</centered>

View File

@@ -643,6 +643,28 @@ class xxxFlexGridSizer(xxxGridSizer):
self.element.appendChild(node) self.element.appendChild(node)
self.special(param, node) self.special(param, node)
class xxxGridBagSizer(xxxSizer):
specials = ['growablecols', 'growablerows']
allParams = ['vgap', 'hgap'] + specials
paramDict = {'growablecols':ParamIntList, 'growablerows':ParamIntList}
# Special processing for growable* parameters
# (they are represented by several nodes)
def special(self, tag, node):
if not self.params.has_key(tag):
# Create new multi-group
self.params[tag] = xxxParamMulti(node)
self.params[tag].append(xxxParamInt(node))
def setSpecial(self, param, value):
# Straightforward implementation: remove, add again
self.params[param].remove()
del self.params[param]
for i in value:
node = g.tree.dom.createElement(param)
text = g.tree.dom.createTextNode(str(i))
node.appendChild(text)
self.element.appendChild(node)
self.special(param, node)
# Container with only one child. # Container with only one child.
# Not shown in tree. # Not shown in tree.
class xxxChildContainer(xxxObject): class xxxChildContainer(xxxObject):
@@ -668,9 +690,13 @@ class xxxChildContainer(xxxObject):
assert 0, 'no child found' assert 0, 'no child found'
class xxxSizerItem(xxxChildContainer): class xxxSizerItem(xxxChildContainer):
allParams = ['option', 'flag', 'border', 'minsize'] allParams = ['option', 'flag', 'border', 'minsize', 'ratio']
paramDict = {'option': ParamInt, 'minsize': ParamPosSize} paramDict = {'option': ParamInt, 'minsize': ParamPosSize, 'ratio': ParamPosSize}
#default = {'cellspan': '1,1'}
def __init__(self, parent, element): def __init__(self, parent, element):
# For GridBag sizer items, extra parameters added
if isinstance(parent, xxxGridBagSizer):
self.allParams = self.allParams + ['cellpos', 'cellspan']
xxxChildContainer.__init__(self, parent, element) xxxChildContainer.__init__(self, parent, element)
# Remove pos parameter - not needed for sizeritems # Remove pos parameter - not needed for sizeritems
if 'pos' in self.child.allParams: if 'pos' in self.child.allParams:
@@ -770,6 +796,7 @@ xxxDict = {
'wxStaticBoxSizer': xxxStaticBoxSizer, 'wxStaticBoxSizer': xxxStaticBoxSizer,
'wxGridSizer': xxxGridSizer, 'wxGridSizer': xxxGridSizer,
'wxFlexGridSizer': xxxFlexGridSizer, 'wxFlexGridSizer': xxxFlexGridSizer,
'wxGridBagSizer': xxxGridBagSizer,
'sizeritem': xxxSizerItem, 'sizeritem': xxxSizerItem,
'spacer': xxxSpacer, 'spacer': xxxSpacer,
@@ -784,7 +811,8 @@ xxxDict = {
# Create IDs for all parameters of all classes # Create IDs for all parameters of all classes
paramIDs = {'fg': wxNewId(), 'bg': wxNewId(), 'exstyle': wxNewId(), 'font': wxNewId(), paramIDs = {'fg': wxNewId(), 'bg': wxNewId(), 'exstyle': wxNewId(), 'font': wxNewId(),
'enabled': wxNewId(), 'focused': wxNewId(), 'hidden': wxNewId(), 'enabled': wxNewId(), 'focused': wxNewId(), 'hidden': wxNewId(),
'tooltip': wxNewId(), 'encoding': wxNewId() 'tooltip': wxNewId(), 'encoding': wxNewId(),
'cellpos': wxNewId(), 'cellspan': wxNewId()
} }
for cl in xxxDict.values(): for cl in xxxDict.values():
if cl.allParams: if cl.allParams: