diff --git a/__main__.py b/__main__.py
index aef1fad..362cdad 100755
--- a/__main__.py
+++ b/__main__.py
@@ -32,6 +32,8 @@ from library import Library
from settings import Settings
from settingsdialog import SettingsUI
+from metadatadialog import MetadataUI
+
class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
def __init__(self):
@@ -68,6 +70,9 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
# Initialize settings dialog
self.settings_dialog = SettingsUI(self)
+ # Initialize metadata dialog
+ self.metadata_dialog = MetadataUI(self)
+
# Statusbar widgets
self.statusMessage.setObjectName('statusMessage')
self.statusBar.addPermanentWidget(self.statusMessage)
@@ -239,8 +244,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
def open_books_at_startup(self):
# Last open books and command line books aren't being opened together
- # so that command line books are processed last and therefore retain
- # focus
+ # so that command line books are processed last and therefore retain focus
# Open last... open books.
# Then set the value to None for the next run
@@ -360,6 +364,8 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
def test_function(self):
print('Caesar si viveret, ad remum dareris')
+ self.metadata_dialog.show()
+
def resizeEvent(self, event=None):
if event:
diff --git a/metadatadialog.py b/metadatadialog.py
new file mode 100644
index 0000000..c32011d
--- /dev/null
+++ b/metadatadialog.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+# This file is a part of Lector, a Qt based ebook reader
+# Copyright (C) 2017 BasioMeusPuga
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+from PyQt5 import QtWidgets, QtCore
+from resources import metadata
+
+class MetadataUI(QtWidgets.QDialog, metadata.Ui_Dialog):
+ def __init__(self, parent):
+ super(MetadataUI, self).__init__()
+ self.setupUi(self)
+
+ self.parent = parent
+ self.setWindowFlags(
+ QtCore.Qt.Window |
+ QtCore.Qt.WindowMinimizeButtonHint |
+ QtCore.Qt.WindowCloseButtonHint)
+ self.setFixedSize(self.width(), self.height())
diff --git a/resources/metadata.py b/resources/metadata.py
new file mode 100644
index 0000000..0d725ed
--- /dev/null
+++ b/resources/metadata.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'raw/metadata.ui'
+#
+# Created by: PyQt5 UI code generator 5.10
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(640, 212)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth())
+ Dialog.setSizePolicy(sizePolicy)
+ Dialog.setMaximumSize(QtCore.QSize(700, 212))
+ Dialog.setModal(True)
+ self.gridLayout = QtWidgets.QGridLayout(Dialog)
+ self.gridLayout.setObjectName("gridLayout")
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.coverView = QtWidgets.QGraphicsView(Dialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.coverView.sizePolicy().hasHeightForWidth())
+ self.coverView.setSizePolicy(sizePolicy)
+ self.coverView.setMinimumSize(QtCore.QSize(140, 200))
+ self.coverView.setMaximumSize(QtCore.QSize(140, 200))
+ self.coverView.setBaseSize(QtCore.QSize(140, 200))
+ self.coverView.setObjectName("coverView")
+ self.horizontalLayout.addWidget(self.coverView)
+ self.verticalLayout = QtWidgets.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.titleLine = QtWidgets.QLineEdit(Dialog)
+ self.titleLine.setObjectName("titleLine")
+ self.verticalLayout.addWidget(self.titleLine)
+ self.authorLine = QtWidgets.QLineEdit(Dialog)
+ self.authorLine.setObjectName("authorLine")
+ self.verticalLayout.addWidget(self.authorLine)
+ self.yearLine = QtWidgets.QLineEdit(Dialog)
+ self.yearLine.setObjectName("yearLine")
+ self.verticalLayout.addWidget(self.yearLine)
+ self.tagsLine = QtWidgets.QLineEdit(Dialog)
+ self.tagsLine.setMinimumSize(QtCore.QSize(0, 0))
+ self.tagsLine.setObjectName("tagsLine")
+ self.verticalLayout.addWidget(self.tagsLine)
+ self.horizontalLayout.addLayout(self.verticalLayout)
+ self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "Edit metadata"))
+ self.titleLine.setPlaceholderText(_translate("Dialog", "Title"))
+ self.authorLine.setPlaceholderText(_translate("Dialog", "Author"))
+ self.yearLine.setPlaceholderText(_translate("Dialog", "Year"))
+ self.tagsLine.setPlaceholderText(_translate("Dialog", "Tags"))
+
diff --git a/resources/raw/metadata.ui b/resources/raw/metadata.ui
new file mode 100644
index 0000000..40c2dea
--- /dev/null
+++ b/resources/raw/metadata.ui
@@ -0,0 +1,106 @@
+
+
+ Dialog
+
+
+
+ 0
+ 0
+ 640
+ 212
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 700
+ 212
+
+
+
+ Edit metadata
+
+
+ true
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 140
+ 200
+
+
+
+
+ 140
+ 200
+
+
+
+
+ 140
+ 200
+
+
+
+
+ -
+
+
-
+
+
+ Title
+
+
+
+ -
+
+
+ Author
+
+
+
+ -
+
+
+ Year
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Tags
+
+
+
+
+
+
+
+
+
+
+
+