Skip to content

Commit

Permalink
simplify menu handling
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Aug 21, 2024
1 parent 9524aad commit d8ca5e7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions client/ayon_core/tools/utils/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,19 @@ def _on_options_button_clicked(self):
return

menu = QtWidgets.QMenu(self)
menu.triggered.connect(self._on_option_action)
for option in self._options:
if option in self.SEPARATORS:
menu.addSeparator()
continue
action = menu.addAction(option)
action.triggered.connect(self._on_option_action)
else:
menu.addAction(option)

rect = self._options_button.rect()
pos = self._options_button.mapToGlobal(rect.bottomLeft())
menu.exec_(pos)

def _on_option_action(self):
action = self.sender()
if action:
self.setText(action.text())
def _on_option_action(self, action):
self.setText(action.text())


class ExpandingTextEdit(QtWidgets.QTextEdit):
Expand Down

0 comments on commit d8ca5e7

Please sign in to comment.