Form re-worked

Preserve splitter location in settings

git-svn-id: http://comictagger.googlecode.com/svn/trunk@330 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville 2013-01-23 18:55:10 +00:00
parent cab525675d
commit d9cdb14aa6
3 changed files with 502 additions and 535 deletions

View File

@ -58,6 +58,8 @@ class ComicTaggerSettings:
self.last_main_window_height = 0
self.last_main_window_x = 0
self.last_main_window_y = 0
self.last_form_side_width = -1
self.last_list_side_width = -1
# identifier settings
self.id_length_delta_thresh = 5
@ -155,6 +157,10 @@ class ComicTaggerSettings:
self.last_main_window_x = self.config.getint( 'auto', 'last_main_window_x' )
if self.config.has_option('auto', 'last_main_window_y'):
self.last_main_window_y = self.config.getint( 'auto', 'last_main_window_y' )
if self.config.has_option('auto', 'last_form_side_width'):
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('identifier', 'id_length_delta_thresh'):
self.id_length_delta_thresh = self.config.getint( 'identifier', 'id_length_delta_thresh' )
@ -213,6 +219,8 @@ class ComicTaggerSettings:
self.config.set( 'auto', 'last_main_window_height', self.last_main_window_height )
self.config.set( 'auto', 'last_main_window_x', self.last_main_window_x )
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 )
if not self.config.has_section( 'identifier' ):
self.config.add_section( 'identifier' )

View File

@ -116,12 +116,30 @@ class TaggerWindow( QtGui.QMainWindow):
self.fileSelectionList.selectionChanged.connect( self.fileListSelectionChanged )
self.fileSelectionList.listCleared.connect( self.fileListCleared )
self.splitter.setSizes([500,200])
# ATB: Disable the list for now...
# ATB: Disable the list...
#self.splitter.setSizes([100,0])
#self.splitter.setHandleWidth(0)
#self.splitter.handle(1).setDisabled(True)
# This is ugly, and should probably be done in a resource file
if platform.system() == "Linux":
self.scrollAreaWidgetContents.resize( self.scrollAreaWidgetContents.width(), 630)
#if platform.system() == "Darwin":
# self.scrollAreaWidgetContents.resize( 550, self.scrollAreaWidgetContents.height())
# we can't specify relative font sizes in the UI designer, so
# walk through all the lablels in the main form, and make them
# a smidge smaller
for child in self.scrollAreaWidgetContents.children():
if ( isinstance(child, QtGui.QLabel) ):
f = child.font()
if f.pointSize() > 10:
f.setPointSize( f.pointSize() - 2 )
f.setItalic( True )
child.setFont( f )
#---------------------------
@ -179,6 +197,8 @@ class TaggerWindow( QtGui.QMainWindow):
self.show()
self.setAppPosition()
if self.settings.last_form_side_width != -1:
self.splitter.setSizes([ self.settings.last_form_side_width , self.settings.last_list_side_width])
self.raise_()
QtCore.QCoreApplication.processEvents()
@ -1666,7 +1686,11 @@ class TaggerWindow( QtGui.QMainWindow):
self.settings.last_main_window_height = appsize.height()
self.settings.last_main_window_x = self.x()
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.save()
event.accept()
else:
event.ignore()
@ -1718,16 +1742,20 @@ class TaggerWindow( QtGui.QMainWindow):
self.metadataToForm()
def renameArchive(self):
if self.comic_archive is not None:
if self.dirtyFlagVerification( "File Rename",
"If you rename files now, unsaved data in the form will be lost. Are you sure?"):
#get list of archives from filelist
ca_list = self.fileSelectionList.getSelectedArchiveList()
dlg = RenameWindow( self, ca_list, self.load_data_style, self.settings )
dlg.setModal( True )
if dlg.exec_():
self.fileSelectionList.updateSelectedRows()
self.loadArchive( self.comic_archive )
ca_list = self.fileSelectionList.getSelectedArchiveList()
if len(ca_list) == 0:
QtGui.QMessageBox.information(self, self.tr("Rename"), self.tr("No archives selected!"))
return
if self.dirtyFlagVerification( "File Rename",
"If you rename files now, unsaved data in the form will be lost. Are you sure?"):
dlg = RenameWindow( self, ca_list, self.load_data_style, self.settings )
dlg.setModal( True )
if dlg.exec_():
self.fileSelectionList.updateSelectedRows()
self.loadArchive( self.comic_archive )

File diff suppressed because it is too large Load Diff