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

Import qtpy instead of PyQt5 in autogenerated gui.py #252

Merged
merged 6 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
20 changes: 16 additions & 4 deletions docs/development-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,36 @@ Although many of `recOrder`'s tests are automated, many features require manual

We use `QT Creator` for large parts of `recOrder`'s GUI. To modify the GUI, install `QT Creator` from [its website](https://www.qt.io/product/development-tools) or with `brew install --cask qt-creator`

Open `/recOrder/recOrder/plugin/gui.ui` in `QT Creator` and make your changes.
Open `./recOrder/plugin/gui.ui` in `QT Creator` and make your changes.

Finally, convert the `.ui` to a `.py` file with:
Next, convert the `.ui` to a `.py` file with:

```sh
pyuic5 -x gui.ui -o gui.py
```

Note: `pyuic5` is installed alongside `PyQt5`, so you can expect to find it installed in your `recOrder` conda environement.

Finally, change the `gui.py` file's to import `qtpy` instead of `PyQt5` to adhere to [napari plugin best practices](https://napari.org/stable/plugins/best_practices.html#don-t-include-pyside2-or-pyqt5-in-your-plugin-s-dependencies).
On macOS, you can modify the file in place with:

```sh
sed -i '' 's/from PyQt5/from qtpy/g' gui.py
```

> This is specific for BSD `sed`, ommit `''` with GNU.

Note: although much of the GUI is specified in the generated `recOrder_ui.py` file, the `main_widget.py` file makes extensive modifications to the GUI.

## Make `git blame` ignore formatting commits

**Note:** `git --version` must be `>=2.23` to use this feature.

If you would like `git blame` to ignore formatting commits, run this line:
If you would like `git blame` to ignore formatting commits, run this line:

```sh
git config --global blame.ignoreRevsFile .git-blame-ignore-revs
```

The `\.git-blame-ignore-revs` file contains a list of commit hashes corresponding to formatting commits. If you make a formatting commit, please add the commit's hash to this file.
The `\.git-blame-ignore-revs` file contains a list of commit hashes corresponding to formatting commits.
If you make a formatting commit, please add the commit's hash to this file.
2 changes: 1 addition & 1 deletion recOrder/plugin/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy import QtCore, QtGui, QtWidgets


class Ui_Form(object):
Expand Down