示例#1
0
    def populateList(self):

        self.appList.ClearAll()

        #Add list columns, currently just name (plus icon) and url
        name = wx.ListItem()
        name.Mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        name.Image = -1
        name.Align = 0
        name.Text = "App Name"
        self.appList.InsertColumn(0, name)

        url = wx.ListItem()
        url.Align = wx.LIST_FORMAT_RIGHT
        url.Text = "Url"
        self.appList.InsertColumn(1, url)

        self.apps = self.getAppList()

        i = 0
        for app in self.apps:
            index = self.appList.InsertItem(self.appList.GetItemCount(), 0)
            self.appList.SetItem(index, 0, app.name)
            self.appList.SetItem(index, 1, app.url)
            self.appList.SetItemData(index, i)
            i += 1

        self.appList.SetColumnWidth(0, 300)
        self.appList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
示例#2
0
 def _Insert(self, index, item, lst=None):
     if lst is None:
         lst = self.lst
     if item is None:
         t, s = '?', '?'
     elif isinstance(item, Structure):
         t, s = item.fourcc, value_preview(item, 200)
     else:
         t, s = type(item).__name__, value_preview(item, 200)
     it = wx.ListItem()
     it.SetColumn(0)
     it.SetId(index)
     it.SetText(str(index))
     lst.InsertItem(it)
     it = wx.ListItem()
     it.SetColumn(1)
     it.SetId(index)
     it.SetText(t)
     lst.SetItem(it)
     it = wx.ListItem()
     it.SetColumn(2)
     it.SetId(index)
     it.SetText(s)
     lst.SetItem(it)
     lst.Select(index)
示例#3
0
    def init_list(self):
        class AutoWidthListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
            def __init__(self, *args, **kwargs):
                wx.ListCtrl.__init__(self, *args, **kwargs)
                ListCtrlAutoWidthMixin.__init__(self)

        self.list = AutoWidthListCtrl(self,
                                      style=wx.LC_REPORT | wx.LC_SINGLE_SEL
                                      | wx.LC_NO_HEADER)
        self.list.setResizeColumn(2)
        self.list.Bind(wx.EVT_SCROLLWIN, self.handle_scroll)
        self.list.Bind(wx.EVT_MOUSEWHEEL, self.handle_scroll)
        self.list.Bind(wx.EVT_MOTION, self.handle_hover)
        self.list.Bind(wx.EVT_LEFT_UP, self.handle_click)

        cover_column = wx.ListItem()
        cover_column.SetMask(wx.LIST_MASK_TEXT)
        cover_column.SetText("Cover")
        cover_column.SetWidth(THUMB_SIZE + 8)
        self.list.InsertColumn(0, cover_column)

        album_column = wx.ListItem()
        album_column.SetMask(wx.LIST_MASK_TEXT)
        album_column.SetText("Album")
        album_column.SetWidth(210)
        self.list.InsertColumn(1, album_column)

        price_column = wx.ListItem()
        price_column.SetMask(wx.LIST_MASK_TEXT)
        price_column.SetAlign(wx.LIST_FORMAT_RIGHT)
        price_column.SetText("Price")
        price_column.SetWidth(70)
        self.list.InsertColumn(2, price_column)

        self.list.setResizeColumn(2)
