+ def _select_sort_column(self, col):
+ #Determine which column requires sorting
+ columns = self._get_column_sort_stuff()
+ for columnIndex, (maybeCol, directionName, col_cmp) in enumerate(columns):
+ if col is maybeCol:
+ direction = getattr(self, directionName)
+ gtkDirection = gtk.SORT_ASCENDING if direction else gtk.SORT_DESCENDING
+
+ # cause a sort
+ self._sortedUnitModel.set_sort_column_id(columnIndex, gtkDirection)
+
+ # set the visual for sorting
+ col.set_sort_indicator(True)
+ col.set_sort_order(not direction)
+
+ setattr(self, directionName, not direction)
+ break
+ else:
+ maybeCol.set_sort_indicator(False)
+ else:
+ assert False, "Unknown column: %s" % (col.get_title(), )
+
+ def set_orientation(self, orientation):
+ if orientation == gtk.ORIENTATION_VERTICAL:
+ hildonize.window_to_portrait(self._mainWindow)
+ self.__isPortrait = True
+ elif orientation == gtk.ORIENTATION_HORIZONTAL:
+ hildonize.window_to_landscape(self._mainWindow)
+ self.__isPortrait = False
+ else:
+ raise NotImplementedError(orientation)
+
+ def get_orientation(self):
+ return gtk.ORIENTATION_VERTICAL if self.__isPortrait else gtk.ORIENTATION_HORIZONTAL
+
+ def _toggle_rotate(self):
+ if self.__isPortrait:
+ self.set_orientation(gtk.ORIENTATION_HORIZONTAL)
+ else:
+ self.set_orientation(gtk.ORIENTATION_VERTICAL)
+
+ @gtk_toolbox.log_exception(_moduleLogger)