Franz Steinhäusler wrote:
[...]
WOW, thank you VERY much!
Did it take a long time?
BTW:
Would it make sense/ much effort to make/epand the XRC
program to make an option to output the code to wxpython code directly?
But that willl be a tall order, I suppose. 
Hi NG,
for the record and if someone has a similar task,
I will show the program "converted" to pure python code.
I took almost 3 hours (I didn't have almost no hunch about XRC
and sizer for me, they were always a little "suspect". 
XRC is a great program and one have a nice hierarchy about
controls and sizers.
my tip on creating such a not so simple dialog:
comment everything out in the development, which
is uninteresting at the moment.
For easier comparision, I append again Robins XRC
Output (Also for people who have problems saving attachments).
#begin
#NGSubscribeDialog.py
#thanks to Robin Dunn for the creation of the dialog
#using XRC Resource Editor, 29.09.2006
#I (Franz Steinhaeusler) implemented it in pure Python code 30.09.2006.
#maybe make better: the tab order
#but for overview, creation of the dialog this way (this order
#of creating the widgets) it looks better, I think.
import wx
class GroupsListDlg(wx.Dialog):
"""Newsgroupl List Dialog"""
def __init__(self):
"""Create the Newsgroupl List Dialog"""
wx.Dialog.__init__(self, None, style=wx.DEFAULT_DIALOG_STYLE|
wx.MAXIMIZE_BOX|wx.THICK_FRAME|wx.RESIZE_BORDER,
title = "NewsGroups")
self.SubscribeManualTC = wx.TextCtrl(self)
self.SubscribeManualBtn = wx.Button(self, label="Subscribe Manually")
boxsizer1 = wx.BoxSizer(wx.HORIZONTAL)
boxsizer1.Add(self.SubscribeManualTC, 1, wx.ALIGN_CENTRE_VERTICAL, 0)
boxsizer1.Add(self.SubscribeManualBtn, 0, wx.LEFT, 4)
boxsizer2 = wx.BoxSizer(wx.VERTICAL)
self.SubscribedGroupsLC = wx.ListCtrl(self, style=wx.LC_REPORT)
boxsizer2.Add(self.SubscribedGroupsLC, 1, wx.EXPAND, 0)
boxsizer2.Add(boxsizer1, 0, wx.TOP|wx.EXPAND, 4)
boxsizer3 = wx.BoxSizer(wx.VERTICAL)
self.AddBtn = wx.BitmapButton(self, bitmap=wx.ArtProvider.GetBitmap(wx.ART_GO_FORWARD))
self.RemoveBtn = wx.BitmapButton(self, bitmap=wx.ArtProvider.GetBitmap(wx.ART_GO_BACK))
boxsizer3.Add((0, 0), 1) #spacer
boxsizer3.Add(self.AddBtn, 0, 0, 0) #default values
boxsizer3.Add((0, 0), 1)
boxsizer3.Add(self.RemoveBtn)
boxsizer3.Add((0, 0), 1)
staticboxsizer1 = wx.StaticBoxSizer(wx.StaticBox(self, label="Subscribed Groups"), wx.HORIZONTAL)
staticboxsizer1.Add(boxsizer3, 0, wx.EXPAND, 0)
staticboxsizer1.Add(boxsizer2, 1, wx.LEFT|wx.EXPAND, 4)
staticboxsizer2 = wx.StaticBoxSizer(wx.StaticBox(self, label="Server"), wx.HORIZONTAL)
self.GetNGBtn = wx.Button(self, label="Get Newsgroups List")
ServerST = wx.StaticText(self, label="news.gmane.org | 119")
staticboxsizer2.Add(self.GetNGBtn)
staticboxsizer2.Add(ServerST, 1, wx.LEFT|wx.ALIGN_CENTRE_VERTICAL, 4)
staticboxsizer3 = wx.StaticBoxSizer(wx.StaticBox(self, label="Articles Number"), wx.HORIZONTAL)
self.NumOfArticlesSC = wx.SpinCtrl(self)
staticboxsizer3.Add(self.NumOfArticlesSC)
boxsizer4 = wx.BoxSizer(wx.HORIZONTAL)
boxsizer4.Add(staticboxsizer2, 1, wx.RIGHT|wx.EXPAND, 2)
boxsizer4.Add(staticboxsizer3, 0, wx.EXPAND, 0)
boxsizer5 = wx.BoxSizer(wx.VERTICAL)
boxsizer5.Add(boxsizer4, 0, wx.EXPAND, 0)
boxsizer5.Add(staticboxsizer1, 1, wx.EXPAND, 0)
boxsizer6 = wx.BoxSizer(wx.HORIZONTAL)
self.GroupTC = wx.TextCtrl(self)
self.GroupTC.SetMinSize((150, -1))
self.SearchBtn = wx.Button(self, label="Seach Group")
boxsizer6.Add(self.GroupTC, 0, wx.RIGHT|wx.ALIGN_CENTRE_VERTICAL, 4)
boxsizer6.Add(self.SearchBtn)
self.LiveCB = wx.CheckBox(self, label="Perform Live Search")
self.RegexCB = wx.CheckBox(self, label="Use Regular Expression")
self.ShowFullBtn = wx.Button(self, label="Show Full List")
self.NewsgroupsLC = wx.ListCtrl(self, style=wx.LC_REPORT)
staticboxsizer4 = wx.StaticBoxSizer(wx.StaticBox(self, label="List"), wx.VERTICAL)
staticboxsizer4.Add(boxsizer6)
staticboxsizer4.Add(self.LiveCB)
staticboxsizer4.Add(self.RegexCB)
staticboxsizer4.Add(self.ShowFullBtn, 0, wx.BOTTOM|wx.EXPAND, 4)
staticboxsizer4.Add(self.NewsgroupsLC, 1, wx.EXPAND, 0)
boxsizer7 = wx.BoxSizer(wx.HORIZONTAL)
boxsizer7.Add(staticboxsizer4, 0, wx.ALL|wx.EXPAND, 4)
boxsizer7.Add(boxsizer5, 1, wx.TOP|wx.BOTTOM|wx.RIGHT|wx.EXPAND, 4)
boxsizer8 = wx.BoxSizer(wx.VERTICAL)
self.ButtonOk = wx.Button(self, wx.ID_OK)
boxsizer8.Add(boxsizer7, 1, wx.EXPAND, 0)
boxsizer8.Add(self.ButtonOk, 0, wx.EXPAND, 0)
mainsizer = boxsizer8
self.SetSizer(mainsizer)
#self.SetSizerAndFit(mainsizer)
self.GroupTC.SetFocus()
self.SetMinSize((615, 270))
self.SetSize((615, 420))
self.Center()
app = wx.App(0)
w = GroupsListDlg()
w.ShowModal()
w.Destroy()
app.MainLoop()
#end
···
On Fri, 29 Sep 2006 11:14:03 -0700, Robin Dunn <robin@alldunn.com> wrote:
=============
#Robins XRC Code:
#NGSubscribe.xrc
<?xml version="1.0" encoding="utf-8"?>
<resource>
<object class="wxPanel" name="NGSubscribePanel">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<label>List</label>
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="GroupTC"/>
<flag>wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
<border>4</border>
<minsize>150, -1</minsize>
</object>
<object class="sizeritem">
<object class="wxButton" name="SearchBtn">
<label>Seach Group</label>
</object>
</object>
</object>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="LiveCB">
<label>Perform Live Search</label>
</object>
</object>
<object class="sizeritem">
<object class="wxCheckBox" name="RegexCB">
<label>Use Regular Expression</label>
</object>
</object>
<object class="sizeritem">
<object class="wxButton" name="ShowFullBtn">
<label>Show Full List</label>
</object>
<flag>wxBOTTOM|wxEXPAND</flag>
<border>4</border>
</object>
<object class="sizeritem">
<object class="wxListCtrl" name="NewsgroupsLC">
<style>wxLC_REPORT</style>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
</object>
<flag>wxALL|wxEXPAND</flag>
<border>4</border>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<label>Server</label>
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxButton" name="GetNGBtn">
<label>Get Newsgroups List</label>
</object>
</object>
<object class="sizeritem">
<object class="wxStaticText" name="ServerST">
<label>news.gmane.org | 119</label>
</object>
<option>1</option>
<flag>wxLEFT|wxALIGN_CENTRE_VERTICAL</flag>
<border>4</border>
</object>
</object>
<option>1</option>
<flag>wxRIGHT|wxEXPAND</flag>
<border>2</border>
</object>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<label>Articles Number</label>
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxSpinCtrl" name="NumOfArticlesSC"/>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxStaticBoxSizer">
<label>Subscribed Groups</label>
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="spacer">
<size>0,0</size>
<option>1</option>
</object>
<object class="sizeritem">
<object class="wxBitmapButton" name="AddBtn">
<bitmap stock_id="wxART_GO_FORWARD"></bitmap>
</object>
</object>
<object class="spacer">
<size>0,0</size>
<option>1</option>
</object>
<object class="sizeritem">
<object class="wxBitmapButton" name="RemoveBtn">
<bitmap stock_id="wxART_GO_BACK"></bitmap>
</object>
</object>
<object class="spacer">
<size>0,0</size>
<option>1</option>
</object>
</object>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxListCtrl" name="SubscribedGroupsLC">
<style>wxLC_REPORT</style>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxBoxSizer">
<orient>wxHORIZONTAL</orient>
<object class="sizeritem">
<object class="wxTextCtrl" name="SubscribeManualTC"/>
<option>1</option>
<flag>wxALIGN_CENTRE_VERTICAL</flag>
</object>
<object class="sizeritem">
<object class="wxButton" name="SubscribeManualBtn">
<label>Subscribe Manually</label>
</object>
<flag>wxLEFT</flag>
<border>4</border>
</object>
</object>
<flag>wxTOP|wxEXPAND</flag>
<border>4</border>
</object>
</object>
<option>1</option>
<flag>wxLEFT|wxEXPAND</flag>
<border>4</border>
</object>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
</object>
<option>1</option>
<flag>wxTOP|wxBOTTOM|wxRIGHT|wxEXPAND</flag>
<border>4</border>
</object>
</object>
<option>1</option>
<flag>wxEXPAND</flag>
</object>
<object class="sizeritem">
<object class="wxButton" name="wxID_OK">
<label></label>
</object>
<flag>wxEXPAND</flag>
</object>
</object>
</object>
</resource>
--
Franz Steinhaeusler