mirror of
https://github.com/ciromattia/kcc
synced 2025-12-15 10:46:40 +00:00
Allow metadata editor to embed directories
This commit is contained in:
@@ -320,6 +320,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p style='white-space:pre'>Shift+Click to edit directory.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="KCC.qrc">
|
<iconset resource="KCC.qrc">
|
||||||
<normaloff>:/Other/icons/editor.png</normaloff>:/Other/icons/editor.png</iconset>
|
<normaloff>:/Other/icons/editor.png</normaloff>:/Other/icons/editor.png</iconset>
|
||||||
@@ -454,7 +457,7 @@
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p style='white-space:pre'>Shift+Click to select the output directory.</p></body></html></string>
|
<string><html><head/><body><p style='white-space:pre'>Shift+Click to select the output directory.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Convert</string>
|
<string>Convert</string>
|
||||||
|
|||||||
@@ -500,28 +500,38 @@ class KCCGUI(KCC_ui.Ui_mainWindow):
|
|||||||
GUI.jobList.scrollToBottom()
|
GUI.jobList.scrollToBottom()
|
||||||
|
|
||||||
def selectFileMetaEditor(self):
|
def selectFileMetaEditor(self):
|
||||||
if self.UnRAR:
|
sname = ''
|
||||||
if self.sevenza:
|
if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ShiftModifier:
|
||||||
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
dname = QtWidgets.QFileDialog.getExistingDirectory(MW, 'Select directory', self.lastPath)
|
||||||
'Comic (*.cbz *.cbr *.cb7)')
|
if dname != '':
|
||||||
else:
|
sname = os.path.join(dname, 'ComicInfo.xml')
|
||||||
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
if sys.platform.startswith('win'):
|
||||||
'Comic (*.cbz *.cbr)')
|
sname = sname.replace('/', '\\')
|
||||||
|
self.lastPath = os.path.abspath(sname)
|
||||||
else:
|
else:
|
||||||
if self.sevenza:
|
if self.UnRAR:
|
||||||
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
if self.sevenza:
|
||||||
'Comic (*.cbz *.cb7)')
|
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||||
|
'Comic (*.cbz *.cbr *.cb7)')
|
||||||
|
else:
|
||||||
|
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||||
|
'Comic (*.cbz *.cbr)')
|
||||||
else:
|
else:
|
||||||
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
if self.sevenza:
|
||||||
'Comic (*.cbz)')
|
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||||
if fname[0] != '':
|
'Comic (*.cbz *.cb7)')
|
||||||
if sys.platform.startswith('win'):
|
else:
|
||||||
fname = fname[0].replace('/', '\\')
|
fname = QtWidgets.QFileDialog.getOpenFileName(MW, 'Select file', self.lastPath,
|
||||||
else:
|
'Comic (*.cbz)')
|
||||||
fname = fname[0]
|
if fname[0] != '':
|
||||||
self.lastPath = os.path.abspath(os.path.join(fname, os.pardir))
|
if sys.platform.startswith('win'):
|
||||||
|
sname = fname[0].replace('/', '\\')
|
||||||
|
else:
|
||||||
|
sname = fname[0]
|
||||||
|
self.lastPath = os.path.abspath(os.path.join(sname, os.pardir))
|
||||||
|
if sname != '':
|
||||||
try:
|
try:
|
||||||
self.editor.loadData(fname)
|
self.editor.loadData(sname)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
_, _, traceback = sys.exc_info()
|
_, _, traceback = sys.exc_info()
|
||||||
GUI.sentry.captureException()
|
GUI.sentry.captureException()
|
||||||
@@ -1109,7 +1119,10 @@ class KCCGUI_MetaEditor(KCC_ui_editor.Ui_editorDialog):
|
|||||||
for field in (self.writerLine, self.pencillerLine, self.inkerLine, self.coloristLine):
|
for field in (self.writerLine, self.pencillerLine, self.inkerLine, self.coloristLine):
|
||||||
field.setText(', '.join(self.parser.data[field.objectName().capitalize()[:-4] + 's']))
|
field.setText(', '.join(self.parser.data[field.objectName().capitalize()[:-4] + 's']))
|
||||||
if self.seriesLine.text() == '':
|
if self.seriesLine.text() == '':
|
||||||
self.seriesLine.setText(file.split('\\')[-1].split('/')[-1].split('.')[0])
|
if file.endswith('.xml'):
|
||||||
|
self.seriesLine.setText(file.split('\\')[-2])
|
||||||
|
else:
|
||||||
|
self.seriesLine.setText(file.split('\\')[-1].split('/')[-1].split('.')[0])
|
||||||
|
|
||||||
def saveData(self):
|
def saveData(self):
|
||||||
for field in (self.volumeLine, self.numberLine, self.muidLine):
|
for field in (self.volumeLine, self.numberLine, self.muidLine):
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ class Ui_mainWindow(object):
|
|||||||
self.colorBox.setText(_translate("mainWindow", "Color mode"))
|
self.colorBox.setText(_translate("mainWindow", "Color mode"))
|
||||||
self.gammaLabel.setText(_translate("mainWindow", "Gamma: Auto"))
|
self.gammaLabel.setText(_translate("mainWindow", "Gamma: Auto"))
|
||||||
self.editorButton.setText(_translate("mainWindow", "Editor"))
|
self.editorButton.setText(_translate("mainWindow", "Editor"))
|
||||||
|
self.editorButton.setToolTip(_translate("mainWindow", "<html><head/><body><p style=\'white-space:pre\'>Shift+Click to edit directory.</p></body></html>"))
|
||||||
self.wikiButton.setText(_translate("mainWindow", "Wiki"))
|
self.wikiButton.setText(_translate("mainWindow", "Wiki"))
|
||||||
self.directoryButton.setToolTip(_translate("mainWindow", "<html><head/><body><p style=\'white-space:pre\'>Add directory containing JPG, PNG or GIF files to queue.<br/><span style=\" font-weight:600;\">CBR, CBZ and CB7 files inside will not be processed!</span></p></body></html>"))
|
self.directoryButton.setToolTip(_translate("mainWindow", "<html><head/><body><p style=\'white-space:pre\'>Add directory containing JPG, PNG or GIF files to queue.<br/><span style=\" font-weight:600;\">CBR, CBZ and CB7 files inside will not be processed!</span></p></body></html>"))
|
||||||
self.directoryButton.setText(_translate("mainWindow", "Add directory"))
|
self.directoryButton.setText(_translate("mainWindow", "Add directory"))
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ class MetadataParser:
|
|||||||
'Bookmarks': []}
|
'Bookmarks': []}
|
||||||
self.rawdata = None
|
self.rawdata = None
|
||||||
self.compressor = None
|
self.compressor = None
|
||||||
if self.source.endswith('.xml'):
|
if self.source.endswith('.xml') and os.path.exists(self.source):
|
||||||
self.rawdata = parse(self.source)
|
self.rawdata = parse(self.source)
|
||||||
self.parseXML()
|
self.parseXML()
|
||||||
else:
|
elif not self.source.endswith('.xml'):
|
||||||
if is_zipfile(self.source):
|
if is_zipfile(self.source):
|
||||||
self.compressor = 'zip'
|
self.compressor = 'zip'
|
||||||
with ZipFile(self.source) as zip_file:
|
with ZipFile(self.source) as zip_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user