diff --git a/comictaggerlib/fileselectionlist.py b/comictaggerlib/fileselectionlist.py index 2d9b97a..cbd9c8f 100644 --- a/comictaggerlib/fileselectionlist.py +++ b/comictaggerlib/fileselectionlist.py @@ -98,6 +98,15 @@ class FileSelectionList(QWidget): self.addAction(removeAction) self.addAction(self.separator) + def getSorting(self): + col = self.twList.horizontalHeader().sortIndicatorSection() + order = self.twList.horizontalHeader().sortIndicatorOrder() + print col,order + return col, order + + def setSorting(self, col, order): + col = self.twList.horizontalHeader().setSortIndicator( col, order) + def addAppAction( self, action ): self.insertAction( None , action ) diff --git a/comictaggerlib/settings.py b/comictaggerlib/settings.py index 15ce465..dd19b37 100644 --- a/comictaggerlib/settings.py +++ b/comictaggerlib/settings.py @@ -82,6 +82,8 @@ class ComicTaggerSettings: self.last_main_window_y = 0 self.last_form_side_width = -1 self.last_list_side_width = -1 + self.last_filelist_sorted_column = -1 + self.last_filelist_sorted_order = 0 # identifier settings self.id_length_delta_thresh = 5 @@ -205,6 +207,10 @@ class ComicTaggerSettings: self.last_form_side_width = self.config.getint( 'auto', 'last_form_side_width' ) if self.config.has_option('auto', 'last_list_side_width'): self.last_list_side_width = self.config.getint( 'auto', 'last_list_side_width' ) + if self.config.has_option('auto', 'last_filelist_sorted_column'): + self.last_filelist_sorted_column = self.config.getint( 'auto', 'last_filelist_sorted_column' ) + if self.config.has_option('auto', 'last_filelist_sorted_order'): + self.last_filelist_sorted_order = self.config.getint( 'auto', 'last_filelist_sorted_order' ) if self.config.has_option('identifier', 'id_length_delta_thresh'): self.id_length_delta_thresh = self.config.getint( 'identifier', 'id_length_delta_thresh' ) @@ -275,6 +281,8 @@ class ComicTaggerSettings: self.config.set( 'auto', 'last_main_window_y', self.last_main_window_y ) self.config.set( 'auto', 'last_form_side_width', self.last_form_side_width ) self.config.set( 'auto', 'last_list_side_width', self.last_list_side_width ) + self.config.set( 'auto', 'last_filelist_sorted_column', self.last_filelist_sorted_column ) + self.config.set( 'auto', 'last_filelist_sorted_order', self.last_filelist_sorted_order ) if not self.config.has_section( 'identifier' ): self.config.add_section( 'identifier' ) diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index 2c489f5..cd232dd 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -101,6 +101,8 @@ class TaggerWindow( QtGui.QMainWindow): self.fileSelectionList.selectionChanged.connect( self.fileListSelectionChanged ) self.fileSelectionList.listCleared.connect( self.fileListCleared ) + self.fileSelectionList.setSorting(self.settings.last_filelist_sorted_column, + self.settings.last_filelist_sorted_order) # we can't specify relative font sizes in the UI designer, so # walk through all the lablels in the main form, and make them @@ -1747,6 +1749,7 @@ class TaggerWindow( QtGui.QMainWindow): self.settings.last_main_window_y = self.y() self.settings.last_form_side_width = self.splitter.sizes()[0] self.settings.last_list_side_width = self.splitter.sizes()[1] + self.settings.last_filelist_sorted_column, self.settings.last_filelist_sorted_order = self.fileSelectionList.getSorting() self.settings.save()