예제 #1
0
def display_main_menu(err='', table=None):
    tables = list(model.TABLES.keys())

    menu = SelectionMenu(tables + ['Search users by question.question_datetime',
                                   'Search questions by answer.answer_is_valid',
                                   'Create 10_000 random questions',
                                   'Full Text Search without word',
                                   'Full Text Search by phrase'], subtitle=err,
                         title="Select a table to work with:")
    menu.show()

    index = menu.selected_option
    if index < len(tables):
        table = tables[index]
        display_secondary_menu(table)
    elif index == len(tables):
        search_users_by_question_date()
    elif index == len(tables) + 1:
        search_questions_by_answer_is_valid()
    elif index == len(tables) + 2:
        create_random_questions()
    elif index == len(tables) + 3:
        full_text_search_without_word()
    elif index == len(tables) + 4:
        full_text_search_by_phrase()
    else:
        print('Bye! Have a nice day!')
예제 #2
0
    def show_init_menu(self, msg=''):
        selectionMenu = SelectionMenu(
            TABLES_NAMES + [
                'Fill table "product" by random data (10 items)',
                'Find buyers by criteria', 'Find orders by criteria',
                'Find products by criteria'
            ],
            title='Select the table to work with | command:',
            subtitle=msg)
        selectionMenu.show()

        index = selectionMenu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == 4:
            self.fillByRandom()
        elif index == 5:
            self.searchByersByCriteria()
        elif index == 6:
            self.searchOrdersByCriteria()
        elif index == 7:
            self.searchProductsByCriteria()
        else:
            print('Exiting...')
예제 #3
0
파일: controller.py 프로젝트: Nastia28/BD
    def show_start_menu(self, subtitle='', **kwargs):
        menu_options = self.tables + ['Знайти майстрів за типом процедур',
                                      'Знайти процедури за типом клієнтів',
                                      'Повнотекстовий пошук (слово не входить)',
                                      'Повнотекстовий пошук (ціла фраза)',
                                      'Створити 100 рандомних майстрів']
        next_steps = [self.show_table_menu] * len(self.tables) + [
            self.get_masters_by_procedures,
            self.get_procedure_by_client_type,
            self.fts_without_word,
            self.fts_phrase,
            self.create_random_masters
        ]
        menu = SelectionMenu(menu_options, subtitle=subtitle,
                             title="Оберіть таблицю або дію:")
        menu.show()

        index = menu.selected_option
        if index < len(menu_options):
            table_name = self.get_table_name(index)
            next_step = next_steps[index]
            try:
                next_step(table_name=table_name)
            except Exception as err:
                self.show_start_menu(subtitle=str(err))
        else:
            print('Пока!!!!')
예제 #4
0
def main_menu(menu_list, status):
    menu = SelectionMenu(menu_list,
                         "Meal Planning with Mary Poppins",
                         prologue_text=status)
    menu.show()
    menu.join()
    selection = menu.selected_option
    return selection
예제 #5
0
def show_start_menu():
    main_menu = [
        'Regression analysis for AQI with Wind Speed',
        'Regression analysis for AQI with Air Pressure',
        'Regression analysis for AQI with Humidity',
        'Regression analysis for Humidity with Temperature',
        'Regression analysis for Humidity with Air Pressure',
        'Top 10 countries with worst mean AQI',
        'Top 10 countries with best mean AQI'
    ]

    regression_types = {
        0: ['linear', 'Linear regression'],
        1: ['polynomial', 'Polynomial regression']
    }
    regression_menu = []
    for key in regression_types:
        regression_menu.append(regression_types[key][1])

    menu = SelectionMenu(main_menu,
                         title="Select one of these amazing options :)")
    menu.show()

    if menu.is_selected_item_exit():
        print("bye")
        return

    item = menu.selected_option

    if item in range(0, 5):
        menu = SelectionMenu(regression_menu,
                             title='Select regression type',
                             show_exit_option=False)
        menu.show()
        regression_selected = menu.selected_option
        regression_type = regression_types[regression_selected][0]
        if item == 0:
            datamanipulation.show_and_save_plot_aqi_windspeed(
                df, regression_type)
        elif item == 1:
            datamanipulation.show_and_save_plot_aqi_pressure(
                df, regression_type)
        elif item == 2:
            datamanipulation.show_and_save_plot_aqi_humidity(
                df, regression_type)
        elif item == 3:
            datamanipulation.show_and_save_plot_temp_humidity(
                df, regression_type)
        elif item == 4:
            datamanipulation.show_and_save_plot_humidity_pressure(
                df, regression_type)

    if item == 5:
        datamanipulation.show_and_save_plot_top10_worst_mean_aqi_by_country(df)
    elif item == 6:
        datamanipulation.show_and_save_plot_top10_best_mean_aqi_by_country(df)

    show_start_menu()
