-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
QT GUI : Qt Designer integration #6791
base: main
Are you sure you want to change the base?
Conversation
292240a
to
c84a7ab
Compare
Signed-off-by: Rohit Bisht <74498290+R-ohit-B-isht@users.noreply.github.com>
c84a7ab
to
a581ac7
Compare
Hey Rohit, I think improving the way widgets are laid out would be welcomed by many. Ultimately, my question is since we already have PyQtGraph as a dependency, would it make sense to leverage their Dock widgets in addition to something like supporting .ui files? I'm picturing everything wrapped in a |
self.top_layout = Qt.QVBoxLayout(self.top_widget) | ||
self.top_grid_layout = Qt.QGridLayout() | ||
self.top_layout.addLayout(self.top_grid_layout) | ||
file_path = os.fspath(Path(__file__).resolve().parent / "${class_name}.ui") |
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 think you can just stick with using Path
everywhere. This could be
file_path = (Path(__file__).resolve().parent / "${class_name}.ui").absolute()
Then later just use Path
methods like if file_path.exists()
self.{layout}.setRowStretch(r, 1) | ||
for c in range({col}, {col_end}): | ||
self.{layout}.setColumnStretch(c, 1) | ||
if not os.path.exists(file_path): |
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 more modern to use f-strings instead of .format()
(I know much of the rest of the codebase uses .format()
, but I think we should work to use modern Python techniques where possible!)
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.
seconding that; a lot of the Python you find in-tree is from a Python 2.7-heritage (as that was all we had in GNU Radio 3.7), and we instantly bumped the requirement to Python 3.6 when we released GNU Radio 3.8, exactly because we wanted f-strings!
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.
Yeah I've been trying to work through linter errors/warnings from rough and have found a lot of 2.7-migrated-to-3.1+ style code :P
@@ -28,6 +28,10 @@ | |||
from packaging.version import Version as StrictVersion | |||
from PyQt5 import 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.
I've seen this in some other places, but think it's caused some issues at least for me. I believe it's more idiomatic to import e.g. widgets from QtWidgets
. I was always under the impression the Qt
namespace was more for constants and enums like Qt.AlignLeft
etc. When I run the test_examples test, I get loads of AttributeErrors about QPushButton
not being a part of PyQt5.Qt
Description
Integrates the gr-qtgui flowgraph’s Qt GUI widget component Qt Designer to design the UI components.
wiki page : https://wiki.gnuradio.org/index.php?title=QT_Designer_Integration
Related Issue
Which blocks/areas does this affect?
flow_graph.py.mako
top_block.py
param.py
Actions.py
Application.py
Bars.py
Testing Done
yes
Checklist