Initial commit

This commit is contained in:
BasioMeusPuga
2017-11-03 21:33:32 +05:30
parent 1b452d33cc
commit b7d130f96b
3 changed files with 255 additions and 0 deletions

92
__main__.py Executable file
View 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()