[wxPython-users] Dynamic generic properties panel generator
Jorgen Bodde
jorgen.maillist at gmail.com
Thu Mar 15 07:31:10 PDT 2007
I made wxGuiBuilder which is similar. I want to one day port it to
wxPython or make a binding for it.
You can find it at;
http://wastebucket.solidsteel.nl/cms/modules/wiwimod/index.php?page=wxGuiBuilder&back=WiwiHome
Regards,
- Jorgen
On 3/13/07, Stani's Python Editor <spe.stani.be at gmail.com> wrote:
>
> There is:
> http://www.geocities.com/jmsalli/propertygrid/index.html
>
> But I thought unfortunately this has a C-module which requires compilation.
> I would prefer a 100%python solution (besides wxPython of course). It is a
> widget which would be very useful.
>
> Stani
>
>
> Ken Seehart wrote:
> I'm considering making a property panel generator.
>
>
> Content specification protocol using basic python types (string, int, float,
> tuple, list), not gui specific.
> Rapid implementation of properties panels without gui code
> Separation of content from implementation
> Merge specification data binding with specification of content
>
> Support for i18n, l10n
> Implementation in wxPython, with content compatibility with other GUIs.
> Maybe something a bit like the following:
>
> # This sample code will not run.
>
> # propmaker.py
>
> import wx
>
> class PropertyMaker(object):
> ...
> def checkbox(self, var, text):
> id = self._get_next_id()
> ttext = self._translator(text)
> w = wx.CheckBox(_parent, id, ttext)
> self._sizer.Add(w)
> self.Bind(wx.EVT_CHECKBOX, lambda(evt, setattr(_data, var,
> evt.IsChecked())), w)
> ...
> ________________________
> # mygui.py
>
> import wx
> import propmaker
>
> content = [
> ('checkbox', 'x', 'select_x'), # creates a checkbox and binds it to
> attribute x
> ('radio', 'z', [('z1',1), ('z2',2), ('z3',3)] ), # creates three radio
> buttons and assigns selected value to attribute z
> ('float', 't', 'temperature', (0.0,10.0)), # creates a horizontal sizer
> with static text and a numeric edit with filtering
> ]
>
> mysizer = wx.BoxSizer(wx.VERTICAL)
> foo = MyData() # any instance that supports getattr and setattr on the
> attributes specified in 'content'
>
> propmaker = propmaker.PropMaker()
> propmaker.deploy_content(mysizer, content) # fills a vertical sizer with
> new widgets defined by 'content'
> propmaker.bind(foo) # binds instance object foo to properties list
>
> # attributes of foo will be displayed in and receive input from, the
> properties panel
>
> The first element of each tuple names a method of PropMaker. The remaining
> attributes are arguments to the method.
> Labels (e.g. 'select_x') are looked up in an international string table for
> the current language.
>
> Lots of potential features. Am I reinventing the wheel again? What is out
> there?
> - Ken Seehart
>
>
>
>
More information about the wxpython-users
mailing list