Exemplo n.º 1
0
    def create_menubar(self, language_list, style=0):
        modifier = 'Ctrl' if name == 'nt' else 'Opt'
        menubar = MenuBar()
        menubar_file = Menu()
        menubar_file.Append(ID_FILE_EXPORT, '&Export\t' + modifier + 'E')
        menubar_file.AppendSeparator()
        menubar_file.Append(ID_FILE_EXIT, 'E&xit\t' + modifier + 'W')

        menubar_edit = Menu()
        menubar_edit_timer = Menu()
        menubar_edit.AppendSubMenu(menubar_edit_timer, '&Timer')
        menubar_edit_timer.Append(ID_EDIT_TIMER_START,
                                  '&Start\t' + modifier + 'S')
        menubar_edit_timer.Append(ID_EDIT_TIMER_PAUSE,
                                  '&Pause\t' + modifier + 'P')
        menubar_edit_timer.Append(ID_EDIT_TIMER_RESET,
                                  '&Reset\t' + modifier + 'R')
        menubar_edit_time_stamp = Menu()
        menubar_edit.AppendSubMenu(menubar_edit_time_stamp, 'Time &Stamp')
        menubar_edit_time_stamp.Append(ID_EDIT_TIME_STAMP_NEW,
                                       '&New\t' + modifier + 'N')

        menubar_view = Menu()
        menubar_view.AppendCheckItem(ID_VIEW_SHOW_PREVIEW,
                                     'Show &Preview\t' + modifier + 'Shift+P')
        menubar_view_language = Menu()

        language_menu_item_list = []
        if language_list is not None:
            menubar_view_language.Bind(EVT_MENU,
                                       lambda x: self.change_language())
            menubar_view.AppendSubMenu(menubar_view_language, '&Language')

            for n in range(len(language_list)):
                language_menu_item_list.append(
                    menubar_view_language.AppendRadioItem(
                        ID_ANY, language_list[n]['Language Setting']))

        menubar_help = Menu()
        menubar_help.Append(ID_HELP_WELCOME,
                            '&Welcome\t' + modifier + 'Shift+H')
        menubar_help.AppendSeparator()
        menubar_help.Append(ID_HELP_VISIT_GITHUB, 'Visit &Github')
        menubar_help.AppendSeparator()
        menubar_help.Append(ID_HELP_ABOUT, '&About')

        menubar.Append(menubar_file, '&File')
        menubar.Append(menubar_edit, '&Edit')
        menubar.Append(menubar_view, '&View')
        menubar.Append(menubar_help, '&Help')

        return menubar, language_menu_item_list
Exemplo n.º 2
0
 def construct_prefs_menu(self):
     """Creates the preferences menu"""
     prefs_menu = Menu()
     self.backup_on_menu_item = prefs_menu.Append(
         NewId(), 'Backup pre save',
         'Backs up the existing config before saving', ITEM_CHECK)
     self.backup_on_menu_item.Check(True)
     prefs_menu.AppendSubMenu(self.construct_docs_menu(), '&Docs')
     self.Append(prefs_menu, '&Preferences')