src/eric7/WebBrowser/WebBrowserSingleApplication.py

branch
eric7
changeset 10303
ee1aadab1215
parent 10301
b4299b82fe37
child 10439
21c28b0f9e41
equal deleted inserted replaced
10302:8cb0dabf852f 10303:ee1aadab1215
9 browser. 9 browser.
10 """ 10 """
11 11
12 from PyQt6.QtCore import pyqtSignal 12 from PyQt6.QtCore import pyqtSignal
13 13
14 from eric7.SystemUtilities import OSUtilities
15 from eric7.Toolbox.SingleApplication import ( 14 from eric7.Toolbox.SingleApplication import (
16 SingleApplicationClient, 15 SingleApplicationClient,
17 SingleApplicationServer, 16 SingleApplicationServer,
18 ) 17 )
19 18
132 131
133 def processArgs(self, args, disconnect=True): 132 def processArgs(self, args, disconnect=True):
134 """ 133 """
135 Public method to process the command line args passed to the UI. 134 Public method to process the command line args passed to the UI.
136 135
137 @param args list of command line arguments 136 @param args namespace object containing the parsed command line parameters
138 @type list of str 137 @type argparse.Namespace
139 @param disconnect flag indicating to disconnect when done 138 @param disconnect flag indicating to disconnect when done
140 @type bool 139 @type bool
141 """ 140 """
142 # no args, return 141 if args.shutdown:
143 if args is None: 142 # send shutdown command and return
143 self.__shutdown()
144 return 144 return
145 145
146 argChars = ("-", "/") if OSUtilities.isWindowsPlatform() else ("-",) 146 if args.search:
147 147 self.__search(args.search)
148 for arg in args: 148 if args.new_tab:
149 if arg.startswith("--search="): 149 for url in args.new_tab:
150 self.__search(arg.replace("--search=", "")) 150 self.__newTab(url)
151 elif arg.startswith("--newtab="): 151 if args.home:
152 self.__newTab(arg.replace("--newtab=", "")) 152 self.__loadUrl(args.home)
153 elif arg == "--shutdown":
154 self.__shutdown()
155 elif not arg.startswith(argChars):
156 # it is an URL
157 self.__loadUrl(arg)
158 153
159 if disconnect: 154 if disconnect:
160 self.disconnect() 155 self.disconnect()
161 156
162 def __loadUrl(self, url): 157 def __loadUrl(self, url):

eric ide

mercurial