我们从Python开源项目中,提取了以下32个代码示例,用于说明如何使用wx.LC_REPORT。
def __init__(self, parent, df, status_bar_callback): wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES | wx.LB_MULTIPLE ) self.status_bar_callback = status_bar_callback self.df_orig = df self.original_columns = self.df_orig.columns[:] self.current_columns = self.df_orig.columns[:] self.sort_by_column = None self._reset_mask() # prepare attribute for alternating colors of rows self.attr_light_blue = wx.ListItemAttr() self.attr_light_blue.SetBackgroundColour("#D6EBFF") self.Bind(wx.EVT_LIST_COL_CLICK, self._on_col_click) self.Bind(wx.EVT_RIGHT_DOWN, self._on_right_click) self.df = pd.DataFrame({}) # init empty to force initial update self._update_rows() self._update_columns(self.original_columns)
def createWidgets(self): self.listCtrl = wxskinListCtrl(self, ID_LISTCTRL, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_VRULES|wx.LC_HRULES) self.listCtrl.InsertColumn(0, "Name") self.listCtrl.InsertColumn(1, "Number") ColumnSorterMixin.__init__(self, 2) self.currentItem = 0 wx.EVT_SIZE(self, self.OnSize) wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected) wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated) wx.EVT_CLOSE(self, self.closeWindow) wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit) wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown) # for wxMSW and wxGTK respectively wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL, self.OnRightClick) wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
def createWidgets(self): self.listCtrl = wxskinListCtrl(self, ID_LISTCTRL, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_VRULES|wx.LC_HRULES) self.listCtrl.InsertColumn(COL_STATUS, "Status") self.listCtrl.InsertColumn(COL_DATE, "Date") self.listCtrl.InsertColumn(COL_FROM, "From") self.listCtrl.InsertColumn(COL_MESSAGE, "Message") ColumnSorterMixin.__init__(self, 4) self.currentItem = 0 wx.EVT_SIZE(self, self.OnSize) wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected) wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated) wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown) wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit) wx.EVT_CLOSE(self, self.closeWindow) # for wxMSW and wxGTK respectively wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL, self.OnRightClick) wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
def __init__(self): wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='Moogle HTTP to OPC Server', size=(800,600) ) sizer = wx.BoxSizer(wx.VERTICAL) self.row_colours = { 'rest': 'blue', 'opc': 'purple'} ## -- Configure Top Tool bar tb = wx.ToolBar(self, style=TBFLAGS) sizer.Add(tb, 0, wx.EXPAND) tsize = (24,24) tb.SetToolBitmapSize(tsize) tb.Realize() self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT #| wx.BORDER_SUNKEN #| wx.BORDER_NONE | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_NO_HEADER | wx.LC_VRULES | wx.LC_HRULES #| wx.LC_SINGLE_SEL ) self.loadListviewHeader() sizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(sizer) sizer.Layout() self.Bind(wx.EVT_CLOSE, self.onClose)
def __init__( self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL, validator=wx.DefaultValidator, columns=None, name=_("ProfileView"), ): wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator, name) if columns is not None: self.columns = columns self.sortOrder = [ (self.columns[5].defaultOrder, self.columns[5]), ] self.sorted = [] self.CreateControls()
def __init__(self, parent): wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY) self.products = [Book("wxPython in Action", "Robin Dunn", "1932394621", "Manning"), Book("Hello World", "Warren and Carter Sande", "1933988495", "Manning") ] self.dataOlv = ObjectListView(self, wx.ID_ANY, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.setBooks() # Allow the cell values to be edited when double-clicked self.dataOlv.cellEditMode = ObjectListView.CELLEDIT_SINGLECLICK # create an update button updateBtn = wx.Button(self, wx.ID_ANY, "Update OLV") updateBtn.Bind(wx.EVT_BUTTON, self.updateControl) # Create some sizers mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(self.dataOlv, 1, wx.ALL|wx.EXPAND, 5) mainSizer.Add(updateBtn, 0, wx.ALL|wx.CENTER, 5) self.SetSizer(mainSizer)
def __init__(self, *arg, **kw): if 'style' in kw and (kw['style']&wx.LC_LIST or kw['style']&wx.LC_REPORT): kw['style'] |= wx.LC_SINGLE_SEL else: kw['style'] = wx.LC_SINGLE_SEL|wx.LC_LIST wx.ListCtrl.__init__(self, *arg, **kw) self.Bind(wx.EVT_LIST_BEGIN_DRAG, self._startDrag) dt = ListDrop(self._insert) self.SetDropTarget(dt)
def __init__(self, parent, id, pos=(5,635), size=(570,160)): wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos) self.InsertColumn(0, 'Device') self.InsertColumn(1, 'GPIO') self.InsertColumn(2, 'wiring') self.InsertColumn(3, 'Currently') self.InsertColumn(4, 'info') self.SetColumnWidth(0, 150) self.SetColumnWidth(1, 75) self.SetColumnWidth(2, 100) self.SetColumnWidth(3, 100) self.SetColumnWidth(4, -1)
def __init__(self, parent, id, pos=(5,10), size=(900,200)): wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos) self.InsertColumn(0, 'Line') self.InsertColumn(1, 'Enabled') self.InsertColumn(2, 'Active') self.InsertColumn(3, 'Task') self.InsertColumn(4, 'extra args') self.InsertColumn(5, 'comment') self.SetColumnWidth(0, 100) self.SetColumnWidth(1, 75) self.SetColumnWidth(2, 75) self.SetColumnWidth(3, 650) self.SetColumnWidth(4, 500) self.SetColumnWidth(5, -1)
def __init__(self, parent, id, pos=(5,245), size=(900,200)): wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos) self.InsertColumn(0, 'Line') self.InsertColumn(1, 'Enabled') self.InsertColumn(2, 'every') self.InsertColumn(3, 'Task') self.InsertColumn(4, 'extra args') self.InsertColumn(5, 'comment') self.SetColumnWidth(0, 75) self.SetColumnWidth(1, 75) self.SetColumnWidth(2, 100) self.SetColumnWidth(3, 500) self.SetColumnWidth(4, 500) self.SetColumnWidth(5, -1)
def __init__(self, parent, id, pos=(5,530), size=(900,200)): wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos) self.InsertColumn(0, 'Line') self.InsertColumn(1, 'Enabled') self.InsertColumn(2, 'Time') self.InsertColumn(3, 'Task') self.InsertColumn(4, 'extra args') self.InsertColumn(5, 'comment') self.SetColumnWidth(0, 75) self.SetColumnWidth(1, 75) self.SetColumnWidth(2, 100) self.SetColumnWidth(3, 500) self.SetColumnWidth(4, 500) self.SetColumnWidth(5, -1)
def __init__(self, parent, id, pos=(25, 250), size=(550,200)): wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos) self.InsertColumn(0, 'Filename') self.InsertColumn(1, 'date modified') self.InsertColumn(2, 'age') self.InsertColumn(3, 'updated?') self.SetColumnWidth(0, 190) self.SetColumnWidth(1, 150) self.SetColumnWidth(2, 110) self.SetColumnWidth(3, 100)
def __init__(self, parent, id, bmpsize=(24,24), size=(180,1)): wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT|wx.LC_NO_HEADER|wx.LC_HRULES|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL, size=(180,1)) ListCtrlAutoWidthMixin.__init__(self) bmpchk = getpipelineok24Bitmap() bmpunchk = getpipelineignore24Bitmap() CheckListCtrlMixin.__init__(self,check_image=bmpchk,uncheck_image=bmpunchk, imgsz=bmpsize)
def OnInit(self): frame = wx.Frame(None, -1, "Hello from wxPython") id=wx.NewId() self.list=wx.ListCtrl(frame,id,style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.list.Show(True) self.list.InsertColumn(0,"Data #1") self.list.InsertColumn(1,"Data #2") self.list.InsertColumn(2,"Data #3") # 0 will insert at the start of the list pos = self.list.InsertStringItem(0,"hello") # add values in the other columns on the same row self.list.SetStringItem(pos,1,"world") self.list.SetStringItem(pos,2,"!") pos = self.list.InsertStringItem(0,"wat") self.list.SetStringItem(pos,1,"um") self.list.SetStringItem(pos,2,"wha") self.itemDataMap = { 0: ("hello","world","!"), 1: ("wat","um","wha") } LCM.ColumnSorterMixin.__init__(self,3) frame.Show(True) self.SetTopWindow(frame) return True
def __init__(self, parent, title, data=[]): wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VIRTUAL) self.title, self.data = title, data #self.Bind(wx.EVT_LIST_CACHE_HINT, self.DoCacheItems) for col, text in enumerate(title): self.InsertColumn(col, text) self.set_data(data)
def __init__(self, parent): wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) CheckListCtrlMixin.__init__(self) ListCtrlAutoWidthMixin.__init__(self) #wx.ListCtrl.InsertStringItem( #
def __init__(self, parent, filetypes, fileLimit = None): wx.Dialog.__init__(self, parent, -1, title = 'Select Input Files', style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.filetypes = {} self.fileArray = wx.ListCtrl(self, -1, style = wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_HRULES | wx.LC_VRULES) for i, (filetype, ext) in enumerate(filetypes): self.fileArray.InsertColumn(i, filetype) assert filetype not in self.filetypes, "Non-unique file identifiers! %s" % filetype self.filetypes[filetype] = ext self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.getFile, self.fileArray) self.goButton = wx.Button(self, -1, "Use Selected Files") self.Bind(wx.EVT_BUTTON, self.complete, self.goButton) self.Bind(wx.EVT_CLOSE, self.abort) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.fileArray, 1, wx.ALL | wx.EXPAND, 10) box.Add(self.goButton, 0, wx.ALL | wx.EXPAND, 10) self.SetSizerAndFit(box) self.SetSize(wx.Size(1200, 300)) self.Bind(wx.EVT_SIZE, self.resize) for i in range(0, 10): self.fileArray.Append([''] * self.fileArray.GetColumnCount()) self.resize(None) self.CentreOnScreen()
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent=parent) self.file_list = [] file_drop_target = MyFileDropTarget(self) self.olv = ObjectListView( self, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.olv.SetDropTarget(file_drop_target) self.setFiles() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.olv, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) self.defaultColor = self.GetBackgroundColour() rows = [("Ford", "Taurus", "1996", "Blue"), ("Nissan", "370Z", "2010", "Green"), ("Porche", "911", "2009", "Red") ] self.list_ctrl = wx.ListCtrl(self, style=wx.LC_REPORT) self.list_ctrl.InsertColumn(0, "Make") self.list_ctrl.InsertColumn(1, "Model") self.list_ctrl.InsertColumn(2, "Year") self.list_ctrl.InsertColumn(3, "Color") index = 0 for row in rows: self.list_ctrl.InsertStringItem(index, row[0]) self.list_ctrl.SetStringItem(index, 1, row[1]) self.list_ctrl.SetStringItem(index, 2, row[2]) self.list_ctrl.SetStringItem(index, 3, row[3]) if index % 2: self.list_ctrl.SetItemBackgroundColour(index, "white") else: self.list_ctrl.SetItemBackgroundColour(index, "yellow") index += 1 btn = wx.ToggleButton(self, label="Toggle Dark") btn.Bind(wx.EVT_TOGGLEBUTTON, self.onToggleDark) normalBtn = wx.Button(self, label="Test") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.list_ctrl, 0, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL, 5) sizer.Add(normalBtn, 0, wx.ALL, 5) self.SetSizer(sizer)
def __init__(self, parent, names, units, curvetypes, datatypes, *args, **kwargs): if 'on_ok_callback' in kwargs: self.on_ok_callback = kwargs.pop('on_ok_callback') else: self.on_ok_callback = None if 'on_cancel_callback' in kwargs: self.on_cancel_callback = kwargs.pop('on_cancel_callback') else: self.on_cancel_callback = None super(Dialog, self).__init__(parent, *args, **kwargs) self.names = names self.units = units self.curvetypes = curvetypes self.datatypes = datatypes self.nrows = len(self.names) style = wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT self.list = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=style) self._fill_list() button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) self.Bind(wx.EVT_BUTTON, self.on_button) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.list, proportion=1, flag=wx.EXPAND) vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT) self.SetSizerAndFit(vbox) self.SetSize((400, 600)) self.SetTitle(u"Importar como:")
def __init__(self, parent): wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT) TextEditMixin.__init__(self) CheckListCtrlMixin.__init__(self) ListCtrlAutoWidthMixin.__init__(self) ListRowHighlighter.__init__(self, color=MEDIUM_GREY, mode=1) self.InsertColumn(0, '', width=24) self.InsertColumn(1, 'MNEM', width=80) self.InsertColumn(2, 'UNIT', width=80) self.InsertColumn(3, 'DATA', width=160) self.InsertColumn(4, 'DESC') self.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.on_begin_label_edit)
def __init__(self): global myWindow wx.Frame.__init__(self, None, -1, "MQTT Protocol Trace", size=(600, 400)) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OpenDetails) self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT) self.statusBar = self.CreateStatusBar() menubar = wx.MenuBar() menu1 = wx.Menu() clear = menu1.Append(wx.NewId(), "&Clear") self.Bind(wx.EVT_MENU, self.OnClear, clear) saveas = menu1.Append(wx.NewId(), "&Save as") self.Bind(wx.EVT_MENU, self.OnSaveAs, saveas) menubar.Append(menu1, "&File") self.SetMenuBar(menubar) for index, title in enumerate(cols): self.list.InsertColumn(index, title) self.list.SetColumnWidth(index, widths[index]) self.listitem = 0 listmix.ColumnSorterMixin.__init__(self, len(cols)) self.itemDataMap = {} myWindow = self self.thread = WorkerThread() self.thread.start()
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS) # self.Bind(wx.EVT_BUTTON, self.OnSelectFont, btn) self.list_ctrl = theListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES | wx.SUNKEN_BORDER) st1 = wx.StaticText(self, label=' Cadena Busqueda') self.cadenaBusqueda = wx.TextCtrl(self) btnbusqueda = wx.Button(self, label="Buscar") btnrecargaVM = wx.Button(self, label="Actualizar VM") name_rows = ['Carpeta', 'Nombre', 'IP', 'Estado', 'pregunta', 'Disco Path', 'Sistema', 'Notas', 'uuid'] # cargamos los nombres de los elementos for x in range(len(name_rows)): self.list_ctrl.InsertColumn(x, name_rows[x]) # conexion = conectar_con_vcenter(self, id) self.tabla = [] self.tabla = sacar_listado_capertas(conexion) self.vm_buscados = [] self.cargardatos_en_listctrl(self.tabla) # para la ordenacion--- llama a Getlistctrl self.itemDataMap = self.tabla listmix.ColumnSorterMixin.__init__(self, len(name_rows)) self.list_ctrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected, self.list_ctrl) # self.list_ctrl.Bind(wx.EVT_CONTEXT_MENU, self.onItemSelected, self.list_ctrl) # Metemos las cosas en le ventana en orden txtcontador = wx.StaticText(self, label='total VM: ' + str(len(self.tabla))) sizer = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(st1, wx.ALL | wx.ALIGN_CENTER, 5) hbox1.Add(self.cadenaBusqueda, wx.ALL | wx.ALIGN_CENTER, 5) hbox1.Add(btnbusqueda, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER, 5) hbox1.Add(btnrecargaVM, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER, 5) hbox1.Add(txtcontador, wx.ALL | wx.ALIGN_CENTER, 5) sizer.Add(hbox1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER, border=2) self.Bind(wx.EVT_BUTTON, self.busquedadatos, btnbusqueda) self.Bind(wx.EVT_BUTTON, self.recarga_VM, btnrecargaVM) sizer.Add(self.list_ctrl, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer) # tools for search an debug (to use uncomment the next line, works only linux) # wx.lib.inspection.InspectionTool().Show() # ---------------------------------------------------------------------- # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py
def __init__(self, parent): wx.Dialog.__init__(self, parent, title="Lookup Table", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) self.SetSizeHints(720,480,-1,-1) self.parent = parent self.Bind(wx.EVT_CLOSE, self.OnExit) self.panelphase = parent.GetParent().GetPage(0) self.panelvisual = self.GetParent() self.actor_list3D = ["vtkOpenGLActor", "vtkActor", "vtkMesaActor"] self.actor_list2D = ["vtkOpenGLImageActor", "vtkImageActor"] self.sizer = wx.BoxSizer(wx.VERTICAL) self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.vbox1 = wx.BoxSizer(wx.VERTICAL) self.vbox2 = wx.BoxSizer(wx.VERTICAL) self.font = self.panelvisual.font self.panels = [] self.listtitles = ["Real Amp","Real Phase", "Fourier Amp","Fourier Phase"] self.list = wx.ListCtrl(self,wx.ID_ANY,style=wx.LC_REPORT|wx.LC_NO_HEADER|wx.LC_HRULES|wx.SUNKEN_BORDER, size=(200,-1)) self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectListItem) self.list.InsertColumn(0,'Settings', width = 200) self.list.SetFont(self.font) for i in range(len(self.listtitles)): if IsNotWX4(): self.list.InsertStringItem(i,self.listtitles[i],i) else: self.list.InsertItem(i,self.listtitles[i],i) self.list.SetItemFont(i, self.font) self.panels.append(ColourDialog(self)) self.panels[-1].Hide() self.panels[-1].Layout() self.GetRadioChoice(i) self.vbox2.Add(self.panels[-1], 1, wx.EXPAND) self.vbox1.Add(self.list, 1, wx.EXPAND) self.panel_hld = wx.StaticText(self, label='') self.vbox2.Add(self.panel_hld, 1, wx.EXPAND) self.hbox.Add(self.vbox1, 0, wx.EXPAND,2) self.hbox.Add(self.vbox2, 1, wx.EXPAND,2) self.sizer.Add(self.hbox, 1, wx.EXPAND,2) self.button_update = wx.Button(self, label="Update Scale", size=(720, 30)) self.sizer.Add(self.button_update, 0, wx.EXPAND, 2) self.Bind(wx.EVT_BUTTON, self.OnClickUpdate,self.button_update) self.SetSizer(self.sizer) self.Fit() self.Layout() self.Show()
def __init__(self, parent): super(SearchDialog, self).__init__(parent=parent, title="pyjam Audio Search") self.parent = parent self.result_list = ObjectListView(parent=self, style=wx.LC_REPORT | wx.BORDER_SUNKEN, sortable=True, useAlternateBackColors=False) self.result_list.SetEmptyListMsg("No results") self.result_list.SetColumns([ ColumnDefn(title="Title", valueGetter="title", width=150), ColumnDefn(title="Description", valueGetter="desc", width=300) ]) self.search_recent = collections.deque([], 10) search_help = wx.StaticText(parent=self, label=("Enter a search term and press Enter. " "Then, select the videos you want from the list and press OK.")) self.search_query = wx.SearchCtrl(parent=self, style=wx.TE_PROCESS_ENTER) self.search_query.ShowCancelButton(True) self.search_query.SetMenu(self.search_menu()) top_sizer = wx.BoxSizer(wx.VERTICAL) olv_sizer = wx.BoxSizer(wx.VERTICAL) query_sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) olv_sizer.Add(self.result_list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_TOP, 5) query_sizer.Add(search_help, 0, wx.ALL ^ wx.TOP, 5) query_sizer.Add(self.search_query, 0, wx.ALL ^ wx.TOP | wx.EXPAND, 5) top_sizer.Add(olv_sizer, 1, wx.ALL | wx.EXPAND, 5) top_sizer.Add(query_sizer, 0, wx.ALL | wx.EXPAND, 5) top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5) # Context menu self.context_menu = wx.Menu() open_url = self.context_menu.Append(wx.ID_OPEN, "Open link in browser") copy_url = self.context_menu.Append(wx.ID_COPY, "Copy link address") self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, handler=self.list_right_click, source=self.result_list) self.Bind(wx.EVT_MENU, handler=self.copy_url, source=copy_url) self.Bind(wx.EVT_MENU, handler=self.open_url, source=open_url) self.Bind(wx.EVT_TEXT_ENTER, handler=self.on_search, source=self.search_query) self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK) self.SetSizerAndFit(top_sizer) self.Center() self.ShowModal()
def _init_ctrls(self, prnt): wx.Dialog.__init__( self, id=ID_DISCOVERYDIALOG, name='DiscoveryDialog', parent=prnt, style=wx.DEFAULT_DIALOG_STYLE, title=_('Service Discovery')) self.staticText1 = wx.StaticText( id=ID_DISCOVERYDIALOGSTATICTEXT1, label=_('Services available:'), name='staticText1', parent=self, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) # Set up list control self.ServicesList = AutoWidthListCtrl( id=ID_DISCOVERYDIALOGSERVICESLIST, name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL) self.ServicesList.InsertColumn(0, _('NAME')) self.ServicesList.InsertColumn(1, _('TYPE')) self.ServicesList.InsertColumn(2, _('IP')) self.ServicesList.InsertColumn(3, _('PORT')) self.ServicesList.SetColumnWidth(0, 150) self.ServicesList.SetColumnWidth(1, 150) self.ServicesList.SetColumnWidth(2, 150) self.ServicesList.SetColumnWidth(3, 150) self.ServicesList.SetInitialSize(wx.Size(-1, 300)) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=ID_DISCOVERYDIALOGSERVICESLIST) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, id=ID_DISCOVERYDIALOGSERVICESLIST) listmix.ColumnSorterMixin.__init__(self, 4) self.RefreshButton = wx.Button( id=ID_DISCOVERYDIALOGREFRESHBUTTON, label=_('Refresh'), name='RefreshButton', parent=self, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.Bind(wx.EVT_BUTTON, self.OnRefreshButton, id=ID_DISCOVERYDIALOGREFRESHBUTTON) self.LocalButton = wx.Button( id=ID_DISCOVERYDIALOGLOCALBUTTON, label=_('Local'), name='LocalButton', parent=self, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.Bind(wx.EVT_BUTTON, self.OnLocalButton, id=ID_DISCOVERYDIALOGLOCALBUTTON) self.IpButton = wx.Button( id=ID_DISCOVERYDIALOGIPBUTTON, label=_('Add IP'), name='IpButton', parent=self, pos=wx.Point(0, 0), size=wx.DefaultSize, style=0) self.Bind(wx.EVT_BUTTON, self.OnIpButton, id=ID_DISCOVERYDIALOGIPBUTTON) self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTER) self._init_sizers() self.Fit()
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0) self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY) self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, _("Warning: Always backup your database before you proceed to avoid potential data loss !!!")) self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("This software does not save Sampoorna credentials. It is used for one time login")) self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Username")) self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Password")) self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER) self.button_next = wx.Button(self.panel_login, wx.ID_ANY, _("Next >>")) self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("8 Standard")) self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("9 Standard")) self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("10 Standard")) self.button_previous = wx.Button(self.standard_pane, wx.ID_ANY, _("<<Previous")) self.button_proceed = wx.Button(self.standard_pane, wx.ID_ANY, _("Proceed >>")) self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, _("Progress")) self.progresss_total = wx.Gauge(self.panel_2, wx.ID_ANY, range=100) self.progress_each = wx.Gauge(self.panel_2, wx.ID_ANY, range=100) self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, _("Status")) self.list_ctrl_1 = wx.ListCtrl(self.panel_2, wx.ID_ANY, style=wx.LC_REPORT | wx.LC_ALIGN_LEFT | wx.SUNKEN_BORDER | wx.NO_BORDER) self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, _("Finished")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_passw) self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_user) self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10) self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_previous) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished) # create a pubsub receiver Publisher().subscribe(self.updateDisplay, "update") # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: sampoorna_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Dialog.__init__(self, *args, **kwds) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0) self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY) self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, ("Warning: Always backup your database before you proceed to avoid potential data loss !!!")) self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, ("This software does not save Sampoorna credentials. It is used for one time login")) self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL) self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Username")) self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, ("Sampoorna Password")) self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER) self.button_next = wx.Button(self.panel_login, wx.ID_ANY, ("Next >>")) self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL) self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("8 Standard")) self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("9 Standard")) self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, ("10 Standard")) self.button_previous = wx.Button(self.standard_pane, wx.ID_ANY, ("<<Previous")) self.button_proceed = wx.Button(self.standard_pane, wx.ID_ANY, ("Proceed >>")) self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY) self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY) self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, ("Progress")) self.progresss_total = wx.Gauge(self.panel_2, wx.ID_ANY, range=100) self.label_progress_perc = wx.StaticText(self.panel_2, wx.ID_ANY, ("")) self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, ("Status")) #self.list_ctrl_1 = wx.ListCtrl(self.panel_2, wx.ID_ANY, style=wx.LC_REPORT | wx.LC_ALIGN_LEFT | wx.SUNKEN_BORDER | wx.NO_BORDER) self.text_ctrl_report = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER) self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, ("Abort")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_passw) self.Bind(wx.EVT_TEXT, self.on_user_pass_text, self.text_ctrl_user) self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9) self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10) self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_previous) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished) # create a pubsub receiver Publisher().subscribe(self.update_display, "update") Publisher().subscribe(self.final_report, "report") Publisher().subscribe(self.update_progress_bar, "progress_bar") Publisher().subscribe(self.update_current_class, "change_class") # end wxGlade
def __init__(self, parent, id): wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT) files = os.listdir('.') self.InsertColumn(0, 'Name') self.InsertColumn(1, 'Ext') self.InsertColumn(2, 'Size', wx.LIST_FORMAT_RIGHT) self.InsertColumn(3, 'Modified') self.SetColumnWidth(0, 220) self.SetColumnWidth(1, 70) self.SetColumnWidth(2, 100) self.SetColumnWidth(3, 420) j = 0 for i in files: (name, ext) = os.path.splitext(i) size = os.path.getsize(i) sec = os.path.getmtime(i) self.InsertStringItem(j, "{}{}".format(name, ext)) self.SetStringItem(j, 1, ext) self.SetStringItem(j, 2, str(size) + ' B') self.SetStringItem( j, 3, time.strftime('%Y-%m-%d %H:%M', time.localtime(sec))) if os.path.isdir(i): self.SetItemImage(j, 1) elif 'py' in ext: self.SetItemImage(j, 2) elif 'jpg' in ext: self.SetItemImage(j, 3) elif 'pdf' in ext: self.SetItemImage(j, 4) else: self.SetItemImage(j, 0) if (j % 2) == 0: self.SetItemBackgroundColour(j, 'light blue') j = j + 1