Remember filelist sorting

git-svn-id: http://comictagger.googlecode.com/svn/trunk@593 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville 2013-04-12 06:10:50 +00:00
parent 0390ff5919
commit 534a326258
3 changed files with 20 additions and 0 deletions

View File

@ -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 )

View File

@ -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' )

View File

@ -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()