diff --git a/fileselectionlist.py b/fileselectionlist.py index 8b96ddd..0ec286f 100644 --- a/fileselectionlist.py +++ b/fileselectionlist.py @@ -75,15 +75,23 @@ class FileSelectionList(QWidget): self.modifiedFlag = False selectAllAction = QAction("Select All", self) - invertSelectionAction = QAction("Invert Selection", self) removeAction = QAction("Remove Selected Items", self) + self.separator = QAction("",self) + self.separator.setSeparator(True) + + selectAllAction.setShortcut( 'Ctrl+A' ) + removeAction.setShortcut( 'Ctrl+X' ) selectAllAction.triggered.connect(self.selectAll) removeAction.triggered.connect(self.removeSelection) + self.addAction(self.separator) self.addAction(selectAllAction) - self.addAction(removeAction) + self.addAction(removeAction) + def addAppAction( self, action ): + self.insertAction( self.separator , action ) + def setModifiedFlag( self, modified ): self.modifiedFlag = modified diff --git a/fileselectionlist.ui b/fileselectionlist.ui index 2c3895e..39dc55e 100644 --- a/fileselectionlist.ui +++ b/fileselectionlist.ui @@ -25,6 +25,9 @@ QAbstractItemView::SelectRows + + Qt::ElideMiddle + 61 diff --git a/renamewindow.py b/renamewindow.py index deaa555..3c765dd 100644 --- a/renamewindow.py +++ b/renamewindow.py @@ -78,14 +78,24 @@ class RenameWindow(QtGui.QDialog): def accept( self ): QtGui.QDialog.accept(self) - for item in self.rename_list: + progdialog = QtGui.QProgressDialog("", "Cancel", 0, len(self.rename_list), self) + progdialog.setWindowTitle( "Renaming Archives" ) + progdialog.setWindowModality(QtCore.Qt.WindowModal) + + for idx,item in enumerate(self.rename_list): + + QtCore.QCoreApplication.processEvents() + if progdialog.wasCanceled(): + break + idx += 1 + progdialog.setValue(idx) if item['new_name'] == os.path.basename( item['archive'].path ): print item['new_name'] , "Filename is already good!" - break + continue if not item['archive'].isWritable(): - break + continue folder = os.path.dirname( os.path.abspath( item['archive'].path ) ) new_abs_path = utils.unique_file( os.path.join( folder, item['new_name'] ) ) @@ -93,4 +103,5 @@ class RenameWindow(QtGui.QDialog): os.rename( item['archive'].path, new_abs_path ) item['archive'].rename( new_abs_path ) - \ No newline at end of file + + progdialog.close() diff --git a/renamewindow.ui b/renamewindow.ui index a71b3da..9542c26 100644 --- a/renamewindow.ui +++ b/renamewindow.ui @@ -9,8 +9,8 @@ 0 0 - 556 - 210 + 813 + 261 diff --git a/taggerwindow.py b/taggerwindow.py index 6027e6f..8128c19 100644 --- a/taggerwindow.py +++ b/taggerwindow.py @@ -164,6 +164,10 @@ class TaggerWindow( QtGui.QMainWindow): self.raise_() QtCore.QCoreApplication.processEvents() + self.fileSelectionList.addAppAction( self.actionAutoSearch ) + self.fileSelectionList.addAppAction( self.actionRename ) + self.fileSelectionList.addAppAction( self.actionRemoveAuto ) + if len(file_list) != 0: self.fileSelectionList.addPathList( file_list ) @@ -231,7 +235,7 @@ class TaggerWindow( QtGui.QMainWindow): self.actionLoad.setStatusTip( 'Load comic archive' ) self.actionLoad.triggered.connect( self.selectFile ) - #self.actionLoadFolder.setShortcut( 'Ctrl+F' ) + self.actionLoadFolder.setShortcut( 'Ctrl+Shift+O' ) self.actionLoadFolder.setStatusTip( 'Load folder with comic archives' ) self.actionLoadFolder.triggered.connect( self.selectFolder ) @@ -275,7 +279,7 @@ class TaggerWindow( QtGui.QMainWindow): self.actionSearchOnline.setStatusTip( 'Search online for tags' ) self.actionSearchOnline.triggered.connect( self.queryOnline ) - self.actionAutoSearch.setShortcut( 'Ctrl+A' ) + self.actionAutoSearch.setShortcut( 'Ctrl+Shift+A' ) self.actionAutoSearch.triggered.connect( self.autoSelectSearch ) self.actionApplyCBLTransform.setShortcut( 'Ctrl+L' ) @@ -436,9 +440,9 @@ class TaggerWindow( QtGui.QMainWindow): def updateMenus( self ): # First just disable all the questionable items - self.actionRemoveAuto.setEnabled( False ) - self.actionRemoveCRTags.setEnabled( False ) - self.actionRemoveCBLTags.setEnabled( False ) + self.actionRemoveAuto.setEnabled( True ) + self.actionRemoveCRTags.setEnabled( True ) + self.actionRemoveCBLTags.setEnabled( True ) self.actionWrite_Tags.setEnabled( False ) self.actionRepackage.setEnabled(False) self.actionViewRawCBLTags.setEnabled( False ) @@ -1279,21 +1283,49 @@ class TaggerWindow( QtGui.QMainWindow): def removeTags( self, style): # remove the indicated tags from the archive - # ( keep the form and the current metadata object intact. ) - if self.comic_archive is not None and self.comic_archive.hasMetadata( style ): + #ATB + ca_list = self.fileSelectionList.getSelectedArchiveList() + has_md_count = 0 + for ca in ca_list: + if ca.hasMetadata( style ): + has_md_count += 1 + + if has_md_count != 0 and not self.dirtyFlagVerification( "Remove Tags", + "If remove tags now, unsaved data in the form will be lost. Are you sure?"): + return + + if has_md_count != 0: reply = QtGui.QMessageBox.question(self, self.tr("Remove Tags"), - self.tr("Are you sure you wish to remove the " + MetaDataStyle.name[style] + " tags from this archive?"), + self.tr("Are you sure you wish to remove the {0} tags from {1} archive(s)?".format(MetaDataStyle.name[style], has_md_count)), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No ) if reply == QtGui.QMessageBox.Yes: - path = self.comic_archive.path - if not self.comic_archive.removeMetadata( style ): - QtGui.QMessageBox.warning(self, self.tr("Remove failed"), self.tr("The tag removal operation seemed to fail!")) - else: - self.updateInfoBox() - self.updateMenus() - self.fileSelectionList.updateCurrentRow() + progdialog = QtGui.QProgressDialog("", "Cancel", 0, has_md_count, self) + progdialog.setWindowTitle( "Removing Tags" ) + progdialog.setWindowModality(QtCore.Qt.WindowModal) + prog_idx = 0 + + for ca in ca_list: + if ca.hasMetadata( style ): + QtCore.QCoreApplication.processEvents() + if progdialog.wasCanceled(): + break + prog_idx += 1 + progdialog.setValue(prog_idx) + + if ca.hasMetadata( style ) and ca.isWritable(): + if not ca.removeMetadata( style ): + if has_md_count == 1: + QtGui.QMessageBox.warning(self, self.tr("Remove failed"), self.tr("The tag removal operation seemed to fail!")) + else: + QtGui.QMessageBox.warning(self, self.tr("Remove failed"), + self.tr("The tag removal operation seemed to fail for {0} Operation aborted!".format(ca.path))) + break + progdialog.close() + self.fileSelectionList.updateSelectedRows() + self.updateInfoBox() + self.updateMenus() def dirtyFlagVerification( self, title, desc): if self.dirtyFlag: @@ -1369,7 +1401,7 @@ class TaggerWindow( QtGui.QMainWindow): def renameArchive(self): if self.comic_archive is not None: if self.dirtyFlagVerification( "File Rename", - "If rename files now, unsave data in the form will be lost. Are you sure?"): + "If 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 ) diff --git a/taggerwindow.ui b/taggerwindow.ui index c1a88b3..0cf0e61 100644 --- a/taggerwindow.ui +++ b/taggerwindow.ui @@ -72,7 +72,7 @@ - Write Style + Modify Style @@ -1176,7 +1176,7 @@ 0 0 968 - 28 + 25 diff --git a/todo.txt b/todo.txt index 140f71c..0f27da3 100644 --- a/todo.txt +++ b/todo.txt @@ -5,15 +5,14 @@ Features Multi-file: Batch Functions: - Delete - - Auto-Select + + Batch Auto-Select Start/Options Dialog Progress Dialog - maybe reuse Interactive dialog at end Summary Dialog - Copy Block + Batch Tag Copy Verify overwrites Rename @@ -24,7 +23,8 @@ Multi-file: Filelist: Add archive type column add read-only column - + Better column sizing + Text display to cut out middle if too short? ----------------------------------------------------- Bugs