Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added message dialog #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lucia/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see https://github.com/LuciaSoftware/lucia/blob/master/LICENSE.

from .menu import *
from .virtualinput import *
from menu import *
from dialogs import *
from menu2 import *
23 changes: 22 additions & 1 deletion lucia/ui/virtualinput.py → lucia/ui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,33 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see https://github.com/LuciaSoftware/lucia/blob/master/LICENSE.

"""A module providing the ability to prompt the user for varying input
"""A module providing the ability to prompt the user for varying input and for displaying any message
"""

import lucia
import string
from lucia.utils import timer
class message_dialog:
"""this class is to show a message dialog to display an info to the user
"""
def __init__(self, message='message'):
"""initializes self

args:
message: str. a message to display to the user
"""
self.message=message
self.running=False
def run(self):
"""presents the message to the user"""
lucia.output.output(self.message)
self.running=True
while self.running:
lucia.process_events()
if lucia.key_pressed(lucia.K_UP) or lucia.key_pressed(lucia.K_DOWN) or lucia.key_pressed(lucia.K_LEFT) or lucia.key_pressed(lucia.K_RIGHT):
lucia.output.output(self.message)
if lucia.key_pressed(lucia.K_RETURN) or lucia.key_pressed(lucia.K_ESCAPE):
self.running=False

class VirtualInput:
def __init__(self, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions lucia/ui/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class YesNoMenu(Menu):
args:
args (tuple): Set of arguments to pass to Menu.__init__
"""
def __init__(*args):
super().__init__(args)
def __init__(self, *args):
super(YesNoMenu, self).__init__(args)
self.add_item_tts("Yes", "yes")
self.add_item_tts("No", "No")
2 changes: 1 addition & 1 deletion lucia/ui/menu2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import time

import lucia
from lucia.ui.virtualinput import *
from lucia.ui.dialogs import *

# Events
CANCELEVENT = 0
Expand Down