示例#4
0
    def displayTopicInfo(self, tpath):
        self.resetRightPanel()
        self.peergov.currentAuthorization = None
        for path in self.peergov.authorizations.keys():
            if path in tpath:
                self.peergov.currentAuthorization = self.peergov.authorizations[
                    path]
        with self.manager.authorities_lock:
            authority, topic = self.manager.getTopicByPath(tpath)
            self.currentTopic = topic
            self.currentTopicId = tpath
            voting = self.peergov.voting
            voting.reset()
            if authority and topic:
                with topic.votes_lock:
                    with topic.proposals_lock:
                        self.text.SetPage(self.genTopicHTML(topic))
                        vote = (self.peergov.user in topic.votes
                                ) and topic.votes[self.peergov.user]['vote']

                        if not self.peergov.currentAuthorization:
                            item = wx.ListItem()
                            item.SetData(-1)
                            item.SetText("NO AUTHORIZATION TO VOTE")
                            self.buttonvote.Enable(False)
                            self.buttonadd.Enable(False)
                            self.buttonrem.Enable(False)
                            self.list2.InsertItem(item)
                        else:
                            self.buttonvote.Enable(True)
                            self.buttonadd.Enable(True)
                            self.buttonrem.Enable(True)

                        for i, proposal in enumerate(topic.proposals):
                            item = wx.ListItem()
                            item.SetText(proposal['title'])
                            item.SetData(i)
                            if vote and proposal['id'] in vote:
                                self.list2.InsertItem(item)
                            else:
                                self.list1.InsertItem(item)

                        if vote:
                            self.currentVote = vote
                            self.list2.SortItems(self.listSortVote)

                        for userfpr in topic.votes.keys():
                            #TODO: eliminate invalid choices from ballot
                            #TODO: eliminate duplicate userids from ballot
                            voting.addVote(topic.votes[userfpr]['vote'])

                        self.results.SetPage(
                            self.genResultHTML(voting.getRanks(),
                                               voting.countVotes()))

            else:
                self.resetRightPanel()
示例#5
0
 def remove_item_by_name(self, displayedName):
     ID = self.ItemList.FindItem(0, displayedName)
     item = wx.ListItem()
     item.SetId(ID)
     item.SetBackgroundColour(app.prefs.get(u'backgroundColor'))
     item.SetTextColour(app.prefs.get(u'textColor'))
     self.ItemList.SetItem(item)
示例#6
0
    def __init__(self,
                 parent,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.LC_REPORT
                 | wx.BORDER_NONE
                 | wx.LC_SORT_ASCENDING):
        wx.ListCtrl.__init__(self, parent, -1, pos, size, style)
        listmix.ListCtrlAutoWidthMixin.__init__(self)

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        self.fldridx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.fldropenidx = il.Add(
            wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, isz))
        #        fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))

        self.SetImageList(il, wx.IMAGE_LIST_SMALL)
        # self.InsertColumn(0, 'Bucket Name')

        info = wx.ListItem()
        info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info.m_image = -1
        info.m_format = 0
        info.m_text = 'Bucket Name'
        self.InsertColumnInfo(0, info)

        self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.on_right_clicked)
示例#7
0
    def generateList(self, size=(50, 50)):
        self.clear_instruments()
        info = wx.ListItem()
        info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info.m_image = -1
        info.m_format = 0
        info.m_text = "Generators"
        self.listView.InsertColumn(0, info)
        image_list = wx.ImageList(*size)

        for key, (name, sound) in enumerate(self.instruments.items()):
            self.associationData[key] = sound
            image = image_list.Add(
                wx.Bitmap.FromRGBA(size[0],
                                   size[1],
                                   red=sound.colourRed,
                                   green=sound.colourGreen,
                                   blue=sound.colourBlue,
                                   alpha=sound.colourAlpha))
            item = self.listView.InsertItem(key, name, image)
            self.listView.SetItemData(item, key)
            self.listView.SetItemImage(item, image, wx.TreeItemIcon_Normal)

        self.listView.AssignImageList(image_list, wx.IMAGE_LIST_SMALL)
        self.Layout()
示例#8
0
 def __init__(self, *args, **kw):
     super(myframe, self).__init__(*args, **kw)
     msearch.__init__(self, *args, **kw)
     self.dot = 46
     self.sug_start = 0
     self.back_dot = 0
     self.prev_char = 0
     self.present_char = 32
     self.api_total = 20
     self.api_list = []
     self.sug_list = parser.list_def()
     for i in range(self.api_total):
         self.api_list.append(wx.ListItem())
     for i in range(len(self.sug_list)):
         self.api_list[i].SetText(self.sug_list[i])
     self.Init()
     self.filename = ''
     self.select_dev = ''
     self.W = 0
     self.H = 0
     self.thread1 = 0
     self.word = ""
     self.str1 = ''
     self.show()
     self.sug_list.sort()
     self.sug_list_str = "".join(i + " " for i in self.sug_list)
