Browse Source

Add buttons to submenues

master
Nils 4 years ago
parent
commit
324a73b949
  1. 27
      qtgui/submenus.py

27
qtgui/submenus.py

@ -166,7 +166,7 @@ class SecondaryClefMenu(Submenu):
]
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "choose a clef"))
super().__init__(mainWindow, translate("submenus", "choose a clef"), hasOkCancelButtons=2)
for number, (prettyname, function) in enumerate(SecondaryClefMenu.clefs):
button = QtWidgets.QPushButton(prettyname)
@ -188,7 +188,7 @@ class SecondarySplitMenu(Submenu):
]
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "split chord in"))
super().__init__(mainWindow, translate("submenus", "split chord in"), hasOkCancelButtons=2)
for number, (prettyname, function) in enumerate(SecondarySplitMenu.splits):
button = QtWidgets.QPushButton(prettyname)
@ -200,7 +200,7 @@ class SecondarySplitMenu(Submenu):
class SecondaryKeySignatureMenu(Submenu):
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "root note is the cursor position"))
super().__init__(mainWindow, translate("submenus", "root note is the cursor position"), hasOkCancelButtons=2)
l = [("[{}] {}".format(num+1, modeString.title()), lambda r, modeString=modeString: api.insertCursorCommonKeySignature(modeString)) for num, modeString in enumerate(api.commonKeySignaturesAsList())]
for number, (prettyname, function) in enumerate(l):
@ -212,7 +212,7 @@ class SecondaryKeySignatureMenu(Submenu):
class SecondaryDynamicsMenu(Submenu):
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "choose a dynamic"))
super().__init__(mainWindow, translate("submenus", "choose a dynamic"), hasOkCancelButtons=2)
button = QtWidgets.QPushButton(translate("submenus", "[r] Ramp"))
button.setShortcut(QtGui.QKeySequence("r"))
self.layout.addWidget(button)
@ -230,7 +230,7 @@ class SecondaryDynamicsMenu(Submenu):
class SecondaryMetricalInstructionMenu(Submenu):
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "choose a metrical instruction"))
super().__init__(mainWindow, translate("submenus", "choose a metrical instruction"), hasOkCancelButtons=2)
l = [("[{}] {}".format(num+1, modeString), lambda r, modeString=modeString: api.insertCommonMetricalInstrucions(modeString)) for num, modeString in enumerate(api.commonMetricalInstructionsAsList())]
@ -250,7 +250,7 @@ class SecondaryTempoChangeMenu(Submenu):
def __init__(self, mainWindow, staticExportTempoItem = None):
super().__init__(mainWindow, translate("submenus", "choose units per minute, reference note, graph type"))
super().__init__(mainWindow, translate("submenus", "choose units per minute, reference note, graph type"), hasOkCancelButtons=True)
self.mainWindow = mainWindow
self.staticExportTempoItem = staticExportTempoItem
@ -299,7 +299,7 @@ class SecondaryTemporaryTempoChangeMenu(Submenu):
lastCustomValue = 0.42
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "[enter] to use value"))
super().__init__(mainWindow, translate("submenus", "[enter] to use value"), hasOkCancelButtons=True)
self.spinbox = QtWidgets.QDoubleSpinBox()
self.spinbox.setValue(SecondaryTemporaryTempoChangeMenu.lastCustomValue)
@ -316,7 +316,7 @@ class SecondaryTemporaryTempoChangeMenu(Submenu):
class BlockPropertiesEdit(Submenu):
def __init__(self, mainWindow, staticExportItem):
def __init__(self, mainWindow, staticExportItem, hasOkCancelButtons=True):
super().__init__(mainWindow, "")
self.mainWindow = mainWindow
@ -345,7 +345,7 @@ class BlockPropertiesEdit(Submenu):
class TempoBlockPropertiesEdit(Submenu):
def __init__(self, mainWindow, staticExportItem):
super().__init__(mainWindow, "")
super().__init__(mainWindow, "", hasOkCancelButtons=True)
self.mainWindow = mainWindow
self.staticExportItem = staticExportItem
@ -464,7 +464,7 @@ class SecondaryProgramChangeMenu(Submenu):
lastLsbValue = 0
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "Instrument Change"))
super().__init__(mainWindow, translate("submenus", "Instrument Change"), hasOkCancelButtons=True)
self.program = QtWidgets.QSpinBox()
self.program.setValue(type(self).lastProgramValue)
@ -482,11 +482,6 @@ class SecondaryProgramChangeMenu(Submenu):
self.layout.addRow(translate("submenus", "Short Name"), self.shortInstrumentName)
self.insert = QtWidgets.QPushButton(translate("submenus", "Insert"))
self.insert.clicked.connect(self.process)
self.layout.addWidget(self.insert)
def process(self):
program = self.program.value()
type(self).lastProgramValue = program
@ -503,7 +498,7 @@ class SecondaryChannelChangeMenu(Submenu):
lastCustomValue = 0
def __init__(self, mainWindow):
super().__init__(mainWindow, translate("submenus", "Channel Change 1-16. [enter] to use value"))
super().__init__(mainWindow, translate("submenus", "Channel Change 1-16. [enter] to use value"), hasOkCancelButtons=True)
self.spinbox = QtWidgets.QSpinBox()
self.spinbox.setValue(type(self).lastCustomValue)

Loading…
Cancel
Save