Initial commit
This commit is contained in:
92
__main__.py
Executable file
92
__main__.py
Executable file
@@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
""" TODO
|
||||||
|
Define every widget in code because you're going to need to create separate tabs
|
||||||
|
Override the keypress event of the textedit
|
||||||
|
Goodreads API: Ratings, Read, Recommendations
|
||||||
|
Get ISBN using python-isbnlib
|
||||||
|
Theming
|
||||||
|
Pagination
|
||||||
|
sqlite3 for storing metadata
|
||||||
|
Drop down for TOC
|
||||||
|
Recursive file addition
|
||||||
|
Get cover images
|
||||||
|
Set context menu for definitions and the like
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
||||||
|
import mainwindow
|
||||||
|
|
||||||
|
|
||||||
|
class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super(self.__class__, self).__init__()
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
# Toolbar setup
|
||||||
|
self.BookToolBar.hide()
|
||||||
|
fullscreenButton = QtWidgets.QAction(
|
||||||
|
QtGui.QIcon.fromTheme('view-fullscreen'), 'Fullscreen', self)
|
||||||
|
self.BookToolBar.addAction(fullscreenButton)
|
||||||
|
fullscreenButton.triggered.connect(self.set_fullscreen)
|
||||||
|
|
||||||
|
# LibraryToolBar buttons
|
||||||
|
addButton = QtWidgets.QAction(QtGui.QIcon.fromTheme('add'), 'Add book', self)
|
||||||
|
deleteButton = QtWidgets.QAction(QtGui.QIcon.fromTheme('remove'), 'Delete book', self)
|
||||||
|
settingsButton = QtWidgets.QAction(QtGui.QIcon.fromTheme('settings'), 'Settings', self)
|
||||||
|
|
||||||
|
self.LibraryToolBar.addAction(addButton)
|
||||||
|
self.LibraryToolBar.addAction(deleteButton)
|
||||||
|
self.LibraryToolBar.addSeparator()
|
||||||
|
self.LibraryToolBar.addAction(settingsButton)
|
||||||
|
|
||||||
|
self.textEdit.setText('asdasds')
|
||||||
|
|
||||||
|
self.exit_shortcut = QtWidgets.QShortcut(QtGui.QKeySequence('Escape'), self)
|
||||||
|
self.exit_shortcut.activated.connect(self.set_normalsize)
|
||||||
|
|
||||||
|
# Toolbar switching
|
||||||
|
self.tabWidget.currentChanged.connect(self.toolbar_switch)
|
||||||
|
|
||||||
|
def toolbar_switch(self):
|
||||||
|
if self.tabWidget.currentIndex() == 0:
|
||||||
|
self.BookToolBar.hide()
|
||||||
|
self.LibraryToolBar.show()
|
||||||
|
else:
|
||||||
|
self.BookToolBar.show()
|
||||||
|
self.LibraryToolBar.hide()
|
||||||
|
|
||||||
|
|
||||||
|
def set_fullscreen(self):
|
||||||
|
|
||||||
|
scr = QtGui.QGuiApplication.primaryScreen()
|
||||||
|
agm = QtGui.QScreen.availableGeometry(scr)
|
||||||
|
self.textEdit.setParent(self)
|
||||||
|
self.textEdit.setGeometry(agm)
|
||||||
|
self.textEdit.showFullScreen()
|
||||||
|
self.showFullScreen()
|
||||||
|
|
||||||
|
def set_normalsize(self):
|
||||||
|
self.textEdit.setParent(self.tab_2)
|
||||||
|
self.textEdit.showNormal()
|
||||||
|
self.showNormal()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wutface():
|
||||||
|
print('huh?')
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
form = MainUI()
|
||||||
|
form.show()
|
||||||
|
form.textEdit.showFullScreen()
|
||||||
|
app.exec_()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
66
mainwindow.py
Normal file
66
mainwindow.py
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'resources/main.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.9
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(800, 600)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
|
||||||
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
|
||||||
|
self.tabWidget.setTabsClosable(True)
|
||||||
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
|
self.tab = QtWidgets.QWidget()
|
||||||
|
self.tab.setObjectName("tab")
|
||||||
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.tab)
|
||||||
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1)
|
||||||
|
self.tabWidget.addTab(self.tab, "")
|
||||||
|
self.tab_2 = QtWidgets.QWidget()
|
||||||
|
self.tab_2.setObjectName("tab_2")
|
||||||
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_2)
|
||||||
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
|
self.textEdit = QtWidgets.QTextEdit(self.tab_2)
|
||||||
|
self.textEdit.setObjectName("textEdit")
|
||||||
|
self.gridLayout_3.addWidget(self.textEdit, 0, 0, 1, 1)
|
||||||
|
self.tabWidget.addTab(self.tab_2, "")
|
||||||
|
self.horizontalLayout.addWidget(self.tabWidget)
|
||||||
|
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
self.LibraryToolBar = QtWidgets.QToolBar(MainWindow)
|
||||||
|
self.LibraryToolBar.setMovable(False)
|
||||||
|
self.LibraryToolBar.setIconSize(QtCore.QSize(22, 22))
|
||||||
|
self.LibraryToolBar.setFloatable(False)
|
||||||
|
self.LibraryToolBar.setObjectName("LibraryToolBar")
|
||||||
|
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.LibraryToolBar)
|
||||||
|
self.BookToolBar = QtWidgets.QToolBar(MainWindow)
|
||||||
|
self.BookToolBar.setMovable(False)
|
||||||
|
self.BookToolBar.setFloatable(False)
|
||||||
|
self.BookToolBar.setObjectName("BookToolBar")
|
||||||
|
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.BookToolBar)
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "Lector"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Library"))
|
||||||
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Read"))
|
||||||
|
self.LibraryToolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
|
||||||
|
self.BookToolBar.setWindowTitle(_translate("MainWindow", "toolBar_2"))
|
||||||
|
|
97
resources/main.ui
Normal file
97
resources/main.ui
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Lector</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="tabsClosable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Library</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Read</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QTextEdit" name="textEdit"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="LibraryToolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<property name="movable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>22</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="floatable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="BookToolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar_2</string>
|
||||||
|
</property>
|
||||||
|
<property name="movable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="floatable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Reference in New Issue
Block a user