Jacek,

I wouldn't use a grid sizer for this.  The grid sizer is largely used if 
you have a lot of label field combos that you want to line up.  Try this:

class PagEditUsersGroups(PagEditBase):
     def createItems(self):
         sizer = self.Sizer
         sizer.DefaultBorder = 5
         
         hs = dabo.ui.dSizer('h')
         vs = dabo.ui.dSizer('v')
         vs.append(dabo.ui.dLabel(self, Caption=u"Grupy użytkowników"))
         vs.append1x(self.addObject(ItemList, "lstGroups", Height=300))
         vs.append(cCmdButtonGroup(self, buttons=("1", "2"), orientation="h"))
         hs.append1x(vs)
         
         vs = dabo.ui.dSizer('v')
         vs.append1x(cCmdButtonGroup(self, buttons=(">", "<"), orientation="v", 
OnHit=self.onListAction), 1)
         vs.append(cCmdButtonGroup(self, buttons=("3", "4"), orientation="h"))
         hs.append(vs, "expand")

         vs = dabo.ui.dSizer('v') 
         vs.append(dabo.ui.dLabel(self, Caption=u"Przynależność do grup"))
         vs.append1x(self.addObject(ItemList, "lstUserGroups", Height=300))
         vs.append(cCmdButtonGroup(self, buttons=("5", "6"), orientation="h"))
         hs.append1x(vs)

         sizer.append(hs, "expand")
         PagEditBase.createItems(self)


Also, I noticed you were mixing in some pure wx stuff and overriding 
__init__ in the subclass.  This is bad juju.  Never override __init__ in 
a dabo control unless you have a very good reason.  All of the stuff in 
the cCmdButtonGroup __init__ method can go into afterInit.  Also, why 
are you setting the _BaseClass variable in cCmdButtonGroup?  You 
shouldn't need to do that.  Also, it needs to be set properly for wx to 
work with the three way init scheme we have.

Regards,

Nate

Jacek Kałucki wrote:
> Użytkownik Nate Lowrie napisał:
>   
>> Can you post your code?  Just the layout portion is all I want to look at.
>>    
>>     
>
> Here is code of whole control page:
> <code>
> import wx
> import dabo
> from dabo.dLocalize import _
> from PagEditBase import PagEditBase
>
> class cCmdButtonGroup(dabo.ui.dPanel):
>
>      _proxy_buttons = []
>
>      def __init__(self, parent, properties=None,
>              attProperties=None, buttons=None,
>              orientation="h", *args, **kwargs):
>          self.__constructed = False
>          cName = self._extractKey((properties, attProperties, kwargs), 
> "NameBase", "")
>          if not cName:
>              cName = self._extractKey((properties, attProperties, kwargs),
>                  "Name", "cCmdButtonGroup")
>          dabo.ui.dPanel.__init__(self, parent=parent, 
> properties=properties,
>                  attProperties=attProperties, *args, **kwargs)
>          self._baseClass = cCmdButtonGroup
>          sizer = self.Sizer = dabo.ui.dSizer(orientation)
>          idx = 0
>          for caption in buttons:
>              button = dabo.ui.dButton(self, Caption=caption)
>              self.Bind(wx.EVT_BUTTON, self._onWxHit, button, idx)
>              self._proxy_buttons.append(button)
>              sizer.append1x(button)
>              idx += 1
>          self.__constructed = True
>          self.layout()
>          self._properties["NameBase"] = cName
>          self._setNameAndProperties(self._properties, **kwargs)
>
>
> class ItemList(dabo.ui.dListControl):
>      def __init__(self, parent, properties=None, attProperties=None,
>              *args, **kwargs):
>          dabo.ui.dListControl.__init__(self, parent, properties=properties,
>              attProperties=attProperties, *args, **kwargs)
>          self.MultipleSelect = False
>          self.HorizontalRules = False
>          self.VerticalRules = False
>          self.HeaderVisible = False
>
>      def afterInit(self):
>          self.setColumns(("",))
>          self.autoSizeColumns()
>
>
> class PagEditUsersGroups(PagEditBase):
>      def createItems(self):
>          sizer = self.Sizer
>          sizer.DefaultBorder = 5
>          gs = dabo.ui.dGridSizer(VGap=5, HGap=5, MaxCols=3)
>          gs.append(dabo.ui.dLabel(self, Caption=u"Grupy użytkowników"))
>          gs.appendSpacer(1)
>          gs.append(dabo.ui.dLabel(self, Caption=u"Przynależność do grup"))
>          gs.append(self.addObject(
>              ItemList,
>              "lstGroups",
>              Height=300), "expand")
>          gs.append(cCmdButtonGroup(self, buttons=(">", "<"),
>              orientation="v", OnHit=self.onListAction))
>          gs.append(self.addObject(
>              ItemList,
>              "lstUserGroups",
>              Height=300), "expand")
>          gs.append(cCmdButtonGroup(self, buttons=("1", "2"),
>              orientation="h"))
>          gs.append(cCmdButtonGroup(self, buttons=("3", "4"),
>              orientation="h"))
>          gs.append(cCmdButtonGroup(self, buttons=("5", "6"),
>              orientation="h"))
>          gs.setColExpand(True, (0, 2))
>          sizer.append(gs, "expand")
>          PagEditBase.createItems(self)
>
>      def onListAction(self, evt):
>          print "Hit!"
> </code>
>
>   

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to