Browse Source

Add dynamic label to submenus that can be changed at every call

master
Nils 7 months ago
parent
commit
2de9d13343
  1. 7
      template/qtgui/submenus.py

7
template/qtgui/submenus.py

@ -50,6 +50,10 @@ class Submenu(QtWidgets.QDialog):
label = QtWidgets.QLabel(labelString) #"Choose a clef" or so.
self.layout.addWidget(label)
#Second Label that can be changed on every call with self.dynamicLabel.setText()
self.dynamicLabel = QtWidgets.QLabel("")
self.layout.addWidget(self.dynamicLabel)
#self.setFocus(); #self.grabKeyboard(); #redundant for a proper modal dialog. Leave here for documentation reasons.
if hasOkCancelButtons == 1: #or true
@ -100,7 +104,8 @@ class Submenu(QtWidgets.QDialog):
self.done(True)
def __call__(self):
"""This instance can be called like a function"""
"""This instance can be called like a function.
Subclasses can subclass this as well to create non-static functionality."""
if self.buttonBox:
self.layout.addWidget(self.buttonBox)
self.setFixedSize(self.layout.geometry().size())

Loading…
Cancel
Save