Skip to content

Commit

Permalink
Refactor onIoSettings and set it as config action (closes #53)
Browse files Browse the repository at this point in the history
  • Loading branch information
glutanimate committed Mar 13, 2018
1 parent d7e39c3 commit 08b74a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/image_occlusion_enhanced/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
logging.basicConfig(stream=sys.stdout, level=logging.ERROR)


def onIoSettings(mw):
def onIoSettings():
"""Call settings dialog if Editor not active"""
if hasattr(mw, "ImgOccEdit") and mw.ImgOccEdit.visible:
tooltip("Please close Image Occlusion Editor\
to access the Options.")
return
dialog = ImgOccOpts(mw)
dialog = ImgOccOpts()
dialog.exec_()


Expand Down Expand Up @@ -193,7 +193,8 @@ def onShowAnswer(self, _old):
# Set up menus
options_action = QAction("Image &Occlusion Enhanced Options...", mw)
help_action = QAction("Image &Occlusion Enhanced...", mw)
options_action.triggered.connect(lambda _, o=mw: onIoSettings(o))
options_action.triggered.connect(onIoSettings)
mw.addonManager.setConfigAction(__name__, onIoSettings)
help_action.triggered.connect(onIoHelp)
mw.form.menuTools.addAction(options_action)
mw.form.menuHelp.addAction(help_action)
Expand Down
2 changes: 1 addition & 1 deletion src/image_occlusion_enhanced/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def keyReleaseEvent(self, evt):
class ImgOccOpts(QDialog):
"""Main Image Occlusion Options dialog"""

def __init__(self, mw):
def __init__(self):
QDialog.__init__(self, parent=mw)
loadConfig(self)
self.ofill = self.sconf['ofill']
Expand Down

0 comments on commit 08b74a1

Please sign in to comment.