def createPanel(self): self.panelPlot = wx.Panel(self) self.panelPlot.SetFocus() self.list = ulc.UltimateListCtrl(self.panelPlot, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ulc.ULC_HAS_VARIABLE_ROW_HEIGHT) self.dpi = 100 self.fig = Figure((5.0, 4.0), dpi=self.dpi) self.canvas = FigCanvas(self.panelPlot, -1, self.fig) self.axes = self.fig.add_subplot(111) self.plot_toolbar = NavigationToolbar(self.canvas) self.plot_toolbar.DeleteToolByPos( 8) #delete save, subplot and spacer from tool bar self.plot_toolbar.DeleteToolByPos(7) self.plot_toolbar.DeleteToolByPos(6) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.canvas, 10, wx.LEFT | wx.TOP | wx.GROW) vbox.Add(self.plot_toolbar, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) vbox.Add(self.list, 3, wx.LEFT | wx.TOP | wx.GROW) self.panelPlot.SetSizer(vbox) vbox.Fit(self)
def init_actions(self): self.actions = ulc.UltimateListCtrl( self, size=(300, 150), agwStyle=wx.LC_REPORT | ulc.ULC_HRULES | ulc.ULC_SINGLE_SEL) self.Bind(ulc.EVT_LIST_ITEM_SELECTED, self.action_selected, self.actions) self.Bind(ulc.EVT_LIST_ITEM_DESELECTED, self.action_deselected, self.actions) self.Bind(ulc.EVT_LIST_ITEM_CHECKED, self.item_checked, self.actions) self.action_deselected() self.actions.InsertColumn(0, "Step") self.actions.InsertColumn(1, "Color") self.actions.InsertColumn(2, "Perform Action?") self.actions.SetColumnWidth(2, ulc.ULC_AUTOSIZE_FILL) self.action_checkboxes = [] for i, color in enumerate(self.colors): self.actions.InsertStringItem(i, "%d." % (i + 1)) item = self.actions.GetItem(i, 2) item.SetKind(1) # "a checkbox-like item" item.SetMask(ulc.ULC_MASK_KIND) self.actions.SetItem(item) self.refresh_actions()
def __init__(self, parent, cluster): wx.Panel.__init__(self, parent) self.cluster = cluster #This is required to fix a bug with GenericDirCtrl in this version of wx self.local = wx.Locale(wx.LANGUAGE_ENGLISH) #dict of progress gauges mapping folder names to gauges self.gauges = {} #List Control of base run folder on cluster self.remote_browser = ULC.UltimateListCtrl( self, -1, size=(-1, 300), agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ULC.ULC_AUTO_CHECK_CHILD) self.refresh_remote_btn = wx.Button(self, 10, "Refresh") self.download_btn = wx.Button(self, 20, "Download") self.delete_btn = wx.Button(self, 30, "Delete") #Layout flex = wx.FlexGridSizer(cols=1) flex.Add(self.remote_browser, 0, wx.EXPAND) flex.Add(self.refresh_remote_btn, 0) flex.Add(self.download_btn, 0) flex.Add(self.delete_btn, 0) flex.AddGrowableCol(0) self.Bind(wx.EVT_BUTTON, self.on_refresh, self.refresh_remote_btn) self.Bind(wx.EVT_BUTTON, self.on_download, self.download_btn) self.Bind(wx.EVT_BUTTON, self.on_delete, self.delete_btn) self.Bind(EVT_UPDATE_DOWNLOAD, self.on_update_download) self.SetSizer(flex)
def __init__(self, parent, cluster): wx.Panel.__init__(self, parent) self.cluster = cluster #List Control of base run folder on cluster self.job_browser = ULC.UltimateListCtrl( self, -1, size=(-1, 300), agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ULC.ULC_AUTO_CHECK_CHILD) self.refresh_btn = wx.Button(self, 10, "Refresh") self.kill_btn = wx.Button(self, 30, "Kill") #Layout flex = wx.FlexGridSizer(cols=1) flex.Add(self.job_browser, 0, wx.EXPAND) flex.Add(self.refresh_btn, 0) flex.Add(self.kill_btn, 0) flex.AddGrowableCol(0) self.Bind(wx.EVT_BUTTON, self.on_refresh, self.refresh_btn) self.Bind(wx.EVT_BUTTON, self.on_kill, self.kill_btn) self.Bind(EVT_JOB, self.on_job) self.SetSizer(flex)
def __init__(self, parent): wx.Frame.__init__(self, parent, -1, "UltimateListCtrl Demo") list = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=ULC.ULC_REPORT | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) list.InsertColumn(0, "Column 1") list.InsertColumn(1, "Column 2") index = list.InsertStringItem(sys.maxsize, "Item 1") list.SetStringItem(index, 1, "Sub-item 1") index = list.InsertStringItem(sys.maxsize, "Item 2") list.SetStringItem(index, 1, "Sub-item 2") choice = wx.Choice(list, -1, choices=["one", "two"]) index = list.InsertStringItem(sys.maxsize, "A widget") list.SetItemWindow(index, 1, choice, expand=True) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(list, 1, wx.EXPAND) self.SetSizer(sizer) list.DeleteAllItems() choice = wx.Choice(list, -1, choices=["one", "two"]) index = list.InsertStringItem(sys.maxsize, "Item 2") list.SetStringItem(index, 1, "Sub-item 2") index = list.InsertStringItem(sys.maxsize, "") list.SetItemWindow(index, 0, choice, expand=True)
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((517, 394)) self.window_1_pane_1 = wx.Panel(self, wx.ID_ANY) self.text_ctrl_1 = wx.TextCtrl(self.window_1_pane_1, wx.ID_ANY, "") self.button_1 = wx.Button(self.window_1_pane_1, wx.ID_ANY, "Add label") self.window_1_pane_2 = wx.Panel(self, wx.ID_ANY) # self.list_ctrl_1 = wx.ListCtrl( # self.window_1_pane_2, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_VRULES # ) self.list_ctrl_1 = ULC.UltimateListCtrl( self.window_1_pane_2, wx.ID_ANY, agwStyle=ULC.ULC_REPORT | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT, ) self.list_box_1 = wx.ListBox( self.window_1_pane_2, wx.ID_ANY, choices=["#btc", "crypto", "currency"] ) self.panel_1 = wx.Panel(self, wx.ID_ANY) self.button_2 = wx.Button(self.panel_1, wx.ID_ANY, "Refresh labels") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.insert_label, self.button_1) self.Bind(wx.EVT_LISTBOX_DCLICK, self.remove_label, self.list_box_1) self.Bind(wx.EVT_BUTTON, self.refresh_labels, self.button_2) # self.Bind(wx.EVT_HYPERLINK, self.open_browser, self.list_ctrl_1) self.stream = None
def CreatePackagePanel(self): from wx.lib.agw import ultimatelistctrl as ULC # create the list control l= ULC.UltimateListCtrl(self, -1,agwStyle=wx.LC_ICON | wx.LC_AUTOARRANGE ) # assign the image list to it l.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL) icons=[self.il.setmaker_bmp,self.il.install_bmp, self.il.genimg_bmp,self.il.mse_bmp,self.il.import_bmp] names=[ #"Localisation & Help Files", #"Export Template", #"Include bundles" ##"Template Exporter", "Set Maker", ##"Installer Maker", "Install Template", "Images Maker", "Export Template", 'Import Template', ] for i,name in enumerate(zip(names,icons)): index = l.InsertImageStringItem(i, *name) l.Bind(ULC.EVT_LIST_ITEM_ACTIVATED,self.OnHelpersActivated) #for i,name in enumerate(names): # index = l.InsertImageStringItem(i, name,self.il.textelt) return l
def __init__(self, parent, panel, columnNumToName, runStartString, listDataItems=[]): self.columnNumToName = OrderedDict([(0, '#')] + columnNumToName.items()) self.columnNameToNum = {v: k for k, v in self.columnNumToName.items()} self.runStartString = runStartString self.panel = panel self.runButton = (xrc.XRCCTRL(parent, 'runButton')) self.addButton = (xrc.XRCCTRL(parent, 'addButton')) self.removeButton = (xrc.XRCCTRL(parent, 'removeButton')) self.list = ULC.UltimateListCtrl(self.panel, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | ULC.ULC_SINGLE_SEL) self.panel.GetSizer().Add(self.list, 1, wx.EXPAND|wx.ALL|wx.GROW) for idx, name in self.columnNumToName.items(): columnInfo = ULC.UltimateListItem() columnInfo._mask = wx.LIST_MASK_TEXT columnInfo._text = name self.list.InsertColumnInfo(idx, columnInfo) if len(listDataItems) == 0: listDataItems = [self.getDefaultDataItem(),] self.populateList(listDataItems) self.listUpdate() parent.Bind(wx.EVT_BUTTON, self.onAddButton, id=xrc.XRCID('addButton')) parent.Bind(wx.EVT_BUTTON, self.onRemoveButton, id=xrc.XRCID('removeButton')) parent.Bind(wx.EVT_BUTTON, self.onRunButton, id=xrc.XRCID('runButton')) self.list.Bind(ULC.EVT_LIST_KEY_DOWN, self.onKeyPress)
def CreateFieldsPanel(self): import sys from wx.lib.agw import ultimatelistctrl as ULC # create the list control l= ULC.UltimateListCtrl(self, -1,size=(200,400),agwStyle=wx.LC_ICON | wx.LC_AUTOARRANGE )#|ULC.ULC_HEADER_IN_ALL_VIEWS) # assign the image list to it l.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL) l.AssignImageList(self.il, 0) #~ info = ULC.UltimateListItem() #~ info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT #~ info._format = wx.LIST_FORMAT_CENTER #~ info._text = "Type" #~ l.InsertColumnInfo(0, info) index = l.InsertImageStringItem(0, "Symbols",self.il.symbolelt) index = l.InsertImageStringItem(0, "Info",self.il.infoelt) index = l.InsertImageStringItem(0, "Set",self.il.setelt) index = l.InsertImageStringItem(0, "Color",self.il.colorelt) #index = l.InsertImageStringItem(0, "MChoice",self.il.choiceelt) index = l.InsertImageStringItem(0, "Choice",self.il.choiceelt) index = l.InsertImageStringItem(0, "Image",self.il.imgelt) #index = l.InsertImageStringItem(0, "StaticImage",self.il.imgelt) index = l.InsertImageStringItem(0, "Text",self.il.textelt) l.Bind(ULC.EVT_LIST_ITEM_ACTIVATED,self.OnAddItem) return l
def __init__(self, *args, **kwds): ''' Constructor ''' wx.ScrolledWindow.__init__(self, *args, **kwds) #CONSTANTES self.COLOR_TUITS = wx.Colour(225, 255, 255) #(Rojo, Verde, Azul) #VARIABLES self.cronologia = None self.esDM = False self.primeraVezClickDerecho = False self.controla = None self.visuali = None #self.tCtrlInfoTweet = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER|wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_AUTO_URL) self.listCtrlListaTweets = ULC.UltimateListCtrl( self, -1, agwStyle=ULC.ULC_REPORT | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | ULC.ULC_SEND_LEFTCLICK) self.__set_properties() self.__do_layout() self.listCtrlListaTweets.Bind(wx.EVT_LIST_ITEM_SELECTED, self.casillaSeleccionada) wx.EVT_LIST_ITEM_RIGHT_CLICK(self, self.listCtrlListaTweets.GetId(), self.clicDerechoEstado)
def __init__(self, parent, id): wx.Panel.__init__(self, parent) self.feature_list = ULC.UltimateListCtrl(self, id=3001, agwStyle=ULC.ULC_REPORT|ULC.ULC_SINGLE_SEL) self.feature_list.InsertColumn(0, "Feature", format=wx.LIST_FORMAT_LEFT, width=200) self.feature_list.InsertColumn(1, "Type", format=wx.LIST_FORMAT_LEFT, width=100) self.feature_list.InsertColumn(2, "Location on DNA", format=wx.LIST_FORMAT_LEFT, width=200) self.feature_list.InsertColumn(3, "Strand", format=wx.LIST_FORMAT_LEFT, width=120) font = wx.Font(pointSize=10, family=wx.FONTFAMILY_DEFAULT, style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL, underline=False, faceName='Monospace', encoding=wx.FONTENCODING_DEFAULT) self.feature_list.SetFont(font) self.feature_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.ListOnSelect) self.feature_list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.ListOnActivate) #buttons padding = 10 #how much to add around the picture imageFile = settings.default_dir+"/icon/new_small.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() newfeature = wx.BitmapButton(self, id=1, bitmap=image1, size = (image1.GetWidth()+padding, image1.GetHeight()+padding), name = "share") imageFile = settings.default_dir+"/icon/remove_small.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() deletefeature = wx.BitmapButton(self, id=2, bitmap=image1, size = (image1.GetWidth()+padding, image1.GetHeight()+padding), name = "share") imageFile = settings.default_dir+"/icon/move_up.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() moveup = wx.BitmapButton(self, id=4, bitmap=image1, size = (image1.GetWidth()+padding, image1.GetHeight()+padding), name = "share") imageFile = settings.default_dir+"/icon/move_down.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() movedown = wx.BitmapButton(self, id=5, bitmap=image1, size = (image1.GetWidth()+padding, image1.GetHeight()+padding), name = "share") imageFile = settings.default_dir+"/icon/edit.png" image1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap() edit = wx.BitmapButton(self, id=6, bitmap=image1, size = (image1.GetWidth()+padding, image1.GetHeight()+padding), name = "edit") #bind feature list buttons self.Bind(wx.EVT_BUTTON, self.OnNew, id=1) self.Bind(wx.EVT_BUTTON, self.OnDelete, id=2) self.Bind(wx.EVT_BUTTON, self.OnMoveFeatureUp, id=4) self.Bind(wx.EVT_BUTTON, self.OnMoveFeatureDown, id=5) self.Bind(wx.EVT_BUTTON, self.OnEditFeature, id=6) #arrange buttons vertically sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(item=newfeature) sizer.Add(item=deletefeature) sizer.Add(item=edit) sizer.Add(item=moveup) sizer.Add(item=movedown) #add feature list and buttons horisontally sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.Add(item=sizer, proportion=0, flag=wx.EXPAND) sizer2.Add(item=self.feature_list, proportion=3, flag=wx.EXPAND) self.SetSizer(sizer2)
def build_tags_grid(self): self.tags_grid = ULC.UltimateListCtrl(self, agwStyle=GRID_STYLE) self.tags_grid.SetUserLineHeight(30) self.tags_grid.InsertColumn(0, _('Name'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(0, 115) self.tags_grid.InsertColumn(1, _('Path'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(1, -3)
def InCompleteOrder(self, parent): ##########################未完成订单开始############################### incomplete_order_panel = wx.Panel(parent) incomplete_order_sizer = wx.BoxSizer(wx.VERTICAL) self.btn = GB.GradientButton(incomplete_order_panel, -1, None, u"查询订单") # self.payBtn = GB.GradientButton(incomplete_order_panel, -1, None, u"去12306支付", (80, 5)) self.btn.Bind(wx.EVT_BUTTON, self.toQueryInCompleteOrder) # self.payBtn.Bind(wx.EVT_BUTTON, self.toGo12306Pay) incomplete_order_sizer.Add(self.btn, 0, wx.ALL, 5) # incomplete_order_sizer.Add(self.payBtn, 0, wx.ALL, 5) agwStyle = (ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL) self.orderlist = orderlist = ULC.UltimateListCtrl( incomplete_order_panel, wx.ID_ANY, size=(400, 300), agwStyle=agwStyle) self.orderlist.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.OnColumnDrag) orderlist.InsertColumn(0, u'序号', format=ULC.ULC_FORMAT_CENTER, width=50) orderlist.InsertColumn(1, u'车次信息', format=ULC.ULC_FORMAT_CENTER, width=300) orderlist.InsertColumn(2, u'席位信息', format=ULC.ULC_FORMAT_CENTER, width=150) orderlist.InsertColumn(3, u'旅客信息', format=ULC.ULC_FORMAT_CENTER, width=150) orderlist.InsertColumn(4, u'票款金额', format=ULC.ULC_FORMAT_CENTER, width=100) orderlist.InsertColumn(5, u'车票状态', format=ULC.ULC_FORMAT_CENTER, width=180) incomplete_order_sizer.Add(self.orderlist, 0, wx.ALL | wx.EXPAND, 5) incomplete_order_panel.SetSizer(incomplete_order_sizer) incomplete_order_panel.Layout() self.nb.AddPage(incomplete_order_panel, u"未完成订单")
def build_tags_grid(self): self.tags_grid = ULC.UltimateListCtrl(self, agwStyle=GRID_STYLE) self.tags_grid.SetUserLineHeight(30) self.tags_grid.InsertColumn(0, _('Name'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(0, 115) self.tags_grid.InsertColumn(1, _('Text'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(1, -3) self.tags_grid.InsertColumn(2, _('Finish type'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(2, 130) self.tags_grid.InsertColumn(3, _('Time'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(3, 70)
def __init__(self, translation: Translation, scheduler: Scheduler): """ Create the window. :param translation: The Translation object to use strings from. :param scheduler: The Scheduler to use. """ super(WhatsAppAutomationFrame, self).__init__(parent=None, title=translation.get_main_window_title()) self.translation = translation self.scheduler = scheduler # Set language appropriate layout self.SetLayoutDirection(translation.get_window_layout_style()) self.main_panel = wx.Panel(self) self.main_sizer = wx.BoxSizer(wx.VERTICAL) # Existing messages list self.messages_list = ulc.UltimateListCtrl(self.main_panel, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | ulc.ULC_HAS_VARIABLE_ROW_HEIGHT) self.messages_list.InsertColumn(0, translation.get_contact_column_title(), width=150) self.messages_list.InsertColumn(1, translation.get_date_time_column_title(), width=150) self.messages_list.InsertColumn(2, '', width=80) # Insertion button self.new_message_btn = wx.Button(self.main_panel, label=translation.get_schedule_new_message_button_label()) self.new_message_btn.Bind(wx.EVT_BUTTON, self.on_click) # Capture ENTER key self.new_message_btn.SetDefault() # Arrange on screen self.main_sizer.Add(self.messages_list, 1, wx.ALL | wx.EXPAND) self.main_sizer.Add(self.new_message_btn, 0, wx.CENTER) self.main_panel.SetSizer(self.main_sizer) # Insertion popup self.popup = None self.Show()
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, style=0) self.parent = parent box = wx.BoxSizer(wx.HORIZONTAL) tday = datetime.date.today() items = [str(x) for x in range(2009, 2021)] self.year = wx.ComboBox(self, 500, str(tday.year), (60, 50), (80, -1), items, wx.CB_DROPDOWN | wx.CB_READONLY) items = [str(x) for x in range(1, 13)] self.month = wx.ComboBox(self, 500, str(tday.month), (60, 50), (60, -1), items, wx.CB_DROPDOWN | wx.CB_READONLY) box.Add(wx.StaticText(self, -1, _(' Date: '), (8, 10)), 0, wx.ALIGN_CENTER) # box.Add(self.) box.Add(wx.StaticText(self, -1, _(" Year: "), (8, 10)), 0, wx.ALIGN_CENTER) box.Add(self.year, 0, wx.EXPAND) box.Add(wx.StaticText(self, -1, _(" Month:"), (8, 10)), 0, wx.ALIGN_CENTER) box.Add(self.month, 0, wx.EXPAND) box.Add(wx.StaticText(self, -1, _(" Sum: "), (8, 10)), 0, wx.ALIGN_CENTER) # self.total = wx.TextCtrl(self, -1, size=(100,-1), style=wx.TE_READONLY) self.total = wx.StaticText(self, -1, "", (8, 10), (60, -1)) box.Add(self.total, 0, wx.ALIGN_CENTER) box.Add(wx.StaticText(self, -1, _(" Surplus: "), (8, 10)), 0, wx.ALIGN_CENTER) self.surplus = wx.StaticText(self, -1, "", (8, 10), (60, -1)) box.Add(self.surplus, 0, wx.ALIGN_CENTER) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(box, 0, wx.EXPAND | wx.ALL, border=2) self.fontSize = 12 f = wx.Font(self.fontSize, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.list = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=ULC.ULC_REPORT | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) self.list.SetFont(f) sizer.Add(self.list, 1, wx.EXPAND | wx.ALL) self.SetSizer(sizer) self.SetAutoLayout(True) self.currentItem = None self.Bind(wx.EVT_COMBOBOX, self.OnChooseYear, self.year) self.Bind(wx.EVT_COMBOBOX, self.OnChooseMonth, self.month) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, self.list) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self.list) self.Bind(wx.EVT_CONTEXT_MENU, self.OnPopupMenu) # self.init() self.itemDataMap = {} self.load() listmix.ColumnSorterMixin.__init__(self, self.list.GetColumnCount())
def __init__(self, parent, file_paths): wx.Dialog.__init__(self, parent, -1, size=(700, 350), title='Metadata Links', style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.ultimateList = ULC.UltimateListCtrl( self, agwStyle=ULC.ULC_REPORT | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) meta = ExperimentSettings.getInstance() self.ultimateList.InsertColumn(0, 'Data URL') self.ultimateList.InsertColumn(1, 'Metadata') self.ultimateList.SetColumnWidth(0, 190) self.ultimateList.SetColumnWidth(1, 300) self.data_metadata = DATA_METADATA for data_file_path in file_paths: index = self.ultimateList.InsertStringItem(sys.maxint, data_file_path, self.data_metadata) self.data_metadata[data_file_path] = '' text_ctrl = wx.TextCtrl(self.ultimateList, -1, "", style=wx.TE_READONLY) self.drop_target = MyFileDropTarget(text_ctrl, data_file_path) text_ctrl.SetDropTarget(self.drop_target) self.ultimateList.SetItemWindow(index, 1, wnd=text_ctrl, expand=True) self.ok_btn = wx.Button(self, wx.ID_OK) self.cancel_btn = wx.Button(self, wx.ID_CANCEL) vbox = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(self.ultimateList, 1, wx.EXPAND) hbox2.Add(self.ok_btn, 1) hbox2.AddSpacer((10, -1)) hbox2.Add(self.cancel_btn, 1) vbox.Add(hbox1, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 5) vbox.Add(hbox2, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.SetSizer(vbox) self.Show()
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) try: font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) boldfont = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) except AttributeError: # wxPython 4 / Phoenix updated SystemSettings font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) boldfont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) self.il = ULC.PyImageList(20, 20) self.il.Add(image.task_process.getBitmap()) self.il.Add(image.task_start.getBitmap()) self.il.Add(image.task_waiting.getBitmap()) self.il.Add(image.task_done.getBitmap()) self.ulc = ULC.UltimateListCtrl(self, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES) self.ulc.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.Bind(ULC.EVT_LIST_ITEM_HYPERLINK, self.OnHyperTextClicked, self.ulc) self.Bind(ULC.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.ulc) # 参考资料 # http://xoomer.virgilio.it/infinity77/Phoenix/lib.agw.ultimatelistctrl.UltimateListItem.html#lib.agw.ultimatelistctrl.UltimateListItem # 设置第一列的样式 # 创建一个ULC list item info = ULC.UltimateListItem() # mask可以出现哪些形式的 info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT info._format = ULC.ULC_FORMAT_LEFT info._text = LANG.finished self.ulc.InsertColumnInfo(0, info) info = ULC.UltimateListItem() info._format = ULC.ULC_FORMAT_LEFT info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT | ULC.ULC_MASK_HYPERTEXT self.ulc.InsertColumnInfo(1, info) self.ulc.SetColumnWidth(0, 600) self.ulc.SetColumnWidth(1, 200) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.ulc, 1, flag=wx.EXPAND) self.SetSizer(sizer)
def __init__(self, *args, **kw): wx.Frame.__init__(self, *args, **kw) self.list = ULC.UltimateListCtrl(self, agwStyle=ULC.ULC_REPORT | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) items = [ 'A', 'b', 'a really really long line that if would be nice if it could word-wrap' ] colWidth = 100 self.list.InsertColumn(0, "AA", width=colWidth) for item in items: item = wordwrap(item, colWidth, wx.ClientDC(self)) self.list.InsertStringItem(0, item)
def CreateHelpersPanel(self): from wx.lib.agw import ultimatelistctrl as ULC # create the list control l= ULC.UltimateListCtrl(self, -1,agwStyle=wx.LC_ICON | wx.LC_AUTOARRANGE ) # assign the image list to it l.AssignImageList(self.il, wx.IMAGE_LIST_NORMAL) icons=[self.il.staticelt,self.il.install_bmp] names=[ "StaticImage", "Choice Maker" ] for i,name in enumerate(zip(names,icons)): index = l.InsertImageStringItem(i, *name) l.Bind(ULC.EVT_LIST_ITEM_ACTIVATED,self.OnHelpersActivated) return l
def __init__(self, parent): wx.Panel.__init__(self, parent, style=wx.WANTS_CHARS) self.description_textctrl = wx.TextCtrl( self, style=wx.TE_MULTILINE | wx.TE_READONLY, ) self.cards = cards = get_cards() agwStyle = ( ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL ) self.mylist = mylist = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=agwStyle) mylist.InsertColumn(0, "", format=ULC.ULC_FORMAT_LEFT, width=50) mylist.InsertColumn(1, "Tarea", format=ULC.ULC_FORMAT_LEFT, width=150) mylist.InsertColumn(2, "Clase", format=ULC.ULC_FORMAT_LEFT, width=100) mylist.InsertColumn(3, "Fecha de Entrega", width=130) mylist.InsertColumn(4, "URL", format=ULC.ULC_FORMAT_CENTER, width=120) self.checkboxes = [] self.hyperlinks = {} self.boxes = [] self.itemDataMap = {} self.InitUltimateListCtrl(cards) listmix.ColumnSorterMixin.__init__(self, 5) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self.mylist) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.mylist, 1, wx.EXPAND) subsizer = wx.BoxSizer(wx.HORIZONTAL) sync_button = wx.Button(self, -1, "Sync") sizer.Add(self.description_textctrl, 1, wx.EXPAND) subsizer.Add(sync_button) sizer.Add(subsizer) self.Bind(wx.EVT_CHECKBOX, self.OnChecked) self.Bind(wx.EVT_BUTTON, self.OnGetData, sync_button) self.mylist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_plot, self.mylist) self.SetSizer(sizer)
def build_tags_grid(self): self.tags_grid = ULC.UltimateListCtrl( self, agwStyle=ULC.ULC_REPORT | ULC.ULC_SINGLE_SEL | ULC.ULC_USER_ROW_HEIGHT | ULC.ULC_HRULES | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) self.tags_grid.SetUserLineHeight(30) self.tags_grid.InsertColumn(0, _('Name'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(0, 115) self.tags_grid.InsertColumn(1, _('Path'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(1, 200) self.tags_grid.InsertColumn(2, _('Associated image'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(2, 140) self.tags_grid.InsertColumn(3, _('Images'), ULC.ULC_FORMAT_CENTER) self.tags_grid.SetColumnWidth(3, -3)
def do_layout(self): sizer = wx.GridBagSizer(vgap=5, hgap=5) #self.projects_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_REPORT, size=(200, 300)) self.projects_list = ulc.UltimateListCtrl(self, wx.ID_ANY, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL, size=(200, 300)) self.projects_list.InsertColumn(0, "Проекты", width=200, format=wx.LIST_FORMAT_CENTRE) self.projects_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_project_selected) sizer.Add(self.projects_list, pos=(0, 0)) self.button_add_project = wx.Button(self, wx.ID_ANY, label='Добавить проект') self.button_add_project.Bind(wx.EVT_BUTTON, self.add_project_click) sizer.Add(self.button_add_project, pos=(1, 0), flag=wx.EXPAND) self.project_card = ProjectCard(self) sizer.Add(self.project_card, pos=(0, 1)) buttons_boxsizer = wx.BoxSizer() self.button_delete_project = wx.Button(self, wx.ID_ANY, label='Удалить проект', size=(200, 30)) self.button_delete_project.Bind(wx.EVT_BUTTON, self.delete_project_click) buttons_boxsizer.Add(self.button_delete_project) button_about_license = wx.Button(self, wx.ID_ANY, label='Информация о лицензии') buttons_boxsizer.Add(button_about_license, flag=wx.EXPAND) sizer.Add(buttons_boxsizer, pos=(1, 1)) self.SetSizer(sizer) self.Layout()
def __init__(self, *args, **kw): wx.Frame.__init__(self, *args, **kw) self.list = ULC.UltimateListCtrl(self, agwStyle=ULC.ULC_REPORT | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) self.items = [ 'list', 'list', 'I want to wrap words and content shold be placed in multiple lines for each item as the window is resized' ] colWidth = 200 self.colWidthPad = 5 self.list.InsertColumn(0, "test", width=colWidth) for item in self.items[::-1]: item = wordwrap(item, colWidth - self.colWidthPad, wx.ClientDC(self)) self.list.InsertStringItem(0, item) self.list.Bind(wx.EVT_LIST_COL_DRAGGING, self.onDrag)
def __init__(self, notificationList, showEditorCallback): from mainlogic import _ self.showEditorCallback = showEditorCallback wx.Frame.__init__(self, None, -1, _("Prosafe Notification"), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.CLOSE_BOX) self.panel = wx.Panel(self) self.notificationListCtrl = ULC.UltimateListCtrl( self.panel, wx.ID_ANY, agwStyle=ULC.ULC_REPORT | ULC.ULC_VRULES | ULC.ULC_HRULES | ULC.ULC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | ULC.ULC_BORDER_SELECT) self.notificationListCtrl.InsertColumn(0, _("NOTIFICATION NUMBER")) self.notificationListCtrl.InsertColumn(1, _("NOTIFICATION TITLE")) self.notificationListCtrl.InsertColumn(2, _("NOTIFICATION TEXT")) self.notificationListCtrl.InsertColumn(3, _("NOTIFICATION LINK")) self.index = 0 self.populateItemList(notificationList) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.notificationListCtrl, 4, wx.EXPAND | wx.ALL, 5) separator = wx.StaticLine(self.panel, wx.NewId(), (-1, -1), (-1, 2), wx.LI_HORIZONTAL) sizer.Add(separator, 0, wx.GROW | wx.ALL, 10) buttonSizer = wx.BoxSizer(wx.HORIZONTAL) self.closeButton = wx.Button(self.panel, label=_('Close')) self.closeButton.Bind(wx.EVT_BUTTON, self.closeNotificationViewer) buttonSizer.Add(self.closeButton, 1, wx.RIGHT, 5) sizer.Add(buttonSizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.panel.SetSizer(sizer) self.adjustSize() self.notificationListCtrl.Layout() self.Layout()
def build_list(self): lst = ULC.UltimateListCtrl( self, wx.ID_ANY, agwStyle=wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, lst) lst.InsertColumn(0, "Title") lst.InsertColumn(1, "Rating") lst.InsertColumn(2, "Year") lst.InsertColumn(3, "Genre") lst.InsertColumn(4, "Runtime") lst.InsertColumn(5, "Details") lst.SetColumnWidth(0, 100) lst.SetColumnWidth(1, 50) lst.SetColumnWidth(2, 50) lst.SetColumnWidth(3, 100) lst.SetColumnWidth(4, 100) lst.SetColumnWidth(5, -3) return lst
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.index = 0 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 _create_controls_pane(self): panel = wx.Panel(self, -1, (-1, 500)) bSizer = wx.BoxSizer(wx.VERTICAL) self.isovalue_list = ulc.UltimateListCtrl( panel, agwStyle=wx.LC_REPORT | ulc.ULC_HAS_VARIABLE_ROW_HEIGHT) '''| wx.BORDER_DEFAULT | wx.LC_SINGLE_SEL | wx.LC_EDIT_LABELS | wx.LC_VRULES | wx.LC_HRULES''' self.isovalue_list.InsertColumn(0, 'Visibility', format=ulc.ULC_FORMAT_CENTER, width=90) self.isovalue_list.InsertColumn(1, 'IsoDose (Gy)', format=ulc.ULC_FORMAT_CENTER, width=105) self.isovalue_list.InsertColumn(2, 'Visualize', format=ulc.ULC_FORMAT_CENTER, width=130) self.isovalue_list.InsertColumn(3, 'Active', format=ulc.ULC_FORMAT_CENTER, width=50) bSizer.Add(self.isovalue_list, 1, wx.ALL | wx.EXPAND, 5) self.static_line2 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer.Add(self.static_line2, 0, wx.EXPAND | wx.ALL, 5) panel.SetSizer(bSizer) bSizer.Fit(panel) return panel
def __init__(self, title, parent=None): wx.Frame.__init__(self, parent=parent, title=title, size=(400, 300)) self.SetIcon(wx.Icon(MLR_ICON)) self.list_ctrl = ULC.UltimateListCtrl( self, -1, agwStyle=ULC.ULC_REPORT | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT) self.list_ctrl.InsertColumn(0, 'Process Name') self.list_ctrl.InsertColumn(1, 'Score') self.list_ctrl.SetColumnWidth(0, 150) self.list_ctrl.SetColumnWidth(1, 220) rows = [("N/A", "N/A")] if formattedq.not_empty: formatbuff = formattedq.get() rows = list(formatbuff.items()) for rowIndex, data in enumerate(rows): for colIndex, coldata in enumerate(data): if colIndex == 0: self.list_ctrl.InsertStringItem(rowIndex, coldata) else: self.list_ctrl.SetStringItem(rowIndex, colIndex, str(coldata)) self.list_ctrl.SetItemData(rowIndex, data) self.itemDataMap = {data: data for data in rows} listmix.ColumnSorterMixin.__init__(self, 2) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.list_ctrl, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(box) self.Show(True)
def __init__(self, parent, title): super(MainWin, self).__init__(parent, title=title, size=(700, 400)) self.Bind(wx.EVT_MAXIMIZE, self.on_maximize) self.statusbar = self.CreateStatusBar(1) self.statusbar.SetStatusText('Ready') self.splitter = wx.SplitterWindow(self, -1) panel = wx.Panel(self.splitter) hbox = wx.BoxSizer(wx.HORIZONTAL) self.local_list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT) self.local_list.InsertColumn(0, 'Uploadable', width=20) self.local_list.InsertColumn(1, 'Name', wx.LIST_FORMAT_RIGHT, width=150) self.local_list.InsertColumn(2, '# photos', wx.LIST_FORMAT_RIGHT) self.remote_list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT) self.remote_list.InsertColumn(0, 'Album') self.remote_list.InsertColumn(1, '# photos', wx.LIST_FORMAT_RIGHT) self.to_remote = wx.Button(panel, wx.ID_ANY, '>>') self.to_local = wx.Button(panel, wx.ID_ANY, '<<') self.to_remote.Bind(wx.EVT_BUTTON, self.on_to_remote) middle_vbox = wx.BoxSizer(wx.VERTICAL) middle_vbox.Add(self.to_remote, 0, wx.EXPAND | wx.TOP) middle_vbox.Add(self.to_local, 1, wx.EXPAND) self.local_dir_tree = wx.GenericDirCtrl(panel, style=wx.DIRCTRL_DIR_ONLY) self.local_dir_tree.Bind(wx.EVT_DIRCTRL_SELECTIONCHANGED, self.on_set_local_dir) self.local_dir_tree.SetPath(str(pathlib.Path().home())) left_vbox = wx.BoxSizer(wx.VERTICAL) left_vbox.Add(self.local_dir_tree, 1, wx.EXPAND) left_vbox.Add(self.local_list, 1, wx.EXPAND) self.connect_remote_btn = wx.Button(panel, wx.ID_ANY, 'Connect') self.connect_remote_btn.Bind(wx.EVT_BUTTON, self.on_connect_remote) right_vbox = wx.BoxSizer(wx.VERTICAL) right_vbox.Add(self.connect_remote_btn, 0, wx.EXPAND) right_vbox.Add(self.remote_list, 1, wx.EXPAND) mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT def gen_column_header(name, kind=0, mask=mask): info = ULC.UltimateListItem() info.SetMask(mask) #info._format = 0 info.SetKind(kind) info.SetText(name) return info agw_style = (wx.LC_REPORT | wx.LC_SINGLE_SEL) self.work_queue_list = ULC.UltimateListCtrl(self.splitter, agwStyle=agw_style) self.work_queue_list.InsertColumnInfo(0, gen_column_header("Type")) self.work_queue_list.InsertColumnInfo(1, gen_column_header("Local")) self.work_queue_list.InsertColumnInfo(2, gen_column_header("Direction")) self.work_queue_list.InsertColumnInfo(3, gen_column_header("Remote")) self.work_queue_list.InsertColumnInfo(4, gen_column_header("Progress")) self.work_queue_list.SetColumnWidth(0, 50) self.work_queue_list.SetColumnWidth(1, 200) self.work_queue_list.SetColumnWidth(2, 70) self.work_queue_list.SetColumnWidth(3, 200) self.work_queue_list.SetColumnWidth(4, 100) self.work_thread = threading.Thread(target=self.worker_func) self.work_queue_lock = threading.Lock() hbox.Add(left_vbox, 3, wx.EXPAND) hbox.Add(middle_vbox, 1, wx.CENTER) hbox.Add(right_vbox, 3, wx.EXPAND) panel.SetSizerAndFit(hbox) self.splitter.SetSashGravity(0) self.splitter.SetMinimumPaneSize(100) self.splitter.SplitHorizontally(panel, self.work_queue_list) self.Centre() self.SetIcon(wx.Icon('google-photos.ico')) self.service = None self.Show(True)