Python wx.ListItem() Examples
The following are 9
code examples of wx.ListItem().
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: ObjectListView.py From bookhub with MIT License | 6 votes |
def AddObjects(self, modelObjects): """ Add the given collections of objects to our collection of objects. The objects will appear at their sorted locations, or at the end of the list if the list is unsorted """ if len(self.innerList) == 0: return self.SetObjects(modelObjects) try: self.Freeze() originalSize = len(self.innerList) self.modelObjects.extend(modelObjects) self._BuildInnerList() item = wx.ListItem() item.SetColumn(0) for (i, x) in enumerate(self.innerList[originalSize:]): item.Clear() self._InsertUpdateItem(item, originalSize+i, x, True) self._SortItemsNow() finally: self.Thaw()
Example #2
Source File: pyResManDialog.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def __handleAPDUCommand(self, commandStr, args): theListCtrl = args[0] itemIndex = 0 if len(args) > 1: itemIndex = args[1] indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' % (itemIndex)) theListCtrl.SetItem(indexItem) else: itemIndex = theListCtrl.GetItemCount() indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('> %d' % (itemIndex)) theListCtrl.InsertItem(indexItem) commandItem = ListItem() commandItem.SetId(itemIndex) commandItem.SetColumn(1) commandItem.SetText(commandStr) theListCtrl.SetItem(commandItem) datetimeItem = ListItem() datetimeItem.SetId(itemIndex) datetimeItem.SetColumn(4) datetimeItem.SetText(datetime.now().strftime("%c")) theListCtrl.SetItem(datetimeItem) theListCtrl.EnsureVisible(itemIndex)
Example #3
Source File: pyResManDialog.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def __handleAPDUResponse(self, responseStr, transtime, args): theListCtrl = args[0] itemIndex = 0 if len(args) > 1: itemIndex = args[1] else: itemIndex = theListCtrl.GetItemCount() - 1 responseItem = ListItem() responseItem.SetId(itemIndex) responseItem.SetColumn(2) responseItem.SetText(responseStr) theListCtrl.SetItem(responseItem) timeItem = ListItem() timeItem.SetId(itemIndex) timeItem.SetColumn(3) timeItem.SetText(Util.getTimeStr(transtime)) theListCtrl.SetItem(timeItem) indexItem = ListItem() indexItem.SetId(itemIndex) indexItem.SetColumn(0) indexItem.SetText('%d' % (itemIndex)) theListCtrl.SetItem(indexItem) theListCtrl.Refresh() theListCtrl.EnsureVisible(itemIndex)
Example #4
Source File: pyResManDialog.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def __handleLoadScriptItem(self, scriptItemStr): itemIndex = self._listctrlScriptList.GetItemCount() scriptItem = ListItem() scriptItem.SetId(itemIndex) scriptItem.SetColumn(0) scriptItem.SetText('%d' % (itemIndex)) self._listctrlScriptList.InsertItem(scriptItem) scriptItem.SetId(itemIndex) scriptItem.SetColumn(1) scriptItem.SetText(scriptItemStr) self._listctrlScriptList.SetItem(scriptItem)
Example #5
Source File: pyResManDialog.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def __handleKeyInformationTemplates(self, kits): self._listctrlKeyData.DeleteAllItems() kitsLen = len(kits) kitsCount = kitsLen / 4 for i in xrange(kitsCount): keySetVersion = ord(kits[i * 4 + 0]) keyIndex = ord(kits[i * 4 + 1]) keyType = ord(kits[i * 4 + 2]) keyLength = ord(kits[i * 4 + 3]) i = self._listctrlKeyData.GetItemCount() keyItem = ListItem() keyItem.SetId(i) keyItem.SetColumn(0) keyItem.SetText("%d" % (i)) self._listctrlKeyData.InsertItem(keyItem) keyItem.SetColumn(1) keyItem.SetText("%02X" % (keySetVersion)) self._listctrlKeyData.SetItem(keyItem) keyItem.SetColumn(2) keyItem.SetText("%02X" % (keyIndex)) self._listctrlKeyData.SetItem(keyItem) keyItem.SetColumn(3) keyItem.SetText("%02X" % (keyType)) self._listctrlKeyData.SetItem(keyItem) keyItem.SetColumn(4) keyItem.SetText("%02X" % (keyLength)) self._listctrlKeyData.SetItem(keyItem)
Example #6
Source File: ListCtrl.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, text, sample_data, renderer=None, comparator=None, enabled=True, width=50): wx.ListItem.__init__(self) self.SetText(text) self.renderer = renderer self.comparator = comparator self.enabled = enabled self.sample_data = sample_data self.width = width
Example #7
Source File: list_ctrl.py From wxGlade with MIT License | 5 votes |
def _update_widget_properties(self, modified=None): # after initial creation, call with modified=None if not self.widget: return if self.style & wx.LC_REPORT: # columns and rows ############################################################################################# if not modified or "columns" in modified or "style" in modified: columns = self.columns # adjust number of columns while self.widget.GetColumnCount()>len(columns): self.widget.DeleteColumn(self.widget.GetColumnCount()-1) while self.widget.GetColumnCount()<len(columns): i = self.widget.GetColumnCount() self.widget.InsertColumn(i, columns[i][0]) # set column widths and labels for i, (label,size) in enumerate(columns): item = wx.ListItem() item.SetText(label) self.widget.SetColumn(i, item) size = int(size or "0") if size>0: # results with LIST_AUTOSIZE are not too good self.widget.SetColumnWidth(i, size) if not modified or "rows_number" in modified or "style" in modified: self.widget.DeleteAllItems() if self.columns: for i in range(self.rows_number): compat.ListCtrl_InsertStringItem(self.widget, i, "") self._set_name() self.widget.Refresh()
Example #8
Source File: ObjectListView.py From bookhub with MIT License | 5 votes |
def AddColumnDefn(self, defn): """ Append the given ColumnDefn object to our list of active columns. If this method is called directly, you must also call RepopulateList() to populate the new column with data. """ self.columns.append(defn) info = wx.ListItem() info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT if isinstance(defn.headerImage, basestring) and self.smallImageList is not None: info.m_image = self.smallImageList.GetImageIndex(defn.headerImage) else: info.m_image = defn.headerImage if info.m_image != -1: info.m_mask = info.m_mask | wx.LIST_MASK_IMAGE info.m_format = defn.GetAlignment() info.m_text = defn.title info.m_width = defn.width self.InsertColumnInfo(len(self.columns)-1, info) # Under Linux, the width doesn't take effect without this call self.SetColumnWidth(len(self.columns)-1, defn.width) # The first checkbox column becomes the check state column for the control if defn.HasCheckState() and self.checkStateColumn is None: self.InstallCheckStateColumn(defn)
Example #9
Source File: ObjectListView.py From bookhub with MIT License | 5 votes |
def RepopulateList(self): """ Completely rebuild the contents of the list control """ self._SortObjects() self._BuildInnerList() self.Freeze() try: wx.ListCtrl.DeleteAllItems(self) if len(self.innerList) == 0 or len(self.columns) == 0: self.Refresh() self.stEmptyListMsg.Show() return self.stEmptyListMsg.Hide() # Insert all the rows item = wx.ListItem() item.SetColumn(0) for (i, x) in enumerate(self.innerList): item.Clear() self._InsertUpdateItem(item, i, x, True) # Auto-resize once all the data has been added self.AutoSizeColumns() finally: self.Thaw()