示例#9
0
 def ModifyItem(self):
     """Modification of an item.
     This function modifies an item or does nothing."""
     names = self.GetSelected()
     item = self.list.GetFirstSelected()
     # for name in names:
     idx = 0
     while idx < len(names):
         name = names[idx]
         dialog = UtilsDialog(self,
                              new=False,
                              data=((name, ) + self.data[name]))
         if dialog.ShowModal() != wx.ID_OK:
             dialog.Destroy()
             return
         result = dialog.result
         if result:
             if result[0] not in ("", None) and result[1] not in ("", None):
                 if result[0] != name:
                     self.list.DeleteItem(item)
                     self.data.pop(name)
                     listItem = wx.ListItem()
                     listItem.SetText(result[0])
                     self.list.InsertItem(listItem)
                 self.data[result[0]] = result[1:]
                 self.data.save()
         idx += 1
         item = self.list.GetNextSelected(item)
     self.DoItemSort(FakeColumnEvent(0))
     self.RefreshUI()
示例#10
0
	def updateInfo(self):
		# Update/Add object. store handle as item data because it must be a 'long'
		objects = self.busItf.getObjects(self.objDesc)
		for obj in objects:
			itemId = self.lstObjs.FindItemData(-1, obj.handle)
			if itemId < 0:
				# Add a new item, filling only column 0 with handle
				itemId = self.lstObjs.GetItemCount()
				listItem = wx.ListItem()
				listItem.SetId(itemId)
				listItem.SetText(str(obj.handle))
				listItem.SetData(obj.handle)
				self.lstObjs.InsertItem(listItem)
			listItem = self.lstObjs.GetItem(itemId)
			# Fill other columns with fields
			idx = 1
			for fieldDesc in self.objDesc.structDesc.fieldsDesc.values():
				listItem.SetColumn(idx)
				listItem.SetText(str(obj.struct.getField(fieldDesc)))
				self.lstObjs.SetItem(listItem)
				idx += 1
		# Remove objects from list
		handles = [obj.handle for obj in objects]
		itemId = 0
		while itemId < self.lstObjs.GetItemCount():
			listItem = self.lstObjs.GetItem(itemId)
			if listItem.GetData() not in handles:
				self.lstObjs.DeleteItem(itemId)
			else:
				itemId += 1
		utils.listCtrl_AdjustColumns(self.lstObjs)
		self._sort(self.sortedColumn, self.sortAscending)
    def PopulateList(self):
        if True:
            # for normal, simple columns, you can add them like this:
            self.list.InsertColumn(0, _("Source URL"))
            self.list.InsertColumn(1, _("Mount point"), wx.LIST_FORMAT_RIGHT)
            #self.list.InsertColumn(2, "Status")
        else:
            # but since we want images on the column header we have to do it the hard way:
            info = wx.ListItem()
            info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
            info.m_image = -1
            info.m_format = 0
            info.m_text = _("Source URL")
            self.list.InsertColumnInfo(0, info)

            info.m_format = wx.LIST_FORMAT_RIGHT
            info.m_text = _("Mountpoint")
            self.list.InsertColumnInfo(1, info)

        items = mountDict().items()
        for key, data in items:
            #index = self.list.InsertImageStringItem(sys.maxint, data[0], self.idx1)
            index = self.list.InsertStringItem(sys.maxint, data[0])
            self.list.SetStringItem(index, 1, data[1])
            #self.list.SetStringItem(index, 2, data[2])
            self.list.SetItemData(index, key)

        self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
        self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE)
	def PopulateList(self, data=None):
		self.logger.debug('PopulateList... ')
		self.currentItem = 0
		self.list.ClearAll()
		if data is None:
			data = self.resultsActive
		info = wx.ListItem()
		info.Mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT
		col = 0
		for header in self.headersActive:
			info.Align = wx.LIST_FORMAT_LEFT
			info.Text = header
			self.list.InsertColumn(col, info)
			col += 1
		items = data.items()
		for key,data in items:
			if len(data) <= 0:
				continue
			index = self.list.InsertItem(self.list.GetItemCount(), data[0])
			for x in range(len(self.headersActive)-1):
				self.list.SetItem(index, x+1, str(data[x+1]))
			self.list.SetItemData(index, key)
		col = 0
		for header in self.headersActive:
			self.list.SetColumnWidth(col, wx.LIST_AUTOSIZE)
			col += 1
		self.list.Fit()
