77# Copyright (C) 2008 Gary van der Merwe
88# Copyright (C) 2008 Robert Kaye
99# Copyright (C) 2008 Will
10- # Copyright (C) 2008-2010, 2015, 2018-2023 Philipp Wolfer
10+ # Copyright (C) 2008-2010, 2015, 2018-2024 Philipp Wolfer
1111# Copyright (C) 2009 Carlin Mangar
1212# Copyright (C) 2009 David Hilton
1313# Copyright (C) 2011-2012 Chad Wilson
@@ -255,6 +255,20 @@ def setupUi(self):
255255 for function in ext_point_ui_init :
256256 function (self )
257257
258+ get_config ().setting .setting_changed .connect (self .handle_settings_changed )
259+
260+ def handle_settings_changed (self , name , old_value , new_value ):
261+ if name == 'rename_files' :
262+ self .actions [MainAction .ENABLE_RENAMING ].setChecked (new_value )
263+ elif name == 'move_files' :
264+ self .actions [MainAction .ENABLE_MOVING ].setChecked (new_value )
265+ elif name == 'dont_write_tags' :
266+ self .actions [MainAction .ENABLE_TAG_SAVING ].setChecked (not new_value )
267+ elif name == 'clear_existing_tags' :
268+ self .metadata_box .update ()
269+ elif name in {'file_renaming_scripts' , 'selected_file_naming_script_id' }:
270+ self ._make_script_selector_menu ()
271+
258272 def set_processing (self , processing = True ):
259273 self .panel .set_processing (processing )
260274
@@ -613,7 +627,7 @@ def add_menu(menu_title, *args):
613627
614628 self .script_quick_selector_menu = QtWidgets .QMenu (_ ("&Select file naming script" ))
615629 self .script_quick_selector_menu .setIcon (icontheme .lookup ('document-open' ))
616- self .make_script_selector_menu ()
630+ self ._make_script_selector_menu ()
617631
618632 self .profile_quick_selector_menu = QtWidgets .QMenu (_ ("&Enable/disable profiles" ))
619633 self ._make_profile_selector_menu ()
@@ -915,7 +929,7 @@ def _options_closed(self):
915929 else :
916930 self .enable_action (MainAction .SHOW_SCRIPT_EDITOR , True )
917931 self ._make_profile_selector_menu ()
918- self .make_script_selector_menu ()
932+ self ._make_script_selector_menu ()
919933
920934 def show_help (self ):
921935 webbrowser2 .open ('documentation' )
@@ -1441,7 +1455,7 @@ def _check_and_repair_profiles(self):
14411455 profile_settings [p_id ][script_id_key ] = None
14421456 config .profiles [SettingConfigSection .SETTINGS_KEY ] = profile_settings
14431457
1444- def make_script_selector_menu (self ):
1458+ def _make_script_selector_menu (self ):
14451459 """Update the sub-menu of available file naming scripts.
14461460 """
14471461 if self .script_editor_dialog is None or not isinstance (self .script_editor_dialog , ScriptEditorDialog ):
@@ -1477,7 +1491,6 @@ def _select_new_naming_script(self, id):
14771491 config = get_config ()
14781492 log .debug ("Setting naming script to: %s" , id )
14791493 config .setting ['selected_file_naming_script_id' ] = id
1480- self .make_script_selector_menu ()
14811494 if self .script_editor_dialog :
14821495 self .script_editor_dialog .set_selected_script_id (id )
14831496
@@ -1503,14 +1516,13 @@ def open_file_naming_script_editor(self):
15031516 def _script_editor_save (self ):
15041517 """Process "signal_save" signal from the script editor.
15051518 """
1506- self .make_script_selector_menu ()
1519+ self ._make_script_selector_menu ()
15071520
15081521 def _script_editor_closed (self ):
15091522 """Process "finished" signal from the script editor.
15101523 """
15111524 self .enable_action (MainAction .SHOW_SCRIPT_EDITOR , True )
15121525 self .script_editor_dialog = None
1513- self .make_script_selector_menu ()
15141526
15151527 def _update_script_editor_example_files (self ):
15161528 """Update the list of example files for the file naming script editor.
@@ -1579,7 +1591,7 @@ def _update_profile_selection(self, profile_id):
15791591 for profile in option_profiles :
15801592 if profile ['id' ] == profile_id :
15811593 profile ['enabled' ] = not profile ['enabled' ]
1582- self .make_script_selector_menu ()
1594+ self ._make_script_selector_menu ()
15831595 return
15841596
15851597 def show_new_user_dialog (self ):
0 commit comments