Skip to content
This repository has been archived by the owner on Dec 23, 2022. It is now read-only.

Commit

Permalink
Move menu to 'tools', tidyup menu code
Browse files Browse the repository at this point in the history
  • Loading branch information
RawToast committed Jul 31, 2021
1 parent 35aa16d commit 4a37df8
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,32 +493,17 @@ def saveMassRetirementTimestamp(timestamp):
mw.addonManager.writeConfig(__name__, config)

def setupMenu():
addMenu = False
if not hasattr(mw, 'RetirementMainMenu'):
mw.RetirementMainMenu = QMenu('Retirement', mw)
addMenu = True
if not hasattr(mw, 'RetirementMenuSettings'):
mw.RetirementMenuSettings = []
if not hasattr(mw, 'RetirementMenuActions'):
mw.RetirementMenuActions = []

setting = QAction("Retirement Settings", mw)
setting.triggered.connect(openSettings)
mw.RetirementMenuSettings.append(setting)
action = QAction("Run Mass Retirement", mw)
action.triggered.connect(testretire)
mw.RetirementMenuActions.append(action)

mw.RetirementMainMenu.clear()
for act in mw.RetirementMenuSettings:
mw.RetirementMainMenu.addAction(act)
mw.RetirementMainMenu.addSeparator()
for act in mw.RetirementMenuActions:
mw.RetirementMainMenu.addAction(act)

if addMenu:
mw.form.menubar.insertMenu(mw.form.menuHelp.menuAction(), mw.RetirementMainMenu)
subMenu = QMenu('Retirement', mw)
mw.form.menuTools.addMenu(subMenu)

retirementSettings= QAction("Retirement Settings", mw)
retirementSettings.triggered.connect(openSettings)
subMenu.addAction(retirementSettings)

massRetirement = QAction("Run Mass Retirement", mw)
massRetirement.triggered.connect(testretire)
subMenu.addAction(massRetirement)

setupMenu()
sched.Scheduler.answerCard = wrap(sched.Scheduler.answerCard, checkInterval)
schedv2.Scheduler.answerCard = wrap(schedv2.Scheduler.answerCard, checkInterval)
Expand Down

0 comments on commit 4a37df8

Please sign in to comment.