示例#13
0
    def PopulateList(self, data=None):
        self.logger.debug('PopulateList... ')
        self.currentItem = 0
        self.list.ClearAll()
        info = wx.ListItem()
        info.Mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT
        col = 0
        for header in self.headers:
            info.Align = wx.LIST_FORMAT_LEFT
            info.Text = header
            self.list.InsertColumn(col, info)
            col += 1

        self.logger.debug('inside PopulateList: data: {}'.format(
            self.accounts))
        self.logger.debug('inside PopulateList: count: {}'.format(
            self.list.GetItemCount()))
        for key, data in self.accounts.items():
            self.logger.debug('inside PopulateList: {} --> {}'.format(
                key, data))
            index = self.list.InsertItem(self.list.GetItemCount(),
                                         str(data[0]))
            for x in range(len(self.headers) - 1):
                self.list.SetItem(index, x + 1, str(data[x + 1]))
            self.list.SetItemData(index, key)
        col = 0
        for header in self.headers:
            if col in [2, 3, 4, 5]:
                self.list.SetColumnWidth(col, 60)
            else:
                self.list.SetColumnWidth(col, wx.LIST_AUTOSIZE)
            col += 1
        self.currentItemId = None
        if self.accounts is not None and len(self.accounts) > 0:
            self.currentItemId = self.getColumnText(self.currentItem, 0)
示例#14
0
    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()
示例#15
0
	def PopulateList(self):
		self.logger.debug('PopulateList... ')
		self.list.ClearAll()
		info = wx.ListItem()
		info.Mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT
		col = 0
		## Insert the headers
		for header in self.headers:
			info.Align = wx.LIST_FORMAT_LEFT
			info.Text = header
			self.list.InsertColumn(col, info)
			col += 1
		## Now insert the jobs
		for key,value in self.jobView.items():
			index = self.list.InsertItem(self.list.GetItemCount(), str(value[0]))
			for x in range(len(self.headers)-1):
				self.list.SetItem(index, x+1, str(value[x+1]))
			self.list.SetItemData(index, key)
		col = 0
		## Set column widths
		for header in self.headers:
			if col == 3:
				self.list.SetColumnWidth(col, 50)
			else:
				self.list.SetColumnWidth(col, wx.LIST_AUTOSIZE)
			col += 1
		self.currentItemId = None
		self.currentItem = 0
		self.logger.debug('PopulateList... data: {}'.format(self.jobView))
		if self.jobView is not None and len(self.jobView) > 0:
			self.logger.debug('               self.currentItem: {}'.format(self.currentItem))
			self.currentItemId = self.getColumnText(self.currentItem, 0)
		#self.list.FitInside()
		self.list.Fit()
示例#16
0
    def CloseEditor(self, evt=None):
        ''' Close the editor and save the new value to the ListCtrl. '''
        if not self.editor.IsShown():
            return
        text = self.editor.GetValue()
        self.editor.Hide()
        self.SetFocus()

        # post wxEVT_COMMAND_LIST_END_LABEL_EDIT
        # Event can be vetoed. It doesn't has SetEditCanceled(), what would
        # require passing extra argument to CloseEditor()
        evt = wx.ListEvent(wx.wxEVT_COMMAND_LIST_END_LABEL_EDIT, self.GetId())
        evt.Index = self.curRow
        evt.Column = self.curCol
        item = wx.ListItem(self.GetItem(self.curRow, self.curCol))
        item.SetText(text)
        evt.SetItem(item)

        ret = self.GetEventHandler().ProcessEvent(evt)
        if not ret or evt.IsAllowed():
            if self.IsVirtual():
                # replace by whatever you use to populate the virtual ListCtrl
                # data source
                self.SetVirtualData(self.curRow, self.curCol, text)
            else:
                self.SetItem(self.curRow, self.curCol, text)
        self.RefreshItem(self.curRow)
示例#17
0
    def test_listctrlEvent(self):
        # check creating a ListEvent, and if the properties are working
        evt = wx.ListEvent(wx.wxEVT_COMMAND_LIST_ITEM_SELECTED, 123)

        evt.KeyCode = 111
        assert evt.GetKeyCode() == 111

        evt.Index = 222
        assert evt.GetIndex() == 222

        evt.Column = 3
        assert evt.GetColumn() == 3

        evt.Point = (44, 55)
        assert evt.GetPoint() == (44, 55)

        i = wx.ListItem()
        i.SetId(66)
        evt.Item = i
        assert evt.GetItem().GetId() == 66

        evt.CacheFrom = 77
        assert evt.GetCacheFrom() == 77

        evt.CacheTo = 88
        assert evt.GetCacheTo() == 88
