當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.ListItem方法代碼示例

本文整理匯總了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() 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:25,代碼來源:ObjectListView.py

示例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) 
開發者ID:JavaCardOS,項目名稱:pyResMan,代碼行數:34,代碼來源:pyResManDialog.py

示例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) 
開發者ID:JavaCardOS,項目名稱:pyResMan,代碼行數:31,代碼來源:pyResManDialog.py

示例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) 
開發者ID:JavaCardOS,項目名稱:pyResMan,代碼行數:14,代碼來源:pyResManDialog.py

示例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) 
開發者ID:JavaCardOS,項目名稱:pyResMan,代碼行數:29,代碼來源:pyResManDialog.py

示例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 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:10,代碼來源:ListCtrl.py

示例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() 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:34,代碼來源:list_ctrl.py

示例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) 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:30,代碼來源:ObjectListView.py

示例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() 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:29,代碼來源:ObjectListView.py


注:本文中的wx.ListItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。