Skip to content
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

Fixed dialog windows tiling like main windows on tiling window managers. #464

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
20 changes: 17 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Thank you so much for showing interest in contributing to TagStudio! Here are a
### Prerequisites

- [Python](https://www.python.org/downloads/) 3.12
- [pyenv](https://github.com/pyenv/pyenv/) (If your system install of Python isn't 3.12 but you don't wish to upgrade/downgrade, otherwise ignore this.)
- [Ruff](https://github.com/astral-sh/ruff) (Included in `requirements-dev.txt`)
- [Mypy](https://github.com/python/mypy) (Included in `requirements-dev.txt`)
- [PyTest](https://docs.pytest.org) (Included in `requirements-dev.txt`)
Expand All @@ -49,22 +50,35 @@ If you wish to launch the source version of TagStudio outside of your IDE:
> [!TIP]
> On Linux and macOS, you can launch the `tagstudio.sh` script to skip the following process, minus the `requirements-dev.txt` installation step. _Using the script is fine if you just want to launch the program from source._

1. In the root repository directory, create a python virtual environment:
1. Make sure you're using the correct Python version:
`python3 --version` (As described above)
- If the output matches `Python 3.12.x` where the x is any number representing a patch update (Does not matter), then continue to step 2 and ignore the info below about pyenv, you won't need to install it either.
- Otherwise, you probably want to use pyenv so you don't have to downgrade or upgrade your Python installation before continuing to step 2:
1. Follow the install instructions for your system on [the pyenv Github repository](https://github.com/pyenv/pyenv/).
2. Install the appropriate Python version with pyenv by running `pyenv install 3.12` (This will **not** mess with your existing Python install in any way).
3. Go into the root of this repository with a terminal, and run `pyenv local 3.12` to tell pyenv that Python 3.12 should be used in this folder (This will **not** mess with your existing Python install either, it only applies to this folder).
- You can also do `pyenv shell 3.12` or `pyenv global 3.12` instead to set the Python version for the current terminal session or the entire system respectively, but `local` is recommended.

2. In the root repository directory, create a python virtual environment:
`python3 -m venv .venv`
2. Activate your environment:
3. Activate your environment:

- Windows w/Powershell: `.venv\Scripts\Activate.ps1`
- Windows w/Command Prompt: `.venv\Scripts\activate.bat`
- Linux/macOS: `source .venv/bin/activate`
If you use an alternative shell like fish or csh, you may wish to switch to the default shell (Usually bash) for this project, or alternatively, you can see the other activation scripts left by Python such as:
- Fish: `source .venv/bin/activate.fish`
- CSH: `source .venv/bin/activate.csh`

3. Install the required packages:
4. Install the required packages:

- `pip install -r requirements.txt`
- If developing (includes Ruff and Mypy): `pip install -r requirements-dev.txt`

_Learn more about setting up a virtual environment [here](https://docs.python.org/3/tutorial/venv.html)._

### Manually Launching (Outside of an IDE)
#### If you encounter errors about the Python version, or seemingly vague script errors, [pyenv](https://github.com/pyenv/pyenv/) may solve your issue, see step 1 of [Creating a Python Virtual Environment](#creating-a-python-virtual-environment)

- **Windows** (start_win.bat)

Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/add_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, library: Library):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.title_widget = QLabel()
self.title_widget.setObjectName("fieldTitle")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/delete_unlinked.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, driver: "QtDriver", tracker: MissingRegistry):
self.setMinimumSize(500, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/drop_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(self, driver: "QtDriver"):
self.setMinimumSize(500, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/file_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self, library: "Library"):
self.setMinimumSize(240, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

# Create Table Widget --------------------------------------------------
self.table = QTableWidget(len(self.lib.prefs(LibraryPrefs.EXTENSION_LIST)), 1)
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/fix_dupes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.tracker = DupeRegistry(library=self.lib)

Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/fix_unlinked.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.unlinked_desc_widget = QLabel()
self.unlinked_desc_widget.setObjectName("unlinkedDescriptionLabel")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/folders_to_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(640, 640)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.title_widget = QLabel()
self.title_widget.setObjectName("title")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/modals/mirror_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, driver: "QtDriver", tracker: DupeRegistry):
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.tracker = tracker
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/widgets/paged_panel/paged_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(self, size: tuple[int, int], stack: list[PagedPanelState]):
self.root_layout.setObjectName("baseLayout")
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.root_layout.setContentsMargins(0, 0, 0, 0)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.content_container = QWidget()
self.content_layout = QVBoxLayout(self.content_container)
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/widgets/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 0, 6, 6)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

self.title_widget = QLabel()
self.title_widget.setObjectName("fieldTitle")
Expand Down
1 change: 1 addition & 0 deletions tagstudio/src/qt/widgets/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(
self.setWindowFlags(self.pb.windowFlags() & ~Qt.WindowType.WindowCloseButtonHint)
self.setWindowTitle(window_title)
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore

def update_label(self, text: str):
self.pb.setLabelText(text)
Expand Down