@@ -599,6 +599,18 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
599599 for kwarg in kwargs:
600600 raise Exception (" Invalid argument: " + kwarg)
601601
602+ if command_line_switches:
603+ # Make a copy as commandLineSwitches is a reference only
604+ # that might get destroyed later.
605+ global g_commandLineSwitches
606+ for key in command_line_switches:
607+ g_commandLineSwitches[key] = copy.deepcopy(
608+ command_line_switches[key])
609+ # Use g_commandLineSwitches if you need to modify or access
610+ # command line switches inside this function.
611+ del command_line_switches
612+ del commandLineSwitches
613+
602614 IF UNAME_SYSNAME == " Linux" :
603615 # Fix Issue #231 - Discovery of the "icudtl.dat" file fails on Linux.
604616 cdef str py_module_dir = GetModuleDirectory()
@@ -636,8 +648,9 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
636648 IF UNAME_SYSNAME == " Darwin" :
637649 MacInitialize()
638650
639- # -------------------------------------------------------------------------
640- # CEF Python only options - default values
651+ # ------------------------------------------------------------------------
652+ # CEF Python only options
653+ # ------------------------------------------------------------------------
641654
642655 if " debug" not in application_settings:
643656 application_settings[" debug" ] = False
@@ -657,8 +670,13 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
657670 IF UNAME_SYSNAME == " Windows" :
658671 if DpiAware.IsProcessDpiAware():
659672 application_settings[" auto_zooming" ] = " system_dpi"
673+ if " app_user_model_id" in application_settings:
674+ g_commandLineSwitches[" app-user-model-id" ] = \
675+ application_settings[" app_user_model_id" ]
660676
677+ # ------------------------------------------------------------------------
661678 # Paths
679+ # ------------------------------------------------------------------------
662680 cdef str module_dir = GetModuleDirectory()
663681 if platform.system() == " Darwin" :
664682 if " framework_dir_path" not in application_settings:
@@ -679,7 +697,9 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
679697 application_settings[" browser_subprocess_path" ] = os.path.join(
680698 module_dir, " subprocess" )
681699
700+ # ------------------------------------------------------------------------
682701 # Mouse context menu
702+ # ------------------------------------------------------------------------
683703 if " context_menu" not in application_settings:
684704 application_settings[" context_menu" ] = {}
685705 menuItems = [" enabled" , " navigation" , " print" , " view_source" ,
@@ -688,8 +708,11 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
688708 if item not in application_settings[" context_menu" ]:
689709 application_settings[" context_menu" ][item] = True
690710
691- # Remote debugging port. If value is 0 we will generate a random
692- # port. To disable remote debugging set value to -1.
711+ # ------------------------------------------------------------------------
712+ # Remote debugging port.
713+ # ------------------------------------------------------------------------
714+ # If value is 0 we will generate a random port. To disable
715+ # remote debugging set value to -1.
693716 if application_settings[" remote_debugging_port" ] == 0 :
694717 # Generate a random port.
695718 application_settings[" remote_debugging_port" ] = \
@@ -698,13 +721,14 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
698721 # Disable remote debugging
699722 application_settings[" remote_debugging_port" ] = 0
700723
701- # -------------------------------------------------------------------------
702-
703- # CEF options - default values.
724+ # ------------------------------------------------------------------------
725+ # CEF options - default values
726+ # ------------------------------------------------------------------------
704727 if not " multi_threaded_message_loop" in application_settings:
705728 application_settings[" multi_threaded_message_loop" ] = False
706729 if not " single_process" in application_settings:
707730 application_settings[" single_process" ] = False
731+ # ------------------------------------------------------------------------
708732
709733 cdef CefRefPtr[CefApp] cefApp = < CefRefPtr[CefApp]?> new CefPythonApp()
710734
@@ -733,14 +757,6 @@ def Initialize(applicationSettings=None, commandLineSwitches=None, **kwargs):
733757 cefApplicationSettings.no_sandbox = 1
734758 SetApplicationSettings(application_settings, & cefApplicationSettings)
735759
736- if command_line_switches:
737- # Make a copy as commandLineSwitches is a reference only
738- # that might get destroyed later.
739- global g_commandLineSwitches
740- for key in command_line_switches:
741- g_commandLineSwitches[key] = copy.deepcopy(
742- command_line_switches[key])
743-
744760 # External message pump
745761 if GetAppSetting(" external_message_pump" )\
746762 and not g_external_message_pump.get():
0 commit comments