Esempio n. 1
0
    def create_show(self):
        """Create a show."""
        show_name = input_dialog(title='Mode',
                                 text='Cool, got a name for your show?',
                                 style=self.example_style).run()

        # create shows folder
        show_path = os.path.normpath(
            os.path.join(self.machine_path, "shows", show_name))
        shows_dir = os.path.normpath(os.path.join(self.machine_path, "shows"))

        if not os.path.exists(show_path):
            if self.in_machine_folder():
                self.create_show_structure(show_name, shows_dir,
                                           self.machine_path)
                message_dialog(
                    title='Shows',
                    text=HTML(
                        '<style fg="green">Success:</style> Created show {}.'.
                        format(show_name)),
                    # text='Success: Created machine config {}.'.format(config_name),
                    style=self.example_style).run()
            else:
                self.show_not_in_machine_folder_dialog()

        else:
            message_dialog(
                title='Mode',
                text=HTML(
                    '<style fg="red">Error:</style> A show with this name already exists\nPlease pick another one!'
                ),
                style=self.example_style).run()
            self._create_machine_config()
Esempio n. 2
0
def main(session):

    # Choose option Login/Register

    student_register = button_dialog(
        title='Student Login',
        text='Choose Login to Continue or Get registered ',
        buttons=[
            ('Login', False),
            ('Register', True),
        ],
    ).run()

    if student_register:
        register(session)
    else:
        auth_status, username = stu_auth(session, is_stu=True)

        if auth_status:
            session.student_username = username
            stu_prompt(session)
        else:
            message_dialog(
                title='Authentication Failed',
                text='Invalid Username/Password. Press ENTER to try again.'
            ).run()
            main(session)
Esempio n. 3
0
    def create_machine_config(self):
        """Create a machine config."""
        config_name = input_dialog(
            title='Machine Config',
            text='Please enter the name of your machine config:',
            style=self.example_style).run()

        if config_name is None:
            sys.exit()

        # create machine_config folder
        self.machine_path = os.path.join(self.current_path, config_name)

        if not os.path.exists(self.machine_path):

            self.create_machine_config_structure(config_name,
                                                 self.machine_path)
            self.current_path = self.machine_path
            message_dialog(
                title='Mode',
                text=HTML(
                    '''<style fg="green">Success:</style> Created machine config {}.
                    \nYou can now create modes and shows.'''.format(
                        config_name)),
                style=self.example_style).run()
        else:
            message_dialog(
                title='Mode',
                text=HTML(
                    '''<style fg="red">Error:</style> A machine config with this name exists already
                    \nPlease pick another one')'''),
                style=self.example_style).run()
            self._create_machine_config()
Esempio n. 4
0
def migrate_non_secure_only_prompt(style: Style):
    message_dialog(title='Configs Migration',
                   text="""


                CONFIGS MIGRATION:

                We have recently refactored the way hummingbot handles configurations.
                We will now attempt to migrate any legacy config files to the new format.

                    """,
                   style=style).run()
    errors = migrate_non_secure_configs_only()
    if len(errors) != 0:
        _migration_errors_dialog(errors, style)
    else:
        message_dialog(title='Configs Migration Success',
                       text="""


                            CONFIGS MIGRATION SUCCESS:

                            The migration process was completed successfully.

                                """,
                       style=style).run()
Esempio n. 5
0
def main():
    message_dialog(
        title='JMK OS 2.0',
        text='JMK OS fixed errors in your applications. '
        'Though your system is clean,\n'
        'this means your installation media may have been corrupted.\n'
        'Consider creating new media next time you install JMK OS.')
