本文整理汇总了Python中wx.ListItem方法的典型用法代码示例。如果您正苦于以下问题:Python wx.ListItem方法的具体用法?Python wx.ListItem怎么用?Python wx.ListItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.ListItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddObjects
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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()
示例2: __handleAPDUCommand
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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)
示例3: __handleAPDUResponse
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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)
示例4: __handleLoadScriptItem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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)
示例5: __handleKeyInformationTemplates
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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
示例7: _update_widget_properties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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()
示例8: AddColumnDefn
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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)
示例9: RepopulateList
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ListItem [as 别名]
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()