コード例 #1
0
    def __init__(self, parent, log):
        wx.ListCtrl.__init__(self,
                             parent,
                             -1,
                             style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES
                             | wx.LC_VRULES)

        self.log = log

        self.il = wx.ImageList(16, 16)
        self.idx1 = self.il.Add(images.Smiles.GetBitmap())
        empty = self.makeBlank()
        self.idx2 = self.il.Add(empty)
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.InsertColumn(0, "First")
        self.InsertColumn(1, "Second")
        self.InsertColumn(2, "Third")
        self.SetColumnWidth(0, 175)
        self.SetColumnWidth(1, 175)
        self.SetColumnWidth(2, 175)

        self.SetItemCount(1000000)

        self.attr1 = wx.ItemAttr()
        self.attr1.SetBackgroundColour("yellow")

        self.attr2 = wx.ItemAttr()
        self.attr2.SetBackgroundColour("light blue")

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
コード例 #2
0
ファイル: locolist.py プロジェクト: jbernardis/mycmri
	def __init__(self, parent):
		self.parent = parent
		
		wx.ListCtrl.__init__(
			self, parent, wx.ID_ANY, size=(240, 280),
			style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL
			)
		
		font = wx.Font(wx.Font(12, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.NORMAL, faceName="Arial"))
		self.SetFont(font)


		self.InsertColumn(0, "Loco")
		self.InsertColumn(1, "Speed")
		self.InsertColumn(2, "Dir")
		self.SetColumnWidth(0, 80)
		self.SetColumnWidth(1, 80)
		self.SetColumnWidth(2, 80)

		self.SetItemCount(0)
		self.locos = []

		self.normalA = wx.ItemAttr()
		self.normalB = wx.ItemAttr()
		self.normalA.SetBackgroundColour(wx.Colour(225, 255, 240))
		self.normalB.SetBackgroundColour(wx.Colour(138, 255, 197))
コード例 #3
0
    def __init__(self, parent, image_size, viewer):
        """ Creates a new table viewer.

        'parent' is the toolkit-specific control that is the table's parent.

        'image_size' is a tuple in the form (int width, int height) that
        specifies the size of the icons (if any) displayed in the table.

        """

        # The vierer that we are providing the control for.
        self._viewer = viewer

        # Base-class constructor.
        wx.ListCtrl.__init__(self, parent, -1, style=self.STYLE)

        # Table item images.
        self._image_list = ImageList(image_size[0], image_size[1])
        self.AssignImageList(self._image_list, wx.IMAGE_LIST_SMALL)

        # Set up attributes to show alternate rows with a different background
        # colour.
        self._even_row_attribute = wx.ItemAttr()
        self._even_row_attribute.SetBackgroundColour(
            self._viewer.even_row_background)

        self._odd_row_attribute = wx.ItemAttr()
        self._odd_row_attribute.SetBackgroundColour(
            self._viewer.odd_row_background)

        return
コード例 #4
0
    def __init__(self, parent, gcode, images):

        f = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL)
        dc = wx.ScreenDC()
        dc.SetFont(f)
        self.gcode = gcode
        fontHeight = dc.GetTextExtent("Xy")[1]

        self.useLineNumbers = False

        colWidths = [300]
        colTitles = [""]

        totwidth = 20
        for w in colWidths:
            totwidth += w

        wx.ListCtrl.__init__(self,
                             parent,
                             wx.ID_ANY,
                             size=(totwidth, fontHeight * 40),
                             style=wx.LC_REPORT | wx.LC_VIRTUAL
                             | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER)

        self.parent = parent
        self.selectedItem = None
        self.bracketStart = None
        self.bracketEnd = None
        self.selectedExists = False

        self.attrEven = wx.ItemAttr()
        self.attrEven.SetBackgroundColour(wx.Colour(255, 255, 255))

        self.attrOdd = wx.ItemAttr()
        self.attrOdd.SetBackgroundColour(wx.Colour(220, 220, 220))

        self.il = wx.ImageList(16, 16)
        self.il.Add(images.pngEmpty)
        self.il.Add(images.pngSelected)
        self.il.Add(images.pngBrstart)
        self.il.Add(images.pngBrstartsel)
        self.il.Add(images.pngBrstartend)
        self.il.Add(images.pngBrstartendsel)
        self.il.Add(images.pngBrend)
        self.il.Add(images.pngBrendsel)
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.SetFont(f)
        for i in range(len(colWidths)):
            self.InsertColumn(i, colTitles[i])
            self.SetColumnWidth(i, colWidths[i])

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.doListSelect)
        self.startLine = 0
        self.endLine = None
        self.SetItemCount(0)
