88 sys.exit(100) |
88 sys.exit(100) |
89 |
89 |
90 import Globals |
90 import Globals |
91 from Globals import AppInfo |
91 from Globals import AppInfo |
92 |
92 |
|
93 from E5Gui.E5Application import E5Application |
|
94 |
93 from Toolbox import Startup |
95 from Toolbox import Startup |
|
96 |
|
97 from WebBrowser.WebBrowserSingleApplication import \ |
|
98 WebBrowserSingleApplicationClient |
94 |
99 |
95 |
100 |
96 def createMainWidget(argv): |
101 def createMainWidget(argv): |
97 """ |
102 """ |
98 Function to create the main widget. |
103 Function to create the main widget. |
114 private = True |
120 private = True |
115 argv.remove(arg) |
121 argv.remove(arg) |
116 elif arg == "--qthelp": |
122 elif arg == "--qthelp": |
117 qthelp = True |
123 qthelp = True |
118 argv.remove(arg) |
124 argv.remove(arg) |
|
125 elif arg == "--single": |
|
126 single = True |
|
127 argv.remove(arg) |
119 elif arg.startswith("--"): |
128 elif arg.startswith("--"): |
120 argv.remove(arg) |
129 argv.remove(arg) |
121 |
130 |
122 try: |
131 try: |
123 home = argv[1] |
132 home = argv[1] |
124 except IndexError: |
133 except IndexError: |
125 home = "" |
134 home = "" |
126 |
135 |
127 browser = WebBrowserWindow(home, '.', None, 'web_browser', |
136 browser = WebBrowserWindow(home, '.', None, 'web_browser', |
128 searchWord=searchWord, private=private, |
137 searchWord=searchWord, private=private, |
129 settingsDir=SettingsDir, qthelp=qthelp) |
138 settingsDir=SettingsDir, qthelp=qthelp, |
|
139 single=single) |
130 return browser |
140 return browser |
131 |
141 |
132 |
142 |
133 def main(): |
143 def main(): |
134 """ |
144 """ |
140 ("--private", "start the browser in private browsing mode"), |
150 ("--private", "start the browser in private browsing mode"), |
141 ("--qthelp", "start the browser with support for QtHelp"), |
151 ("--qthelp", "start the browser with support for QtHelp"), |
142 ("--search=word", "search for the given word"), |
152 ("--search=word", "search for the given word"), |
143 ("--settings=settingsDir", |
153 ("--settings=settingsDir", |
144 "use the given directory to store the settings files"), |
154 "use the given directory to store the settings files"), |
|
155 ("--single", "start the browser as a single application"), |
145 ] |
156 ] |
146 appinfo = AppInfo.makeAppInfo(sys.argv, |
157 appinfo = AppInfo.makeAppInfo(sys.argv, |
147 "eric6 Web Browser", |
158 "eric6 Web Browser", |
148 "file", |
159 "file", |
149 "web browser", |
160 "web browser", |
150 options) |
161 options) |
151 |
162 |
152 if not Globals.checkBlacklistedVersions(): |
163 if not Globals.checkBlacklistedVersions(): |
153 sys.exit(100) |
164 sys.exit(100) |
154 |
165 |
|
166 |
|
167 # set the library paths for plugins |
|
168 Startup.setLibraryPaths() |
|
169 |
|
170 app = E5Application(sys.argv) |
|
171 if not "--private" in sys.argv: |
|
172 client = WebBrowserSingleApplicationClient() |
|
173 res = client.connect() |
|
174 if res > 0: |
|
175 if len(sys.argv) > 1: |
|
176 client.processArgs(sys.argv[1:]) |
|
177 sys.exit(0) |
|
178 elif res < 0: |
|
179 print("eric6_trpreviewer: {0}".format(client.errstr())) |
|
180 sys.exit(res) |
|
181 |
155 res = Startup.simpleAppStartup(sys.argv, |
182 res = Startup.simpleAppStartup(sys.argv, |
156 appinfo, |
183 appinfo, |
157 createMainWidget, |
184 createMainWidget, |
158 installErrorHandler=True) |
185 installErrorHandler=True, |
|
186 app=app) |
159 sys.exit(res) |
187 sys.exit(res) |
160 |
188 |
161 if __name__ == '__main__': |
189 if __name__ == '__main__': |
162 main() |
190 main() |