Skip to content

Commit

Permalink
ENH: Dialogs - Add method to hide last dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtJacobson committed Oct 4, 2020
1 parent 46f9699 commit 14ed1ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions qtpyvcp/widgets/dialogs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

LOG = getLogger(__name__)

ACTIVE_DIALOGS = []


def getDialog(name):
"""Get dialog instance from name.
Expand Down Expand Up @@ -40,6 +42,20 @@ def showDialog(name):
dialog.move(win_pos.x() - dialog.width() / 2, win_pos.y() - dialog.height() / 2)

dialog.show()
ACTIVE_DIALOGS.append(dialog)


def hideActiveDialog():
try:
dialog = ACTIVE_DIALOGS.pop(-1)
dialog.hide()
except:
pass


def hideDialog(name):
dialog = getDialog(name)
dialog.hide()


def askQuestion(title='', message='', parent=None):
Expand Down

0 comments on commit 14ed1ae

Please sign in to comment.