Python wx.ListBox() Examples
The following are 28
code examples of wx.ListBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: new_properties.py From wxGlade with MIT License | 7 votes |
def _on_text_click(self, event): if self.deactivated and not self.auto_activated and self.text: text_rect = self.text.GetClientRect() text_rect.Offset(self.text.Position) if text_rect.Contains(event.Position): self.toggle_active(active=True) return event.Skip() #class ListBoxProperty(ComboBoxProperty): #def __init__(self, value="", choices=[], default_value=_DefaultArgument, name=None): #self.choices = choices #TextProperty.__init__(self, value, False, default_value, name) #def create_text_ctrl(self, panel, value): #style = wx.LB_SINGLE #combo = wx.ListBox( panel, -1, self.value, choices=self.choices, style=style ) #combo.Bind(wx.EVT_LISTBOX, self.on_combobox) ##combo.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) ##combo.Bind(wx.EVT_CHAR, self.on_char) #return combo
Example #2
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def SetChoices(self, choices): max_text_width = 0 max_text_height = 0 self.ListBox.Clear() for choice in choices: self.ListBox.Append(choice) w, h = self.ListBox.GetTextExtent(choice) max_text_width = max(max_text_width, w) max_text_height = max(max_text_height, h) itemcount = min(len(choices), MAX_ITEM_SHOWN) width = self.Parent.GetSize()[0] height = \ max_text_height * itemcount + \ LISTBOX_INTERVAL_HEIGHT * max(0, itemcount - 1) + \ 2 * LISTBOX_BORDER_HEIGHT if max_text_width + 10 > width: height += 15 size = wx.Size(width, height) if wx.Platform == '__WXMSW__': size.width -= 2 self.ListBox.SetSize(size) self.SetClientSize(size)
Example #3
Source File: sidebar.py From pyFileFixity with MIT License | 6 votes |
def _do_layout(self): self.SetDoubleBuffered(True) self.SetBackgroundColour('#f2f2f2') self.SetSize((180, 0)) self.SetMinSize((180, 0)) STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10) container = wx.BoxSizer(wx.VERTICAL) container.AddSpacer(15) container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT) container.AddSpacer(5) thing = wx.ListBox(self, -1, choices=self.contents) container.Add(thing, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10) container.AddSpacer(20) self.SetSizer(container) thing.SetSelection(0) self.Bind(wx.EVT_LISTBOX, self.onClick, thing)
Example #4
Source File: templates_ui.py From wxGlade with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: TemplateListDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.template_names = wx.ListBox(self, wx.ID_ANY, choices=[]) self.template_name = wx.StaticText(self, wx.ID_ANY, _("wxGlade template:\n")) self.author = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY) self.description = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.instructions = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.btn_open = wx.Button(self, wx.ID_OPEN, "") self.btn_edit = wx.Button(self, ID_EDIT, _("&Edit")) self.btn_delete = wx.Button(self, wx.ID_DELETE, "") self.btn_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_open, self.template_names) self.Bind(wx.EVT_LISTBOX, self.on_select_template, self.template_names) self.Bind(wx.EVT_BUTTON, self.on_open, self.btn_open) self.Bind(wx.EVT_BUTTON, self.on_edit, id=ID_EDIT) self.Bind(wx.EVT_BUTTON, self.on_delete, self.btn_delete) # end wxGlade
Example #5
Source File: bomsaway.py From Boms-Away with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText( self, 11, 'Duplicate Component values found!' '\n\nPlease select which format to follow:') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_selection, id=wx.ID_ANY) self.Show(True)
Example #6
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 5 votes |
def crt_listbox(self, choices, style=None): if style is None: listbox = wx.ListBox(self, choices=choices, size=self.LISTBOX_SIZE) else: listbox = wx.ListBox(self, choices=choices, style=style, size=self.LISTBOX_SIZE) return listbox
Example #7
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def DismissListBox(self): if self.listbox is not None: if self.listbox.ListBox.HasCapture(): self.listbox.ListBox.ReleaseMouse() self.listbox.Destroy() self.listbox = None
Example #8
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnLeftDown(self, event): selected = self.ListBox.HitTest(wx.Point(event.GetX(), event.GetY())) parent_size = self.Parent.GetSize() parent_rect = wx.Rect(0, -parent_size[1], parent_size[0], parent_size[1]) if selected != wx.NOT_FOUND: wx.CallAfter(self.Parent.SetValueFromSelected, self.ListBox.GetString(selected)) elif parent_rect.InsideXY(event.GetX(), event.GetY()): result, x, y = self.Parent.HitTest(wx.Point(event.GetX(), event.GetY() + parent_size[1])) if result != wx.TE_HT_UNKNOWN: self.Parent.SetInsertionPoint(self.Parent.XYToPosition(x, y)) else: wx.CallAfter(self.Parent.DismissListBox) event.Skip()
Example #9
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def GetSelection(self): return self.ListBox.GetStringSelection()
Example #10
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def MoveSelection(self, direction): selected = self.ListBox.GetSelection() if selected == wx.NOT_FOUND: if direction >= 0: selected = 0 else: selected = self.ListBox.GetCount() - 1 else: selected = (selected + direction) % (self.ListBox.GetCount() + 1) if selected == self.ListBox.GetCount(): selected = wx.NOT_FOUND self.ListBox.SetSelection(selected)
Example #11
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, choices=None): wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE) self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL | wx.LB_SINGLE | wx.LB_SORT) choices = [] if choices is None else choices self.SetChoices(choices) self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.ListBox.Bind(wx.EVT_MOTION, self.OnMotion)
Example #12
Source File: bug194.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: Frame194.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 600)) self.SetTitle(_("frame_1")) sizer_1 = wx.GridSizer(2, 3, 0, 0) self.list_box_single = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_SINGLE")]) self.list_box_single.SetSelection(0) sizer_1.Add(self.list_box_single, 1, wx.ALL | wx.EXPAND, 5) self.list_box_multiple = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE) self.list_box_multiple.SetSelection(0) sizer_1.Add(self.list_box_multiple, 1, wx.ALL | wx.EXPAND, 5) self.list_box_extended = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_EXTENDED")], style=wx.LB_EXTENDED) self.list_box_extended.SetSelection(0) sizer_1.Add(self.list_box_extended, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_single = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_SINGLE")], style=wx.LB_SINGLE) self.check_list_box_single.SetSelection(0) sizer_1.Add(self.check_list_box_single, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_multiple = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE) self.check_list_box_multiple.SetSelection(0) sizer_1.Add(self.check_list_box_multiple, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_extended = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_EXTENDED")], style=wx.LB_EXTENDED) self.check_list_box_extended.SetSelection(0) sizer_1.Add(self.check_list_box_extended, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class Frame194
Example #13
Source File: list_box.py From wxGlade with MIT License | 5 votes |
def create_widget(self): choices = [c[0] for c in self.choices] self.widget = wx.ListBox(self.parent_window.widget, self.id, choices=choices) if self.selection>=0: self.widget.SetSelection(self.selection) self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
Example #14
Source File: sidebar.py From me-ica with GNU Lesser General Public License v2.1 | 5 votes |
def _do_layout(self): self.SetDoubleBuffered(True) self.SetBackgroundColour('#f2f2f2') self.SetSize((180, 0)) self.SetMinSize((180, 0)) STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10) container = wx.BoxSizer(wx.VERTICAL) container.AddSpacer(15) container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT) container.AddSpacer(5) self.listbox = wx.ListBox(self, -1) container.Add(self.listbox, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10) container.AddSpacer(20) self.SetSizer(container) self.Bind(wx.EVT_LISTBOX, self.selection_change, self.listbox)
Example #15
Source File: widgets.py From youtube-dl-gui with The Unlicense | 5 votes |
def GetString(self, index): if index < 0 or index >= self.GetCount(): # Return empty string based on the wx.ListBox docs # for some reason parent GetString does not handle # invalid indices return "" return self._remove_prefix(super(ListBoxWithHeaders, self).GetString(index))
Example #16
Source File: widgets.py From youtube-dl-gui with The Unlicense | 5 votes |
def _remove_prefix(self, string): if string[:len(self.TEXT_PREFIX)] == self.TEXT_PREFIX: return string[len(self.TEXT_PREFIX):] return string # wx.ListBox methods
Example #17
Source File: bomsaway.py From Boms-Away with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText(self, 11, 'Please select from the following components') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX, self.on_selection, id=wx.ID_ANY) self.Show(True)
Example #18
Source File: listbox.py From Gooey with MIT License | 5 votes |
def getWidget(self, parent, *args, **options): height = self._options.get('height', 60) return wx.ListBox( parent=parent, choices=self._meta['choices'], size=(-1, height), style=wx.LB_MULTIPLE )
Example #19
Source File: sidebar.py From Gooey with MIT License | 5 votes |
def __init__(self, parent, buildSpec, configPanels, *args, **kwargs): super(Sidebar, self).__init__(parent, *args, **kwargs) self._parent = parent self.buildSpec = buildSpec self.configPanels = configPanels self.activeSelection = 0 self.options = list(self.buildSpec['widgets'].keys()) self.leftPanel = wx.Panel(self) self.label = wx_util.h1(self.leftPanel, self.buildSpec.get('sidebar_title')) self.listbox = wx.ListBox(self.leftPanel, -1, choices=self.options) self.Bind(wx.EVT_LISTBOX, self.swapConfigPanels, self.listbox) self.layoutComponent() self.listbox.SetSelection(0)
Example #20
Source File: dfgui.py From PandasDataFrameGUI with MIT License | 5 votes |
def __init__(self, parent, size, data, *args, **kwargs): wx.ListBox.__init__(self, parent, size, **kwargs) if isinstance(data,(pd.RangeIndex,pd.Int64Index)): # RangeIndex is not supported by self._update_columns data = pd.Index([str(i) for i in data]) self.data = data self.InsertItems(self.data, 0) self.Bind(wx.EVT_LISTBOX, self.on_selection_changed) self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down) self.Bind(wx.EVT_RIGHT_DOWN, self.on_right_down) self.Bind(wx.EVT_RIGHT_UP, self.on_right_up) self.Bind(wx.EVT_MOTION, self.on_move) self.index_iter = range(len(self.data)) self.selected_items = [True] * len(self.data) self.index_mapping = list(range(len(self.data))) self.drag_start_index = None self.update_selection() self.SetFocus()
Example #21
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent): wx.ListBox.__init__(self, parent, -1) wx.EVT_LISTBOX(self, self.GetId(), self.OnPageChange) # get a list of all the pages
Example #22
Source File: commondialogs.py From CANFestivino with GNU Lesser General Public License v2.1 | 4 votes |
def _init_ctrls(self, prnt): wx.Dialog.__init__(self, id=ID_COMMUNICATIONDIALOG, name='CommunicationDialog', parent=prnt, pos=wx.Point(234, 216), size=wx.Size(726, 437), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, title=_('Edit Communication Profile')) self.SetClientSize(wx.Size(726, 437)) self.staticText1 = wx.StaticText(id=ID_COMMUNICATIONDIALOGSTATICTEXT1, label=_('Possible Profile Indexes:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.PossibleIndexes = wx.ListBox(choices=[], id=ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES, name='PossibleIndexes', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.LB_EXTENDED) self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnPossibleIndexesDClick, id=ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES) self.Select = wx.Button(id=ID_COMMUNICATIONDIALOGSELECT, label='>>', name='Select', parent=self, pos=wx.Point(0, 0), size=wx.Size(32, 32), style=0) self.Select.Bind(wx.EVT_BUTTON, self.OnSelectButton, id=ID_COMMUNICATIONDIALOGSELECT) self.Unselect = wx.Button(id=ID_COMMUNICATIONDIALOGUNSELECT, label='<<', name='Unselect', parent=self, pos=wx.Point(0, 0), size=wx.Size(32, 32), style=0) self.Unselect.Bind(wx.EVT_BUTTON, self.OnUnselectButton, id=ID_COMMUNICATIONDIALOGUNSELECT) self.staticText2 = wx.StaticText(id=ID_COMMUNICATIONDIALOGSTATICTEXT2, label=_('Current Profile Indexes:'), name='staticText2', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) self.CurrentIndexes = wx.ListBox(choices=[], id=ID_COMMUNICATIONDIALOGCURRENTINDEXES, name='CurrentIndexes', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.LB_EXTENDED) self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnCurrentIndexesDClick, id=ID_COMMUNICATIONDIALOGCURRENTINDEXES) self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL) self._init_sizers()
Example #23
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 4 votes |
def Configure(self, location_id = "Antwerp, Belgium", hl=''): text=self.text dialog = eg.ConfigPanel(self) sizer = dialog.sizer mySizer = wx.FlexGridSizer(cols=2) desc0 = wx.StaticText(dialog, -1, text.LanguageLabel) mySizer.Add(desc0, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) Language = wx.TextCtrl(dialog, -1,hl) mySizer.Add(Language, 0, wx.EXPAND|wx.ALL, 5) desc1 = wx.StaticText(dialog, -1, text.LocationLabel) mySizer.Add(desc1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) Location = wx.TextCtrl(dialog, -1,location_id) mySizer.Add(Location, 0, wx.EXPAND|wx.ALL, 5) desc2 = wx.StaticText(dialog, -1, text.CountriesLabel) mySizer.Add(desc2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) CountriesEdit = wx.ListBox(dialog, -1, choices=[], style=wx.LB_SINGLE) mySizer.Add(CountriesEdit, 0, wx.EXPAND|wx.ALL, 5) CountriesEdit.Clear() CountryList = pywapi.get_countries_from_google() i=0 while i < len(CountryList): CountriesEdit.Append(CountryList[i]['name']) i=i+1 def OnCountrySelect(event): CitiesEdit.Clear() result = pywapi.get_cities_from_google(str(CountryList[CountriesEdit.GetSelection()]['iso_code'])) i=0 while i < len(result): CitiesEdit.Append(result[i]['name']) i=i+1 Location.SetValue(CitiesEdit.GetStringSelection() + ", " + CountriesEdit.GetStringSelection()) CountriesEdit.Bind(wx.EVT_LISTBOX, OnCountrySelect) desc3 = wx.StaticText(dialog, -1, text.CitiesLabel) mySizer.Add(desc3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) CitiesEdit = wx.ListBox(dialog, -1, choices=[], style=wx.LB_SINGLE) mySizer.Add(CitiesEdit, 0, wx.EXPAND|wx.ALL, 5) def OnCitySelect(event): Location.SetValue(CitiesEdit.GetStringSelection() + ", " + CountriesEdit.GetStringSelection()) CitiesEdit.Bind(wx.EVT_LISTBOX, OnCitySelect) sizer.Add(mySizer, 1, wx.EXPAND) while dialog.Affirmed(): dialog.SetResult(Location.GetValue(), Language.GetValue())
Example #24
Source File: JobInfo.py From meerk40t with MIT License | 4 votes |
def __init__(self, *args, **kwds): # begin wxGlade: JobInfo.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((659, 612)) self.operations_listbox = wx.ListBox(self, wx.ID_ANY, choices=[], style=wx.LB_ALWAYS_SB | wx.LB_SINGLE) self.commands_listbox = wx.ListBox(self, wx.ID_ANY, choices=[], style=wx.LB_ALWAYS_SB | wx.LB_SINGLE) self.button_job_spooler = wx.BitmapButton(self, wx.ID_ANY, icons8_route_50.GetBitmap()) self.button_writer_control = wx.Button(self, wx.ID_ANY, _("Start Job")) self.button_writer_control.SetBitmap(icons8_laser_beam_52.GetBitmap()) self.button_writer_control.SetFont( wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI")) # Menu Bar self.JobInfo_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.menu_autostart = wxglade_tmp_menu.Append(wx.ID_ANY, _("Start Spooler"), "", wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.on_check_auto_start_controller, id=self.menu_autostart.GetId()) self.menu_prehome = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home Before"), "", wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.on_check_home_before, id=self.menu_prehome.GetId()) self.menu_autohome = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home After"), "", wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.on_check_home_after, id=self.menu_autohome.GetId()) self.menu_autobeep = wxglade_tmp_menu.Append(wx.ID_ANY, _("Beep After"), "", wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.on_check_beep_after, id=self.menu_autobeep.GetId()) self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Automatic")) wxglade_tmp_menu = wx.Menu() t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home"), "") self.Bind(wx.EVT_MENU, self.jobadd_home, id=t.GetId()) t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Wait"), "") self.Bind(wx.EVT_MENU, self.jobadd_wait, id=t.GetId()) t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Beep"), "") self.Bind(wx.EVT_MENU, self.jobadd_beep, id=t.GetId()) t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Interrupt"), "") self.Bind(wx.EVT_MENU, self.jobadd_interrupt, id=t.GetId()) self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Add")) self.SetMenuBar(self.JobInfo_menubar) # Menu Bar end self.__set_properties() self.__do_layout() self.Bind(wx.EVT_LISTBOX, self.on_listbox_operation_click, self.operations_listbox) self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_operation_dclick, self.operations_listbox) self.Bind(wx.EVT_LISTBOX, self.on_listbox_commands_click, self.commands_listbox) self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_commands_dclick, self.commands_listbox) self.Bind(wx.EVT_BUTTON, self.on_button_start_job, self.button_writer_control) self.Bind(wx.EVT_BUTTON, self.on_button_job_spooler, self.button_job_spooler) # end wxGlade self.Bind(wx.EVT_CLOSE, self.on_close, self) # TODO: Move this to Elements self.preprocessor = OperationPreprocessor() self.operations = []
Example #25
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, id, cfg): wx.Panel.__init__(self, parent, id) self.cfg = cfg vsizer = wx.BoxSizer(wx.VERTICAL) hsizer = wx.BoxSizer(wx.HORIZONTAL) vsizer2 = wx.BoxSizer(wx.VERTICAL) vsizer2.Add(wx.StaticText(self, -1, "Commands:")) self.commandsLb = wx.ListBox(self, -1, size = (175, 50)) for cmd in self.cfg.commands: self.commandsLb.Append(cmd.name, cmd) vsizer2.Add(self.commandsLb, 1) hsizer.Add(vsizer2, 0, wx.EXPAND | wx.RIGHT, 15) vsizer2 = wx.BoxSizer(wx.VERTICAL) vsizer2.Add(wx.StaticText(self, -1, "Keys:")) self.keysLb = wx.ListBox(self, -1, size = (150, 60)) vsizer2.Add(self.keysLb, 1, wx.BOTTOM, 10) btn = wx.Button(self, -1, "Add") wx.EVT_BUTTON(self, btn.GetId(), self.OnAdd) vsizer2.Add(btn, 0, wx.ALIGN_CENTER | wx.BOTTOM, 10) self.addBtn = btn btn = wx.Button(self, -1, "Delete") wx.EVT_BUTTON(self, btn.GetId(), self.OnDelete) vsizer2.Add(btn, 0, wx.ALIGN_CENTER | wx.BOTTOM, 10) self.deleteBtn = btn vsizer2.Add(wx.StaticText(self, -1, "Description:")) self.descEntry = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE | wx.TE_READONLY, size = (150, 75)) vsizer2.Add(self.descEntry, 1, wx.EXPAND) hsizer.Add(vsizer2, 0, wx.EXPAND | wx.BOTTOM, 10) vsizer.Add(hsizer) vsizer.Add(wx.StaticText(self, -1, "Conflicting keys:"), 0, wx.TOP, 10) self.conflictsEntry = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE | wx.TE_READONLY, size = (50, 75)) vsizer.Add(self.conflictsEntry, 1, wx.EXPAND) util.finishWindow(self, vsizer, center = False) wx.EVT_LISTBOX(self, self.commandsLb.GetId(), self.OnCommandLb) self.commandsLb.SetSelection(0) self.OnCommandLb()
Example #26
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, id, cfg): wx.Panel.__init__(self, parent, id) self.cfg = cfg vsizer = wx.BoxSizer(wx.VERTICAL) hsizer = wx.BoxSizer(wx.HORIZONTAL) self.colorsLb = wx.ListBox(self, -1, size = (300, 250)) tmp = self.cfg.cvars.color.values() tmp.sort(lambda c1, c2: cmp(c1.descr, c2.descr)) for it in tmp: self.colorsLb.Append(it.descr, it.name) hsizer.Add(self.colorsLb, 1) vsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 10) hsizer = wx.BoxSizer(wx.HORIZONTAL) vsizer2 = wx.BoxSizer(wx.VERTICAL) btn = wx.Button(self, -1, "Change") wx.EVT_BUTTON(self, btn.GetId(), self.OnChangeColor) vsizer2.Add(btn, 0, wx.BOTTOM, 10) btn = wx.Button(self, -1, "Restore default") wx.EVT_BUTTON(self, btn.GetId(), self.OnDefaultColor) vsizer2.Add(btn) hsizer.Add(vsizer2, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) self.colorSample = misc.MyColorSample(self, -1, size = wx.Size(200, 50)) hsizer.Add(self.colorSample, 1, wx.EXPAND) vsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 10) self.useCustomElemColors = wx.CheckBox( self, -1, "Use per-element-type colors") wx.EVT_CHECKBOX(self, self.useCustomElemColors.GetId(), self.OnMisc) vsizer.Add(self.useCustomElemColors) util.finishWindow(self, vsizer, center = False) wx.EVT_LISTBOX(self, self.colorsLb.GetId(), self.OnColorLb) self.colorsLb.SetSelection(0) self.OnColorLb()
Example #27
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, id, cfg): wx.Panel.__init__(self, parent, id) self.cfg = cfg vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(wx.StaticText(self, -1, "Screen fonts:")) self.fontsLb = wx.ListBox(self, -1, size = (300, 100)) for it in ["fontNormal", "fontBold", "fontItalic", "fontBoldItalic"]: self.fontsLb.Append("", it) vsizer.Add(self.fontsLb, 0, wx.BOTTOM, 10) hsizer = wx.BoxSizer(wx.HORIZONTAL) btn = wx.Button(self, -1, "Change") wx.EVT_LISTBOX_DCLICK(self, self.fontsLb.GetId(), self.OnChangeFont) wx.EVT_BUTTON(self, btn.GetId(), self.OnChangeFont) self.errText = wx.StaticText(self, -1, "") self.origColor = self.errText.GetForegroundColour() hsizer.Add(btn) hsizer.Add((20, -1)) hsizer.Add(self.errText, 0, wx.ALIGN_CENTER_VERTICAL) vsizer.Add(hsizer, 0, wx.BOTTOM, 20) vsizer.Add(wx.StaticText(self, -1, "The settings below apply only" " to 'Draft' view mode."), 0, wx.BOTTOM, 15) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(wx.StaticText(self, -1, "Row spacing:"), 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10) self.spacingEntry = wx.SpinCtrl(self, -1) self.spacingEntry.SetRange(*self.cfg.cvars.getMinMax("fontYdelta")) wx.EVT_SPINCTRL(self, self.spacingEntry.GetId(), self.OnMisc) wx.EVT_KILL_FOCUS(self.spacingEntry, self.OnKillFocus) hsizer.Add(self.spacingEntry, 0) hsizer.Add(wx.StaticText(self, -1, "pixels"), 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 15) self.pbRb = wx.RadioBox(self, -1, "Page break lines to show", style = wx.RA_SPECIFY_COLS, majorDimension = 1, choices = [ "None", "Normal", "Normal + unadjusted " ]) vsizer.Add(self.pbRb) self.fontsLb.SetSelection(0) self.updateFontLb() self.cfg2gui() util.finishWindow(self, vsizer, center = False) wx.EVT_RADIOBOX(self, self.pbRb.GetId(), self.OnMisc)
Example #28
Source File: locationsdlg.py From trelby with GNU General Public License v2.0 | 4 votes |
def __init__(self, parent, sp): wx.Dialog.__init__(self, parent, -1, "Locations", style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.sp = sp vsizer = wx.BoxSizer(wx.VERTICAL) tmp = wx.StaticText(self, -1, "Locations:") vsizer.Add(tmp) self.locationsLb = wx.ListBox(self, -1, size = (450, 200)) vsizer.Add(self.locationsLb, 1, wx.EXPAND) hsizer = wx.BoxSizer(wx.HORIZONTAL) self.addBtn = gutil.createStockButton(self, "Add") hsizer.Add(self.addBtn) wx.EVT_BUTTON(self, self.addBtn.GetId(), self.OnAdd) self.delBtn = gutil.createStockButton(self, "Delete") hsizer.Add(self.delBtn, 0, wx.LEFT, 10) wx.EVT_BUTTON(self, self.delBtn.GetId(), self.OnDelete) vsizer.Add(hsizer, 0, wx.ALIGN_CENTER | wx.TOP, 10) tmp = wx.StaticText(self, -1, "Scenes:") vsizer.Add(tmp) self.scenesLb = wx.ListBox(self, -1, size = (450, 200), style = wx.LB_EXTENDED) vsizer.Add(self.scenesLb, 1, wx.EXPAND) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add((1, 1), 1) cancelBtn = gutil.createStockButton(self, "Cancel") hsizer.Add(cancelBtn, 0, wx.LEFT, 10) okBtn = gutil.createStockButton(self, "OK") hsizer.Add(okBtn, 0, wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10) util.finishWindow(self, vsizer) wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK) self.fillGui()