예제 #6
0
파일: controller.py 프로젝트: Nastia28/BD
    def show_table_menu(self, table_name, subtitle=''):
        next_steps = [self.get, self.insert, self.update, self.delete, self.show_start_menu]
        menu = SelectionMenu(
            ['GET', 'INSERT', 'UPDATE', 'DELETE'], subtitle=subtitle,
            title=f'Обрано таблицю `{table_name}`', exit_option_text='Назад', )
        menu.show()

        next_step = next_steps[menu.selected_option]
        next_step(table_name=table_name)
예제 #7
0
def display_secondary_menu(table, subtitle=''):
    opts = ['Select', 'Insert', 'Update', 'Delete']
    steps = [select, insert, update, delete, display_main_menu]

    menu = SelectionMenu(
        opts, subtitle=subtitle,
        title=f'Selected table "{table}"', exit_option_text='Go back',)
    menu.show()
    index = menu.selected_option
    steps[index](table=table)
예제 #8
0
    def show_entity_menu(self, tableName, msg=''):
        options = ['Get',  'Delete', 'Update', 'Insert']
        functions = [self.get, self.delete, self.update, self.insert]

        selectionMenu = SelectionMenu(options, f'{tableName}',
                                      exit_option_text='Back', subtitle=msg)
        selectionMenu.show()
        try:
            function = functions[selectionMenu.selected_option]
            function(tableName)
        except IndexError:
            self.show_init_menu()
예제 #9
0
def show_Contents(lstContents):
    lst_ContForm = []
    for cnt in lstContents.contentList:
        lst_ContForm.append(cnt.getListItem())

    subTitle = '{0:<41} {1:<23} {2:<2}'.format("      Name", "Author", "In")
    menu = SelectionMenu(lst_ContForm,
                         "Digital Library Contents",
                         subTitle,
                         show_exit_option=False)
    menu.show()
    menu.join()
    return menu.selected_option
예제 #10
0
파일: controller.py 프로젝트: Sedatif/db
    def show_entity_menu(self, table_name, input=''):
        options = ['INSERT', 'DELETE', 'UPDATE']
        methods = [self.insert, self.delete, self.update]

        selection_menu = SelectionMenu(options,
                                       f'Table: {table_name}',
                                       exit_option_text='Back',
                                       subtitle=input)
        selection_menu.show()
        try:
            method = methods[selection_menu.selected_option]
            method(table_name)
        except IndexError:
            self.show_start_menu()
예제 #11
0
def display_main_menu(err='', table=None):
    tables = list(model.TABLES.keys())

    menu = SelectionMenu(tables + ['Make commit'], subtitle=err,
                         title="Select a table to work with:")
    menu.show()


    index = menu.selected_option
    if index < len(tables):
        table = tables[index]
        display_secondary_menu(table)
    elif index == len(tables):
        model.commit()
        display_main_menu('Commit was made successful')
