From 253913fe2f4a7b39375bc698b5c8c2bb92b284b2 Mon Sep 17 00:00:00 2001 From: "beville@gmail.com" Date: Sat, 3 Nov 2012 18:46:04 +0000 Subject: [PATCH] Added form clearing function git-svn-id: http://comictagger.googlecode.com/svn/trunk@5 6c5673fe-1810-88d6-992b-cd32ca31540c --- taggerwindow.py | 28 +++++++++++++++++++++++++++- taggerwindow.ui | 18 ++++++++++++++++++ todo.txt | 7 +------ 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/taggerwindow.py b/taggerwindow.py index 95f021e..3be2f76 100644 --- a/taggerwindow.py +++ b/taggerwindow.py @@ -97,6 +97,10 @@ class TaggerWindow( QtGui.QMainWindow): self.actionQuery_Online.setStatusTip( 'Search online for tags' ) self.actionQuery_Online.triggered.connect( self.queryOnline ) + self.actionClearEntryForm.setShortcut( 'Ctrl+C' ) + self.actionClearEntryForm.setStatusTip( 'Clear all the data on the screen' ) + self.actionClearEntryForm.triggered.connect( self.clearForm ) + # Help Menu self.actionAbout.setShortcut( 'Ctrl+A' ) self.actionAbout.setStatusTip( 'Show the ' + self.appName + ' info' ) @@ -108,8 +112,8 @@ class TaggerWindow( QtGui.QMainWindow): self.toolBar.addAction( self.actionWrite_Tags ) self.toolBar.addAction( self.actionParse_Filename ) self.toolBar.addAction( self.actionQuery_Online ) + self.toolBar.addAction( self.actionClearEntryForm ) - def repackageArchive( self ): QtGui.QMessageBox.information(self, self.tr("Repackage Comic Archive"), self.tr("TBD")) @@ -174,6 +178,28 @@ class TaggerWindow( QtGui.QMainWindow): self.lblArchiveInfo.setText( info_text ) + def clearForm( self ): + # recursivly clear the tab form + self.clearChildren( self.tabWidget ) + + def clearChildren (self, widget ): + + if ( isinstance(widget, QtGui.QLineEdit) or + isinstance(widget, QtGui.QTextEdit)): + widget.setText("") + if ( isinstance(widget, QtGui.QComboBox) ): + widget.setCurrentIndex( 0 ) + if ( isinstance(widget, QtGui.QCheckBox) ): + widget.setChecked( False ) + if ( isinstance(widget, QtGui.QTableWidget) ): + while widget.rowCount() > 0: + widget.removeRow(0) + + # recursive call on chillun + for child in widget.children(): + self.clearChildren( child ) + + def metadataToForm( self ): # copy the the metadata object into to the form diff --git a/taggerwindow.ui b/taggerwindow.ui index ce0485e..f8db6ad 100644 --- a/taggerwindow.ui +++ b/taggerwindow.ui @@ -685,6 +685,8 @@ + + @@ -699,6 +701,7 @@ + @@ -757,6 +760,21 @@ Query Online + + + Clear Entry Form + + + + + Remove CR Tags + + + + + Remove CBL Tags + + diff --git a/todo.txt b/todo.txt index ee07291..c72252c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,4 @@ - +Remove metadata from archive ComicArchive support for folders ComicArchive support for reading RARs @@ -20,19 +20,14 @@ TaggerWindow entry fields Form type validation Ints vs strings for month, year. etc - Check all HTTP responses for errors -Clear form button -Remove metadata from archive - Lots of error checking Archive function to detect tag blocks out of sync Use external RAR tools to generate rar with CIX! - Hourglass popup, or whatever, for when busy Idea: Support only CBI or CIX for any given file, and not both