示例#18
0
 def GetColumn(self, col):
     info = wx.ListItem()
     info.SetText(self.getCol(col).heading)
     info.SetWidth(self.getCol(col).width)
     info.SetAlign(self.getCol(col).format)
     info.SetColumn(col)
     return info
示例#19
0
    def populateList(self):
        info = wx.ListItem()
        info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
        info.m_image = -1
        info.m_format = wx.LIST_FORMAT_CENTRE

        for i in list(range(len(self.headers))):
            info.m_text = self.headers[i]
            self.InsertColumn(i, self.headers[i])

        items = list(self.itemDataMap.items())
        for i in list(range(len(items))):
            key, data = items[i]
            self.InsertItem(i, data[0])
            for j in list(range(1, len(self.headers))):
                self.SetItem(i, j, data[j])
            self.SetItemData(i, key)

        # dirty hack... wxWidgets needs a wx.LIST_AUTOSIZE_* that
        # chooses the maximum of BOTH header size and list item size
        for i in list(range(len(self.headers) - 1)):
            self.SetColumnWidth(i, wx.LIST_AUTOSIZE)
            itemWidth = self.GetColumnWidth(i)
            self.SetColumnWidth(i, wx.LIST_AUTOSIZE_USEHEADER)
            headerWidth = self.GetColumnWidth(i)
            if headerWidth < itemWidth:
                self.SetColumnWidth(i, wx.LIST_AUTOSIZE)
示例#20
0
 def UpdateHeaders(self, headers=None):
     data = self.list.data
     data.update_headers(headers)
     for col, header in enumerate(data.get_headers()):
         item = wx.ListItem()
         item.SetText(header)
         self.list.SetColumn(col, item)
示例#21
0
    def __init__(self, parent, client, proto, key):
        self.client = client
        self.proto = proto
        self.key = key
        self.current_parent = parent
        self.panel = wx.Panel(parent)
        self.list = wx.ListCtrl(
            parent=self.panel, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL
        )
        self.ok_button = wx.Button(parent=self.panel, label="Ok")

        self.list.InsertColumn(0, "")
        for ind, i in enumerate(proto.items):
            li = wx.ListItem()
            li.SetText(i.label)
            li.SetId(ind)
            self.list.InsertItem(li)

        self.ok_button.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_ANY)
        self.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_list_click, id=wx.ID_ANY)

        if proto.can_cancel:
            self.cancel_button = wx.Button(parent=self.panel, label="Cancel")
            self.cancel_button.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_ANY)
            # and allow for escape in the list.
            self.list.Bind(wx.EVT_KEY_DOWN, self.on_list_key, id=wx.ID_ANY)

        if len(proto.items):
            self.list.Select(0)
            self.list.Focus(0)
示例#22
0
    def Populate(self):

        # populate list
        items = self.__decode_xdt()
        for item_idx in range(len(items), 0, -1):
            data = items[item_idx]
            idx = self.list.InsertItem(info=wx.ListItem())
            self.list.SetStringItem(index=idx, col=0, label=data[0])
            self.list.SetStringItem(index=idx, col=1, label=data[1])
            #self.list.SetItemData(item_idx, item_idx)

        # reaspect
        self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
        self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE)

        # show how to select an item
        #self.list.SetItemState(5, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)

        # show how to change the colour of a couple items
        #item = self.list.GetItem(1)
        #item.SetTextColour(wx.BLUE)
        #self.list.SetItem(item)
        #item = self.list.GetItem(4)
        #item.SetTextColour(wxRED)
        #self.list.SetItem(item)

        self.currentItem = 0
 def set_subitem_image(self, index, column, image_number):
     item = wx.ListItem()
     item.Mask = wx.LIST_MASK_IMAGE
     item.Image = image_number
     item.Id = index
     item.Column = column
     self.list_ctrl.SetItem(item)