コード例 #5
0
ファイル: dfgui.py プロジェクト: soonyenju/jams_python
    def __init__(self, parent, df, status_bar_callback):
        wx.ListCtrl.__init__(self,
                             parent,
                             -1,
                             style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES
                             | wx.LC_VRULES | wx.LB_MULTIPLE)
        self.status_bar_callback = status_bar_callback

        self.df_orig = df
        self.original_columns = self.df_orig.columns[:]
        self.current_columns = self.df_orig.columns[:]

        self.sort_by_column = None

        self._reset_mask()

        # prepare attribute for alternating colors of rows
        # self.attr_light_blue = wx.ListItemAttr()
        self.attr_light_blue = wx.ItemAttr()
        self.attr_light_blue.SetBackgroundColour("#D6EBFF")

        self.Bind(wx.EVT_LIST_COL_CLICK, self._on_col_click)
        self.Bind(wx.EVT_RIGHT_DOWN, self._on_right_click)

        self.df = pd.DataFrame({})  # init empty to force initial update
        self._update_rows()
        self._update_columns(self.original_columns)
コード例 #6
0
 def _create_link_attribute(self):
     if wx.VERSION < (4, 1, 0):
         attr = wx.ListItemAttr()
     else:
         attr = wx.ItemAttr()
     attr.SetTextColour(wx.BLUE)
     attr.SetFont(Font().underlined)
     return attr
コード例 #7
0
ファイル: labeldlg.py プロジェクト: jbernardis/panel
    def __init__(self, parent, bmps, labels):

        f = wx.Font(12, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL)
        dc = wx.ScreenDC()
        dc.SetFont(f)
        fontHeight = dc.GetTextExtent("Xy")[1]

        colWidths = [240, 80, 80, 80, 80]
        colTitles = ["Text", "Column", "X Adj", "Row", "Y Adj"]

        totwidth = 20
        for w in colWidths:
            totwidth += w

        wx.ListCtrl.__init__(self,
                             parent,
                             wx.ID_ANY,
                             size=(totwidth, fontHeight * (VISIBLELABELS + 1)),
                             style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES
                             | wx.LC_VRULES | wx.LC_SINGLE_SEL)

        self.parent = parent
        self.bmps = bmps
        self.labels = labels

        self.selectedItem = None
        self.il = wx.ImageList(16, 16)
        self.il.Add(self.bmps.selected)
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.attr1 = wx.ItemAttr()
        self.attr1.SetBackgroundColour(wx.Colour(218, 238, 193))

        self.attr2 = wx.ItemAttr()
        self.attr2.SetBackgroundColour(wx.Colour(187, 203, 158))

        self.SetFont(f)
        for i in range(len(colWidths)):
            self.InsertColumn(i, colTitles[i])
            self.SetColumnWidth(i, colWidths[i])

        self.SetItemCount(len(self.labels))

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.doListSelect)
        self.parent.setSelected(False, None, None)
コード例 #8
0
ファイル: FileListFrame.py プロジェクト: hercule115/OSVM
    def __init__(self, parent, hdrLabels, dataDict):

        wx.ListCtrl.__init__( self, parent, wx.ID_ANY, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES)
        ListCtrlAutoWidthMixin.__init__(self)

        self.parent = parent

        self.EnableAlternateRowColours(enable=True)
        self.EnableCheckBoxes(enable=True)
        
        # Adding some attributes (colourful background for each item rows)
        self.attrs = dict()
        attr0 = wx.ItemAttr()
        attr0.SetBackgroundColour("white")
        self.attrs[0] = attr0

        attr1 = wx.ItemAttr()
        attr1.SetBackgroundColour("light blue")
        self.attrs[1] = attr1

        # Add images
        self.il = wx.ImageList(16, 16)
        self.idx0 = self.il.Add(wx.Bitmap(os.path.join(globs.imgDir,'blue_camera.png')))
        self.idx1 = self.il.Add(wx.Bitmap(os.path.join(globs.imgDir,'video.png')))
        #self.idx2 = self.il.Add(self.makeBlank())
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        # Building the columns. Each entry is: (Column Name, Column Width)
        idx = 0
        for c in hdrLabels:
            self.InsertColumn(idx, c[0])
            self.SetColumnWidth(idx, c[1])
            idx += 1

        self.UpdateDataMap(dataDict)
        
        # Events
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self._OnItemActivated)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._OnItemDeselected)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._OnItemSelected)
        self.Bind(wx.EVT_LIST_ITEM_CHECKED, self._OnItemChecked)
        self.Bind(wx.EVT_LIST_ITEM_UNCHECKED, self._OnItemChecked)
コード例 #9
0
ファイル: FalconVirtualListCtrl.py プロジェクト: yncat/falcon
 def OnGetItemAttr(self, item):
     ret = self.lst[item]
     if type(ret) == list:
         return None
     else:
         ret = ret.list_backgroundColour
         if ret:
             self.CheckedItemAttr = wx.ItemAttr()
             self.CheckedItemAttr.SetBackgroundColour(wx.Colour(ret))
             return self.CheckedItemAttr
         return None
