def _makeListView (self, parent): if self.config.groupByGenre: listView = GroupListView (parent, wx.ID_ANY, style = wx.LC_REPORT | wx.SUNKEN_BORDER, useAlternateBackColors = False) else: listView = ObjectListView (parent, wx.ID_ANY, style = wx.LC_REPORT | wx.SUNKEN_BORDER, useAlternateBackColors = False) listView.rowFormatter = self.rowFormatter listView.SetEmptyListMsg ("No transducers found") # COLUMNS: # Normal: DR # Grp: D(G)R # Det: DNGSR # Det+Grp: DN(G)SR cols = ([ ColumnDefn ("Description", "left", 220, "smartName"), ColumnDefn ("Reading", "right", 100, "lastRead", isSpaceFilling = True), ]) if self.config.viewDetails: cols.insert (1, ColumnDefn ("Name", "center", 50, "name")) if self.config.groupByGenre: # This col is only used for grouping, use 0 width and make entries empty to hide it cols.insert (2, ColumnDefn ("Genre", "center", 0, "genre", maximumWidth = 0, stringConverter = lambda g: "", groupKeyConverter = lambda g: "Sensors" if g == Sensoria.SENSOR else "Actuators")) else: cols.insert (2, ColumnDefn ("Genre", "center", 100, "genre", stringConverter = lambda g: "Sensor" if g == Sensoria.SENSOR else "Actuator")) cols.insert (3, ColumnDefn ("Stereo", "center", 50, "stereotype")) elif self.config.groupByGenre: # This col is only used for grouping, use 0 width and make entries empty to hide it cols.insert (2, ColumnDefn ("Genre", "center", 50, "genre", maximumWidth = 0, stringConverter = lambda g: "", groupKeyConverter = lambda g: "Sensors" if g == Sensoria.SENSOR else "Actuators")) listView.SetColumns (cols) if self.config.groupByGenre: listView.showItemCounts = False listView.SetShowGroups = True listView.alwaysGroupByColumnIndex = 3 # col 0 is expansion icon listView.SetSortColumn (listView.columns[1]) else: listView.SetSortColumn (listView.columns[0]) listView.Bind (wx.EVT_LIST_ITEM_ACTIVATED, self.onItemDoubleClicked) listView.Bind (wx.EVT_LIST_ITEM_RIGHT_CLICK, self.onItemRightClicked) return listView