Compare commits

..

4 Commits

3 changed files with 38 additions and 23 deletions
+17 -17
View File
@@ -121,24 +121,24 @@ def settings_dialog(self):
# IMAGE PATH # # IMAGE PATH #
############### ###############
# image_path_container = QWidget() image_path_container = QWidget()
# image_path_layout = QHBoxLayout() image_path_layout = QHBoxLayout()
# image_path = QLineEdit() image_path = QLineEdit()
# image_path_layout.addWidget(QLabel("Image Path (requires restart):")) image_path_layout.addWidget(QLabel("Image Path (requires restart):"))
# image_path_layout.addWidget(image_path) image_path_layout.addWidget(image_path)
# image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
# image_path_container.setLayout(image_path_layout) image_path_container.setLayout(image_path_layout)
# image_path.setText(state.image_path) image_path.setText(state.image_path)
# def browse_image_path(): def browse_image_path():
# file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0] file_path = QFileDialog.getOpenFileName(dialog, "Select Image File", state.image_path, "Image Files (*.png *.jpg)")[0]
# if file_path: if file_path:
# image_path.setText(file_path) image_path.setText(file_path)
# browse_button = QPushButton("📁") browse_button = QPushButton("📁")
# image_path_layout.addWidget(browse_button) image_path_layout.addWidget(browse_button)
# browse_button.clicked.connect(browse_image_path) browse_button.clicked.connect(browse_image_path)
################## ##################
# SPEED LIMITING # # SPEED LIMITING #
@@ -244,7 +244,7 @@ def settings_dialog(self):
download_path.text(), download_path.text(),
down_speed_limit.value(), down_speed_limit.value(),
up_speed_limit.value(), up_speed_limit.value(),
# image_path.text(), image_path.text(),
autoresume_checkbox.isChecked(), autoresume_checkbox.isChecked(),
max_connections.value(), max_connections.value(),
max_downloads.value(), max_downloads.value(),
@@ -256,7 +256,7 @@ def settings_dialog(self):
self.tabs = QTabWidget() self.tabs = QTabWidget()
self.tab1 = general_tab("General", autoresume_container, update_checkbox_container, transparent_window_container, self.tabs) self.tab1 = general_tab("General", autoresume_container, update_checkbox_container, transparent_window_container, self.tabs)
self.tab2 = paths_tab("Paths", download_path_container, self.tabs) self.tab2 = paths_tab("Paths", download_path_container, image_path_container, self.tabs)
self.tab3 = network_tab("Network", interface_container, max_connections_container, max_downloads_container, up_speed_limit_container, down_speed_limit_container, api_url_container, self.tabs) self.tab3 = network_tab("Network", interface_container, max_connections_container, max_downloads_container, up_speed_limit_container, down_speed_limit_container, api_url_container, self.tabs)
dialog.layout().addWidget(self.tabs) dialog.layout().addWidget(self.tabs)
+19 -4
View File
@@ -84,10 +84,19 @@ def _table_stylesheet(view_type="QTableWidget"):
{view_type}::item {{ {view_type}::item {{
border-bottom: 1px solid {c["border"]}; border-bottom: 1px solid {c["border"]};
padding: 6px 14px; padding: 6px 14px;
outline: none;
{color_rule} {color_rule}
}} }}
{view_type}::item:selected {{ {view_type}::item:selected {{
background: {c["selected"]}; background: {c["selected"]};
outline: none;
border: none;
border-bottom: 1px solid {c["border"]};
}}
{view_type}::item:focus {{
outline: none;
border: none;
border-bottom: 1px solid {c["border"]};
}} }}
QHeaderView {{ QHeaderView {{
background: transparent; background: transparent;
@@ -449,21 +458,27 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
class HoverRowDelegate(QStyledItemDelegate): class HoverRowDelegate(QStyledItemDelegate):
def paint(self, painter, option, index): def paint(self, painter, option, index):
opt = QtWidgets.QStyleOptionViewItem(option)
opt.state &= ~QtWidgets.QStyle.StateFlag.State_HasFocus
opt.state &= ~QtWidgets.QStyle.StateFlag.State_Selected
if index.row() == MainWindow._instance._hovered_row: if index.row() == MainWindow._instance._hovered_row:
painter.save() painter.save()
painter.fillRect(option.rect, _theme_colors()["hover"]) painter.fillRect(opt.rect, _theme_colors()["hover"])
painter.restore() painter.restore()
super().paint(painter, option, index) super().paint(painter, opt, index)
class PauseResumeDelegate(QStyledItemDelegate): class PauseResumeDelegate(QStyledItemDelegate):
clicked = Signal(int) clicked = Signal(int)
def paint(self, painter, option, index): def paint(self, painter, option, index):
opt = QtWidgets.QStyleOptionViewItem(option)
opt.state &= ~QtWidgets.QStyle.StateFlag.State_HasFocus
opt.state &= ~QtWidgets.QStyle.StateFlag.State_Selected
if index.row() == MainWindow._instance._hovered_row: if index.row() == MainWindow._instance._hovered_row:
painter.save() painter.save()
painter.fillRect(option.rect, _theme_colors()["hover"]) painter.fillRect(opt.rect, _theme_colors()["hover"])
painter.restore() painter.restore()
super().paint(painter, option, index) super().paint(painter, opt, index)
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
button = editor.findChild(QtWidgets.QPushButton) button = editor.findChild(QtWidgets.QPushButton)
+2 -2
View File
@@ -30,11 +30,11 @@ def general_tab(title, autoresume, update_checkbox, transparent_window, tabs):
tabs.addTab(tab, title) tabs.addTab(tab, title)
return tab return tab
def paths_tab(title, download_path, tabs): def paths_tab(title, download_path, image_path, tabs):
tab = QWidget() tab = QWidget()
layout = QVBoxLayout() layout = QVBoxLayout()
layout.addWidget(download_path) layout.addWidget(download_path)
# layout.addWidget(image_path) layout.addWidget(image_path)
layout.addStretch() layout.addStretch()
tab.setLayout(layout) tab.setLayout(layout)
tabs.addTab(tab, title) tabs.addTab(tab, title)