Esempio n. 6
0
def start(argv=None):
    global current_file

    argv = sys.argv if argv is None else argv
    if len(sys.argv) > 2:
        sys.exit("Usage: qpython [filename]")
    elif len(sys.argv) == 2:
        current_file = Path(sys.argv[1]).resolve()
        with current_file.open(encoding="utf8") as open_file:
            code.buffer.text = open_file.read()
            open_file_frame.title = current_file.name
    else:
        message_dialog(
            title="Welcome to",
            text="""QuickPython version 0.0.2

Copyright (c) 2020 Timothy Crosley. Few rights reserved. MIT Licensed.
Simultanously distributed to the US and Canada. And you know, the rest of the world.

A productive parody.
""",
            style=style,
        ).run()

    app.layout.focus(code.buffer)
    app.run()
Esempio n. 7
0
def start(argv=None):
    global current_file
    global isort_config
    global black_config

    argv = sys.argv if argv is None else argv
    if len(sys.argv) > 2:
        sys.exit("Usage: qpython [filename]")
    elif len(sys.argv) == 2:
        current_file = Path(sys.argv[1]).resolve()
        isort_config = isort.Config(settings_path=current_file.parent)
        black_config_file = black.find_pyproject_toml((str(current_file), ))
        if black_config_file:
            black_config = black.parse_pyproject_toml(black_config_file)
        else:
            black_config = {}

        open_file_frame.title = current_file.name
        if current_file.exists():
            with current_file.open(encoding="utf8") as open_file:
                code.buffer.text = open_file.read()
    else:
        message_dialog(
            title="Welcome to",
            text=ABOUT_MESSAGE,
            style=style,
        ).run()

    app.layout.focus(code.buffer)
    app.run()
Esempio n. 8
0
def main():
    message_dialog(
        title=HTML('<style bg="blue" fg="white">Styled</style> '
                   '<style fg="ansired">dialog</style> window'),
        text="Do you want to continue?\nPress ENTER to quit.",
        style=example_style,
    ).run()
Esempio n. 9
0
    def create_mode(self):
        """Create a mode."""
        mode_name = input_dialog(title='Mode',
                                 text='Cool, got a name for your mode?',
                                 style=self.example_style).run()

        # create mode folder
        mode_path = os.path.join(self.machine_path, "modes", mode_name)
        if not os.path.exists(mode_path):
            self.create_mode_structure(mode_name, mode_path, self.machine_path)
            message_dialog(
                title='Mode',
                text=HTML(
                    '''<style fg="green">Success:</style> Created mode {}.
                    \nDon\'t forget to add it to your mode list.'''.format(
                        mode_name)),
                style=self.example_style).run()

        else:
            message_dialog(
                title='Mode',
                text=HTML(
                    '<style fg="red">Error:</style> A mode with this name exists already\nPlease pick another one'
                ),
                style=self.example_style).run()
            self.create_mode()
Esempio n. 10
0
def save(contents,filepath):
  try:
    fp=open(filepath,'w')
    fp.write(contents)
    fp.close()
  except FileNotFoundError:
    message_dialog(title='ERROR',text='Could not write to file:\n'+os.getcwd()+filename)
    break_dance=True
Esempio n. 11
0
 def show_not_in_machine_folder_dialog(self):
     """Show error message if current directory is not a machine folder."""
     message_dialog(
         title='Wrong directory',
         text=HTML(
             '<style fg="red">Error:</style> You dont\'t seem to be in a machine folder.\nPlease switch to one!'
         ),
         style=self.example_style).run()
     sys.exit()
Esempio n. 12
0
    def _init_window(self):
        clear()
        set_title("Test Infra CLI")

        if not self._global_variables.pull_secret:
            message_dialog(
                title="Pull Secret",
                text=
                "Cant find PULL_SECRET, some functionality might not work as expected"
            ).run()
Esempio n. 13
0
    def handle(self):
        headers = ("", "Key", "Single Press", "Double Press")
        keys = [
            ("1", "Control + C", "Clear the text if exist else exit the cli"),
            ("2", "Control + Q", "Exit the cli"),
            ("3", "Tab", "Enter and navigate the autocomplete menu"),
            ("4", "Right", "Step right or autocomplete from history"),
        ]
        table = tabulate(keys, headers=headers, tablefmt="fancy_grid")

        message_dialog(title="Help", text=str(table)).run()