예제 #12
0
    def show_init_menu(self, msg=''):
        selection_menu = SelectionMenu(
            TABLES_NAMES + ['Fill table "book" by random data (10 items)'],
            title='Select the table to work with | command:', subtitle=msg)

        selection_menu.show()

        index = selection_menu.selected_option
        if index < len(TABLES_NAMES):
            table_name = TABLES_NAMES[index]
            self.show_entity_menu(table_name)
        elif index == 5:
            self.fill_by_random()
        else:
            print('Bye, have a beautiful day!')
예제 #13
0
    def show_init_menu(self, msg=''):
        selectionMenu = SelectionMenu(
            TABLES_NAMES + ['Fill table "faculty" by random data'],
            title='Select the table to work with | command:',
            subtitle=msg)
        selectionMenu.show()

        index = selectionMenu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == 5:
            self.fillByRandom()
        else:
            print('Bye!')
예제 #14
0
def show_start_menu(tname='', err=''):
    tables = list(model.TABLES.keys())

    menu = SelectionMenu(tables + ['Custom SQL query'],
                         subtitle=err,
                         title="Select a table to work with:")
    menu.show()

    index = menu.selected_option
    if index < len(tables):
        tname = tables[index]
        show_table_menu(tname)
    elif index == len(tables):
        custom_query()
    else:
        print('Bye! Have a nice day!')
예제 #15
0
    def show_init_menu(self, message=''):
        selection_menu = SelectionMenu(
            TABLES_NAMES + ['Fill table "level" by random data', 'Commit'], title='Menu:', subtitle=message)
        selection_menu.show()

        index = selection_menu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == len(TABLES_NAMES):
            self.fill_level_by_random_data()
        elif index == len(TABLES_NAMES) + 1:
            self.model.commit()
            self.show_init_menu(message='Commit success')
        else:
            print('Closing...')
예제 #16
0
파일: ui.py 프로젝트: traumgedanken/obd
def show_start_menu():
    """Entrance point in menu"""
    menu = SelectionMenu([
        'Crawl bigmir.net',
        'Find page from bigmir.net with the smallest number of images',
        'Crawl sokol.ua', 'Create XHTML table with fridges from sokol.ua'
    ],
                         title="Select a task to do")
    menu.show()

    if menu.is_selected_item_exit():
        print('Bye!')
    else:
        index = menu.selected_option
        (crawl_bigmir, analize_bigmir, crawl_sokol,
         create_xhtml_table)[index]()
예제 #17
0
파일: ui.py 프로젝트: goroanya/DB_labs
def show_start_menu():
    """Entrance point in menu"""
    menu = SelectionMenu([
        'Crawl isport.ua', 'Print all links crawled from isport.ua',
        'Crawl portativ.ua',
        'Create XHTML table with headphones from portativ.ua'
    ],
                         title="Select a task to do")
    menu.show()

    if menu.is_selected_item_exit():
        print('Bye!')
    else:
        index = menu.selected_option
        (crawl_isport, print_all_links_from_isport, crawl_portativ,
         create_xhtml_table)[index]()
예제 #18
0
    def show_init_menu(self, msg=''):
        selectionMenu = SelectionMenu(
        TABLES_NAMES + ['Fill table "product" by random data (1000 items)',
                        'commit'], title='Select the table to work with | command:', subtitle=msg)
        selectionMenu.show()

        index = selectionMenu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == 4:
            self.fillByRandom()
        elif index == 5:
            self.model.commit()
            self.show_init_menu(msg='Commit success')
        else:
            print('Exiting...')
예제 #19
0
    def show_init_menu(self, msg=''):
        selection_menu = SelectionMenu(
            TABLES_NAMES + ['Fill table "department" by random data (10 000 items)', 'Commit'],
            title='Select the table to work with | command:', subtitle=msg)
        selection_menu.show()

        index = selection_menu.selected_option
        if index < len(TABLES_NAMES):
            table_name = TABLES_NAMES[index]
            self.show_entity_menu(table_name)
        elif index == len(TABLES_NAMES):
            self.fill_by_random()
        elif index == len(TABLES_NAMES) + 1:
            self.model.commit()
            self.show_init_menu(msg='Commit success')
        else:
            print('Bye, have a beautiful day!')