コード例 #10
0
ファイル: ViewCreator.py プロジェクト: guredora403/falcon
	def ListCtrl(self,proportion,sizerFlag,**settings):
		hListCtrl=wx.ListCtrl()
		hListCtrl.EnableSystemTheme(False)
		hListCtrl.SetHeaderAttr(wx.ItemAttr("888888","888888",self.font.GetFont()))
		hListCtrl.Create(self.parent,wx.ID_ANY,**settings)
		self.SetFace(hListCtrl)
		self.SetFace(hListCtrl.GetMainWindow())
		Add(self.sizer,hListCtrl,proportion,sizerFlag)
		_winxptheme.SetWindowTheme(win32api.SendMessage(hListCtrl.GetHandle(),0x101F,0,0),"","")#ヘッダーのウィンドウテーマを引っぺがす
		self.AddSpace(self.space)
		return hListCtrl
コード例 #11
0
ファイル: servosdlg.py プロジェクト: jbernardis/mycmri
    def __init__(self, parent, data, maxsv):
        colWidth = 0
        nLines = 16
        for c in colInfo:
            colWidth += c[2]

        if os.name == 'nt':
            lcSize = (colWidth + 18, nLines * 19 + 30)
        else:
            lcSize = (colWidth + 18, nLines * 19 + 30)

        wx.ListCtrl.__init__(self,
                             parent,
                             wx.ID_ANY,
                             style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_VRULES
                             | wx.LC_HRULES,
                             size=lcSize)
        self.parent = parent
        self.maxsv = maxsv
        self.data = data[:]
        self.ctSel = 0

        self.EnableCheckBoxes(enable=True)
        for c in colInfo:
            self.AppendColumn(c[0], c[1], c[2])

        self.SetItemCount(maxsv)
        self.isChecked = [False] * maxsv

        self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.onColumnResize)

        self.attrNorm = wx.ItemAttr()
        self.attrNorm.SetBackgroundColour(wx.Colour(113, 244, 89))

        self.attrRev = wx.ItemAttr()
        self.attrRev.SetBackgroundColour(wx.Colour(241, 54, 73))

        self.attrOth = wx.ItemAttr()
        self.attrOth.SetBackgroundColour(wx.Colour(243, 240, 118))

        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)
コード例 #12
0
ファイル: listeditor.py プロジェクト: charles20cent/RIDE
 def _create_ui(self, columns, data):
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     self._list = self._create_list(columns, data)
     if wx.VERSION >= (4, 1, 0):
         # DEBUG: This is supposed to work on Windows, but it is not
         result = self._list.SetHeaderAttr(wx.ItemAttr(colText=self.color_foreground,
                                              colBack=self.color_background, font=self._list.GetFont()))
         # print(f"DEBUG: Change colors of table headers {result}")
     sizer.Add(self._list, 1, wx.EXPAND)
     sizer.Add((5, 0))
     sizer.Add(self._create_buttons())
     sizer.Add((5, 0))
     self.SetSizer(sizer)
     sizer.Layout()
コード例 #13
0
ファイル: gcodelist.py プロジェクト: jbernardis/cnctools
    def __init__(self, parent):
        self.parent = parent
        self.model = None
        wx.ListCtrl.__init__(self,
                             parent,
                             wx.ID_ANY,
                             size=(-1, 300),
                             style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES
                             | wx.LC_NO_HEADER)

        self.InsertColumn(0, "")
        self.SetColumnWidth(0, 300)
        self.Bind(wx.EVT_SIZE, self.onResize)

        self.gcode = []
        self.SetItemCount(0)

        self.attr2 = wx.ItemAttr()
        self.attr2.SetBackgroundColour("light blue")
コード例 #14
0
ファイル: tabular_editor.py プロジェクト: enthought/traitsui
    def OnGetItemAttr(self, row):
        """Returns the display attributes to use for the specified list item."""
        # fixme: There appears to be a bug in wx in that they do not correctly
        # manage the reference count for the returned object, and it seems to be
        # gc'ed before they finish using it. So we store an object reference to
        # it to prevent it from going away too soon...
        self._attr = attr = wx.ItemAttr()
        editor = self._editor
        object, name = editor.object, editor.name

        color = editor.adapter.get_bg_color(object, name, row)
        if color is not None:
            attr.SetBackgroundColour(color)

        color = editor.adapter.get_text_color(object, name, row)
        if color is not None:
            attr.SetTextColour(color)

        font = editor.adapter.get_font(object, name, row)
        if font is not None:
            attr.SetFont(font)

        return attr
コード例 #15
0
    def __init__(
        self,
        parent,
        id=-1,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.LC_REPORT,
    ):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style)

        self._data = None
        self._currentColumn = 0
        self._currentDirection = LISTCTRL_SORT
        self._secondarySortColumn = None

        self._defaultColour = self.GetBackgroundColour()
        self._altColour = self.GetBackgroundColour()
        self._currentAttr = wx.ItemAttr()

        self._getItemTextFn = None
        self._getItemAttrFn = None

        # set events
        self.Bind(wx.EVT_LIST_COL_CLICK, self._onColClick, self)