-
Notifications
You must be signed in to change notification settings - Fork 0
Tab Framework Code
The tabs are all built on top of a management framework that supports the tabs. You are not expected to learn/understand this framework and it is not documented too well. Feel free to dig in if you wish it is all in the repo. But a more important thing is to know which code to look at and which to skip.
All the code in the exercise for one tab is in one module, a single file for each tab. We have pulled as much of the framework back into the parent class, but there is still quite a bit in the children.
At the top of the file is some metadata that controls the selection and behavior of the tab
( for good example code see push button code ) This metadata is used to construct the key words lookup as well as other aspects of the code.
Typically the code has the following sections.methods ( and optionally more )
# ---- tof
This is a comment that causes Spyder to list tof = top of file in its code outline, a great feature for quick code navigation, to use it turn on the outline in Spyder. There are several other comment of the type # ---- for useful navigation of the code. This outline comment is a great Spyder feature.
""" KEY_WORDS: pressed press PushBtton click connect rh CLASS_NAME: QPushButtonTab WIDGETS: QPushButton STATUS: June 2025 ok: but more content would be nice TAB_TITLE: QPushButton Reference DESCRIPTION: A reference for the QPushButton widget HOW_COMPLETE: 20 # AND A COMMENT -- <10 major probs <15 runs but <20 fair not finished <=25 not to shabby """ WIKI_LINK = "https://github.com/russ-hensel/qt5_by_example/wiki/What-We-Know-About-QPushButtons"
Some metadata that controls the selection and behavior of the tab ( for good example code see button code ). This metadata is used to construct the key words lookup as well as other aspects of the code.
if __name__ == "__main__":
#----- run the full app
import main
A little magic to run the app from any tab ( use a restarted interpreter for each run )
from PyQt5 import QtGui
from PyQt5.QtCore import (QDate,
QDateTime,
QModelIndex,
QSize,
Qt,
QTime,
QTimer)
.........
More imports than are needed -- we will use pycln to improve this in the future.
class QPushButtonTab( tab_base.TabBase ):
def __init__(self):
The tab's class and init. All framework, no exercise code.
def _build_gui_widgets(self, main_layout):
Basic creation for the widgets of interest, along with a bit of framework code, it should be clear which is which. Read it for the exercise.
def mutate_0(self):
Code for the excise using a bit of the framework for messaging. Read it for the exercise.
def inspect(self):
Mostly framework for the wat-inspector
def breakpoint(self):
All boiler plate for the breakpoint function