Python Forum
request help putting together multiple widgets in pyqt application
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
request help putting together multiple widgets in pyqt application
Hello people,

I'd like to share some code for review. I am currently working on an interface that will be part of the frontend of some measurement setup, unfortunately I am really struggling to put everything together when adding more widgets.
I've written a mock-up of one part to keep things simple Uronchaa/Graphdisplay

At this point the code in the main branch displays
  • a number of input channels with the possibility to change their names and status (on or off)
  • A graph that displays the names and measurement values of all active channels
  • a push button to add new "measurement" values to all channels

In an effort to separate the business logic from the GUI, mainly to avoid binding everything to Pyqt, I've been trying to organize my code the following way:
  • Widgets dedicated to UI only tasks will carry their own business logic in their class ("usual" Pyqt style)
  • Widgets interacting with the non-UI parts (main models, calculations, etc) will do so via a controller
  • Pyqt signals are for UI related events only, and for UI-to-controller notifications
  • Non UI events (mainly model changes) go through an observer pattern

My end goal is to expand the functionalities with new widgets to modify or display the contents of the underlying data models but my previous attempts seemed too complex or impractical.

Could i please have some feedback or tips on what I have written so far in the main branch? Mainly focusing on the structure of the program, and how the different parts communicate with one another. It would help to know if I am going in the right direction or not.

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020