예제 #20
0
def show_start_menu(tname=None, err=''):
    tables = list(model.TABLES.keys())

    menu = SelectionMenu(tables + ['commit'],
                         subtitle=err,
                         title="Select a table to work with:")
    menu.show()

    index = menu.selected_option
    if index < len(tables):
        tname = tables[index]
        show_table_menu(tname)
    elif index == len(tables):
        print('Trying to commit...')
        model.commit()
        show_start_menu(err='All chages were commited')
    else:
        print('Bye! Have a nice day!')
예제 #21
0
파일: controller.py 프로젝트: Sedatif/db
    def show_start_menu(self, input=''):
        selection_menu = SelectionMenu(
            TABLES_NAMES + ['Find books by name or author`s fullname',
            'Fill the Readers (random)'],
            title = 'Input:',
            subtitle=input)

        selection_menu.show()
        option = selection_menu.selected_option
        if option < len(TABLES_NAMES):
            table_name = TABLES_NAMES[option]
            self.show_entity_menu(table_name)
        elif option == 6:
            self.filter_books()
        elif option == 7:
            self.random_data_for_readers_table()
        else:
            print('')
예제 #22
0
def show_table_menu(tname, subtitle=''):
    opts = ['Get', 'Insert', 'Update', 'Delete']
    steps = [get, insert, update, delete]

    if tname == 'team':
        opts.append('Create 100_000 random teams')
        steps.append(create_random_team)
    steps.append(show_start_menu)

    menu = SelectionMenu(
        opts,
        subtitle=subtitle,
        title=f'Selected table "{tname}"',
        exit_option_text='Go back',
    )
    menu.show()
    index = menu.selected_option
    steps[index](tname=tname)
예제 #23
0
파일: controller.py 프로젝트: Sedatif/db
    def show_start_menu(self, msg=''):
        selection_menu = SelectionMenu(
            TABLES_NAMES + ['Fill the Readers (random)', 'Commit'],
            title='Select the table to work with | command:',
            subtitle=msg)
        selection_menu.show()

        index = selection_menu.selected_option
        if index < len(TABLES_NAMES):
            table_name = TABLES_NAMES[index]
            self.show_entity_menu(table_name)
        elif index == len(TABLES_NAMES):
            self.random_data_for_readers_table()
        elif index == len(TABLES_NAMES) + 1:
            self.model.commit()
            self.show_start_menu(msg='Commit success')
        else:
            print(' ')
예제 #24
0
    def show_entity_menu(self, table_name, msg=''):
        options = ['Get', 'Delete', 'Update', 'Insert']

        functions = [self.get, self.delete, self.update, self.insert]

        if table_name == 'author':
            options.append('Search book by author')
            functions.append(self.search_book_by_author)
        elif table_name == 'book':
            options.append('Search authors that wrote the book')
            functions.append(self.search_author_by_book)

        selection_menu = SelectionMenu(options, f'Name of table: {table_name}', exit_option_text='Back', subtitle=msg)
        selection_menu.show()
        try:
            function = functions[selection_menu.selected_option]
            function(table_name)
        except IndexError:
            self.show_init_menu()
예제 #25
0
    def show_init_menu(self, msg=''):
        selectionMenu = SelectionMenu(TABLES_NAMES + [
            'Find text by word or phrase',
            'Fill table "Customers" by random data (10 items)'
        ],
                                      title='Select the table or option:',
                                      subtitle=msg)
        selectionMenu.show()

        index = selectionMenu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == 5:
            self.filter_product_category()
        elif index == 6:
            self.fillByRandom()
        else:
            print('END OF THE PROGRAMM')
