mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Open metadata editor after doubleclick on source (#1102)
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Double click on source to open it in metadata editor.</p></body></html></string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
|
||||
@@ -607,26 +607,26 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
GUI.jobList.addItem(fname)
|
||||
GUI.jobList.scrollToBottom()
|
||||
|
||||
def selectFileMetaEditor(self):
|
||||
sname = ''
|
||||
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
|
||||
dname = QFileDialog.getExistingDirectory(MW, 'Select directory', self.lastPath)
|
||||
if dname != '':
|
||||
sname = os.path.join(dname, 'ComicInfo.xml')
|
||||
self.lastPath = os.path.abspath(sname)
|
||||
else:
|
||||
if self.sevenzip:
|
||||
fname = QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||
'Comic (*.cbz *.cbr *.cb7)')
|
||||
def selectFileMetaEditor(self, sname):
|
||||
if not sname:
|
||||
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
|
||||
dname = QFileDialog.getExistingDirectory(MW, 'Select directory', self.lastPath)
|
||||
if dname != '':
|
||||
sname = os.path.join(dname, 'ComicInfo.xml')
|
||||
self.lastPath = os.path.dirname(sname)
|
||||
else:
|
||||
fname = ['']
|
||||
self.showDialog("Editor is disabled due to a lack of 7z.", 'error')
|
||||
self.addMessage('<a href="https://github.com/ciromattia/kcc#7-zip">Install 7z (link)</a>'
|
||||
' to enable metadata editing.', 'warning')
|
||||
if fname[0] != '':
|
||||
sname = fname[0]
|
||||
self.lastPath = os.path.abspath(os.path.join(sname, os.pardir))
|
||||
if sname != '':
|
||||
if self.sevenzip:
|
||||
fname = QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||
'Comic (*.cbz *.cbr *.cb7)')
|
||||
else:
|
||||
fname = ['']
|
||||
self.showDialog("Editor is disabled due to a lack of 7z.", 'error')
|
||||
self.addMessage('<a href="https://github.com/ciromattia/kcc#7-zip">Install 7z (link)</a>'
|
||||
' to enable metadata editing.', 'warning')
|
||||
if fname[0] != '':
|
||||
sname = fname[0]
|
||||
self.lastPath = os.path.abspath(os.path.join(sname, os.pardir))
|
||||
if sname:
|
||||
try:
|
||||
self.editor.loadData(sname)
|
||||
except Exception as err:
|
||||
@@ -767,6 +767,13 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
if value:
|
||||
GUI.titleEdit.setText(None)
|
||||
|
||||
def editSourceMetadata(self, item):
|
||||
if item.icon().isNull():
|
||||
sname = item.text()
|
||||
if os.path.isdir(sname):
|
||||
sname = os.path.join(sname, "ComicInfo.xml")
|
||||
self.selectFileMetaEditor(sname)
|
||||
|
||||
def changeGamma(self, value):
|
||||
valueRaw = int(5 * round(float(value) / 5))
|
||||
value = '%.2f' % (float(valueRaw) / 100)
|
||||
@@ -1282,6 +1289,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
||||
GUI.titleEdit.textChanged.connect(self.toggletitleEdit)
|
||||
GUI.fileFusionBox.stateChanged.connect(self.togglefileFusionBox)
|
||||
GUI.metadataTitleBox.stateChanged.connect(self.togglemetadataTitleBox)
|
||||
GUI.jobList.itemDoubleClicked.connect(self.editSourceMetadata)
|
||||
MW.progressBarTick.connect(self.updateProgressbar)
|
||||
MW.modeConvert.connect(self.modeConvert)
|
||||
MW.addMessage.connect(self.addMessage)
|
||||
|
||||
@@ -500,6 +500,9 @@ class Ui_mainWindow(object):
|
||||
|
||||
def retranslateUi(self, mainWindow):
|
||||
mainWindow.setWindowTitle(QCoreApplication.translate("mainWindow", u"Kindle Comic Converter", None))
|
||||
#if QT_CONFIG(tooltip)
|
||||
self.jobList.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p>Double click on source to open metadata editor.</p></body></html>", None))
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
#if QT_CONFIG(tooltip)
|
||||
self.editorButton.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p style='white-space:pre'>Shift+Click to edit directory.</p></body></html>", None))
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
|
||||
Reference in New Issue
Block a user