Change library background color
This commit is contained in:
9
TODO
9
TODO
@@ -20,12 +20,11 @@ TODO
|
|||||||
✓ Memory management
|
✓ Memory management
|
||||||
✓ Mass tagging
|
✓ Mass tagging
|
||||||
✓ Add capability to sort by new
|
✓ Add capability to sort by new
|
||||||
Table view
|
✓ Table view
|
||||||
Ignore a / the / numbers for sorting purposes
|
|
||||||
Information dialog widget
|
|
||||||
Context menu: Cache, Read, Edit database, delete, Mark read/unread
|
Context menu: Cache, Read, Edit database, delete, Mark read/unread
|
||||||
Set focus to newly added file
|
Information dialog widget
|
||||||
Allow editing of database data through the UI + for Bookmarks
|
Allow editing of database data through the UI + for Bookmarks
|
||||||
|
Set focus to newly added file
|
||||||
Reading:
|
Reading:
|
||||||
✓ Drop down for TOC
|
✓ Drop down for TOC
|
||||||
✓ Override the keypress event of the textedit
|
✓ Override the keypress event of the textedit
|
||||||
@@ -42,6 +41,7 @@ TODO
|
|||||||
✓ Line spacing
|
✓ Line spacing
|
||||||
✓ Record progress
|
✓ Record progress
|
||||||
✓ Text alignment
|
✓ Text alignment
|
||||||
|
Background color
|
||||||
Bookmarks
|
Bookmarks
|
||||||
✓ Creation
|
✓ Creation
|
||||||
✓ Navigation
|
✓ Navigation
|
||||||
@@ -83,3 +83,4 @@ TODO
|
|||||||
Include icons for filetype emblems
|
Include icons for filetype emblems
|
||||||
Drag and drop support for the library
|
Drag and drop support for the library
|
||||||
Leave comic images on disk in case tab isn't closed and files are remembered
|
Leave comic images on disk in case tab isn't closed and files are remembered
|
||||||
|
Ignore a / the / numbers for sorting purposes
|
40
__main__.py
40
__main__.py
@@ -84,6 +84,7 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.statusBar.addWidget(self.sorterProgress)
|
self.statusBar.addWidget(self.sorterProgress)
|
||||||
self.sorterProgress.setVisible(False)
|
self.sorterProgress.setVisible(False)
|
||||||
|
|
||||||
|
# Statusbar - Toolbar Visibility
|
||||||
self.toolbarToggle.setIcon(QtGui.QIcon.fromTheme('visibility'))
|
self.toolbarToggle.setIcon(QtGui.QIcon.fromTheme('visibility'))
|
||||||
self.toolbarToggle.setObjectName('toolbarToggle')
|
self.toolbarToggle.setObjectName('toolbarToggle')
|
||||||
self.toolbarToggle.setToolTip('Toggle toolbar')
|
self.toolbarToggle.setToolTip('Toggle toolbar')
|
||||||
@@ -91,6 +92,15 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.toolbarToggle.clicked.connect(self.toggle_toolbars)
|
self.toolbarToggle.clicked.connect(self.toggle_toolbars)
|
||||||
self.statusBar.addPermanentWidget(self.toolbarToggle)
|
self.statusBar.addPermanentWidget(self.toolbarToggle)
|
||||||
|
|
||||||
|
# Statusbar - Library background
|
||||||
|
self.libraryBackground = QtWidgets.QToolButton()
|
||||||
|
self.libraryBackground.setIcon(QtGui.QIcon.fromTheme('color-management'))
|
||||||
|
self.libraryBackground.setObjectName('libraryBackground')
|
||||||
|
self.libraryBackground.setToolTip('Change library background color')
|
||||||
|
self.libraryBackground.setAutoRaise(True)
|
||||||
|
self.libraryBackground.clicked.connect(self.get_color)
|
||||||
|
self.statusBar.addPermanentWidget(self.libraryBackground)
|
||||||
|
|
||||||
# THIS IS TEMPORARY
|
# THIS IS TEMPORARY
|
||||||
self.guiTest = QtWidgets.QToolButton()
|
self.guiTest = QtWidgets.QToolButton()
|
||||||
self.guiTest.setIcon(QtGui.QIcon.fromTheme('mail-thread-watch'))
|
self.guiTest.setIcon(QtGui.QIcon.fromTheme('mail-thread-watch'))
|
||||||
@@ -211,6 +221,10 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
self.listView.setItemDelegate(LibraryDelegate(self.temp_dir.path(), self))
|
self.listView.setItemDelegate(LibraryDelegate(self.temp_dir.path(), self))
|
||||||
self.listView.verticalScrollBar().valueChanged.connect(self.start_culling_timer)
|
self.listView.verticalScrollBar().valueChanged.connect(self.start_culling_timer)
|
||||||
|
|
||||||
|
self.listView.setStyleSheet(
|
||||||
|
"QListView {{background-color: {0}}}".format(
|
||||||
|
self.settings['listview_background'].name()))
|
||||||
|
|
||||||
# TableView
|
# TableView
|
||||||
self.tableView.doubleClicked.connect(self.library_doubleclick)
|
self.tableView.doubleClicked.connect(self.library_doubleclick)
|
||||||
self.tableView.horizontalHeader().setSectionResizeMode(
|
self.tableView.horizontalHeader().setSectionResizeMode(
|
||||||
@@ -367,7 +381,6 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
print('Caesar si viveret, ad remum dareris')
|
print('Caesar si viveret, ad remum dareris')
|
||||||
self.metadata_dialog.show()
|
self.metadata_dialog.show()
|
||||||
|
|
||||||
|
|
||||||
def resizeEvent(self, event=None):
|
def resizeEvent(self, event=None):
|
||||||
if event:
|
if event:
|
||||||
# This implies a vertical resize event only
|
# This implies a vertical resize event only
|
||||||
@@ -429,15 +442,13 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
|
|
||||||
def delete_books(self):
|
def delete_books(self):
|
||||||
# TODO
|
# TODO
|
||||||
# Implement this for the tableview
|
# ? Mirror selection
|
||||||
# The same process can be used to mirror selection
|
|
||||||
# Ask if library files are to be excluded from further scans
|
# Ask if library files are to be excluded from further scans
|
||||||
# Make a checkbox for this
|
# Make a checkbox for this
|
||||||
|
|
||||||
# Get a list of QItemSelection objects
|
# Get a list of QItemSelection objects
|
||||||
# What we're interested in is the indexes()[0] in each of them
|
# What we're interested in is the indexes()[0] in each of them
|
||||||
# That gives a list of indexes from the view model
|
# That gives a list of indexes from the view model
|
||||||
|
|
||||||
if self.listView.isVisible():
|
if self.listView.isVisible():
|
||||||
selected_books = self.lib_ref.item_proxy_model.mapSelectionToSource(
|
selected_books = self.lib_ref.item_proxy_model.mapSelectionToSource(
|
||||||
self.listView.selectionModel().selection())
|
self.listView.selectionModel().selection())
|
||||||
@@ -711,12 +722,6 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
# def dropEvent
|
# def dropEvent
|
||||||
|
|
||||||
def get_color(self):
|
def get_color(self):
|
||||||
signal_sender = self.sender().objectName()
|
|
||||||
profile_index = self.bookToolBar.profileBox.currentIndex()
|
|
||||||
current_profile = self.bookToolBar.profileBox.itemData(
|
|
||||||
profile_index, QtCore.Qt.UserRole)
|
|
||||||
|
|
||||||
# Retain current values on opening a new dialog
|
|
||||||
def open_color_dialog(current_color):
|
def open_color_dialog(current_color):
|
||||||
color_dialog = QtWidgets.QColorDialog()
|
color_dialog = QtWidgets.QColorDialog()
|
||||||
new_color = color_dialog.getColor(current_color)
|
new_color = color_dialog.getColor(current_color)
|
||||||
@@ -725,6 +730,21 @@ class MainUI(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
return current_color
|
return current_color
|
||||||
|
|
||||||
|
signal_sender = self.sender().objectName()
|
||||||
|
|
||||||
|
if signal_sender == 'libraryBackground':
|
||||||
|
current_color = self.settings['listview_background']
|
||||||
|
new_color = open_color_dialog(current_color)
|
||||||
|
self.listView.setStyleSheet("QListView {{background-color: {0}}}".format(
|
||||||
|
new_color.name()))
|
||||||
|
self.settings['listview_background'] = new_color
|
||||||
|
return
|
||||||
|
|
||||||
|
profile_index = self.bookToolBar.profileBox.currentIndex()
|
||||||
|
current_profile = self.bookToolBar.profileBox.itemData(
|
||||||
|
profile_index, QtCore.Qt.UserRole)
|
||||||
|
|
||||||
|
# Retain current values on opening a new dialog
|
||||||
if signal_sender == 'fgColor':
|
if signal_sender == 'fgColor':
|
||||||
current_color = current_profile['foreground']
|
current_color = current_profile['foreground']
|
||||||
new_color = open_color_dialog(current_color)
|
new_color = open_color_dialog(current_color)
|
||||||
|
@@ -52,6 +52,8 @@ class Settings:
|
|||||||
self.parent.move(self.settings.value('windowPosition', QtCore.QPoint(0, 0)))
|
self.parent.move(self.settings.value('windowPosition', QtCore.QPoint(0, 0)))
|
||||||
self.parent.settings['current_view'] = int(self.settings.value('currentView', 0))
|
self.parent.settings['current_view'] = int(self.settings.value('currentView', 0))
|
||||||
self.parent.settings['main_window_headers'] = self.settings.value('tableHeaders', None)
|
self.parent.settings['main_window_headers'] = self.settings.value('tableHeaders', None)
|
||||||
|
self.parent.settings['listview_background'] = self.settings.value(
|
||||||
|
'listViewBackground', QtGui.QColor().fromRgb(76, 76, 76))
|
||||||
self.settings.endGroup()
|
self.settings.endGroup()
|
||||||
|
|
||||||
self.settings.beginGroup('runtimeVariables')
|
self.settings.beginGroup('runtimeVariables')
|
||||||
@@ -104,6 +106,7 @@ class Settings:
|
|||||||
self.settings.setValue('windowSize', self.parent.size())
|
self.settings.setValue('windowSize', self.parent.size())
|
||||||
self.settings.setValue('windowPosition', self.parent.pos())
|
self.settings.setValue('windowPosition', self.parent.pos())
|
||||||
self.settings.setValue('currentView', self.parent.stackedWidget.currentIndex())
|
self.settings.setValue('currentView', self.parent.stackedWidget.currentIndex())
|
||||||
|
self.settings.setValue('listViewBackground', self.parent.settings['listview_background'])
|
||||||
|
|
||||||
table_headers = []
|
table_headers = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
Reference in New Issue
Block a user