@@ -34,47 +34,49 @@ class MenuCreators:
3434 @staticmethod
3535 def create_patterns_menu () -> Menu :
3636 menu = Menu (tearoff = False ,** MENU_COLOR_ARGS )
37- menu .add_command (label = 'Add Pattern' , command = CommandsObjects .patterns_menu_commands .add_pattern ,accelerator = 'Ctrl+Shift+A' )
38- menu .add_command (label = 'Insert Pattern' ,command = CommandsObjects .patterns_menu_commands .insert_pattern ,accelerator = 'Ctrl+I' )
39- menu .add_separator ()
40- menu .add_command (label = 'Move Up' , command = CommandsObjects .patterns_menu_commands .move_selected )
41- menu .add_command (label = 'Move Down' , command = lambda : CommandsObjects .patterns_menu_commands .move_selected (up = False ))
42- menu .add_separator ()
43- menu .add_command (label = 'Edit selected' , command = CommandsObjects .patterns_menu_commands .edit_selected ,accelerator = 'F2' )
44- menu .add_command (label = 'Delete selected' , command = CommandsObjects .patterns_menu_commands .delete_selected ,accelerator = 'Delete' )
45- menu .add_command (label = 'Copy selected' , command = CommandsObjects .patterns_menu_commands .copy_pattern ,accelerator = 'Ctrl+C' )
46- menu .add_command (label = 'Delete All' , command = CommandsObjects .patterns_menu_commands .delete_all ,accelerator = 'Ctrl+Shift+D' )
47- menu .add_command (label = 'Copy All' , command = lambda : CommandsObjects .patterns_menu_commands .copy_pattern (all = True ),accelerator = 'Ctrl+Shift+C' )
48- menu .add_separator ()
49- menu .add_command (label = 'Import from file' , command = CommandsObjects .patterns_menu_commands .import_from_file ,accelerator = 'Ctrl+Shift+I' )
50- menu .add_command (label = 'Export to file' , command = CommandsObjects .patterns_menu_commands .export_to_file ,accelerator = 'Ctrl+E' )
37+ # The numbers below the following lines are indices of context menu commands
38+ # which are used in context_menu_displayers.py module given to entryconfig method
39+ menu .add_command (label = 'Add Pattern' , command = CommandsObjects .patterns_menu_commands .add_pattern ,accelerator = 'Ctrl+Shift+A' ) # 0
40+ menu .add_command (label = 'Insert Pattern' ,command = CommandsObjects .patterns_menu_commands .insert_pattern ,accelerator = 'Ctrl+I' ) # 1
41+ menu .add_separator () # 2
42+ menu .add_command (label = 'Move Up' , command = CommandsObjects .patterns_menu_commands .move_selected ) # 3
43+ menu .add_command (label = 'Move Down' , command = lambda : CommandsObjects .patterns_menu_commands .move_selected (up = False )) # 4
44+ menu .add_separator () # 5
45+ menu .add_command (label = 'Edit selected' , command = CommandsObjects .patterns_menu_commands .edit_selected ,accelerator = 'F2' ) # 6
46+ menu .add_command (label = 'Delete selected' , command = CommandsObjects .patterns_menu_commands .delete_selected ,accelerator = 'Delete' ) # 7
47+ menu .add_command (label = 'Copy selected' , command = CommandsObjects .patterns_menu_commands .copy_pattern ,accelerator = 'Ctrl+C' ) # 8
48+ menu .add_command (label = 'Delete All' , command = CommandsObjects .patterns_menu_commands .delete_all ,accelerator = 'Ctrl+Shift+D' ) # 9
49+ menu .add_command (label = 'Copy All' , command = lambda : CommandsObjects .patterns_menu_commands .copy_pattern (all = True ),accelerator = 'Ctrl+Shift+C' ) # 10
50+ menu .add_separator () # 11
51+ menu .add_command (label = 'Import from file' , command = CommandsObjects .patterns_menu_commands .import_from_file ,accelerator = 'Ctrl+Shift+I' ) # 12
52+ menu .add_command (label = 'Export to file' , command = CommandsObjects .patterns_menu_commands .export_to_file ,accelerator = 'Ctrl+E' ) # 13
5153 return menu
5254
5355 @staticmethod
5456 def create_log_menu () -> Menu :
5557 menu = Menu (tearoff = False ,** MENU_COLOR_ARGS )
56- menu .add_command (label = 'Copy log' ,command = CommandsObjects .log_menu_commands .copy_log ,accelerator = 'Ctrl+C' )
57- menu .add_command (label = 'Clear log' ,command = CommandsObjects .log_menu_commands .clear_log ,accelerator = 'Ctrl+D' )
58- menu .add_separator ()
59- menu .add_command (label = LOG_MODE [0 ],command = CommandsObjects .log_menu_commands .toggle_log )
58+ menu .add_command (label = 'Copy log' ,command = CommandsObjects .log_menu_commands .copy_log ,accelerator = 'Ctrl+C' ) # 0
59+ menu .add_command (label = 'Clear log' ,command = CommandsObjects .log_menu_commands .clear_log ,accelerator = 'Ctrl+D' ) # 1
60+ menu .add_separator () # 2
61+ menu .add_command (label = LOG_MODE [0 ],command = CommandsObjects .log_menu_commands .toggle_log ) # 3
6062 return menu
6163
6264 @staticmethod
6365 def create_entry_menu (widget : Entry , excel_var , is_file_entry : bool = True ,is_output_file_entry : bool = True ) -> Menu :
6466 menu = Menu (tearoff = False ,** MENU_COLOR_ARGS )
65- menu .add_command (label = 'Select All' , accelerator = 'Ctrl+A' ,command = lambda : widget .select_range (0 ,'end' ))
66- menu .add_command (label = 'Copy' , accelerator = 'Ctrl+C' ,command = lambda : widget .event_generate ('<<Copy>>' ))
67- menu .add_command (label = 'Paste' , accelerator = 'Ctrl+V' ,command = lambda : widget .event_generate ('<<Paste>>' ))
68- menu .add_command (label = 'Cut' , accelerator = 'Ctrl+X' ,command = lambda : widget .event_generate ('<<Cut>>' ))
69- menu .add_separator ()
70- menu .add_command (label = 'Clear' ,accelerator = 'Ctrl+Shift+C' ,command = lambda : widget .delete (0 ,'end' ))
67+ menu .add_command (label = 'Select All' , accelerator = 'Ctrl+A' ,command = lambda : widget .select_range (0 ,'end' )) # 0
68+ menu .add_command (label = 'Copy' , accelerator = 'Ctrl+C' ,command = lambda : widget .event_generate ('<<Copy>>' )) # 1
69+ menu .add_command (label = 'Paste' , accelerator = 'Ctrl+V' ,command = lambda : widget .event_generate ('<<Paste>>' )) # 2
70+ menu .add_command (label = 'Cut' , accelerator = 'Ctrl+X' ,command = lambda : widget .event_generate ('<<Cut>>' )) # 3
71+ menu .add_separator () # 4
72+ menu .add_command (label = 'Clear' ,accelerator = 'Ctrl+Shift+C' ,command = lambda : widget .delete (0 ,'end' )) # 5
7173 if is_file_entry :
72- menu .add_command (label = 'Browse' ,command = lambda : browse_files (widget , not is_output_file_entry ),accelerator = 'Ctrl+B' )
74+ menu .add_command (label = 'Browse' ,command = lambda : browse_files (widget , not is_output_file_entry ),accelerator = 'Ctrl+B' ) # 6
7375 if is_output_file_entry :
74- menu .add_separator ()
76+ menu .add_separator () # 7
7577 menu .add_radiobutton (label = 'Excel' ,variable = excel_var ,value = True ,
76- command = CommandsObjects .csv_excel_switch_functions .show_only_excel_required_widgets )
78+ command = CommandsObjects .csv_excel_switch_functions .show_only_excel_required_widgets ) # 8
7779
7880 menu .add_radiobutton (label = 'CSV' ,variable = excel_var ,value = False ,
79- command = CommandsObjects .csv_excel_switch_functions .hide_only_excel_required_widgets )
81+ command = CommandsObjects .csv_excel_switch_functions .hide_only_excel_required_widgets ) # 9
8082 return menu
0 commit comments