-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirm_ui.py
28 lines (23 loc) · 886 Bytes
/
confirm_ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import urwid
class ConfirmUI(object):
"""Shows a list of registered performers to allow management of them"""
def __init__(self, callback_yes, callback_no, manager):
# Store the context
self.manager = manager
# Set the chrome
self.title = "Really Delete?"
self.shortcuts = None
# Create the UI
self.question = urwid.Text("Are you sure you want to delete?")
self.yes = urwid.Button("Yes")
self.no = urwid.Button("No")
buttons = urwid.Columns([self.yes, self.no])
self.widget = urwid.Padding(
urwid.Filler(
urwid.Pile([self.question, buttons])
),
"center", ("relative", 50)
)
# Plug in the events
urwid.connect_signal(self.yes, "click", callback_yes)
urwid.connect_signal(self.no, "click", callback_no)