-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve UI and Refactor UI Codebase #515
Improve UI and Refactor UI Codebase #515
Conversation
main_window.py: put driver to application property and update theme palette. qt_logger.py: contains a logger which will be used in ui related codes. theme.py: New theme management system. test_theme.py: tests for theme management system.
line_edit_widgets: New line edit widget. main_window.py: Using new line edits.
…l/TagStudio into ui-improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume things are subject to change, but here's a few comments I noticed on the first read-through
tagstudio/src/qt/main_window.py
Outdated
@@ -18,13 +18,16 @@ | |||
from PySide6.QtCore import (QCoreApplication, QMetaObject, QRect,QSize, Qt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the comment on top of the file - this file is autogenerated, so any changes here are irrelevant and they will be lost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so how do I add the widget to the main window? i can't use home.ui to add and recompile because a lot of lines change after compiling, and those changes will be lost if i recompile. i haven't seen any other .ui files in the repository. am i missing something? btw this is temporary and i will refactor this file.
# region NOTE: temporary solution for test by making fake driver to use QSettings | ||
from PySide6.QtCore import QSettings | ||
from PySide6.QtWidgets import QApplication | ||
|
||
app = QApplication.instance() or QApplication([]) | ||
|
||
class Driver: | ||
settings = QSettings(str(settings_file), QSettings.Format.IniFormat, app) | ||
|
||
app.setProperty("driver", Driver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a driver
fixture defined in conftest.py
, would it be possible to re-use it here, or adjust it in a way that it would be reusable?
TagStudio/tagstudio/tests/conftest.py
Lines 99 to 120 in 073d517
@pytest.fixture | |
def qt_driver(qtbot, library): | |
with TemporaryDirectory() as tmp_dir: | |
class Args: | |
config_file = pathlib.Path(tmp_dir) / "tagstudio.ini" | |
open = pathlib.Path(tmp_dir) | |
ci = True | |
with patch("src.qt.ts_qt.Consumer"), patch("src.qt.ts_qt.CustomRunnable"): | |
driver = QtDriver(backend, Args()) | |
driver.main_window = Mock() | |
driver.preview_panel = Mock() | |
driver.flow_container = Mock() | |
driver.item_thumbs = [] | |
driver.lib = library | |
# TODO - downsize this method and use it | |
# driver.start() | |
driver.frame_content = list(library.get_entries()) | |
yield driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with pytest fixtures and mock, so i'm not sure how to do this. in this test, I’m creating a new settings file and writing values to test the functions that use these settings. how can I achieve that using this fixture (or adjust)?
# NOTE: ProxyStyle is used to customize the drawing of the line edit widget's background. Overriding | ||
# the repaint method would be overly complex as it would require reimplementing the calculation | ||
# of the cursor, text, alignment, margins, selected text highlight, index of the text when | ||
# clicked on, and click and drag to select, etc. By using ProxyStyle, we only need to customize | ||
# the background drawing. The widget will take care of the other aspects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a docstring instead perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's explaining why ProxyStyle is used, not what ProxyStyle does. that's why i decided to write it as a comment instead of docstring of ProxyStyle. should i add this to the BaseLineEdit class docstring?
Co-authored-by: yed <yedpodtrzitko@users.noreply.github.com>
button_widgets: added BasePushButton widget. main_window.py, landing.py: using BasePushButton instead of QPushButton base_line_edit.py: - refactor - update color on setDisabled(), setPalette(), setStyleSheet() - set placeholder text on painting
Focus indicators added to base button and base line edit widgets. Minor improvements.
theme.py, test_library.py: mypy improvements.
Hi, personally I feel this PR is doing a lot at once and that makes it hard to review keep up with main. I think this is best reflected in the non descriptive PR title. Personally, I'd love to see this broken up into several PRs that can be merged independently. Stuff like refactoring, shortcut manager, and theming |
Theme management and the settings window are part of my 'Improve overall UI/UX for better responsiveness and accessibility' list.
i felt the same, but that was intentional. tnx 😊 |
This PR broke into smaller PRs. |
Hi,
I'm working on cleaning up and improving the UI code. This is a draft PR, so I'll be pushing changes bit by bit as I go.
Here’s what I’m aiming for:
Feel free to drop any feedback or suggestions as I push updates. Would love to hear your thoughts as this evolves!
Tnx ❤️.