Esempio n. 14
0
    def write_archive(self):
        """ writes out the stripped archive """
        self.archive_written = True
        if self.filetype == 'tar':
            destination_file = self.get_stripped_filename()
            if os.path.exists(destination_file):
                result = yes_no_dialog(
                    title="Action confirmation",
                    text=
                    f"File exists: {destination_file}\nDo you want to overwrite it?"
                ).run()
                if not result:
                    return False
            archive_command = [
                'tar',
                '--options',
                'gzip:compression-level=9',
                '-czf',
                destination_file,

                # --exclude='*wp-content/uploads/2*' \
                # --exclude '*backup*.tar.gz' \
                # --exclude '*public_html/video/*' \
                # --exclude '*.wpress'
            ]
            for filename in self.file_filters:
                archive_command += [
                    '--exclude',
                    f"'{filename}'",
                ]
            archive_command.append(f"@{self.filename}")

            string_command = " ".join(archive_command)

            logger.warning(f"I'm running this:")
            logger.warning(string_command)

            start_time = time()
            old_file_size = self.get_file_size()
            logger.info("Running tar command...")
            subprocess.run(" ".join(archive_command), shell=True)
            #logger.info("Done!")
            new_file_size = human_file_size(os.path.getsize(destination_file))
            total_time = round(time() - start_time, 2)
            logger.info(f"")
            message_dialog(
                title='Archive munging complete',
                text=
                f"It took: {total_time} seconds.\nOld file size: {old_file_size}\nNew file size: {new_file_size}"
            ).run()
        else:
            raise NotImplementedError("Uh, not done yet!")
        self.move_stripped_over_original()
Esempio n. 15
0
def _migration_errors_dialog(errors, style: Style):
    padding = "\n                    "
    errors_str = padding + padding.join(errors)
    message_dialog(title='Configs Migration Errors',
                   text=f"""


                CONFIGS MIGRATION ERRORS:

                {errors_str}

                    """,
                   style=style).run()
Esempio n. 16
0
    def show_file_filters(self):
        """ shows the user a list of the files selected """
        if not self.file_filters:
            message_dialog(
                title='No files selected!',
                text='Please return to the main menu\nAnd select some files.',
            ).run()
        else:
            for file in self.file_filters:
                print(file)

            text = prompt('Hit enter to continue'
                          )  #, lexer=PygmentsLexer(HtmlLexer),style=our_style)
        return True
Esempio n. 17
0
def main(session):
    """
        Entry Point for admin view.
    """

    # Authenticate admin user
    while True:
        if auth(session, is_admin=True):
            break
        else:
            message_dialog(
                title='Authentication Failed',
                text='Invalid Username/Password. Press ENTER to try again.').run()

    # Start Admin Prompt
    admin_prompt(session)
