From d9cdb14aa68d734c9b8d79158e24d64e889df020 Mon Sep 17 00:00:00 2001 From: beville Date: Wed, 23 Jan 2013 18:55:10 +0000 Subject: [PATCH] Form re-worked Preserve splitter location in settings git-svn-id: http://comictagger.googlecode.com/svn/trunk@330 6c5673fe-1810-88d6-992b-cd32ca31540c --- settings.py | 8 + taggerwindow.py | 54 ++- taggerwindow.ui | 975 ++++++++++++++++++++++-------------------------- 3 files changed, 502 insertions(+), 535 deletions(-) diff --git a/settings.py b/settings.py index f0f0dc5..87b2fe9 100644 --- a/settings.py +++ b/settings.py @@ -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' ) diff --git a/taggerwindow.py b/taggerwindow.py index 7250ee7..f3937f2 100644 --- a/taggerwindow.py +++ b/taggerwindow.py @@ -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 ) diff --git a/taggerwindow.ui b/taggerwindow.ui index 5894a31..0ff6a54 100644 --- a/taggerwindow.ui +++ b/taggerwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1007 - 575 + 1096 + 571 @@ -36,7 +36,7 @@ true - + true @@ -276,6 +276,12 @@ + + + 0 + 0 + + true @@ -295,528 +301,453 @@ 0 - 0 - 685 - 384 + -64 + 470 + 520 + + + 0 + 0 + + + + + 0 + 0 + + true - - - - 10 - 10 - 361 - 341 - - - - - 4 - - - - - QLayout::SetNoConstraint - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Series - - - - - - - false - - - - - - - Title - - - - - - - false - - - - - - - Publisher - - - - - - - false - - - - - - - Imprint - - - - - - - false - - - - - - - - 85 - 0 - - - - Series Group - - - - - - - false - - - - - - - Story Arc - - - - - - - false - - - - - - - Genre - - - - - - - false - - - - - - - Alt. Series - - - - - - - false - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 10 - - - - - - - - - - 6 - - - 4 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 85 - 0 - - - - Alt. Issue - - - - - - - - 0 - 0 - - - - false - - - - - - - - - - - Alt. # Issues - - - - - - - false - - - - - - - - - - - - - 380 - 10 - 301 - 341 - - - - - 6 - - - 3 - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Issue - - - - - - - false - - - - - - - Volume - - - - - - - false - - - - - - - Year - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - false - - - Qt::ImhDigitsOnly - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - # Issues - - - - - - - false - - - Qt::ImhDigitsOnly - - - - - - - # Volumes - - - - - - - false - - - Qt::ImhDigitsOnly - - - - - - - Month - - - - - - - - 0 - 0 - - - - - 50 - 16777215 - - - - false - - - Qt::ImhDigitsOnly - - - - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - 6 - - - - - Maturity Rating - - - - - - - false - - - true - - - - - - - Manga - - - - - - - false - - - - - - - Format - - - - - - - - 0 - 0 - - - - true - - - - - - - Black & White - - - - - - - Qt::LeftToRight - - - false - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 20 - 10 - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - 0 - 0 - - - - - - - - Country - - - - - - - - 0 - 0 - - - - - - - - Language - - - - - - - + + + + + + + QFormLayout::FieldsStayAtSizeHint + + + QFormLayout::WrapAllRows + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 6 + + + 1 + + + + + Issue + + + + + + + false + + + + + + + Year + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + Qt::ImhDigitsOnly + + + + + + + Month + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + Qt::ImhDigitsOnly + + + + + + + # Issues + + + + + + + false + + + Qt::ImhDigitsOnly + + + + + + + Volume + + + + + + + false + + + + + + + # Volumes + + + + + + + false + + + Qt::ImhDigitsOnly + + + + + + + Alt.Issue + + + + + + + + 0 + 0 + + + + false + + + + + + + Alt. # Issues + + + + + + + false + + + + + + + + + QLayout::SetMinimumSize + + + QFormLayout::AllNonFixedFieldsGrow + + + QFormLayout::WrapAllRows + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + 0 + + + 1 + + + + + Series + + + + + + + false + + + + + + + Title + + + + + + + false + + + + + + + Publisher + + + + + + + false + + + + + + + Imprint + + + + + + + + 0 + 0 + + + + false + + + + + + + Series Group + + + + + + + false + + + + + + + Story Arc + + + + + + + false + + + + + + + Genre + + + + + + + false + + + + + + + Maturity Rating + + + + + + + false + + + true + + + + + + + Manga + + + + + + + false + + + + + + + Format + + + + + + + + 0 + 0 + + + + true + + + + + + + Black & White + + + + + + + Qt::LeftToRight + + + false + + + + + + + + + + Language + + + + + + + + 0 + 0 + + + + + + + + Country + + + + + + + + 0 + 0 + + + + + + + + Alt. Series + + + + + + + false + + + + + + + + @@ -1175,8 +1106,8 @@ 0 0 - 1007 - 28 + 1096 + 25