Browse Source

Add submenu parameter to only have cancel

master
Nils 4 years ago
parent
commit
fcec995718
  1. 5
      template/qtgui/submenus.py

5
template/qtgui/submenus.py

@ -50,10 +50,13 @@ class Submenu(QtWidgets.QDialog):
#self.setFocus(); #self.grabKeyboard(); #redundant for a proper modal dialog. Leave here for documentation reasons.
if hasOkCancelButtons:
if hasOkCancelButtons == 1: #or true
self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
self.buttonBox.accepted.connect(self.process)
self.buttonBox.rejected.connect(self.reject)
elif hasOkCancelButtons == 2: #only cancel. #TODO: unpythonic.
self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel)
self.buttonBox.rejected.connect(self.reject)
else:
self.buttonBox = None

Loading…
Cancel
Save