コード例 #1
0
ファイル: Menus.py プロジェクト: JimmyLamothe/redaction
 def add_commands(self):
     """ Add items to display menu | None -> None """
     language_dict = config.get_language_dict()
     self.add_command(label=language_dict['show_buttons'],
                      command=config.show_buttons)
     self.add_command(label=language_dict['hide_buttons'],
                      command=config.hide_buttons)
コード例 #2
0
ファイル: Menus.py プロジェクト: JimmyLamothe/redaction
 def add_menus(self):
     """ Adds submenus to main menu bar | None -> None """
     language_dict = config.get_language_dict()
     self.add_cascade(menu=self.file_menu, label=language_dict['file'])
     self.add_cascade(menu=self.option_menu, label=language_dict['options'])
     self.add_cascade(menu=self.display_menu,
                      label=language_dict['display'])
コード例 #3
0
 def __init__(self):
     tk.Tk.__init__(self)
     if not config.get_db_path():
         config.set_db_path()
     if not config.get_backup_path():
         config.set_backup_path()
     if not config.get_session_path():
         config.set_session_path()
     db_type = config.get_db_type()
     if db_type == 'standard':
         db = Databases.StandardDatabase()
     else:
         db = Databases.TranslationDatabase(config.get_lang1(),
                                            config.get_lang2())
     config.active_objects['db'] = db
     config.active_objects[
         'root'] = self  #Allows access outside creation module
     backup.backup()
     self.option_add('*Font',
                     'TkDefaultFont')  #All widgets use default font
     if db_type == 'standard':
         self.main_frame = StandardMainFrame(self)
     else:
         self.main_frame = TranslationMainFrame(self)
     self.menu_bar = MenuBar(self)
     self['menu'] = self.menu_bar
     self.title(config.get_language_dict()['title'])  #Application name
     icon = Image.open('icons/30101621.png')
     icon = ImageTk.PhotoImage(icon)
     self.iconphoto(True, icon)
     self.set_geometry()
     self.bind_events()
コード例 #4
0
 def set_text(self):
     """ Sets text of all widgets to config settings | None -> None """
     language_dict = config.get_language_dict()
     self.title(language_dict['title'])
     self.menu_bar = MenuBar(self)
     self.config(menu=self.menu_bar)
     self.main_frame.set_text(language_dict)
コード例 #5
0
 def get_label_2_text(self):
     """ Gets correct text for label 1 None -> str """
     if self.db_type == 'standard':
         text = config.get_language_dict()['phrase']
     else:
         text = config.get_lang2()
     return text
コード例 #6
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def create_phrase_label(self):
     """ Creates a label for the phrase text widget | None -> tk.Label """
     language_dict = config.get_language_dict() #Active language name dict
     label = tk.Label(
         master=self,
         text=language_dict['phrase'],
         bg='#EEEEEE'
     )
     return label
コード例 #7
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def create_key_label(self):
     """ Creates a label for the key entry widget | None -> tk.Label """
     language_dict = config.get_language_dict() #Active language name dict
     label = tk.Label(
         master=self,
         text=language_dict['key'],
         bg='#EEEEEE'
     )
     return label
コード例 #8
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def load_tutorial(self):
     """ Display tutorial in hint mode | None -> None """
     config.set_mode('hint')
     config.decrement_tutorial()
     self.focus()
     language_dict = config.get_language_dict()
     with open(language_dict['tutorial'], 'r') as source:
         tutorial = source.read().split('***\n')
         self.phrase.active_list = tutorial
         self.phrase.active_list_index = 0
         self.phrase.display_current()
コード例 #9
0
 def create_copy_button(self):
     """ Creates copy button on right of app window | None -> tk.Button """
     language_dict = config.get_language_dict()  #Active language name dict
     button = tk.Button(master=self,
                        command=self.copy,
                        text=language_dict['copy'],
                        relief=tk.RIDGE,
                        borderwidth=2,
                        fg='BLACK',
                        bg='#DDDDDD',
                        padx=10,
                        pady=5)
     return button
コード例 #10
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def create_left_button(self):
     """ Creates button on left of app window| None -> tk.Button """
     language_dict = config.get_language_dict() #Active language name dict
     button = tk.Button(
         master=self,
         command=config.change_mode,
         text=language_dict['new'], #Changes with config.change_mode
         relief=tk.RIDGE,
         borderwidth=2,
         fg='BLACK',
         bg='#DDDDDD',
         padx=10,
         pady=5
     )
     return button
コード例 #11
0
 def create_left_button(self):
     """ Creates button on left of app window| None -> tk.Button """
     language_dict = config.get_language_dict() #Active language name dict
     button = tk.Button(
         master=self,
         command=self.save_entry, #TO BE DETERMINED
         text=language_dict['save'], #TO BE DETERMINED
         relief=tk.RIDGE,
         borderwidth=2,
         fg='BLACK',
         bg='#DDDDDD',
         padx=10,
         pady=5
     )
     return button
コード例 #12
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def activate_put_mode(self):
     """ Sets app to save entry to database | None -> None """
     if config.get_mode() == 'put':
         return
     language_dict = config.get_language_dict()
     for item in [self, self.key_label, self.phrase_label]:
         item.config(bg='#F5FCFF')
     self.phrase.config(
         bg='#FFFFFF',
         borderwidth=2
         )
     if config.get_show_buttons():
         self.left_button.config(
             text=language_dict['cancel'],
         )
         self.right_button.config(
             text=language_dict['save'],
             command=self.save_entry
         )
     self.phrase.focus()
     self.key.ignore_suggestion()
     self.phrase.full_clear()
     config.set_mode('put')
コード例 #13
0
ファイル: MainFrame.py プロジェクト: JimmyLamothe/redaction
 def activate_get_mode(self):
     """ Sets app to get entry from database | None -> None """
     if config.get_mode() == 'get':
         return
     language_dict = config.get_language_dict()
     for item in [self, self.key_label, self.phrase_label]:
         item.config(bg='#EEEEEE')
     self.phrase.config(
         bg='#F5F5F5',
         borderwidth=3
         )
     if config.get_show_buttons():
         self.left_button.config(
             text=language_dict['new'],
         )
         self.right_button.config(
             text=language_dict['copy'],
             command=self.copy_phrase
         )
     self.key.focus()
     self.key.full_clear()
     self.phrase.full_clear()
     config.set_mode('get')
コード例 #14
0
ファイル: Menus.py プロジェクト: JimmyLamothe/redaction
 def add_menus(self):
     """ Add sub menus to option menu | None -> None """
     language_dict = config.get_language_dict()
     self.add_cascade(menu=self.database_menu, label=language_dict['db'])