Merge branch 'feature/253-recalc-page-dims' of https://github.com/MichaelFitzurka/comictagger into MichaelFitzurka-feature/253-recalc-page-dims

This commit is contained in:
Timmy Welch 2022-04-10 11:00:10 -07:00
commit 5e06d35057
2 changed files with 26 additions and 0 deletions

View File

@ -360,6 +360,12 @@ Have fun!
self.actionApplyCBLTransform.setStatusTip("Modify tags specifically for CBL format")
self.actionApplyCBLTransform.triggered.connect(self.apply_cbl_transform)
self.actionReCalcPageDims.setShortcut("Ctrl+R")
self.actionReCalcPageDims.setStatusTip(
"Trigger re-calculating image size, height and width for all pages on the next save"
)
self.actionReCalcPageDims.triggered.connect(self.recalc_page_dimensions)
self.actionClearEntryForm.setShortcut("Ctrl+Shift+C")
self.actionClearEntryForm.setStatusTip("Clear all the data on the screen")
self.actionClearEntryForm.triggered.connect(self.clear_form)
@ -589,6 +595,7 @@ Please choose options below, and select OK.
self.actionAutoIdentify.setEnabled(False)
self.actionRename.setEnabled(False)
self.actionApplyCBLTransform.setEnabled(False)
self.actionReCalcPageDims.setEnabled(False)
# now, selectively re-enable
if self.comic_archive is not None:
@ -600,6 +607,7 @@ Please choose options below, and select OK.
self.actionAutoTag.setEnabled(True)
self.actionRename.setEnabled(True)
self.actionApplyCBLTransform.setEnabled(True)
self.actionReCalcPageDims.setEnabled(True)
self.actionRepackage.setEnabled(True)
self.actionRemoveAuto.setEnabled(True)
self.actionRemoveCRTags.setEnabled(True)
@ -1928,6 +1936,18 @@ Please choose options below, and select OK to Auto-Tag.
self.metadata = CBLTransformer(self.metadata, self.settings).apply()
self.metadata_to_form()
def recalc_page_dimensions(self):
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor))
for p in self.metadata.pages:
if "ImageSize" in p:
del p["ImageSize"]
if "ImageHeight" in p:
del p["ImageHeight"]
if "ImageWidth" in p:
del p["ImageWidth"]
self.set_dirty_flag()
QtWidgets.QApplication.restoreOverrideCursor()
def rename_archive(self):
ca_list = self.fileSelectionList.get_selected_archive_list()

View File

@ -1198,6 +1198,7 @@
<addaction name="actionAutoIdentify"/>
<addaction name="separator"/>
<addaction name="actionApplyCBLTransform"/>
<addaction name="actionReCalcPageDims"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
@ -1372,6 +1373,11 @@
<string>Apply CBL Transform</string>
</property>
</action>
<action name="actionReCalcPageDims">
<property name="text">
<string>Re-Calculate Page Dimensions</string>
</property>
</action>
<action name="actionLoadFolder">
<property name="text">
<string>Open Folder</string>