Multiple UI improvements
This commit is contained in:
@@ -50,6 +50,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
super(MainUI, self).__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
# Central Widget - Make borders disappear
|
||||
self.centralWidget().layout().setContentsMargins(0, 0, 0, 0)
|
||||
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
# Initialize translation function
|
||||
self._translate = QtCore.QCoreApplication.translate
|
||||
|
||||
@@ -78,7 +82,8 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.libraryFilterMenu = QtWidgets.QMenu()
|
||||
self.statusMessage = QtWidgets.QLabel()
|
||||
self.distractionFreeToggle = QtWidgets.QToolButton()
|
||||
self.reloadLibrary = QtWidgets.QToolButton()
|
||||
# self.reloadLibrary = QtWidgets.QToolButton()
|
||||
self.reloadLibrary = QtWidgets.QPushButton()
|
||||
|
||||
# Create the database in case it doesn't exist
|
||||
database.DatabaseInit(self.database_path)
|
||||
@@ -200,10 +205,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
print('Available parsers: ' + self.available_parsers)
|
||||
|
||||
# The library refresh button on the Library tab
|
||||
self.reloadLibrary.setFlat(True)
|
||||
self.reloadLibrary.setIcon(self.QImageFactory.get_image('reload'))
|
||||
self.reloadLibrary.setObjectName('reloadLibrary')
|
||||
self.reloadLibrary.setToolTip(self._translate('Main_UI', 'Scan library'))
|
||||
self.reloadLibrary.setAutoRaise(True)
|
||||
self.reloadLibrary.clicked.connect(self.settingsDialog.start_library_scan)
|
||||
|
||||
self.tabWidget.tabBar().setTabButton(
|
||||
@@ -434,7 +439,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
# First, calculate the number of images per row
|
||||
i = self.listView.viewport().width() / default_size
|
||||
rem = i - int(i)
|
||||
if rem >= .11875 and rem <= .9999:
|
||||
if rem >= .21875 and rem <= .9999:
|
||||
num_images = int(i)
|
||||
else:
|
||||
num_images = int(i) - 1
|
||||
@@ -1171,7 +1176,6 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
else:
|
||||
self.libraryFilterMenu.actions()[-1].setChecked(True)
|
||||
|
||||
# print(self.active_library_filters)
|
||||
self.lib_ref.update_proxymodels()
|
||||
|
||||
def toggle_distraction_free(self):
|
||||
@@ -1190,6 +1194,8 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.bookToolBar.setVisible(
|
||||
not self.bookToolBar.isVisible())
|
||||
|
||||
self.start_culling_timer()
|
||||
|
||||
def closeEvent(self, event=None):
|
||||
if event:
|
||||
event.ignore()
|
||||
|
@@ -101,7 +101,8 @@ class Settings:
|
||||
'dictionaryLanguage', 'en')
|
||||
self.parent.settings['caching_enabled'] = literal_eval(self.settings.value(
|
||||
'cachingEnabled', 'True').capitalize())
|
||||
|
||||
self.parent.settings['hide_scrollbars'] = literal_eval(self.settings.value(
|
||||
'hideScrollBars', 'False').capitalize())
|
||||
self.settings.endGroup()
|
||||
|
||||
self.settings.beginGroup('dialogSettings')
|
||||
@@ -171,6 +172,7 @@ class Settings:
|
||||
self.settings.setValue('performCulling', current_settings['perform_culling'])
|
||||
self.settings.setValue('dictionaryLanguage', current_settings['dictionary_language'])
|
||||
self.settings.setValue('cachingEnabled', current_settings['caching_enabled'])
|
||||
self.settings.setValue('hideScrollBars', current_settings['hide_scrollbars'])
|
||||
self.settings.endGroup()
|
||||
|
||||
self.settings.beginGroup('dialogSettings')
|
||||
|
@@ -91,6 +91,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
self.fileRemember.setChecked(self.parent.settings['remember_files'])
|
||||
self.performCulling.setChecked(self.parent.settings['perform_culling'])
|
||||
self.cachingEnabled.setChecked(self.parent.settings['caching_enabled'])
|
||||
self.hideScrollBars.setChecked(self.parent.settings['hide_scrollbars'])
|
||||
|
||||
self.autoTags.clicked.connect(self.manage_checkboxes)
|
||||
self.coverShadows.clicked.connect(self.manage_checkboxes)
|
||||
@@ -98,6 +99,7 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
self.fileRemember.clicked.connect(self.manage_checkboxes)
|
||||
self.performCulling.clicked.connect(self.manage_checkboxes)
|
||||
self.cachingEnabled.clicked.connect(self.manage_checkboxes)
|
||||
self.hideScrollBars.clicked.connect(self.manage_checkboxes)
|
||||
|
||||
# Generate the filesystem treeView
|
||||
self.generate_tree()
|
||||
@@ -284,7 +286,8 @@ class SettingsUI(QtWidgets.QDialog, settingswindow.Ui_Dialog):
|
||||
'refreshLibrary': 'scan_library',
|
||||
'fileRemember': 'remember_files',
|
||||
'performCulling': 'perform_culling',
|
||||
'cachingEnabled': 'caching_enabled',}
|
||||
'cachingEnabled': 'caching_enabled',
|
||||
'hideScrollBars': 'hide_scrollbars'}
|
||||
|
||||
self.parent.settings[sender_dict[sender]] = not self.parent.settings[sender_dict[sender]]
|
||||
|
||||
|
@@ -51,6 +51,7 @@ class Tab(QtWidgets.QWidget):
|
||||
self.main_window = self.window()
|
||||
|
||||
self.masterLayout = QtWidgets.QHBoxLayout(self)
|
||||
self.masterLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horzLayout = QtWidgets.QSplitter(self)
|
||||
self.horzLayout.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.masterLayout.addWidget(self.horzLayout)
|
||||
@@ -111,8 +112,13 @@ class Tab(QtWidgets.QWidget):
|
||||
self.contentView.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.contentView.setObjectName('contentView')
|
||||
self.contentView.verticalScrollBar().setSingleStep(7)
|
||||
self.contentView.setHorizontalScrollBarPolicy(
|
||||
QtCore.Qt.ScrollBarAsNeeded)
|
||||
|
||||
if self.main_window.settings['hide_scrollbars']:
|
||||
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.contentView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
else:
|
||||
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||
self.contentView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
|
||||
|
||||
# See bookmark availability
|
||||
if not self.metadata['bookmarks']:
|
||||
@@ -296,6 +302,10 @@ class Tab(QtWidgets.QWidget):
|
||||
# Hide the view modification buttons in case they're visible
|
||||
self.main_window.bookToolBar.customize_view_off()
|
||||
|
||||
# Exit distraction free mode too
|
||||
if not self.main_window.settings['show_bars']:
|
||||
self.main_window.toggle_distraction_free()
|
||||
|
||||
def change_chapter_tocBox(self):
|
||||
chapter_number = self.main_window.bookToolBar.tocBox.currentIndex()
|
||||
required_content = self.metadata['content'][chapter_number][1]
|
||||
|
@@ -63,35 +63,15 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTags">
|
||||
<widget class="QCheckBox" name="performCulling">
|
||||
<property name="toolTip">
|
||||
<string>Enabling reduces startup time and memory usage</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate tags from files</string>
|
||||
<string>Load covers only when needed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="languageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dictionary:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="languageBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -106,12 +86,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="performCulling">
|
||||
<property name="toolTip">
|
||||
<string>Enabling reduces startup time and memory usage</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="autoTags">
|
||||
<property name="text">
|
||||
<string>Load covers only when needed</string>
|
||||
<string>Generate tags from files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -125,12 +102,50 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="languageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dictionary:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="languageBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideScrollBars">
|
||||
<property name="toolTip">
|
||||
<string>Horizontal scrolling with Alt + Scroll
|
||||
Reopen book to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide scrollbars when reading</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string>Restart to see changes</string>
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Icon theme: </string>
|
||||
@@ -140,7 +155,7 @@
|
||||
<item>
|
||||
<widget class="QRadioButton" name="darkIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart to see changes</string>
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dar&k</string>
|
||||
@@ -150,7 +165,7 @@
|
||||
<item>
|
||||
<widget class="QRadioButton" name="lightIconsRadio">
|
||||
<property name="toolTip">
|
||||
<string>Restart to see changes</string>
|
||||
<string>Restart application to see changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Light</string>
|
||||
|
@@ -43,9 +43,25 @@ class Ui_Dialog(object):
|
||||
self.fileRemember = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.fileRemember.setObjectName("fileRemember")
|
||||
self.horizontalLayout_4.addWidget(self.fileRemember)
|
||||
self.performCulling = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.performCulling.setObjectName("performCulling")
|
||||
self.horizontalLayout_4.addWidget(self.performCulling)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.coverShadows = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.coverShadows.setObjectName("coverShadows")
|
||||
self.horizontalLayout.addWidget(self.coverShadows)
|
||||
self.autoTags = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.autoTags.setObjectName("autoTags")
|
||||
self.horizontalLayout_4.addWidget(self.autoTags)
|
||||
self.horizontalLayout.addWidget(self.autoTags)
|
||||
self.cachingEnabled = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.cachingEnabled.setObjectName("cachingEnabled")
|
||||
self.horizontalLayout.addWidget(self.cachingEnabled)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
|
||||
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.languageLabel = QtWidgets.QLabel(self.groupBox)
|
||||
@@ -60,20 +76,10 @@ class Ui_Dialog(object):
|
||||
self.languageBox = QtWidgets.QComboBox(self.groupBox)
|
||||
self.languageBox.setObjectName("languageBox")
|
||||
self.horizontalLayout_3.addWidget(self.languageBox)
|
||||
self.horizontalLayout_4.addLayout(self.horizontalLayout_3)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.coverShadows = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.coverShadows.setObjectName("coverShadows")
|
||||
self.horizontalLayout.addWidget(self.coverShadows)
|
||||
self.performCulling = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.performCulling.setObjectName("performCulling")
|
||||
self.horizontalLayout.addWidget(self.performCulling)
|
||||
self.cachingEnabled = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.cachingEnabled.setObjectName("cachingEnabled")
|
||||
self.horizontalLayout.addWidget(self.cachingEnabled)
|
||||
self.horizontalLayout_6.addLayout(self.horizontalLayout_3)
|
||||
self.hideScrollBars = QtWidgets.QCheckBox(self.groupBox)
|
||||
self.hideScrollBars.setObjectName("hideScrollBars")
|
||||
self.horizontalLayout_6.addWidget(self.hideScrollBars)
|
||||
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.label = QtWidgets.QLabel(self.groupBox)
|
||||
@@ -85,8 +91,8 @@ class Ui_Dialog(object):
|
||||
self.lightIconsRadio = QtWidgets.QRadioButton(self.groupBox)
|
||||
self.lightIconsRadio.setObjectName("lightIconsRadio")
|
||||
self.horizontalLayout_5.addWidget(self.lightIconsRadio)
|
||||
self.horizontalLayout.addLayout(self.horizontalLayout_5)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1)
|
||||
self.horizontalLayout_6.addLayout(self.horizontalLayout_5)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_6, 2, 0, 1, 1)
|
||||
self.verticalLayout_2.addWidget(self.groupBox)
|
||||
self.gridLayout_3.addLayout(self.verticalLayout_2, 0, 0, 1, 1)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
@@ -113,18 +119,21 @@ class Ui_Dialog(object):
|
||||
self.groupBox.setTitle(_translate("Dialog", "Switches"))
|
||||
self.refreshLibrary.setText(_translate("Dialog", "Startup: Refresh library"))
|
||||
self.fileRemember.setText(_translate("Dialog", "Remember open files"))
|
||||
self.autoTags.setText(_translate("Dialog", "Generate tags from files"))
|
||||
self.languageLabel.setText(_translate("Dialog", "Dictionary:"))
|
||||
self.coverShadows.setText(_translate("Dialog", "Cover shadows"))
|
||||
self.performCulling.setToolTip(_translate("Dialog", "Enabling reduces startup time and memory usage"))
|
||||
self.performCulling.setText(_translate("Dialog", "Load covers only when needed"))
|
||||
self.coverShadows.setText(_translate("Dialog", "Cover shadows"))
|
||||
self.autoTags.setText(_translate("Dialog", "Generate tags from files"))
|
||||
self.cachingEnabled.setToolTip(_translate("Dialog", "Greatly reduces page transition time at the cost of more memory"))
|
||||
self.cachingEnabled.setText(_translate("Dialog", "Cache comic / pdf pages"))
|
||||
self.label.setToolTip(_translate("Dialog", "Restart to see changes"))
|
||||
self.languageLabel.setText(_translate("Dialog", "Dictionary:"))
|
||||
self.hideScrollBars.setToolTip(_translate("Dialog", "Horizontal scrolling with Alt + Scroll\n"
|
||||
"Reopen book to see changes"))
|
||||
self.hideScrollBars.setText(_translate("Dialog", "Hide scrollbars when reading"))
|
||||
self.label.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.label.setText(_translate("Dialog", "Icon theme: "))
|
||||
self.darkIconsRadio.setToolTip(_translate("Dialog", "Restart to see changes"))
|
||||
self.darkIconsRadio.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.darkIconsRadio.setText(_translate("Dialog", "Dar&k"))
|
||||
self.lightIconsRadio.setToolTip(_translate("Dialog", "Restart to see changes"))
|
||||
self.lightIconsRadio.setToolTip(_translate("Dialog", "Restart application to see changes"))
|
||||
self.lightIconsRadio.setText(_translate("Dialog", "&Light"))
|
||||
self.okButton.setText(_translate("Dialog", "Scan Library"))
|
||||
self.cancelButton.setText(_translate("Dialog", "Close"))
|
||||
|
Reference in New Issue
Block a user