Skip to content

Commit

Permalink
BUG: fix program actions bind ok method
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtJacobson committed Feb 17, 2019
1 parent 601deed commit 72c34e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion qtpyvcp/actions/program_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _run_ok(widget=None):
def _run_bindOk(widget):
STATUS.estop.onValueChanged(lambda: _run_ok(widget))
STATUS.enabled.onValueChanged(lambda: _run_ok(widget))
STATUS.all_homed.connect(lambda: _run_ok(widget))
STATUS.all_axes_homed.onValueChanged(lambda: _run_ok(widget))
STATUS.interp_state.onValueChanged(lambda: _run_ok(widget))
STATUS.file.onValueChanged(lambda: _run_ok(widget))

Expand Down
25 changes: 13 additions & 12 deletions qtpyvcp/widgets/form_widgets/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,20 @@ def getMenuAction(self, menu_action, title='notitle', action_name='noaction'):
'action': actions,
}

try:
mod, action = action_name.split('.', 1)
method = getattr(env.get(mod, self), action)
menu_action.triggered.connect(method)
return
except:
pass
if action_name is not None:
try:
mod, action = action_name.split('.', 1)
method = getattr(env.get(mod, self), action)
menu_action.triggered.connect(method)
return
except:
pass

try:
actions.bindWidget(menu_action, action_name)
return
except actions.InvalidAction:
pass
try:
actions.bindWidget(menu_action, action_name)
return
except actions.InvalidAction:
LOG.exception('Error binding menu action %s', action_name)

msg = "The <b>{}</b> action specified for the " \
"<b>{}</b> menu item could not be triggered. " \
Expand Down

0 comments on commit 72c34e2

Please # to comment.