def __DoLayout(self, icon, title): """Layout the dialog controls @param icon: wx.Bitmap or None @param title: string """ sz = wx.BoxSizer(wx.VERTICAL) self._listBox = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(200, 150), list(), wx.LB_SINGLE | wx.NO_BORDER) self._panel = ctrlbox.ControlBar(self, style=ctrlbox.CTRLBAR_STYLE_GRADIENT) self._panel.SetVMargin(2, 2) if icon is not None: bmp = wx.StaticBitmap(self._panel, bitmap=icon) self._panel.AddControl(bmp, wx.ALIGN_LEFT) txt = wx.StaticText(self._panel, label=title) self._panel.AddControl(txt, wx.ALIGN_LEFT) sz.Add(self._panel, 0, wx.EXPAND) sz.Add(self._listBox, 1, wx.EXPAND) sz.Fit(self) sz.SetSizeHints(self) sz.Layout() self.Centre() self.SetSizer(sz) self.SetAutoLayout(True)
def __init__(self, parent, fdata, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=AFR_STYLE_FINDDIALOG, name=FindBoxName): """Create the container box @param fdata: wx.FindReplaceData """ ctrlbox.ControlBox.__init__(self, parent, id, pos, size, wx.TAB_TRAVERSAL|wx.NO_BORDER, name) # Attributes self._fpanel = FindPanel(self, fdata, style=style) ctrlbar = ctrlbox.ControlBar(self, style=ctrlbox.CTRLBAR_STYLE_GRADIENT) bmp = wx.ArtProvider.GetBitmap(wx.ART_FIND, wx.ART_MENU) self.find = platebtn.PlateButton(ctrlbar, label=_("Find"), bmp=bmp, style=platebtn.PB_STYLE_NOBG) bmp = wx.ArtProvider.GetBitmap(wx.ART_FIND_AND_REPLACE, wx.ART_MENU) self.replace = platebtn.PlateButton(ctrlbar, label=_("Replace"), bmp=bmp, style=platebtn.PB_STYLE_NOBG) # Setup if wx.Platform == '__WXGTK__': ctrlbar.SetWindowStyle(ctrlbox.CTRLBAR_STYLE_DEFAULT) ctrlbar.SetVMargin(2, 2) ctrlbar.AddControl(self.find, wx.ALIGN_LEFT) ctrlbar.AddControl(self.replace, wx.ALIGN_LEFT) self.SetControlBar(ctrlbar) self.SetWindow(self._fpanel) # Event Handlers self.Bind(wx.EVT_BUTTON, self.OnButton)
def __init__(self, parent, auiMgr, icon=None, title=''): """@param auiMgr: Main window Aui Manager""" wx.Dialog.__init__(self, parent, wx.ID_ANY, "", style=0) # Attributes self._auimgr = auiMgr self._selectedItem = -1 self._indexMap = [] self._sel = 0 self._tabed = 0 # Setup sz = wx.BoxSizer(wx.VERTICAL) self._listBox = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.Size(200, 150), list(), wx.LB_SINGLE | wx.NO_BORDER) self._panel = ctrlbox.ControlBar(self, style=ctrlbox.CTRLBAR_STYLE_GRADIENT) self._panel.SetVMargin(2, 2) if icon is not None: bmp = wx.StaticBitmap(self._panel, bitmap=icon) self._panel.AddControl(bmp, wx.ALIGN_LEFT) txt = wx.StaticText(self._panel, label=title) self._panel.AddControl(txt, wx.ALIGN_LEFT) sz.Add(self._panel, 0, wx.EXPAND) sz.Add(self._listBox, 1, wx.EXPAND) sz.Fit(self) sz.SetSizeHints(self) sz.Layout() self.Centre() self.SetSizer(sz) self.SetAutoLayout(True) # Get the panes self.PopulateListControl() # Event Handlers self._listBox.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self._listBox.Bind(wx.EVT_NAVIGATION_KEY, self.OnNavigationKey) self._listBox.Bind(wx.EVT_LISTBOX_DCLICK, self.OnItemSelected) # Set focus on the list box to avoid having to click on it to change # the tab selection under GTK. self._listBox.SetFocus() self._listBox.SetSelection(0)