From 2c42e1f04d8fc4ce530567067423ff009f758252 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 00:09:28 -0400 Subject: [PATCH 01/15] Implement toggling visibility of builds in the library As per @Victor-IX's suggestion on Discord This doesn't have options to toggle them just yet --- source/modules/settings.py | 32 +++++++++++++++++++++++++++++ source/resources/styles/QTabBar.css | 8 ++++++++ source/windows/main_window.py | 12 +++++++++++ 3 files changed, 52 insertions(+) diff --git a/source/modules/settings.py b/source/modules/settings.py index 5427056..d28045b 100644 --- a/source/modules/settings.py +++ b/source/modules/settings.py @@ -481,6 +481,38 @@ def set_scrape_bfa_builds(b: bool): get_settings().setValue("scrape_bfa_builds", b) +def get_show_stable_builds() -> bool: + return get_settings().value("show_stable_builds", defaultValue=True, type=bool) + + +def set_show_stable_builds(b: bool): + get_settings().setValue("show_stable_builds", b) + + +def get_show_daily_builds() -> bool: + return get_settings().value("show_daily_builds", defaultValue=True, type=bool) + + +def set_show_daily_builds(b: bool): + get_settings().setValue("show_daily_builds", b) + + +def get_show_experimental_and_patch_builds() -> bool: + return get_settings().value("show_experimental_and_patch_builds", defaultValue=True, type=bool) + + +def set_show_experimental_and_patch_builds(b: bool): + get_settings().setValue("show_experimental_and_patch_builds", b) + + +def get_show_bfa_builds() -> bool: + return get_settings().value("show_bfa_builds", defaultValue=True, type=bool) + + +def set_show_bfa_builds(b: bool): + get_settings().setValue("show_bfa_builds", b) + + def get_show_daily_archive_builds() -> bool: return get_settings().value("show_daily_archive_builds", defaultValue=False, type=bool) diff --git a/source/resources/styles/QTabBar.css b/source/resources/styles/QTabBar.css index 1991790..138b994 100644 --- a/source/resources/styles/QTabBar.css +++ b/source/resources/styles/QTabBar.css @@ -12,3 +12,11 @@ QTabBar::tab::selected { color: #FFFFFF; background-color: #424242; } + +QTabBar::tab::disabled { + width: 0; + height: 0; + margin: 0; + padding: 0; + border: none; +} \ No newline at end of file diff --git a/source/windows/main_window.py b/source/windows/main_window.py index ea6b049..60722c8 100644 --- a/source/windows/main_window.py +++ b/source/windows/main_window.py @@ -39,6 +39,10 @@ get_scrape_automated_builds, get_scrape_bfa_builds, get_scrape_stable_builds, + get_show_bfa_builds, + get_show_daily_builds, + get_show_experimental_and_patch_builds, + get_show_stable_builds, get_show_tray_icon, get_sync_library_and_downloads_pages, get_tray_icon_notified, @@ -424,6 +428,8 @@ def draw(self, polish=False): self.LibraryToolBox.setCurrentIndex(get_default_library_page()) self.DownloadsToolBox.setCurrentIndex(get_default_downloads_page()) + self.update_visible_lists() + # Status bar self.status_bar = QStatusBar(self) self.setStatusBar(self.status_bar) @@ -980,6 +986,12 @@ def draw_unrecognized(self, path): list_widget.insert_item(item, widget) + def update_visible_lists(self): + self.LibraryToolBox.setTabEnabled(0, get_show_stable_builds()) + self.LibraryToolBox.setTabEnabled(1, get_show_daily_builds()) + self.LibraryToolBox.setTabEnabled(2, get_show_experimental_and_patch_builds()) + self.LibraryToolBox.setTabEnabled(3, get_show_bfa_builds()) + def focus_widget(self, widget: BaseBuildWidget): tab: QWidget | None = None lst: BaseListWidget | None = None From 46beafd447b64995d1bb558b691b289f051056f7 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 01:10:28 -0400 Subject: [PATCH 02/15] Add visual elements -- requires reload of style --- source/resources/icons/download_off.svg | 1 + source/resources/icons/download_on.svg | 1 + source/resources/icons/visibility_off.svg | 1 + source/resources/icons/visibility_on.svg | 1 + source/resources/resources.qrc | 4 + source/resources/styles/QCheckBox.css | 18 +++- source/resources/styles/QPushButton.css | 6 ++ source/widgets/repo_group.py | 89 ++++++++++++++++++ source/widgets/repo_visibility_view.py | 91 +++++++++++++++++++ .../settings_window/blender_builds_tab.py | 65 ++++++------- source/windows/settings_window.py | 3 +- 11 files changed, 241 insertions(+), 39 deletions(-) create mode 100644 source/resources/icons/download_off.svg create mode 100644 source/resources/icons/download_on.svg create mode 100644 source/resources/icons/visibility_off.svg create mode 100644 source/resources/icons/visibility_on.svg create mode 100644 source/widgets/repo_group.py create mode 100644 source/widgets/repo_visibility_view.py diff --git a/source/resources/icons/download_off.svg b/source/resources/icons/download_off.svg new file mode 100644 index 0000000..af81980 --- /dev/null +++ b/source/resources/icons/download_off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/source/resources/icons/download_on.svg b/source/resources/icons/download_on.svg new file mode 100644 index 0000000..ab6fe91 --- /dev/null +++ b/source/resources/icons/download_on.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/source/resources/icons/visibility_off.svg b/source/resources/icons/visibility_off.svg new file mode 100644 index 0000000..157eba4 --- /dev/null +++ b/source/resources/icons/visibility_off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/source/resources/icons/visibility_on.svg b/source/resources/icons/visibility_on.svg new file mode 100644 index 0000000..30ad7c7 --- /dev/null +++ b/source/resources/icons/visibility_on.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/source/resources/resources.qrc b/source/resources/resources.qrc index 0dcb963..2fafaee 100644 --- a/source/resources/resources.qrc +++ b/source/resources/resources.qrc @@ -25,6 +25,10 @@ icons/file.svg icons/expand_less.svg icons/expand_more.svg + icons/visibility_on.svg + icons/visibility_off.svg + icons/download_on.svg + icons/download_off.svg styles/global.qss fonts/OpenSans-SemiBold.ttf diff --git a/source/resources/styles/QCheckBox.css b/source/resources/styles/QCheckBox.css index c0f990a..faa16ad 100644 --- a/source/resources/styles/QCheckBox.css +++ b/source/resources/styles/QCheckBox.css @@ -8,4 +8,20 @@ QCheckBox::indicator:checked { QCheckBox::indicator:unchecked { image: url(:resources/icons/box_unchecked.svg); -} \ No newline at end of file +} + +QCheckBox[Visibility=true]::indicator:checked { + image: url(:resources/icons/visibility_on.svg); +} + +QCheckBox[Visibility=true]::indicator:unchecked { + image: url(:resources/icons/visibility_off.svg); +} + +QCheckBox[Download=true]::indicator:checked { + image: url(:resources/icons/download_on.svg); +} + +QCheckBox[Download=true]::indicator:unchecked { + image: url(:resources/icons/download_off.svg); +} diff --git a/source/resources/styles/QPushButton.css b/source/resources/styles/QPushButton.css index 37789db..6398433 100644 --- a/source/resources/styles/QPushButton.css +++ b/source/resources/styles/QPushButton.css @@ -67,6 +67,12 @@ QPushButton[CreateButton=true] { padding: 9px; } +QPushButton[CreateButton=true]:disabled { + background-color: rgb(133, 133, 133); + color: black; + padding: 9px; +} + QPushButton[InstalledButton=true] { background-color: #318CE7; border: none; diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py new file mode 100644 index 0000000..7837c64 --- /dev/null +++ b/source/widgets/repo_group.py @@ -0,0 +1,89 @@ + +from modules.settings import ( + get_scrape_automated_builds, + get_scrape_bfa_builds, + get_scrape_stable_builds, + get_show_bfa_builds, + get_show_daily_builds, + get_show_experimental_and_patch_builds, + get_show_stable_builds, +) +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import ( + QButtonGroup, + QListWidget, + QListWidgetItem, +) +from widgets.repo_visibility_view import RepoUserView + + +class RepoGroup(QListWidget): + def __init__(self, parent=None): + super().__init__(parent) + self.setAlternatingRowColors(True) + self.setContentsMargins(0, 0, 0, 0) + + self.stable_repo = RepoUserView( + "stable", + "The builds that come from the stable build", + library=get_show_stable_builds(), + download=get_scrape_stable_builds(), + parent=self, + ) + self.daily_repo = RepoUserView( + "daily", + "Builds created every day. They the latest features and bug fixes, but they can be unstable", + library=get_show_daily_builds(), + download=get_scrape_automated_builds(), + parent=self, + ) + self.experimental_repo = RepoUserView( + "experimental", + "These have new features that may end up in official Blender releases. They can be unstable.", + library=get_show_experimental_and_patch_builds(), + download=get_scrape_automated_builds(), + parent=self, + ) + self.patch_repo = RepoUserView( + "patch", + "Patch based builds", + library=get_show_experimental_and_patch_builds(), + download=get_scrape_automated_builds(), + parent=self, + ) + self.bforartists_repo = RepoUserView( + "bforartists", + "A popular fork of Blender with the goal of improving the UI.", + library=get_show_bfa_builds(), + download=get_scrape_bfa_builds(), + parent=self, + ) + + self.exp_and_patch_groups = QButtonGroup() + self.exp_and_patch_groups.setExclusive(False) + self.experimental_repo.add_library_to_group(self.exp_and_patch_groups) + self.patch_repo.add_library_to_group(self.exp_and_patch_groups) + + self.automated_groups = QButtonGroup() + self.automated_groups.setExclusive(False) + self.daily_repo.add_downloads_to_group(self.automated_groups) + self.experimental_repo.add_downloads_to_group(self.automated_groups) + self.patch_repo.add_downloads_to_group(self.automated_groups) + + self.repos = [ + self.stable_repo, + self.daily_repo, + self.experimental_repo, + self.patch_repo, + self.bforartists_repo, + ] + + for widget in self.repos: + item = QListWidgetItem() + item.setSizeHint(widget.sizeHint()) + item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsSelectable) # type: ignore + self.addItem(item) + self.setItemWidget(item, widget) + + def total_height(self): + return sum(r.height() for r in self.repos) diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py new file mode 100644 index 0000000..f60b57f --- /dev/null +++ b/source/widgets/repo_visibility_view.py @@ -0,0 +1,91 @@ +from __future__ import annotations + +from PyQt5.QtCore import pyqtSignal +from PyQt5.QtGui import QFont +from PyQt5.QtWidgets import ( + QButtonGroup, + QCheckBox, + QGridLayout, + QLabel, + QSizePolicy, + QVBoxLayout, + QWidget, +) + + +class RepoUserView(QWidget): + library_changed = pyqtSignal(bool) + download_changed = pyqtSignal(bool) + + def __init__( + self, + name: str, + description: str, + library: bool | None = True, # bool if used, None if disabled + download: bool | None = True, # bool if used, None if disabled + parent=None, + ): + super().__init__(parent) + self.name = name + + self.title_label = QLabel(name, self) + font = QFont(self.title_label.font()) + font.setPointSize(12) + font.setBold(True) + self.title_label.setFont(font) + self.description = QLabel(description, self) + self.description.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + + self.library_enable_button = QCheckBox(self) + self.library_enable_button.setProperty("Visibility", True) + self.library_enable_button.setChecked(library or False) + self.library_enable_button.setText(None) + self.library_enable_button.toggled.connect(self.library_changed) + + if library is None: + self.library_enable_button.setEnabled(False) + + self.download_enable_button = QCheckBox(self) + self.download_enable_button.setProperty("Download", True) + self.download_enable_button.setChecked(download or False) + self.download_enable_button.setText(None) + self.download_enable_button.toggled.connect(self.download_changed) + + if download is None: + self.download_enable_button.setEnabled(False) + + self.layout_ = QGridLayout(self) + self.layout_.setContentsMargins(5, 5, 5, 5) + self.layout_.setSpacing(5) + self.layout_.setSizeConstraint(QVBoxLayout.SizeConstraint.SetMinimumSize) + self.layout_.addWidget(self.title_label, 0, 0, 1, 1) + self.layout_.addWidget(self.description, 1, 0, 1, 1) + self.layout_.addWidget(self.library_enable_button, 0, 1, 2, 1) + self.layout_.addWidget(self.download_enable_button, 0, 2, 2, 1) + + def add_library_to_group(self, grp: QButtonGroup): + grp.addButton(self.library_enable_button) + grp.buttonToggled.connect(self.__library_toggled) + + def add_downloads_to_group(self, grp: QButtonGroup): + grp.addButton(self.download_enable_button) + grp.buttonToggled.connect(self.__download_toggled) + + def __library_toggled(self, btn: QCheckBox, checked: bool): + if btn is not self and checked != self.library_enable_button.isChecked(): + self.library_enable_button.setChecked(checked) + + def __download_toggled(self, btn: QCheckBox, checked: bool): + if btn is not self and checked != self.download_enable_button.isChecked(): + self.download_enable_button.setChecked(checked) + + @property + def download(self): + return self.download_enable_button.isChecked() + + @property + def library(self): + return self.library_enable_button.isChecked() + + + diff --git a/source/widgets/settings_window/blender_builds_tab.py b/source/widgets/settings_window/blender_builds_tab.py index b6f24d8..f0e226a 100644 --- a/source/widgets/settings_window/blender_builds_tab.py +++ b/source/widgets/settings_window/blender_builds_tab.py @@ -1,3 +1,4 @@ +from modules._platform import get_platform from modules.bl_api_manager import dropdown_blender_version from modules.settings import ( favorite_pages, @@ -11,14 +12,17 @@ get_mark_as_favorite, get_minimum_blender_stable_version, get_new_builds_check_frequency, - get_platform, get_quick_launch_key_seq, get_scrape_automated_builds, get_scrape_bfa_builds, get_scrape_stable_builds, + get_show_bfa_builds, get_show_daily_archive_builds, + get_show_daily_builds, + get_show_experimental_and_patch_builds, get_show_experimental_archive_builds, get_show_patch_archive_builds, + get_show_stable_builds, set_bash_arguments, set_blender_startup_arguments, set_check_for_new_builds_automatically, @@ -33,24 +37,32 @@ set_scrape_automated_builds, set_scrape_bfa_builds, set_scrape_stable_builds, + set_show_bfa_builds, set_show_daily_archive_builds, + set_show_daily_builds, + set_show_experimental_and_patch_builds, set_show_experimental_archive_builds, set_show_patch_archive_builds, + set_show_stable_builds, ) from PyQt5 import QtGui from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( + QButtonGroup, QCheckBox, QComboBox, QFormLayout, QGridLayout, QLabel, QLineEdit, + QListWidget, + QListWidgetItem, QSpinBox, ) +from widgets.repo_group import RepoGroup +from widgets.repo_visibility_view import RepoUserView from widgets.settings_form_widget import SettingsFormWidget - -from .settings_group import SettingsGroup +from widgets.settings_window.settings_group import SettingsGroup class BlenderBuildsTabWidget(SettingsFormWidget): @@ -105,32 +117,16 @@ def __init__(self, parent=None): \nDEFAULT: On" ) - # Scraping builds settings - self.ScrapeStableBuilds = QCheckBox(self) - self.ScrapeStableBuilds.setChecked(get_scrape_stable_builds()) - self.ScrapeStableBuilds.clicked.connect(self.toggle_scrape_stable_builds) - self.ScrapeStableBuilds.setText("Scrape stable builds") - self.ScrapeStableBuilds.setToolTip( - "Scrape stable Blender builds\ - \nDEFAULT: On" - ) - self.ScrapeAutomatedBuilds = QCheckBox(self) - self.ScrapeAutomatedBuilds.setChecked(get_scrape_automated_builds()) - self.ScrapeAutomatedBuilds.clicked.connect(self.toggle_scrape_automated_builds) - self.ScrapeAutomatedBuilds.setText("Scrape automated builds (daily/experimental/patch)") - self.ScrapeAutomatedBuilds.setToolTip( - "Scrape daily, experimental, and patch Blender builds\ - \nDEFAULT: On" - ) + self.repo_group = RepoGroup(self) + self.repo_group.setMinimumHeight(self.repo_group.total_height() - 2) - self.ScrapeBfaBuilds = QCheckBox(self) - self.ScrapeBfaBuilds.setChecked(get_scrape_bfa_builds()) - self.ScrapeBfaBuilds.clicked.connect(self.toggle_scrape_bfa_builds) - self.ScrapeBfaBuilds.setText("Scrape BforArtists builds") - self.ScrapeBfaBuilds.setToolTip( - "Scrape BForArtists builds, a popular Blender fork\ - \nDEFAULT: On" - ) + self.repo_group.stable_repo.library_changed.connect(lambda b: set_show_stable_builds(b)) + self.repo_group.stable_repo.download_changed.connect(self.toggle_scrape_stable_builds) + self.repo_group.daily_repo.library_changed.connect(lambda b: set_show_daily_builds(b)) + self.repo_group.daily_repo.download_changed.connect(self.toggle_scrape_automated_builds) + self.repo_group.experimental_repo.library_changed.connect(lambda b: set_show_experimental_and_patch_builds(b)) + self.repo_group.bforartists_repo.library_changed.connect(lambda b: set_show_bfa_builds(b)) + self.repo_group.bforartists_repo.download_changed.connect(self.toggle_scrape_bfa_builds) # Show Archive Builds self.show_daily_archive_builds = QCheckBox(self) @@ -165,12 +161,10 @@ def __init__(self, parent=None): self.scraping_builds_layout.addWidget(self.CheckForNewBuildsOnStartup, 1, 0, 1, 2) self.scraping_builds_layout.addWidget(QLabel("Minimum stable build to scrape", self), 2, 0, 1, 1) self.scraping_builds_layout.addWidget(self.MinStableBlenderVer, 2, 1, 1, 1) - self.scraping_builds_layout.addWidget(self.ScrapeStableBuilds, 3, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.ScrapeAutomatedBuilds, 4, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.ScrapeBfaBuilds, 5, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_daily_archive_builds, 6, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_experimental_archive_builds, 7, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_patch_archive_builds, 8, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.repo_group, 3, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_daily_archive_builds, 4, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_experimental_archive_builds, 5, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_patch_archive_builds, 6, 0, 1, 2) self.buildcheck_settings.setLayout(self.scraping_builds_layout) # Downloading builds settings @@ -361,15 +355,12 @@ def toggle_check_on_startup(self, is_checked): def toggle_scrape_stable_builds(self, is_checked): set_scrape_stable_builds(is_checked) - self.ScrapeStableBuilds.setChecked(is_checked) def toggle_scrape_automated_builds(self, is_checked): set_scrape_automated_builds(is_checked) - self.ScrapeAutomatedBuilds.setChecked(is_checked) def toggle_scrape_bfa_builds(self, is_checked): set_scrape_bfa_builds(is_checked) - self.ScrapeAutomatedBuilds.setChecked(is_checked) def toggle_show_daily_archive_builds(self, is_checked): set_show_daily_archive_builds(is_checked) diff --git a/source/windows/settings_window.py b/source/windows/settings_window.py index 365b41b..2085438 100644 --- a/source/windows/settings_window.py +++ b/source/windows/settings_window.py @@ -36,7 +36,7 @@ def __init__(self, parent): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) - self.setMinimumSize(QSize(480, 100)) + self.setMinimumSize(QSize(750, 100)) self.CentralWidget = QWidget(self) self.CentralLayout = QVBoxLayout(self.CentralWidget) self.CentralLayout.setContentsMargins(1, 1, 1, 1) @@ -215,4 +215,5 @@ def closeEvent(self, event): event.ignore() else: self.parent.settings_window = None + self.parent.update_visible_lists() event.accept() From e8a114a80faa3f5f7a635d25d32521f183609417 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 01:16:39 -0400 Subject: [PATCH 03/15] Use a different method to hide and reveal the tabs --- source/resources/styles/QTabBar.css | 8 -------- source/windows/main_window.py | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/source/resources/styles/QTabBar.css b/source/resources/styles/QTabBar.css index 138b994..1991790 100644 --- a/source/resources/styles/QTabBar.css +++ b/source/resources/styles/QTabBar.css @@ -12,11 +12,3 @@ QTabBar::tab::selected { color: #FFFFFF; background-color: #424242; } - -QTabBar::tab::disabled { - width: 0; - height: 0; - margin: 0; - padding: 0; - border: none; -} \ No newline at end of file diff --git a/source/windows/main_window.py b/source/windows/main_window.py index 60722c8..16c7be4 100644 --- a/source/windows/main_window.py +++ b/source/windows/main_window.py @@ -987,10 +987,10 @@ def draw_unrecognized(self, path): list_widget.insert_item(item, widget) def update_visible_lists(self): - self.LibraryToolBox.setTabEnabled(0, get_show_stable_builds()) - self.LibraryToolBox.setTabEnabled(1, get_show_daily_builds()) - self.LibraryToolBox.setTabEnabled(2, get_show_experimental_and_patch_builds()) - self.LibraryToolBox.setTabEnabled(3, get_show_bfa_builds()) + self.LibraryToolBox.setTabVisible(0, get_show_stable_builds()) + self.LibraryToolBox.setTabVisible(1, get_show_daily_builds()) + self.LibraryToolBox.setTabVisible(2, get_show_experimental_and_patch_builds()) + self.LibraryToolBox.setTabVisible(3, get_show_bfa_builds()) def focus_widget(self, widget: BaseBuildWidget): tab: QWidget | None = None From a8fec7ece09b375fbaf0fce8b2ce2eb27f680e93 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 17:02:55 -0400 Subject: [PATCH 04/15] Move the description to a tooltip --- source/widgets/repo_visibility_view.py | 17 +++++++++-------- .../settings_window/blender_builds_tab.py | 4 +++- source/windows/settings_window.py | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index f60b57f..7866fd0 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -1,6 +1,6 @@ from __future__ import annotations -from PyQt5.QtCore import pyqtSignal +from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtGui import QFont from PyQt5.QtWidgets import ( QButtonGroup, @@ -20,7 +20,7 @@ class RepoUserView(QWidget): def __init__( self, name: str, - description: str, + description: str = "", library: bool | None = True, # bool if used, None if disabled download: bool | None = True, # bool if used, None if disabled parent=None, @@ -29,12 +29,12 @@ def __init__( self.name = name self.title_label = QLabel(name, self) + self.title_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) font = QFont(self.title_label.font()) font.setPointSize(12) - font.setBold(True) self.title_label.setFont(font) - self.description = QLabel(description, self) - self.description.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + if description: + self.title_label.setToolTip(description) self.library_enable_button = QCheckBox(self) self.library_enable_button.setProperty("Visibility", True) @@ -58,10 +58,11 @@ def __init__( self.layout_.setContentsMargins(5, 5, 5, 5) self.layout_.setSpacing(5) self.layout_.setSizeConstraint(QVBoxLayout.SizeConstraint.SetMinimumSize) + self.layout_.setAlignment(Qt.AlignmentFlag.AlignVCenter) + self.layout_.addWidget(self.title_label, 0, 0, 1, 1) - self.layout_.addWidget(self.description, 1, 0, 1, 1) - self.layout_.addWidget(self.library_enable_button, 0, 1, 2, 1) - self.layout_.addWidget(self.download_enable_button, 0, 2, 2, 1) + self.layout_.addWidget(self.library_enable_button, 0, 1, 1, 1) + self.layout_.addWidget(self.download_enable_button, 0, 2, 1, 1) def add_library_to_group(self, grp: QButtonGroup): grp.addButton(self.library_enable_button) diff --git a/source/widgets/settings_window/blender_builds_tab.py b/source/widgets/settings_window/blender_builds_tab.py index f0e226a..fb3d3ee 100644 --- a/source/widgets/settings_window/blender_builds_tab.py +++ b/source/widgets/settings_window/blender_builds_tab.py @@ -118,7 +118,8 @@ def __init__(self, parent=None): ) self.repo_group = RepoGroup(self) - self.repo_group.setMinimumHeight(self.repo_group.total_height() - 2) + self.repo_group.setMinimumHeight(self.repo_group.total_height()) + self.repo_group.setVerticalScrollMode(QListWidget.ScrollMode.ScrollPerPixel) self.repo_group.stable_repo.library_changed.connect(lambda b: set_show_stable_builds(b)) self.repo_group.stable_repo.download_changed.connect(self.toggle_scrape_stable_builds) @@ -278,6 +279,7 @@ def __init__(self, parent=None): self.addRow(self.download_settings) self.addRow(self.launching_settings) + def change_mark_as_favorite(self, page): set_mark_as_favorite(page) diff --git a/source/windows/settings_window.py b/source/windows/settings_window.py index 2085438..7e7bd6a 100644 --- a/source/windows/settings_window.py +++ b/source/windows/settings_window.py @@ -36,7 +36,7 @@ def __init__(self, parent): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) - self.setMinimumSize(QSize(750, 100)) + self.setMinimumSize(QSize(480, 735)) self.CentralWidget = QWidget(self) self.CentralLayout = QVBoxLayout(self.CentralWidget) self.CentralLayout.setContentsMargins(1, 1, 1, 1) From 51de6372dc11edd0cedc20d69eb0d134ea791d7c Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 17:05:06 -0400 Subject: [PATCH 05/15] change contentsMargins slightly --- source/widgets/repo_visibility_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index 7866fd0..06771fb 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -55,7 +55,7 @@ def __init__( self.download_enable_button.setEnabled(False) self.layout_ = QGridLayout(self) - self.layout_.setContentsMargins(5, 5, 5, 5) + self.layout_.setContentsMargins(5, 5, 0, 5) self.layout_.setSpacing(5) self.layout_.setSizeConstraint(QVBoxLayout.SizeConstraint.SetMinimumSize) self.layout_.setAlignment(Qt.AlignmentFlag.AlignVCenter) From ca61ba06f9bc2cfbf9896ab9a4c6527bbeda503a Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 17:20:37 -0400 Subject: [PATCH 06/15] Move the visibility and downloading settings to another group --- source/widgets/folder_select.py | 1 - source/widgets/repo_group.py | 1 - source/widgets/repo_visibility_view.py | 7 +-- .../settings_window/blender_builds_tab.py | 53 +++++++++---------- source/windows/settings_window.py | 2 +- 5 files changed, 29 insertions(+), 35 deletions(-) diff --git a/source/widgets/folder_select.py b/source/widgets/folder_select.py index 6f3a98a..9714ce9 100644 --- a/source/widgets/folder_select.py +++ b/source/widgets/folder_select.py @@ -93,7 +93,6 @@ def set_folder(self, folder: Path, relative: bool | None = None): if (self.check_perms and self.check_write_permission()) or not self.check_perms: self.folder_changed.emit(folder) - def check_write_permission(self) -> bool: path = Path(self.line_edit.text()) if not path.exists(): diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py index 7837c64..592825d 100644 --- a/source/widgets/repo_group.py +++ b/source/widgets/repo_group.py @@ -1,4 +1,3 @@ - from modules.settings import ( get_scrape_automated_builds, get_scrape_bfa_builds, diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index 06771fb..6794886 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -22,7 +22,7 @@ def __init__( name: str, description: str = "", library: bool | None = True, # bool if used, None if disabled - download: bool | None = True, # bool if used, None if disabled + download: bool | None = True, # bool if used, None if disabled parent=None, ): super().__init__(parent) @@ -31,7 +31,7 @@ def __init__( self.title_label = QLabel(name, self) self.title_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) font = QFont(self.title_label.font()) - font.setPointSize(12) + font.setPointSize(11) self.title_label.setFont(font) if description: self.title_label.setToolTip(description) @@ -87,6 +87,3 @@ def download(self): @property def library(self): return self.library_enable_button.isChecked() - - - diff --git a/source/widgets/settings_window/blender_builds_tab.py b/source/widgets/settings_window/blender_builds_tab.py index fb3d3ee..9fb3791 100644 --- a/source/widgets/settings_window/blender_builds_tab.py +++ b/source/widgets/settings_window/blender_builds_tab.py @@ -13,16 +13,9 @@ get_minimum_blender_stable_version, get_new_builds_check_frequency, get_quick_launch_key_seq, - get_scrape_automated_builds, - get_scrape_bfa_builds, - get_scrape_stable_builds, - get_show_bfa_builds, get_show_daily_archive_builds, - get_show_daily_builds, - get_show_experimental_and_patch_builds, get_show_experimental_archive_builds, get_show_patch_archive_builds, - get_show_stable_builds, set_bash_arguments, set_blender_startup_arguments, set_check_for_new_builds_automatically, @@ -48,7 +41,6 @@ from PyQt5 import QtGui from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( - QButtonGroup, QCheckBox, QComboBox, QFormLayout, @@ -56,11 +48,10 @@ QLabel, QLineEdit, QListWidget, - QListWidgetItem, QSpinBox, + QVBoxLayout, ) from widgets.repo_group import RepoGroup -from widgets.repo_visibility_view import RepoUserView from widgets.settings_form_widget import SettingsFormWidget from widgets.settings_window.settings_group import SettingsGroup @@ -69,6 +60,27 @@ class BlenderBuildsTabWidget(SettingsFormWidget): def __init__(self, parent=None): super().__init__(parent=parent) + # Repo visibility and downloading settings + self.repo_settings = SettingsGroup("Visibility and Downloading", parent=self) + + self.repo_group = RepoGroup(self) + self.repo_group.setMinimumHeight(self.repo_group.total_height() + 2) + self.repo_group.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) + self.repo_group.setVerticalScrollMode(QListWidget.ScrollMode.ScrollPerPixel) + + self.repo_group.stable_repo.library_changed.connect(lambda b: set_show_stable_builds(b)) + self.repo_group.stable_repo.download_changed.connect(self.toggle_scrape_stable_builds) + self.repo_group.daily_repo.library_changed.connect(lambda b: set_show_daily_builds(b)) + self.repo_group.daily_repo.download_changed.connect(self.toggle_scrape_automated_builds) + self.repo_group.experimental_repo.library_changed.connect(lambda b: set_show_experimental_and_patch_builds(b)) + self.repo_group.bforartists_repo.library_changed.connect(lambda b: set_show_bfa_builds(b)) + self.repo_group.bforartists_repo.download_changed.connect(self.toggle_scrape_bfa_builds) + + qvl = QVBoxLayout() + # qvl.setContentsMargins(0, 0, 0, 0) + qvl.addWidget(self.repo_group) + self.repo_settings.setLayout(qvl) + # Checking for builds settings self.buildcheck_settings = SettingsGroup("Checking For Builds", parent=self) @@ -117,18 +129,6 @@ def __init__(self, parent=None): \nDEFAULT: On" ) - self.repo_group = RepoGroup(self) - self.repo_group.setMinimumHeight(self.repo_group.total_height()) - self.repo_group.setVerticalScrollMode(QListWidget.ScrollMode.ScrollPerPixel) - - self.repo_group.stable_repo.library_changed.connect(lambda b: set_show_stable_builds(b)) - self.repo_group.stable_repo.download_changed.connect(self.toggle_scrape_stable_builds) - self.repo_group.daily_repo.library_changed.connect(lambda b: set_show_daily_builds(b)) - self.repo_group.daily_repo.download_changed.connect(self.toggle_scrape_automated_builds) - self.repo_group.experimental_repo.library_changed.connect(lambda b: set_show_experimental_and_patch_builds(b)) - self.repo_group.bforartists_repo.library_changed.connect(lambda b: set_show_bfa_builds(b)) - self.repo_group.bforartists_repo.download_changed.connect(self.toggle_scrape_bfa_builds) - # Show Archive Builds self.show_daily_archive_builds = QCheckBox(self) self.show_daily_archive_builds.setText("Show Daily Archived Builds") @@ -162,10 +162,9 @@ def __init__(self, parent=None): self.scraping_builds_layout.addWidget(self.CheckForNewBuildsOnStartup, 1, 0, 1, 2) self.scraping_builds_layout.addWidget(QLabel("Minimum stable build to scrape", self), 2, 0, 1, 1) self.scraping_builds_layout.addWidget(self.MinStableBlenderVer, 2, 1, 1, 1) - self.scraping_builds_layout.addWidget(self.repo_group, 3, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_daily_archive_builds, 4, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_experimental_archive_builds, 5, 0, 1, 2) - self.scraping_builds_layout.addWidget(self.show_patch_archive_builds, 6, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_daily_archive_builds, 3, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_experimental_archive_builds, 4, 0, 1, 2) + self.scraping_builds_layout.addWidget(self.show_patch_archive_builds, 5, 0, 1, 2) self.buildcheck_settings.setLayout(self.scraping_builds_layout) # Downloading builds settings @@ -275,11 +274,11 @@ def __init__(self, parent=None): self.launching_settings.setLayout(self.launching_layout) # Layout + self.addRow(self.repo_settings) self.addRow(self.buildcheck_settings) self.addRow(self.download_settings) self.addRow(self.launching_settings) - def change_mark_as_favorite(self, page): set_mark_as_favorite(page) diff --git a/source/windows/settings_window.py b/source/windows/settings_window.py index 7e7bd6a..e142603 100644 --- a/source/windows/settings_window.py +++ b/source/windows/settings_window.py @@ -36,7 +36,7 @@ def __init__(self, parent): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) - self.setMinimumSize(QSize(480, 735)) + self.setMinimumSize(QSize(480, 777)) self.CentralWidget = QWidget(self) self.CentralLayout = QVBoxLayout(self.CentralWidget) self.CentralLayout.setContentsMargins(1, 1, 1, 1) From dbe1a68c7b141f91459fbcc9bcd7052bd95be3cb Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 20:46:00 -0400 Subject: [PATCH 07/15] update the icons to look more blender-y --- source/resources/icons/download_off.svg | 2 +- source/resources/icons/download_on.svg | 2 +- source/resources/icons/visibility_off.svg | 5 ++++- source/resources/icons/visibility_on.svg | 8 +++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/source/resources/icons/download_off.svg b/source/resources/icons/download_off.svg index af81980..8002f7f 100644 --- a/source/resources/icons/download_off.svg +++ b/source/resources/icons/download_off.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/resources/icons/download_on.svg b/source/resources/icons/download_on.svg index ab6fe91..aa13a5f 100644 --- a/source/resources/icons/download_on.svg +++ b/source/resources/icons/download_on.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/resources/icons/visibility_off.svg b/source/resources/icons/visibility_off.svg index 157eba4..ef0a0bb 100644 --- a/source/resources/icons/visibility_off.svg +++ b/source/resources/icons/visibility_off.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/source/resources/icons/visibility_on.svg b/source/resources/icons/visibility_on.svg index 30ad7c7..edbf714 100644 --- a/source/resources/icons/visibility_on.svg +++ b/source/resources/icons/visibility_on.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + + + \ No newline at end of file From cae26ebbbdf0005caee9b1859388b6d81d685177 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 20:50:30 -0400 Subject: [PATCH 08/15] Update downloads tabs, merge Experimental and Patch repos, bind library to download buttons --- source/widgets/repo_group.py | 37 ++++++++++---------- source/widgets/repo_visibility_view.py | 26 ++++++++++++-- source/windows/main_window.py | 48 +++++++++++++++++++++++--- 3 files changed, 85 insertions(+), 26 deletions(-) diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py index 592825d..77661cb 100644 --- a/source/widgets/repo_group.py +++ b/source/widgets/repo_group.py @@ -7,7 +7,7 @@ get_show_experimental_and_patch_builds, get_show_stable_builds, ) -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, pyqtSlot from PyQt5.QtWidgets import ( QButtonGroup, QListWidget, @@ -23,57 +23,48 @@ def __init__(self, parent=None): self.setContentsMargins(0, 0, 0, 0) self.stable_repo = RepoUserView( - "stable", + "Stable", "The builds that come from the stable build", library=get_show_stable_builds(), download=get_scrape_stable_builds(), parent=self, ) self.daily_repo = RepoUserView( - "daily", + "Daily", "Builds created every day. They the latest features and bug fixes, but they can be unstable", library=get_show_daily_builds(), download=get_scrape_automated_builds(), + bind_download_to_library=False, parent=self, ) self.experimental_repo = RepoUserView( - "experimental", + "Experimental and Patch", "These have new features that may end up in official Blender releases. They can be unstable.", library=get_show_experimental_and_patch_builds(), download=get_scrape_automated_builds(), - parent=self, - ) - self.patch_repo = RepoUserView( - "patch", - "Patch based builds", - library=get_show_experimental_and_patch_builds(), - download=get_scrape_automated_builds(), + bind_download_to_library=False, parent=self, ) self.bforartists_repo = RepoUserView( - "bforartists", + "Bforartists", "A popular fork of Blender with the goal of improving the UI.", library=get_show_bfa_builds(), download=get_scrape_bfa_builds(), parent=self, ) - self.exp_and_patch_groups = QButtonGroup() - self.exp_and_patch_groups.setExclusive(False) - self.experimental_repo.add_library_to_group(self.exp_and_patch_groups) - self.patch_repo.add_library_to_group(self.exp_and_patch_groups) + self.daily_repo.library_changed.connect(self.check_if_both_automated_are_disabled) + self.experimental_repo.library_changed.connect(self.check_if_both_automated_are_disabled) self.automated_groups = QButtonGroup() self.automated_groups.setExclusive(False) self.daily_repo.add_downloads_to_group(self.automated_groups) self.experimental_repo.add_downloads_to_group(self.automated_groups) - self.patch_repo.add_downloads_to_group(self.automated_groups) self.repos = [ self.stable_repo, self.daily_repo, self.experimental_repo, - self.patch_repo, self.bforartists_repo, ] @@ -84,5 +75,15 @@ def __init__(self, parent=None): self.addItem(item) self.setItemWidget(item, widget) + @pyqtSlot() + def check_if_both_automated_are_disabled(self): + if (not self.daily_repo.library) and (not self.experimental_repo.library) and self.daily_repo.download: + self.daily_repo.download = False # Will also set experimental_repo + self.daily_repo.download_enable_button.setEnabled(False) + self.experimental_repo.download_enable_button.setEnabled(False) + if (self.daily_repo.library or self.experimental_repo) and not self.daily_repo.download: + self.daily_repo.download_enable_button.setEnabled(True) + self.experimental_repo.download_enable_button.setEnabled(True) + def total_height(self): return sum(r.height() for r in self.repos) diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index 6794886..4bbb4ea 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -23,6 +23,7 @@ def __init__( description: str = "", library: bool | None = True, # bool if used, None if disabled download: bool | None = True, # bool if used, None if disabled + bind_download_to_library: bool = True, parent=None, ): super().__init__(parent) @@ -39,8 +40,7 @@ def __init__( self.library_enable_button = QCheckBox(self) self.library_enable_button.setProperty("Visibility", True) self.library_enable_button.setChecked(library or False) - self.library_enable_button.setText(None) - self.library_enable_button.toggled.connect(self.library_changed) + self.library_enable_button.toggled.connect(self.__library_button_toggled) if library is None: self.library_enable_button.setEnabled(False) @@ -48,12 +48,14 @@ def __init__( self.download_enable_button = QCheckBox(self) self.download_enable_button.setProperty("Download", True) self.download_enable_button.setChecked(download or False) - self.download_enable_button.setText(None) self.download_enable_button.toggled.connect(self.download_changed) + self.previous_download = download or False if download is None: self.download_enable_button.setEnabled(False) + self.bind_download_to_library = bind_download_to_library + self.layout_ = QGridLayout(self) self.layout_.setContentsMargins(5, 5, 0, 5) self.layout_.setSpacing(5) @@ -72,6 +74,20 @@ def add_downloads_to_group(self, grp: QButtonGroup): grp.addButton(self.download_enable_button) grp.buttonToggled.connect(self.__download_toggled) + def __library_button_toggled(self, checked: bool): + self.title_label.setEnabled(checked) + if self.bind_download_to_library: + self.__library_bound_toggle(checked) + self.library_changed.emit(checked) + + def __library_bound_toggle(self, b: bool): + if not b: + self.previous_download = self.download_enable_button.isChecked() + self.download_enable_button.setChecked(False) + else: + self.download_enable_button.setChecked(self.previous_download) + self.download_enable_button.setEnabled(b) + def __library_toggled(self, btn: QCheckBox, checked: bool): if btn is not self and checked != self.library_enable_button.isChecked(): self.library_enable_button.setChecked(checked) @@ -84,6 +100,10 @@ def __download_toggled(self, btn: QCheckBox, checked: bool): def download(self): return self.download_enable_button.isChecked() + @download.setter + def download(self, v: bool): + self.download_enable_button.setChecked(v) + @property def library(self): return self.library_enable_button.isChecked() diff --git a/source/windows/main_window.py b/source/windows/main_window.py index 16c7be4..bd7e523 100644 --- a/source/windows/main_window.py +++ b/source/windows/main_window.py @@ -807,9 +807,16 @@ def force_check(self): if QApplication.queryKeyboardModifiers() & Qt.Modifier.SHIFT: # Shift held while pressing check # Ignore scrape_stable, scrape_automated and scrape_bfa settings self.start_scraper(True, True, True) + self.update_visible_lists( + force_s_stable=True, + force_s_daily=get_show_daily_builds(), + force_s_expatch=get_show_experimental_and_patch_builds(), + force_s_bfa=True, + ) else: # Use settings self.start_scraper() + self.update_visible_lists() def start_scraper(self, scrape_stable=None, scrape_automated=None, scrape_bfa=None): self.set_status("Checking for new builds", False) @@ -986,11 +993,42 @@ def draw_unrecognized(self, path): list_widget.insert_item(item, widget) - def update_visible_lists(self): - self.LibraryToolBox.setTabVisible(0, get_show_stable_builds()) - self.LibraryToolBox.setTabVisible(1, get_show_daily_builds()) - self.LibraryToolBox.setTabVisible(2, get_show_experimental_and_patch_builds()) - self.LibraryToolBox.setTabVisible(3, get_show_bfa_builds()) + def update_visible_lists( + self, + force_l_stable=False, # Force the library visibility of these + force_l_daily=False, + force_l_expatch=False, + force_l_bfa=False, + force_s_stable=False, # Force the scraper visibility of these + force_s_daily=False, + force_s_expatch=False, + force_s_bfa=False, + ): + show_stable = force_l_stable or get_show_stable_builds() + show_daily = force_l_daily or get_show_daily_builds() + show_expatch = force_l_expatch or get_show_experimental_and_patch_builds() + show_bfa = force_l_bfa or get_show_bfa_builds() + scrape_stable = force_s_stable or get_scrape_stable_builds() + scrape_daily = force_s_daily or (get_scrape_automated_builds() and get_show_daily_builds()) + scrape_expatch = force_s_expatch or (get_scrape_automated_builds() and get_show_experimental_and_patch_builds()) + scrape_bfa = force_s_bfa or get_scrape_bfa_builds() + + self.LibraryToolBox.setTabVisible(0, show_stable) + self.LibraryToolBox.setTabEnabled(0, show_stable) + self.LibraryToolBox.setTabVisible(1, show_daily) + self.LibraryToolBox.setTabEnabled(1, show_daily) + self.LibraryToolBox.setTabVisible(2, show_expatch) + self.LibraryToolBox.setTabEnabled(2, show_expatch) + self.LibraryToolBox.setTabVisible(3, show_bfa) + self.LibraryToolBox.setTabEnabled(3, show_bfa) + self.DownloadsToolBox.setTabVisible(0, scrape_stable) + self.DownloadsToolBox.setTabEnabled(0, scrape_stable) + self.DownloadsToolBox.setTabVisible(1, scrape_daily) + self.DownloadsToolBox.setTabEnabled(1, scrape_daily) + self.DownloadsToolBox.setTabVisible(2, scrape_expatch) + self.DownloadsToolBox.setTabEnabled(2, scrape_expatch) + self.DownloadsToolBox.setTabVisible(3, scrape_bfa) + self.DownloadsToolBox.setTabEnabled(3, scrape_bfa) def focus_widget(self, widget: BaseBuildWidget): tab: QWidget | None = None From 9e483e170ed78de80e09640138b5cf72567e1d3b Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 21:00:27 -0400 Subject: [PATCH 09/15] disable download automated in "both are invisible" case --- source/widgets/repo_group.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py index 77661cb..d3d4549 100644 --- a/source/widgets/repo_group.py +++ b/source/widgets/repo_group.py @@ -61,6 +61,8 @@ def __init__(self, parent=None): self.daily_repo.add_downloads_to_group(self.automated_groups) self.experimental_repo.add_downloads_to_group(self.automated_groups) + self.check_if_both_automated_are_disabled() + self.repos = [ self.stable_repo, self.daily_repo, @@ -77,11 +79,12 @@ def __init__(self, parent=None): @pyqtSlot() def check_if_both_automated_are_disabled(self): - if (not self.daily_repo.library) and (not self.experimental_repo.library) and self.daily_repo.download: + if (not self.daily_repo.library) and (not self.experimental_repo.library): self.daily_repo.download = False # Will also set experimental_repo self.daily_repo.download_enable_button.setEnabled(False) self.experimental_repo.download_enable_button.setEnabled(False) - if (self.daily_repo.library or self.experimental_repo) and not self.daily_repo.download: + return + if (self.daily_repo.library or self.experimental_repo.library) and not self.daily_repo.download: self.daily_repo.download_enable_button.setEnabled(True) self.experimental_repo.download_enable_button.setEnabled(True) From 9c2385e40617d046f00a59e5f983e2871a08456c Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 21:02:19 -0400 Subject: [PATCH 10/15] shrink settings_window slightly for the new size of the repo list --- source/windows/settings_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/windows/settings_window.py b/source/windows/settings_window.py index e142603..fe856bc 100644 --- a/source/windows/settings_window.py +++ b/source/windows/settings_window.py @@ -36,7 +36,7 @@ def __init__(self, parent): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) - self.setMinimumSize(QSize(480, 777)) + self.setMinimumSize(QSize(480, 744)) self.CentralWidget = QWidget(self) self.CentralLayout = QVBoxLayout(self.CentralWidget) self.CentralLayout.setContentsMargins(1, 1, 1, 1) From 35c932efb8fd23062b7ea4ddaa1a7fa9d7d598c2 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 22:54:57 -0400 Subject: [PATCH 11/15] The visibility icon was not symmetrical --- source/resources/icons/visibility_off.svg | 22 +++++++++++++--- source/resources/icons/visibility_on.svg | 31 ++++++++++++++++++----- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/source/resources/icons/visibility_off.svg b/source/resources/icons/visibility_off.svg index ef0a0bb..7c41a11 100644 --- a/source/resources/icons/visibility_off.svg +++ b/source/resources/icons/visibility_off.svg @@ -1,4 +1,18 @@ - - - - \ No newline at end of file + + diff --git a/source/resources/icons/visibility_on.svg b/source/resources/icons/visibility_on.svg index edbf714..86504c3 100644 --- a/source/resources/icons/visibility_on.svg +++ b/source/resources/icons/visibility_on.svg @@ -1,7 +1,24 @@ - - - - - - - \ No newline at end of file + + + + + + From be6ed6f0017a917f168905c3682655195d27769c Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 23:02:57 -0400 Subject: [PATCH 12/15] Add small tooltips. Could use some work --- source/widgets/repo_visibility_view.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index 4bbb4ea..c221740 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -40,6 +40,11 @@ def __init__( self.library_enable_button = QCheckBox(self) self.library_enable_button.setProperty("Visibility", True) self.library_enable_button.setChecked(library or False) + self.library_enable_button.setToolTip( + "Make this repository visible / hidden in the launcher view.
\ + If disabled, then it will automatically disable fetching,
\ + unless another repository shares the fetching behavior." + ) self.library_enable_button.toggled.connect(self.__library_button_toggled) if library is None: @@ -48,6 +53,11 @@ def __init__( self.download_enable_button = QCheckBox(self) self.download_enable_button.setProperty("Download", True) self.download_enable_button.setChecked(download or False) + self.download_enable_button.setToolTip( + 'Enable / Disable fetching this repository.
\ + If you force-check by holding SHIFT while pressing the "Check" button,
\ + Then all visible categories will download regardless of fetching settings.' + ) self.download_enable_button.toggled.connect(self.download_changed) self.previous_download = download or False From 29be1bc4d99f0ddfbe0c40e0aba4f3777dbffa83 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Sat, 2 Nov 2024 23:06:23 -0400 Subject: [PATCH 13/15] Typo --- source/widgets/repo_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py index d3d4549..fa67ccb 100644 --- a/source/widgets/repo_group.py +++ b/source/widgets/repo_group.py @@ -24,14 +24,14 @@ def __init__(self, parent=None): self.stable_repo = RepoUserView( "Stable", - "The builds that come from the stable build", + "Production-ready builds.", library=get_show_stable_builds(), download=get_scrape_stable_builds(), parent=self, ) self.daily_repo = RepoUserView( "Daily", - "Builds created every day. They the latest features and bug fixes, but they can be unstable", + "Builds created every day. They have the latest features and bug fixes, but they can be unstable.", library=get_show_daily_builds(), download=get_scrape_automated_builds(), bind_download_to_library=False, From 97a7c2bcf1a311806cb04b4bc365d685bcfa3c75 Mon Sep 17 00:00:00 2001 From: zeptofine Date: Mon, 4 Nov 2024 10:45:05 -0500 Subject: [PATCH 14/15] scrape all that are visible, not all of them no matter what --- source/windows/main_window.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/windows/main_window.py b/source/windows/main_window.py index bd7e523..fb8d969 100644 --- a/source/windows/main_window.py +++ b/source/windows/main_window.py @@ -805,13 +805,17 @@ def scraper_error(self, s: str): def force_check(self): if QApplication.queryKeyboardModifiers() & Qt.Modifier.SHIFT: # Shift held while pressing check - # Ignore scrape_stable, scrape_automated and scrape_bfa settings - self.start_scraper(True, True, True) + # Ignore scrape_stable, scrape_automated and scrape_bfa settings and scrape all that are visible + show_stable = get_show_stable_builds() + show_daily = get_show_daily_builds() + show_expatch = get_show_experimental_and_patch_builds() + show_bfa = get_show_bfa_builds() + self.start_scraper(show_stable, show_daily or show_expatch, show_bfa) self.update_visible_lists( - force_s_stable=True, - force_s_daily=get_show_daily_builds(), - force_s_expatch=get_show_experimental_and_patch_builds(), - force_s_bfa=True, + force_s_stable=show_stable, + force_s_daily=show_daily, + force_s_expatch=show_expatch, + force_s_bfa=show_bfa, ) else: # Use settings From 271b221d899e79cd85fb3fe105360ae8ff460afb Mon Sep 17 00:00:00 2001 From: zeptofine Date: Mon, 4 Nov 2024 20:10:16 -0500 Subject: [PATCH 15/15] Use a frame instead of a ListWidget, trigger visibility when... download is clicked and the repo is invisible --- source/widgets/repo_group.py | 23 ++++++++++--------- source/widgets/repo_visibility_view.py | 10 ++++++-- .../settings_window/blender_builds_tab.py | 5 ---- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/source/widgets/repo_group.py b/source/widgets/repo_group.py index fa67ccb..ad733f6 100644 --- a/source/widgets/repo_group.py +++ b/source/widgets/repo_group.py @@ -7,20 +7,22 @@ get_show_experimental_and_patch_builds, get_show_stable_builds, ) -from PyQt5.QtCore import Qt, pyqtSlot +from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import ( QButtonGroup, - QListWidget, - QListWidgetItem, + QFrame, + QSizePolicy, + QVBoxLayout, ) from widgets.repo_visibility_view import RepoUserView -class RepoGroup(QListWidget): +class RepoGroup(QFrame): def __init__(self, parent=None): super().__init__(parent) - self.setAlternatingRowColors(True) + self.setProperty("SettingsGroup", True) self.setContentsMargins(0, 0, 0, 0) + self.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Maximum) self.stable_repo = RepoUserView( "Stable", @@ -70,17 +72,16 @@ def __init__(self, parent=None): self.bforartists_repo, ] + self.layout_ = QVBoxLayout(self) + self.layout_.setContentsMargins(0, 0, 0, 5) + for widget in self.repos: - item = QListWidgetItem() - item.setSizeHint(widget.sizeHint()) - item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsSelectable) # type: ignore - self.addItem(item) - self.setItemWidget(item, widget) + self.layout_.addWidget(widget) @pyqtSlot() def check_if_both_automated_are_disabled(self): if (not self.daily_repo.library) and (not self.experimental_repo.library): - self.daily_repo.download = False # Will also set experimental_repo + self.daily_repo.download = False # Will also set experimental_repo self.daily_repo.download_enable_button.setEnabled(False) self.experimental_repo.download_enable_button.setEnabled(False) return diff --git a/source/widgets/repo_visibility_view.py b/source/widgets/repo_visibility_view.py index c221740..2f96208 100644 --- a/source/widgets/repo_visibility_view.py +++ b/source/widgets/repo_visibility_view.py @@ -27,6 +27,7 @@ def __init__( parent=None, ): super().__init__(parent) + self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self.name = name self.title_label = QLabel(name, self) @@ -58,7 +59,7 @@ def __init__( If you force-check by holding SHIFT while pressing the "Check" button,
\ Then all visible categories will download regardless of fetching settings.' ) - self.download_enable_button.toggled.connect(self.download_changed) + self.download_enable_button.toggled.connect(self.__download_button_toggled) self.previous_download = download or False if download is None: @@ -90,13 +91,18 @@ def __library_button_toggled(self, checked: bool): self.__library_bound_toggle(checked) self.library_changed.emit(checked) + def __download_button_toggled(self, checked: bool): + if not self.library_enable_button.isChecked() and checked: + self.library_enable_button.setChecked(True) + self.download_enable_button.setChecked(checked) + self.download_changed.emit(checked) + def __library_bound_toggle(self, b: bool): if not b: self.previous_download = self.download_enable_button.isChecked() self.download_enable_button.setChecked(False) else: self.download_enable_button.setChecked(self.previous_download) - self.download_enable_button.setEnabled(b) def __library_toggled(self, btn: QCheckBox, checked: bool): if btn is not self and checked != self.library_enable_button.isChecked(): diff --git a/source/widgets/settings_window/blender_builds_tab.py b/source/widgets/settings_window/blender_builds_tab.py index 9fb3791..4793d9a 100644 --- a/source/widgets/settings_window/blender_builds_tab.py +++ b/source/widgets/settings_window/blender_builds_tab.py @@ -47,7 +47,6 @@ QGridLayout, QLabel, QLineEdit, - QListWidget, QSpinBox, QVBoxLayout, ) @@ -64,10 +63,6 @@ def __init__(self, parent=None): self.repo_settings = SettingsGroup("Visibility and Downloading", parent=self) self.repo_group = RepoGroup(self) - self.repo_group.setMinimumHeight(self.repo_group.total_height() + 2) - self.repo_group.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) - self.repo_group.setVerticalScrollMode(QListWidget.ScrollMode.ScrollPerPixel) - self.repo_group.stable_repo.library_changed.connect(lambda b: set_show_stable_builds(b)) self.repo_group.stable_repo.download_changed.connect(self.toggle_scrape_stable_builds) self.repo_group.daily_repo.library_changed.connect(lambda b: set_show_daily_builds(b))