示例#24
0
    def _createCols(self):
        """Creates columns in list"""
        if 0:
            # normal, simple columns
            for col in enumerate(self.colsData):
                iLabel = self.dataTypes["colLabel"]
                self.InsertColumn(col[0], col[1][iLabel])
        else:
            # the hard way: we want images on the column header
            info = wx.ListItem()
            info.SetMask(
                wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT)
            info.SetImage(-1)
            if globalvar.wxPythonPhoenix:
                info.Format = wx.LIST_FORMAT_LEFT
            else:
                info.m_format = wx.LIST_FORMAT_LEFT

            for col in enumerate(self.colsData):
                iLabel = self.dataTypes["colLabel"]
                info.SetText(col[1][iLabel])
                if globalvar.wxPythonPhoenix:
                    self.InsertColumn(col[0], info)
                else:
                    self.InsertColumnInfo(col[0], info)
示例#25
0
    def __init__(self, parent):
        wx.ListView.__init__(self, parent)

        self.InsertColumn(0, "Location")

        item = wx.ListItem()
        item.SetText("foo")
        self.InsertItem(item)
示例#26
0
 def _FixIndices(self, last_good=-1):
     lst = self.lst
     for i in xrange(last_good + 1, lst.ItemCount):
         it = wx.ListItem()
         it.SetColumn(0)
         it.SetId(i)
         it.SetText(str(i))
         lst.SetItem(it)
 def setSerialStatus(self, serial, status):
     row = self.lc.FindItem(-1, serial)
     item = wx.ListItem()
     item.SetId(row)
     item.SetColumn(1)
     item.SetMask(wx.LIST_MASK_TEXT)
     item.SetText(status)
     self.lc.SetItem(item)
示例#28
0
    def init_list(self):
    	self.col0 = wx.ListItem()
	self.col0.SetId(0)
	self.col0.SetText("Address")
	self.col0.SetWidth(100)
	self.list_ctrl_1.InsertColumn(0, "col0")
	self.list_ctrl_1.InsertStringItem(0, "Test")
	self.list_ctrl_1.InsertStringItem(0, "Test2")
示例#29
0
    def insert_item(self, item):

        itm = wx.ListItem()
        itm.SetText(item.file)
        itm.SetId(self.maxitem)

        self.items.append(item)
        self.InsertItem(itm)
示例#30
0
    def PopulateList(self):
        if 0:
            # for normal, simple columns, you can add them like this:
            self.list.InsertColumn(0, "Command")
            self.list.InsertColumn(1, "Binding", wx.LIST_FORMAT_RIGHT)
            self.list.InsertColumn(2, "Category")
        else:
            # but since we want images on the column header we have to do it the hard way:
            info = wx.ListItem()
            info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_FORMAT
            info.m_image = 1
            info.m_format = 0
            info.m_text = "Command"
            self.list.InsertColumn(0, info)

            info.m_format = wx.LIST_FORMAT_RIGHT
            info.m_text = "Binding"
            self.list.InsertColumn(1, info)

            info.m_format = 0
            info.m_text = "Category"
            self.list.InsertColumn(2, info)

        items = musicdata.items()
        path = os.path.abspath(__file__)
        tail = None
        while tail != 'src':
            path = os.path.abspath(os.path.join(path, '..'))
            head, tail = os.path.split(path)

        imageLocation = os.path.join(path, "images")
        count = 0
        for key, data in items:
            image = wx.Image(os.path.join(imageLocation, data[3]),
                             wx.BITMAP_TYPE_PNG).ConvertToBitmap()
            index = self.list.InsertItem(count, data[0], self.il.Add(image))
            self.list.SetItem(index, 1, data[1])
            self.list.SetItem(index, 2, data[2])
            self.list.SetItemData(index, key)
            count += 1

        self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
        self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE)
        self.list.SetColumnWidth(2, 100)

        # show how to select an item
        self.list.SetItemState(5, wx.LIST_STATE_SELECTED,
                               wx.LIST_STATE_SELECTED)

        # show how to change the colour of a couple items
        item = self.list.GetItem(1)
        item.SetTextColour(wx.BLUE)
        self.list.SetItem(item)
        item = self.list.GetItem(4)
        item.SetTextColour(wx.RED)
        self.list.SetItem(item)

        self.currentItem = 0