Changeset 822:08829c45f0a9
- Timestamp:
- 09/25/16 06:45:38 (8 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flightlist.py
r821 r822 13 13 def __init__(self, attribute, heading, type = str, 14 14 convertFn = None, renderer = gtk.CellRendererText(), 15 extraColumnAttributes = None, sortable = False): 15 extraColumnAttributes = None, sortable = False, 16 defaultSortable = False): 16 17 """Construct the descriptor.""" 17 18 self._attribute = attribute … … 22 23 self._extraColumnAttributes = extraColumnAttributes 23 24 self._sortable = sortable 25 self._defaultSortable = defaultSortable 26 27 @property 28 def defaultSortable(self): 29 """Determine if this column is the default sortable one.""" 30 return self._defaultSortable 24 31 25 32 def appendType(self, types): … … 65 72 ColumnDescriptor("callsign", xstr("flightsel_no")), 66 73 ColumnDescriptor("departureTime", xstr("flightsel_deptime"), 67 sortable = True ),74 sortable = True, defaultSortable = True), 68 75 ColumnDescriptor("departureICAO", xstr("flightsel_from"), 69 76 sortable = True), … … 80 87 81 88 types = [int] 89 defaultSortableIndex = None 82 90 for columnDescriptor in self._columnDescriptors: 91 if columnDescriptor.defaultSortable: 92 defaultSortableIndex = len(types) 83 93 columnDescriptor.appendType(types) 84 94 85 95 self._model = gtk.ListStore(*types) 86 self._model.set_sort_column_id(2, SORT_ASCENDING) 96 if defaultSortableIndex is not None: 97 self._model.set_sort_column_id(defaultSortableIndex, 98 SORT_ASCENDING) 87 99 self._view = gtk.TreeView(self._model) 88 100 … … 213 225 ColumnDescriptor("callsign", xstr("flightsel_no")), 214 226 ColumnDescriptor("departureTime", xstr("flightsel_deptime"), 215 sortable = True ),227 sortable = True, defaultSortable = True), 216 228 ColumnDescriptor("departureICAO", xstr("flightsel_from"), 217 229 sortable = True),
Note:
See TracChangeset
for help on using the changeset viewer.