Esempio n. 18
0
def login_prompt(secrets_manager_cls: Type[BaseSecretsManager], style: Style):
    err_msg = None
    secrets_manager = None
    if Security.new_password_required() and legacy_confs_exist():
        secrets_manager = migrate_configs_prompt(secrets_manager_cls, style)
    if Security.new_password_required():
        show_welcome(style)
        password = input_dialog(title="Set Password",
                                text="""
    Create a password to protect your sensitive data.
    This password is not shared with us nor with anyone else, so please store it securely.

    If you have used hummingbot before and already have secure configs stored,
    input your previous password in this prompt. The next step will automatically
    migrate your existing configs.

    Enter your new password:""",
                                password=True,
                                style=style).run()
        if password is None:
            return None
        re_password = input_dialog(title="Set Password",
                                   text="Please re-enter your password:"******"Passwords entered do not match, please try again."
        else:
            secrets_manager = secrets_manager_cls(password)
            store_password_verification(secrets_manager)
        migrate_non_secure_only_prompt(style)
    else:
        password = input_dialog(title="Welcome back to Hummingbot",
                                text="Enter your password:"******"Invalid password - please try again."
    if err_msg is not None:
        message_dialog(title='Error', text=err_msg, style=style).run()
        return login_prompt(secrets_manager_cls, style)
    return secrets_manager
Esempio n. 19
0
def prompt_datetime(
    for_attr: Optional[str] = None,
    prompt_msg: Optional[str] = None,
) -> datetime:
    m: str = create_prompt_string(datetime, for_attr, prompt_msg)
    import dateparser  # type: ignore[import]

    # can cause lag on slower machines because of the constant
    # recomputes - put it behind a envvar-enabled feature
    if "AUTOTUI_DATETIME_LIVE" in os.environ:
        dt_validator = LiveDatetimeValidator(parser_func=dateparser.parse)
        resp = prompt(
            m,
            validator=ThreadedValidator(dt_validator),
            bottom_toolbar=dt_validator.toolbar,
        )
        dt = dateparser.parse(resp)
        assert dt is not None and isinstance(
            dt, datetime
        ), "Fatal Erorr; Could not parse response from datetime prompt into a datetime"
        return dt
    else:
        parsed_time: Optional[datetime] = None
        while parsed_time is None:
            time_str: Optional[str] = input_dialog(
                title="Describe the datetime:",
                text=
                "For example:\n'now', '2 hours ago', 'noon', 'tomorrow at 10PM', 'may 30th at 8PM'",
                style=STYLE,
            ).run()
            if time_str is None:
                # hmm -- is this dangerous? user is prompting, so unless they've left the file
                # open this should be fine. everything in shortcuts.py is atomic-like
                # on purpose so this doesnt run into a problem there
                #
                # the alternative is to write bogus info, but perhaps that runs into
                # less problems with losing data?
                print("Cancelled, exiting...")
                sys.exit(1)
            parsed_time = dateparser.parse(time_str)
            if parsed_time is None:
                message_dialog(
                    title="Error",
                    text=f"Could not parse '{time_str}' into datetime...",
                    style=STYLE,
                ).run()
        return parsed_time
Esempio n. 20
0
def import_email(assessment, campaign_number, template_smtp):
    """Import email from file."""
    temp_template = Template(name=f"{assessment.id}-T{str(campaign_number)}")
    temp_smtp = copy.deepcopy(template_smtp)
    temp_smtp.name = f"{assessment.id}-SP-{campaign_number}"

    # Receives the file name and checks if it exists.
    while True:
        try:
            import_file_name = get_input("    Import File name?")
            # Drops .json if included so it can always be added as fail safe.
            import_file_name = import_file_name.split(".", 1)[0]

            with open(import_file_name + ".json") as importFile:
                import_temp = json.load(importFile)

            # Validates that all fields are present or raise MissingKey Error.
            email_import_validation(import_temp)
            break
        except EnvironmentError:
            logging.critical(
                "Import File not found: {}.json".format(import_file_name))
            print("Please try again...")

        except MissingKey as e:
            # Logs and indicates the user should correct before clicking ok which will re-run the import.
            logging.critical("Missing Field from import: {}".format(e.key))
            message_dialog(
                title="Missing Field",
                text=
                f'Email import is missing the "{e.key}" field, please correct before clicking Ok.\n {e.key}: {e.description}',
            )

            continue

    # Finalize SMTP profile, push to GoPhish for check.
    # TODO Need to valid this formatting.
    temp_smtp.from_address = import_temp["from_address"]

    # Load
    temp_template.subject = import_temp["subject"]
    temp_template.html = import_temp["html"]
    temp_template.text = import_temp["text"]
    temp_template.name = f"{assessment.id}-T{str(campaign_number)}-{import_temp['id']}"

    return temp_smtp, temp_template
Esempio n. 21
0
    def __se_is_selected(self):
        """判断交易所是否已选择"""
        if self.__se_info:  # 非空
            selected_se = ''
            for el in self.__se_info:
                selected_se += el.split(':')[0] + ' '
            self.__se_selected = yes_no_dialog(title="确认",
                                               text="你选中了: " + selected_se,
                                               yes_text="确认",
                                               no_text="返回").run()

            if not self.__se_selected:  # 选择了返回,则回到交易所选择界面
                self.interactive_start()
            else:
                self.__alert_stock_selecting()

        else:  # 空
            message_dialog(title='提示', text='尚未选中交易所信息!').run()
            self.interactive_start()
Esempio n. 22
0
def login_prompt():
    from hummingbot.client.config.security import Security

    err_msg = None
    if Security.new_password_required():
        show_welcome()
        password = input_dialog(
            title="Set Password",
            text="Create a password to protect your sensitive data. "
                 "This password is not shared with us nor with anyone else, so please store it securely."
                 "\n\nEnter your new password:"******"Set Password",
            text="Please re-enter your password:"******"Passwords entered do not match, please try again."
        else:
            Security.login(password)
    else:
        password = input_dialog(
            title="Welcome back to Hummingbot",
            text="Enter your password:"******"Invalid password - please try again."
    if err_msg is not None:
        message_dialog(
            title='Error',
            text=err_msg,
            style=dialog_style).run()
        return login_prompt()
    return True
Esempio n. 23
0
def login_prompt():
    from hummingbot.client.config.security import Security
    import time

    err_msg = None
    if Security.new_password_required():
        show_welcome()
        password = input_dialog(
            title="Set Password",
            text="Create a password to protect your sensitive data. "
            "This password is not shared with us nor with anyone else, so please store it securely."
            "\n\nEnter your new password:"******"Set Password",
                                   text="Please re-enter your password:"******"Passwords entered do not match, please try again."
        else:
            Security.login(password)
            # encrypt current timestamp as a dummy to prevent promping for password if bot exits without connecting an exchange
            dummy = f"{time.time()}"
            Security.update_secure_config("default", dummy)
    else:
        password = input_dialog(title="Welcome back to Hummingbot",
                                text="Enter your password:"******"Invalid password - please try again."
    if err_msg is not None:
        message_dialog(title='Error', text=err_msg, style=dialog_style).run()
        return login_prompt()
    return True
Esempio n. 24
0
def bert_to_text(vocabulary_file, model_dir, output_path, num_worker):
    # Source: https://github.com/hanxiao/bert-as-service
    # Start Bert Model: bert-serving-start -model_dir /tmp/uncased_L-12_H-768_A-12/ -num_worker=4
    # model: 'base' (768 dimensions) or 'large' (1024 dimensions)

    message_dialog(
        title='BERT binary conversion to word embeddings',
        text=
        'BERT conversion requires that the server component of bert-as-service is running. Please execute\n'
        'the following command in a separate terminal and wait until the server reports "all set, ready to serve request!".\n'
        'Note that bert-as-service creates temporary files in the working directory the command is executed in, which\n'
        'must be removed manually after termination. The number of workers may be increased depending on available resources \n'
        'and ulimit restrictions.\n\n'
        'bert-serving-start -model_dir={} -num_worker=1'.format(
            str(model_dir))).run()

    with open(vocabulary_file, 'r') as f:
        words = f.readlines()

    # Create directory
    os.makedirs(output_path.parent, exist_ok=True)

    with open(output_path, 'w') as embedding_file:
        # Load pre-trained model (weights)
        with BertClient() as bc:

            count_not_found = 0
            print('Obtaining per-word embedding ...')
            with ProgressBar() as pb:
                for word in pb(words):
                    word = word.strip()
                    output_embedding = bc.encode([word])
                    embedding = ' '.join(map(str, output_embedding[0]))
                    print(word, embedding, file=embedding_file)

            print(count_not_found, ' words not found.')

    message_dialog(
        title='BERT binary conversion to word embeddings',
        text=
        'BERT conversion complete. bert-as-service may now be safely terminated.'
    ).run()
Esempio n. 25
0
def show_welcome():
    message_dialog(
        title='Welcome to Hummingbot',
        text="""

    ██╗  ██╗██╗   ██╗███╗   ███╗███╗   ███╗██╗███╗   ██╗ ██████╗ ██████╗  ██████╗ ████████╗
    ██║  ██║██║   ██║████╗ ████║████╗ ████║██║████╗  ██║██╔════╝ ██╔══██╗██╔═══██╗╚══██╔══╝
    ███████║██║   ██║██╔████╔██║██╔████╔██║██║██╔██╗ ██║██║  ███╗██████╔╝██║   ██║   ██║
    ██╔══██║██║   ██║██║╚██╔╝██║██║╚██╔╝██║██║██║╚██╗██║██║   ██║██╔══██╗██║   ██║   ██║
    ██║  ██║╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║██║ ╚████║╚██████╔╝██████╔╝╚██████╔╝   ██║
    ╚═╝  ╚═╝ ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚═╝╚═╝╚═╝  ╚═══╝ ╚═════╝ ╚═════╝  ╚═════╝    ╚═╝

    =======================================================================================

    Version:  [version number]
    Codebase: https://github.com/coinalpha/hummingbot


        """,
        style=dialog_style).run()
    message_dialog(
        title='Important Warning',
        text="""


    PLEASE READ THIS CAREFULLY BEFORE USING HUMMINGBOT:

    Hummingbot is a free and open source software client that helps you build algorithmic
    crypto trading strategies.

    Algorithmic crypto trading is a risky activity. You will be building a "bot" that
    automatically places orders and trades based on parameters that you set. Please take
    the time to understand how each strategy works before you risk real capital with it.
    You are solely responsible for the trades that you perform using Hummingbot.

    To use Hummingbot, you first need to give it access to your crypto assets by entering
    API keys and/or private keys. These keys are not shared with anyone, including us.

    On the next screen, you will set a password to protect your use of Hummingbot. Please
    store this password safely, since only you have access to it and we cannot reset it.

        """,
        style=dialog_style).run()
    message_dialog(
        title='Important Warning',
        text="""


    SET A SECURE PASSWORD:

    To use Hummingbot, you will need to give it access to your crypto assets by entering
    your exchange API keys and/or wallet private keys. These keys are not shared with
    anyone, including us.

    On the next screen, you will set a password to protect these keys and other sensitive
    data. Please store this password safely since there is no way to reset it.

        """,
        style=dialog_style).run()
Esempio n. 26
0
def label(ctx, ds_path, level):
    """
    Export specific label from a ZarrDataset.
    \f

    Args:
        ds_path (str): path to the dataset
    """

    show_trace = logger.getEffectiveLevel() <= logging.DEBUG
    ds = open_dataset(ds_path, show_trace=show_trace)

    if not isinstance(ds, ZarrDataset):
        raise TypeError("input is not a ZarrDataset")

    labels = ds.labels
    if len(labels) < 2:
        if len(labels) == 1:
            desc = "Only a single label exists in this dataset.\n"
        else:
            desc = "Cannot find a valid label (something very wrong?)\n"
        message_dialog(title="Unable to export label", text=desc).run()
        return

    values = [(label, ) * 2 for label in labels]
    label = radiolist_dialog(
        title="Found multiple labels",
        text="Which label would you like to export?",
        values=values,
    ).run()

    if label is None:
        logger.info("cancelled")
        return

    # reload dataset
    logger.info(f'reload dataset with default label "{label}"')
    ds = open_dataset(ds_path, label=label, show_trace=show_trace)
Esempio n. 27
0
def migrate_configs_prompt(secrets_manager_cls: Type[BaseSecretsManager],
                           style: Style) -> BaseSecretsManager:
    message_dialog(title='Configs Migration',
                   text="""


            CONFIGS MIGRATION:

            We have recently refactored the way hummingbot handles configurations.
            To migrate your legacy configuration files to the new format,
            please enter your password on the following screen.

                """,
                   style=style).run()
    password = input_dialog(title="Input Password",
                            text="\n\nEnter your previous password:"******"Wrong password.")
    secrets_manager = secrets_manager_cls(password)
    errors = migrate_configs(secrets_manager)
    if len(errors) != 0:
        _migration_errors_dialog(errors, style)
    else:
        message_dialog(title='Configs Migration Success',
                       text="""


                            CONFIGS MIGRATION SUCCESS:

                            The migration process was completed successfully.

                                """,
                       style=style).run()
    return secrets_manager
Esempio n. 28
0
def run_lesson_module(module_ind, text=LESSON_TEXT):
    if module_ind is None:
        return
    module = LESSON_DATA[module_ind]
    if len(module['lessons']) == 0:
        return message_dialog(title=HTML(module['module_name']), text=EMPTY_MODULE_TEXT, style=APP_STYLE).run()
    else:
        values = list()
        for i,l in enumerate(module['lessons']):
            if is_lesson_completed(module_ind,i):
                c = 'green'
            else:
                c = 'red'
            values.append((i, HTML('<ansi%s>%s</ansi%s>' % (c,l['lesson_name'],c))))
        return radiolist_dialog(title=HTML(module['module_name']), text=text, style=APP_STYLE, values=values).run()
Esempio n. 29
0
        def apply_app_factory():
            print("Applying network interface changes...")
            with self.context.get_client() as c:
                try:
                    c.call("interface.commit")
                except ClientException as e:
                    return AppResult(
                        app=message_dialog(
                            "Error", "\n".join(
                                textwrap.wrap(format_error(self.context, e),
                                              74))),
                        app_result_handler=lambda _: NetworkInterfaceList(
                            self.context),
                    )

            return NetworkInterfaceList(self.context)
Esempio n. 30
0
from prompt_toolkit.shortcuts import message_dialog, radiolist_dialog

response = radiolist_dialog(
    title="Zadání příkazu",
    text="Zadejte příkaz (quit, exit, help, eval):",
    values=[("quit", "Quit"), ("exit", "Exit"), ("help", "Help"),
            ("eval", "Eval")],
)

if response is not None:
    message_dialog(
        title="Zadání příkazu",
        text="zadali jste: {command}".format(
            command=response if response else "nic :)"),
    )
else:
    message_dialog(title="Zadání uživatelského jména",
                   text="Příkaz nebyl zadán")
from prompt_toolkit.shortcuts import checkboxlist_dialog, message_dialog
from prompt_toolkit.styles import Style

results = checkboxlist_dialog(
    title="CheckboxList dialog",
    text="What would you like in your breakfast ?",
    values=[
        ("eggs", "Eggs"),
        ("bacon", "Bacon"),
        ("croissants", "20 Croissants"),
        ("daily", "The breakfast of the day")
    ],
    style=Style.from_dict({
        'dialog': 'bg:#cdbbb3',
        'button': 'bg:#bf99a4',
        'checkbox': '#e8612c',
        'dialog.body': 'bg:#a9cfd0',
        'dialog shadow': 'bg:#c98982',
        'frame.label': '#fcaca3',
        'dialog.body label': '#fd8bb6',
    })
).run()
if results:
    message_dialog(
        title="Room service",
        text="You selected: %s\nGreat choice sir !" % ",".join(results)
    ).run()
else:
    message_dialog("*starves*").run()
def main():
    message_dialog(
        title='Example dialog window',
        text='Do you want to continue?\nPress ENTER to quit.').run()
 def pause_execution(self, message="Test execution paused."):
     # """Pauses test execution until user hits `Return` key.
     #
     # `message` is the message s,hown in the dialog.
     # """
     message_dialog(title="Execution paused", text=message)
def main():
    message_dialog(
        title=HTML('<style bg="blue" fg="white">Styled</style> '
                   '<style fg="ansired">dialog</style> window'),
        text='Do you want to continue?\nPress ENTER to quit.',
        style=example_style).run()