Options dialog for export to zip
Fixed progress dialogs git-svn-id: http://comictagger.googlecode.com/svn/trunk@320 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
parent
be3b0fe92c
commit
b8e8c6433a
@ -109,6 +109,17 @@ class FileSelectionList(QWidget):
|
||||
|
||||
def deselectAll( self ):
|
||||
self.twList.setRangeSelected( QTableWidgetSelectionRange ( 0, 0, self.twList.rowCount()-1, 5 ), False )
|
||||
|
||||
def removeArchiveList( self, ca_list ):
|
||||
self.twList.setSortingEnabled(False)
|
||||
for ca in ca_list:
|
||||
for row in range(self.twList.rowCount()):
|
||||
fi = self.twList.item(row, FileSelectionList.dataColNum).data( Qt.UserRole ).toPyObject()
|
||||
if fi.ca == ca:
|
||||
self.twList.removeRow(row)
|
||||
break
|
||||
self.twList.setSortingEnabled(True)
|
||||
|
||||
|
||||
def removeSelection( self ):
|
||||
row_list = []
|
||||
@ -128,10 +139,12 @@ class FileSelectionList(QWidget):
|
||||
row_list.reverse()
|
||||
|
||||
self.twList.currentItemChanged.disconnect( self.currentItemChangedCB )
|
||||
self.twList.setSortingEnabled(False)
|
||||
|
||||
for i in row_list:
|
||||
self.twList.removeRow(i)
|
||||
|
||||
self.twList.setSortingEnabled(True)
|
||||
self.twList.currentItemChanged.connect( self.currentItemChangedCB )
|
||||
|
||||
if self.twList.rowCount() > 0:
|
||||
@ -155,6 +168,7 @@ class FileSelectionList(QWidget):
|
||||
progdialog = QProgressDialog("", "Cancel", 0, len(filelist), self)
|
||||
progdialog.setWindowTitle( "Adding Files" )
|
||||
progdialog.setWindowModality(Qt.WindowModal)
|
||||
progdialog.show()
|
||||
|
||||
firstAdded = None
|
||||
self.twList.setSortingEnabled(False)
|
||||
@ -163,6 +177,8 @@ class FileSelectionList(QWidget):
|
||||
if progdialog.wasCanceled():
|
||||
break
|
||||
progdialog.setValue(idx)
|
||||
progdialog.setLabelText(f)
|
||||
QCoreApplication.processEvents()
|
||||
row = self.addPathItem( f )
|
||||
if firstAdded is None and row is not None:
|
||||
firstAdded = row
|
||||
|
@ -1,4 +1,18 @@
|
||||
|
||||
---------------------------------
|
||||
1.0.0-beta - ??-Jan-2013
|
||||
---------------------------------
|
||||
Version 1! New multi-file processing in GUI!
|
||||
|
||||
GUI Changes:
|
||||
Open multiple files and/or folders via drag/drop or file dialog
|
||||
File management list for easy viewing and selection
|
||||
Batch tag remove
|
||||
Batch export as zip
|
||||
Batch rename
|
||||
Batch tag copy
|
||||
Batch auto-select and save!
|
||||
|
||||
---------------------------------
|
||||
0.9.5-beta - 16-Jan-2013
|
||||
---------------------------------
|
||||
|
@ -121,6 +121,7 @@ class RenameWindow(QtGui.QDialog):
|
||||
progdialog = QtGui.QProgressDialog("", "Cancel", 0, len(self.rename_list), self)
|
||||
progdialog.setWindowTitle( "Renaming Archives" )
|
||||
progdialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
progdialog.show()
|
||||
|
||||
for idx,item in enumerate(self.rename_list):
|
||||
|
||||
@ -129,6 +130,7 @@ class RenameWindow(QtGui.QDialog):
|
||||
break
|
||||
idx += 1
|
||||
progdialog.setValue(idx)
|
||||
progdialog.setLabelText( item['new_name'] )
|
||||
|
||||
if item['new_name'] == os.path.basename( item['archive'].path ):
|
||||
print item['new_name'] , "Filename is already good!"
|
||||
|
@ -22,7 +22,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -47,6 +47,7 @@ from pagelisteditor import PageListEditor
|
||||
from fileselectionlist import FileSelectionList
|
||||
from cbltransformer import CBLTransformer
|
||||
from renamewindow import RenameWindow
|
||||
from exportwindow import ExportWindow, ExportConflictOpts
|
||||
from pageloader import PageLoader
|
||||
import utils
|
||||
import ctversion
|
||||
@ -348,19 +349,21 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
return
|
||||
|
||||
if rar_count != 0:
|
||||
reply = QtGui.QMessageBox.question(self,
|
||||
self.tr("Export Archives"),
|
||||
self.tr("Are you sure you wish to export {0} archive(s) to Zip format?".format(rar_count)),
|
||||
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No )
|
||||
|
||||
if reply == QtGui.QMessageBox.No:
|
||||
dlg = ExportWindow( self, self.settings,
|
||||
self.tr("You have selected {0} archive(s) to export to Zip format. New archives will be created in the same folder as the original.\n\nPlease choose options below, and select OK.\n".format(rar_count) ))
|
||||
dlg.setModal( True )
|
||||
if not dlg.exec_():
|
||||
return
|
||||
|
||||
|
||||
progdialog = QtGui.QProgressDialog("", "Cancel", 0, rar_count, self)
|
||||
progdialog.setWindowTitle( "Exporting as ZIP" )
|
||||
progdialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
progdialog.show()
|
||||
prog_idx = 0
|
||||
|
||||
new_archives_to_add = []
|
||||
archives_to_remove = []
|
||||
|
||||
for ca in ca_list:
|
||||
if ca.isRar():
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
@ -368,17 +371,35 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
break
|
||||
prog_idx += 1
|
||||
progdialog.setValue(prog_idx)
|
||||
progdialog.setLabelText( ca.path )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
export_name = os.path.splitext(ca.path)[0] + ".cbz"
|
||||
export_name = utils.unique_file( export_name )
|
||||
retcode = ca.exportAsZip( export_name )
|
||||
|
||||
if not retcode:
|
||||
QtGui.QMessageBox.information(self, self.tr("Export as Zip Archive"),
|
||||
self.tr("An error occure while exporting {0}. Batch operation aborted!".format(ca.path)))
|
||||
break
|
||||
original_path = os.path.abspath( ca.path )
|
||||
export_name = os.path.splitext(original_path)[0] + ".cbz"
|
||||
|
||||
if os.path.lexists( export_name ):
|
||||
if dlg.fileConflictBehavior == ExportConflictOpts.dontCreate:
|
||||
export_name = None
|
||||
elif dlg.fileConflictBehavior == ExportConflictOpts.createUnique:
|
||||
export_name = utils.unique_file( export_name )
|
||||
|
||||
if export_name is not None:
|
||||
if ca.exportAsZip( export_name ):
|
||||
if dlg.addToList:
|
||||
new_archives_to_add.append( export_name )
|
||||
if dlg.deleteOriginal:
|
||||
archives_to_remove.append( ca )
|
||||
os.unlink( ca.path )
|
||||
|
||||
else:
|
||||
QtGui.QMessageBox.information(self, self.tr("Export as Zip Archive"),
|
||||
self.tr("An error occured while exporting {0} to {1}. Batch operation aborted!".format(original_path, export_name)))
|
||||
break
|
||||
|
||||
progdialog.close()
|
||||
|
||||
progdialog.close()
|
||||
self.fileSelectionList.addPathList( new_archives_to_add )
|
||||
self.fileSelectionList.removeArchiveList( archives_to_remove )
|
||||
# ATB maybe show a summary of files created here...?
|
||||
|
||||
def aboutApp( self ):
|
||||
@ -1327,6 +1348,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
progdialog = QtGui.QProgressDialog("", "Cancel", 0, has_md_count, self)
|
||||
progdialog.setWindowTitle( "Removing Tags" )
|
||||
progdialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
progdialog.show()
|
||||
prog_idx = 0
|
||||
|
||||
for ca in ca_list:
|
||||
@ -1336,6 +1358,8 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
break
|
||||
prog_idx += 1
|
||||
progdialog.setValue(prog_idx)
|
||||
progdialog.setLabelText( ca.path )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
if ca.hasMetadata( style ) and ca.isWritable():
|
||||
if not ca.removeMetadata( style ):
|
||||
@ -1388,6 +1412,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
progdialog = QtGui.QProgressDialog("", "Cancel", 0, has_src_count, self)
|
||||
progdialog.setWindowTitle( "Copying Tags" )
|
||||
progdialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
progdialog.show()
|
||||
prog_idx = 0
|
||||
|
||||
for ca in ca_list:
|
||||
@ -1397,6 +1422,7 @@ class TaggerWindow( QtGui.QMainWindow):
|
||||
break
|
||||
prog_idx += 1
|
||||
progdialog.setValue(prog_idx)
|
||||
progdialog.setLabelText( ca.path )
|
||||
QtCore.QCoreApplication.processEvents()
|
||||
|
||||
if ca.hasMetadata( src_style ) and ca.isWritable():
|
||||
|
18
todo.txt
18
todo.txt
@ -4,29 +4,21 @@ Features
|
||||
|
||||
Multi-file:
|
||||
|
||||
File list:
|
||||
|
||||
Delete archive function??
|
||||
|
||||
Batch Functions:
|
||||
|
||||
Batch Auto-Select
|
||||
Start/Options Dialog
|
||||
Progress Dialog - maybe reuse
|
||||
-Show compared images to show progress in a sexy way
|
||||
Interactive dialog at end
|
||||
Summary Dialog
|
||||
|
||||
Export to CBZ:
|
||||
start dialog with:
|
||||
option to delete originals
|
||||
option to add to list
|
||||
option, when filename already exists:
|
||||
create new, unique file
|
||||
don't export
|
||||
over-write existing zip
|
||||
-- special case of misnamed RAR as cbz
|
||||
maybe show a summary of files created at end
|
||||
|
||||
Rename
|
||||
|
||||
check-box for rows?
|
||||
fix extensions?
|
||||
|
||||
Batch Tag Copy
|
||||
Disallow overwrites?
|
||||
|
Loading…
Reference in New Issue
Block a user