Open first page for no position entry

This commit is contained in:
BasioMeusPuga
2017-11-13 11:34:09 +05:30
parent dcd8f12147
commit cee1afbf02
2 changed files with 20 additions and 16 deletions

View File

@@ -29,11 +29,11 @@
✓ Use format* icons for toolbar buttons
✓ Implement book view settings with a(nother) toolbar
✓ Substitute textedit for another widget
Theming
Theming
✓ Keep fontsize and margins consistent - Let page increase in length
All ebooks should first be added to the database and then returned as HTML
Pagination
Set context menu for definitions and the like
Keep fontsize and margins consistent - Let page increase in length
Filetypes:
? Plugin system for parsers
? pdf support
@@ -66,7 +66,7 @@ from subclasses import Settings, Library
class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
def __init__(self):
super(self.__class__, self).__init__()
super(MainUI, self).__init__()
self.setupUi(self)
# Initialize application
@@ -97,16 +97,17 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
self.bookToolBar = BookToolBar(self)
self.bookToolBar.fullscreenButton.triggered.connect(self.set_fullscreen)
for count, i in enumerate(self.display_profiles):
self.bookToolBar.profileBox.setItemData(count, i, QtCore.Qt.UserRole)
self.bookToolBar.profileBox.currentIndexChanged.connect(self.format_contentView)
self.bookToolBar.profileBox.setCurrentIndex(self.current_profile_index)
self.bookToolBar.fontBox.currentFontChanged.connect(self.modify_font)
self.bookToolBar.fontSizeBox.currentTextChanged.connect(self.modify_font)
self.bookToolBar.lineSpacingUp.triggered.connect(self.modify_font)
self.bookToolBar.lineSpacingDown.triggered.connect(self.modify_font)
self.bookToolBar.paddingUp.triggered.connect(self.modify_font)
self.bookToolBar.paddingDown.triggered.connect(self.modify_font)
for count, i in enumerate(self.display_profiles):
self.bookToolBar.profileBox.setItemData(count, i, QtCore.Qt.UserRole)
self.bookToolBar.profileBox.currentIndexChanged.connect(self.format_contentView)
self.bookToolBar.profileBox.setCurrentIndex(self.current_profile_index)
self.bookToolBar.colorBoxFG.clicked.connect(self.get_color)
self.bookToolBar.colorBoxBG.clicked.connect(self.get_color)

View File

@@ -68,9 +68,9 @@ class BookToolBar(QtWidgets.QToolBar):
self.colorBoxFG = FixedPushButton(self)
self.colorBoxFG.setObjectName('fgColor')
self.colorBoxFG.setToolTip('Set foreground color')
self.colorBoxFG.setToolTip('Text color')
self.colorBoxBG = FixedPushButton(self)
self.colorBoxBG.setToolTip('Set background color')
self.colorBoxBG.setToolTip('Background color')
self.colorBoxBG.setObjectName('bgColor')
profiles = ['Profile 1', 'Profile 2', 'Profile 3']
@@ -266,10 +266,6 @@ class Tab(QtWidgets.QWidget):
super(Tab, self).__init__(parent)
self.parent = parent
self.metadata = metadata # Save progress data into this dictionary
# self.setStyleSheet("background-color: black")
title = self.metadata['title']
path = self.metadata['path']
self.gridLayout = QtWidgets.QGridLayout(self)
self.gridLayout.setObjectName("gridLayout")
@@ -277,11 +273,18 @@ class Tab(QtWidgets.QWidget):
self.contentView.setFrameShape(QtWidgets.QFrame.NoFrame)
self.contentView.setObjectName("contentView")
self.contentView.verticalScrollBar().setSingleStep(7)
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
title = self.metadata['title']
position = self.metadata['position']
if not position:
first_chapter_name = list(self.metadata['content'])[0]
first_chapter_content = self.metadata['content'][first_chapter_name]
self.contentView.setHtml(first_chapter_content)
self.contentView.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)
self.gridLayout.addWidget(self.contentView, 0, 0, 1, 1)
self.parent.addTab(self, title)
# self.contentView.setStyleSheet(
# "QTextEdit {font-size:20px; padding-left:100; padding-right:100; background-color:black}")
class LibraryDelegate(QtWidgets.QStyledItemDelegate):