Changeset 814:6886acd6bcd5
- Timestamp:
- 09/25/16 06:30:42 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flightlist.py
r811 r814 11 11 def __init__(self, attribute, heading, type = str, 12 12 convertFn = None, renderer = gtk.CellRendererText(), 13 extraColumnAttributes = None ):13 extraColumnAttributes = None, sortable = False): 14 14 """Construct the descriptor.""" 15 15 self._attribute = attribute … … 19 19 self._renderer = renderer 20 20 self._extraColumnAttributes = extraColumnAttributes 21 self._sortable = sortable 21 22 22 23 def appendType(self, types): … … 39 40 text = index) 40 41 column.set_expand(True) 42 if self._sortable: 43 column.set_sort_column_id(index) 44 column.set_sort_indicator(True) 41 45 42 46 return column … … 63 67 self._popupMenu = None 64 68 65 types = [ ]69 types = [int] 66 70 for columnDescriptor in self._columnDescriptors: 67 71 columnDescriptor.appendType(types) 68 72 69 73 self._model = gtk.ListStore(*types) 74 self._model.set_sort_column_id(2, SORT_ASCENDING) 70 75 self._view = gtk.TreeView(self._model) 71 76 72 index = 0 77 flightIndexColumn = gtk.TreeViewColumn() 78 flightIndexColumn.set_visible(False) 79 self._view.append_column(flightIndexColumn) 80 81 index = 1 73 82 for columnDescriptor in self._columnDescriptors: 74 83 column = columnDescriptor.getViewColumn(index) … … 106 115 return None 107 116 else: 108 path = model.get_path(iter) 109 [index] = path.get_indices() if pygobject else path 117 index = model.get_value(iter, 0) 110 118 return index 111 119 … … 116 124 def addFlight(self, flight): 117 125 """Add the given booked flight.""" 118 values = [ ]126 values = [self._model.iter_n_children(None)] 119 127 for columnDescriptor in self._columnDescriptors: 120 128 values.append(columnDescriptor.getValueFrom(flight))
Note:
See TracChangeset
for help on using the changeset viewer.