예제 #26
0
def main():

    if len(argv) < 2:
        menu = SelectionMenu(list(tool_dict.keys()),
                             "What type of mechanism are you characterizing?")
        menu.show()
        menu.join()
        mech_type = list(tool_dict.keys())[menu.selected_option]

        menu = SelectionMenu(list(list(tool_dict.values())[0].keys()),
                             "What tool do you want to use?")
        menu.show()
        menu.join()
        tool_type = list(list(
            tool_dict.values())[0].keys())[menu.selected_option]

        tool_dict[mech_type][tool_type](None)
    else:
        parser = argparse.ArgumentParser(
            description="RobotPy characterization tools CLI")
        parser.add_argument(
            "mech_type",
            choices=list(tool_dict.keys()),
            help="Mechanism type being characterized",
        )
        parser.add_argument(
            "tool_type",
            choices=list(list(tool_dict.values())[0].keys()),
            help=
            "Create new project, start data recorder/logger, or start data analyzer",
        )
        parser.add_argument(
            "project_directory",
            help=
            "Location for the project directory (if creating a new project)",
            nargs="?",
            default=None,
        )
        argcomplete.autocomplete(parser)

        args = parser.parse_args()
        tool_dict[args.mech_type][args.tool_type](args.project_directory)
예제 #27
0
파일: controller.py 프로젝트: Nastia28/BD
    def show_start_menu(self, subtitle='', **kwargs):
        menu_options = self.tables + ['Створити 100 рандомних майстрів',
                                      'Зробити коміт']
        next_steps = [self.show_table_menu] * len(self.tables) + [
            self.create_random_masters,
            self.commit
        ]
        menu = SelectionMenu(menu_options, subtitle=subtitle,
                             title="Оберіть таблицю або дію:")
        menu.show()

        index = menu.selected_option
        if index < len(menu_options):
            table_name = self.get_table_name(index)
            next_step = next_steps[index]
            try:
                next_step(table_name=table_name)
            except Exception as err:
                self.show_start_menu(subtitle=str(err))
        else:
            print('Пока!!!!')
예제 #28
0
    def show_entity_menu(self, tableName, msg=''):
        options = ['Get', 'Delete', 'Update', 'Insert']
        functions = [self.get, self.delete, self.update, self.insert]

        if tableName == 'task':
            options.append('Search task by student group')
            functions.append(self.search_task_by_student_group)
        elif tableName == 'student':
            options.append('Search student by his task is passed')
            functions.append(self.search_student_by_task_is_passed)

        selectionMenu = SelectionMenu(options,
                                      f'Name of table: {tableName}',
                                      exit_option_text='Back',
                                      subtitle=msg)
        selectionMenu.show()
        try:
            function = functions[selectionMenu.selected_option]
            function(tableName)
        except IndexError:
            self.show_init_menu()
예제 #29
0
    def show_entity_menu(self, tableName, msg=''):
        options = ['Get', 'Delete', 'Update', 'Insert']
        functions = [self.get, self.delete, self.update, self.insert]

        if tableName == 'task':
            options.append('Search task by worker positions')
            functions.append(self.search_task_by_worker_position)
        elif tableName == 'worker':
            options.append('Search worker by his task is done')
            functions.append(self.search_worker_by_task_is_done)

        selectionMenu = SelectionMenu(options,
                                      f'Name of table: {tableName}',
                                      exit_option_text='Back',
                                      subtitle=msg)
        selectionMenu.show()
        try:
            function = functions[selectionMenu.selected_option]
            function(tableName)
        except IndexError:
            self.show_init_menu()
예제 #30
0
    def show_init_menu(self, msg=''):
        selectionMenu = SelectionMenu(
            TABLES_NAMES +
            [ 'Fill "members" by random data (10 items)', 
            'Find author or book by phrase',
            'Find member by name or book'], 
            title='Select the table to work with | command:', subtitle=msg)
        
        selectionMenu.show()

        index = selectionMenu.selected_option
        if index < len(TABLES_NAMES):
            tableName = TABLES_NAMES[index]
            self.show_entity_menu(tableName)
        elif index == 6:
            self.fillByRandom()
        elif index == 7:
            self.find_book_or_author_by_phrase()
        elif index == 8:
            self.find_member_by_phrase()
        else:
            print('Bye, have a beautiful day!')