250 mainP = Path(os.path.abspath(__file__)).parent
252 extraKeyP = Path(QDir.homePath()) / Application.readSetting(self.
configGroup,
"extraKeysLocation", str())
256 self.setLayout(QVBoxLayout())
257 mainWidget = QTabWidget()
258 self.layout().addWidget(mainWidget)
259 self.setWindowTitle(i18n(
"Comic Metadata"))
260 buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
261 self.layout().addWidget(buttons)
266 metadataPage = QWidget()
267 mformLayout = QFormLayout()
268 metadataPage.setLayout(mformLayout)
271 self.
lnTitle.setToolTip(i18n(
"The proper title of the comic."))
274 self.
teSummary.setToolTip(i18n(
"What will you tell others to entice them to read your comic?"))
278 genreCompletion.setModel(QStringListModel(self.
genreKeysList))
279 self.
lnGenre.setCompleter(genreCompletion)
280 genreCompletion.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive)
281 self.
lnGenre.setToolTip(i18n(
"The genre of the work. Prefilled values are from the ACBF, but you can fill in your own. Separate genres with commas. Try to limit the amount to about two or three."))
286 characterCompletion.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive)
287 characterCompletion.setFilterMode(Qt.MatchFlag.MatchContains)
289 self.
lnCharacters.setToolTip(i18n(
"The names of the characters that this comic revolves around. Comma-separated."))
294 formatCompletion.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive)
295 self.
lnFormat.setCompleter(formatCompletion)
297 ratingLayout = QHBoxLayout()
308 self.
lnSeriesName.setToolTip(i18n(
"If this is part of a series, enter the name of the series and the number."))
313 seriesLayout = QHBoxLayout()
319 otherCompletion.setModel(QStringListModel(self.
otherKeysList))
320 otherCompletion.setCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive)
321 otherCompletion.setFilterMode(Qt.MatchFlag.MatchContains)
324 self.
lnOtherKeywords.setToolTip(i18n(
"Other keywords that do not fit in the previously mentioned sets. As always, comma-separated."))
334 self.
cmbCoverPage.setToolTip(i18n(
"Which page is the cover page? This will be empty if there are no pages."))
336 mformLayout.addRow(i18n(
"Title:"), self.
lnTitle)
337 mformLayout.addRow(i18n(
"Cover page:"), self.
cmbCoverPage)
338 mformLayout.addRow(i18n(
"Summary:"), self.
teSummary)
339 mformLayout.addRow(i18n(
"Language:"), self.
cmbLanguage)
341 mformLayout.addRow(i18n(
"Reading direction:"), self.
cmbReadingMode)
342 mformLayout.addRow(i18n(
"Genre:"), self.
lnGenre)
343 mformLayout.addRow(i18n(
"Characters:"), self.
lnCharacters)
344 mformLayout.addRow(i18n(
"Format:"), self.
lnFormat)
345 mformLayout.addRow(i18n(
"Rating:"), ratingLayout)
346 mformLayout.addRow(i18n(
"Series:"), seriesLayout)
349 mainWidget.addTab(metadataPage, i18n(
"Work"))
352 authorPage = QWidget()
353 authorPage.setLayout(QVBoxLayout())
354 explanation = QLabel(i18n(
"The following is a table of the authors that contributed to this comic. You can set their nickname, proper names (first, middle, last), role (penciller, inker, etc), email and homepage."))
355 explanation.setWordWrap(
True)
357 labels = [i18n(
"Nick Name"), i18n(
"Given Name"), i18n(
"Middle Name"), i18n(
"Family Name"), i18n(
"Role"), i18n(
"Email"), i18n(
"Homepage"), i18n(
"Language")]
361 self.
authorTable.verticalHeader().setDragEnabled(
True)
362 self.
authorTable.verticalHeader().setDropIndicatorShown(
True)
363 self.
authorTable.verticalHeader().setSectionsMovable(
True)
367 delegate.setLanguageData(len(labels) - 1)
369 author_button_layout = QWidget()
370 author_button_layout.setLayout(QHBoxLayout())
371 btn_add_author = QPushButton(i18n(
"Add Author"))
373 btn_remove_author = QPushButton(i18n(
"Remove Author"))
375 author_button_layout.layout().addWidget(btn_add_author)
376 author_button_layout.layout().addWidget(btn_remove_author)
377 authorPage.layout().addWidget(explanation)
379 authorPage.layout().addWidget(author_button_layout)
380 mainWidget.addTab(authorPage, i18n(
"Authors"))
383 publisherPage = QWidget()
384 publisherLayout = QFormLayout()
385 publisherPage.setLayout(publisherLayout)
387 self.
publisherName.setToolTip(i18n(
"The name of the company, group or person who is responsible for the final version the reader gets."))
388 publishDateLayout = QHBoxLayout()
390 self.
publishDate.setDisplayFormat(QLocale().system().dateFormat())
391 currentDate = QPushButton(i18n(
"Set Today"))
392 currentDate.setToolTip(i18n(
"Sets the publish date to the current date."))
395 publishDateLayout.addWidget(currentDate)
397 self.
publishCity.setToolTip(i18n(
"Traditional publishers are always mentioned in source with the city they are located."))
401 self.
license.completer().setCompletionMode(QCompleter.CompletionMode.PopupCompletion)
402 dataBaseReference = QVBoxLayout()
404 self.
ln_database_name.setToolTip(i18n(
"If there is an entry in a comics data base, that should be added here. It is unlikely to be a factor for comics from scratch, but useful when doing a conversion."))
409 self.
ln_source.setToolTip(i18n(
"Whether the comic is an adaptation of an existing source, and if so, how to find information about that source. So for example, for an adapted webcomic, the official website url should go here."))
411 self.
label_uuid.setToolTip(i18n(
"By default this will be filled with a generated universal unique identifier. The ID by itself is merely so that comic book library management programs can figure out if this particular comic is already in their database and whether it has been rated. Of course, the UUID can be changed into something else by manually changing the JSON, but this is advanced usage."))
413 dbHorizontal = QHBoxLayout()
416 dataBaseReference.addLayout(dbHorizontal)
419 publisherLayout.addRow(i18n(
"City:"), self.
publishCity)
420 publisherLayout.addRow(i18n(
"Date:"), publishDateLayout)
421 publisherLayout.addRow(i18n(
"ISBN:"), self.
isbn)
422 publisherLayout.addRow(i18n(
"Source:"), self.
ln_source)
423 publisherLayout.addRow(i18n(
"UUID:"), self.
label_uuid)
424 publisherLayout.addRow(i18n(
"License:"), self.
license)
425 publisherLayout.addRow(i18n(
"Database:"), dataBaseReference)
427 mainWidget.addTab(publisherPage, i18n(
"Publisher"))
565 if "title" in config.keys():
566 self.
lnTitle.setText(config[
"title"])
568 if "pages" in config.keys():
570 for page
in config[
"pages"]:
572 if "cover" in config.keys():
573 if config[
"cover"]
in config[
"pages"]:
575 if "summary" in config.keys():
576 self.
teSummary.appendPlainText(config[
"summary"])
577 if "genre" in config.keys():
579 genreListConf = config[
"genre"]
581 if isinstance(config[
"genre"], dict):
582 genreListConf = config[
"genre"].keys()
584 for genre
in genreListConf:
588 if isinstance(config[
"genre"], dict):
589 genreValue = config[
"genre"][genre]
591 genreKey = str(genreKey +
"(" + str(genreValue) +
")")
592 genreList.append(genreKey)
593 self.
lnGenre.setText(
", ".join(genreList))
594 if "characters" in config.keys():
595 self.
lnCharacters.setText(
", ".join(config[
"characters"]))
596 if "format" in config.keys():
597 self.
lnFormat.setText(
", ".join(config[
"format"]))
598 if "rating" in config.keys():
599 self.
cmbRating.setCurrentText(config[
"rating"])
602 if "ratingSystem" in config.keys():
606 if "otherKeywords" in config.keys():
608 if "seriesName" in config.keys():
610 if "seriesVolume" in config.keys():
612 if "seriesNumber" in config.keys():
614 if "language" in config.keys():
615 code = config[
"language"]
617 self.
cmbLanguage.setEntryToCode(code.split(
"_")[0])
618 self.
cmbCountry.setEntryToCode(code.split(
"_")[-1])
620 self.
cmbLanguage.setEntryToCode(code.split(
"-")[0])
621 self.
cmbCountry.setEntryToCode(code.split(
"-")[-1])
624 if "readingDirection" in config.keys():
625 if QLibraryInfo.version().majorVersion() == 6:
626 if config[
"readingDirection"] ==
"leftToRight":
627 self.
cmbReadingMode.setCurrentIndex(Qt.LayoutDirection.LeftToRight.value)
629 self.
cmbReadingMode.setCurrentIndex(Qt.LayoutDirection.RightToLeft.value)
631 if config[
"readingDirection"] ==
"leftToRight":
632 self.
cmbReadingMode.setCurrentIndex(Qt.LayoutDirection.LeftToRight)
634 self.
cmbReadingMode.setCurrentIndex(Qt.LayoutDirection.RightToLeft)
636 if QLibraryInfo.version().majorVersion() == 6:
640 if "publisherName" in config.keys():
642 if "publisherCity" in config.keys():
644 if "publishingDate" in config.keys():
645 self.
publishDate.setDate(QDate.fromString(config[
"publishingDate"], Qt.DateFormat.ISODate))
646 if "isbn-number" in config.keys():
647 self.
isbn.setText(config[
"isbn-number"])
648 if "source" in config.keys():
650 elif "acbfSource" in config.keys():
651 self.
ln_source.setText(config[
"acbfSource"])
652 if "uuid" in config.keys():
656 if "acbfID" in config.keys():
657 uuid = config[
"acbfID"]
658 uuid = uuid.strip(
"{")
659 uuid = uuid.strip(
"}")
660 uuidVerify = uuid.split(
"-")
661 if len(uuidVerify[0])!=8
or len(uuidVerify[1])!=4
or len(uuidVerify[2])!=4
or len(uuidVerify[3])!=4
or len(uuidVerify[4])!=12:
662 uuid = QUuid.createUuid().toString()
664 config[
"uuid"] = uuid
665 if "license" in config.keys():
666 self.
license.setCurrentText(config[
"license"])
668 self.
license.setCurrentText(
"")
669 if "authorList" in config.keys():
670 authorList = config[
"authorList"]
671 for i
in range(len(authorList)):
672 author = authorList[i]
673 if len(author.keys()) > 0:
676 listItems.append(QStandardItem(author.get(
"nickname",
"")))
677 listItems.append(QStandardItem(author.get(
"first-name",
"")))
678 listItems.append(QStandardItem(author.get(
"initials",
"")))
679 listItems.append(QStandardItem(author.get(
"last-name",
"")))
680 role = author.get(
"role",
"")
683 listItems.append(QStandardItem(role))
684 listItems.append(QStandardItem(author.get(
"email",
"")))
685 listItems.append(QStandardItem(author.get(
"homepage",
"")))
686 listItems.append(QStandardItem(author.get(
"language",
"")))
690 dbRef = config.get(
"databaseReference", {})
694 self.
cmb_entry_type.setCurrentText(dbRef.get(
"type", stringCmbEntryType))