9220:e9e7eca7efee | 9221:bf71ee032bb4 |
---|---|
17 import functools | 17 import functools |
18 import contextlib | 18 import contextlib |
19 import pathlib | 19 import pathlib |
20 | 20 |
21 from PyQt6.QtCore import ( | 21 from PyQt6.QtCore import ( |
22 pyqtSlot, QTimer, QFile, pyqtSignal, PYQT_VERSION_STR, QDate, QIODevice, | 22 pyqtSlot, |
23 qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, QUrlQuery | 23 QTimer, |
24 QFile, | |
25 pyqtSignal, | |
26 PYQT_VERSION_STR, | |
27 QDate, | |
28 QIODevice, | |
29 qVersion, | |
30 QProcess, | |
31 QSize, | |
32 QUrl, | |
33 QObject, | |
34 Qt, | |
35 QUuid, | |
36 QThread, | |
37 QUrlQuery, | |
24 ) | 38 ) |
25 from PyQt6.QtGui import ( | 39 from PyQt6.QtGui import QAction, QKeySequence, QDesktopServices, QSessionManager |
26 QAction, QKeySequence, QDesktopServices, QSessionManager | |
27 ) | |
28 from PyQt6.QtWidgets import ( | 40 from PyQt6.QtWidgets import ( |
29 QSizePolicy, QWidget, QWhatsThis, QToolBar, QDialog, QSplitter, | 41 QSizePolicy, |
30 QApplication, QMenu, QVBoxLayout, QDockWidget, QLabel | 42 QWidget, |
43 QWhatsThis, | |
44 QToolBar, | |
45 QDialog, | |
46 QSplitter, | |
47 QApplication, | |
48 QMenu, | |
49 QVBoxLayout, | |
50 QDockWidget, | |
51 QLabel, | |
31 ) | 52 ) |
32 from PyQt6.Qsci import QSCINTILLA_VERSION_STR | 53 from PyQt6.Qsci import QSCINTILLA_VERSION_STR |
33 from PyQt6.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager | 54 from PyQt6.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager |
34 | 55 |
35 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress | 56 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress |
55 | 76 |
56 from Tasks.TasksFile import TasksFile | 77 from Tasks.TasksFile import TasksFile |
57 | 78 |
58 from EricNetwork.EricNetworkIcon import EricNetworkIcon | 79 from EricNetwork.EricNetworkIcon import EricNetworkIcon |
59 from EricNetwork.EricNetworkProxyFactory import ( | 80 from EricNetwork.EricNetworkProxyFactory import ( |
60 EricNetworkProxyFactory, proxyAuthenticationRequired | 81 EricNetworkProxyFactory, |
82 proxyAuthenticationRequired, | |
61 ) | 83 ) |
84 | |
62 try: | 85 try: |
63 from EricNetwork.EricSslErrorHandler import ( | 86 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState |
64 EricSslErrorHandler, EricSslErrorState | 87 |
65 ) | |
66 SSL_AVAILABLE = True | 88 SSL_AVAILABLE = True |
67 except ImportError: | 89 except ImportError: |
68 SSL_AVAILABLE = False | 90 SSL_AVAILABLE = False |
69 | 91 |
70 from eric7config import getConfig | 92 from eric7config import getConfig |
71 | 93 |
72 | 94 |
73 class Redirector(QObject): | 95 class Redirector(QObject): |
74 """ | 96 """ |
75 Helper class used to redirect stdout and stderr to the log window. | 97 Helper class used to redirect stdout and stderr to the log window. |
76 | 98 |
77 @signal appendStderr(str) emitted to write data to stderr logger | 99 @signal appendStderr(str) emitted to write data to stderr logger |
78 @signal appendStdout(str) emitted to write data to stdout logger | 100 @signal appendStdout(str) emitted to write data to stdout logger |
79 """ | 101 """ |
102 | |
80 appendStderr = pyqtSignal(str) | 103 appendStderr = pyqtSignal(str) |
81 appendStdout = pyqtSignal(str) | 104 appendStdout = pyqtSignal(str) |
82 | 105 |
83 def __init__(self, stderr, parent=None): | 106 def __init__(self, stderr, parent=None): |
84 """ | 107 """ |
85 Constructor | 108 Constructor |
86 | 109 |
87 @param stderr flag indicating stderr is being redirected | 110 @param stderr flag indicating stderr is being redirected |
88 @type bool | 111 @type bool |
89 @param parent reference to the parent object | 112 @param parent reference to the parent object |
90 @type QObject | 113 @type QObject |
91 """ | 114 """ |
92 super().__init__(parent) | 115 super().__init__(parent) |
93 self.stderr = stderr | 116 self.stderr = stderr |
94 self.buffer = '' | 117 self.buffer = "" |
95 | 118 |
96 def __nWrite(self, n): | 119 def __nWrite(self, n): |
97 """ | 120 """ |
98 Private method used to write data. | 121 Private method used to write data. |
99 | 122 |
100 @param n max number of bytes to write | 123 @param n max number of bytes to write |
101 """ | 124 """ |
102 if n: | 125 if n: |
103 line = self.buffer[:n] | 126 line = self.buffer[:n] |
104 if self.stderr: | 127 if self.stderr: |
105 self.appendStderr.emit(line) | 128 self.appendStderr.emit(line) |
106 else: | 129 else: |
107 self.appendStdout.emit(line) | 130 self.appendStdout.emit(line) |
108 self.buffer = self.buffer[n:] | 131 self.buffer = self.buffer[n:] |
109 | 132 |
110 def __bufferedWrite(self): | 133 def __bufferedWrite(self): |
111 """ | 134 """ |
112 Private method returning number of characters to write. | 135 Private method returning number of characters to write. |
113 | 136 |
114 @return number of characters buffered or length of buffered line | 137 @return number of characters buffered or length of buffered line |
115 (integer) | 138 (integer) |
116 """ | 139 """ |
117 return self.buffer.rfind('\n') + 1 | 140 return self.buffer.rfind("\n") + 1 |
118 | 141 |
119 def flush(self): | 142 def flush(self): |
120 """ | 143 """ |
121 Public method used to flush the buffered data. | 144 Public method used to flush the buffered data. |
122 """ | 145 """ |
123 self.__nWrite(len(self.buffer)) | 146 self.__nWrite(len(self.buffer)) |
124 | 147 |
125 def write(self, s): | 148 def write(self, s): |
126 """ | 149 """ |
127 Public method used to write data. | 150 Public method used to write data. |
128 | 151 |
129 @param s data to be written (it must support the str-method) | 152 @param s data to be written (it must support the str-method) |
130 """ | 153 """ |
131 self.buffer += str(s) | 154 self.buffer += str(s) |
132 self.__nWrite(self.__bufferedWrite()) | 155 self.__nWrite(self.__bufferedWrite()) |
133 | 156 |
134 | 157 |
135 class UserInterface(EricMainWindow): | 158 class UserInterface(EricMainWindow): |
136 """ | 159 """ |
137 Class implementing the main user interface. | 160 Class implementing the main user interface. |
138 | 161 |
139 @signal appendStderr(str) emitted to write data to stderr logger | 162 @signal appendStderr(str) emitted to write data to stderr logger |
140 @signal appendStdout(str) emitted to write data to stdout logger | 163 @signal appendStdout(str) emitted to write data to stdout logger |
141 @signal preferencesChanged() emitted after the preferences were changed | 164 @signal preferencesChanged() emitted after the preferences were changed |
142 @signal reloadAPIs() emitted to reload the api information | 165 @signal reloadAPIs() emitted to reload the api information |
143 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The | 166 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The |
145 @signal masterPasswordChanged(str, str) emitted after the master | 168 @signal masterPasswordChanged(str, str) emitted after the master |
146 password has been changed with the old and the new password | 169 password has been changed with the old and the new password |
147 @signal onlineStateChanged(online) emitted to indicate a change of the | 170 @signal onlineStateChanged(online) emitted to indicate a change of the |
148 network state | 171 network state |
149 """ | 172 """ |
173 | |
150 appendStderr = pyqtSignal(str) | 174 appendStderr = pyqtSignal(str) |
151 appendStdout = pyqtSignal(str) | 175 appendStdout = pyqtSignal(str) |
152 preferencesChanged = pyqtSignal() | 176 preferencesChanged = pyqtSignal() |
153 reloadAPIs = pyqtSignal() | 177 reloadAPIs = pyqtSignal() |
154 showMenu = pyqtSignal(str, QMenu) | 178 showMenu = pyqtSignal(str, QMenu) |
155 masterPasswordChanged = pyqtSignal(str, str) | 179 masterPasswordChanged = pyqtSignal(str, str) |
156 onlineStateChanged = pyqtSignal(bool) | 180 onlineStateChanged = pyqtSignal(bool) |
157 | 181 |
158 maxFilePathLen = 100 | 182 maxFilePathLen = 100 |
159 maxMenuFilePathLen = 75 | 183 maxMenuFilePathLen = 75 |
160 | 184 |
161 LeftSide = 1 | 185 LeftSide = 1 |
162 BottomSide = 2 | 186 BottomSide = 2 |
163 RightSide = 3 | 187 RightSide = 3 |
164 | 188 |
165 ErrorLogFileName = "eric7_error.log" | 189 ErrorLogFileName = "eric7_error.log" |
166 | 190 |
167 def __init__(self, app, locale, splash, plugin, disabledPlugins, | 191 def __init__( |
168 noOpenAtStartup, noCrashOpenAtStartup, disableCrashSession, | 192 self, |
169 restartArguments, originalPathString): | 193 app, |
194 locale, | |
195 splash, | |
196 plugin, | |
197 disabledPlugins, | |
198 noOpenAtStartup, | |
199 noCrashOpenAtStartup, | |
200 disableCrashSession, | |
201 restartArguments, | |
202 originalPathString, | |
203 ): | |
170 """ | 204 """ |
171 Constructor | 205 Constructor |
172 | 206 |
173 @param app reference to the application object | 207 @param app reference to the application object |
174 @type EricApplication | 208 @type EricApplication |
175 @param locale locale to be used by the UI | 209 @param locale locale to be used by the UI |
176 @type str | 210 @type str |
177 @param splash reference to the splashscreen | 211 @param splash reference to the splashscreen |
196 @type list of str | 230 @type list of str |
197 @param originalPathString original PATH environment variable | 231 @param originalPathString original PATH environment variable |
198 @type str | 232 @type str |
199 """ | 233 """ |
200 super().__init__() | 234 super().__init__() |
201 | 235 |
202 self.__restartArgs = restartArguments[:] | 236 self.__restartArgs = restartArguments[:] |
203 | 237 |
204 self.setStyle(Preferences.getUI("Style"), | 238 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
205 Preferences.getUI("StyleSheet")) | 239 |
206 | |
207 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") | 240 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
208 self.locale = locale | 241 self.locale = locale |
209 self.__openAtStartup = not noOpenAtStartup | 242 self.__openAtStartup = not noOpenAtStartup |
210 self.__noCrashOpenAtStartup = noCrashOpenAtStartup | 243 self.__noCrashOpenAtStartup = noCrashOpenAtStartup |
211 self.__disableCrashSession = disableCrashSession | 244 self.__disableCrashSession = disableCrashSession |
212 self.__disabledPlugins = disabledPlugins[:] | 245 self.__disabledPlugins = disabledPlugins[:] |
213 | 246 |
214 self.__originalPathString = originalPathString | 247 self.__originalPathString = originalPathString |
215 | 248 |
216 if app.usesSmallScreen(): | 249 if app.usesSmallScreen(): |
217 # override settings for small screens | 250 # override settings for small screens |
218 Preferences.setUI("LayoutType", "Sidebars") | 251 Preferences.setUI("LayoutType", "Sidebars") |
219 Preferences.setUI("CombinedLeftRightSidebar", True) | 252 Preferences.setUI("CombinedLeftRightSidebar", True) |
220 Preferences.setUI("IconBarSize", "sm") | 253 Preferences.setUI("IconBarSize", "sm") |
221 | 254 |
222 self.__layoutType = Preferences.getUI("LayoutType") | 255 self.__layoutType = Preferences.getUI("LayoutType") |
223 | 256 |
224 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled") | 257 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled") |
225 | 258 |
226 g = Preferences.getGeometry("MainGeometry") | 259 g = Preferences.getGeometry("MainGeometry") |
227 if g.isEmpty(): | 260 if g.isEmpty(): |
228 s = QSize(1280, 720) | 261 s = QSize(1280, 720) |
229 self.resize(s) | 262 self.resize(s) |
230 else: | 263 else: |
231 self.restoreGeometry(g) | 264 self.restoreGeometry(g) |
232 self.__startup = True | 265 self.__startup = True |
233 | 266 |
234 if Preferences.getUI("UseSystemProxy"): | 267 if Preferences.getUI("UseSystemProxy"): |
235 QNetworkProxyFactory.setUseSystemConfiguration(True) | 268 QNetworkProxyFactory.setUseSystemConfiguration(True) |
236 else: | 269 else: |
237 self.__proxyFactory = EricNetworkProxyFactory() | 270 self.__proxyFactory = EricNetworkProxyFactory() |
238 QNetworkProxyFactory.setApplicationProxyFactory( | 271 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
239 self.__proxyFactory) | |
240 QNetworkProxyFactory.setUseSystemConfiguration(False) | 272 QNetworkProxyFactory.setUseSystemConfiguration(False) |
241 | 273 |
242 self.capProject = "" | 274 self.capProject = "" |
243 self.capEditor = "" | 275 self.capEditor = "" |
244 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") | 276 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") |
245 | 277 |
246 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric")) | 278 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
247 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) | 279 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
248 self.__setWindowCaption() | 280 self.__setWindowCaption() |
249 | 281 |
250 # load the view profiles | 282 # load the view profiles |
251 self.profiles = Preferences.getUI("ViewProfiles") | 283 self.profiles = Preferences.getUI("ViewProfiles") |
252 | 284 |
253 splash.showMessage(self.tr("Initializing Basic Services...")) | 285 splash.showMessage(self.tr("Initializing Basic Services...")) |
254 | 286 |
255 # Generate the conda interface | 287 # Generate the conda interface |
256 logging.debug("Creating Conda Interface...") | 288 logging.debug("Creating Conda Interface...") |
257 from CondaInterface.Conda import Conda | 289 from CondaInterface.Conda import Conda |
290 | |
258 self.condaInterface = Conda(self) | 291 self.condaInterface = Conda(self) |
259 ericApp().registerObject("Conda", self.condaInterface) | 292 ericApp().registerObject("Conda", self.condaInterface) |
260 | 293 |
261 # Generate the pip interface | 294 # Generate the pip interface |
262 logging.debug("Creating Pip Interface...") | 295 logging.debug("Creating Pip Interface...") |
263 from PipInterface.Pip import Pip | 296 from PipInterface.Pip import Pip |
297 | |
264 self.pipInterface = Pip(self) | 298 self.pipInterface = Pip(self) |
265 ericApp().registerObject("Pip", self.pipInterface) | 299 ericApp().registerObject("Pip", self.pipInterface) |
266 | 300 |
267 # Generate the virtual environment manager | 301 # Generate the virtual environment manager |
268 logging.debug("Creating Virtual Environments Manager...") | 302 logging.debug("Creating Virtual Environments Manager...") |
269 from VirtualEnv.VirtualenvManager import VirtualenvManager | 303 from VirtualEnv.VirtualenvManager import VirtualenvManager |
304 | |
270 self.virtualenvManager = VirtualenvManager(self) | 305 self.virtualenvManager = VirtualenvManager(self) |
271 # register it early because it is needed very soon | 306 # register it early because it is needed very soon |
272 ericApp().registerObject("VirtualEnvManager", self.virtualenvManager) | 307 ericApp().registerObject("VirtualEnvManager", self.virtualenvManager) |
273 | 308 |
274 # Generate an empty project object and multi project object | 309 # Generate an empty project object and multi project object |
275 logging.debug("Creating Project Manager...") | 310 logging.debug("Creating Project Manager...") |
276 from Project.Project import Project | 311 from Project.Project import Project |
312 | |
277 self.project = Project(self) | 313 self.project = Project(self) |
278 ericApp().registerObject("Project", self.project) | 314 ericApp().registerObject("Project", self.project) |
279 | 315 |
280 from MultiProject.MultiProject import MultiProject | 316 from MultiProject.MultiProject import MultiProject |
317 | |
281 logging.debug("Creating Multi-Project Manager...") | 318 logging.debug("Creating Multi-Project Manager...") |
282 self.multiProject = MultiProject(self.project, self) | 319 self.multiProject = MultiProject(self.project, self) |
283 | 320 |
284 # Generate the debug server object | 321 # Generate the debug server object |
285 logging.debug("Creating Debug Server...") | 322 logging.debug("Creating Debug Server...") |
286 from Debugger.DebugServer import DebugServer | 323 from Debugger.DebugServer import DebugServer |
324 | |
287 self.__debugServer = DebugServer( | 325 self.__debugServer = DebugServer( |
288 self.__originalPathString, project=self.project, parent=self) | 326 self.__originalPathString, project=self.project, parent=self |
289 | 327 ) |
328 | |
290 # Create the background service object | 329 # Create the background service object |
291 from Utilities.BackgroundService import BackgroundService | 330 from Utilities.BackgroundService import BackgroundService |
331 | |
292 self.backgroundService = BackgroundService(self) | 332 self.backgroundService = BackgroundService(self) |
293 | 333 |
294 splash.showMessage(self.tr("Initializing Plugin Manager...")) | 334 splash.showMessage(self.tr("Initializing Plugin Manager...")) |
295 | 335 |
296 # Initialize the Plugin Manager (Plugins are initialized later | 336 # Initialize the Plugin Manager (Plugins are initialized later |
297 from PluginManager.PluginManager import PluginManager | 337 from PluginManager.PluginManager import PluginManager |
298 self.pluginManager = PluginManager(self, self.__disabledPlugins, | 338 |
299 develPlugin=plugin) | 339 self.pluginManager = PluginManager( |
300 | 340 self, self.__disabledPlugins, develPlugin=plugin |
341 ) | |
342 | |
301 splash.showMessage(self.tr("Generating Main User Interface...")) | 343 splash.showMessage(self.tr("Generating Main User Interface...")) |
302 | 344 |
303 self.__webBrowserProcess = None | 345 self.__webBrowserProcess = None |
304 self.__webBrowserClient = None | 346 self.__webBrowserClient = None |
305 self.__webBrowserSAName = QUuid.createUuid().toString()[1:-1] | 347 self.__webBrowserSAName = QUuid.createUuid().toString()[1:-1] |
306 | 348 |
307 # set spellchecker defaults | 349 # set spellchecker defaults |
308 from QScintilla.SpellChecker import SpellChecker | 350 from QScintilla.SpellChecker import SpellChecker |
351 | |
309 SpellChecker.setDefaultLanguage( | 352 SpellChecker.setDefaultLanguage( |
310 Preferences.getEditor("SpellCheckingDefaultLanguage")) | 353 Preferences.getEditor("SpellCheckingDefaultLanguage") |
311 | 354 ) |
355 | |
312 with contextlib.suppress(ImportError, AttributeError): | 356 with contextlib.suppress(ImportError, AttributeError): |
313 from EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin | 357 from EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin |
358 | |
314 pwl = SpellChecker.getUserDictionaryPath(isException=False) | 359 pwl = SpellChecker.getUserDictionaryPath(isException=False) |
315 pel = SpellChecker.getUserDictionaryPath(isException=True) | 360 pel = SpellChecker.getUserDictionaryPath(isException=True) |
316 SpellCheckMixin.setDefaultLanguage( | 361 SpellCheckMixin.setDefaultLanguage( |
317 Preferences.getEditor("SpellCheckingDefaultLanguage"), | 362 Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel |
318 pwl, pel) | 363 ) |
319 | 364 |
320 logging.debug("Creating Application Objects...") | 365 logging.debug("Creating Application Objects...") |
321 self.__createObjects() | 366 self.__createObjects() |
322 | 367 |
323 # Create the main window now so that we can connect QActions to it. | 368 # Create the main window now so that we can connect QActions to it. |
324 logging.debug("Creating Layout...") | 369 logging.debug("Creating Layout...") |
325 self.__createLayout() | 370 self.__createLayout() |
326 self.__currentRightWidget = None | 371 self.__currentRightWidget = None |
327 self.__currentBottomWidget = None | 372 self.__currentBottomWidget = None |
328 | 373 |
329 # Generate the debugger part of the ui | 374 # Generate the debugger part of the ui |
330 logging.debug("Creating Debugger UI...") | 375 logging.debug("Creating Debugger UI...") |
331 from Debugger.DebugUI import DebugUI | 376 from Debugger.DebugUI import DebugUI |
332 self.debuggerUI = DebugUI(self, self.viewmanager, self.__debugServer, | 377 |
333 self.debugViewer, self.project) | 378 self.debuggerUI = DebugUI( |
379 self, self.viewmanager, self.__debugServer, self.debugViewer, self.project | |
380 ) | |
334 self.debugViewer.setDebugger(self.debuggerUI) | 381 self.debugViewer.setDebugger(self.debuggerUI) |
335 self.shell.setDebuggerUI(self.debuggerUI) | 382 self.shell.setDebuggerUI(self.debuggerUI) |
336 | 383 |
337 # Generate the redirection helpers | 384 # Generate the redirection helpers |
338 self.stdout = Redirector(False, self) | 385 self.stdout = Redirector(False, self) |
339 self.stderr = Redirector(True, self) | 386 self.stderr = Redirector(True, self) |
340 | 387 |
341 # set a few dialog members for non-modal dialogs created on demand | 388 # set a few dialog members for non-modal dialogs created on demand |
342 self.programsDialog = None | 389 self.programsDialog = None |
343 self.shortcutsDialog = None | 390 self.shortcutsDialog = None |
344 self.__testingWidget = None | 391 self.__testingWidget = None |
345 self.findFileNameDialog = None | 392 self.findFileNameDialog = None |
349 self.replaceFilesDialog = None | 396 self.replaceFilesDialog = None |
350 self.__notification = None | 397 self.__notification = None |
351 self.__readingSession = False | 398 self.__readingSession = False |
352 self.__versionsDialog = None | 399 self.__versionsDialog = None |
353 self.__configurationDialog = None | 400 self.__configurationDialog = None |
354 | 401 |
355 # now setup the connections | 402 # now setup the connections |
356 splash.showMessage(self.tr("Setting up connections...")) | 403 splash.showMessage(self.tr("Setting up connections...")) |
357 | 404 |
358 self.debugViewer.exceptionLogger.sourceFile.connect( | 405 self.debugViewer.exceptionLogger.sourceFile.connect( |
359 self.viewmanager.openSourceFile) | 406 self.viewmanager.openSourceFile |
360 | 407 ) |
408 | |
361 self.debugViewer.sourceFile.connect(self.viewmanager.showDebugSource) | 409 self.debugViewer.sourceFile.connect(self.viewmanager.showDebugSource) |
362 | 410 |
363 self.taskViewer.displayFile.connect(self.viewmanager.openSourceFile) | 411 self.taskViewer.displayFile.connect(self.viewmanager.openSourceFile) |
364 | 412 |
365 self.projectBrowser.psBrowser.sourceFile[str].connect( | 413 self.projectBrowser.psBrowser.sourceFile[str].connect( |
366 self.viewmanager.openSourceFile) | 414 self.viewmanager.openSourceFile |
415 ) | |
367 self.projectBrowser.psBrowser.sourceFile[str, int].connect( | 416 self.projectBrowser.psBrowser.sourceFile[str, int].connect( |
368 self.viewmanager.openSourceFile) | 417 self.viewmanager.openSourceFile |
418 ) | |
369 self.projectBrowser.psBrowser.sourceFile[str, list].connect( | 419 self.projectBrowser.psBrowser.sourceFile[str, list].connect( |
370 self.viewmanager.openSourceFile) | 420 self.viewmanager.openSourceFile |
421 ) | |
371 self.projectBrowser.psBrowser.sourceFile[str, int, str].connect( | 422 self.projectBrowser.psBrowser.sourceFile[str, int, str].connect( |
372 self.viewmanager.openSourceFile) | 423 self.viewmanager.openSourceFile |
424 ) | |
373 self.projectBrowser.psBrowser.closeSourceWindow.connect( | 425 self.projectBrowser.psBrowser.closeSourceWindow.connect( |
374 self.viewmanager.closeWindow) | 426 self.viewmanager.closeWindow |
375 self.projectBrowser.psBrowser.testFile.connect( | 427 ) |
376 self.__startTestScript) | 428 self.projectBrowser.psBrowser.testFile.connect(self.__startTestScript) |
377 | 429 |
378 self.projectBrowser.pfBrowser.designerFile.connect(self.__designer) | 430 self.projectBrowser.pfBrowser.designerFile.connect(self.__designer) |
379 self.projectBrowser.pfBrowser.sourceFile.connect( | 431 self.projectBrowser.pfBrowser.sourceFile.connect( |
380 self.viewmanager.openSourceFile) | 432 self.viewmanager.openSourceFile |
433 ) | |
381 self.projectBrowser.pfBrowser.uipreview.connect(self.__UIPreviewer) | 434 self.projectBrowser.pfBrowser.uipreview.connect(self.__UIPreviewer) |
382 self.projectBrowser.pfBrowser.trpreview.connect(self.__TRPreviewer) | 435 self.projectBrowser.pfBrowser.trpreview.connect(self.__TRPreviewer) |
383 self.projectBrowser.pfBrowser.closeSourceWindow.connect( | 436 self.projectBrowser.pfBrowser.closeSourceWindow.connect( |
384 self.viewmanager.closeWindow) | 437 self.viewmanager.closeWindow |
438 ) | |
385 self.projectBrowser.pfBrowser.appendStderr.connect(self.appendToStderr) | 439 self.projectBrowser.pfBrowser.appendStderr.connect(self.appendToStderr) |
386 | 440 |
387 self.projectBrowser.prBrowser.sourceFile.connect( | 441 self.projectBrowser.prBrowser.sourceFile.connect( |
388 self.viewmanager.openSourceFile) | 442 self.viewmanager.openSourceFile |
443 ) | |
389 self.projectBrowser.prBrowser.closeSourceWindow.connect( | 444 self.projectBrowser.prBrowser.closeSourceWindow.connect( |
390 self.viewmanager.closeWindow) | 445 self.viewmanager.closeWindow |
446 ) | |
391 self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr) | 447 self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr) |
392 | 448 |
393 self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist) | 449 self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist) |
394 self.projectBrowser.ptBrowser.sourceFile.connect( | 450 self.projectBrowser.ptBrowser.sourceFile.connect( |
395 self.viewmanager.openSourceFile) | 451 self.viewmanager.openSourceFile |
396 self.projectBrowser.ptBrowser.trpreview[list].connect( | 452 ) |
397 self.__TRPreviewer) | 453 self.projectBrowser.ptBrowser.trpreview[list].connect(self.__TRPreviewer) |
398 self.projectBrowser.ptBrowser.trpreview[list, bool].connect( | 454 self.projectBrowser.ptBrowser.trpreview[list, bool].connect(self.__TRPreviewer) |
399 self.__TRPreviewer) | |
400 self.projectBrowser.ptBrowser.closeSourceWindow.connect( | 455 self.projectBrowser.ptBrowser.closeSourceWindow.connect( |
401 self.viewmanager.closeWindow) | 456 self.viewmanager.closeWindow |
457 ) | |
402 self.projectBrowser.ptBrowser.appendStdout.connect(self.appendToStdout) | 458 self.projectBrowser.ptBrowser.appendStdout.connect(self.appendToStdout) |
403 self.projectBrowser.ptBrowser.appendStderr.connect(self.appendToStderr) | 459 self.projectBrowser.ptBrowser.appendStderr.connect(self.appendToStderr) |
404 | 460 |
405 self.projectBrowser.piBrowser.sourceFile[str].connect( | 461 self.projectBrowser.piBrowser.sourceFile[str].connect( |
406 self.viewmanager.openSourceFile) | 462 self.viewmanager.openSourceFile |
463 ) | |
407 self.projectBrowser.piBrowser.sourceFile[str, int].connect( | 464 self.projectBrowser.piBrowser.sourceFile[str, int].connect( |
408 self.viewmanager.openSourceFile) | 465 self.viewmanager.openSourceFile |
466 ) | |
409 self.projectBrowser.piBrowser.closeSourceWindow.connect( | 467 self.projectBrowser.piBrowser.closeSourceWindow.connect( |
410 self.viewmanager.closeWindow) | 468 self.viewmanager.closeWindow |
469 ) | |
411 self.projectBrowser.piBrowser.appendStdout.connect(self.appendToStdout) | 470 self.projectBrowser.piBrowser.appendStdout.connect(self.appendToStdout) |
412 self.projectBrowser.piBrowser.appendStderr.connect(self.appendToStderr) | 471 self.projectBrowser.piBrowser.appendStderr.connect(self.appendToStderr) |
413 | 472 |
414 self.projectBrowser.ppBrowser.sourceFile[str].connect( | 473 self.projectBrowser.ppBrowser.sourceFile[str].connect( |
415 self.viewmanager.openSourceFile) | 474 self.viewmanager.openSourceFile |
475 ) | |
416 self.projectBrowser.ppBrowser.sourceFile[str, int].connect( | 476 self.projectBrowser.ppBrowser.sourceFile[str, int].connect( |
417 self.viewmanager.openSourceFile) | 477 self.viewmanager.openSourceFile |
478 ) | |
418 self.projectBrowser.ppBrowser.closeSourceWindow.connect( | 479 self.projectBrowser.ppBrowser.closeSourceWindow.connect( |
419 self.viewmanager.closeWindow) | 480 self.viewmanager.closeWindow |
481 ) | |
420 self.projectBrowser.ppBrowser.appendStdout.connect(self.appendToStdout) | 482 self.projectBrowser.ppBrowser.appendStdout.connect(self.appendToStdout) |
421 self.projectBrowser.ppBrowser.appendStderr.connect(self.appendToStderr) | 483 self.projectBrowser.ppBrowser.appendStderr.connect(self.appendToStderr) |
422 | 484 |
423 self.projectBrowser.poBrowser.sourceFile.connect( | 485 self.projectBrowser.poBrowser.sourceFile.connect( |
424 self.viewmanager.openSourceFile) | 486 self.viewmanager.openSourceFile |
487 ) | |
425 self.projectBrowser.poBrowser.closeSourceWindow.connect( | 488 self.projectBrowser.poBrowser.closeSourceWindow.connect( |
426 self.viewmanager.closeWindow) | 489 self.viewmanager.closeWindow |
490 ) | |
427 self.projectBrowser.poBrowser.pixmapEditFile.connect(self.__editPixmap) | 491 self.projectBrowser.poBrowser.pixmapEditFile.connect(self.__editPixmap) |
428 self.projectBrowser.poBrowser.pixmapFile.connect(self.__showPixmap) | 492 self.projectBrowser.poBrowser.pixmapFile.connect(self.__showPixmap) |
429 self.projectBrowser.poBrowser.svgFile.connect(self.__showSvg) | 493 self.projectBrowser.poBrowser.svgFile.connect(self.__showSvg) |
430 self.projectBrowser.poBrowser.umlFile.connect(self.__showUml) | 494 self.projectBrowser.poBrowser.umlFile.connect(self.__showUml) |
431 self.projectBrowser.poBrowser.binaryFile.connect(self.__openHexEditor) | 495 self.projectBrowser.poBrowser.binaryFile.connect(self.__openHexEditor) |
432 | 496 |
433 self.project.sourceFile.connect(self.viewmanager.openSourceFile) | 497 self.project.sourceFile.connect(self.viewmanager.openSourceFile) |
434 self.project.designerFile.connect(self.__designer) | 498 self.project.designerFile.connect(self.__designer) |
435 self.project.linguistFile.connect(self.__linguist) | 499 self.project.linguistFile.connect(self.__linguist) |
436 self.project.projectOpened.connect(self.viewmanager.projectOpened) | 500 self.project.projectOpened.connect(self.viewmanager.projectOpened) |
437 self.project.projectClosed.connect(self.viewmanager.projectClosed) | 501 self.project.projectClosed.connect(self.viewmanager.projectClosed) |
438 self.project.projectFileRenamed.connect( | 502 self.project.projectFileRenamed.connect(self.viewmanager.projectFileRenamed) |
439 self.viewmanager.projectFileRenamed) | |
440 self.project.lexerAssociationsChanged.connect( | 503 self.project.lexerAssociationsChanged.connect( |
441 self.viewmanager.projectLexerAssociationsChanged) | 504 self.viewmanager.projectLexerAssociationsChanged |
505 ) | |
442 self.project.newProject.connect(self.__newProject) | 506 self.project.newProject.connect(self.__newProject) |
443 self.project.projectOpened.connect(self.__projectOpened) | 507 self.project.projectOpened.connect(self.__projectOpened) |
444 self.project.projectOpened.connect(self.__activateProjectBrowser) | 508 self.project.projectOpened.connect(self.__activateProjectBrowser) |
445 self.project.projectClosed.connect(self.__projectClosed) | 509 self.project.projectClosed.connect(self.__projectClosed) |
446 self.project.projectClosed.connect( | 510 self.project.projectClosed.connect( |
447 self.backgroundService.preferencesOrProjectChanged) | 511 self.backgroundService.preferencesOrProjectChanged |
512 ) | |
448 self.project.projectOpened.connect(self.__writeCrashSession) | 513 self.project.projectOpened.connect(self.__writeCrashSession) |
449 self.project.projectClosed.connect(self.__writeCrashSession) | 514 self.project.projectClosed.connect(self.__writeCrashSession) |
450 self.project.appendStdout.connect(self.appendToStdout) | 515 self.project.appendStdout.connect(self.appendToStdout) |
451 self.project.appendStderr.connect(self.appendToStderr) | 516 self.project.appendStderr.connect(self.appendToStderr) |
452 | 517 |
453 self.multiProject.multiProjectOpened.connect( | 518 self.multiProject.multiProjectOpened.connect(self.__activateMultiProjectBrowser) |
454 self.__activateMultiProjectBrowser) | 519 self.multiProject.multiProjectOpened.connect(self.__writeCrashSession) |
455 self.multiProject.multiProjectOpened.connect( | 520 self.multiProject.multiProjectClosed.connect(self.__writeCrashSession) |
456 self.__writeCrashSession) | 521 |
457 self.multiProject.multiProjectClosed.connect( | |
458 self.__writeCrashSession) | |
459 | |
460 self.debuggerUI.resetUI.connect(self.viewmanager.handleResetUI) | 522 self.debuggerUI.resetUI.connect(self.viewmanager.handleResetUI) |
461 self.debuggerUI.resetUI.connect(self.debugViewer.handleResetUI) | 523 self.debuggerUI.resetUI.connect(self.debugViewer.handleResetUI) |
462 self.debuggerUI.resetUI.connect(self.__debuggingDone) | 524 self.debuggerUI.resetUI.connect(self.__debuggingDone) |
463 self.debuggerUI.debuggingStarted.connect(self.__programChange) | 525 self.debuggerUI.debuggingStarted.connect(self.__programChange) |
464 self.debuggerUI.debuggingStarted.connect(self.__debuggingStarted) | 526 self.debuggerUI.debuggingStarted.connect(self.__debuggingStarted) |
465 self.debuggerUI.compileForms.connect( | 527 self.debuggerUI.compileForms.connect( |
466 self.projectBrowser.pfBrowser.compileChangedForms) | 528 self.projectBrowser.pfBrowser.compileChangedForms |
529 ) | |
467 self.debuggerUI.compileResources.connect( | 530 self.debuggerUI.compileResources.connect( |
468 self.projectBrowser.prBrowser.compileChangedResources) | 531 self.projectBrowser.prBrowser.compileChangedResources |
532 ) | |
469 self.debuggerUI.executeMake.connect(self.project.executeMake) | 533 self.debuggerUI.executeMake.connect(self.project.executeMake) |
470 self.debuggerUI.appendStdout.connect(self.appendToStdout) | 534 self.debuggerUI.appendStdout.connect(self.appendToStdout) |
471 | 535 |
472 self.__debugServer.clientDisassembly.connect( | 536 self.__debugServer.clientDisassembly.connect( |
473 self.debugViewer.disassemblyViewer.showDisassembly) | 537 self.debugViewer.disassemblyViewer.showDisassembly |
538 ) | |
474 self.__debugServer.clientProcessStdout.connect(self.appendToStdout) | 539 self.__debugServer.clientProcessStdout.connect(self.appendToStdout) |
475 self.__debugServer.clientProcessStderr.connect(self.appendToStderr) | 540 self.__debugServer.clientProcessStderr.connect(self.appendToStderr) |
476 self.__debugServer.appendStdout.connect(self.appendToStdout) | 541 self.__debugServer.appendStdout.connect(self.appendToStdout) |
477 | 542 |
478 self.stdout.appendStdout.connect(self.appendToStdout) | 543 self.stdout.appendStdout.connect(self.appendToStdout) |
479 self.stderr.appendStderr.connect(self.appendToStderr) | 544 self.stderr.appendStderr.connect(self.appendToStderr) |
480 | 545 |
481 self.preferencesChanged.connect(self.viewmanager.preferencesChanged) | 546 self.preferencesChanged.connect(self.viewmanager.preferencesChanged) |
482 self.reloadAPIs.connect(self.viewmanager.getAPIsManager().reloadAPIs) | 547 self.reloadAPIs.connect(self.viewmanager.getAPIsManager().reloadAPIs) |
483 self.preferencesChanged.connect(self.logViewer.preferencesChanged) | 548 self.preferencesChanged.connect(self.logViewer.preferencesChanged) |
484 self.appendStdout.connect(self.logViewer.appendToStdout) | 549 self.appendStdout.connect(self.logViewer.appendToStdout) |
485 self.appendStderr.connect(self.logViewer.appendToStderr) | 550 self.appendStderr.connect(self.logViewer.appendToStderr) |
486 self.preferencesChanged.connect(self.shell.handlePreferencesChanged) | 551 self.preferencesChanged.connect(self.shell.handlePreferencesChanged) |
487 self.preferencesChanged.connect(self.project.handlePreferencesChanged) | 552 self.preferencesChanged.connect(self.project.handlePreferencesChanged) |
553 self.preferencesChanged.connect(self.projectBrowser.handlePreferencesChanged) | |
488 self.preferencesChanged.connect( | 554 self.preferencesChanged.connect( |
489 self.projectBrowser.handlePreferencesChanged) | 555 self.projectBrowser.psBrowser.handlePreferencesChanged |
556 ) | |
490 self.preferencesChanged.connect( | 557 self.preferencesChanged.connect( |
491 self.projectBrowser.psBrowser.handlePreferencesChanged) | 558 self.projectBrowser.pfBrowser.handlePreferencesChanged |
559 ) | |
492 self.preferencesChanged.connect( | 560 self.preferencesChanged.connect( |
493 self.projectBrowser.pfBrowser.handlePreferencesChanged) | 561 self.projectBrowser.prBrowser.handlePreferencesChanged |
562 ) | |
494 self.preferencesChanged.connect( | 563 self.preferencesChanged.connect( |
495 self.projectBrowser.prBrowser.handlePreferencesChanged) | 564 self.projectBrowser.ptBrowser.handlePreferencesChanged |
565 ) | |
496 self.preferencesChanged.connect( | 566 self.preferencesChanged.connect( |
497 self.projectBrowser.ptBrowser.handlePreferencesChanged) | 567 self.projectBrowser.piBrowser.handlePreferencesChanged |
568 ) | |
498 self.preferencesChanged.connect( | 569 self.preferencesChanged.connect( |
499 self.projectBrowser.piBrowser.handlePreferencesChanged) | 570 self.projectBrowser.ppBrowser.handlePreferencesChanged |
571 ) | |
500 self.preferencesChanged.connect( | 572 self.preferencesChanged.connect( |
501 self.projectBrowser.ppBrowser.handlePreferencesChanged) | 573 self.projectBrowser.poBrowser.handlePreferencesChanged |
502 self.preferencesChanged.connect( | 574 ) |
503 self.projectBrowser.poBrowser.handlePreferencesChanged) | 575 self.preferencesChanged.connect(self.taskViewer.handlePreferencesChanged) |
504 self.preferencesChanged.connect( | |
505 self.taskViewer.handlePreferencesChanged) | |
506 self.preferencesChanged.connect(self.pluginManager.preferencesChanged) | 576 self.preferencesChanged.connect(self.pluginManager.preferencesChanged) |
507 self.preferencesChanged.connect(self.__debugServer.preferencesChanged) | 577 self.preferencesChanged.connect(self.__debugServer.preferencesChanged) |
508 self.preferencesChanged.connect(self.debugViewer.preferencesChanged) | 578 self.preferencesChanged.connect(self.debugViewer.preferencesChanged) |
509 self.preferencesChanged.connect( | 579 self.preferencesChanged.connect( |
510 self.backgroundService.preferencesOrProjectChanged) | 580 self.backgroundService.preferencesOrProjectChanged |
581 ) | |
511 self.preferencesChanged.connect(self.__previewer.preferencesChanged) | 582 self.preferencesChanged.connect(self.__previewer.preferencesChanged) |
512 self.preferencesChanged.connect(self.__astViewer.preferencesChanged) | 583 self.preferencesChanged.connect(self.__astViewer.preferencesChanged) |
513 self.preferencesChanged.connect(self.__disViewer.preferencesChanged) | 584 self.preferencesChanged.connect(self.__disViewer.preferencesChanged) |
514 | 585 |
515 if self.browser is not None: | 586 if self.browser is not None: |
516 self.browser.sourceFile[str].connect( | 587 self.browser.sourceFile[str].connect(self.viewmanager.openSourceFile) |
517 self.viewmanager.openSourceFile) | 588 self.browser.sourceFile[str, int].connect(self.viewmanager.openSourceFile) |
518 self.browser.sourceFile[str, int].connect( | 589 self.browser.sourceFile[str, list].connect(self.viewmanager.openSourceFile) |
519 self.viewmanager.openSourceFile) | |
520 self.browser.sourceFile[str, list].connect( | |
521 self.viewmanager.openSourceFile) | |
522 self.browser.sourceFile[str, int, str].connect( | 590 self.browser.sourceFile[str, int, str].connect( |
523 self.viewmanager.openSourceFile) | 591 self.viewmanager.openSourceFile |
592 ) | |
524 self.browser.designerFile.connect(self.__designer) | 593 self.browser.designerFile.connect(self.__designer) |
525 self.browser.linguistFile.connect(self.__linguist) | 594 self.browser.linguistFile.connect(self.__linguist) |
526 self.browser.projectFile.connect(self.project.openProject) | 595 self.browser.projectFile.connect(self.project.openProject) |
527 self.browser.multiProjectFile.connect( | 596 self.browser.multiProjectFile.connect(self.multiProject.openMultiProject) |
528 self.multiProject.openMultiProject) | |
529 self.browser.pixmapEditFile.connect(self.__editPixmap) | 597 self.browser.pixmapEditFile.connect(self.__editPixmap) |
530 self.browser.pixmapFile.connect(self.__showPixmap) | 598 self.browser.pixmapFile.connect(self.__showPixmap) |
531 self.browser.svgFile.connect(self.__showSvg) | 599 self.browser.svgFile.connect(self.__showSvg) |
532 self.browser.umlFile.connect(self.__showUml) | 600 self.browser.umlFile.connect(self.__showUml) |
533 self.browser.binaryFile.connect(self.__openHexEditor) | 601 self.browser.binaryFile.connect(self.__openHexEditor) |
534 self.browser.testFile.connect(self.__startTestScript) | 602 self.browser.testFile.connect(self.__startTestScript) |
535 self.browser.trpreview.connect(self.__TRPreviewer) | 603 self.browser.trpreview.connect(self.__TRPreviewer) |
536 | 604 |
537 self.debuggerUI.debuggingStarted.connect( | 605 self.debuggerUI.debuggingStarted.connect(self.browser.handleProgramChange) |
538 self.browser.handleProgramChange) | 606 |
539 | |
540 self.__debugServer.clientInterpreterChanged.connect( | 607 self.__debugServer.clientInterpreterChanged.connect( |
541 self.browser.handleInterpreterChanged) | 608 self.browser.handleInterpreterChanged |
542 | 609 ) |
543 self.preferencesChanged.connect( | 610 |
544 self.browser.handlePreferencesChanged) | 611 self.preferencesChanged.connect(self.browser.handlePreferencesChanged) |
545 | 612 |
546 if self.codeDocumentationViewer is not None: | 613 if self.codeDocumentationViewer is not None: |
547 self.preferencesChanged.connect( | 614 self.preferencesChanged.connect( |
548 self.codeDocumentationViewer.preferencesChanged) | 615 self.codeDocumentationViewer.preferencesChanged |
549 | 616 ) |
617 | |
550 self.viewmanager.editorSaved.connect(self.project.repopulateItem) | 618 self.viewmanager.editorSaved.connect(self.project.repopulateItem) |
551 self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed) | 619 self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed) |
552 self.viewmanager.editorOpened.connect(self.__editorOpened) | 620 self.viewmanager.editorOpened.connect(self.__editorOpened) |
553 self.viewmanager.changeCaption.connect(self.__setWindowCaption) | 621 self.viewmanager.changeCaption.connect(self.__setWindowCaption) |
554 self.viewmanager.checkActions.connect(self.__checkActions) | 622 self.viewmanager.checkActions.connect(self.__checkActions) |
555 self.viewmanager.editorChanged.connect( | 623 self.viewmanager.editorChanged.connect(self.projectBrowser.handleEditorChanged) |
556 self.projectBrowser.handleEditorChanged) | |
557 self.viewmanager.editorLineChanged.connect( | 624 self.viewmanager.editorLineChanged.connect( |
558 self.projectBrowser.handleEditorLineChanged) | 625 self.projectBrowser.handleEditorLineChanged |
626 ) | |
559 self.viewmanager.editorOpened.connect(self.__writeCrashSession) | 627 self.viewmanager.editorOpened.connect(self.__writeCrashSession) |
560 self.viewmanager.editorClosed.connect(self.__writeCrashSession) | 628 self.viewmanager.editorClosed.connect(self.__writeCrashSession) |
561 self.viewmanager.editorRenamed.connect(self.__writeCrashSession) | 629 self.viewmanager.editorRenamed.connect(self.__writeCrashSession) |
562 self.viewmanager.editorChanged.connect(self.__writeCrashSession) | 630 self.viewmanager.editorChanged.connect(self.__writeCrashSession) |
563 | 631 |
564 self.shell.zoomValueChanged.connect( | 632 self.shell.zoomValueChanged.connect( |
565 lambda v: self.viewmanager.zoomValueChanged(v, self.shell)) | 633 lambda v: self.viewmanager.zoomValueChanged(v, self.shell) |
566 | 634 ) |
635 | |
567 if self.cooperation is not None: | 636 if self.cooperation is not None: |
568 self.viewmanager.checkActions.connect( | 637 self.viewmanager.checkActions.connect(self.cooperation.checkEditorActions) |
569 self.cooperation.checkEditorActions) | 638 self.preferencesChanged.connect(self.cooperation.preferencesChanged) |
570 self.preferencesChanged.connect( | 639 self.cooperation.shareEditor.connect(self.viewmanager.shareEditor) |
571 self.cooperation.preferencesChanged) | 640 self.cooperation.startEdit.connect(self.viewmanager.startSharedEdit) |
572 self.cooperation.shareEditor.connect( | 641 self.cooperation.sendEdit.connect(self.viewmanager.sendSharedEdit) |
573 self.viewmanager.shareEditor) | 642 self.cooperation.cancelEdit.connect(self.viewmanager.cancelSharedEdit) |
574 self.cooperation.startEdit.connect( | 643 self.cooperation.connected.connect(self.viewmanager.shareConnected) |
575 self.viewmanager.startSharedEdit) | 644 self.cooperation.editorCommand.connect(self.viewmanager.receive) |
576 self.cooperation.sendEdit.connect( | 645 self.viewmanager.setCooperationClient(self.cooperation.getClient()) |
577 self.viewmanager.sendSharedEdit) | 646 |
578 self.cooperation.cancelEdit.connect( | |
579 self.viewmanager.cancelSharedEdit) | |
580 self.cooperation.connected.connect( | |
581 self.viewmanager.shareConnected) | |
582 self.cooperation.editorCommand.connect( | |
583 self.viewmanager.receive) | |
584 self.viewmanager.setCooperationClient( | |
585 self.cooperation.getClient()) | |
586 | |
587 if self.symbolsViewer is not None: | 647 if self.symbolsViewer is not None: |
588 self.symbolsViewer.insertSymbol.connect( | 648 self.symbolsViewer.insertSymbol.connect(self.viewmanager.insertSymbol) |
589 self.viewmanager.insertSymbol) | 649 |
590 | |
591 if self.numbersViewer is not None: | 650 if self.numbersViewer is not None: |
592 self.numbersViewer.insertNumber.connect( | 651 self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber) |
593 self.viewmanager.insertNumber) | 652 |
594 | |
595 if self.irc is not None: | 653 if self.irc is not None: |
596 self.irc.autoConnected.connect(self.__ircAutoConnected) | 654 self.irc.autoConnected.connect(self.__ircAutoConnected) |
597 | 655 |
598 # create the toolbar manager object | 656 # create the toolbar manager object |
599 self.toolbarManager = EricToolBarManager(self, self) | 657 self.toolbarManager = EricToolBarManager(self, self) |
600 self.toolbarManager.setMainWindow(self) | 658 self.toolbarManager.setMainWindow(self) |
601 | 659 |
602 # Initialize the tool groups and list of started tools | 660 # Initialize the tool groups and list of started tools |
603 splash.showMessage(self.tr("Initializing Tools...")) | 661 splash.showMessage(self.tr("Initializing Tools...")) |
604 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() | 662 self.toolGroups, self.currentToolGroup = Preferences.readToolGroups() |
605 self.toolProcs = [] | 663 self.toolProcs = [] |
606 self.__initExternalToolsActions() | 664 self.__initExternalToolsActions() |
607 | 665 |
608 # redirect handling of http, https and file URLs to ourselves | 666 # redirect handling of http, https and file URLs to ourselves |
609 QDesktopServices.setUrlHandler("file", self.handleUrl) | 667 QDesktopServices.setUrlHandler("file", self.handleUrl) |
610 QDesktopServices.setUrlHandler("http", self.handleUrl) | 668 QDesktopServices.setUrlHandler("http", self.handleUrl) |
611 QDesktopServices.setUrlHandler("https", self.handleUrl) | 669 QDesktopServices.setUrlHandler("https", self.handleUrl) |
612 | 670 |
613 # register all relevant objects | 671 # register all relevant objects |
614 splash.showMessage(self.tr("Registering Objects...")) | 672 splash.showMessage(self.tr("Registering Objects...")) |
615 ericApp().registerObject("UserInterface", self) | 673 ericApp().registerObject("UserInterface", self) |
616 ericApp().registerObject("DebugUI", self.debuggerUI) | 674 ericApp().registerObject("DebugUI", self.debuggerUI) |
617 ericApp().registerObject("DebugServer", self.__debugServer) | 675 ericApp().registerObject("DebugServer", self.__debugServer) |
632 if self.symbolsViewer is not None: | 690 if self.symbolsViewer is not None: |
633 ericApp().registerObject("Symbols", self.symbolsViewer) | 691 ericApp().registerObject("Symbols", self.symbolsViewer) |
634 if self.numbersViewer is not None: | 692 if self.numbersViewer is not None: |
635 ericApp().registerObject("Numbers", self.numbersViewer) | 693 ericApp().registerObject("Numbers", self.numbersViewer) |
636 if self.codeDocumentationViewer is not None: | 694 if self.codeDocumentationViewer is not None: |
637 ericApp().registerObject("DocuViewer", | 695 ericApp().registerObject("DocuViewer", self.codeDocumentationViewer) |
638 self.codeDocumentationViewer) | |
639 if self.microPythonWidget is not None: | 696 if self.microPythonWidget is not None: |
640 ericApp().registerObject("MicroPython", self.microPythonWidget) | 697 ericApp().registerObject("MicroPython", self.microPythonWidget) |
641 ericApp().registerObject("JediAssistant", self.jediAssistant) | 698 ericApp().registerObject("JediAssistant", self.jediAssistant) |
642 ericApp().registerObject("PluginRepositoryViewer", | 699 ericApp().registerObject("PluginRepositoryViewer", self.pluginRepositoryViewer) |
643 self.pluginRepositoryViewer) | 700 |
644 | |
645 # create the various JSON file interfaces | 701 # create the various JSON file interfaces |
646 self.__sessionFile = SessionFile(True) | 702 self.__sessionFile = SessionFile(True) |
647 self.__tasksFile = TasksFile(True) | 703 self.__tasksFile = TasksFile(True) |
648 | 704 |
649 # Initialize the actions, menus, toolbars and statusbar | 705 # Initialize the actions, menus, toolbars and statusbar |
650 splash.showMessage(self.tr("Initializing Actions...")) | 706 splash.showMessage(self.tr("Initializing Actions...")) |
651 self.__initActions() | 707 self.__initActions() |
652 splash.showMessage(self.tr("Initializing Menus...")) | 708 splash.showMessage(self.tr("Initializing Menus...")) |
653 self.__initMenus() | 709 self.__initMenus() |
654 splash.showMessage(self.tr("Initializing Toolbars...")) | 710 splash.showMessage(self.tr("Initializing Toolbars...")) |
655 self.__initToolbars() | 711 self.__initToolbars() |
656 splash.showMessage(self.tr("Initializing Statusbar...")) | 712 splash.showMessage(self.tr("Initializing Statusbar...")) |
657 self.__initStatusbar() | 713 self.__initStatusbar() |
658 | 714 |
659 # connect the appFocusChanged signal after all actions are ready | 715 # connect the appFocusChanged signal after all actions are ready |
660 app.focusChanged.connect(self.viewmanager.appFocusChanged) | 716 app.focusChanged.connect(self.viewmanager.appFocusChanged) |
661 | 717 |
662 # Initialize the instance variables. | 718 # Initialize the instance variables. |
663 self.currentProg = None | 719 self.currentProg = None |
664 self.isProg = False | 720 self.isProg = False |
665 self.__testingEditorOpen = False | 721 self.__testingEditorOpen = False |
666 self.__testingProjectOpen = False | 722 self.__testingProjectOpen = False |
667 | 723 |
668 self.inDragDrop = False | 724 self.inDragDrop = False |
669 self.setAcceptDrops(True) | 725 self.setAcceptDrops(True) |
670 | 726 |
671 self.currentProfile = None | 727 self.currentProfile = None |
672 | 728 |
673 self.shutdownCalled = False | 729 self.shutdownCalled = False |
674 self.inCloseEvent = False | 730 self.inCloseEvent = False |
675 | 731 |
676 # now redirect stdout and stderr | 732 # now redirect stdout and stderr |
677 # TODO: release - reenable redirection | 733 # TODO: release - reenable redirection |
678 ## sys.stdout = self.stdout # __IGNORE_WARNING_M891__ | 734 ## sys.stdout = self.stdout # __IGNORE_WARNING_M891__ |
679 ## sys.stderr = self.stderr # __IGNORE_WARNING_M891__ | 735 ## sys.stderr = self.stderr # __IGNORE_WARNING_M891__ |
680 | 736 |
681 # now fire up the single application server | 737 # now fire up the single application server |
682 if Preferences.getUI("SingleApplicationMode"): | 738 if Preferences.getUI("SingleApplicationMode"): |
683 splash.showMessage( | 739 splash.showMessage(self.tr("Initializing Single Application Server...")) |
684 self.tr("Initializing Single Application Server...")) | |
685 self.SAServer = EricSingleApplicationServer() | 740 self.SAServer = EricSingleApplicationServer() |
686 else: | 741 else: |
687 self.SAServer = None | 742 self.SAServer = None |
688 | 743 |
689 # now finalize the plugin manager setup | 744 # now finalize the plugin manager setup |
690 splash.showMessage(self.tr("Initializing Plugins...")) | 745 splash.showMessage(self.tr("Initializing Plugins...")) |
691 self.pluginManager.finalizeSetup() | 746 self.pluginManager.finalizeSetup() |
692 # now activate plugins having autoload set to True | 747 # now activate plugins having autoload set to True |
693 splash.showMessage(self.tr("Activating Plugins...")) | 748 splash.showMessage(self.tr("Activating Plugins...")) |
695 splash.showMessage(self.tr("Generating Plugins Toolbars...")) | 750 splash.showMessage(self.tr("Generating Plugins Toolbars...")) |
696 self.pluginManager.initPluginToolbars(self.toolbarManager) | 751 self.pluginManager.initPluginToolbars(self.toolbarManager) |
697 if Preferences.getPluginManager("StartupCleanup"): | 752 if Preferences.getPluginManager("StartupCleanup"): |
698 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) | 753 splash.showMessage(self.tr("Cleaning Plugins Download Area...")) |
699 from PluginManager.PluginRepositoryDialog import ( | 754 from PluginManager.PluginRepositoryDialog import ( |
700 PluginRepositoryDownloadCleanup | 755 PluginRepositoryDownloadCleanup, |
701 ) | 756 ) |
757 | |
702 PluginRepositoryDownloadCleanup(quiet=True) | 758 PluginRepositoryDownloadCleanup(quiet=True) |
703 | 759 |
704 # now read the keyboard shortcuts for all the actions | 760 # now read the keyboard shortcuts for all the actions |
705 from Preferences import Shortcuts | 761 from Preferences import Shortcuts |
762 | |
706 Shortcuts.readShortcuts() | 763 Shortcuts.readShortcuts() |
707 | 764 |
708 # restore toolbar manager state | 765 # restore toolbar manager state |
709 splash.showMessage(self.tr("Restoring Toolbarmanager...")) | 766 splash.showMessage(self.tr("Restoring Toolbarmanager...")) |
710 self.toolbarManager.restoreState( | 767 self.toolbarManager.restoreState(Preferences.getUI("ToolbarManagerState")) |
711 Preferences.getUI("ToolbarManagerState")) | 768 |
712 | |
713 if self.codeDocumentationViewer is not None: | 769 if self.codeDocumentationViewer is not None: |
714 # finalize the initialization of the code documentation viewer | 770 # finalize the initialization of the code documentation viewer |
715 self.codeDocumentationViewer.finalizeSetup() | 771 self.codeDocumentationViewer.finalizeSetup() |
716 | 772 |
717 # now activate the initial view profile | 773 # now activate the initial view profile |
718 splash.showMessage(self.tr("Setting View Profile...")) | 774 splash.showMessage(self.tr("Setting View Profile...")) |
719 self.__setEditProfile() | 775 self.__setEditProfile() |
720 | 776 |
721 # special treatment for the VCS toolbars | 777 # special treatment for the VCS toolbars |
722 for tb in self.getToolbarsByCategory("vcs"): | 778 for tb in self.getToolbarsByCategory("vcs"): |
723 tb.setVisible(False) | 779 tb.setVisible(False) |
724 tb.setEnabled(False) | 780 tb.setEnabled(False) |
725 tb = self.getToolbar("vcs")[1] | 781 tb = self.getToolbar("vcs")[1] |
726 tb.setEnabled(True) | 782 tb.setEnabled(True) |
727 if Preferences.getVCS("ShowVcsToolbar"): | 783 if Preferences.getVCS("ShowVcsToolbar"): |
728 tb.setVisible(True) | 784 tb.setVisible(True) |
729 | 785 |
730 # now read the saved tasks | 786 # now read the saved tasks |
731 splash.showMessage(self.tr("Reading Tasks...")) | 787 splash.showMessage(self.tr("Reading Tasks...")) |
732 self.__readTasks() | 788 self.__readTasks() |
733 | 789 |
734 if self.templateViewer is not None: | 790 if self.templateViewer is not None: |
735 # now read the saved templates | 791 # now read the saved templates |
736 splash.showMessage(self.tr("Reading Templates...")) | 792 splash.showMessage(self.tr("Reading Templates...")) |
737 self.templateViewer.readTemplates() | 793 self.templateViewer.readTemplates() |
738 | 794 |
739 # now start the debug client with the most recently used virtual | 795 # now start the debug client with the most recently used virtual |
740 # environment | 796 # environment |
741 splash.showMessage(self.tr("Starting Debugger...")) | 797 splash.showMessage(self.tr("Starting Debugger...")) |
742 if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"): | 798 if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"): |
743 self.__debugServer.startClient( | 799 self.__debugServer.startClient( |
744 False, venvName=Preferences.getShell("LastVirtualEnvironment") | 800 False, venvName=Preferences.getShell("LastVirtualEnvironment") |
745 ) | 801 ) |
746 else: | 802 else: |
747 self.__debugServer.startClient(False) | 803 self.__debugServer.startClient(False) |
748 | 804 |
749 # attributes for the network objects | 805 # attributes for the network objects |
750 self.__networkManager = QNetworkAccessManager(self) | 806 self.__networkManager = QNetworkAccessManager(self) |
751 self.__networkManager.proxyAuthenticationRequired.connect( | 807 self.__networkManager.proxyAuthenticationRequired.connect( |
752 proxyAuthenticationRequired) | 808 proxyAuthenticationRequired |
809 ) | |
753 if SSL_AVAILABLE: | 810 if SSL_AVAILABLE: |
754 self.__sslErrorHandler = EricSslErrorHandler(self) | 811 self.__sslErrorHandler = EricSslErrorHandler(self) |
755 self.__networkManager.sslErrors.connect(self.__sslErrors) | 812 self.__networkManager.sslErrors.connect(self.__sslErrors) |
756 self.__replies = [] | 813 self.__replies = [] |
757 | 814 |
758 # attributes for the last shown configuration page and the | 815 # attributes for the last shown configuration page and the |
759 # extended configuration entries | 816 # extended configuration entries |
760 self.__lastConfigurationPageName = "" | 817 self.__lastConfigurationPageName = "" |
761 self.__expandedConfigurationEntries = [] | 818 self.__expandedConfigurationEntries = [] |
762 | 819 |
763 # set the keyboard input interval | 820 # set the keyboard input interval |
764 interval = Preferences.getUI("KeyboardInputInterval") | 821 interval = Preferences.getUI("KeyboardInputInterval") |
765 if interval > 0: | 822 if interval > 0: |
766 QApplication.setKeyboardInputInterval(interval) | 823 QApplication.setKeyboardInputInterval(interval) |
767 | 824 |
768 # connect to the desktop environment session manager | 825 # connect to the desktop environment session manager |
769 app.commitDataRequest.connect(self.__commitData, | 826 app.commitDataRequest.connect( |
770 Qt.ConnectionType.DirectConnection) | 827 self.__commitData, Qt.ConnectionType.DirectConnection |
771 | 828 ) |
829 | |
772 def networkAccessManager(self): | 830 def networkAccessManager(self): |
773 """ | 831 """ |
774 Public method to get a reference to the network access manager object. | 832 Public method to get a reference to the network access manager object. |
775 | 833 |
776 @return reference to the network access manager object | 834 @return reference to the network access manager object |
777 @rtype QNetworkAccessManager | 835 @rtype QNetworkAccessManager |
778 """ | 836 """ |
779 return self.__networkManager | 837 return self.__networkManager |
780 | 838 |
781 def __createObjects(self): | 839 def __createObjects(self): |
782 """ | 840 """ |
783 Private method to create the various application objects. | 841 Private method to create the various application objects. |
784 """ | 842 """ |
785 # Create the view manager depending on the configuration setting | 843 # Create the view manager depending on the configuration setting |
786 logging.debug("Creating Viewmanager...") | 844 logging.debug("Creating Viewmanager...") |
787 import ViewManager | 845 import ViewManager |
846 | |
788 self.viewmanager = ViewManager.factory( | 847 self.viewmanager = ViewManager.factory( |
789 self, self, self.__debugServer, self.pluginManager) | 848 self, self, self.__debugServer, self.pluginManager |
790 | 849 ) |
850 | |
791 # Create previewer | 851 # Create previewer |
792 logging.debug("Creating Previewer...") | 852 logging.debug("Creating Previewer...") |
793 from .Previewer import Previewer | 853 from .Previewer import Previewer |
854 | |
794 self.__previewer = Previewer(self.viewmanager) | 855 self.__previewer = Previewer(self.viewmanager) |
795 | 856 |
796 # Create AST viewer | 857 # Create AST viewer |
797 logging.debug("Creating Python AST Viewer") | 858 logging.debug("Creating Python AST Viewer") |
798 from .PythonAstViewer import PythonAstViewer | 859 from .PythonAstViewer import PythonAstViewer |
860 | |
799 self.__astViewer = PythonAstViewer(self.viewmanager) | 861 self.__astViewer = PythonAstViewer(self.viewmanager) |
800 | 862 |
801 # Create DIS viewer | 863 # Create DIS viewer |
802 logging.debug("Creating Python Disassembly Viewer") | 864 logging.debug("Creating Python Disassembly Viewer") |
803 from .PythonDisViewer import PythonDisViewer | 865 from .PythonDisViewer import PythonDisViewer |
866 | |
804 self.__disViewer = PythonDisViewer(self.viewmanager) | 867 self.__disViewer = PythonDisViewer(self.viewmanager) |
805 | 868 |
806 # Create the project browser | 869 # Create the project browser |
807 logging.debug("Creating Project Browser...") | 870 logging.debug("Creating Project Browser...") |
808 from Project.ProjectBrowser import ProjectBrowser | 871 from Project.ProjectBrowser import ProjectBrowser |
872 | |
809 self.projectBrowser = ProjectBrowser(self.project) | 873 self.projectBrowser = ProjectBrowser(self.project) |
810 | 874 |
811 # Create the multi project browser | 875 # Create the multi project browser |
812 logging.debug("Creating Multiproject Browser...") | 876 logging.debug("Creating Multiproject Browser...") |
813 from MultiProject.MultiProjectBrowser import MultiProjectBrowser | 877 from MultiProject.MultiProjectBrowser import MultiProjectBrowser |
814 self.multiProjectBrowser = MultiProjectBrowser( | 878 |
815 self.multiProject, self.project) | 879 self.multiProjectBrowser = MultiProjectBrowser(self.multiProject, self.project) |
816 | 880 |
817 # Create the task viewer part of the user interface | 881 # Create the task viewer part of the user interface |
818 logging.debug("Creating Task Viewer...") | 882 logging.debug("Creating Task Viewer...") |
819 from Tasks.TaskViewer import TaskViewer | 883 from Tasks.TaskViewer import TaskViewer |
884 | |
820 self.taskViewer = TaskViewer(None, self.project) | 885 self.taskViewer = TaskViewer(None, self.project) |
821 | 886 |
822 # Create the log viewer part of the user interface | 887 # Create the log viewer part of the user interface |
823 logging.debug("Creating Log Viewer...") | 888 logging.debug("Creating Log Viewer...") |
824 from .LogView import LogViewer | 889 from .LogView import LogViewer |
890 | |
825 self.logViewer = LogViewer(self) | 891 self.logViewer = LogViewer(self) |
826 | 892 |
827 # Create the debug viewer | 893 # Create the debug viewer |
828 logging.debug("Creating Debug Viewer...") | 894 logging.debug("Creating Debug Viewer...") |
829 from Debugger.DebugViewer import DebugViewer | 895 from Debugger.DebugViewer import DebugViewer |
896 | |
830 self.debugViewer = DebugViewer(self.__debugServer) | 897 self.debugViewer = DebugViewer(self.__debugServer) |
831 | 898 |
832 # Create the shell | 899 # Create the shell |
833 logging.debug("Creating Shell...") | 900 logging.debug("Creating Shell...") |
834 from QScintilla.Shell import ShellAssembly | 901 from QScintilla.Shell import ShellAssembly |
902 | |
835 self.shellAssembly = ShellAssembly( | 903 self.shellAssembly = ShellAssembly( |
836 self.__debugServer, self.viewmanager, self.project, True) | 904 self.__debugServer, self.viewmanager, self.project, True |
905 ) | |
837 self.shell = self.shellAssembly.shell() | 906 self.shell = self.shellAssembly.shell() |
838 | 907 |
839 if Preferences.getUI("ShowTemplateViewer"): | 908 if Preferences.getUI("ShowTemplateViewer"): |
840 # Create the template viewer part of the user interface | 909 # Create the template viewer part of the user interface |
841 logging.debug("Creating Template Viewer...") | 910 logging.debug("Creating Template Viewer...") |
842 from Templates.TemplateViewer import TemplateViewer | 911 from Templates.TemplateViewer import TemplateViewer |
843 self.templateViewer = TemplateViewer( | 912 |
844 None, self.viewmanager) | 913 self.templateViewer = TemplateViewer(None, self.viewmanager) |
845 else: | 914 else: |
846 logging.debug("Template Viewer disabled") | 915 logging.debug("Template Viewer disabled") |
847 self.templateViewer = None | 916 self.templateViewer = None |
848 | 917 |
849 if Preferences.getUI("ShowFileBrowser"): | 918 if Preferences.getUI("ShowFileBrowser"): |
850 # Create the file browser | 919 # Create the file browser |
851 logging.debug("Creating File Browser...") | 920 logging.debug("Creating File Browser...") |
852 from .Browser import Browser | 921 from .Browser import Browser |
922 | |
853 self.browser = Browser() | 923 self.browser = Browser() |
854 else: | 924 else: |
855 logging.debug("File Browser disabled") | 925 logging.debug("File Browser disabled") |
856 self.browser = None | 926 self.browser = None |
857 | 927 |
858 if Preferences.getUI("ShowSymbolsViewer"): | 928 if Preferences.getUI("ShowSymbolsViewer"): |
859 # Create the symbols viewer | 929 # Create the symbols viewer |
860 logging.debug("Creating Symbols Viewer...") | 930 logging.debug("Creating Symbols Viewer...") |
861 from .SymbolsWidget import SymbolsWidget | 931 from .SymbolsWidget import SymbolsWidget |
932 | |
862 self.symbolsViewer = SymbolsWidget() | 933 self.symbolsViewer = SymbolsWidget() |
863 else: | 934 else: |
864 logging.debug("Symbols Viewer disabled") | 935 logging.debug("Symbols Viewer disabled") |
865 self.symbolsViewer = None | 936 self.symbolsViewer = None |
866 | 937 |
867 if Preferences.getUI("ShowCodeDocumentationViewer"): | 938 if Preferences.getUI("ShowCodeDocumentationViewer"): |
868 # Create the code documentation viewer | 939 # Create the code documentation viewer |
869 logging.debug("Creating Code Documentation Viewer...") | 940 logging.debug("Creating Code Documentation Viewer...") |
870 from .CodeDocumentationViewer import CodeDocumentationViewer | 941 from .CodeDocumentationViewer import CodeDocumentationViewer |
942 | |
871 self.codeDocumentationViewer = CodeDocumentationViewer(self) | 943 self.codeDocumentationViewer = CodeDocumentationViewer(self) |
872 else: | 944 else: |
873 logging.debug("Code Documentation Viewer disabled") | 945 logging.debug("Code Documentation Viewer disabled") |
874 self.codeDocumentationViewer = None | 946 self.codeDocumentationViewer = None |
875 | 947 |
876 if Preferences.getUI("ShowPyPIPackageManager"): | 948 if Preferences.getUI("ShowPyPIPackageManager"): |
877 # Create the PyPI package manager | 949 # Create the PyPI package manager |
878 logging.debug("Creating PyPI Package Manager...") | 950 logging.debug("Creating PyPI Package Manager...") |
879 from PipInterface.PipPackagesWidget import PipPackagesWidget | 951 from PipInterface.PipPackagesWidget import PipPackagesWidget |
952 | |
880 self.pipWidget = PipPackagesWidget(self.pipInterface) | 953 self.pipWidget = PipPackagesWidget(self.pipInterface) |
881 else: | 954 else: |
882 logging.debug("PyPI Package Manager disabled") | 955 logging.debug("PyPI Package Manager disabled") |
883 self.pipWidget = None | 956 self.pipWidget = None |
884 | 957 |
885 if Preferences.getUI("ShowCondaPackageManager"): | 958 if Preferences.getUI("ShowCondaPackageManager"): |
886 # Create the conda package manager | 959 # Create the conda package manager |
887 logging.debug("Creating Conda Package Manager...") | 960 logging.debug("Creating Conda Package Manager...") |
888 from CondaInterface.CondaPackagesWidget import CondaPackagesWidget | 961 from CondaInterface.CondaPackagesWidget import CondaPackagesWidget |
962 | |
889 self.condaWidget = CondaPackagesWidget(self.condaInterface) | 963 self.condaWidget = CondaPackagesWidget(self.condaInterface) |
890 else: | 964 else: |
891 logging.debug("Conda Package Manager disabled") | 965 logging.debug("Conda Package Manager disabled") |
892 self.condaWidget = None | 966 self.condaWidget = None |
893 | 967 |
894 if Preferences.getUI("ShowCooperation"): | 968 if Preferences.getUI("ShowCooperation"): |
895 # Create the chat part of the user interface | 969 # Create the chat part of the user interface |
896 logging.debug("Creating Chat Widget...") | 970 logging.debug("Creating Chat Widget...") |
897 from Cooperation.ChatWidget import ChatWidget | 971 from Cooperation.ChatWidget import ChatWidget |
972 | |
898 self.cooperation = ChatWidget(self) | 973 self.cooperation = ChatWidget(self) |
899 else: | 974 else: |
900 logging.debug("Chat Widget disabled") | 975 logging.debug("Chat Widget disabled") |
901 self.cooperation = None | 976 self.cooperation = None |
902 | 977 |
903 if Preferences.getUI("ShowIrc"): | 978 if Preferences.getUI("ShowIrc"): |
904 # Create the IRC part of the user interface | 979 # Create the IRC part of the user interface |
905 logging.debug("Creating IRC Widget...") | 980 logging.debug("Creating IRC Widget...") |
906 from Network.IRC.IrcWidget import IrcWidget | 981 from Network.IRC.IrcWidget import IrcWidget |
982 | |
907 self.irc = IrcWidget(self) | 983 self.irc = IrcWidget(self) |
908 else: | 984 else: |
909 logging.debug("IRC Widget disabled") | 985 logging.debug("IRC Widget disabled") |
910 self.irc = None | 986 self.irc = None |
911 | 987 |
912 if Preferences.getUI("ShowMicroPython"): | 988 if Preferences.getUI("ShowMicroPython"): |
913 # Create the MicroPython part of the user interface | 989 # Create the MicroPython part of the user interface |
914 logging.debug("Creating MicroPython Widget...") | 990 logging.debug("Creating MicroPython Widget...") |
915 from MicroPython.MicroPythonWidget import MicroPythonWidget | 991 from MicroPython.MicroPythonWidget import MicroPythonWidget |
992 | |
916 self.microPythonWidget = MicroPythonWidget(self) | 993 self.microPythonWidget = MicroPythonWidget(self) |
917 else: | 994 else: |
918 logging.debug("MicroPython Widget disabled") | 995 logging.debug("MicroPython Widget disabled") |
919 self.microPythonWidget = None | 996 self.microPythonWidget = None |
920 | 997 |
921 if Preferences.getUI("ShowNumbersViewer"): | 998 if Preferences.getUI("ShowNumbersViewer"): |
922 # Create the numbers viewer | 999 # Create the numbers viewer |
923 logging.debug("Creating Numbers Viewer...") | 1000 logging.debug("Creating Numbers Viewer...") |
924 from .NumbersWidget import NumbersWidget | 1001 from .NumbersWidget import NumbersWidget |
1002 | |
925 self.numbersViewer = NumbersWidget() | 1003 self.numbersViewer = NumbersWidget() |
926 else: | 1004 else: |
927 logging.debug("Numbers Viewer disabled") | 1005 logging.debug("Numbers Viewer disabled") |
928 self.numbersViewer = None | 1006 self.numbersViewer = None |
929 | 1007 |
930 # Create the Jedi Assistant | 1008 # Create the Jedi Assistant |
931 logging.debug("Creating Jedi Assistant...") | 1009 logging.debug("Creating Jedi Assistant...") |
932 from JediInterface.AssistantJedi import AssistantJedi | 1010 from JediInterface.AssistantJedi import AssistantJedi |
933 self.jediAssistant = AssistantJedi( | 1011 |
934 self, self.viewmanager, self.project) | 1012 self.jediAssistant = AssistantJedi(self, self.viewmanager, self.project) |
935 | 1013 |
936 # Create the plug-ins repository viewer | 1014 # Create the plug-ins repository viewer |
937 from PluginManager.PluginRepositoryDialog import PluginRepositoryWidget | 1015 from PluginManager.PluginRepositoryDialog import PluginRepositoryWidget |
1016 | |
938 self.pluginRepositoryViewer = PluginRepositoryWidget( | 1017 self.pluginRepositoryViewer = PluginRepositoryWidget( |
939 self.pluginManager, integrated=True, parent=self) | 1018 self.pluginManager, integrated=True, parent=self |
1019 ) | |
940 self.pluginRepositoryViewer.closeAndInstall.connect( | 1020 self.pluginRepositoryViewer.closeAndInstall.connect( |
941 self.__installDownloadedPlugins) | 1021 self.__installDownloadedPlugins |
942 | 1022 ) |
1023 | |
943 # Create the virtual environments management widget | 1024 # Create the virtual environments management widget |
944 from VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget | 1025 from VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget |
1026 | |
945 self.__virtualenvManagerWidget = VirtualenvManagerWidget( | 1027 self.__virtualenvManagerWidget = VirtualenvManagerWidget( |
946 self.virtualenvManager, self) | 1028 self.virtualenvManager, self |
947 | 1029 ) |
1030 | |
948 self.__findFileDialog = None | 1031 self.__findFileDialog = None |
949 self.__replaceFileDialog = None | 1032 self.__replaceFileDialog = None |
950 if Preferences.getUI("ShowFindFileWidget"): | 1033 if Preferences.getUI("ShowFindFileWidget"): |
951 # Create the find in files widget | 1034 # Create the find in files widget |
952 from .FindFileWidget import FindFileWidget | 1035 from .FindFileWidget import FindFileWidget |
1036 | |
953 self.__findFileWidget = FindFileWidget(self.project, self) | 1037 self.__findFileWidget = FindFileWidget(self.project, self) |
954 self.__findFileWidget.sourceFile.connect( | 1038 self.__findFileWidget.sourceFile.connect(self.viewmanager.openSourceFile) |
955 self.viewmanager.openSourceFile) | |
956 self.__findFileWidget.designerFile.connect(self.__designer) | 1039 self.__findFileWidget.designerFile.connect(self.__designer) |
957 self.__findFileWidget.linguistFile.connect(self.__linguist) | 1040 self.__findFileWidget.linguistFile.connect(self.__linguist) |
958 self.__findFileWidget.trpreview.connect(self.__TRPreviewer) | 1041 self.__findFileWidget.trpreview.connect(self.__TRPreviewer) |
959 self.__findFileWidget.pixmapFile.connect(self.__showPixmap) | 1042 self.__findFileWidget.pixmapFile.connect(self.__showPixmap) |
960 self.__findFileWidget.svgFile.connect(self.__showSvg) | 1043 self.__findFileWidget.svgFile.connect(self.__showSvg) |
961 self.__findFileWidget.umlFile.connect(self.__showUml) | 1044 self.__findFileWidget.umlFile.connect(self.__showUml) |
962 else: | 1045 else: |
963 self.__findFileWidget = None | 1046 self.__findFileWidget = None |
964 | 1047 |
965 self.__findLocationDialog = None | 1048 self.__findLocationDialog = None |
966 if Preferences.getUI("ShowFindLocationWidget"): | 1049 if Preferences.getUI("ShowFindLocationWidget"): |
967 # Create the find location (file) widget | 1050 # Create the find location (file) widget |
968 from .FindLocationWidget import FindLocationWidget | 1051 from .FindLocationWidget import FindLocationWidget |
1052 | |
969 self.__findLocationWidget = FindLocationWidget(self.project, self) | 1053 self.__findLocationWidget = FindLocationWidget(self.project, self) |
970 self.__findLocationWidget.sourceFile.connect( | 1054 self.__findLocationWidget.sourceFile.connect( |
971 self.viewmanager.openSourceFile) | 1055 self.viewmanager.openSourceFile |
1056 ) | |
972 self.__findLocationWidget.designerFile.connect(self.__designer) | 1057 self.__findLocationWidget.designerFile.connect(self.__designer) |
973 self.__findLocationWidget.linguistFile.connect(self.__linguist) | 1058 self.__findLocationWidget.linguistFile.connect(self.__linguist) |
974 self.__findLocationWidget.trpreview.connect(self.__TRPreviewer) | 1059 self.__findLocationWidget.trpreview.connect(self.__TRPreviewer) |
975 self.__findLocationWidget.pixmapFile.connect(self.__showPixmap) | 1060 self.__findLocationWidget.pixmapFile.connect(self.__showPixmap) |
976 self.__findLocationWidget.svgFile.connect(self.__showSvg) | 1061 self.__findLocationWidget.svgFile.connect(self.__showSvg) |
977 self.__findLocationWidget.umlFile.connect(self.__showUml) | 1062 self.__findLocationWidget.umlFile.connect(self.__showUml) |
978 else: | 1063 else: |
979 self.__findLocationWidget = None | 1064 self.__findLocationWidget = None |
980 | 1065 |
981 # Create the VCS Status widget | 1066 # Create the VCS Status widget |
982 from VCS.StatusWidget import StatusWidget | 1067 from VCS.StatusWidget import StatusWidget |
983 self.__vcsStatusWidget = StatusWidget( | 1068 |
984 self.project, self.viewmanager, self) | 1069 self.__vcsStatusWidget = StatusWidget(self.project, self.viewmanager, self) |
985 | 1070 |
986 if ( | 1071 if ( |
987 Preferences.getUI("ShowInternalHelpViewer") or | 1072 Preferences.getUI("ShowInternalHelpViewer") |
988 Preferences.getHelp("HelpViewerType") == 0 | 1073 or Preferences.getHelp("HelpViewerType") == 0 |
989 ): | 1074 ): |
990 # Create the embedded help viewer | 1075 # Create the embedded help viewer |
991 logging.debug("Creating Internal Help Viewer...") | 1076 logging.debug("Creating Internal Help Viewer...") |
992 from HelpViewer.HelpViewerWidget import HelpViewerWidget | 1077 from HelpViewer.HelpViewerWidget import HelpViewerWidget |
1078 | |
993 self.__helpViewerWidget = HelpViewerWidget(self) | 1079 self.__helpViewerWidget = HelpViewerWidget(self) |
994 else: | 1080 else: |
995 logging.debug("Internal Help Viewer disabled...") | 1081 logging.debug("Internal Help Viewer disabled...") |
996 self.__helpViewerWidget = None | 1082 self.__helpViewerWidget = None |
997 | 1083 |
998 def __createLayout(self): | 1084 def __createLayout(self): |
999 """ | 1085 """ |
1000 Private method to create the layout of the various windows. | 1086 Private method to create the layout of the various windows. |
1001 | 1087 |
1002 @exception ValueError raised to indicate an invalid layout type | 1088 @exception ValueError raised to indicate an invalid layout type |
1003 """ | 1089 """ |
1004 leftWidget = QWidget() | 1090 leftWidget = QWidget() |
1005 layout = QVBoxLayout() | 1091 layout = QVBoxLayout() |
1006 layout.setContentsMargins(1, 1, 1, 1) | 1092 layout.setContentsMargins(1, 1, 1, 1) |
1007 layout.setSpacing(1) | 1093 layout.setSpacing(1) |
1008 layout.addWidget(self.viewmanager.mainWidget()) | 1094 layout.addWidget(self.viewmanager.mainWidget()) |
1009 layout.addWidget(self.viewmanager.searchWidget()) | 1095 layout.addWidget(self.viewmanager.searchWidget()) |
1010 layout.addWidget(self.viewmanager.replaceWidget()) | 1096 layout.addWidget(self.viewmanager.replaceWidget()) |
1011 self.viewmanager.mainWidget().setSizePolicy( | 1097 self.viewmanager.mainWidget().setSizePolicy( |
1012 QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) | 1098 QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding |
1099 ) | |
1013 leftWidget.setLayout(layout) | 1100 leftWidget.setLayout(layout) |
1014 self.viewmanager.searchWidget().hide() | 1101 self.viewmanager.searchWidget().hide() |
1015 self.viewmanager.replaceWidget().hide() | 1102 self.viewmanager.replaceWidget().hide() |
1016 | 1103 |
1017 splitter = QSplitter(Qt.Orientation.Horizontal) | 1104 splitter = QSplitter(Qt.Orientation.Horizontal) |
1018 splitter.addWidget(leftWidget) | 1105 splitter.addWidget(leftWidget) |
1019 self.setCentralWidget(splitter) | 1106 self.setCentralWidget(splitter) |
1020 | 1107 |
1021 self.__previewer.setSplitter(splitter) | 1108 self.__previewer.setSplitter(splitter) |
1022 splitter.addWidget(self.__previewer) | 1109 splitter.addWidget(self.__previewer) |
1023 | 1110 |
1024 splitter.addWidget(self.__astViewer) | 1111 splitter.addWidget(self.__astViewer) |
1025 | 1112 |
1026 splitter.addWidget(self.__disViewer) | 1113 splitter.addWidget(self.__disViewer) |
1027 | 1114 |
1028 # Initialize the widgets of the layouts to None | 1115 # Initialize the widgets of the layouts to None |
1029 self.lToolbox = None | 1116 self.lToolbox = None |
1030 self.rToolbox = None | 1117 self.rToolbox = None |
1031 self.hToolbox = None | 1118 self.hToolbox = None |
1032 self.leftSidebar = None | 1119 self.leftSidebar = None |
1033 self.rightSidebar = None | 1120 self.rightSidebar = None |
1034 self.bottomSidebar = None | 1121 self.bottomSidebar = None |
1035 | 1122 |
1036 # Create layout with toolbox windows embedded in dock windows | 1123 # Create layout with toolbox windows embedded in dock windows |
1037 if self.__layoutType == "Toolboxes": | 1124 if self.__layoutType == "Toolboxes": |
1038 logging.debug("Creating toolboxes...") | 1125 logging.debug("Creating toolboxes...") |
1039 self.__createToolboxesLayout() | 1126 self.__createToolboxesLayout() |
1040 | 1127 |
1041 # Create layout with sidebar windows embedded in dock windows | 1128 # Create layout with sidebar windows embedded in dock windows |
1042 elif self.__layoutType == "Sidebars": | 1129 elif self.__layoutType == "Sidebars": |
1043 logging.debug("Creating sidebars...") | 1130 logging.debug("Creating sidebars...") |
1044 self.__createSidebarsLayout() | 1131 self.__createSidebarsLayout() |
1045 | 1132 |
1046 else: | 1133 else: |
1047 raise ValueError("Wrong layout type given ({0})".format( | 1134 raise ValueError("Wrong layout type given ({0})".format(self.__layoutType)) |
1048 self.__layoutType)) | |
1049 logging.debug("Created Layout") | 1135 logging.debug("Created Layout") |
1050 | 1136 |
1051 def __createToolboxesLayout(self): | 1137 def __createToolboxesLayout(self): |
1052 """ | 1138 """ |
1053 Private method to create the Toolboxes layout. | 1139 Private method to create the Toolboxes layout. |
1054 """ | 1140 """ |
1055 from EricWidgets.EricToolBox import ( | 1141 from EricWidgets.EricToolBox import EricVerticalToolBox, EricHorizontalToolBox |
1056 EricVerticalToolBox, EricHorizontalToolBox | 1142 |
1057 ) | |
1058 | |
1059 logging.debug("Creating Toolboxes Layout...") | 1143 logging.debug("Creating Toolboxes Layout...") |
1060 | 1144 |
1061 # Create the left toolbox | 1145 # Create the left toolbox |
1062 self.lToolboxDock = self.__createDockWindow("lToolboxDock") | 1146 self.lToolboxDock = self.__createDockWindow("lToolboxDock") |
1063 self.lToolbox = EricVerticalToolBox(self.lToolboxDock) | 1147 self.lToolbox = EricVerticalToolBox(self.lToolboxDock) |
1064 self.__setupDockWindow(self.lToolboxDock, | 1148 self.__setupDockWindow( |
1065 Qt.DockWidgetArea.LeftDockWidgetArea, | 1149 self.lToolboxDock, |
1066 self.lToolbox, | 1150 Qt.DockWidgetArea.LeftDockWidgetArea, |
1067 self.tr("Left Toolbox")) | 1151 self.lToolbox, |
1068 | 1152 self.tr("Left Toolbox"), |
1153 ) | |
1154 | |
1069 # Create the horizontal toolbox | 1155 # Create the horizontal toolbox |
1070 self.hToolboxDock = self.__createDockWindow("hToolboxDock") | 1156 self.hToolboxDock = self.__createDockWindow("hToolboxDock") |
1071 self.hToolbox = EricHorizontalToolBox(self.hToolboxDock) | 1157 self.hToolbox = EricHorizontalToolBox(self.hToolboxDock) |
1072 self.__setupDockWindow(self.hToolboxDock, | 1158 self.__setupDockWindow( |
1073 Qt.DockWidgetArea.BottomDockWidgetArea, | 1159 self.hToolboxDock, |
1074 self.hToolbox, | 1160 Qt.DockWidgetArea.BottomDockWidgetArea, |
1075 self.tr("Horizontal Toolbox")) | 1161 self.hToolbox, |
1076 | 1162 self.tr("Horizontal Toolbox"), |
1163 ) | |
1164 | |
1077 # Create the right toolbox | 1165 # Create the right toolbox |
1078 self.rToolboxDock = self.__createDockWindow("rToolboxDock") | 1166 self.rToolboxDock = self.__createDockWindow("rToolboxDock") |
1079 self.rToolbox = EricVerticalToolBox(self.rToolboxDock) | 1167 self.rToolbox = EricVerticalToolBox(self.rToolboxDock) |
1080 self.__setupDockWindow(self.rToolboxDock, | 1168 self.__setupDockWindow( |
1081 Qt.DockWidgetArea.RightDockWidgetArea, | 1169 self.rToolboxDock, |
1082 self.rToolbox, | 1170 Qt.DockWidgetArea.RightDockWidgetArea, |
1083 self.tr("Right Toolbox")) | 1171 self.rToolbox, |
1084 | 1172 self.tr("Right Toolbox"), |
1173 ) | |
1174 | |
1085 #################################################### | 1175 #################################################### |
1086 ## Populate the left toolbox | 1176 ## Populate the left toolbox |
1087 #################################################### | 1177 #################################################### |
1088 | 1178 |
1089 self.lToolbox.addItem(self.multiProjectBrowser, | 1179 self.lToolbox.addItem( |
1090 UI.PixmapCache.getIcon("multiProjectViewer"), | 1180 self.multiProjectBrowser, |
1091 self.tr("Multiproject-Viewer")) | 1181 UI.PixmapCache.getIcon("multiProjectViewer"), |
1092 | 1182 self.tr("Multiproject-Viewer"), |
1093 self.lToolbox.addItem(self.projectBrowser, | 1183 ) |
1094 UI.PixmapCache.getIcon("projectViewer"), | 1184 |
1095 self.tr("Project-Viewer")) | 1185 self.lToolbox.addItem( |
1096 | 1186 self.projectBrowser, |
1187 UI.PixmapCache.getIcon("projectViewer"), | |
1188 self.tr("Project-Viewer"), | |
1189 ) | |
1190 | |
1097 if self.__findFileWidget: | 1191 if self.__findFileWidget: |
1098 self.lToolbox.addItem(self.__findFileWidget, | 1192 self.lToolbox.addItem( |
1099 UI.PixmapCache.getIcon("find"), | 1193 self.__findFileWidget, |
1100 self.tr("Find/Replace In Files")) | 1194 UI.PixmapCache.getIcon("find"), |
1101 | 1195 self.tr("Find/Replace In Files"), |
1196 ) | |
1197 | |
1102 if self.__findLocationWidget: | 1198 if self.__findLocationWidget: |
1103 self.lToolbox.addItem(self.__findLocationWidget, | 1199 self.lToolbox.addItem( |
1104 UI.PixmapCache.getIcon("findLocation"), | 1200 self.__findLocationWidget, |
1105 self.tr("Find File")) | 1201 UI.PixmapCache.getIcon("findLocation"), |
1106 | 1202 self.tr("Find File"), |
1107 self.lToolbox.addItem(self.__vcsStatusWidget, | 1203 ) |
1108 UI.PixmapCache.getIcon("tbVcsStatus"), | 1204 |
1109 self.tr("VCS Status")) | 1205 self.lToolbox.addItem( |
1110 | 1206 self.__vcsStatusWidget, |
1207 UI.PixmapCache.getIcon("tbVcsStatus"), | |
1208 self.tr("VCS Status"), | |
1209 ) | |
1210 | |
1111 if self.templateViewer: | 1211 if self.templateViewer: |
1112 self.lToolbox.addItem(self.templateViewer, | 1212 self.lToolbox.addItem( |
1113 UI.PixmapCache.getIcon("templateViewer"), | 1213 self.templateViewer, |
1114 self.tr("Template-Viewer")) | 1214 UI.PixmapCache.getIcon("templateViewer"), |
1115 | 1215 self.tr("Template-Viewer"), |
1216 ) | |
1217 | |
1116 if self.browser: | 1218 if self.browser: |
1117 self.lToolbox.addItem(self.browser, | 1219 self.lToolbox.addItem( |
1118 UI.PixmapCache.getIcon("browser"), | 1220 self.browser, UI.PixmapCache.getIcon("browser"), self.tr("File-Browser") |
1119 self.tr("File-Browser")) | 1221 ) |
1120 | 1222 |
1121 if self.symbolsViewer: | 1223 if self.symbolsViewer: |
1122 self.lToolbox.addItem(self.symbolsViewer, | 1224 self.lToolbox.addItem( |
1123 UI.PixmapCache.getIcon("symbols"), | 1225 self.symbolsViewer, |
1124 self.tr("Symbols")) | 1226 UI.PixmapCache.getIcon("symbols"), |
1125 | 1227 self.tr("Symbols"), |
1228 ) | |
1229 | |
1126 #################################################### | 1230 #################################################### |
1127 ## Populate the right toolbox | 1231 ## Populate the right toolbox |
1128 #################################################### | 1232 #################################################### |
1129 | 1233 |
1130 self.rToolbox.addItem(self.debugViewer, | 1234 self.rToolbox.addItem( |
1131 UI.PixmapCache.getIcon("debugViewer"), | 1235 self.debugViewer, |
1132 self.tr("Debug-Viewer")) | 1236 UI.PixmapCache.getIcon("debugViewer"), |
1133 | 1237 self.tr("Debug-Viewer"), |
1238 ) | |
1239 | |
1134 if self.codeDocumentationViewer: | 1240 if self.codeDocumentationViewer: |
1135 self.rToolbox.addItem(self.codeDocumentationViewer, | 1241 self.rToolbox.addItem( |
1136 UI.PixmapCache.getIcon("codeDocuViewer"), | 1242 self.codeDocumentationViewer, |
1137 self.tr("Code Documentation Viewer")) | 1243 UI.PixmapCache.getIcon("codeDocuViewer"), |
1138 | 1244 self.tr("Code Documentation Viewer"), |
1245 ) | |
1246 | |
1139 if self.__helpViewerWidget: | 1247 if self.__helpViewerWidget: |
1140 self.rToolbox.addItem(self.__helpViewerWidget, | 1248 self.rToolbox.addItem( |
1141 UI.PixmapCache.getIcon("help"), | 1249 self.__helpViewerWidget, |
1142 self.tr("Help Viewer")) | 1250 UI.PixmapCache.getIcon("help"), |
1143 | 1251 self.tr("Help Viewer"), |
1144 self.rToolbox.addItem(self.pluginRepositoryViewer, | 1252 ) |
1145 UI.PixmapCache.getIcon("pluginRepository"), | 1253 |
1146 self.tr("Plugin Repository")) | 1254 self.rToolbox.addItem( |
1147 | 1255 self.pluginRepositoryViewer, |
1148 self.rToolbox.addItem(self.__virtualenvManagerWidget, | 1256 UI.PixmapCache.getIcon("pluginRepository"), |
1149 UI.PixmapCache.getIcon("virtualenv"), | 1257 self.tr("Plugin Repository"), |
1150 self.tr("Virtual Environments")) | 1258 ) |
1151 | 1259 |
1260 self.rToolbox.addItem( | |
1261 self.__virtualenvManagerWidget, | |
1262 UI.PixmapCache.getIcon("virtualenv"), | |
1263 self.tr("Virtual Environments"), | |
1264 ) | |
1265 | |
1152 if self.pipWidget: | 1266 if self.pipWidget: |
1153 self.rToolbox.addItem(self.pipWidget, | 1267 self.rToolbox.addItem( |
1154 UI.PixmapCache.getIcon("pypi"), | 1268 self.pipWidget, UI.PixmapCache.getIcon("pypi"), self.tr("PyPI") |
1155 self.tr("PyPI")) | 1269 ) |
1156 | 1270 |
1157 if self.condaWidget: | 1271 if self.condaWidget: |
1158 self.rToolbox.addItem(self.condaWidget, | 1272 self.rToolbox.addItem( |
1159 UI.PixmapCache.getIcon("miniconda"), | 1273 self.condaWidget, UI.PixmapCache.getIcon("miniconda"), self.tr("Conda") |
1160 self.tr("Conda")) | 1274 ) |
1161 | 1275 |
1162 if self.cooperation: | 1276 if self.cooperation: |
1163 self.rToolbox.addItem(self.cooperation, | 1277 self.rToolbox.addItem( |
1164 UI.PixmapCache.getIcon("cooperation"), | 1278 self.cooperation, |
1165 self.tr("Cooperation")) | 1279 UI.PixmapCache.getIcon("cooperation"), |
1166 | 1280 self.tr("Cooperation"), |
1281 ) | |
1282 | |
1167 if self.irc: | 1283 if self.irc: |
1168 self.rToolbox.addItem(self.irc, | 1284 self.rToolbox.addItem( |
1169 UI.PixmapCache.getIcon("irc"), | 1285 self.irc, UI.PixmapCache.getIcon("irc"), self.tr("IRC") |
1170 self.tr("IRC")) | 1286 ) |
1171 | 1287 |
1172 if self.microPythonWidget: | 1288 if self.microPythonWidget: |
1173 self.rToolbox.addItem(self.microPythonWidget, | 1289 self.rToolbox.addItem( |
1174 UI.PixmapCache.getIcon("micropython"), | 1290 self.microPythonWidget, |
1175 self.tr("MicroPython")) | 1291 UI.PixmapCache.getIcon("micropython"), |
1176 | 1292 self.tr("MicroPython"), |
1293 ) | |
1294 | |
1177 #################################################### | 1295 #################################################### |
1178 ## Populate the bottom toolbox | 1296 ## Populate the bottom toolbox |
1179 #################################################### | 1297 #################################################### |
1180 | 1298 |
1181 self.hToolbox.addItem(self.shellAssembly, | 1299 self.hToolbox.addItem( |
1182 UI.PixmapCache.getIcon("shell"), | 1300 self.shellAssembly, UI.PixmapCache.getIcon("shell"), self.tr("Shell") |
1183 self.tr("Shell")) | 1301 ) |
1184 | 1302 |
1185 self.hToolbox.addItem(self.taskViewer, | 1303 self.hToolbox.addItem( |
1186 UI.PixmapCache.getIcon("task"), | 1304 self.taskViewer, UI.PixmapCache.getIcon("task"), self.tr("Task-Viewer") |
1187 self.tr("Task-Viewer")) | 1305 ) |
1188 | 1306 |
1189 self.hToolbox.addItem(self.logViewer, | 1307 self.hToolbox.addItem( |
1190 UI.PixmapCache.getIcon("logViewer"), | 1308 self.logViewer, UI.PixmapCache.getIcon("logViewer"), self.tr("Log-Viewer") |
1191 self.tr("Log-Viewer")) | 1309 ) |
1192 | 1310 |
1193 if self.numbersViewer: | 1311 if self.numbersViewer: |
1194 self.hToolbox.addItem(self.numbersViewer, | 1312 self.hToolbox.addItem( |
1195 UI.PixmapCache.getIcon("numbers"), | 1313 self.numbersViewer, |
1196 self.tr("Numbers")) | 1314 UI.PixmapCache.getIcon("numbers"), |
1197 | 1315 self.tr("Numbers"), |
1316 ) | |
1317 | |
1198 #################################################### | 1318 #################################################### |
1199 ## Set the start index of each toolbox | 1319 ## Set the start index of each toolbox |
1200 #################################################### | 1320 #################################################### |
1201 | 1321 |
1202 self.lToolbox.setCurrentIndex(0) | 1322 self.lToolbox.setCurrentIndex(0) |
1203 self.rToolbox.setCurrentIndex(0) | 1323 self.rToolbox.setCurrentIndex(0) |
1204 self.hToolbox.setCurrentIndex(0) | 1324 self.hToolbox.setCurrentIndex(0) |
1205 | 1325 |
1206 def __createSidebarsLayout(self): | 1326 def __createSidebarsLayout(self): |
1207 """ | 1327 """ |
1208 Private method to create the Sidebars layout. | 1328 Private method to create the Sidebars layout. |
1209 """ | 1329 """ |
1210 from EricWidgets.EricSideBar import EricSideBar, EricSideBarSide | 1330 from EricWidgets.EricSideBar import EricSideBar, EricSideBarSide |
1211 | 1331 |
1212 logging.debug("Creating Sidebars Layout...") | 1332 logging.debug("Creating Sidebars Layout...") |
1213 | 1333 |
1214 # Create the left sidebar | 1334 # Create the left sidebar |
1215 self.leftSidebar = EricSideBar(EricSideBarSide.WEST, | 1335 self.leftSidebar = EricSideBar( |
1216 Preferences.getUI("IconBarSize")) | 1336 EricSideBarSide.WEST, Preferences.getUI("IconBarSize") |
1337 ) | |
1217 self.leftSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) | 1338 self.leftSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
1218 | 1339 |
1219 # Create the bottom sidebar | 1340 # Create the bottom sidebar |
1220 self.bottomSidebar = EricSideBar(EricSideBarSide.SOUTH, | 1341 self.bottomSidebar = EricSideBar( |
1221 Preferences.getUI("IconBarSize")) | 1342 EricSideBarSide.SOUTH, Preferences.getUI("IconBarSize") |
1343 ) | |
1222 self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) | 1344 self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
1223 | 1345 |
1224 # Create the right sidebar | 1346 # Create the right sidebar |
1225 if Preferences.getUI("CombinedLeftRightSidebar"): | 1347 if Preferences.getUI("CombinedLeftRightSidebar"): |
1226 # combine left and right sidebar on the left side | 1348 # combine left and right sidebar on the left side |
1227 self.rightSidebar = None | 1349 self.rightSidebar = None |
1228 else: | 1350 else: |
1229 self.rightSidebar = EricSideBar( | 1351 self.rightSidebar = EricSideBar( |
1230 EricSideBarSide.EAST, Preferences.getUI("IconBarSize")) | 1352 EricSideBarSide.EAST, Preferences.getUI("IconBarSize") |
1231 self.rightSidebar.setIconBarColor( | 1353 ) |
1232 Preferences.getUI("IconBarColor")) | 1354 self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
1233 | 1355 |
1234 #################################################### | 1356 #################################################### |
1235 ## Populate the left side bar | 1357 ## Populate the left side bar |
1236 #################################################### | 1358 #################################################### |
1237 | 1359 |
1238 self.leftSidebar.addTab( | 1360 self.leftSidebar.addTab( |
1239 self.multiProjectBrowser, | 1361 self.multiProjectBrowser, |
1240 UI.PixmapCache.getIcon("sbMultiProjectViewer96"), | 1362 UI.PixmapCache.getIcon("sbMultiProjectViewer96"), |
1241 self.tr("Multiproject-Viewer")) | 1363 self.tr("Multiproject-Viewer"), |
1242 | 1364 ) |
1365 | |
1243 self.leftSidebar.addTab( | 1366 self.leftSidebar.addTab( |
1244 self.projectBrowser, | 1367 self.projectBrowser, |
1245 UI.PixmapCache.getIcon("sbProjectViewer96"), | 1368 UI.PixmapCache.getIcon("sbProjectViewer96"), |
1246 self.tr("Project-Viewer")) | 1369 self.tr("Project-Viewer"), |
1247 | 1370 ) |
1371 | |
1248 if self.__findFileWidget: | 1372 if self.__findFileWidget: |
1249 self.leftSidebar.addTab( | 1373 self.leftSidebar.addTab( |
1250 self.__findFileWidget, | 1374 self.__findFileWidget, |
1251 UI.PixmapCache.getIcon("sbFind96"), | 1375 UI.PixmapCache.getIcon("sbFind96"), |
1252 self.tr("Find/Replace In Files")) | 1376 self.tr("Find/Replace In Files"), |
1253 | 1377 ) |
1378 | |
1254 if self.__findLocationWidget: | 1379 if self.__findLocationWidget: |
1255 self.leftSidebar.addTab( | 1380 self.leftSidebar.addTab( |
1256 self.__findLocationWidget, | 1381 self.__findLocationWidget, |
1257 UI.PixmapCache.getIcon("sbFindLocation96"), | 1382 UI.PixmapCache.getIcon("sbFindLocation96"), |
1258 self.tr("Find File")) | 1383 self.tr("Find File"), |
1259 | 1384 ) |
1385 | |
1260 self.leftSidebar.addTab( | 1386 self.leftSidebar.addTab( |
1261 self.__vcsStatusWidget, | 1387 self.__vcsStatusWidget, |
1262 UI.PixmapCache.getIcon("sbVcsStatus96"), | 1388 UI.PixmapCache.getIcon("sbVcsStatus96"), |
1263 self.tr("VCS Status")) | 1389 self.tr("VCS Status"), |
1264 | 1390 ) |
1391 | |
1265 if self.templateViewer: | 1392 if self.templateViewer: |
1266 self.leftSidebar.addTab( | 1393 self.leftSidebar.addTab( |
1267 self.templateViewer, | 1394 self.templateViewer, |
1268 UI.PixmapCache.getIcon("sbTemplateViewer96"), | 1395 UI.PixmapCache.getIcon("sbTemplateViewer96"), |
1269 self.tr("Template-Viewer")) | 1396 self.tr("Template-Viewer"), |
1270 | 1397 ) |
1398 | |
1271 if self.browser: | 1399 if self.browser: |
1272 self.leftSidebar.addTab( | 1400 self.leftSidebar.addTab( |
1273 self.browser, | 1401 self.browser, |
1274 UI.PixmapCache.getIcon("sbFileBrowser96"), | 1402 UI.PixmapCache.getIcon("sbFileBrowser96"), |
1275 self.tr("File-Browser")) | 1403 self.tr("File-Browser"), |
1276 | 1404 ) |
1405 | |
1277 if self.symbolsViewer: | 1406 if self.symbolsViewer: |
1278 self.leftSidebar.addTab( | 1407 self.leftSidebar.addTab( |
1279 self.symbolsViewer, | 1408 self.symbolsViewer, |
1280 UI.PixmapCache.getIcon("sbSymbolsViewer96"), | 1409 UI.PixmapCache.getIcon("sbSymbolsViewer96"), |
1281 self.tr("Symbols")) | 1410 self.tr("Symbols"), |
1411 ) | |
1282 | 1412 |
1283 ############################################################## | 1413 ############################################################## |
1284 ## Populate the right side bar or combined left sidebar | 1414 ## Populate the right side bar or combined left sidebar |
1285 ############################################################## | 1415 ############################################################## |
1286 | 1416 |
1287 sidebar = self.rightSidebar or self.leftSidebar | 1417 sidebar = self.rightSidebar or self.leftSidebar |
1288 | 1418 |
1289 if sidebar is self.leftSidebar: | 1419 if sidebar is self.leftSidebar: |
1290 # place debug viewer after 'VCS Status' widget | 1420 # place debug viewer after 'VCS Status' widget |
1291 index = self.leftSidebar.indexOf(self.__vcsStatusWidget) + 1 | 1421 index = self.leftSidebar.indexOf(self.__vcsStatusWidget) + 1 |
1292 sidebar.insertTab( | 1422 sidebar.insertTab( |
1293 index, | 1423 index, |
1294 self.debugViewer, | 1424 self.debugViewer, |
1295 UI.PixmapCache.getIcon("sbDebugViewer96"), | 1425 UI.PixmapCache.getIcon("sbDebugViewer96"), |
1296 self.tr("Debug-Viewer")) | 1426 self.tr("Debug-Viewer"), |
1427 ) | |
1297 else: | 1428 else: |
1298 sidebar.addTab( | 1429 sidebar.addTab( |
1299 self.debugViewer, | 1430 self.debugViewer, |
1300 UI.PixmapCache.getIcon("sbDebugViewer96"), | 1431 UI.PixmapCache.getIcon("sbDebugViewer96"), |
1301 self.tr("Debug-Viewer")) | 1432 self.tr("Debug-Viewer"), |
1302 | 1433 ) |
1434 | |
1303 if self.codeDocumentationViewer: | 1435 if self.codeDocumentationViewer: |
1304 sidebar.addTab( | 1436 sidebar.addTab( |
1305 self.codeDocumentationViewer, | 1437 self.codeDocumentationViewer, |
1306 UI.PixmapCache.getIcon("sbCodeDocuViewer96"), | 1438 UI.PixmapCache.getIcon("sbCodeDocuViewer96"), |
1307 self.tr("Code Documentation Viewer")) | 1439 self.tr("Code Documentation Viewer"), |
1308 | 1440 ) |
1441 | |
1309 if self.__helpViewerWidget: | 1442 if self.__helpViewerWidget: |
1310 sidebar.addTab( | 1443 sidebar.addTab( |
1311 self.__helpViewerWidget, | 1444 self.__helpViewerWidget, |
1312 UI.PixmapCache.getIcon("sbHelpViewer96"), | 1445 UI.PixmapCache.getIcon("sbHelpViewer96"), |
1313 self.tr("Help Viewer")) | 1446 self.tr("Help Viewer"), |
1314 | 1447 ) |
1448 | |
1315 sidebar.addTab( | 1449 sidebar.addTab( |
1316 self.pluginRepositoryViewer, | 1450 self.pluginRepositoryViewer, |
1317 UI.PixmapCache.getIcon("sbPluginRepository96"), | 1451 UI.PixmapCache.getIcon("sbPluginRepository96"), |
1318 self.tr("Plugin Repository")) | 1452 self.tr("Plugin Repository"), |
1319 | 1453 ) |
1454 | |
1320 sidebar.addTab( | 1455 sidebar.addTab( |
1321 self.__virtualenvManagerWidget, | 1456 self.__virtualenvManagerWidget, |
1322 UI.PixmapCache.getIcon("sbVirtenvManager96"), | 1457 UI.PixmapCache.getIcon("sbVirtenvManager96"), |
1323 self.tr("Virtual Environments")) | 1458 self.tr("Virtual Environments"), |
1324 | 1459 ) |
1460 | |
1325 if self.pipWidget: | 1461 if self.pipWidget: |
1326 sidebar.addTab( | 1462 sidebar.addTab( |
1327 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"), | 1463 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"), self.tr("PyPI") |
1328 self.tr("PyPI")) | 1464 ) |
1329 | 1465 |
1330 if self.condaWidget: | 1466 if self.condaWidget: |
1331 sidebar.addTab( | 1467 sidebar.addTab( |
1332 self.condaWidget, UI.PixmapCache.getIcon("sbMiniconda96"), | 1468 self.condaWidget, |
1333 self.tr("Conda")) | 1469 UI.PixmapCache.getIcon("sbMiniconda96"), |
1470 self.tr("Conda"), | |
1471 ) | |
1334 | 1472 |
1335 if self.cooperation: | 1473 if self.cooperation: |
1336 sidebar.addTab( | 1474 sidebar.addTab( |
1337 self.cooperation, UI.PixmapCache.getIcon("sbCooperation96"), | 1475 self.cooperation, |
1338 self.tr("Cooperation")) | 1476 UI.PixmapCache.getIcon("sbCooperation96"), |
1339 | 1477 self.tr("Cooperation"), |
1478 ) | |
1479 | |
1340 if self.irc: | 1480 if self.irc: |
1341 sidebar.addTab( | 1481 sidebar.addTab(self.irc, UI.PixmapCache.getIcon("sbIrc96"), self.tr("IRC")) |
1342 self.irc, UI.PixmapCache.getIcon("sbIrc96"), | 1482 |
1343 self.tr("IRC")) | |
1344 | |
1345 if self.microPythonWidget: | 1483 if self.microPythonWidget: |
1346 sidebar.addTab( | 1484 sidebar.addTab( |
1347 self.microPythonWidget, | 1485 self.microPythonWidget, |
1348 UI.PixmapCache.getIcon("sbMicroPython96"), | 1486 UI.PixmapCache.getIcon("sbMicroPython96"), |
1349 self.tr("MicroPython")) | 1487 self.tr("MicroPython"), |
1350 | 1488 ) |
1489 | |
1351 #################################################### | 1490 #################################################### |
1352 ## Populate the bottom side bar | 1491 ## Populate the bottom side bar |
1353 #################################################### | 1492 #################################################### |
1354 | 1493 |
1355 self.bottomSidebar.addTab(self.shellAssembly, | 1494 self.bottomSidebar.addTab( |
1356 UI.PixmapCache.getIcon("sbShell96"), | 1495 self.shellAssembly, UI.PixmapCache.getIcon("sbShell96"), self.tr("Shell") |
1357 self.tr("Shell")) | 1496 ) |
1358 | 1497 |
1359 self.bottomSidebar.addTab(self.taskViewer, | 1498 self.bottomSidebar.addTab( |
1360 UI.PixmapCache.getIcon("sbTasksViewer96"), | 1499 self.taskViewer, |
1361 self.tr("Task-Viewer")) | 1500 UI.PixmapCache.getIcon("sbTasksViewer96"), |
1362 | 1501 self.tr("Task-Viewer"), |
1363 self.bottomSidebar.addTab(self.logViewer, | 1502 ) |
1364 UI.PixmapCache.getIcon("sbLogViewer96"), | 1503 |
1365 self.tr("Log-Viewer")) | 1504 self.bottomSidebar.addTab( |
1366 | 1505 self.logViewer, |
1506 UI.PixmapCache.getIcon("sbLogViewer96"), | |
1507 self.tr("Log-Viewer"), | |
1508 ) | |
1509 | |
1367 if self.numbersViewer: | 1510 if self.numbersViewer: |
1368 self.bottomSidebar.addTab(self.numbersViewer, | 1511 self.bottomSidebar.addTab( |
1369 UI.PixmapCache.getIcon("sbNumbers96"), | 1512 self.numbersViewer, |
1370 self.tr("Numbers")) | 1513 UI.PixmapCache.getIcon("sbNumbers96"), |
1371 | 1514 self.tr("Numbers"), |
1515 ) | |
1516 | |
1372 #################################################### | 1517 #################################################### |
1373 ## Set the start index of each side bar | 1518 ## Set the start index of each side bar |
1374 #################################################### | 1519 #################################################### |
1375 | 1520 |
1376 self.leftSidebar.setCurrentIndex(0) | 1521 self.leftSidebar.setCurrentIndex(0) |
1377 if self.rightSidebar: | 1522 if self.rightSidebar: |
1378 self.rightSidebar.setCurrentIndex(0) | 1523 self.rightSidebar.setCurrentIndex(0) |
1379 self.bottomSidebar.setCurrentIndex(0) | 1524 self.bottomSidebar.setCurrentIndex(0) |
1380 | 1525 |
1381 # create the central widget | 1526 # create the central widget |
1382 logging.debug("Creating central widget...") | 1527 logging.debug("Creating central widget...") |
1383 cw = self.centralWidget() # save the current central widget | 1528 cw = self.centralWidget() # save the current central widget |
1384 self.horizontalSplitter = QSplitter(Qt.Orientation.Horizontal) | 1529 self.horizontalSplitter = QSplitter(Qt.Orientation.Horizontal) |
1385 self.horizontalSplitter.setChildrenCollapsible(False) | 1530 self.horizontalSplitter.setChildrenCollapsible(False) |
1386 self.verticalSplitter = QSplitter(Qt.Orientation.Vertical) | 1531 self.verticalSplitter = QSplitter(Qt.Orientation.Vertical) |
1387 self.verticalSplitter.setChildrenCollapsible(False) | 1532 self.verticalSplitter.setChildrenCollapsible(False) |
1388 self.verticalSplitter.addWidget(cw) | 1533 self.verticalSplitter.addWidget(cw) |
1390 self.horizontalSplitter.addWidget(self.leftSidebar) | 1535 self.horizontalSplitter.addWidget(self.leftSidebar) |
1391 self.horizontalSplitter.addWidget(self.verticalSplitter) | 1536 self.horizontalSplitter.addWidget(self.verticalSplitter) |
1392 if self.rightSidebar: | 1537 if self.rightSidebar: |
1393 self.horizontalSplitter.addWidget(self.rightSidebar) | 1538 self.horizontalSplitter.addWidget(self.rightSidebar) |
1394 self.setCentralWidget(self.horizontalSplitter) | 1539 self.setCentralWidget(self.horizontalSplitter) |
1395 | 1540 |
1396 def addSideWidget(self, side, widget, icon, label): | 1541 def addSideWidget(self, side, widget, icon, label): |
1397 """ | 1542 """ |
1398 Public method to add a widget to the sides. | 1543 Public method to add a widget to the sides. |
1399 | 1544 |
1400 @param side side to add the widget to | 1545 @param side side to add the widget to |
1401 @type int (one of UserInterface.LeftSide, UserInterface.BottomSide, | 1546 @type int (one of UserInterface.LeftSide, UserInterface.BottomSide, |
1402 UserInterface.RightSide) | 1547 UserInterface.RightSide) |
1403 @param widget reference to the widget to add | 1548 @param widget reference to the widget to add |
1404 @type QWidget | 1549 @type QWidget |
1405 @param icon icon to be used | 1550 @param icon icon to be used |
1406 @type QIcon | 1551 @type QIcon |
1407 @param label label text to be shown | 1552 @param label label text to be shown |
1408 @type str | 1553 @type str |
1409 """ | 1554 """ |
1410 if side in [UserInterface.LeftSide, UserInterface.BottomSide, | 1555 if side in [ |
1411 UserInterface.RightSide]: | 1556 UserInterface.LeftSide, |
1557 UserInterface.BottomSide, | |
1558 UserInterface.RightSide, | |
1559 ]: | |
1412 if self.__layoutType == "Toolboxes": | 1560 if self.__layoutType == "Toolboxes": |
1413 if side == UserInterface.LeftSide: | 1561 if side == UserInterface.LeftSide: |
1414 self.lToolbox.addItem(widget, icon, label) | 1562 self.lToolbox.addItem(widget, icon, label) |
1415 elif side == UserInterface.BottomSide: | 1563 elif side == UserInterface.BottomSide: |
1416 self.hToolbox.addItem(widget, icon, label) | 1564 self.hToolbox.addItem(widget, icon, label) |
1424 elif side == UserInterface.RightSide: | 1572 elif side == UserInterface.RightSide: |
1425 if self.rightSidebar: | 1573 if self.rightSidebar: |
1426 self.rightSidebar.addTab(widget, icon, label) | 1574 self.rightSidebar.addTab(widget, icon, label) |
1427 else: | 1575 else: |
1428 self.leftSidebar.addTab(widget, icon, label) | 1576 self.leftSidebar.addTab(widget, icon, label) |
1429 | 1577 |
1430 def removeSideWidget(self, widget): | 1578 def removeSideWidget(self, widget): |
1431 """ | 1579 """ |
1432 Public method to remove a widget added using addSideWidget(). | 1580 Public method to remove a widget added using addSideWidget(). |
1433 | 1581 |
1434 @param widget reference to the widget to remove | 1582 @param widget reference to the widget to remove |
1435 @type QWidget | 1583 @type QWidget |
1436 """ | 1584 """ |
1437 if self.__layoutType == "Toolboxes": | 1585 if self.__layoutType == "Toolboxes": |
1438 for container in [self.lToolbox, self.hToolbox, self.rToolbox]: | 1586 for container in [self.lToolbox, self.hToolbox, self.rToolbox]: |
1439 index = container.indexOf(widget) | 1587 index = container.indexOf(widget) |
1440 if index != -1: | 1588 if index != -1: |
1441 container.removeItem(index) | 1589 container.removeItem(index) |
1442 elif self.__layoutType == "Sidebars": | 1590 elif self.__layoutType == "Sidebars": |
1443 for container in [self.leftSidebar, self.bottomSidebar, | 1591 for container in [self.leftSidebar, self.bottomSidebar, self.rightSidebar]: |
1444 self.rightSidebar]: | |
1445 if container is not None: | 1592 if container is not None: |
1446 index = container.indexOf(widget) | 1593 index = container.indexOf(widget) |
1447 if index != -1: | 1594 if index != -1: |
1448 container.removeTab(index) | 1595 container.removeTab(index) |
1449 | 1596 |
1450 def showSideWidget(self, widget): | 1597 def showSideWidget(self, widget): |
1451 """ | 1598 """ |
1452 Public method to show a specific widget placed in the side widgets. | 1599 Public method to show a specific widget placed in the side widgets. |
1453 | 1600 |
1454 @param widget reference to the widget to be shown | 1601 @param widget reference to the widget to be shown |
1455 @type QWidget | 1602 @type QWidget |
1456 """ | 1603 """ |
1457 if self.__layoutType == "Toolboxes": | 1604 if self.__layoutType == "Toolboxes": |
1458 for dock in [self.lToolboxDock, self.hToolboxDock, | 1605 for dock in [self.lToolboxDock, self.hToolboxDock, self.rToolboxDock]: |
1459 self.rToolboxDock]: | |
1460 container = dock.widget() | 1606 container = dock.widget() |
1461 index = container.indexOf(widget) | 1607 index = container.indexOf(widget) |
1462 if index != -1: | 1608 if index != -1: |
1463 dock.show() | 1609 dock.show() |
1464 container.setCurrentIndex(index) | 1610 container.setCurrentIndex(index) |
1465 dock.raise_() | 1611 dock.raise_() |
1466 elif self.__layoutType == "Sidebars": | 1612 elif self.__layoutType == "Sidebars": |
1467 for container in [self.leftSidebar, self.bottomSidebar, | 1613 for container in [self.leftSidebar, self.bottomSidebar, self.rightSidebar]: |
1468 self.rightSidebar]: | |
1469 if container is not None: | 1614 if container is not None: |
1470 index = container.indexOf(widget) | 1615 index = container.indexOf(widget) |
1471 if index != -1: | 1616 if index != -1: |
1472 container.show() | 1617 container.show() |
1473 container.setCurrentIndex(index) | 1618 container.setCurrentIndex(index) |
1474 container.raise_() | 1619 container.raise_() |
1475 | 1620 |
1476 def showLogViewer(self): | 1621 def showLogViewer(self): |
1477 """ | 1622 """ |
1478 Public method to show the Log-Viewer. | 1623 Public method to show the Log-Viewer. |
1479 """ | 1624 """ |
1480 if Preferences.getUI("LogViewerAutoRaise"): | 1625 if Preferences.getUI("LogViewerAutoRaise"): |
1484 self.hToolboxDock.raise_() | 1629 self.hToolboxDock.raise_() |
1485 elif self.__layoutType == "Sidebars": | 1630 elif self.__layoutType == "Sidebars": |
1486 self.bottomSidebar.show() | 1631 self.bottomSidebar.show() |
1487 self.bottomSidebar.setCurrentWidget(self.logViewer) | 1632 self.bottomSidebar.setCurrentWidget(self.logViewer) |
1488 self.bottomSidebar.raise_() | 1633 self.bottomSidebar.raise_() |
1489 | 1634 |
1490 def __openOnStartup(self, startupType=None): | 1635 def __openOnStartup(self, startupType=None): |
1491 """ | 1636 """ |
1492 Private method to open the last file, project or multiproject. | 1637 Private method to open the last file, project or multiproject. |
1493 | 1638 |
1494 @param startupType type of startup requested (string, one of | 1639 @param startupType type of startup requested (string, one of |
1495 "Nothing", "File", "Project", "MultiProject" or "Session") | 1640 "Nothing", "File", "Project", "MultiProject" or "Session") |
1496 """ | 1641 """ |
1497 startupTypeMapping = { | 1642 startupTypeMapping = { |
1498 "Nothing": 0, | 1643 "Nothing": 0, |
1499 "File": 1, | 1644 "File": 1, |
1500 "Project": 2, | 1645 "Project": 2, |
1501 "MultiProject": 3, | 1646 "MultiProject": 3, |
1502 "Session": 4, | 1647 "Session": 4, |
1503 } | 1648 } |
1504 | 1649 |
1505 if startupType is None: | 1650 if startupType is None: |
1506 startup = Preferences.getUI("OpenOnStartup") | 1651 startup = Preferences.getUI("OpenOnStartup") |
1507 else: | 1652 else: |
1508 try: | 1653 try: |
1509 startup = startupTypeMapping[startupType] | 1654 startup = startupTypeMapping[startupType] |
1510 except KeyError: | 1655 except KeyError: |
1511 startup = Preferences.getUI("OpenOnStartup") | 1656 startup = Preferences.getUI("OpenOnStartup") |
1512 | 1657 |
1513 if startup == 0: | 1658 if startup == 0: |
1514 # open nothing | 1659 # open nothing |
1515 pass | 1660 pass |
1516 elif startup == 1: | 1661 elif startup == 1: |
1517 # open last file | 1662 # open last file |
1529 if recent is not None: | 1674 if recent is not None: |
1530 self.multiProject.openMultiProject(recent) | 1675 self.multiProject.openMultiProject(recent) |
1531 elif startup == 4: | 1676 elif startup == 4: |
1532 # open from session file | 1677 # open from session file |
1533 self.__readSession() | 1678 self.__readSession() |
1534 | 1679 |
1535 def processArgs(self, args): | 1680 def processArgs(self, args): |
1536 """ | 1681 """ |
1537 Public method to process the command line args passed to the UI. | 1682 Public method to process the command line args passed to the UI. |
1538 | 1683 |
1539 @param args list of files to open<br /> | 1684 @param args list of files to open<br /> |
1540 The args are processed one at a time. All arguments after a | 1685 The args are processed one at a time. All arguments after a |
1541 '--' option are considered debug arguments to the program | 1686 '--' option are considered debug arguments to the program |
1542 for the debugger. All files named before the '--' option | 1687 for the debugger. All files named before the '--' option |
1543 are opened in a text editor, unless the argument ends in | 1688 are opened in a text editor, unless the argument ends in |
1545 ends in .emj, .e4m or .e5m, it is opened as a multi project. | 1690 ends in .emj, .e4m or .e5m, it is opened as a multi project. |
1546 """ | 1691 """ |
1547 # check and optionally read a crash session and ignore any arguments | 1692 # check and optionally read a crash session and ignore any arguments |
1548 if self.__readCrashSession(): | 1693 if self.__readCrashSession(): |
1549 return | 1694 return |
1550 | 1695 |
1551 # no args, return | 1696 # no args, return |
1552 if args is None: | 1697 if args is None: |
1553 if self.__openAtStartup: | 1698 if self.__openAtStartup: |
1554 self.__openOnStartup() | 1699 self.__openOnStartup() |
1555 return | 1700 return |
1556 | 1701 |
1557 opens = 0 | 1702 opens = 0 |
1558 | 1703 |
1559 # holds space delimited list of command args, if any | 1704 # holds space delimited list of command args, if any |
1560 argsStr = None | 1705 argsStr = None |
1561 # flag indicating '--' options was found | 1706 # flag indicating '--' options was found |
1562 ddseen = False | 1707 ddseen = False |
1563 | 1708 |
1564 argChars = ['-', '/'] if Utilities.isWindowsPlatform() else ['-'] | 1709 argChars = ["-", "/"] if Utilities.isWindowsPlatform() else ["-"] |
1565 | 1710 |
1566 for arg in args: | 1711 for arg in args: |
1567 # handle a request to start with last session | 1712 # handle a request to start with last session |
1568 if arg == '--start-file': | 1713 if arg == "--start-file": |
1569 self.__openOnStartup("File") | 1714 self.__openOnStartup("File") |
1570 # ignore all further arguments | 1715 # ignore all further arguments |
1571 return | 1716 return |
1572 elif arg == '--start-multi': | 1717 elif arg == "--start-multi": |
1573 self.__openOnStartup("MultiProject") | 1718 self.__openOnStartup("MultiProject") |
1574 # ignore all further arguments | 1719 # ignore all further arguments |
1575 return | 1720 return |
1576 elif arg == '--start-project': | 1721 elif arg == "--start-project": |
1577 self.__openOnStartup("Project") | 1722 self.__openOnStartup("Project") |
1578 # ignore all further arguments | 1723 # ignore all further arguments |
1579 return | 1724 return |
1580 elif arg == '--start-session': | 1725 elif arg == "--start-session": |
1581 self.__openOnStartup("Session") | 1726 self.__openOnStartup("Session") |
1582 # ignore all further arguments | 1727 # ignore all further arguments |
1583 return | 1728 return |
1584 | 1729 |
1585 if arg == '--' and not ddseen: | 1730 if arg == "--" and not ddseen: |
1586 ddseen = True | 1731 ddseen = True |
1587 continue | 1732 continue |
1588 | 1733 |
1589 if arg[0] in argChars or ddseen: | 1734 if arg[0] in argChars or ddseen: |
1590 if argsStr is None: | 1735 if argsStr is None: |
1591 argsStr = arg | 1736 argsStr = arg |
1592 else: | 1737 else: |
1593 argsStr = "{0} {1}".format(argsStr, arg) | 1738 argsStr = "{0} {1}".format(argsStr, arg) |
1594 continue | 1739 continue |
1595 | 1740 |
1596 try: | 1741 try: |
1597 ext = os.path.splitext(arg)[1] | 1742 ext = os.path.splitext(arg)[1] |
1598 ext = os.path.normcase(ext) | 1743 ext = os.path.normcase(ext) |
1599 except IndexError: | 1744 except IndexError: |
1600 ext = "" | 1745 ext = "" |
1601 | 1746 |
1602 if ext in ('.epj', '.e4p'): | 1747 if ext in (".epj", ".e4p"): |
1603 self.project.openProject(arg) | 1748 self.project.openProject(arg) |
1604 opens += 1 | 1749 opens += 1 |
1605 elif ext in ('.emj', '.e4m', '.e5m'): | 1750 elif ext in (".emj", ".e4m", ".e5m"): |
1606 self.multiProject.openMultiProject(arg) | 1751 self.multiProject.openMultiProject(arg) |
1607 opens += 1 | 1752 opens += 1 |
1608 else: | 1753 else: |
1609 self.viewmanager.openFiles(arg) | 1754 self.viewmanager.openFiles(arg) |
1610 opens += 1 | 1755 opens += 1 |
1611 | 1756 |
1612 # store away any args we had | 1757 # store away any args we had |
1613 if argsStr is not None: | 1758 if argsStr is not None: |
1614 self.debuggerUI.setArgvHistory(argsStr) | 1759 self.debuggerUI.setArgvHistory(argsStr) |
1615 | 1760 |
1616 if opens == 0 and self.__openAtStartup: | 1761 if opens == 0 and self.__openAtStartup: |
1617 # no files, project or multiproject was given | 1762 # no files, project or multiproject was given |
1618 self.__openOnStartup() | 1763 self.__openOnStartup() |
1619 | 1764 |
1620 def processInstallInfoFile(self): | 1765 def processInstallInfoFile(self): |
1621 """ | 1766 """ |
1622 Public method to process the file containing installation information. | 1767 Public method to process the file containing installation information. |
1623 """ | 1768 """ |
1624 import Globals | 1769 import Globals |
1625 | 1770 |
1626 installInfoFile = Globals.getInstallInfoFilePath() | 1771 installInfoFile = Globals.getInstallInfoFilePath() |
1627 if not os.path.exists(installInfoFile): | 1772 if not os.path.exists(installInfoFile): |
1628 filename = os.path.join(getConfig("ericDir"), "eric7install.json") | 1773 filename = os.path.join(getConfig("ericDir"), "eric7install.json") |
1629 if os.path.exists(filename): | 1774 if os.path.exists(filename): |
1630 # eric was installed via the install.py script | 1775 # eric was installed via the install.py script |
1631 shutil.copy2(filename, installInfoFile) | 1776 shutil.copy2(filename, installInfoFile) |
1632 else: | 1777 else: |
1633 filename = os.path.join(getConfig("ericDir"), | 1778 filename = os.path.join(getConfig("ericDir"), "eric7installpip.json") |
1634 "eric7installpip.json") | |
1635 if os.path.exists(filename): | 1779 if os.path.exists(filename): |
1636 # eric was installed via pip (i.e. eric-ide) | 1780 # eric was installed via pip (i.e. eric-ide) |
1637 with contextlib.suppress(OSError): | 1781 with contextlib.suppress(OSError): |
1638 installDateTime = datetime.datetime.now(tz=None) | 1782 installDateTime = datetime.datetime.now(tz=None) |
1639 with open(filename, "r") as infoFile: | 1783 with open(filename, "r") as infoFile: |
1640 installInfo = json.load(infoFile) | 1784 installInfo = json.load(infoFile) |
1641 installInfo["guessed"] = True | 1785 installInfo["guessed"] = True |
1642 installInfo["eric"] = getConfig("ericDir") | 1786 installInfo["eric"] = getConfig("ericDir") |
1643 installInfo["virtualenv"] = ( | 1787 installInfo["virtualenv"] = installInfo["eric"].startswith( |
1644 installInfo["eric"].startswith( | 1788 os.path.expanduser("~") |
1645 os.path.expanduser("~")) | |
1646 ) | 1789 ) |
1647 if installInfo["virtualenv"]: | 1790 if installInfo["virtualenv"]: |
1648 installInfo["user"] = getpass.getuser() | 1791 installInfo["user"] = getpass.getuser() |
1649 installInfo["exe"] = sys.executable | 1792 installInfo["exe"] = sys.executable |
1650 installInfo["installed"] = True | 1793 installInfo["installed"] = True |
1651 installInfo["installed_on"] = installDateTime.strftime( | 1794 installInfo["installed_on"] = installDateTime.strftime( |
1652 "%Y-%m-%d %H:%M:%S") | 1795 "%Y-%m-%d %H:%M:%S" |
1796 ) | |
1653 installInfo["sudo"] = not os.access( | 1797 installInfo["sudo"] = not os.access( |
1654 installInfo["eric"], os.W_OK) | 1798 installInfo["eric"], os.W_OK |
1799 ) | |
1655 with open(installInfoFile, "w") as infoFile: | 1800 with open(installInfoFile, "w") as infoFile: |
1656 json.dump(installInfo, infoFile, indent=2) | 1801 json.dump(installInfo, infoFile, indent=2) |
1657 else: | 1802 else: |
1658 changed = False | 1803 changed = False |
1659 with open(installInfoFile, "r") as infoFile: | 1804 with open(installInfoFile, "r") as infoFile: |
1660 installInfo = json.load(infoFile) | 1805 installInfo = json.load(infoFile) |
1661 | 1806 |
1662 # 1. adapt stored file to latest format | 1807 # 1. adapt stored file to latest format |
1663 if "install_cwd" not in installInfo: | 1808 if "install_cwd" not in installInfo: |
1664 installInfo["install_cwd"] = "" | 1809 installInfo["install_cwd"] = "" |
1665 installInfo["install_cwd_edited"] = False | 1810 installInfo["install_cwd_edited"] = False |
1666 changed = True | 1811 changed = True |
1667 if "installed_on" not in installInfo: | 1812 if "installed_on" not in installInfo: |
1668 installInfo["installed_on"] = "" | 1813 installInfo["installed_on"] = "" |
1669 changed = True | 1814 changed = True |
1670 | 1815 |
1671 # 2. merge new data into stored file | 1816 # 2. merge new data into stored file |
1672 filename = os.path.join(getConfig("ericDir"), "eric7install.json") | 1817 filename = os.path.join(getConfig("ericDir"), "eric7install.json") |
1673 if os.path.exists(filename): | 1818 if os.path.exists(filename): |
1674 # eric was updated via the install.py script | 1819 # eric was updated via the install.py script |
1675 if ( | 1820 if os.path.getmtime(filename) > os.path.getmtime(installInfoFile): |
1676 os.path.getmtime(filename) > | |
1677 os.path.getmtime(installInfoFile) | |
1678 ): | |
1679 if not installInfo["edited"]: | 1821 if not installInfo["edited"]: |
1680 shutil.copy2(filename, installInfoFile) | 1822 shutil.copy2(filename, installInfoFile) |
1681 else: | 1823 else: |
1682 with open(filename, "r") as infoFile: | 1824 with open(filename, "r") as infoFile: |
1683 installInfo2 = json.load(infoFile) | 1825 installInfo2 = json.load(infoFile) |
1684 if not installInfo["install_cwd_edited"]: | 1826 if not installInfo["install_cwd_edited"]: |
1685 installInfo2["install_cwd"] = installInfo[ | 1827 installInfo2["install_cwd"] = installInfo["install_cwd"] |
1686 "install_cwd"] | |
1687 if not installInfo["exe_edited"]: | 1828 if not installInfo["exe_edited"]: |
1688 installInfo2["exe"] = installInfo["exe"] | 1829 installInfo2["exe"] = installInfo["exe"] |
1689 if not installInfo["argv_edited"]: | 1830 if not installInfo["argv_edited"]: |
1690 installInfo2["argv"] = installInfo["argv"] | 1831 installInfo2["argv"] = installInfo["argv"] |
1691 if not installInfo["eric_edited"]: | 1832 if not installInfo["eric_edited"]: |
1692 installInfo2["eric"] = installInfo["eric"] | 1833 installInfo2["eric"] = installInfo["eric"] |
1693 installInfo = installInfo2 | 1834 installInfo = installInfo2 |
1694 changed = True | 1835 changed = True |
1695 else: | 1836 else: |
1696 filename = os.path.join(getConfig("ericDir"), | 1837 filename = os.path.join(getConfig("ericDir"), "eric7installpip.json") |
1697 "eric7installpip.json") | 1838 if os.path.exists(filename) and os.path.getmtime( |
1698 if ( | 1839 filename |
1699 os.path.exists(filename) and | 1840 ) > os.path.getmtime(installInfoFile): |
1700 os.path.getmtime(filename) > | |
1701 os.path.getmtime(installInfoFile) | |
1702 ): | |
1703 # eric was updated via pip (i.e. eric-ide) | 1841 # eric was updated via pip (i.e. eric-ide) |
1704 # just update the installation date and time | 1842 # just update the installation date and time |
1705 installDateTime = datetime.datetime.now(tz=None) | 1843 installDateTime = datetime.datetime.now(tz=None) |
1706 installInfo["installed_on"] = installDateTime.strftime( | 1844 installInfo["installed_on"] = installDateTime.strftime( |
1707 "%Y-%m-%d %H:%M:%S") | 1845 "%Y-%m-%d %H:%M:%S" |
1846 ) | |
1708 changed = True | 1847 changed = True |
1709 | 1848 |
1710 if changed: | 1849 if changed: |
1711 with open(installInfoFile, "w") as infoFile: | 1850 with open(installInfoFile, "w") as infoFile: |
1712 json.dump(installInfo, infoFile, indent=2) | 1851 json.dump(installInfo, infoFile, indent=2) |
1713 | 1852 |
1714 def __createDockWindow(self, name): | 1853 def __createDockWindow(self, name): |
1715 """ | 1854 """ |
1716 Private method to create a dock window with common properties. | 1855 Private method to create a dock window with common properties. |
1717 | 1856 |
1718 @param name object name of the new dock window (string) | 1857 @param name object name of the new dock window (string) |
1719 @return the generated dock window (QDockWindow) | 1858 @return the generated dock window (QDockWindow) |
1720 """ | 1859 """ |
1721 dock = QDockWidget() | 1860 dock = QDockWidget() |
1722 dock.setObjectName(name) | 1861 dock.setObjectName(name) |
1723 dock.setFeatures( | 1862 dock.setFeatures( |
1724 QDockWidget.DockWidgetFeature.DockWidgetClosable | | 1863 QDockWidget.DockWidgetFeature.DockWidgetClosable |
1725 QDockWidget.DockWidgetFeature.DockWidgetMovable | | 1864 | QDockWidget.DockWidgetFeature.DockWidgetMovable |
1726 QDockWidget.DockWidgetFeature.DockWidgetFloatable | 1865 | QDockWidget.DockWidgetFeature.DockWidgetFloatable |
1727 ) | 1866 ) |
1728 return dock | 1867 return dock |
1729 | 1868 |
1730 def __setupDockWindow(self, dock, where, widget, caption): | 1869 def __setupDockWindow(self, dock, where, widget, caption): |
1731 """ | 1870 """ |
1732 Private method to configure the dock window created with | 1871 Private method to configure the dock window created with |
1733 __createDockWindow(). | 1872 __createDockWindow(). |
1734 | 1873 |
1735 @param dock the dock window (QDockWindow) | 1874 @param dock the dock window (QDockWindow) |
1736 @param where dock area to be docked to (Qt.DockWidgetArea) | 1875 @param where dock area to be docked to (Qt.DockWidgetArea) |
1737 @param widget widget to be shown in the dock window (QWidget) | 1876 @param widget widget to be shown in the dock window (QWidget) |
1738 @param caption caption of the dock window (string) | 1877 @param caption caption of the dock window (string) |
1739 """ | 1878 """ |
1745 dock.show() | 1884 dock.show() |
1746 | 1885 |
1747 def __setWindowCaption(self, editor=None, project=None): | 1886 def __setWindowCaption(self, editor=None, project=None): |
1748 """ | 1887 """ |
1749 Private method to set the caption of the Main Window. | 1888 Private method to set the caption of the Main Window. |
1750 | 1889 |
1751 @param editor filename to be displayed (string) | 1890 @param editor filename to be displayed (string) |
1752 @param project project name to be displayed (string) | 1891 @param project project name to be displayed (string) |
1753 """ | 1892 """ |
1754 if editor is not None and self.captionShowsFilename: | 1893 if editor is not None and self.captionShowsFilename: |
1755 self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen) | 1894 self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen) |
1756 if project is not None: | 1895 if project is not None: |
1757 self.capProject = project | 1896 self.capProject = project |
1758 | 1897 |
1759 if self.passiveMode: | 1898 if self.passiveMode: |
1760 if not self.capProject and not self.capEditor: | 1899 if not self.capProject and not self.capEditor: |
1761 self.setWindowTitle( | 1900 self.setWindowTitle(self.tr("{0} - Passive Mode").format(Program)) |
1762 self.tr("{0} - Passive Mode").format(Program)) | |
1763 elif self.capProject and not self.capEditor: | 1901 elif self.capProject and not self.capEditor: |
1764 self.setWindowTitle( | 1902 self.setWindowTitle( |
1765 self.tr("{0} - {1} - Passive Mode") | 1903 self.tr("{0} - {1} - Passive Mode").format(self.capProject, Program) |
1766 .format(self.capProject, Program)) | 1904 ) |
1767 elif not self.capProject and self.capEditor: | 1905 elif not self.capProject and self.capEditor: |
1768 self.setWindowTitle( | 1906 self.setWindowTitle( |
1769 self.tr("{0} - {1} - Passive Mode") | 1907 self.tr("{0} - {1} - Passive Mode").format(self.capEditor, Program) |
1770 .format(self.capEditor, Program)) | 1908 ) |
1771 else: | 1909 else: |
1772 self.setWindowTitle( | 1910 self.setWindowTitle( |
1773 self.tr("{0} - {1} - {2} - Passive Mode") | 1911 self.tr("{0} - {1} - {2} - Passive Mode").format( |
1774 .format(self.capProject, self.capEditor, Program)) | 1912 self.capProject, self.capEditor, Program |
1913 ) | |
1914 ) | |
1775 else: | 1915 else: |
1776 if not self.capProject and not self.capEditor: | 1916 if not self.capProject and not self.capEditor: |
1777 self.setWindowTitle(Program) | 1917 self.setWindowTitle(Program) |
1778 elif self.capProject and not self.capEditor: | 1918 elif self.capProject and not self.capEditor: |
1919 self.setWindowTitle("{0} - {1}".format(self.capProject, Program)) | |
1920 elif not self.capProject and self.capEditor: | |
1921 self.setWindowTitle("{0} - {1}".format(self.capEditor, Program)) | |
1922 else: | |
1779 self.setWindowTitle( | 1923 self.setWindowTitle( |
1780 "{0} - {1}".format(self.capProject, Program)) | 1924 "{0} - {1} - {2}".format(self.capProject, self.capEditor, Program) |
1781 elif not self.capProject and self.capEditor: | 1925 ) |
1782 self.setWindowTitle( | 1926 |
1783 "{0} - {1}".format(self.capEditor, Program)) | |
1784 else: | |
1785 self.setWindowTitle("{0} - {1} - {2}".format( | |
1786 self.capProject, self.capEditor, Program)) | |
1787 | |
1788 def __initActions(self): | 1927 def __initActions(self): |
1789 """ | 1928 """ |
1790 Private method to define the user interface actions. | 1929 Private method to define the user interface actions. |
1791 """ | 1930 """ |
1792 self.actions = [] | 1931 self.actions = [] |
1793 self.wizardsActions = [] | 1932 self.wizardsActions = [] |
1794 | 1933 |
1795 self.exitAct = EricAction( | 1934 self.exitAct = EricAction( |
1796 self.tr('Quit'), | 1935 self.tr("Quit"), |
1797 UI.PixmapCache.getIcon("exit"), | 1936 UI.PixmapCache.getIcon("exit"), |
1798 self.tr('&Quit'), | 1937 self.tr("&Quit"), |
1799 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), | 1938 QKeySequence(self.tr("Ctrl+Q", "File|Quit")), |
1800 0, self, 'quit') | 1939 0, |
1801 self.exitAct.setStatusTip(self.tr('Quit the IDE')) | 1940 self, |
1802 self.exitAct.setWhatsThis(self.tr( | 1941 "quit", |
1803 """<b>Quit the IDE</b>""" | 1942 ) |
1804 """<p>This quits the IDE. Any unsaved changes may be saved""" | 1943 self.exitAct.setStatusTip(self.tr("Quit the IDE")) |
1805 """ first. Any Python program being debugged will be stopped""" | 1944 self.exitAct.setWhatsThis( |
1806 """ and the preferences will be written to disc.</p>""" | 1945 self.tr( |
1807 )) | 1946 """<b>Quit the IDE</b>""" |
1947 """<p>This quits the IDE. Any unsaved changes may be saved""" | |
1948 """ first. Any Python program being debugged will be stopped""" | |
1949 """ and the preferences will be written to disc.</p>""" | |
1950 ) | |
1951 ) | |
1808 self.exitAct.triggered.connect(self.__quit) | 1952 self.exitAct.triggered.connect(self.__quit) |
1809 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) | 1953 self.exitAct.setMenuRole(QAction.MenuRole.QuitRole) |
1810 self.actions.append(self.exitAct) | 1954 self.actions.append(self.exitAct) |
1811 | 1955 |
1812 self.restartAct = EricAction( | 1956 self.restartAct = EricAction( |
1813 self.tr('Restart'), | 1957 self.tr("Restart"), |
1814 UI.PixmapCache.getIcon("restart"), | 1958 UI.PixmapCache.getIcon("restart"), |
1815 self.tr('Restart'), | 1959 self.tr("Restart"), |
1816 QKeySequence(self.tr("Ctrl+Shift+Q", "File|Quit")), | 1960 QKeySequence(self.tr("Ctrl+Shift+Q", "File|Quit")), |
1817 0, self, 'restart_eric') | 1961 0, |
1818 self.restartAct.setStatusTip(self.tr('Restart the IDE')) | 1962 self, |
1819 self.restartAct.setWhatsThis(self.tr( | 1963 "restart_eric", |
1820 """<b>Restart the IDE</b>""" | 1964 ) |
1821 """<p>This restarts the IDE. Any unsaved changes may be saved""" | 1965 self.restartAct.setStatusTip(self.tr("Restart the IDE")) |
1822 """ first. Any Python program being debugged will be stopped""" | 1966 self.restartAct.setWhatsThis( |
1823 """ and the preferences will be written to disc.</p>""" | 1967 self.tr( |
1824 )) | 1968 """<b>Restart the IDE</b>""" |
1969 """<p>This restarts the IDE. Any unsaved changes may be saved""" | |
1970 """ first. Any Python program being debugged will be stopped""" | |
1971 """ and the preferences will be written to disc.</p>""" | |
1972 ) | |
1973 ) | |
1825 self.restartAct.triggered.connect(self.__restart) | 1974 self.restartAct.triggered.connect(self.__restart) |
1826 self.actions.append(self.restartAct) | 1975 self.actions.append(self.restartAct) |
1827 | 1976 |
1828 self.saveSessionAct = EricAction( | 1977 self.saveSessionAct = EricAction( |
1829 self.tr('Save session'), | 1978 self.tr("Save session"), |
1830 self.tr('Save session...'), | 1979 self.tr("Save session..."), |
1831 0, 0, self, 'save_session_to_file') | 1980 0, |
1832 self.saveSessionAct.setStatusTip(self.tr('Save session')) | 1981 0, |
1833 self.saveSessionAct.setWhatsThis(self.tr( | 1982 self, |
1834 """<b>Save session...</b>""" | 1983 "save_session_to_file", |
1835 """<p>This saves the current session to disk. A dialog is""" | 1984 ) |
1836 """ opened to select the file name.</p>""" | 1985 self.saveSessionAct.setStatusTip(self.tr("Save session")) |
1837 )) | 1986 self.saveSessionAct.setWhatsThis( |
1987 self.tr( | |
1988 """<b>Save session...</b>""" | |
1989 """<p>This saves the current session to disk. A dialog is""" | |
1990 """ opened to select the file name.</p>""" | |
1991 ) | |
1992 ) | |
1838 self.saveSessionAct.triggered.connect(self.__saveSessionToFile) | 1993 self.saveSessionAct.triggered.connect(self.__saveSessionToFile) |
1839 self.actions.append(self.saveSessionAct) | 1994 self.actions.append(self.saveSessionAct) |
1840 | 1995 |
1841 self.loadSessionAct = EricAction( | 1996 self.loadSessionAct = EricAction( |
1842 self.tr('Load session'), | 1997 self.tr("Load session"), |
1843 self.tr('Load session...'), | 1998 self.tr("Load session..."), |
1844 0, 0, self, 'load_session_from_file') | 1999 0, |
1845 self.loadSessionAct.setStatusTip(self.tr('Load session')) | 2000 0, |
1846 self.loadSessionAct.setWhatsThis(self.tr( | 2001 self, |
1847 """<b>Load session...</b>""" | 2002 "load_session_from_file", |
1848 """<p>This loads a session saved to disk previously. A dialog is""" | 2003 ) |
1849 """ opened to select the file name.</p>""" | 2004 self.loadSessionAct.setStatusTip(self.tr("Load session")) |
1850 )) | 2005 self.loadSessionAct.setWhatsThis( |
2006 self.tr( | |
2007 """<b>Load session...</b>""" | |
2008 """<p>This loads a session saved to disk previously. A dialog is""" | |
2009 """ opened to select the file name.</p>""" | |
2010 ) | |
2011 ) | |
1851 self.loadSessionAct.triggered.connect(self.__loadSessionFromFile) | 2012 self.loadSessionAct.triggered.connect(self.__loadSessionFromFile) |
1852 self.actions.append(self.loadSessionAct) | 2013 self.actions.append(self.loadSessionAct) |
1853 | 2014 |
1854 self.newWindowAct = EricAction( | 2015 self.newWindowAct = EricAction( |
1855 self.tr('New Window'), | 2016 self.tr("New Window"), |
1856 UI.PixmapCache.getIcon("newWindow"), | 2017 UI.PixmapCache.getIcon("newWindow"), |
1857 self.tr('New &Window'), | 2018 self.tr("New &Window"), |
1858 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), | 2019 QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), |
1859 0, self, 'new_window') | 2020 0, |
1860 self.newWindowAct.setStatusTip(self.tr( | 2021 self, |
1861 'Open a new eric instance')) | 2022 "new_window", |
1862 self.newWindowAct.setWhatsThis(self.tr( | 2023 ) |
1863 """<b>New Window</b>""" | 2024 self.newWindowAct.setStatusTip(self.tr("Open a new eric instance")) |
1864 """<p>This opens a new instance of the eric IDE.</p>""" | 2025 self.newWindowAct.setWhatsThis( |
1865 )) | 2026 self.tr( |
2027 """<b>New Window</b>""" | |
2028 """<p>This opens a new instance of the eric IDE.</p>""" | |
2029 ) | |
2030 ) | |
1866 self.newWindowAct.triggered.connect(self.__newWindow) | 2031 self.newWindowAct.triggered.connect(self.__newWindow) |
1867 self.actions.append(self.newWindowAct) | 2032 self.actions.append(self.newWindowAct) |
1868 self.newWindowAct.setEnabled( | 2033 self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode")) |
1869 not Preferences.getUI("SingleApplicationMode")) | 2034 |
1870 | |
1871 self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True) | 2035 self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True) |
1872 | 2036 |
1873 self.setEditProfileAct = EricAction( | 2037 self.setEditProfileAct = EricAction( |
1874 self.tr('Edit Profile'), | 2038 self.tr("Edit Profile"), |
1875 UI.PixmapCache.getIcon("viewProfileEdit"), | 2039 UI.PixmapCache.getIcon("viewProfileEdit"), |
1876 self.tr('Edit Profile'), | 2040 self.tr("Edit Profile"), |
1877 0, 0, | 2041 0, |
1878 self.viewProfileActGrp, 'edit_profile', True) | 2042 0, |
1879 self.setEditProfileAct.setStatusTip(self.tr( | 2043 self.viewProfileActGrp, |
1880 'Activate the edit view profile')) | 2044 "edit_profile", |
1881 self.setEditProfileAct.setWhatsThis(self.tr( | 2045 True, |
1882 """<b>Edit Profile</b>""" | 2046 ) |
1883 """<p>Activate the "Edit View Profile". Windows being shown,""" | 2047 self.setEditProfileAct.setStatusTip(self.tr("Activate the edit view profile")) |
1884 """ if this profile is active, may be configured with the""" | 2048 self.setEditProfileAct.setWhatsThis( |
1885 """ "View Profile Configuration" dialog.</p>""" | 2049 self.tr( |
1886 )) | 2050 """<b>Edit Profile</b>""" |
2051 """<p>Activate the "Edit View Profile". Windows being shown,""" | |
2052 """ if this profile is active, may be configured with the""" | |
2053 """ "View Profile Configuration" dialog.</p>""" | |
2054 ) | |
2055 ) | |
1887 self.setEditProfileAct.triggered.connect(self.__setEditProfile) | 2056 self.setEditProfileAct.triggered.connect(self.__setEditProfile) |
1888 self.actions.append(self.setEditProfileAct) | 2057 self.actions.append(self.setEditProfileAct) |
1889 | 2058 |
1890 self.setDebugProfileAct = EricAction( | 2059 self.setDebugProfileAct = EricAction( |
1891 self.tr('Debug Profile'), | 2060 self.tr("Debug Profile"), |
1892 UI.PixmapCache.getIcon("viewProfileDebug"), | 2061 UI.PixmapCache.getIcon("viewProfileDebug"), |
1893 self.tr('Debug Profile'), | 2062 self.tr("Debug Profile"), |
1894 0, 0, | 2063 0, |
1895 self.viewProfileActGrp, 'debug_profile', True) | 2064 0, |
1896 self.setDebugProfileAct.setStatusTip( | 2065 self.viewProfileActGrp, |
1897 self.tr('Activate the debug view profile')) | 2066 "debug_profile", |
1898 self.setDebugProfileAct.setWhatsThis(self.tr( | 2067 True, |
1899 """<b>Debug Profile</b>""" | 2068 ) |
1900 """<p>Activate the "Debug View Profile". Windows being shown,""" | 2069 self.setDebugProfileAct.setStatusTip(self.tr("Activate the debug view profile")) |
1901 """ if this profile is active, may be configured with the""" | 2070 self.setDebugProfileAct.setWhatsThis( |
1902 """ "View Profile Configuration" dialog.</p>""" | 2071 self.tr( |
1903 )) | 2072 """<b>Debug Profile</b>""" |
2073 """<p>Activate the "Debug View Profile". Windows being shown,""" | |
2074 """ if this profile is active, may be configured with the""" | |
2075 """ "View Profile Configuration" dialog.</p>""" | |
2076 ) | |
2077 ) | |
1904 self.setDebugProfileAct.triggered.connect(self.setDebugProfile) | 2078 self.setDebugProfileAct.triggered.connect(self.setDebugProfile) |
1905 self.actions.append(self.setDebugProfileAct) | 2079 self.actions.append(self.setDebugProfileAct) |
1906 | 2080 |
1907 self.pbActivateAct = EricAction( | 2081 self.pbActivateAct = EricAction( |
1908 self.tr('Project-Viewer'), | 2082 self.tr("Project-Viewer"), |
1909 self.tr('&Project-Viewer'), | 2083 self.tr("&Project-Viewer"), |
1910 QKeySequence(self.tr("Alt+Shift+P")), | 2084 QKeySequence(self.tr("Alt+Shift+P")), |
1911 0, self, | 2085 0, |
1912 'project_viewer_activate') | 2086 self, |
1913 self.pbActivateAct.setStatusTip(self.tr( | 2087 "project_viewer_activate", |
1914 "Switch the input focus to the Project-Viewer window.")) | 2088 ) |
1915 self.pbActivateAct.setWhatsThis(self.tr( | 2089 self.pbActivateAct.setStatusTip( |
1916 """<b>Activate Project-Viewer</b>""" | 2090 self.tr("Switch the input focus to the Project-Viewer window.") |
1917 """<p>This switches the input focus to the Project-Viewer""" | 2091 ) |
1918 """ window.</p>""" | 2092 self.pbActivateAct.setWhatsThis( |
1919 )) | 2093 self.tr( |
2094 """<b>Activate Project-Viewer</b>""" | |
2095 """<p>This switches the input focus to the Project-Viewer""" | |
2096 """ window.</p>""" | |
2097 ) | |
2098 ) | |
1920 self.pbActivateAct.triggered.connect(self.__activateProjectBrowser) | 2099 self.pbActivateAct.triggered.connect(self.__activateProjectBrowser) |
1921 self.actions.append(self.pbActivateAct) | 2100 self.actions.append(self.pbActivateAct) |
1922 self.addAction(self.pbActivateAct) | 2101 self.addAction(self.pbActivateAct) |
1923 | 2102 |
1924 self.mpbActivateAct = EricAction( | 2103 self.mpbActivateAct = EricAction( |
1925 self.tr('Multiproject-Viewer'), | 2104 self.tr("Multiproject-Viewer"), |
1926 self.tr('&Multiproject-Viewer'), | 2105 self.tr("&Multiproject-Viewer"), |
1927 QKeySequence(self.tr("Alt+Shift+M")), | 2106 QKeySequence(self.tr("Alt+Shift+M")), |
1928 0, self, | 2107 0, |
1929 'multi_project_viewer_activate') | 2108 self, |
1930 self.mpbActivateAct.setStatusTip(self.tr( | 2109 "multi_project_viewer_activate", |
1931 "Switch the input focus to the Multiproject-Viewer window.")) | 2110 ) |
1932 self.mpbActivateAct.setWhatsThis(self.tr( | 2111 self.mpbActivateAct.setStatusTip( |
1933 """<b>Activate Multiproject-Viewer</b>""" | 2112 self.tr("Switch the input focus to the Multiproject-Viewer window.") |
1934 """<p>This switches the input focus to the Multiproject-Viewer""" | 2113 ) |
1935 """ window.</p>""" | 2114 self.mpbActivateAct.setWhatsThis( |
1936 )) | 2115 self.tr( |
1937 self.mpbActivateAct.triggered.connect( | 2116 """<b>Activate Multiproject-Viewer</b>""" |
1938 self.__activateMultiProjectBrowser) | 2117 """<p>This switches the input focus to the Multiproject-Viewer""" |
2118 """ window.</p>""" | |
2119 ) | |
2120 ) | |
2121 self.mpbActivateAct.triggered.connect(self.__activateMultiProjectBrowser) | |
1939 self.actions.append(self.mpbActivateAct) | 2122 self.actions.append(self.mpbActivateAct) |
1940 self.addAction(self.mpbActivateAct) | 2123 self.addAction(self.mpbActivateAct) |
1941 | 2124 |
1942 self.debugViewerActivateAct = EricAction( | 2125 self.debugViewerActivateAct = EricAction( |
1943 self.tr('Debug-Viewer'), | 2126 self.tr("Debug-Viewer"), |
1944 self.tr('&Debug-Viewer'), | 2127 self.tr("&Debug-Viewer"), |
1945 QKeySequence(self.tr("Alt+Shift+D")), | 2128 QKeySequence(self.tr("Alt+Shift+D")), |
1946 0, self, | 2129 0, |
1947 'debug_viewer_activate') | 2130 self, |
1948 self.debugViewerActivateAct.setStatusTip(self.tr( | 2131 "debug_viewer_activate", |
1949 "Switch the input focus to the Debug-Viewer window.")) | 2132 ) |
1950 self.debugViewerActivateAct.setWhatsThis(self.tr( | 2133 self.debugViewerActivateAct.setStatusTip( |
1951 """<b>Activate Debug-Viewer</b>""" | 2134 self.tr("Switch the input focus to the Debug-Viewer window.") |
1952 """<p>This switches the input focus to the Debug-Viewer""" | 2135 ) |
1953 """ window.</p>""" | 2136 self.debugViewerActivateAct.setWhatsThis( |
1954 )) | 2137 self.tr( |
1955 self.debugViewerActivateAct.triggered.connect( | 2138 """<b>Activate Debug-Viewer</b>""" |
1956 self.activateDebugViewer) | 2139 """<p>This switches the input focus to the Debug-Viewer""" |
2140 """ window.</p>""" | |
2141 ) | |
2142 ) | |
2143 self.debugViewerActivateAct.triggered.connect(self.activateDebugViewer) | |
1957 self.actions.append(self.debugViewerActivateAct) | 2144 self.actions.append(self.debugViewerActivateAct) |
1958 self.addAction(self.debugViewerActivateAct) | 2145 self.addAction(self.debugViewerActivateAct) |
1959 | 2146 |
1960 self.shellActivateAct = EricAction( | 2147 self.shellActivateAct = EricAction( |
1961 self.tr('Shell'), | 2148 self.tr("Shell"), |
1962 self.tr('&Shell'), | 2149 self.tr("&Shell"), |
1963 QKeySequence(self.tr("Alt+Shift+S")), | 2150 QKeySequence(self.tr("Alt+Shift+S")), |
1964 0, self, | 2151 0, |
1965 'interpreter_shell_activate') | 2152 self, |
1966 self.shellActivateAct.setStatusTip(self.tr( | 2153 "interpreter_shell_activate", |
1967 "Switch the input focus to the Shell window.")) | 2154 ) |
1968 self.shellActivateAct.setWhatsThis(self.tr( | 2155 self.shellActivateAct.setStatusTip( |
1969 """<b>Activate Shell</b>""" | 2156 self.tr("Switch the input focus to the Shell window.") |
1970 """<p>This switches the input focus to the Shell window.</p>""" | 2157 ) |
1971 )) | 2158 self.shellActivateAct.setWhatsThis( |
2159 self.tr( | |
2160 """<b>Activate Shell</b>""" | |
2161 """<p>This switches the input focus to the Shell window.</p>""" | |
2162 ) | |
2163 ) | |
1972 self.shellActivateAct.triggered.connect(self.__activateShell) | 2164 self.shellActivateAct.triggered.connect(self.__activateShell) |
1973 self.actions.append(self.shellActivateAct) | 2165 self.actions.append(self.shellActivateAct) |
1974 self.addAction(self.shellActivateAct) | 2166 self.addAction(self.shellActivateAct) |
1975 | 2167 |
1976 if self.browser is not None: | 2168 if self.browser is not None: |
1977 self.browserActivateAct = EricAction( | 2169 self.browserActivateAct = EricAction( |
1978 self.tr('File-Browser'), | 2170 self.tr("File-Browser"), |
1979 self.tr('&File-Browser'), | 2171 self.tr("&File-Browser"), |
1980 QKeySequence(self.tr("Alt+Shift+F")), | 2172 QKeySequence(self.tr("Alt+Shift+F")), |
1981 0, self, | 2173 0, |
1982 'file_browser_activate') | 2174 self, |
1983 self.browserActivateAct.setStatusTip(self.tr( | 2175 "file_browser_activate", |
1984 "Switch the input focus to the File-Browser window.")) | 2176 ) |
1985 self.browserActivateAct.setWhatsThis(self.tr( | 2177 self.browserActivateAct.setStatusTip( |
1986 """<b>Activate File-Browser</b>""" | 2178 self.tr("Switch the input focus to the File-Browser window.") |
1987 """<p>This switches the input focus to the File-Browser""" | 2179 ) |
1988 """ window.</p>""" | 2180 self.browserActivateAct.setWhatsThis( |
1989 )) | 2181 self.tr( |
2182 """<b>Activate File-Browser</b>""" | |
2183 """<p>This switches the input focus to the File-Browser""" | |
2184 """ window.</p>""" | |
2185 ) | |
2186 ) | |
1990 self.browserActivateAct.triggered.connect(self.__activateBrowser) | 2187 self.browserActivateAct.triggered.connect(self.__activateBrowser) |
1991 self.actions.append(self.browserActivateAct) | 2188 self.actions.append(self.browserActivateAct) |
1992 self.addAction(self.browserActivateAct) | 2189 self.addAction(self.browserActivateAct) |
1993 | 2190 |
1994 self.logViewerActivateAct = EricAction( | 2191 self.logViewerActivateAct = EricAction( |
1995 self.tr('Log-Viewer'), | 2192 self.tr("Log-Viewer"), |
1996 self.tr('Lo&g-Viewer'), | 2193 self.tr("Lo&g-Viewer"), |
1997 QKeySequence(self.tr("Alt+Shift+G")), | 2194 QKeySequence(self.tr("Alt+Shift+G")), |
1998 0, self, | 2195 0, |
1999 'log_viewer_activate') | 2196 self, |
2000 self.logViewerActivateAct.setStatusTip(self.tr( | 2197 "log_viewer_activate", |
2001 "Switch the input focus to the Log-Viewer window.")) | 2198 ) |
2002 self.logViewerActivateAct.setWhatsThis(self.tr( | 2199 self.logViewerActivateAct.setStatusTip( |
2003 """<b>Activate Log-Viewer</b>""" | 2200 self.tr("Switch the input focus to the Log-Viewer window.") |
2004 """<p>This switches the input focus to the Log-Viewer""" | 2201 ) |
2005 """ window.</p>""" | 2202 self.logViewerActivateAct.setWhatsThis( |
2006 )) | 2203 self.tr( |
2007 self.logViewerActivateAct.triggered.connect( | 2204 """<b>Activate Log-Viewer</b>""" |
2008 self.__activateLogViewer) | 2205 """<p>This switches the input focus to the Log-Viewer""" |
2206 """ window.</p>""" | |
2207 ) | |
2208 ) | |
2209 self.logViewerActivateAct.triggered.connect(self.__activateLogViewer) | |
2009 self.actions.append(self.logViewerActivateAct) | 2210 self.actions.append(self.logViewerActivateAct) |
2010 self.addAction(self.logViewerActivateAct) | 2211 self.addAction(self.logViewerActivateAct) |
2011 | 2212 |
2012 self.taskViewerActivateAct = EricAction( | 2213 self.taskViewerActivateAct = EricAction( |
2013 self.tr('Task-Viewer'), | 2214 self.tr("Task-Viewer"), |
2014 self.tr('&Task-Viewer'), | 2215 self.tr("&Task-Viewer"), |
2015 QKeySequence(self.tr("Alt+Shift+T")), | 2216 QKeySequence(self.tr("Alt+Shift+T")), |
2016 0, self, | 2217 0, |
2017 'task_viewer_activate') | 2218 self, |
2018 self.taskViewerActivateAct.setStatusTip(self.tr( | 2219 "task_viewer_activate", |
2019 "Switch the input focus to the Task-Viewer window.")) | 2220 ) |
2020 self.taskViewerActivateAct.setWhatsThis(self.tr( | 2221 self.taskViewerActivateAct.setStatusTip( |
2021 """<b>Activate Task-Viewer</b>""" | 2222 self.tr("Switch the input focus to the Task-Viewer window.") |
2022 """<p>This switches the input focus to the Task-Viewer""" | 2223 ) |
2023 """ window.</p>""" | 2224 self.taskViewerActivateAct.setWhatsThis( |
2024 )) | 2225 self.tr( |
2025 self.taskViewerActivateAct.triggered.connect( | 2226 """<b>Activate Task-Viewer</b>""" |
2026 self.__activateTaskViewer) | 2227 """<p>This switches the input focus to the Task-Viewer""" |
2228 """ window.</p>""" | |
2229 ) | |
2230 ) | |
2231 self.taskViewerActivateAct.triggered.connect(self.__activateTaskViewer) | |
2027 self.actions.append(self.taskViewerActivateAct) | 2232 self.actions.append(self.taskViewerActivateAct) |
2028 self.addAction(self.taskViewerActivateAct) | 2233 self.addAction(self.taskViewerActivateAct) |
2029 | 2234 |
2030 if self.templateViewer is not None: | 2235 if self.templateViewer is not None: |
2031 self.templateViewerActivateAct = EricAction( | 2236 self.templateViewerActivateAct = EricAction( |
2032 self.tr('Template-Viewer'), | 2237 self.tr("Template-Viewer"), |
2033 self.tr('Templ&ate-Viewer'), | 2238 self.tr("Templ&ate-Viewer"), |
2034 QKeySequence(self.tr("Alt+Shift+A")), | 2239 QKeySequence(self.tr("Alt+Shift+A")), |
2035 0, self, | 2240 0, |
2036 'template_viewer_activate') | 2241 self, |
2037 self.templateViewerActivateAct.setStatusTip(self.tr( | 2242 "template_viewer_activate", |
2038 "Switch the input focus to the Template-Viewer window.")) | 2243 ) |
2039 self.templateViewerActivateAct.setWhatsThis(self.tr( | 2244 self.templateViewerActivateAct.setStatusTip( |
2040 """<b>Activate Template-Viewer</b>""" | 2245 self.tr("Switch the input focus to the Template-Viewer window.") |
2041 """<p>This switches the input focus to the Template-Viewer""" | 2246 ) |
2042 """ window.</p>""" | 2247 self.templateViewerActivateAct.setWhatsThis( |
2043 )) | 2248 self.tr( |
2249 """<b>Activate Template-Viewer</b>""" | |
2250 """<p>This switches the input focus to the Template-Viewer""" | |
2251 """ window.</p>""" | |
2252 ) | |
2253 ) | |
2044 self.templateViewerActivateAct.triggered.connect( | 2254 self.templateViewerActivateAct.triggered.connect( |
2045 self.__activateTemplateViewer) | 2255 self.__activateTemplateViewer |
2256 ) | |
2046 self.actions.append(self.templateViewerActivateAct) | 2257 self.actions.append(self.templateViewerActivateAct) |
2047 self.addAction(self.templateViewerActivateAct) | 2258 self.addAction(self.templateViewerActivateAct) |
2048 | 2259 |
2049 if self.lToolbox: | 2260 if self.lToolbox: |
2050 self.ltAct = EricAction( | 2261 self.ltAct = EricAction( |
2051 self.tr('Left Toolbox'), | 2262 self.tr("Left Toolbox"), |
2052 self.tr('&Left Toolbox'), 0, 0, self, 'vertical_toolbox', True) | 2263 self.tr("&Left Toolbox"), |
2053 self.ltAct.setStatusTip(self.tr('Toggle the Left Toolbox window')) | 2264 0, |
2054 self.ltAct.setWhatsThis(self.tr( | 2265 0, |
2055 """<b>Toggle the Left Toolbox window</b>""" | 2266 self, |
2056 """<p>If the Left Toolbox window is hidden then display it.""" | 2267 "vertical_toolbox", |
2057 """ If it is displayed then close it.</p>""" | 2268 True, |
2058 )) | 2269 ) |
2270 self.ltAct.setStatusTip(self.tr("Toggle the Left Toolbox window")) | |
2271 self.ltAct.setWhatsThis( | |
2272 self.tr( | |
2273 """<b>Toggle the Left Toolbox window</b>""" | |
2274 """<p>If the Left Toolbox window is hidden then display it.""" | |
2275 """ If it is displayed then close it.</p>""" | |
2276 ) | |
2277 ) | |
2059 self.ltAct.triggered.connect(self.__toggleLeftToolbox) | 2278 self.ltAct.triggered.connect(self.__toggleLeftToolbox) |
2060 self.actions.append(self.ltAct) | 2279 self.actions.append(self.ltAct) |
2061 else: | 2280 else: |
2062 self.ltAct = None | 2281 self.ltAct = None |
2063 | 2282 |
2064 if self.rToolbox: | 2283 if self.rToolbox: |
2065 self.rtAct = EricAction( | 2284 self.rtAct = EricAction( |
2066 self.tr('Right Toolbox'), | 2285 self.tr("Right Toolbox"), |
2067 self.tr('&Right Toolbox'), | 2286 self.tr("&Right Toolbox"), |
2068 0, 0, self, 'vertical_toolbox', True) | 2287 0, |
2069 self.rtAct.setStatusTip(self.tr('Toggle the Right Toolbox window')) | 2288 0, |
2070 self.rtAct.setWhatsThis(self.tr( | 2289 self, |
2071 """<b>Toggle the Right Toolbox window</b>""" | 2290 "vertical_toolbox", |
2072 """<p>If the Right Toolbox window is hidden then display it.""" | 2291 True, |
2073 """ If it is displayed then close it.</p>""" | 2292 ) |
2074 )) | 2293 self.rtAct.setStatusTip(self.tr("Toggle the Right Toolbox window")) |
2294 self.rtAct.setWhatsThis( | |
2295 self.tr( | |
2296 """<b>Toggle the Right Toolbox window</b>""" | |
2297 """<p>If the Right Toolbox window is hidden then display it.""" | |
2298 """ If it is displayed then close it.</p>""" | |
2299 ) | |
2300 ) | |
2075 self.rtAct.triggered.connect(self.__toggleRightToolbox) | 2301 self.rtAct.triggered.connect(self.__toggleRightToolbox) |
2076 self.actions.append(self.rtAct) | 2302 self.actions.append(self.rtAct) |
2077 else: | 2303 else: |
2078 self.rtAct = None | 2304 self.rtAct = None |
2079 | 2305 |
2080 if self.hToolbox: | 2306 if self.hToolbox: |
2081 self.htAct = EricAction( | 2307 self.htAct = EricAction( |
2082 self.tr('Horizontal Toolbox'), | 2308 self.tr("Horizontal Toolbox"), |
2083 self.tr('&Horizontal Toolbox'), 0, 0, self, | 2309 self.tr("&Horizontal Toolbox"), |
2084 'horizontal_toolbox', True) | 2310 0, |
2085 self.htAct.setStatusTip(self.tr( | 2311 0, |
2086 'Toggle the Horizontal Toolbox window')) | 2312 self, |
2087 self.htAct.setWhatsThis(self.tr( | 2313 "horizontal_toolbox", |
2088 """<b>Toggle the Horizontal Toolbox window</b>""" | 2314 True, |
2089 """<p>If the Horizontal Toolbox window is hidden then""" | 2315 ) |
2090 """ display it. If it is displayed then close it.</p>""" | 2316 self.htAct.setStatusTip(self.tr("Toggle the Horizontal Toolbox window")) |
2091 )) | 2317 self.htAct.setWhatsThis( |
2318 self.tr( | |
2319 """<b>Toggle the Horizontal Toolbox window</b>""" | |
2320 """<p>If the Horizontal Toolbox window is hidden then""" | |
2321 """ display it. If it is displayed then close it.</p>""" | |
2322 ) | |
2323 ) | |
2092 self.htAct.triggered.connect(self.__toggleHorizontalToolbox) | 2324 self.htAct.triggered.connect(self.__toggleHorizontalToolbox) |
2093 self.actions.append(self.htAct) | 2325 self.actions.append(self.htAct) |
2094 else: | 2326 else: |
2095 self.htAct = None | 2327 self.htAct = None |
2096 | 2328 |
2097 if self.leftSidebar: | 2329 if self.leftSidebar: |
2098 self.lsbAct = EricAction( | 2330 self.lsbAct = EricAction( |
2099 self.tr('Left Sidebar'), | 2331 self.tr("Left Sidebar"), |
2100 self.tr('&Left Sidebar'), | 2332 self.tr("&Left Sidebar"), |
2101 0, 0, self, 'left_sidebar', True) | 2333 0, |
2102 self.lsbAct.setStatusTip(self.tr('Toggle the left sidebar window')) | 2334 0, |
2103 self.lsbAct.setWhatsThis(self.tr( | 2335 self, |
2104 """<b>Toggle the left sidebar window</b>""" | 2336 "left_sidebar", |
2105 """<p>If the left sidebar window is hidden then display it.""" | 2337 True, |
2106 """ If it is displayed then close it.</p>""" | 2338 ) |
2107 )) | 2339 self.lsbAct.setStatusTip(self.tr("Toggle the left sidebar window")) |
2340 self.lsbAct.setWhatsThis( | |
2341 self.tr( | |
2342 """<b>Toggle the left sidebar window</b>""" | |
2343 """<p>If the left sidebar window is hidden then display it.""" | |
2344 """ If it is displayed then close it.</p>""" | |
2345 ) | |
2346 ) | |
2108 self.lsbAct.triggered.connect(self.__toggleLeftSidebar) | 2347 self.lsbAct.triggered.connect(self.__toggleLeftSidebar) |
2109 self.actions.append(self.lsbAct) | 2348 self.actions.append(self.lsbAct) |
2110 else: | 2349 else: |
2111 self.lsbAct = None | 2350 self.lsbAct = None |
2112 | 2351 |
2113 if self.rightSidebar: | 2352 if self.rightSidebar: |
2114 self.rsbAct = EricAction( | 2353 self.rsbAct = EricAction( |
2115 self.tr('Right Sidebar'), | 2354 self.tr("Right Sidebar"), |
2116 self.tr('&Right Sidebar'), | 2355 self.tr("&Right Sidebar"), |
2117 0, 0, self, 'right_sidebar', True) | 2356 0, |
2118 self.rsbAct.setStatusTip(self.tr( | 2357 0, |
2119 'Toggle the right sidebar window')) | 2358 self, |
2120 self.rsbAct.setWhatsThis(self.tr( | 2359 "right_sidebar", |
2121 """<b>Toggle the right sidebar window</b>""" | 2360 True, |
2122 """<p>If the right sidebar window is hidden then display it.""" | 2361 ) |
2123 """ If it is displayed then close it.</p>""" | 2362 self.rsbAct.setStatusTip(self.tr("Toggle the right sidebar window")) |
2124 )) | 2363 self.rsbAct.setWhatsThis( |
2364 self.tr( | |
2365 """<b>Toggle the right sidebar window</b>""" | |
2366 """<p>If the right sidebar window is hidden then display it.""" | |
2367 """ If it is displayed then close it.</p>""" | |
2368 ) | |
2369 ) | |
2125 self.rsbAct.triggered.connect(self.__toggleRightSidebar) | 2370 self.rsbAct.triggered.connect(self.__toggleRightSidebar) |
2126 self.actions.append(self.rsbAct) | 2371 self.actions.append(self.rsbAct) |
2127 else: | 2372 else: |
2128 self.rsbAct = None | 2373 self.rsbAct = None |
2129 | 2374 |
2130 if self.bottomSidebar: | 2375 if self.bottomSidebar: |
2131 self.bsbAct = EricAction( | 2376 self.bsbAct = EricAction( |
2132 self.tr('Bottom Sidebar'), | 2377 self.tr("Bottom Sidebar"), |
2133 self.tr('&Bottom Sidebar'), 0, 0, self, | 2378 self.tr("&Bottom Sidebar"), |
2134 'bottom_sidebar', True) | 2379 0, |
2135 self.bsbAct.setStatusTip(self.tr( | 2380 0, |
2136 'Toggle the bottom sidebar window')) | 2381 self, |
2137 self.bsbAct.setWhatsThis(self.tr( | 2382 "bottom_sidebar", |
2138 """<b>Toggle the bottom sidebar window</b>""" | 2383 True, |
2139 """<p>If the bottom sidebar window is hidden then display""" | 2384 ) |
2140 """ it. If it is displayed then close it.</p>""" | 2385 self.bsbAct.setStatusTip(self.tr("Toggle the bottom sidebar window")) |
2141 )) | 2386 self.bsbAct.setWhatsThis( |
2387 self.tr( | |
2388 """<b>Toggle the bottom sidebar window</b>""" | |
2389 """<p>If the bottom sidebar window is hidden then display""" | |
2390 """ it. If it is displayed then close it.</p>""" | |
2391 ) | |
2392 ) | |
2142 self.bsbAct.triggered.connect(self.__toggleBottomSidebar) | 2393 self.bsbAct.triggered.connect(self.__toggleBottomSidebar) |
2143 self.actions.append(self.bsbAct) | 2394 self.actions.append(self.bsbAct) |
2144 else: | 2395 else: |
2145 self.bsbAct = None | 2396 self.bsbAct = None |
2146 | 2397 |
2147 if self.cooperation is not None: | 2398 if self.cooperation is not None: |
2148 self.cooperationViewerActivateAct = EricAction( | 2399 self.cooperationViewerActivateAct = EricAction( |
2149 self.tr('Cooperation-Viewer'), | 2400 self.tr("Cooperation-Viewer"), |
2150 self.tr('Co&operation-Viewer'), | 2401 self.tr("Co&operation-Viewer"), |
2151 QKeySequence(self.tr("Alt+Shift+O")), | 2402 QKeySequence(self.tr("Alt+Shift+O")), |
2152 0, self, | 2403 0, |
2153 'cooperation_viewer_activate') | 2404 self, |
2154 self.cooperationViewerActivateAct.setStatusTip(self.tr( | 2405 "cooperation_viewer_activate", |
2155 "Switch the input focus to the Cooperation-Viewer window.")) | 2406 ) |
2156 self.cooperationViewerActivateAct.setWhatsThis(self.tr( | 2407 self.cooperationViewerActivateAct.setStatusTip( |
2157 """<b>Activate Cooperation-Viewer</b>""" | 2408 self.tr("Switch the input focus to the Cooperation-Viewer window.") |
2158 """<p>This switches the input focus to the""" | 2409 ) |
2159 """ Cooperation-Viewer window.</p>""" | 2410 self.cooperationViewerActivateAct.setWhatsThis( |
2160 )) | 2411 self.tr( |
2412 """<b>Activate Cooperation-Viewer</b>""" | |
2413 """<p>This switches the input focus to the""" | |
2414 """ Cooperation-Viewer window.</p>""" | |
2415 ) | |
2416 ) | |
2161 self.cooperationViewerActivateAct.triggered.connect( | 2417 self.cooperationViewerActivateAct.triggered.connect( |
2162 self.activateCooperationViewer) | 2418 self.activateCooperationViewer |
2419 ) | |
2163 self.actions.append(self.cooperationViewerActivateAct) | 2420 self.actions.append(self.cooperationViewerActivateAct) |
2164 self.addAction(self.cooperationViewerActivateAct) | 2421 self.addAction(self.cooperationViewerActivateAct) |
2165 | 2422 |
2166 if self.irc is not None: | 2423 if self.irc is not None: |
2167 self.ircActivateAct = EricAction( | 2424 self.ircActivateAct = EricAction( |
2168 self.tr('IRC'), | 2425 self.tr("IRC"), |
2169 self.tr('&IRC'), | 2426 self.tr("&IRC"), |
2170 QKeySequence(self.tr("Ctrl+Alt+Shift+I")), | 2427 QKeySequence(self.tr("Ctrl+Alt+Shift+I")), |
2171 0, self, | 2428 0, |
2172 'irc_widget_activate') | 2429 self, |
2173 self.ircActivateAct.setStatusTip(self.tr( | 2430 "irc_widget_activate", |
2174 "Switch the input focus to the IRC window.")) | 2431 ) |
2175 self.ircActivateAct.setWhatsThis(self.tr( | 2432 self.ircActivateAct.setStatusTip( |
2176 """<b>Activate IRC</b>""" | 2433 self.tr("Switch the input focus to the IRC window.") |
2177 """<p>This switches the input focus to the IRC window.</p>""" | 2434 ) |
2178 )) | 2435 self.ircActivateAct.setWhatsThis( |
2179 self.ircActivateAct.triggered.connect( | 2436 self.tr( |
2180 self.__activateIRC) | 2437 """<b>Activate IRC</b>""" |
2438 """<p>This switches the input focus to the IRC window.</p>""" | |
2439 ) | |
2440 ) | |
2441 self.ircActivateAct.triggered.connect(self.__activateIRC) | |
2181 self.actions.append(self.ircActivateAct) | 2442 self.actions.append(self.ircActivateAct) |
2182 self.addAction(self.ircActivateAct) | 2443 self.addAction(self.ircActivateAct) |
2183 | 2444 |
2184 if self.symbolsViewer is not None: | 2445 if self.symbolsViewer is not None: |
2185 self.symbolsViewerActivateAct = EricAction( | 2446 self.symbolsViewerActivateAct = EricAction( |
2186 self.tr('Symbols-Viewer'), | 2447 self.tr("Symbols-Viewer"), |
2187 self.tr('S&ymbols-Viewer'), | 2448 self.tr("S&ymbols-Viewer"), |
2188 QKeySequence(self.tr("Alt+Shift+Y")), | 2449 QKeySequence(self.tr("Alt+Shift+Y")), |
2189 0, self, | 2450 0, |
2190 'symbols_viewer_activate') | 2451 self, |
2191 self.symbolsViewerActivateAct.setStatusTip(self.tr( | 2452 "symbols_viewer_activate", |
2192 "Switch the input focus to the Symbols-Viewer window.")) | 2453 ) |
2193 self.symbolsViewerActivateAct.setWhatsThis(self.tr( | 2454 self.symbolsViewerActivateAct.setStatusTip( |
2194 """<b>Activate Symbols-Viewer</b>""" | 2455 self.tr("Switch the input focus to the Symbols-Viewer window.") |
2195 """<p>This switches the input focus to the Symbols-Viewer""" | 2456 ) |
2196 """ window.</p>""" | 2457 self.symbolsViewerActivateAct.setWhatsThis( |
2197 )) | 2458 self.tr( |
2459 """<b>Activate Symbols-Viewer</b>""" | |
2460 """<p>This switches the input focus to the Symbols-Viewer""" | |
2461 """ window.</p>""" | |
2462 ) | |
2463 ) | |
2198 self.symbolsViewerActivateAct.triggered.connect( | 2464 self.symbolsViewerActivateAct.triggered.connect( |
2199 self.__activateSymbolsViewer) | 2465 self.__activateSymbolsViewer |
2466 ) | |
2200 self.actions.append(self.symbolsViewerActivateAct) | 2467 self.actions.append(self.symbolsViewerActivateAct) |
2201 self.addAction(self.symbolsViewerActivateAct) | 2468 self.addAction(self.symbolsViewerActivateAct) |
2202 | 2469 |
2203 if self.numbersViewer is not None: | 2470 if self.numbersViewer is not None: |
2204 self.numbersViewerActivateAct = EricAction( | 2471 self.numbersViewerActivateAct = EricAction( |
2205 self.tr('Numbers-Viewer'), | 2472 self.tr("Numbers-Viewer"), |
2206 self.tr('Num&bers-Viewer'), | 2473 self.tr("Num&bers-Viewer"), |
2207 QKeySequence(self.tr("Alt+Shift+B")), | 2474 QKeySequence(self.tr("Alt+Shift+B")), |
2208 0, self, | 2475 0, |
2209 'numbers_viewer_activate') | 2476 self, |
2210 self.numbersViewerActivateAct.setStatusTip(self.tr( | 2477 "numbers_viewer_activate", |
2211 "Switch the input focus to the Numbers-Viewer window.")) | 2478 ) |
2212 self.numbersViewerActivateAct.setWhatsThis(self.tr( | 2479 self.numbersViewerActivateAct.setStatusTip( |
2213 """<b>Activate Numbers-Viewer</b>""" | 2480 self.tr("Switch the input focus to the Numbers-Viewer window.") |
2214 """<p>This switches the input focus to the Numbers-Viewer""" | 2481 ) |
2215 """ window.</p>""" | 2482 self.numbersViewerActivateAct.setWhatsThis( |
2216 )) | 2483 self.tr( |
2484 """<b>Activate Numbers-Viewer</b>""" | |
2485 """<p>This switches the input focus to the Numbers-Viewer""" | |
2486 """ window.</p>""" | |
2487 ) | |
2488 ) | |
2217 self.numbersViewerActivateAct.triggered.connect( | 2489 self.numbersViewerActivateAct.triggered.connect( |
2218 self.__activateNumbersViewer) | 2490 self.__activateNumbersViewer |
2491 ) | |
2219 self.actions.append(self.numbersViewerActivateAct) | 2492 self.actions.append(self.numbersViewerActivateAct) |
2220 self.addAction(self.numbersViewerActivateAct) | 2493 self.addAction(self.numbersViewerActivateAct) |
2221 | 2494 |
2222 if self.codeDocumentationViewer is not None: | 2495 if self.codeDocumentationViewer is not None: |
2223 self.codeDocumentationViewerActivateAct = EricAction( | 2496 self.codeDocumentationViewerActivateAct = EricAction( |
2224 self.tr('Code Documentation Viewer'), | 2497 self.tr("Code Documentation Viewer"), |
2225 self.tr('Code Documentation Viewer'), | 2498 self.tr("Code Documentation Viewer"), |
2226 QKeySequence(self.tr("Ctrl+Alt+Shift+D")), | 2499 QKeySequence(self.tr("Ctrl+Alt+Shift+D")), |
2227 0, self, | 2500 0, |
2228 'code_documentation_viewer_activate') | 2501 self, |
2229 self.codeDocumentationViewerActivateAct.setStatusTip(self.tr( | 2502 "code_documentation_viewer_activate", |
2230 "Switch the input focus to the Code Documentation Viewer" | 2503 ) |
2231 " window.")) | 2504 self.codeDocumentationViewerActivateAct.setStatusTip( |
2232 self.codeDocumentationViewerActivateAct.setWhatsThis(self.tr( | 2505 self.tr( |
2233 """<b>Code Documentation Viewer</b>""" | 2506 "Switch the input focus to the Code Documentation Viewer" " window." |
2234 """<p>This switches the input focus to the Code""" | 2507 ) |
2235 """ Documentation Viewer window.</p>""" | 2508 ) |
2236 )) | 2509 self.codeDocumentationViewerActivateAct.setWhatsThis( |
2510 self.tr( | |
2511 """<b>Code Documentation Viewer</b>""" | |
2512 """<p>This switches the input focus to the Code""" | |
2513 """ Documentation Viewer window.</p>""" | |
2514 ) | |
2515 ) | |
2237 self.codeDocumentationViewerActivateAct.triggered.connect( | 2516 self.codeDocumentationViewerActivateAct.triggered.connect( |
2238 self.activateCodeDocumentationViewer) | 2517 self.activateCodeDocumentationViewer |
2518 ) | |
2239 self.actions.append(self.codeDocumentationViewerActivateAct) | 2519 self.actions.append(self.codeDocumentationViewerActivateAct) |
2240 self.addAction(self.codeDocumentationViewerActivateAct) | 2520 self.addAction(self.codeDocumentationViewerActivateAct) |
2241 | 2521 |
2242 if self.pipWidget is not None: | 2522 if self.pipWidget is not None: |
2243 self.pipWidgetActivateAct = EricAction( | 2523 self.pipWidgetActivateAct = EricAction( |
2244 self.tr('PyPI'), | 2524 self.tr("PyPI"), |
2245 self.tr('PyPI'), | 2525 self.tr("PyPI"), |
2246 QKeySequence(self.tr("Ctrl+Alt+Shift+P")), | 2526 QKeySequence(self.tr("Ctrl+Alt+Shift+P")), |
2247 0, self, | 2527 0, |
2248 'pip_widget_activate') | 2528 self, |
2249 self.pipWidgetActivateAct.setStatusTip(self.tr( | 2529 "pip_widget_activate", |
2250 "Switch the input focus to the PyPI window.")) | 2530 ) |
2251 self.pipWidgetActivateAct.setWhatsThis(self.tr( | 2531 self.pipWidgetActivateAct.setStatusTip( |
2252 """<b>PyPI</b>""" | 2532 self.tr("Switch the input focus to the PyPI window.") |
2253 """<p>This switches the input focus to the PyPI window.</p>""" | 2533 ) |
2254 )) | 2534 self.pipWidgetActivateAct.setWhatsThis( |
2255 self.pipWidgetActivateAct.triggered.connect( | 2535 self.tr( |
2256 self.__activatePipWidget) | 2536 """<b>PyPI</b>""" |
2537 """<p>This switches the input focus to the PyPI window.</p>""" | |
2538 ) | |
2539 ) | |
2540 self.pipWidgetActivateAct.triggered.connect(self.__activatePipWidget) | |
2257 self.actions.append(self.pipWidgetActivateAct) | 2541 self.actions.append(self.pipWidgetActivateAct) |
2258 self.addAction(self.pipWidgetActivateAct) | 2542 self.addAction(self.pipWidgetActivateAct) |
2259 | 2543 |
2260 if self.condaWidget is not None: | 2544 if self.condaWidget is not None: |
2261 self.condaWidgetActivateAct = EricAction( | 2545 self.condaWidgetActivateAct = EricAction( |
2262 self.tr('Conda'), | 2546 self.tr("Conda"), |
2263 self.tr('Conda'), | 2547 self.tr("Conda"), |
2264 QKeySequence(self.tr("Ctrl+Alt+Shift+C")), | 2548 QKeySequence(self.tr("Ctrl+Alt+Shift+C")), |
2265 0, self, | 2549 0, |
2266 'conda_widget_activate') | 2550 self, |
2267 self.condaWidgetActivateAct.setStatusTip(self.tr( | 2551 "conda_widget_activate", |
2268 "Switch the input focus to the Conda window.")) | 2552 ) |
2269 self.condaWidgetActivateAct.setWhatsThis(self.tr( | 2553 self.condaWidgetActivateAct.setStatusTip( |
2270 """<b>Conda</b>""" | 2554 self.tr("Switch the input focus to the Conda window.") |
2271 """<p>This switches the input focus to the Conda window.</p>""" | 2555 ) |
2272 )) | 2556 self.condaWidgetActivateAct.setWhatsThis( |
2273 self.condaWidgetActivateAct.triggered.connect( | 2557 self.tr( |
2274 self.__activateCondaWidget) | 2558 """<b>Conda</b>""" |
2559 """<p>This switches the input focus to the Conda window.</p>""" | |
2560 ) | |
2561 ) | |
2562 self.condaWidgetActivateAct.triggered.connect(self.__activateCondaWidget) | |
2275 self.actions.append(self.condaWidgetActivateAct) | 2563 self.actions.append(self.condaWidgetActivateAct) |
2276 self.addAction(self.condaWidgetActivateAct) | 2564 self.addAction(self.condaWidgetActivateAct) |
2277 | 2565 |
2278 if self.microPythonWidget is not None: | 2566 if self.microPythonWidget is not None: |
2279 self.microPythonWidgetActivateAct = EricAction( | 2567 self.microPythonWidgetActivateAct = EricAction( |
2280 self.tr('MicroPython'), | 2568 self.tr("MicroPython"), |
2281 self.tr('MicroPython'), | 2569 self.tr("MicroPython"), |
2282 QKeySequence(self.tr("Ctrl+Alt+Shift+M")), | 2570 QKeySequence(self.tr("Ctrl+Alt+Shift+M")), |
2283 0, self, | 2571 0, |
2284 'micropython_widget_activate') | 2572 self, |
2285 self.microPythonWidgetActivateAct.setStatusTip(self.tr( | 2573 "micropython_widget_activate", |
2286 "Switch the input focus to the MicroPython window.")) | 2574 ) |
2287 self.microPythonWidgetActivateAct.setWhatsThis(self.tr( | 2575 self.microPythonWidgetActivateAct.setStatusTip( |
2288 """<b>MicroPython</b>""" | 2576 self.tr("Switch the input focus to the MicroPython window.") |
2289 """<p>This switches the input focus to the MicroPython""" | 2577 ) |
2290 """ window.</p>""" | 2578 self.microPythonWidgetActivateAct.setWhatsThis( |
2291 )) | 2579 self.tr( |
2580 """<b>MicroPython</b>""" | |
2581 """<p>This switches the input focus to the MicroPython""" | |
2582 """ window.</p>""" | |
2583 ) | |
2584 ) | |
2292 self.microPythonWidgetActivateAct.triggered.connect( | 2585 self.microPythonWidgetActivateAct.triggered.connect( |
2293 self.__activateMicroPython) | 2586 self.__activateMicroPython |
2587 ) | |
2294 self.actions.append(self.microPythonWidgetActivateAct) | 2588 self.actions.append(self.microPythonWidgetActivateAct) |
2295 self.addAction(self.microPythonWidgetActivateAct) | 2589 self.addAction(self.microPythonWidgetActivateAct) |
2296 | 2590 |
2297 self.pluginRepositoryViewerActivateAct = EricAction( | 2591 self.pluginRepositoryViewerActivateAct = EricAction( |
2298 self.tr('Plugin Repository'), | 2592 self.tr("Plugin Repository"), |
2299 self.tr('Plugin Repository'), | 2593 self.tr("Plugin Repository"), |
2300 QKeySequence(self.tr("Ctrl+Alt+Shift+R")), | 2594 QKeySequence(self.tr("Ctrl+Alt+Shift+R")), |
2301 0, self, | 2595 0, |
2302 'plugin_repository_viewer_activate') | 2596 self, |
2303 self.pluginRepositoryViewerActivateAct.setStatusTip(self.tr( | 2597 "plugin_repository_viewer_activate", |
2304 "Switch the input focus to the Plugin Repository window.")) | 2598 ) |
2305 self.pluginRepositoryViewerActivateAct.setWhatsThis(self.tr( | 2599 self.pluginRepositoryViewerActivateAct.setStatusTip( |
2306 """<b>Plugin Repository</b>""" | 2600 self.tr("Switch the input focus to the Plugin Repository window.") |
2307 """<p>This switches the input focus to the Plugin Repository""" | 2601 ) |
2308 """ window.</p>""" | 2602 self.pluginRepositoryViewerActivateAct.setWhatsThis( |
2309 )) | 2603 self.tr( |
2604 """<b>Plugin Repository</b>""" | |
2605 """<p>This switches the input focus to the Plugin Repository""" | |
2606 """ window.</p>""" | |
2607 ) | |
2608 ) | |
2310 self.pluginRepositoryViewerActivateAct.triggered.connect( | 2609 self.pluginRepositoryViewerActivateAct.triggered.connect( |
2311 self.activatePluginRepositoryViewer) | 2610 self.activatePluginRepositoryViewer |
2611 ) | |
2312 self.actions.append(self.pluginRepositoryViewerActivateAct) | 2612 self.actions.append(self.pluginRepositoryViewerActivateAct) |
2313 self.addAction(self.pluginRepositoryViewerActivateAct) | 2613 self.addAction(self.pluginRepositoryViewerActivateAct) |
2314 | 2614 |
2315 self.virtualenvManagerActivateAct = EricAction( | 2615 self.virtualenvManagerActivateAct = EricAction( |
2316 self.tr('Virtual Environments'), | 2616 self.tr("Virtual Environments"), |
2317 self.tr('Virtual Environments'), | 2617 self.tr("Virtual Environments"), |
2318 QKeySequence(self.tr("Ctrl+Alt+V")), | 2618 QKeySequence(self.tr("Ctrl+Alt+V")), |
2319 0, self, | 2619 0, |
2320 'virtualenv_manager_activate') | 2620 self, |
2321 self.virtualenvManagerActivateAct.setStatusTip(self.tr( | 2621 "virtualenv_manager_activate", |
2322 "Switch the input focus to the Virtual Environments Manager" | 2622 ) |
2323 " window.")) | 2623 self.virtualenvManagerActivateAct.setStatusTip( |
2324 self.virtualenvManagerActivateAct.setWhatsThis(self.tr( | 2624 self.tr( |
2325 """<b>Virtual Environments</b>""" | 2625 "Switch the input focus to the Virtual Environments Manager" " window." |
2326 """<p>This switches the input focus to the Virtual Environments""" | 2626 ) |
2327 """ Manager window.</p>""" | 2627 ) |
2328 )) | 2628 self.virtualenvManagerActivateAct.setWhatsThis( |
2629 self.tr( | |
2630 """<b>Virtual Environments</b>""" | |
2631 """<p>This switches the input focus to the Virtual Environments""" | |
2632 """ Manager window.</p>""" | |
2633 ) | |
2634 ) | |
2329 self.virtualenvManagerActivateAct.triggered.connect( | 2635 self.virtualenvManagerActivateAct.triggered.connect( |
2330 self.activateVirtualenvManager) | 2636 self.activateVirtualenvManager |
2637 ) | |
2331 self.actions.append(self.virtualenvManagerActivateAct) | 2638 self.actions.append(self.virtualenvManagerActivateAct) |
2332 self.addAction(self.virtualenvManagerActivateAct) | 2639 self.addAction(self.virtualenvManagerActivateAct) |
2333 | 2640 |
2334 if self.__findFileWidget is not None: | 2641 if self.__findFileWidget is not None: |
2335 self.findFileActivateAct = EricAction( | 2642 self.findFileActivateAct = EricAction( |
2336 self.tr("Find/Replace In Files"), | 2643 self.tr("Find/Replace In Files"), |
2337 self.tr("Find/Replace In Files"), | 2644 self.tr("Find/Replace In Files"), |
2338 QKeySequence(self.tr("Ctrl+Alt+Shift+F")), | 2645 QKeySequence(self.tr("Ctrl+Alt+Shift+F")), |
2339 0, self, | 2646 0, |
2340 'find_file_activate') | 2647 self, |
2341 self.findFileActivateAct.setStatusTip(self.tr( | 2648 "find_file_activate", |
2342 "Switch the input focus to the Find/Replace In Files window.")) | 2649 ) |
2343 self.findFileActivateAct.setWhatsThis(self.tr( | 2650 self.findFileActivateAct.setStatusTip( |
2344 """<b>Find/Replace In Files</b>""" | 2651 self.tr("Switch the input focus to the Find/Replace In Files window.") |
2345 """<p>This switches the input focus to the Find/Replace In""" | 2652 ) |
2346 """ Files window.</p>""" | 2653 self.findFileActivateAct.setWhatsThis( |
2347 )) | 2654 self.tr( |
2348 self.findFileActivateAct.triggered.connect( | 2655 """<b>Find/Replace In Files</b>""" |
2349 self.__activateFindFileWidget) | 2656 """<p>This switches the input focus to the Find/Replace In""" |
2657 """ Files window.</p>""" | |
2658 ) | |
2659 ) | |
2660 self.findFileActivateAct.triggered.connect(self.__activateFindFileWidget) | |
2350 self.actions.append(self.findFileActivateAct) | 2661 self.actions.append(self.findFileActivateAct) |
2351 self.addAction(self.findFileActivateAct) | 2662 self.addAction(self.findFileActivateAct) |
2352 | 2663 |
2353 if self.__findLocationWidget is not None: | 2664 if self.__findLocationWidget is not None: |
2354 self.findLocationActivateAct = EricAction( | 2665 self.findLocationActivateAct = EricAction( |
2355 self.tr("Find File"), | 2666 self.tr("Find File"), |
2356 self.tr("Find File"), | 2667 self.tr("Find File"), |
2357 QKeySequence(self.tr("Ctrl+Alt+Shift+L")), | 2668 QKeySequence(self.tr("Ctrl+Alt+Shift+L")), |
2358 0, self, | 2669 0, |
2359 'find_location_activate') | 2670 self, |
2360 self.findLocationActivateAct.setStatusTip(self.tr( | 2671 "find_location_activate", |
2361 "Switch the input focus to the Find File window.")) | 2672 ) |
2362 self.findLocationActivateAct.setWhatsThis(self.tr( | 2673 self.findLocationActivateAct.setStatusTip( |
2363 """<b>Find File</b>""" | 2674 self.tr("Switch the input focus to the Find File window.") |
2364 """<p>This switches the input focus to the Find File window.""" | 2675 ) |
2365 """</p>""" | 2676 self.findLocationActivateAct.setWhatsThis( |
2366 )) | 2677 self.tr( |
2678 """<b>Find File</b>""" | |
2679 """<p>This switches the input focus to the Find File window.""" | |
2680 """</p>""" | |
2681 ) | |
2682 ) | |
2367 self.findLocationActivateAct.triggered.connect( | 2683 self.findLocationActivateAct.triggered.connect( |
2368 self.__activateFindLocationWidget) | 2684 self.__activateFindLocationWidget |
2685 ) | |
2369 self.actions.append(self.findLocationActivateAct) | 2686 self.actions.append(self.findLocationActivateAct) |
2370 self.addAction(self.findLocationActivateAct) | 2687 self.addAction(self.findLocationActivateAct) |
2371 | 2688 |
2372 self.vcsStatusListActivateAct = EricAction( | 2689 self.vcsStatusListActivateAct = EricAction( |
2373 self.tr("VCS Status List"), | 2690 self.tr("VCS Status List"), |
2374 self.tr("VCS Status List"), | 2691 self.tr("VCS Status List"), |
2375 QKeySequence(self.tr("Alt+Shift+V")), | 2692 QKeySequence(self.tr("Alt+Shift+V")), |
2376 0, self, | 2693 0, |
2377 'vcs_status_list_activate') | 2694 self, |
2378 self.vcsStatusListActivateAct.setStatusTip(self.tr( | 2695 "vcs_status_list_activate", |
2379 "Switch the input focus to the VCS Status List window.")) | 2696 ) |
2380 self.vcsStatusListActivateAct.setWhatsThis(self.tr( | 2697 self.vcsStatusListActivateAct.setStatusTip( |
2381 """<b>VCS Status List</b>""" | 2698 self.tr("Switch the input focus to the VCS Status List window.") |
2382 """<p>This switches the input focus to the VCS Status List""" | 2699 ) |
2383 """ window.</p>""" | 2700 self.vcsStatusListActivateAct.setWhatsThis( |
2384 )) | 2701 self.tr( |
2385 self.vcsStatusListActivateAct.triggered.connect( | 2702 """<b>VCS Status List</b>""" |
2386 self.__activateVcsStatusList) | 2703 """<p>This switches the input focus to the VCS Status List""" |
2704 """ window.</p>""" | |
2705 ) | |
2706 ) | |
2707 self.vcsStatusListActivateAct.triggered.connect(self.__activateVcsStatusList) | |
2387 self.actions.append(self.vcsStatusListActivateAct) | 2708 self.actions.append(self.vcsStatusListActivateAct) |
2388 self.addAction(self.vcsStatusListActivateAct) | 2709 self.addAction(self.vcsStatusListActivateAct) |
2389 | 2710 |
2390 self.helpViewerActivateAct = EricAction( | 2711 self.helpViewerActivateAct = EricAction( |
2391 self.tr("Help Viewer"), | 2712 self.tr("Help Viewer"), |
2392 self.tr("Help Viewer"), | 2713 self.tr("Help Viewer"), |
2393 QKeySequence(self.tr("Alt+Shift+H")), | 2714 QKeySequence(self.tr("Alt+Shift+H")), |
2394 0, self, | 2715 0, |
2395 'help_viewer_activate') | 2716 self, |
2396 self.helpViewerActivateAct.setStatusTip(self.tr( | 2717 "help_viewer_activate", |
2397 "Switch the input focus to the embedded Help Viewer window.")) | 2718 ) |
2398 self.helpViewerActivateAct.setWhatsThis(self.tr( | 2719 self.helpViewerActivateAct.setStatusTip( |
2399 """<b>Help Viewer</b>""" | 2720 self.tr("Switch the input focus to the embedded Help Viewer window.") |
2400 """<p>This switches the input focus to the embedded Help Viewer""" | 2721 ) |
2401 """ window. It will show HTML help files and help from Qt help""" | 2722 self.helpViewerActivateAct.setWhatsThis( |
2402 """ collections.</p><p>If called with a word selected, this word""" | 2723 self.tr( |
2403 """ is searched in the Qt help collection.</p>""" | 2724 """<b>Help Viewer</b>""" |
2404 )) | 2725 """<p>This switches the input focus to the embedded Help Viewer""" |
2405 self.helpViewerActivateAct.triggered.connect( | 2726 """ window. It will show HTML help files and help from Qt help""" |
2406 self.__activateHelpViewerWidget) | 2727 """ collections.</p><p>If called with a word selected, this word""" |
2728 """ is searched in the Qt help collection.</p>""" | |
2729 ) | |
2730 ) | |
2731 self.helpViewerActivateAct.triggered.connect(self.__activateHelpViewerWidget) | |
2407 self.actions.append(self.helpViewerActivateAct) | 2732 self.actions.append(self.helpViewerActivateAct) |
2408 self.addAction(self.helpViewerActivateAct) | 2733 self.addAction(self.helpViewerActivateAct) |
2409 | 2734 |
2410 self.whatsThisAct = EricAction( | 2735 self.whatsThisAct = EricAction( |
2411 self.tr('What\'s This?'), | 2736 self.tr("What's This?"), |
2412 UI.PixmapCache.getIcon("whatsThis"), | 2737 UI.PixmapCache.getIcon("whatsThis"), |
2413 self.tr('&What\'s This?'), | 2738 self.tr("&What's This?"), |
2414 QKeySequence(self.tr("Shift+F1")), | 2739 QKeySequence(self.tr("Shift+F1")), |
2415 0, self, 'whatsThis') | 2740 0, |
2416 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) | 2741 self, |
2417 self.whatsThisAct.setWhatsThis(self.tr( | 2742 "whatsThis", |
2418 """<b>Display context sensitive help</b>""" | 2743 ) |
2419 """<p>In What's This? mode, the mouse cursor shows an arrow with""" | 2744 self.whatsThisAct.setStatusTip(self.tr("Context sensitive help")) |
2420 """ a question mark, and you can click on the interface elements""" | 2745 self.whatsThisAct.setWhatsThis( |
2421 """ to get a short description of what they do and how to use""" | 2746 self.tr( |
2422 """ them. In dialogs, this feature can be accessed using the""" | 2747 """<b>Display context sensitive help</b>""" |
2423 """ context help button in the titlebar.</p>""" | 2748 """<p>In What's This? mode, the mouse cursor shows an arrow with""" |
2424 )) | 2749 """ a question mark, and you can click on the interface elements""" |
2750 """ to get a short description of what they do and how to use""" | |
2751 """ them. In dialogs, this feature can be accessed using the""" | |
2752 """ context help button in the titlebar.</p>""" | |
2753 ) | |
2754 ) | |
2425 self.whatsThisAct.triggered.connect(self.__whatsThis) | 2755 self.whatsThisAct.triggered.connect(self.__whatsThis) |
2426 self.actions.append(self.whatsThisAct) | 2756 self.actions.append(self.whatsThisAct) |
2427 | 2757 |
2428 self.helpviewerAct = EricAction( | 2758 self.helpviewerAct = EricAction( |
2429 self.tr('Helpviewer'), | 2759 self.tr("Helpviewer"), |
2430 UI.PixmapCache.getIcon("help"), | 2760 UI.PixmapCache.getIcon("help"), |
2431 self.tr('&Helpviewer...'), | 2761 self.tr("&Helpviewer..."), |
2432 QKeySequence(self.tr("F1")), | 2762 QKeySequence(self.tr("F1")), |
2433 0, self, 'helpviewer') | 2763 0, |
2434 self.helpviewerAct.setStatusTip(self.tr( | 2764 self, |
2435 'Open the helpviewer window')) | 2765 "helpviewer", |
2436 self.helpviewerAct.setWhatsThis(self.tr( | 2766 ) |
2437 """<b>Helpviewer</b>""" | 2767 self.helpviewerAct.setStatusTip(self.tr("Open the helpviewer window")) |
2438 """<p>Display the eric web browser. This window will show""" | 2768 self.helpviewerAct.setWhatsThis( |
2439 """ HTML help files and help from Qt help collections. It""" | 2769 self.tr( |
2440 """ has the capability to navigate to links, set bookmarks,""" | 2770 """<b>Helpviewer</b>""" |
2441 """ print the displayed help and some more features. You may""" | 2771 """<p>Display the eric web browser. This window will show""" |
2442 """ use it to browse the internet as well</p><p>If called""" | 2772 """ HTML help files and help from Qt help collections. It""" |
2443 """ with a word selected, this word is searched in the Qt help""" | 2773 """ has the capability to navigate to links, set bookmarks,""" |
2444 """ collection.</p>""" | 2774 """ print the displayed help and some more features. You may""" |
2445 )) | 2775 """ use it to browse the internet as well</p><p>If called""" |
2776 """ with a word selected, this word is searched in the Qt help""" | |
2777 """ collection.</p>""" | |
2778 ) | |
2779 ) | |
2446 self.helpviewerAct.triggered.connect(self.__helpViewer) | 2780 self.helpviewerAct.triggered.connect(self.__helpViewer) |
2447 self.actions.append(self.helpviewerAct) | 2781 self.actions.append(self.helpviewerAct) |
2448 | 2782 |
2449 self.__initQtDocActions() | 2783 self.__initQtDocActions() |
2450 self.__initPythonDocActions() | 2784 self.__initPythonDocActions() |
2451 self.__initEricDocAction() | 2785 self.__initEricDocAction() |
2452 self.__initPySideDocActions() | 2786 self.__initPySideDocActions() |
2453 | 2787 |
2454 self.versionAct = EricAction( | 2788 self.versionAct = EricAction( |
2455 self.tr('Show Versions'), | 2789 self.tr("Show Versions"), |
2456 self.tr('Show &Versions'), | 2790 self.tr("Show &Versions"), |
2457 0, 0, self, 'show_versions') | 2791 0, |
2458 self.versionAct.setStatusTip(self.tr( | 2792 0, |
2459 'Display version information')) | 2793 self, |
2460 self.versionAct.setWhatsThis(self.tr( | 2794 "show_versions", |
2461 """<b>Show Versions</b>""" | 2795 ) |
2462 """<p>Display version information.</p>""" | 2796 self.versionAct.setStatusTip(self.tr("Display version information")) |
2463 )) | 2797 self.versionAct.setWhatsThis( |
2798 self.tr( | |
2799 """<b>Show Versions</b>""" """<p>Display version information.</p>""" | |
2800 ) | |
2801 ) | |
2464 self.versionAct.triggered.connect(self.__showVersions) | 2802 self.versionAct.triggered.connect(self.__showVersions) |
2465 self.actions.append(self.versionAct) | 2803 self.actions.append(self.versionAct) |
2466 | 2804 |
2467 self.showErrorLogAct = EricAction( | 2805 self.showErrorLogAct = EricAction( |
2468 self.tr('Show Error Log'), | 2806 self.tr("Show Error Log"), |
2469 self.tr('Show Error &Log...'), | 2807 self.tr("Show Error &Log..."), |
2470 0, 0, self, 'show_error_log') | 2808 0, |
2471 self.showErrorLogAct.setStatusTip(self.tr('Show Error Log')) | 2809 0, |
2472 self.showErrorLogAct.setWhatsThis(self.tr( | 2810 self, |
2473 """<b>Show Error Log...</b>""" | 2811 "show_error_log", |
2474 """<p>Opens a dialog showing the most recent error log.</p>""" | 2812 ) |
2475 )) | 2813 self.showErrorLogAct.setStatusTip(self.tr("Show Error Log")) |
2814 self.showErrorLogAct.setWhatsThis( | |
2815 self.tr( | |
2816 """<b>Show Error Log...</b>""" | |
2817 """<p>Opens a dialog showing the most recent error log.</p>""" | |
2818 ) | |
2819 ) | |
2476 self.showErrorLogAct.triggered.connect(self.__showErrorLog) | 2820 self.showErrorLogAct.triggered.connect(self.__showErrorLog) |
2477 self.actions.append(self.showErrorLogAct) | 2821 self.actions.append(self.showErrorLogAct) |
2478 | 2822 |
2479 self.showInstallInfoAct = EricAction( | 2823 self.showInstallInfoAct = EricAction( |
2480 self.tr('Show Install Info'), | 2824 self.tr("Show Install Info"), |
2481 self.tr('Show Install &Info...'), | 2825 self.tr("Show Install &Info..."), |
2482 0, 0, self, 'show_install_info') | 2826 0, |
2483 self.showInstallInfoAct.setStatusTip(self.tr( | 2827 0, |
2484 'Show Installation Information')) | 2828 self, |
2485 self.showInstallInfoAct.setWhatsThis(self.tr( | 2829 "show_install_info", |
2486 """<b>Show Install Info...</b>""" | 2830 ) |
2487 """<p>Opens a dialog showing some information about the""" | 2831 self.showInstallInfoAct.setStatusTip(self.tr("Show Installation Information")) |
2488 """ installation process.</p>""" | 2832 self.showInstallInfoAct.setWhatsThis( |
2489 )) | 2833 self.tr( |
2834 """<b>Show Install Info...</b>""" | |
2835 """<p>Opens a dialog showing some information about the""" | |
2836 """ installation process.</p>""" | |
2837 ) | |
2838 ) | |
2490 self.showInstallInfoAct.triggered.connect(self.__showInstallInfo) | 2839 self.showInstallInfoAct.triggered.connect(self.__showInstallInfo) |
2491 self.actions.append(self.showInstallInfoAct) | 2840 self.actions.append(self.showInstallInfoAct) |
2492 | 2841 |
2493 self.reportBugAct = EricAction( | 2842 self.reportBugAct = EricAction( |
2494 self.tr('Report Bug'), | 2843 self.tr("Report Bug"), self.tr("Report &Bug..."), 0, 0, self, "report_bug" |
2495 self.tr('Report &Bug...'), | 2844 ) |
2496 0, 0, self, 'report_bug') | 2845 self.reportBugAct.setStatusTip(self.tr("Report a bug")) |
2497 self.reportBugAct.setStatusTip(self.tr('Report a bug')) | 2846 self.reportBugAct.setWhatsThis( |
2498 self.reportBugAct.setWhatsThis(self.tr( | 2847 self.tr( |
2499 """<b>Report Bug...</b>""" | 2848 """<b>Report Bug...</b>""" """<p>Opens a dialog to report a bug.</p>""" |
2500 """<p>Opens a dialog to report a bug.</p>""" | 2849 ) |
2501 )) | 2850 ) |
2502 self.reportBugAct.triggered.connect(self.__reportBug) | 2851 self.reportBugAct.triggered.connect(self.__reportBug) |
2503 self.actions.append(self.reportBugAct) | 2852 self.actions.append(self.reportBugAct) |
2504 | 2853 |
2505 self.requestFeatureAct = EricAction( | 2854 self.requestFeatureAct = EricAction( |
2506 self.tr('Request Feature'), | 2855 self.tr("Request Feature"), |
2507 self.tr('Request &Feature...'), | 2856 self.tr("Request &Feature..."), |
2508 0, 0, self, 'request_feature') | 2857 0, |
2509 self.requestFeatureAct.setStatusTip(self.tr( | 2858 0, |
2510 'Send a feature request')) | 2859 self, |
2511 self.requestFeatureAct.setWhatsThis(self.tr( | 2860 "request_feature", |
2512 """<b>Request Feature...</b>""" | 2861 ) |
2513 """<p>Opens a dialog to send a feature request.</p>""" | 2862 self.requestFeatureAct.setStatusTip(self.tr("Send a feature request")) |
2514 )) | 2863 self.requestFeatureAct.setWhatsThis( |
2864 self.tr( | |
2865 """<b>Request Feature...</b>""" | |
2866 """<p>Opens a dialog to send a feature request.</p>""" | |
2867 ) | |
2868 ) | |
2515 self.requestFeatureAct.triggered.connect(self.__requestFeature) | 2869 self.requestFeatureAct.triggered.connect(self.__requestFeature) |
2516 self.actions.append(self.requestFeatureAct) | 2870 self.actions.append(self.requestFeatureAct) |
2517 | 2871 |
2518 self.testingActGrp = createActionGroup(self) | 2872 self.testingActGrp = createActionGroup(self) |
2519 | 2873 |
2520 self.testingDialogAct = EricAction( | 2874 self.testingDialogAct = EricAction( |
2521 self.tr('Testing'), | 2875 self.tr("Testing"), |
2522 UI.PixmapCache.getIcon("unittest"), | 2876 UI.PixmapCache.getIcon("unittest"), |
2523 self.tr('&Testing...'), | 2877 self.tr("&Testing..."), |
2524 0, 0, self.testingActGrp, 'unittest') | 2878 0, |
2525 self.testingDialogAct.setStatusTip(self.tr('Start the testing dialog')) | 2879 0, |
2526 self.testingDialogAct.setWhatsThis(self.tr( | 2880 self.testingActGrp, |
2527 """<b>Testing</b>""" | 2881 "unittest", |
2528 """<p>Perform test runs. The dialog gives the""" | 2882 ) |
2529 """ ability to select and run a test suite or""" | 2883 self.testingDialogAct.setStatusTip(self.tr("Start the testing dialog")) |
2530 """ auto discover them.</p>""" | 2884 self.testingDialogAct.setWhatsThis( |
2531 )) | 2885 self.tr( |
2886 """<b>Testing</b>""" | |
2887 """<p>Perform test runs. The dialog gives the""" | |
2888 """ ability to select and run a test suite or""" | |
2889 """ auto discover them.</p>""" | |
2890 ) | |
2891 ) | |
2532 self.testingDialogAct.triggered.connect(self.__startTesting) | 2892 self.testingDialogAct.triggered.connect(self.__startTesting) |
2533 self.actions.append(self.testingDialogAct) | 2893 self.actions.append(self.testingDialogAct) |
2534 | 2894 |
2535 self.restartTestAct = EricAction( | 2895 self.restartTestAct = EricAction( |
2536 self.tr('Restart Last Test'), | 2896 self.tr("Restart Last Test"), |
2537 UI.PixmapCache.getIcon("unittestRestart"), | 2897 UI.PixmapCache.getIcon("unittestRestart"), |
2538 self.tr('&Restart Last Test...'), | 2898 self.tr("&Restart Last Test..."), |
2539 0, 0, self.testingActGrp, 'unittest_restart') | 2899 0, |
2540 self.restartTestAct.setStatusTip(self.tr('Restarts the last test')) | 2900 0, |
2541 self.restartTestAct.setWhatsThis(self.tr( | 2901 self.testingActGrp, |
2542 """<b>Restart Last Test</b>""" | 2902 "unittest_restart", |
2543 """<p>Restarts the test performed last.</p>""" | 2903 ) |
2544 )) | 2904 self.restartTestAct.setStatusTip(self.tr("Restarts the last test")) |
2905 self.restartTestAct.setWhatsThis( | |
2906 self.tr( | |
2907 """<b>Restart Last Test</b>""" | |
2908 """<p>Restarts the test performed last.</p>""" | |
2909 ) | |
2910 ) | |
2545 self.restartTestAct.triggered.connect(self.__restartTest) | 2911 self.restartTestAct.triggered.connect(self.__restartTest) |
2546 self.restartTestAct.setEnabled(False) | 2912 self.restartTestAct.setEnabled(False) |
2547 self.actions.append(self.restartTestAct) | 2913 self.actions.append(self.restartTestAct) |
2548 | 2914 |
2549 self.rerunFailedTestsAct = EricAction( | 2915 self.rerunFailedTestsAct = EricAction( |
2550 self.tr('Rerun Failed Tests'), | 2916 self.tr("Rerun Failed Tests"), |
2551 UI.PixmapCache.getIcon("unittestRerunFailed"), | 2917 UI.PixmapCache.getIcon("unittestRerunFailed"), |
2552 self.tr('Rerun Failed Tests...'), | 2918 self.tr("Rerun Failed Tests..."), |
2553 0, 0, self.testingActGrp, 'unittest_rerun_failed') | 2919 0, |
2554 self.rerunFailedTestsAct.setStatusTip(self.tr( | 2920 0, |
2555 'Rerun failed tests of the last run')) | 2921 self.testingActGrp, |
2556 self.rerunFailedTestsAct.setWhatsThis(self.tr( | 2922 "unittest_rerun_failed", |
2557 """<b>Rerun Failed Tests</b>""" | 2923 ) |
2558 """<p>Rerun all tests that failed during the last test run.</p>""" | 2924 self.rerunFailedTestsAct.setStatusTip( |
2559 )) | 2925 self.tr("Rerun failed tests of the last run") |
2926 ) | |
2927 self.rerunFailedTestsAct.setWhatsThis( | |
2928 self.tr( | |
2929 """<b>Rerun Failed Tests</b>""" | |
2930 """<p>Rerun all tests that failed during the last test run.</p>""" | |
2931 ) | |
2932 ) | |
2560 self.rerunFailedTestsAct.triggered.connect(self.__rerunFailedTests) | 2933 self.rerunFailedTestsAct.triggered.connect(self.__rerunFailedTests) |
2561 self.rerunFailedTestsAct.setEnabled(False) | 2934 self.rerunFailedTestsAct.setEnabled(False) |
2562 self.actions.append(self.rerunFailedTestsAct) | 2935 self.actions.append(self.rerunFailedTestsAct) |
2563 | 2936 |
2564 self.testScriptAct = EricAction( | 2937 self.testScriptAct = EricAction( |
2565 self.tr('Test Script'), | 2938 self.tr("Test Script"), |
2566 UI.PixmapCache.getIcon("unittestScript"), | 2939 UI.PixmapCache.getIcon("unittestScript"), |
2567 self.tr('Test &Script...'), | 2940 self.tr("Test &Script..."), |
2568 0, 0, self.testingActGrp, 'unittest_script') | 2941 0, |
2569 self.testScriptAct.setStatusTip(self.tr( | 2942 0, |
2570 'Run tests of the current script')) | 2943 self.testingActGrp, |
2571 self.testScriptAct.setWhatsThis(self.tr( | 2944 "unittest_script", |
2572 """<b>Test Script</b>""" | 2945 ) |
2573 """<p>Run tests with the current script.</p>""" | 2946 self.testScriptAct.setStatusTip(self.tr("Run tests of the current script")) |
2574 )) | 2947 self.testScriptAct.setWhatsThis( |
2948 self.tr( | |
2949 """<b>Test Script</b>""" """<p>Run tests with the current script.</p>""" | |
2950 ) | |
2951 ) | |
2575 self.testScriptAct.triggered.connect(self.__startTestScript) | 2952 self.testScriptAct.triggered.connect(self.__startTestScript) |
2576 self.testScriptAct.setEnabled(False) | 2953 self.testScriptAct.setEnabled(False) |
2577 self.actions.append(self.testScriptAct) | 2954 self.actions.append(self.testScriptAct) |
2578 | 2955 |
2579 self.testProjectAct = EricAction( | 2956 self.testProjectAct = EricAction( |
2580 self.tr('Test Project'), | 2957 self.tr("Test Project"), |
2581 UI.PixmapCache.getIcon("unittestProject"), | 2958 UI.PixmapCache.getIcon("unittestProject"), |
2582 self.tr('Test &Project...'), | 2959 self.tr("Test &Project..."), |
2583 0, 0, self.testingActGrp, 'unittest_project') | 2960 0, |
2584 self.testProjectAct.setStatusTip(self.tr( | 2961 0, |
2585 'Run tests of the current project')) | 2962 self.testingActGrp, |
2586 self.testProjectAct.setWhatsThis(self.tr( | 2963 "unittest_project", |
2587 """<b>Test Project</b>""" | 2964 ) |
2588 """<p>Run test of the current project.</p>""" | 2965 self.testProjectAct.setStatusTip(self.tr("Run tests of the current project")) |
2589 )) | 2966 self.testProjectAct.setWhatsThis( |
2967 self.tr( | |
2968 """<b>Test Project</b>""" """<p>Run test of the current project.</p>""" | |
2969 ) | |
2970 ) | |
2590 self.testProjectAct.triggered.connect(self.__startTestProject) | 2971 self.testProjectAct.triggered.connect(self.__startTestProject) |
2591 self.testProjectAct.setEnabled(False) | 2972 self.testProjectAct.setEnabled(False) |
2592 self.actions.append(self.testProjectAct) | 2973 self.actions.append(self.testProjectAct) |
2593 | 2974 |
2594 # check for Qt5 designer and linguist | 2975 # check for Qt5 designer and linguist |
2595 if Utilities.isWindowsPlatform(): | 2976 if Utilities.isWindowsPlatform(): |
2596 designerExe = os.path.join( | 2977 designerExe = os.path.join( |
2597 Utilities.getQtBinariesPath(), | 2978 Utilities.getQtBinariesPath(), |
2598 "{0}.exe".format(Utilities.generateQtToolName("designer"))) | 2979 "{0}.exe".format(Utilities.generateQtToolName("designer")), |
2980 ) | |
2599 elif Utilities.isMacPlatform(): | 2981 elif Utilities.isMacPlatform(): |
2600 designerExe = Utilities.getQtMacBundle("designer") | 2982 designerExe = Utilities.getQtMacBundle("designer") |
2601 else: | 2983 else: |
2602 designerExe = os.path.join( | 2984 designerExe = os.path.join( |
2603 Utilities.getQtBinariesPath(), | 2985 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer") |
2604 Utilities.generateQtToolName("designer")) | 2986 ) |
2605 if os.path.exists(designerExe): | 2987 if os.path.exists(designerExe): |
2606 self.designer4Act = EricAction( | 2988 self.designer4Act = EricAction( |
2607 self.tr('Qt-Designer'), | 2989 self.tr("Qt-Designer"), |
2608 UI.PixmapCache.getIcon("designer4"), | 2990 UI.PixmapCache.getIcon("designer4"), |
2609 self.tr('Qt-&Designer...'), | 2991 self.tr("Qt-&Designer..."), |
2610 0, 0, self, 'qt_designer4') | 2992 0, |
2611 self.designer4Act.setStatusTip(self.tr('Start Qt-Designer')) | 2993 0, |
2612 self.designer4Act.setWhatsThis(self.tr( | 2994 self, |
2613 """<b>Qt-Designer</b>""" | 2995 "qt_designer4", |
2614 """<p>Start Qt-Designer.</p>""" | 2996 ) |
2615 )) | 2997 self.designer4Act.setStatusTip(self.tr("Start Qt-Designer")) |
2998 self.designer4Act.setWhatsThis( | |
2999 self.tr("""<b>Qt-Designer</b>""" """<p>Start Qt-Designer.</p>""") | |
3000 ) | |
2616 self.designer4Act.triggered.connect(self.__designer) | 3001 self.designer4Act.triggered.connect(self.__designer) |
2617 self.actions.append(self.designer4Act) | 3002 self.actions.append(self.designer4Act) |
2618 else: | 3003 else: |
2619 self.designer4Act = None | 3004 self.designer4Act = None |
2620 | 3005 |
2621 if Utilities.isWindowsPlatform(): | 3006 if Utilities.isWindowsPlatform(): |
2622 linguistExe = os.path.join( | 3007 linguistExe = os.path.join( |
2623 Utilities.getQtBinariesPath(), | 3008 Utilities.getQtBinariesPath(), |
2624 "{0}.exe".format(Utilities.generateQtToolName("linguist"))) | 3009 "{0}.exe".format(Utilities.generateQtToolName("linguist")), |
3010 ) | |
2625 elif Utilities.isMacPlatform(): | 3011 elif Utilities.isMacPlatform(): |
2626 linguistExe = Utilities.getQtMacBundle("linguist") | 3012 linguistExe = Utilities.getQtMacBundle("linguist") |
2627 else: | 3013 else: |
2628 linguistExe = os.path.join( | 3014 linguistExe = os.path.join( |
2629 Utilities.getQtBinariesPath(), | 3015 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist") |
2630 Utilities.generateQtToolName("linguist")) | 3016 ) |
2631 if os.path.exists(linguistExe): | 3017 if os.path.exists(linguistExe): |
2632 self.linguist4Act = EricAction( | 3018 self.linguist4Act = EricAction( |
2633 self.tr('Qt-Linguist'), | 3019 self.tr("Qt-Linguist"), |
2634 UI.PixmapCache.getIcon("linguist4"), | 3020 UI.PixmapCache.getIcon("linguist4"), |
2635 self.tr('Qt-&Linguist...'), | 3021 self.tr("Qt-&Linguist..."), |
2636 0, 0, self, 'qt_linguist4') | 3022 0, |
2637 self.linguist4Act.setStatusTip(self.tr('Start Qt-Linguist')) | 3023 0, |
2638 self.linguist4Act.setWhatsThis(self.tr( | 3024 self, |
2639 """<b>Qt-Linguist</b>""" | 3025 "qt_linguist4", |
2640 """<p>Start Qt-Linguist.</p>""" | 3026 ) |
2641 )) | 3027 self.linguist4Act.setStatusTip(self.tr("Start Qt-Linguist")) |
3028 self.linguist4Act.setWhatsThis( | |
3029 self.tr("""<b>Qt-Linguist</b>""" """<p>Start Qt-Linguist.</p>""") | |
3030 ) | |
2642 self.linguist4Act.triggered.connect(self.__linguist) | 3031 self.linguist4Act.triggered.connect(self.__linguist) |
2643 self.actions.append(self.linguist4Act) | 3032 self.actions.append(self.linguist4Act) |
2644 else: | 3033 else: |
2645 self.linguist4Act = None | 3034 self.linguist4Act = None |
2646 | 3035 |
2647 self.uipreviewerAct = EricAction( | 3036 self.uipreviewerAct = EricAction( |
2648 self.tr('UI Previewer'), | 3037 self.tr("UI Previewer"), |
2649 UI.PixmapCache.getIcon("uiPreviewer"), | 3038 UI.PixmapCache.getIcon("uiPreviewer"), |
2650 self.tr('&UI Previewer...'), | 3039 self.tr("&UI Previewer..."), |
2651 0, 0, self, 'ui_previewer') | 3040 0, |
2652 self.uipreviewerAct.setStatusTip(self.tr('Start the UI Previewer')) | 3041 0, |
2653 self.uipreviewerAct.setWhatsThis(self.tr( | 3042 self, |
2654 """<b>UI Previewer</b>""" | 3043 "ui_previewer", |
2655 """<p>Start the UI Previewer.</p>""" | 3044 ) |
2656 )) | 3045 self.uipreviewerAct.setStatusTip(self.tr("Start the UI Previewer")) |
3046 self.uipreviewerAct.setWhatsThis( | |
3047 self.tr("""<b>UI Previewer</b>""" """<p>Start the UI Previewer.</p>""") | |
3048 ) | |
2657 self.uipreviewerAct.triggered.connect(self.__UIPreviewer) | 3049 self.uipreviewerAct.triggered.connect(self.__UIPreviewer) |
2658 self.actions.append(self.uipreviewerAct) | 3050 self.actions.append(self.uipreviewerAct) |
2659 | 3051 |
2660 self.trpreviewerAct = EricAction( | 3052 self.trpreviewerAct = EricAction( |
2661 self.tr('Translations Previewer'), | 3053 self.tr("Translations Previewer"), |
2662 UI.PixmapCache.getIcon("trPreviewer"), | 3054 UI.PixmapCache.getIcon("trPreviewer"), |
2663 self.tr('&Translations Previewer...'), | 3055 self.tr("&Translations Previewer..."), |
2664 0, 0, self, 'tr_previewer') | 3056 0, |
2665 self.trpreviewerAct.setStatusTip(self.tr( | 3057 0, |
2666 'Start the Translations Previewer')) | 3058 self, |
2667 self.trpreviewerAct.setWhatsThis(self.tr( | 3059 "tr_previewer", |
2668 """<b>Translations Previewer</b>""" | 3060 ) |
2669 """<p>Start the Translations Previewer.</p>""" | 3061 self.trpreviewerAct.setStatusTip(self.tr("Start the Translations Previewer")) |
2670 )) | 3062 self.trpreviewerAct.setWhatsThis( |
3063 self.tr( | |
3064 """<b>Translations Previewer</b>""" | |
3065 """<p>Start the Translations Previewer.</p>""" | |
3066 ) | |
3067 ) | |
2671 self.trpreviewerAct.triggered.connect(self.__TRPreviewer) | 3068 self.trpreviewerAct.triggered.connect(self.__TRPreviewer) |
2672 self.actions.append(self.trpreviewerAct) | 3069 self.actions.append(self.trpreviewerAct) |
2673 | 3070 |
2674 self.diffAct = EricAction( | 3071 self.diffAct = EricAction( |
2675 self.tr('Compare Files'), | 3072 self.tr("Compare Files"), |
2676 UI.PixmapCache.getIcon("diffFiles"), | 3073 UI.PixmapCache.getIcon("diffFiles"), |
2677 self.tr('&Compare Files...'), | 3074 self.tr("&Compare Files..."), |
2678 0, 0, self, 'diff_files') | 3075 0, |
2679 self.diffAct.setStatusTip(self.tr('Compare two files')) | 3076 0, |
2680 self.diffAct.setWhatsThis(self.tr( | 3077 self, |
2681 """<b>Compare Files</b>""" | 3078 "diff_files", |
2682 """<p>Open a dialog to compare two files.</p>""" | 3079 ) |
2683 )) | 3080 self.diffAct.setStatusTip(self.tr("Compare two files")) |
3081 self.diffAct.setWhatsThis( | |
3082 self.tr( | |
3083 """<b>Compare Files</b>""" | |
3084 """<p>Open a dialog to compare two files.</p>""" | |
3085 ) | |
3086 ) | |
2684 self.diffAct.triggered.connect(self.__compareFiles) | 3087 self.diffAct.triggered.connect(self.__compareFiles) |
2685 self.actions.append(self.diffAct) | 3088 self.actions.append(self.diffAct) |
2686 | 3089 |
2687 self.compareAct = EricAction( | 3090 self.compareAct = EricAction( |
2688 self.tr('Compare Files side by side'), | 3091 self.tr("Compare Files side by side"), |
2689 UI.PixmapCache.getIcon("compareFiles"), | 3092 UI.PixmapCache.getIcon("compareFiles"), |
2690 self.tr('Compare &Files side by side...'), | 3093 self.tr("Compare &Files side by side..."), |
2691 0, 0, self, 'compare_files') | 3094 0, |
2692 self.compareAct.setStatusTip(self.tr('Compare two files')) | 3095 0, |
2693 self.compareAct.setWhatsThis(self.tr( | 3096 self, |
2694 """<b>Compare Files side by side</b>""" | 3097 "compare_files", |
2695 """<p>Open a dialog to compare two files and show the result""" | 3098 ) |
2696 """ side by side.</p>""" | 3099 self.compareAct.setStatusTip(self.tr("Compare two files")) |
2697 )) | 3100 self.compareAct.setWhatsThis( |
3101 self.tr( | |
3102 """<b>Compare Files side by side</b>""" | |
3103 """<p>Open a dialog to compare two files and show the result""" | |
3104 """ side by side.</p>""" | |
3105 ) | |
3106 ) | |
2698 self.compareAct.triggered.connect(self.__compareFilesSbs) | 3107 self.compareAct.triggered.connect(self.__compareFilesSbs) |
2699 self.actions.append(self.compareAct) | 3108 self.actions.append(self.compareAct) |
2700 | 3109 |
2701 self.sqlBrowserAct = EricAction( | 3110 self.sqlBrowserAct = EricAction( |
2702 self.tr('SQL Browser'), | 3111 self.tr("SQL Browser"), |
2703 UI.PixmapCache.getIcon("sqlBrowser"), | 3112 UI.PixmapCache.getIcon("sqlBrowser"), |
2704 self.tr('SQL &Browser...'), | 3113 self.tr("SQL &Browser..."), |
2705 0, 0, self, 'sql_browser') | 3114 0, |
2706 self.sqlBrowserAct.setStatusTip(self.tr('Browse a SQL database')) | 3115 0, |
2707 self.sqlBrowserAct.setWhatsThis(self.tr( | 3116 self, |
2708 """<b>SQL Browser</b>""" | 3117 "sql_browser", |
2709 """<p>Browse a SQL database.</p>""" | 3118 ) |
2710 )) | 3119 self.sqlBrowserAct.setStatusTip(self.tr("Browse a SQL database")) |
3120 self.sqlBrowserAct.setWhatsThis( | |
3121 self.tr("""<b>SQL Browser</b>""" """<p>Browse a SQL database.</p>""") | |
3122 ) | |
2711 self.sqlBrowserAct.triggered.connect(self.__sqlBrowser) | 3123 self.sqlBrowserAct.triggered.connect(self.__sqlBrowser) |
2712 self.actions.append(self.sqlBrowserAct) | 3124 self.actions.append(self.sqlBrowserAct) |
2713 | 3125 |
2714 self.miniEditorAct = EricAction( | 3126 self.miniEditorAct = EricAction( |
2715 self.tr('Mini Editor'), | 3127 self.tr("Mini Editor"), |
2716 UI.PixmapCache.getIcon("editor"), | 3128 UI.PixmapCache.getIcon("editor"), |
2717 self.tr('Mini &Editor...'), | 3129 self.tr("Mini &Editor..."), |
2718 0, 0, self, 'mini_editor') | 3130 0, |
2719 self.miniEditorAct.setStatusTip(self.tr('Mini Editor')) | 3131 0, |
2720 self.miniEditorAct.setWhatsThis(self.tr( | 3132 self, |
2721 """<b>Mini Editor</b>""" | 3133 "mini_editor", |
2722 """<p>Open a dialog with a simplified editor.</p>""" | 3134 ) |
2723 )) | 3135 self.miniEditorAct.setStatusTip(self.tr("Mini Editor")) |
3136 self.miniEditorAct.setWhatsThis( | |
3137 self.tr( | |
3138 """<b>Mini Editor</b>""" | |
3139 """<p>Open a dialog with a simplified editor.</p>""" | |
3140 ) | |
3141 ) | |
2724 self.miniEditorAct.triggered.connect(self.__openMiniEditor) | 3142 self.miniEditorAct.triggered.connect(self.__openMiniEditor) |
2725 self.actions.append(self.miniEditorAct) | 3143 self.actions.append(self.miniEditorAct) |
2726 | 3144 |
2727 self.hexEditorAct = EricAction( | 3145 self.hexEditorAct = EricAction( |
2728 self.tr('Hex Editor'), | 3146 self.tr("Hex Editor"), |
2729 UI.PixmapCache.getIcon("hexEditor"), | 3147 UI.PixmapCache.getIcon("hexEditor"), |
2730 self.tr('&Hex Editor...'), | 3148 self.tr("&Hex Editor..."), |
2731 0, 0, self, 'hex_editor') | 3149 0, |
2732 self.hexEditorAct.setStatusTip(self.tr( | 3150 0, |
2733 'Start the eric Hex Editor')) | 3151 self, |
2734 self.hexEditorAct.setWhatsThis(self.tr( | 3152 "hex_editor", |
2735 """<b>Hex Editor</b>""" | 3153 ) |
2736 """<p>Starts the eric Hex Editor for viewing or editing""" | 3154 self.hexEditorAct.setStatusTip(self.tr("Start the eric Hex Editor")) |
2737 """ binary files.</p>""" | 3155 self.hexEditorAct.setWhatsThis( |
2738 )) | 3156 self.tr( |
3157 """<b>Hex Editor</b>""" | |
3158 """<p>Starts the eric Hex Editor for viewing or editing""" | |
3159 """ binary files.</p>""" | |
3160 ) | |
3161 ) | |
2739 self.hexEditorAct.triggered.connect(self.__openHexEditor) | 3162 self.hexEditorAct.triggered.connect(self.__openHexEditor) |
2740 self.actions.append(self.hexEditorAct) | 3163 self.actions.append(self.hexEditorAct) |
2741 | 3164 |
2742 self.webBrowserAct = EricAction( | 3165 self.webBrowserAct = EricAction( |
2743 self.tr('eric Web Browser'), | 3166 self.tr("eric Web Browser"), |
2744 UI.PixmapCache.getIcon("ericWeb"), | 3167 UI.PixmapCache.getIcon("ericWeb"), |
2745 self.tr('eric &Web Browser...'), | 3168 self.tr("eric &Web Browser..."), |
2746 0, 0, self, 'web_browser') | 3169 0, |
2747 self.webBrowserAct.setStatusTip(self.tr( | 3170 0, |
2748 'Start the eric Web Browser')) | 3171 self, |
2749 self.webBrowserAct.setWhatsThis(self.tr( | 3172 "web_browser", |
2750 """<b>eric Web Browser</b>""" | 3173 ) |
2751 """<p>Browse the Internet with the eric Web Browser.</p>""" | 3174 self.webBrowserAct.setStatusTip(self.tr("Start the eric Web Browser")) |
2752 )) | 3175 self.webBrowserAct.setWhatsThis( |
3176 self.tr( | |
3177 """<b>eric Web Browser</b>""" | |
3178 """<p>Browse the Internet with the eric Web Browser.</p>""" | |
3179 ) | |
3180 ) | |
2753 self.webBrowserAct.triggered.connect(self.__startWebBrowser) | 3181 self.webBrowserAct.triggered.connect(self.__startWebBrowser) |
2754 self.actions.append(self.webBrowserAct) | 3182 self.actions.append(self.webBrowserAct) |
2755 | 3183 |
2756 self.iconEditorAct = EricAction( | 3184 self.iconEditorAct = EricAction( |
2757 self.tr('Icon Editor'), | 3185 self.tr("Icon Editor"), |
2758 UI.PixmapCache.getIcon("iconEditor"), | 3186 UI.PixmapCache.getIcon("iconEditor"), |
2759 self.tr('&Icon Editor...'), | 3187 self.tr("&Icon Editor..."), |
2760 0, 0, self, 'icon_editor') | 3188 0, |
2761 self.iconEditorAct.setStatusTip(self.tr( | 3189 0, |
2762 'Start the eric Icon Editor')) | 3190 self, |
2763 self.iconEditorAct.setWhatsThis(self.tr( | 3191 "icon_editor", |
2764 """<b>Icon Editor</b>""" | 3192 ) |
2765 """<p>Starts the eric Icon Editor for editing simple icons.</p>""" | 3193 self.iconEditorAct.setStatusTip(self.tr("Start the eric Icon Editor")) |
2766 )) | 3194 self.iconEditorAct.setWhatsThis( |
3195 self.tr( | |
3196 """<b>Icon Editor</b>""" | |
3197 """<p>Starts the eric Icon Editor for editing simple icons.</p>""" | |
3198 ) | |
3199 ) | |
2767 self.iconEditorAct.triggered.connect(self.__editPixmap) | 3200 self.iconEditorAct.triggered.connect(self.__editPixmap) |
2768 self.actions.append(self.iconEditorAct) | 3201 self.actions.append(self.iconEditorAct) |
2769 | 3202 |
2770 self.snapshotAct = EricAction( | 3203 self.snapshotAct = EricAction( |
2771 self.tr('Snapshot'), | 3204 self.tr("Snapshot"), |
2772 UI.PixmapCache.getIcon("ericSnap"), | 3205 UI.PixmapCache.getIcon("ericSnap"), |
2773 self.tr('&Snapshot...'), | 3206 self.tr("&Snapshot..."), |
2774 0, 0, self, 'snapshot') | 3207 0, |
2775 self.snapshotAct.setStatusTip(self.tr( | 3208 0, |
2776 'Take snapshots of a screen region')) | 3209 self, |
2777 self.snapshotAct.setWhatsThis(self.tr( | 3210 "snapshot", |
2778 """<b>Snapshot</b>""" | 3211 ) |
2779 """<p>This opens a dialog to take snapshots of a screen""" | 3212 self.snapshotAct.setStatusTip(self.tr("Take snapshots of a screen region")) |
2780 """ region.</p>""" | 3213 self.snapshotAct.setWhatsThis( |
2781 )) | 3214 self.tr( |
3215 """<b>Snapshot</b>""" | |
3216 """<p>This opens a dialog to take snapshots of a screen""" | |
3217 """ region.</p>""" | |
3218 ) | |
3219 ) | |
2782 self.snapshotAct.triggered.connect(self.__snapshot) | 3220 self.snapshotAct.triggered.connect(self.__snapshot) |
2783 self.actions.append(self.snapshotAct) | 3221 self.actions.append(self.snapshotAct) |
2784 | 3222 |
2785 self.prefAct = EricAction( | 3223 self.prefAct = EricAction( |
2786 self.tr('Preferences'), | 3224 self.tr("Preferences"), |
2787 UI.PixmapCache.getIcon("configure"), | 3225 UI.PixmapCache.getIcon("configure"), |
2788 self.tr('&Preferences...'), | 3226 self.tr("&Preferences..."), |
2789 0, 0, self, 'preferences') | 3227 0, |
2790 self.prefAct.setStatusTip(self.tr( | 3228 0, |
2791 'Set the prefered configuration')) | 3229 self, |
2792 self.prefAct.setWhatsThis(self.tr( | 3230 "preferences", |
2793 """<b>Preferences</b>""" | 3231 ) |
2794 """<p>Set the configuration items of the application""" | 3232 self.prefAct.setStatusTip(self.tr("Set the prefered configuration")) |
2795 """ with your prefered values.</p>""" | 3233 self.prefAct.setWhatsThis( |
2796 )) | 3234 self.tr( |
3235 """<b>Preferences</b>""" | |
3236 """<p>Set the configuration items of the application""" | |
3237 """ with your prefered values.</p>""" | |
3238 ) | |
3239 ) | |
2797 self.prefAct.triggered.connect(self.showPreferences) | 3240 self.prefAct.triggered.connect(self.showPreferences) |
2798 self.prefAct.setMenuRole(QAction.MenuRole.PreferencesRole) | 3241 self.prefAct.setMenuRole(QAction.MenuRole.PreferencesRole) |
2799 self.actions.append(self.prefAct) | 3242 self.actions.append(self.prefAct) |
2800 | 3243 |
2801 self.prefExportAct = EricAction( | 3244 self.prefExportAct = EricAction( |
2802 self.tr('Export Preferences'), | 3245 self.tr("Export Preferences"), |
2803 UI.PixmapCache.getIcon("configureExport"), | 3246 UI.PixmapCache.getIcon("configureExport"), |
2804 self.tr('E&xport Preferences...'), | 3247 self.tr("E&xport Preferences..."), |
2805 0, 0, self, 'export_preferences') | 3248 0, |
2806 self.prefExportAct.setStatusTip(self.tr( | 3249 0, |
2807 'Export the current configuration')) | 3250 self, |
2808 self.prefExportAct.setWhatsThis(self.tr( | 3251 "export_preferences", |
2809 """<b>Export Preferences</b>""" | 3252 ) |
2810 """<p>Export the current configuration to a file.</p>""" | 3253 self.prefExportAct.setStatusTip(self.tr("Export the current configuration")) |
2811 )) | 3254 self.prefExportAct.setWhatsThis( |
3255 self.tr( | |
3256 """<b>Export Preferences</b>""" | |
3257 """<p>Export the current configuration to a file.</p>""" | |
3258 ) | |
3259 ) | |
2812 self.prefExportAct.triggered.connect(self.__exportPreferences) | 3260 self.prefExportAct.triggered.connect(self.__exportPreferences) |
2813 self.actions.append(self.prefExportAct) | 3261 self.actions.append(self.prefExportAct) |
2814 | 3262 |
2815 self.prefImportAct = EricAction( | 3263 self.prefImportAct = EricAction( |
2816 self.tr('Import Preferences'), | 3264 self.tr("Import Preferences"), |
2817 UI.PixmapCache.getIcon("configureImport"), | 3265 UI.PixmapCache.getIcon("configureImport"), |
2818 self.tr('I&mport Preferences...'), | 3266 self.tr("I&mport Preferences..."), |
2819 0, 0, self, 'import_preferences') | 3267 0, |
2820 self.prefImportAct.setStatusTip(self.tr( | 3268 0, |
2821 'Import a previously exported configuration')) | 3269 self, |
2822 self.prefImportAct.setWhatsThis(self.tr( | 3270 "import_preferences", |
2823 """<b>Import Preferences</b>""" | 3271 ) |
2824 """<p>Import a previously exported configuration.</p>""" | 3272 self.prefImportAct.setStatusTip( |
2825 )) | 3273 self.tr("Import a previously exported configuration") |
3274 ) | |
3275 self.prefImportAct.setWhatsThis( | |
3276 self.tr( | |
3277 """<b>Import Preferences</b>""" | |
3278 """<p>Import a previously exported configuration.</p>""" | |
3279 ) | |
3280 ) | |
2826 self.prefImportAct.triggered.connect(self.__importPreferences) | 3281 self.prefImportAct.triggered.connect(self.__importPreferences) |
2827 self.actions.append(self.prefImportAct) | 3282 self.actions.append(self.prefImportAct) |
2828 | 3283 |
2829 self.themeExportAct = EricAction( | 3284 self.themeExportAct = EricAction( |
2830 self.tr('Export Theme'), | 3285 self.tr("Export Theme"), |
2831 UI.PixmapCache.getIcon("themeExport"), | 3286 UI.PixmapCache.getIcon("themeExport"), |
2832 self.tr('Export Theme...'), | 3287 self.tr("Export Theme..."), |
2833 0, 0, self, 'export_theme') | 3288 0, |
2834 self.themeExportAct.setStatusTip(self.tr( | 3289 0, |
2835 'Export the current theme')) | 3290 self, |
2836 self.themeExportAct.setWhatsThis(self.tr( | 3291 "export_theme", |
2837 """<b>Export Theme</b>""" | 3292 ) |
2838 """<p>Export the current theme to a file.</p>""" | 3293 self.themeExportAct.setStatusTip(self.tr("Export the current theme")) |
2839 )) | 3294 self.themeExportAct.setWhatsThis( |
3295 self.tr( | |
3296 """<b>Export Theme</b>""" | |
3297 """<p>Export the current theme to a file.</p>""" | |
3298 ) | |
3299 ) | |
2840 self.themeExportAct.triggered.connect(self.__exportTheme) | 3300 self.themeExportAct.triggered.connect(self.__exportTheme) |
2841 self.actions.append(self.themeExportAct) | 3301 self.actions.append(self.themeExportAct) |
2842 | 3302 |
2843 self.themeImportAct = EricAction( | 3303 self.themeImportAct = EricAction( |
2844 self.tr('Import Theme'), | 3304 self.tr("Import Theme"), |
2845 UI.PixmapCache.getIcon("themeImport"), | 3305 UI.PixmapCache.getIcon("themeImport"), |
2846 self.tr('Import Theme...'), | 3306 self.tr("Import Theme..."), |
2847 0, 0, self, 'import_theme') | 3307 0, |
2848 self.themeImportAct.setStatusTip(self.tr( | 3308 0, |
2849 'Import a previously exported theme')) | 3309 self, |
2850 self.themeImportAct.setWhatsThis(self.tr( | 3310 "import_theme", |
2851 """<b>Import Theme</b>""" | 3311 ) |
2852 """<p>Import a previously exported theme.</p>""" | 3312 self.themeImportAct.setStatusTip(self.tr("Import a previously exported theme")) |
2853 )) | 3313 self.themeImportAct.setWhatsThis( |
3314 self.tr( | |
3315 """<b>Import Theme</b>""" | |
3316 """<p>Import a previously exported theme.</p>""" | |
3317 ) | |
3318 ) | |
2854 self.themeImportAct.triggered.connect(self.__importTheme) | 3319 self.themeImportAct.triggered.connect(self.__importTheme) |
2855 self.actions.append(self.themeImportAct) | 3320 self.actions.append(self.themeImportAct) |
2856 | 3321 |
2857 self.reloadAPIsAct = EricAction( | 3322 self.reloadAPIsAct = EricAction( |
2858 self.tr('Reload APIs'), | 3323 self.tr("Reload APIs"), self.tr("Reload &APIs"), 0, 0, self, "reload_apis" |
2859 self.tr('Reload &APIs'), | 3324 ) |
2860 0, 0, self, 'reload_apis') | 3325 self.reloadAPIsAct.setStatusTip(self.tr("Reload the API information")) |
2861 self.reloadAPIsAct.setStatusTip(self.tr( | 3326 self.reloadAPIsAct.setWhatsThis( |
2862 'Reload the API information')) | 3327 self.tr("""<b>Reload APIs</b>""" """<p>Reload the API information.</p>""") |
2863 self.reloadAPIsAct.setWhatsThis(self.tr( | 3328 ) |
2864 """<b>Reload APIs</b>""" | |
2865 """<p>Reload the API information.</p>""" | |
2866 )) | |
2867 self.reloadAPIsAct.triggered.connect(self.__reloadAPIs) | 3329 self.reloadAPIsAct.triggered.connect(self.__reloadAPIs) |
2868 self.actions.append(self.reloadAPIsAct) | 3330 self.actions.append(self.reloadAPIsAct) |
2869 | 3331 |
2870 self.showExternalToolsAct = EricAction( | 3332 self.showExternalToolsAct = EricAction( |
2871 self.tr('Show external tools'), | 3333 self.tr("Show external tools"), |
2872 UI.PixmapCache.getIcon("showPrograms"), | 3334 UI.PixmapCache.getIcon("showPrograms"), |
2873 self.tr('Show external &tools'), | 3335 self.tr("Show external &tools"), |
2874 0, 0, self, 'show_external_tools') | 3336 0, |
2875 self.showExternalToolsAct.setStatusTip(self.tr( | 3337 0, |
2876 'Show external tools')) | 3338 self, |
2877 self.showExternalToolsAct.setWhatsThis(self.tr( | 3339 "show_external_tools", |
2878 """<b>Show external tools</b>""" | 3340 ) |
2879 """<p>Opens a dialog to show the path and versions of all""" | 3341 self.showExternalToolsAct.setStatusTip(self.tr("Show external tools")) |
2880 """ extenal tools used by eric.</p>""" | 3342 self.showExternalToolsAct.setWhatsThis( |
2881 )) | 3343 self.tr( |
2882 self.showExternalToolsAct.triggered.connect( | 3344 """<b>Show external tools</b>""" |
2883 self.__showExternalTools) | 3345 """<p>Opens a dialog to show the path and versions of all""" |
3346 """ extenal tools used by eric.</p>""" | |
3347 ) | |
3348 ) | |
3349 self.showExternalToolsAct.triggered.connect(self.__showExternalTools) | |
2884 self.actions.append(self.showExternalToolsAct) | 3350 self.actions.append(self.showExternalToolsAct) |
2885 | 3351 |
2886 self.configViewProfilesAct = EricAction( | 3352 self.configViewProfilesAct = EricAction( |
2887 self.tr('View Profiles'), | 3353 self.tr("View Profiles"), |
2888 UI.PixmapCache.getIcon("configureViewProfiles"), | 3354 UI.PixmapCache.getIcon("configureViewProfiles"), |
2889 self.tr('&View Profiles...'), | 3355 self.tr("&View Profiles..."), |
2890 0, 0, self, 'view_profiles') | 3356 0, |
2891 self.configViewProfilesAct.setStatusTip(self.tr( | 3357 0, |
2892 'Configure view profiles')) | 3358 self, |
2893 self.configViewProfilesAct.setWhatsThis(self.tr( | 3359 "view_profiles", |
2894 """<b>View Profiles</b>""" | 3360 ) |
2895 """<p>Configure the view profiles. With this dialog you may""" | 3361 self.configViewProfilesAct.setStatusTip(self.tr("Configure view profiles")) |
2896 """ set the visibility of the various windows for the""" | 3362 self.configViewProfilesAct.setWhatsThis( |
2897 """ predetermined view profiles.</p>""" | 3363 self.tr( |
2898 )) | 3364 """<b>View Profiles</b>""" |
2899 self.configViewProfilesAct.triggered.connect( | 3365 """<p>Configure the view profiles. With this dialog you may""" |
2900 self.__configViewProfiles) | 3366 """ set the visibility of the various windows for the""" |
3367 """ predetermined view profiles.</p>""" | |
3368 ) | |
3369 ) | |
3370 self.configViewProfilesAct.triggered.connect(self.__configViewProfiles) | |
2901 self.actions.append(self.configViewProfilesAct) | 3371 self.actions.append(self.configViewProfilesAct) |
2902 | 3372 |
2903 self.configToolBarsAct = EricAction( | 3373 self.configToolBarsAct = EricAction( |
2904 self.tr('Toolbars'), | 3374 self.tr("Toolbars"), |
2905 UI.PixmapCache.getIcon("toolbarsConfigure"), | 3375 UI.PixmapCache.getIcon("toolbarsConfigure"), |
2906 self.tr('Tool&bars...'), | 3376 self.tr("Tool&bars..."), |
2907 0, 0, self, 'configure_toolbars') | 3377 0, |
2908 self.configToolBarsAct.setStatusTip(self.tr('Configure toolbars')) | 3378 0, |
2909 self.configToolBarsAct.setWhatsThis(self.tr( | 3379 self, |
2910 """<b>Toolbars</b>""" | 3380 "configure_toolbars", |
2911 """<p>Configure the toolbars. With this dialog you may""" | 3381 ) |
2912 """ change the actions shown on the various toolbars and""" | 3382 self.configToolBarsAct.setStatusTip(self.tr("Configure toolbars")) |
2913 """ define your own toolbars.</p>""" | 3383 self.configToolBarsAct.setWhatsThis( |
2914 )) | 3384 self.tr( |
3385 """<b>Toolbars</b>""" | |
3386 """<p>Configure the toolbars. With this dialog you may""" | |
3387 """ change the actions shown on the various toolbars and""" | |
3388 """ define your own toolbars.</p>""" | |
3389 ) | |
3390 ) | |
2915 self.configToolBarsAct.triggered.connect(self.__configToolBars) | 3391 self.configToolBarsAct.triggered.connect(self.__configToolBars) |
2916 self.actions.append(self.configToolBarsAct) | 3392 self.actions.append(self.configToolBarsAct) |
2917 | 3393 |
2918 self.shortcutsAct = EricAction( | 3394 self.shortcutsAct = EricAction( |
2919 self.tr('Keyboard Shortcuts'), | 3395 self.tr("Keyboard Shortcuts"), |
2920 UI.PixmapCache.getIcon("configureShortcuts"), | 3396 UI.PixmapCache.getIcon("configureShortcuts"), |
2921 self.tr('Keyboard &Shortcuts...'), | 3397 self.tr("Keyboard &Shortcuts..."), |
2922 0, 0, self, 'keyboard_shortcuts') | 3398 0, |
2923 self.shortcutsAct.setStatusTip(self.tr( | 3399 0, |
2924 'Set the keyboard shortcuts')) | 3400 self, |
2925 self.shortcutsAct.setWhatsThis(self.tr( | 3401 "keyboard_shortcuts", |
2926 """<b>Keyboard Shortcuts</b>""" | 3402 ) |
2927 """<p>Set the keyboard shortcuts of the application""" | 3403 self.shortcutsAct.setStatusTip(self.tr("Set the keyboard shortcuts")) |
2928 """ with your prefered values.</p>""" | 3404 self.shortcutsAct.setWhatsThis( |
2929 )) | 3405 self.tr( |
3406 """<b>Keyboard Shortcuts</b>""" | |
3407 """<p>Set the keyboard shortcuts of the application""" | |
3408 """ with your prefered values.</p>""" | |
3409 ) | |
3410 ) | |
2930 self.shortcutsAct.triggered.connect(self.__configShortcuts) | 3411 self.shortcutsAct.triggered.connect(self.__configShortcuts) |
2931 self.actions.append(self.shortcutsAct) | 3412 self.actions.append(self.shortcutsAct) |
2932 | 3413 |
2933 self.exportShortcutsAct = EricAction( | 3414 self.exportShortcutsAct = EricAction( |
2934 self.tr('Export Keyboard Shortcuts'), | 3415 self.tr("Export Keyboard Shortcuts"), |
2935 UI.PixmapCache.getIcon("exportShortcuts"), | 3416 UI.PixmapCache.getIcon("exportShortcuts"), |
2936 self.tr('&Export Keyboard Shortcuts...'), | 3417 self.tr("&Export Keyboard Shortcuts..."), |
2937 0, 0, self, 'export_keyboard_shortcuts') | 3418 0, |
2938 self.exportShortcutsAct.setStatusTip(self.tr( | 3419 0, |
2939 'Export the keyboard shortcuts')) | 3420 self, |
2940 self.exportShortcutsAct.setWhatsThis(self.tr( | 3421 "export_keyboard_shortcuts", |
2941 """<b>Export Keyboard Shortcuts</b>""" | 3422 ) |
2942 """<p>Export the keyboard shortcuts of the application.</p>""" | 3423 self.exportShortcutsAct.setStatusTip(self.tr("Export the keyboard shortcuts")) |
2943 )) | 3424 self.exportShortcutsAct.setWhatsThis( |
3425 self.tr( | |
3426 """<b>Export Keyboard Shortcuts</b>""" | |
3427 """<p>Export the keyboard shortcuts of the application.</p>""" | |
3428 ) | |
3429 ) | |
2944 self.exportShortcutsAct.triggered.connect(self.__exportShortcuts) | 3430 self.exportShortcutsAct.triggered.connect(self.__exportShortcuts) |
2945 self.actions.append(self.exportShortcutsAct) | 3431 self.actions.append(self.exportShortcutsAct) |
2946 | 3432 |
2947 self.importShortcutsAct = EricAction( | 3433 self.importShortcutsAct = EricAction( |
2948 self.tr('Import Keyboard Shortcuts'), | 3434 self.tr("Import Keyboard Shortcuts"), |
2949 UI.PixmapCache.getIcon("importShortcuts"), | 3435 UI.PixmapCache.getIcon("importShortcuts"), |
2950 self.tr('&Import Keyboard Shortcuts...'), | 3436 self.tr("&Import Keyboard Shortcuts..."), |
2951 0, 0, self, 'import_keyboard_shortcuts') | 3437 0, |
2952 self.importShortcutsAct.setStatusTip(self.tr( | 3438 0, |
2953 'Import the keyboard shortcuts')) | 3439 self, |
2954 self.importShortcutsAct.setWhatsThis(self.tr( | 3440 "import_keyboard_shortcuts", |
2955 """<b>Import Keyboard Shortcuts</b>""" | 3441 ) |
2956 """<p>Import the keyboard shortcuts of the application.</p>""" | 3442 self.importShortcutsAct.setStatusTip(self.tr("Import the keyboard shortcuts")) |
2957 )) | 3443 self.importShortcutsAct.setWhatsThis( |
3444 self.tr( | |
3445 """<b>Import Keyboard Shortcuts</b>""" | |
3446 """<p>Import the keyboard shortcuts of the application.</p>""" | |
3447 ) | |
3448 ) | |
2958 self.importShortcutsAct.triggered.connect(self.__importShortcuts) | 3449 self.importShortcutsAct.triggered.connect(self.__importShortcuts) |
2959 self.actions.append(self.importShortcutsAct) | 3450 self.actions.append(self.importShortcutsAct) |
2960 | 3451 |
2961 if SSL_AVAILABLE: | 3452 if SSL_AVAILABLE: |
2962 self.certificatesAct = EricAction( | 3453 self.certificatesAct = EricAction( |
2963 self.tr('Manage SSL Certificates'), | 3454 self.tr("Manage SSL Certificates"), |
2964 UI.PixmapCache.getIcon("certificates"), | 3455 UI.PixmapCache.getIcon("certificates"), |
2965 self.tr('Manage SSL Certificates...'), | 3456 self.tr("Manage SSL Certificates..."), |
2966 0, 0, self, 'manage_ssl_certificates') | 3457 0, |
2967 self.certificatesAct.setStatusTip(self.tr( | 3458 0, |
2968 'Manage the saved SSL certificates')) | 3459 self, |
2969 self.certificatesAct.setWhatsThis(self.tr( | 3460 "manage_ssl_certificates", |
2970 """<b>Manage SSL Certificates...</b>""" | 3461 ) |
2971 """<p>Opens a dialog to manage the saved SSL certificates.""" | 3462 self.certificatesAct.setStatusTip( |
2972 """</p>""" | 3463 self.tr("Manage the saved SSL certificates") |
2973 )) | 3464 ) |
2974 self.certificatesAct.triggered.connect( | 3465 self.certificatesAct.setWhatsThis( |
2975 self.__showCertificatesDialog) | 3466 self.tr( |
3467 """<b>Manage SSL Certificates...</b>""" | |
3468 """<p>Opens a dialog to manage the saved SSL certificates.""" | |
3469 """</p>""" | |
3470 ) | |
3471 ) | |
3472 self.certificatesAct.triggered.connect(self.__showCertificatesDialog) | |
2976 self.actions.append(self.certificatesAct) | 3473 self.actions.append(self.certificatesAct) |
2977 | 3474 |
2978 self.editMessageFilterAct = EricAction( | 3475 self.editMessageFilterAct = EricAction( |
2979 self.tr('Edit Message Filters'), | 3476 self.tr("Edit Message Filters"), |
2980 UI.PixmapCache.getIcon("warning"), | 3477 UI.PixmapCache.getIcon("warning"), |
2981 self.tr('Edit Message Filters...'), | 3478 self.tr("Edit Message Filters..."), |
2982 0, 0, self, 'manage_message_filters') | 3479 0, |
2983 self.editMessageFilterAct.setStatusTip(self.tr( | 3480 0, |
2984 'Edit the message filters used to suppress unwanted messages')) | 3481 self, |
2985 self.editMessageFilterAct.setWhatsThis(self.tr( | 3482 "manage_message_filters", |
2986 """<b>Edit Message Filters</b>""" | 3483 ) |
2987 """<p>Opens a dialog to edit the message filters used to""" | 3484 self.editMessageFilterAct.setStatusTip( |
2988 """ suppress unwanted messages been shown in an error""" | 3485 self.tr("Edit the message filters used to suppress unwanted messages") |
2989 """ window.</p>""" | 3486 ) |
2990 )) | 3487 self.editMessageFilterAct.setWhatsThis( |
2991 self.editMessageFilterAct.triggered.connect( | 3488 self.tr( |
2992 EricErrorMessage.editMessageFilters) | 3489 """<b>Edit Message Filters</b>""" |
3490 """<p>Opens a dialog to edit the message filters used to""" | |
3491 """ suppress unwanted messages been shown in an error""" | |
3492 """ window.</p>""" | |
3493 ) | |
3494 ) | |
3495 self.editMessageFilterAct.triggered.connect(EricErrorMessage.editMessageFilters) | |
2993 self.actions.append(self.editMessageFilterAct) | 3496 self.actions.append(self.editMessageFilterAct) |
2994 | 3497 |
2995 self.clearPrivateDataAct = EricAction( | 3498 self.clearPrivateDataAct = EricAction( |
2996 self.tr('Clear private data'), | 3499 self.tr("Clear private data"), |
2997 UI.PixmapCache.getIcon("clearPrivateData"), | 3500 UI.PixmapCache.getIcon("clearPrivateData"), |
2998 self.tr('Clear private data'), | 3501 self.tr("Clear private data"), |
2999 0, 0, | 3502 0, |
3000 self, 'clear_private_data') | 3503 0, |
3001 self.clearPrivateDataAct.setStatusTip(self.tr( | 3504 self, |
3002 'Clear private data')) | 3505 "clear_private_data", |
3003 self.clearPrivateDataAct.setWhatsThis(self.tr( | 3506 ) |
3004 """<b>Clear private data</b>""" | 3507 self.clearPrivateDataAct.setStatusTip(self.tr("Clear private data")) |
3005 """<p>Clears the private data like the various list of""" | 3508 self.clearPrivateDataAct.setWhatsThis( |
3006 """ recently opened files, projects or multi projects.</p>""" | 3509 self.tr( |
3007 )) | 3510 """<b>Clear private data</b>""" |
3008 self.clearPrivateDataAct.triggered.connect( | 3511 """<p>Clears the private data like the various list of""" |
3009 self.__clearPrivateData) | 3512 """ recently opened files, projects or multi projects.</p>""" |
3513 ) | |
3514 ) | |
3515 self.clearPrivateDataAct.triggered.connect(self.__clearPrivateData) | |
3010 self.actions.append(self.clearPrivateDataAct) | 3516 self.actions.append(self.clearPrivateDataAct) |
3011 | 3517 |
3012 self.viewmanagerActivateAct = EricAction( | 3518 self.viewmanagerActivateAct = EricAction( |
3013 self.tr('Activate current editor'), | 3519 self.tr("Activate current editor"), |
3014 self.tr('Activate current editor'), | 3520 self.tr("Activate current editor"), |
3015 QKeySequence(self.tr("Alt+Shift+E")), | 3521 QKeySequence(self.tr("Alt+Shift+E")), |
3016 0, self, 'viewmanager_activate') | 3522 0, |
3017 self.viewmanagerActivateAct.triggered.connect( | 3523 self, |
3018 self.__activateViewmanager) | 3524 "viewmanager_activate", |
3525 ) | |
3526 self.viewmanagerActivateAct.triggered.connect(self.__activateViewmanager) | |
3019 self.actions.append(self.viewmanagerActivateAct) | 3527 self.actions.append(self.viewmanagerActivateAct) |
3020 self.addAction(self.viewmanagerActivateAct) | 3528 self.addAction(self.viewmanagerActivateAct) |
3021 | 3529 |
3022 self.nextTabAct = EricAction( | 3530 self.nextTabAct = EricAction( |
3023 self.tr('Show next'), | 3531 self.tr("Show next"), |
3024 self.tr('Show next'), | 3532 self.tr("Show next"), |
3025 QKeySequence(self.tr('Ctrl+Alt+Tab')), 0, | 3533 QKeySequence(self.tr("Ctrl+Alt+Tab")), |
3026 self, 'view_next_tab') | 3534 0, |
3535 self, | |
3536 "view_next_tab", | |
3537 ) | |
3027 self.nextTabAct.triggered.connect(self.__showNext) | 3538 self.nextTabAct.triggered.connect(self.__showNext) |
3028 self.actions.append(self.nextTabAct) | 3539 self.actions.append(self.nextTabAct) |
3029 self.addAction(self.nextTabAct) | 3540 self.addAction(self.nextTabAct) |
3030 | 3541 |
3031 self.prevTabAct = EricAction( | 3542 self.prevTabAct = EricAction( |
3032 self.tr('Show previous'), | 3543 self.tr("Show previous"), |
3033 self.tr('Show previous'), | 3544 self.tr("Show previous"), |
3034 QKeySequence(self.tr('Shift+Ctrl+Alt+Tab')), 0, | 3545 QKeySequence(self.tr("Shift+Ctrl+Alt+Tab")), |
3035 self, 'view_previous_tab') | 3546 0, |
3547 self, | |
3548 "view_previous_tab", | |
3549 ) | |
3036 self.prevTabAct.triggered.connect(self.__showPrevious) | 3550 self.prevTabAct.triggered.connect(self.__showPrevious) |
3037 self.actions.append(self.prevTabAct) | 3551 self.actions.append(self.prevTabAct) |
3038 self.addAction(self.prevTabAct) | 3552 self.addAction(self.prevTabAct) |
3039 | 3553 |
3040 self.switchTabAct = EricAction( | 3554 self.switchTabAct = EricAction( |
3041 self.tr('Switch between tabs'), | 3555 self.tr("Switch between tabs"), |
3042 self.tr('Switch between tabs'), | 3556 self.tr("Switch between tabs"), |
3043 QKeySequence(self.tr('Ctrl+1')), 0, | 3557 QKeySequence(self.tr("Ctrl+1")), |
3044 self, 'switch_tabs') | 3558 0, |
3559 self, | |
3560 "switch_tabs", | |
3561 ) | |
3045 self.switchTabAct.triggered.connect(self.__switchTab) | 3562 self.switchTabAct.triggered.connect(self.__switchTab) |
3046 self.actions.append(self.switchTabAct) | 3563 self.actions.append(self.switchTabAct) |
3047 self.addAction(self.switchTabAct) | 3564 self.addAction(self.switchTabAct) |
3048 | 3565 |
3049 self.pluginInfoAct = EricAction( | 3566 self.pluginInfoAct = EricAction( |
3050 self.tr('Plugin Infos'), | 3567 self.tr("Plugin Infos"), |
3051 UI.PixmapCache.getIcon("plugin"), | 3568 UI.PixmapCache.getIcon("plugin"), |
3052 self.tr('&Plugin Infos...'), 0, 0, self, 'plugin_infos') | 3569 self.tr("&Plugin Infos..."), |
3053 self.pluginInfoAct.setStatusTip(self.tr('Show Plugin Infos')) | 3570 0, |
3054 self.pluginInfoAct.setWhatsThis(self.tr( | 3571 0, |
3055 """<b>Plugin Infos...</b>""" | 3572 self, |
3056 """<p>This opens a dialog, that show some information about""" | 3573 "plugin_infos", |
3057 """ loaded plugins.</p>""" | 3574 ) |
3058 )) | 3575 self.pluginInfoAct.setStatusTip(self.tr("Show Plugin Infos")) |
3576 self.pluginInfoAct.setWhatsThis( | |
3577 self.tr( | |
3578 """<b>Plugin Infos...</b>""" | |
3579 """<p>This opens a dialog, that show some information about""" | |
3580 """ loaded plugins.</p>""" | |
3581 ) | |
3582 ) | |
3059 self.pluginInfoAct.triggered.connect(self.__showPluginInfo) | 3583 self.pluginInfoAct.triggered.connect(self.__showPluginInfo) |
3060 self.actions.append(self.pluginInfoAct) | 3584 self.actions.append(self.pluginInfoAct) |
3061 | 3585 |
3062 self.pluginInstallAct = EricAction( | 3586 self.pluginInstallAct = EricAction( |
3063 self.tr('Install Plugins'), | 3587 self.tr("Install Plugins"), |
3064 UI.PixmapCache.getIcon("pluginInstall"), | 3588 UI.PixmapCache.getIcon("pluginInstall"), |
3065 self.tr('&Install Plugins...'), | 3589 self.tr("&Install Plugins..."), |
3066 0, 0, self, 'plugin_install') | 3590 0, |
3067 self.pluginInstallAct.setStatusTip(self.tr('Install Plugins')) | 3591 0, |
3068 self.pluginInstallAct.setWhatsThis(self.tr( | 3592 self, |
3069 """<b>Install Plugins...</b>""" | 3593 "plugin_install", |
3070 """<p>This opens a dialog to install or update plugins.</p>""" | 3594 ) |
3071 )) | 3595 self.pluginInstallAct.setStatusTip(self.tr("Install Plugins")) |
3596 self.pluginInstallAct.setWhatsThis( | |
3597 self.tr( | |
3598 """<b>Install Plugins...</b>""" | |
3599 """<p>This opens a dialog to install or update plugins.</p>""" | |
3600 ) | |
3601 ) | |
3072 self.pluginInstallAct.triggered.connect(self.__installPlugins) | 3602 self.pluginInstallAct.triggered.connect(self.__installPlugins) |
3073 self.actions.append(self.pluginInstallAct) | 3603 self.actions.append(self.pluginInstallAct) |
3074 | 3604 |
3075 self.pluginDeinstallAct = EricAction( | 3605 self.pluginDeinstallAct = EricAction( |
3076 self.tr('Uninstall Plugin'), | 3606 self.tr("Uninstall Plugin"), |
3077 UI.PixmapCache.getIcon("pluginUninstall"), | 3607 UI.PixmapCache.getIcon("pluginUninstall"), |
3078 self.tr('&Uninstall Plugin...'), | 3608 self.tr("&Uninstall Plugin..."), |
3079 0, 0, self, 'plugin_deinstall') | 3609 0, |
3080 self.pluginDeinstallAct.setStatusTip(self.tr('Uninstall Plugin')) | 3610 0, |
3081 self.pluginDeinstallAct.setWhatsThis(self.tr( | 3611 self, |
3082 """<b>Uninstall Plugin...</b>""" | 3612 "plugin_deinstall", |
3083 """<p>This opens a dialog to uninstall a plugin.</p>""" | 3613 ) |
3084 )) | 3614 self.pluginDeinstallAct.setStatusTip(self.tr("Uninstall Plugin")) |
3615 self.pluginDeinstallAct.setWhatsThis( | |
3616 self.tr( | |
3617 """<b>Uninstall Plugin...</b>""" | |
3618 """<p>This opens a dialog to uninstall a plugin.</p>""" | |
3619 ) | |
3620 ) | |
3085 self.pluginDeinstallAct.triggered.connect(self.__deinstallPlugin) | 3621 self.pluginDeinstallAct.triggered.connect(self.__deinstallPlugin) |
3086 self.actions.append(self.pluginDeinstallAct) | 3622 self.actions.append(self.pluginDeinstallAct) |
3087 | 3623 |
3088 self.pluginRepoAct = EricAction( | 3624 self.pluginRepoAct = EricAction( |
3089 self.tr('Plugin Repository'), | 3625 self.tr("Plugin Repository"), |
3090 UI.PixmapCache.getIcon("pluginRepository"), | 3626 UI.PixmapCache.getIcon("pluginRepository"), |
3091 self.tr('Plugin &Repository...'), | 3627 self.tr("Plugin &Repository..."), |
3092 0, 0, self, 'plugin_repository') | 3628 0, |
3093 self.pluginRepoAct.setStatusTip(self.tr( | 3629 0, |
3094 'Show Plugins available for download')) | 3630 self, |
3095 self.pluginRepoAct.setWhatsThis(self.tr( | 3631 "plugin_repository", |
3096 """<b>Plugin Repository...</b>""" | 3632 ) |
3097 """<p>This opens a dialog, that shows a list of plugins """ | 3633 self.pluginRepoAct.setStatusTip(self.tr("Show Plugins available for download")) |
3098 """available on the Internet.</p>""" | 3634 self.pluginRepoAct.setWhatsThis( |
3099 )) | 3635 self.tr( |
3636 """<b>Plugin Repository...</b>""" | |
3637 """<p>This opens a dialog, that shows a list of plugins """ | |
3638 """available on the Internet.</p>""" | |
3639 ) | |
3640 ) | |
3100 self.pluginRepoAct.triggered.connect(self.__showPluginsAvailable) | 3641 self.pluginRepoAct.triggered.connect(self.__showPluginsAvailable) |
3101 self.actions.append(self.pluginRepoAct) | 3642 self.actions.append(self.pluginRepoAct) |
3102 | 3643 |
3103 # initialize viewmanager actions | 3644 # initialize viewmanager actions |
3104 self.viewmanager.initActions() | 3645 self.viewmanager.initActions() |
3105 | 3646 |
3106 # initialize debugger actions | 3647 # initialize debugger actions |
3107 self.debuggerUI.initActions() | 3648 self.debuggerUI.initActions() |
3108 | 3649 |
3109 # initialize project actions | 3650 # initialize project actions |
3110 self.project.initActions() | 3651 self.project.initActions() |
3111 | 3652 |
3112 # initialize multi project actions | 3653 # initialize multi project actions |
3113 self.multiProject.initActions() | 3654 self.multiProject.initActions() |
3114 | 3655 |
3115 def __initQtDocActions(self): | 3656 def __initQtDocActions(self): |
3116 """ | 3657 """ |
3117 Private slot to initialize the action to show the Qt documentation. | 3658 Private slot to initialize the action to show the Qt documentation. |
3118 """ | 3659 """ |
3119 self.qt5DocAct = EricAction( | 3660 self.qt5DocAct = EricAction( |
3120 self.tr('Qt5 Documentation'), | 3661 self.tr("Qt5 Documentation"), |
3121 self.tr('Qt5 Documentation'), | 3662 self.tr("Qt5 Documentation"), |
3122 0, 0, self, 'qt5_documentation') | 3663 0, |
3123 self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation')) | 3664 0, |
3124 self.qt5DocAct.setWhatsThis(self.tr( | 3665 self, |
3125 """<b>Qt5 Documentation</b>""" | 3666 "qt5_documentation", |
3126 """<p>Display the Qt5 Documentation. Dependent upon your""" | 3667 ) |
3127 """ settings, this will either show the help in Eric's internal""" | 3668 self.qt5DocAct.setStatusTip(self.tr("Open Qt5 Documentation")) |
3128 """ help viewer/web browser, or execute a web browser or Qt""" | 3669 self.qt5DocAct.setWhatsThis( |
3129 """ Assistant. </p>""" | 3670 self.tr( |
3130 )) | 3671 """<b>Qt5 Documentation</b>""" |
3672 """<p>Display the Qt5 Documentation. Dependent upon your""" | |
3673 """ settings, this will either show the help in Eric's internal""" | |
3674 """ help viewer/web browser, or execute a web browser or Qt""" | |
3675 """ Assistant. </p>""" | |
3676 ) | |
3677 ) | |
3131 self.qt5DocAct.triggered.connect(lambda: self.__showQtDoc(5)) | 3678 self.qt5DocAct.triggered.connect(lambda: self.__showQtDoc(5)) |
3132 self.actions.append(self.qt5DocAct) | 3679 self.actions.append(self.qt5DocAct) |
3133 | 3680 |
3134 self.qt6DocAct = EricAction( | 3681 self.qt6DocAct = EricAction( |
3135 self.tr('Qt6 Documentation'), | 3682 self.tr("Qt6 Documentation"), |
3136 self.tr('Qt6 Documentation'), | 3683 self.tr("Qt6 Documentation"), |
3137 0, 0, self, 'qt6_documentation') | 3684 0, |
3138 self.qt6DocAct.setStatusTip(self.tr('Open Qt6 Documentation')) | 3685 0, |
3139 self.qt6DocAct.setWhatsThis(self.tr( | 3686 self, |
3140 """<b>Qt6 Documentation</b>""" | 3687 "qt6_documentation", |
3141 """<p>Display the Qt6 Documentation. Dependent upon your""" | 3688 ) |
3142 """ settings, this will either show the help in Eric's internal""" | 3689 self.qt6DocAct.setStatusTip(self.tr("Open Qt6 Documentation")) |
3143 """ help viewer/web browser, or execute a web browser or Qt""" | 3690 self.qt6DocAct.setWhatsThis( |
3144 """ Assistant. </p>""" | 3691 self.tr( |
3145 )) | 3692 """<b>Qt6 Documentation</b>""" |
3693 """<p>Display the Qt6 Documentation. Dependent upon your""" | |
3694 """ settings, this will either show the help in Eric's internal""" | |
3695 """ help viewer/web browser, or execute a web browser or Qt""" | |
3696 """ Assistant. </p>""" | |
3697 ) | |
3698 ) | |
3146 self.qt6DocAct.triggered.connect(lambda: self.__showQtDoc(6)) | 3699 self.qt6DocAct.triggered.connect(lambda: self.__showQtDoc(6)) |
3147 self.actions.append(self.qt6DocAct) | 3700 self.actions.append(self.qt6DocAct) |
3148 | 3701 |
3149 self.pyqt5DocAct = EricAction( | 3702 self.pyqt5DocAct = EricAction( |
3150 self.tr('PyQt5 Documentation'), | 3703 self.tr("PyQt5 Documentation"), |
3151 self.tr('PyQt5 Documentation'), | 3704 self.tr("PyQt5 Documentation"), |
3152 0, 0, self, 'pyqt5_documentation') | 3705 0, |
3153 self.pyqt5DocAct.setStatusTip(self.tr( | 3706 0, |
3154 'Open PyQt5 Documentation')) | 3707 self, |
3155 self.pyqt5DocAct.setWhatsThis(self.tr( | 3708 "pyqt5_documentation", |
3156 """<b>PyQt5 Documentation</b>""" | 3709 ) |
3157 """<p>Display the PyQt5 Documentation. Dependent upon your""" | 3710 self.pyqt5DocAct.setStatusTip(self.tr("Open PyQt5 Documentation")) |
3158 """ settings, this will either show the help in Eric's""" | 3711 self.pyqt5DocAct.setWhatsThis( |
3159 """ internal help viewer/web browser, or execute a web""" | 3712 self.tr( |
3160 """ browser or Qt Assistant. </p>""" | 3713 """<b>PyQt5 Documentation</b>""" |
3161 )) | 3714 """<p>Display the PyQt5 Documentation. Dependent upon your""" |
3162 self.pyqt5DocAct.triggered.connect( | |
3163 lambda: self.__showPyQtDoc(variant=5)) | |
3164 self.actions.append(self.pyqt5DocAct) | |
3165 | |
3166 self.pyqt6DocAct = EricAction( | |
3167 self.tr('PyQt6 Documentation'), | |
3168 self.tr('PyQt6 Documentation'), | |
3169 0, 0, self, 'pyqt6_documentation') | |
3170 self.pyqt6DocAct.setStatusTip(self.tr( | |
3171 'Open PyQt6 Documentation')) | |
3172 self.pyqt6DocAct.setWhatsThis(self.tr( | |
3173 """<b>PyQt6 Documentation</b>""" | |
3174 """<p>Display the PyQt6 Documentation. Dependent upon your""" | |
3175 """ settings, this will either show the help in Eric's""" | |
3176 """ internal help viewer/web browser, or execute a web""" | |
3177 """ browser or Qt Assistant. </p>""" | |
3178 )) | |
3179 self.pyqt6DocAct.triggered.connect( | |
3180 lambda: self.__showPyQtDoc(variant=6)) | |
3181 self.actions.append(self.pyqt6DocAct) | |
3182 | |
3183 def __initPythonDocActions(self): | |
3184 """ | |
3185 Private slot to initialize the actions to show the Python | |
3186 documentation. | |
3187 """ | |
3188 self.pythonDocAct = EricAction( | |
3189 self.tr('Python 3 Documentation'), | |
3190 self.tr('Python 3 Documentation'), | |
3191 0, 0, self, 'python3_documentation') | |
3192 self.pythonDocAct.setStatusTip(self.tr( | |
3193 'Open Python 3 Documentation')) | |
3194 self.pythonDocAct.setWhatsThis(self.tr( | |
3195 """<b>Python 3 Documentation</b>""" | |
3196 """<p>Display the Python 3 documentation. If no documentation""" | |
3197 """ directory is configured, the location of the Python 3""" | |
3198 """ documentation is assumed to be the doc directory underneath""" | |
3199 """ the location of the Python 3 executable on Windows and""" | |
3200 """ <i>/usr/share/doc/packages/python/html</i> on Unix. Set""" | |
3201 """ PYTHON3DOCDIR in your environment to override this.</p>""" | |
3202 )) | |
3203 self.pythonDocAct.triggered.connect(self.__showPythonDoc) | |
3204 self.actions.append(self.pythonDocAct) | |
3205 | |
3206 def __initEricDocAction(self): | |
3207 """ | |
3208 Private slot to initialize the action to show the eric documentation. | |
3209 """ | |
3210 self.ericDocAct = EricAction( | |
3211 self.tr("eric API Documentation"), | |
3212 self.tr('eric API Documentation'), | |
3213 0, 0, self, 'eric_documentation') | |
3214 self.ericDocAct.setStatusTip(self.tr( | |
3215 "Open eric API Documentation")) | |
3216 self.ericDocAct.setWhatsThis(self.tr( | |
3217 """<b>eric API Documentation</b>""" | |
3218 """<p>Display the eric API documentation. The location for the""" | |
3219 """ documentation is the Documentation/Source subdirectory of""" | |
3220 """ the eric installation directory.</p>""" | |
3221 )) | |
3222 self.ericDocAct.triggered.connect(self.__showEricDoc) | |
3223 self.actions.append(self.ericDocAct) | |
3224 | |
3225 def __initPySideDocActions(self): | |
3226 """ | |
3227 Private slot to initialize the actions to show the PySide | |
3228 documentation. | |
3229 """ | |
3230 if Utilities.checkPyside(variant=2): | |
3231 self.pyside2DocAct = EricAction( | |
3232 self.tr('PySide2 Documentation'), | |
3233 self.tr('PySide2 Documentation'), | |
3234 0, 0, self, 'pyside2_documentation') | |
3235 self.pyside2DocAct.setStatusTip(self.tr( | |
3236 'Open PySide2 Documentation')) | |
3237 self.pyside2DocAct.setWhatsThis(self.tr( | |
3238 """<b>PySide2 Documentation</b>""" | |
3239 """<p>Display the PySide2 Documentation. Dependent upon your""" | |
3240 """ settings, this will either show the help in Eric's""" | 3715 """ settings, this will either show the help in Eric's""" |
3241 """ internal help viewer/web browser, or execute a web""" | 3716 """ internal help viewer/web browser, or execute a web""" |
3242 """ browser or Qt Assistant. </p>""" | 3717 """ browser or Qt Assistant. </p>""" |
3243 )) | 3718 ) |
3719 ) | |
3720 self.pyqt5DocAct.triggered.connect(lambda: self.__showPyQtDoc(variant=5)) | |
3721 self.actions.append(self.pyqt5DocAct) | |
3722 | |
3723 self.pyqt6DocAct = EricAction( | |
3724 self.tr("PyQt6 Documentation"), | |
3725 self.tr("PyQt6 Documentation"), | |
3726 0, | |
3727 0, | |
3728 self, | |
3729 "pyqt6_documentation", | |
3730 ) | |
3731 self.pyqt6DocAct.setStatusTip(self.tr("Open PyQt6 Documentation")) | |
3732 self.pyqt6DocAct.setWhatsThis( | |
3733 self.tr( | |
3734 """<b>PyQt6 Documentation</b>""" | |
3735 """<p>Display the PyQt6 Documentation. Dependent upon your""" | |
3736 """ settings, this will either show the help in Eric's""" | |
3737 """ internal help viewer/web browser, or execute a web""" | |
3738 """ browser or Qt Assistant. </p>""" | |
3739 ) | |
3740 ) | |
3741 self.pyqt6DocAct.triggered.connect(lambda: self.__showPyQtDoc(variant=6)) | |
3742 self.actions.append(self.pyqt6DocAct) | |
3743 | |
3744 def __initPythonDocActions(self): | |
3745 """ | |
3746 Private slot to initialize the actions to show the Python | |
3747 documentation. | |
3748 """ | |
3749 self.pythonDocAct = EricAction( | |
3750 self.tr("Python 3 Documentation"), | |
3751 self.tr("Python 3 Documentation"), | |
3752 0, | |
3753 0, | |
3754 self, | |
3755 "python3_documentation", | |
3756 ) | |
3757 self.pythonDocAct.setStatusTip(self.tr("Open Python 3 Documentation")) | |
3758 self.pythonDocAct.setWhatsThis( | |
3759 self.tr( | |
3760 """<b>Python 3 Documentation</b>""" | |
3761 """<p>Display the Python 3 documentation. If no documentation""" | |
3762 """ directory is configured, the location of the Python 3""" | |
3763 """ documentation is assumed to be the doc directory underneath""" | |
3764 """ the location of the Python 3 executable on Windows and""" | |
3765 """ <i>/usr/share/doc/packages/python/html</i> on Unix. Set""" | |
3766 """ PYTHON3DOCDIR in your environment to override this.</p>""" | |
3767 ) | |
3768 ) | |
3769 self.pythonDocAct.triggered.connect(self.__showPythonDoc) | |
3770 self.actions.append(self.pythonDocAct) | |
3771 | |
3772 def __initEricDocAction(self): | |
3773 """ | |
3774 Private slot to initialize the action to show the eric documentation. | |
3775 """ | |
3776 self.ericDocAct = EricAction( | |
3777 self.tr("eric API Documentation"), | |
3778 self.tr("eric API Documentation"), | |
3779 0, | |
3780 0, | |
3781 self, | |
3782 "eric_documentation", | |
3783 ) | |
3784 self.ericDocAct.setStatusTip(self.tr("Open eric API Documentation")) | |
3785 self.ericDocAct.setWhatsThis( | |
3786 self.tr( | |
3787 """<b>eric API Documentation</b>""" | |
3788 """<p>Display the eric API documentation. The location for the""" | |
3789 """ documentation is the Documentation/Source subdirectory of""" | |
3790 """ the eric installation directory.</p>""" | |
3791 ) | |
3792 ) | |
3793 self.ericDocAct.triggered.connect(self.__showEricDoc) | |
3794 self.actions.append(self.ericDocAct) | |
3795 | |
3796 def __initPySideDocActions(self): | |
3797 """ | |
3798 Private slot to initialize the actions to show the PySide | |
3799 documentation. | |
3800 """ | |
3801 if Utilities.checkPyside(variant=2): | |
3802 self.pyside2DocAct = EricAction( | |
3803 self.tr("PySide2 Documentation"), | |
3804 self.tr("PySide2 Documentation"), | |
3805 0, | |
3806 0, | |
3807 self, | |
3808 "pyside2_documentation", | |
3809 ) | |
3810 self.pyside2DocAct.setStatusTip(self.tr("Open PySide2 Documentation")) | |
3811 self.pyside2DocAct.setWhatsThis( | |
3812 self.tr( | |
3813 """<b>PySide2 Documentation</b>""" | |
3814 """<p>Display the PySide2 Documentation. Dependent upon your""" | |
3815 """ settings, this will either show the help in Eric's""" | |
3816 """ internal help viewer/web browser, or execute a web""" | |
3817 """ browser or Qt Assistant. </p>""" | |
3818 ) | |
3819 ) | |
3244 self.pyside2DocAct.triggered.connect( | 3820 self.pyside2DocAct.triggered.connect( |
3245 lambda: self.__showPySideDoc(variant=2)) | 3821 lambda: self.__showPySideDoc(variant=2) |
3822 ) | |
3246 self.actions.append(self.pyside2DocAct) | 3823 self.actions.append(self.pyside2DocAct) |
3247 else: | 3824 else: |
3248 self.pyside2DocAct = None | 3825 self.pyside2DocAct = None |
3249 | 3826 |
3250 if Utilities.checkPyside(variant=6): | 3827 if Utilities.checkPyside(variant=6): |
3251 self.pyside6DocAct = EricAction( | 3828 self.pyside6DocAct = EricAction( |
3252 self.tr('PySide6 Documentation'), | 3829 self.tr("PySide6 Documentation"), |
3253 self.tr('PySide6 Documentation'), | 3830 self.tr("PySide6 Documentation"), |
3254 0, 0, self, 'pyside6_documentation') | 3831 0, |
3255 self.pyside6DocAct.setStatusTip(self.tr( | 3832 0, |
3256 'Open PySide6 Documentation')) | 3833 self, |
3257 self.pyside6DocAct.setWhatsThis(self.tr( | 3834 "pyside6_documentation", |
3258 """<b>PySide6 Documentation</b>""" | 3835 ) |
3259 """<p>Display the PySide6 Documentation. Dependent upon your""" | 3836 self.pyside6DocAct.setStatusTip(self.tr("Open PySide6 Documentation")) |
3260 """ settings, this will either show the help in Eric's""" | 3837 self.pyside6DocAct.setWhatsThis( |
3261 """ internal help viewer/web browser, or execute a web""" | 3838 self.tr( |
3262 """ browser or Qt Assistant. </p>""" | 3839 """<b>PySide6 Documentation</b>""" |
3263 )) | 3840 """<p>Display the PySide6 Documentation. Dependent upon your""" |
3841 """ settings, this will either show the help in Eric's""" | |
3842 """ internal help viewer/web browser, or execute a web""" | |
3843 """ browser or Qt Assistant. </p>""" | |
3844 ) | |
3845 ) | |
3264 self.pyside6DocAct.triggered.connect( | 3846 self.pyside6DocAct.triggered.connect( |
3265 lambda: self.__showPySideDoc(variant=6)) | 3847 lambda: self.__showPySideDoc(variant=6) |
3848 ) | |
3266 self.actions.append(self.pyside6DocAct) | 3849 self.actions.append(self.pyside6DocAct) |
3267 else: | 3850 else: |
3268 self.pyside6DocAct = None | 3851 self.pyside6DocAct = None |
3269 | 3852 |
3270 def __initMenus(self): | 3853 def __initMenus(self): |
3271 """ | 3854 """ |
3272 Private slot to create the menus. | 3855 Private slot to create the menus. |
3273 """ | 3856 """ |
3274 self.__menus = {} | 3857 self.__menus = {} |
3275 mb = self.menuBar() | 3858 mb = self.menuBar() |
3276 if ( | 3859 if Utilities.isLinuxPlatform() and not Preferences.getUI("UseNativeMenuBar"): |
3277 Utilities.isLinuxPlatform() and | |
3278 not Preferences.getUI("UseNativeMenuBar") | |
3279 ): | |
3280 mb.setNativeMenuBar(False) | 3860 mb.setNativeMenuBar(False) |
3281 | 3861 |
3282 ############################################################## | 3862 ############################################################## |
3283 ## File menu | 3863 ## File menu |
3284 ############################################################## | 3864 ############################################################## |
3285 | 3865 |
3286 self.__menus["file"] = self.viewmanager.initFileMenu() | 3866 self.__menus["file"] = self.viewmanager.initFileMenu() |
3287 mb.addMenu(self.__menus["file"]) | 3867 mb.addMenu(self.__menus["file"]) |
3288 self.__menus["file"].addSeparator() | 3868 self.__menus["file"].addSeparator() |
3289 self.__menus["file"].addAction(self.saveSessionAct) | 3869 self.__menus["file"].addAction(self.saveSessionAct) |
3290 self.__menus["file"].addAction(self.loadSessionAct) | 3870 self.__menus["file"].addAction(self.loadSessionAct) |
3293 self.__menus["file"].addAction(self.exitAct) | 3873 self.__menus["file"].addAction(self.exitAct) |
3294 act = self.__menus["file"].actions()[0] | 3874 act = self.__menus["file"].actions()[0] |
3295 sep = self.__menus["file"].insertSeparator(act) | 3875 sep = self.__menus["file"].insertSeparator(act) |
3296 self.__menus["file"].insertAction(sep, self.newWindowAct) | 3876 self.__menus["file"].insertAction(sep, self.newWindowAct) |
3297 self.__menus["file"].aboutToShow.connect(self.__showFileMenu) | 3877 self.__menus["file"].aboutToShow.connect(self.__showFileMenu) |
3298 | 3878 |
3299 ############################################################## | 3879 ############################################################## |
3300 ## Edit menu | 3880 ## Edit menu |
3301 ############################################################## | 3881 ############################################################## |
3302 | 3882 |
3303 self.__menus["edit"] = self.viewmanager.initEditMenu() | 3883 self.__menus["edit"] = self.viewmanager.initEditMenu() |
3304 mb.addMenu(self.__menus["edit"]) | 3884 mb.addMenu(self.__menus["edit"]) |
3305 | 3885 |
3306 ############################################################## | 3886 ############################################################## |
3307 ## Search menu | 3887 ## Search menu |
3308 ############################################################## | 3888 ############################################################## |
3309 | 3889 |
3310 self.__menus["search"] = self.viewmanager.initSearchMenu() | 3890 self.__menus["search"] = self.viewmanager.initSearchMenu() |
3311 mb.addMenu(self.__menus["search"]) | 3891 mb.addMenu(self.__menus["search"]) |
3312 | 3892 |
3313 ############################################################## | 3893 ############################################################## |
3314 ## View menu | 3894 ## View menu |
3315 ############################################################## | 3895 ############################################################## |
3316 | 3896 |
3317 self.__menus["view"] = self.viewmanager.initViewMenu() | 3897 self.__menus["view"] = self.viewmanager.initViewMenu() |
3318 mb.addMenu(self.__menus["view"]) | 3898 mb.addMenu(self.__menus["view"]) |
3319 | 3899 |
3320 ############################################################## | 3900 ############################################################## |
3321 ## Bookmarks menu | 3901 ## Bookmarks menu |
3322 ############################################################## | 3902 ############################################################## |
3323 | 3903 |
3324 self.__menus["bookmarks"] = self.viewmanager.initBookmarkMenu() | 3904 self.__menus["bookmarks"] = self.viewmanager.initBookmarkMenu() |
3325 mb.addMenu(self.__menus["bookmarks"]) | 3905 mb.addMenu(self.__menus["bookmarks"]) |
3326 self.__menus["bookmarks"].setTearOffEnabled(True) | 3906 self.__menus["bookmarks"].setTearOffEnabled(True) |
3327 | 3907 |
3328 ############################################################## | 3908 ############################################################## |
3329 ## Multiproject menu | 3909 ## Multiproject menu |
3330 ############################################################## | 3910 ############################################################## |
3331 | 3911 |
3332 self.__menus["multiproject"] = self.multiProject.initMenu() | 3912 self.__menus["multiproject"] = self.multiProject.initMenu() |
3333 mb.addMenu(self.__menus["multiproject"]) | 3913 mb.addMenu(self.__menus["multiproject"]) |
3334 | 3914 |
3335 ############################################################## | 3915 ############################################################## |
3336 ## Project menu | 3916 ## Project menu |
3337 ############################################################## | 3917 ############################################################## |
3338 | 3918 |
3339 self.__menus["project"], self.__menus["project_tools"] = ( | 3919 ( |
3340 self.project.initMenus() | 3920 self.__menus["project"], |
3341 ) | 3921 self.__menus["project_tools"], |
3922 ) = self.project.initMenus() | |
3342 mb.addMenu(self.__menus["project"]) | 3923 mb.addMenu(self.__menus["project"]) |
3343 mb.addMenu(self.__menus["project_tools"]) | 3924 mb.addMenu(self.__menus["project_tools"]) |
3344 | 3925 |
3345 ############################################################## | 3926 ############################################################## |
3346 ## Start and Debug menus | 3927 ## Start and Debug menus |
3347 ############################################################## | 3928 ############################################################## |
3348 | 3929 |
3349 self.__menus["start"], self.__menus["debug"] = ( | 3930 self.__menus["start"], self.__menus["debug"] = self.debuggerUI.initMenus() |
3350 self.debuggerUI.initMenus() | |
3351 ) | |
3352 mb.addMenu(self.__menus["start"]) | 3931 mb.addMenu(self.__menus["start"]) |
3353 mb.addMenu(self.__menus["debug"]) | 3932 mb.addMenu(self.__menus["debug"]) |
3354 | 3933 |
3355 ############################################################## | 3934 ############################################################## |
3356 ## Extras menu | 3935 ## Extras menu |
3357 ############################################################## | 3936 ############################################################## |
3358 | 3937 |
3359 self.__menus["extras"] = QMenu(self.tr('E&xtras'), self) | 3938 self.__menus["extras"] = QMenu(self.tr("E&xtras"), self) |
3360 self.__menus["extras"].setTearOffEnabled(True) | 3939 self.__menus["extras"].setTearOffEnabled(True) |
3361 self.__menus["extras"].aboutToShow.connect(self.__showExtrasMenu) | 3940 self.__menus["extras"].aboutToShow.connect(self.__showExtrasMenu) |
3362 mb.addMenu(self.__menus["extras"]) | 3941 mb.addMenu(self.__menus["extras"]) |
3363 self.viewmanager.addToExtrasMenu(self.__menus["extras"]) | 3942 self.viewmanager.addToExtrasMenu(self.__menus["extras"]) |
3364 | 3943 |
3365 ############################################################## | 3944 ############################################################## |
3366 ## Extras/Wizards menu | 3945 ## Extras/Wizards menu |
3367 ############################################################## | 3946 ############################################################## |
3368 | 3947 |
3369 self.__menus["wizards"] = QMenu(self.tr('Wi&zards'), self) | 3948 self.__menus["wizards"] = QMenu(self.tr("Wi&zards"), self) |
3370 self.__menus["wizards"].setTearOffEnabled(True) | 3949 self.__menus["wizards"].setTearOffEnabled(True) |
3371 self.__menus["wizards"].aboutToShow.connect(self.__showWizardsMenu) | 3950 self.__menus["wizards"].aboutToShow.connect(self.__showWizardsMenu) |
3372 self.wizardsMenuAct = self.__menus["extras"].addMenu( | 3951 self.wizardsMenuAct = self.__menus["extras"].addMenu(self.__menus["wizards"]) |
3373 self.__menus["wizards"]) | |
3374 self.wizardsMenuAct.setEnabled(False) | 3952 self.wizardsMenuAct.setEnabled(False) |
3375 | 3953 |
3376 ############################################################## | 3954 ############################################################## |
3377 ## Extras/Macros menu | 3955 ## Extras/Macros menu |
3378 ############################################################## | 3956 ############################################################## |
3379 | 3957 |
3380 self.__menus["macros"] = self.viewmanager.initMacroMenu() | 3958 self.__menus["macros"] = self.viewmanager.initMacroMenu() |
3381 self.__menus["extras"].addMenu(self.__menus["macros"]) | 3959 self.__menus["extras"].addMenu(self.__menus["macros"]) |
3382 self.__menus["extras"].addSeparator() | 3960 self.__menus["extras"].addSeparator() |
3383 | 3961 |
3384 ############################################################## | 3962 ############################################################## |
3385 ## Extras/Plugins menu | 3963 ## Extras/Plugins menu |
3386 ############################################################## | 3964 ############################################################## |
3387 | 3965 |
3388 pluginsMenu = QMenu(self.tr('P&lugins'), self) | 3966 pluginsMenu = QMenu(self.tr("P&lugins"), self) |
3389 pluginsMenu.setIcon(UI.PixmapCache.getIcon("plugin")) | 3967 pluginsMenu.setIcon(UI.PixmapCache.getIcon("plugin")) |
3390 pluginsMenu.setTearOffEnabled(True) | 3968 pluginsMenu.setTearOffEnabled(True) |
3391 pluginsMenu.addAction(self.pluginInfoAct) | 3969 pluginsMenu.addAction(self.pluginInfoAct) |
3392 pluginsMenu.addAction(self.pluginInstallAct) | 3970 pluginsMenu.addAction(self.pluginInstallAct) |
3393 pluginsMenu.addAction(self.pluginDeinstallAct) | 3971 pluginsMenu.addAction(self.pluginDeinstallAct) |
3394 pluginsMenu.addSeparator() | 3972 pluginsMenu.addSeparator() |
3395 pluginsMenu.addAction(self.pluginRepoAct) | 3973 pluginsMenu.addAction(self.pluginRepoAct) |
3396 pluginsMenu.addSeparator() | 3974 pluginsMenu.addSeparator() |
3397 pluginsMenu.addAction( | 3975 pluginsMenu.addAction(self.tr("Configure..."), self.__pluginsConfigure) |
3398 self.tr("Configure..."), self.__pluginsConfigure) | 3976 |
3399 | |
3400 self.__menus["extras"].addMenu(pluginsMenu) | 3977 self.__menus["extras"].addMenu(pluginsMenu) |
3401 self.__menus["extras"].addSeparator() | 3978 self.__menus["extras"].addSeparator() |
3402 | 3979 |
3403 ############################################################## | 3980 ############################################################## |
3404 ## Extras/Unittest menu | 3981 ## Extras/Unittest menu |
3405 ############################################################## | 3982 ############################################################## |
3406 | 3983 |
3407 self.__menus["testing"] = QMenu(self.tr('&Testing'), self) | 3984 self.__menus["testing"] = QMenu(self.tr("&Testing"), self) |
3408 self.__menus["testing"].setTearOffEnabled(True) | 3985 self.__menus["testing"].setTearOffEnabled(True) |
3409 self.__menus["testing"].addAction(self.testingDialogAct) | 3986 self.__menus["testing"].addAction(self.testingDialogAct) |
3410 self.__menus["testing"].addSeparator() | 3987 self.__menus["testing"].addSeparator() |
3411 self.__menus["testing"].addAction(self.restartTestAct) | 3988 self.__menus["testing"].addAction(self.restartTestAct) |
3412 self.__menus["testing"].addAction(self.rerunFailedTestsAct) | 3989 self.__menus["testing"].addAction(self.rerunFailedTestsAct) |
3413 self.__menus["testing"].addSeparator() | 3990 self.__menus["testing"].addSeparator() |
3414 self.__menus["testing"].addAction(self.testScriptAct) | 3991 self.__menus["testing"].addAction(self.testScriptAct) |
3415 self.__menus["testing"].addAction(self.testProjectAct) | 3992 self.__menus["testing"].addAction(self.testProjectAct) |
3416 | 3993 |
3417 self.__menus["extras"].addMenu(self.__menus["testing"]) | 3994 self.__menus["extras"].addMenu(self.__menus["testing"]) |
3418 self.__menus["extras"].addSeparator() | 3995 self.__menus["extras"].addSeparator() |
3419 | 3996 |
3420 ############################################################## | 3997 ############################################################## |
3421 ## Extras/Builtin,Plugin,User tools menus | 3998 ## Extras/Builtin,Plugin,User tools menus |
3422 ############################################################## | 3999 ############################################################## |
3423 | 4000 |
3424 self.toolGroupsMenu = QMenu(self.tr("Select Tool Group"), self) | 4001 self.toolGroupsMenu = QMenu(self.tr("Select Tool Group"), self) |
3425 self.toolGroupsMenu.aboutToShow.connect(self.__showToolGroupsMenu) | 4002 self.toolGroupsMenu.aboutToShow.connect(self.__showToolGroupsMenu) |
3426 self.toolGroupsMenu.triggered.connect(self.__toolGroupSelected) | 4003 self.toolGroupsMenu.triggered.connect(self.__toolGroupSelected) |
3427 self.toolGroupsMenuTriggered = False | 4004 self.toolGroupsMenuTriggered = False |
3428 self.__initToolsMenus(self.__menus["extras"]) | 4005 self.__initToolsMenus(self.__menus["extras"]) |
3429 self.__menus["extras"].addSeparator() | 4006 self.__menus["extras"].addSeparator() |
3430 | 4007 |
3431 ############################################################## | 4008 ############################################################## |
3432 ## Settings menu | 4009 ## Settings menu |
3433 ############################################################## | 4010 ############################################################## |
3434 | 4011 |
3435 self.__menus["settings"] = QMenu(self.tr('Se&ttings'), self) | 4012 self.__menus["settings"] = QMenu(self.tr("Se&ttings"), self) |
3436 mb.addMenu(self.__menus["settings"]) | 4013 mb.addMenu(self.__menus["settings"]) |
3437 self.__menus["settings"].setTearOffEnabled(True) | 4014 self.__menus["settings"].setTearOffEnabled(True) |
3438 | 4015 |
3439 self.__menus["settings"].addAction(self.prefAct) | 4016 self.__menus["settings"].addAction(self.prefAct) |
3440 self.__menus["settings"].addAction(self.prefExportAct) | 4017 self.__menus["settings"].addAction(self.prefExportAct) |
3441 self.__menus["settings"].addAction(self.prefImportAct) | 4018 self.__menus["settings"].addAction(self.prefImportAct) |
3442 self.__menus["settings"].addSeparator() | 4019 self.__menus["settings"].addSeparator() |
3443 self.__menus["settings"].addAction(self.themeExportAct) | 4020 self.__menus["settings"].addAction(self.themeExportAct) |
3458 self.__menus["settings"].addAction(self.certificatesAct) | 4035 self.__menus["settings"].addAction(self.certificatesAct) |
3459 self.__menus["settings"].addSeparator() | 4036 self.__menus["settings"].addSeparator() |
3460 self.__menus["settings"].addAction(self.editMessageFilterAct) | 4037 self.__menus["settings"].addAction(self.editMessageFilterAct) |
3461 self.__menus["settings"].addSeparator() | 4038 self.__menus["settings"].addSeparator() |
3462 self.__menus["settings"].addAction(self.clearPrivateDataAct) | 4039 self.__menus["settings"].addAction(self.clearPrivateDataAct) |
3463 | 4040 |
3464 ############################################################## | 4041 ############################################################## |
3465 ## Window menu | 4042 ## Window menu |
3466 ############################################################## | 4043 ############################################################## |
3467 | 4044 |
3468 self.__menus["window"] = QMenu(self.tr('&Window'), self) | 4045 self.__menus["window"] = QMenu(self.tr("&Window"), self) |
3469 mb.addMenu(self.__menus["window"]) | 4046 mb.addMenu(self.__menus["window"]) |
3470 self.__menus["window"].setTearOffEnabled(True) | 4047 self.__menus["window"].setTearOffEnabled(True) |
3471 self.__menus["window"].aboutToShow.connect(self.__showWindowMenu) | 4048 self.__menus["window"].aboutToShow.connect(self.__showWindowMenu) |
3472 | 4049 |
3473 ############################################################## | 4050 ############################################################## |
3474 ## Window/Windows menu | 4051 ## Window/Windows menu |
3475 ############################################################## | 4052 ############################################################## |
3476 | 4053 |
3477 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), | 4054 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), self.__menus["window"]) |
3478 self.__menus["window"]) | |
3479 self.__menus["subwindow"].setTearOffEnabled(True) | 4055 self.__menus["subwindow"].setTearOffEnabled(True) |
3480 | 4056 |
3481 # central park | 4057 # central park |
3482 self.__menus["subwindow"].addSection(self.tr("Central Park")) | 4058 self.__menus["subwindow"].addSection(self.tr("Central Park")) |
3483 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) | 4059 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) |
3484 | 4060 |
3485 # left side | 4061 # left side |
3486 self.__menus["subwindow"].addSection(self.tr("Left Side")) | 4062 self.__menus["subwindow"].addSection(self.tr("Left Side")) |
3487 self.__menus["subwindow"].addAction(self.mpbActivateAct) | 4063 self.__menus["subwindow"].addAction(self.mpbActivateAct) |
3488 self.__menus["subwindow"].addAction(self.pbActivateAct) | 4064 self.__menus["subwindow"].addAction(self.pbActivateAct) |
3489 if self.__findFileWidget is not None: | 4065 if self.__findFileWidget is not None: |
3497 self.__menus["subwindow"].addAction(self.templateViewerActivateAct) | 4073 self.__menus["subwindow"].addAction(self.templateViewerActivateAct) |
3498 if self.browser is not None: | 4074 if self.browser is not None: |
3499 self.__menus["subwindow"].addAction(self.browserActivateAct) | 4075 self.__menus["subwindow"].addAction(self.browserActivateAct) |
3500 if self.symbolsViewer is not None: | 4076 if self.symbolsViewer is not None: |
3501 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) | 4077 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) |
3502 | 4078 |
3503 # right side | 4079 # right side |
3504 if self.rightSidebar: | 4080 if self.rightSidebar: |
3505 self.__menus["subwindow"].addSection(self.tr("Right Side")) | 4081 self.__menus["subwindow"].addSection(self.tr("Right Side")) |
3506 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) | 4082 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) |
3507 if self.codeDocumentationViewer is not None: | 4083 if self.codeDocumentationViewer is not None: |
3508 self.__menus["subwindow"].addAction( | 4084 self.__menus["subwindow"].addAction(self.codeDocumentationViewerActivateAct) |
3509 self.codeDocumentationViewerActivateAct) | 4085 self.__menus["subwindow"].addAction(self.helpViewerActivateAct) |
3510 self.__menus["subwindow"].addAction( | 4086 self.__menus["subwindow"].addAction(self.pluginRepositoryViewerActivateAct) |
3511 self.helpViewerActivateAct) | |
3512 self.__menus["subwindow"].addAction( | |
3513 self.pluginRepositoryViewerActivateAct) | |
3514 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct) | 4087 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct) |
3515 if self.pipWidget is not None: | 4088 if self.pipWidget is not None: |
3516 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) | 4089 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) |
3517 if self.condaWidget is not None: | 4090 if self.condaWidget is not None: |
3518 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct) | 4091 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct) |
3519 if self.cooperation is not None: | 4092 if self.cooperation is not None: |
3520 self.__menus["subwindow"].addAction( | 4093 self.__menus["subwindow"].addAction(self.cooperationViewerActivateAct) |
3521 self.cooperationViewerActivateAct) | |
3522 if self.irc is not None: | 4094 if self.irc is not None: |
3523 self.__menus["subwindow"].addAction(self.ircActivateAct) | 4095 self.__menus["subwindow"].addAction(self.ircActivateAct) |
3524 if self.microPythonWidget is not None: | 4096 if self.microPythonWidget is not None: |
3525 self.__menus["subwindow"].addAction( | 4097 self.__menus["subwindow"].addAction(self.microPythonWidgetActivateAct) |
3526 self.microPythonWidgetActivateAct) | 4098 |
3527 | |
3528 # bottom side | 4099 # bottom side |
3529 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) | 4100 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) |
3530 self.__menus["subwindow"].addAction(self.shellActivateAct) | 4101 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3531 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) | 4102 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) |
3532 self.__menus["subwindow"].addAction(self.logViewerActivateAct) | 4103 self.__menus["subwindow"].addAction(self.logViewerActivateAct) |
3533 if self.numbersViewer is not None: | 4104 if self.numbersViewer is not None: |
3534 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) | 4105 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) |
3535 | 4106 |
3536 # plug-in provided windows | 4107 # plug-in provided windows |
3537 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) | 4108 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
3538 | 4109 |
3539 ############################################################## | 4110 ############################################################## |
3540 ## Window/Toolbars menu | 4111 ## Window/Toolbars menu |
3541 ############################################################## | 4112 ############################################################## |
3542 | 4113 |
3543 self.__menus["toolbars"] = QMenu( | 4114 self.__menus["toolbars"] = QMenu(self.tr("&Toolbars"), self.__menus["window"]) |
3544 self.tr("&Toolbars"), self.__menus["window"]) | |
3545 self.__menus["toolbars"].setTearOffEnabled(True) | 4115 self.__menus["toolbars"].setTearOffEnabled(True) |
3546 self.__menus["toolbars"].aboutToShow.connect(self.__showToolbarsMenu) | 4116 self.__menus["toolbars"].aboutToShow.connect(self.__showToolbarsMenu) |
3547 self.__menus["toolbars"].triggered.connect(self.__TBMenuTriggered) | 4117 self.__menus["toolbars"].triggered.connect(self.__TBMenuTriggered) |
3548 | 4118 |
3549 self.__showWindowMenu() # to initialize these actions | 4119 self.__showWindowMenu() # to initialize these actions |
3550 | 4120 |
3551 mb.addSeparator() | 4121 mb.addSeparator() |
3552 | 4122 |
3553 ############################################################## | 4123 ############################################################## |
3554 ## Help menu | 4124 ## Help menu |
3555 ############################################################## | 4125 ############################################################## |
3556 | 4126 |
3557 self.__menus["help"] = QMenu(self.tr('&Help'), self) | 4127 self.__menus["help"] = QMenu(self.tr("&Help"), self) |
3558 mb.addMenu(self.__menus["help"]) | 4128 mb.addMenu(self.__menus["help"]) |
3559 self.__menus["help"].setTearOffEnabled(True) | 4129 self.__menus["help"].setTearOffEnabled(True) |
3560 if self.helpviewerAct: | 4130 if self.helpviewerAct: |
3561 self.__menus["help"].addAction(self.helpviewerAct) | 4131 self.__menus["help"].addAction(self.helpviewerAct) |
3562 self.__menus["help"].addSeparator() | 4132 self.__menus["help"].addSeparator() |
3579 self.__menus["help"].addAction(self.reportBugAct) | 4149 self.__menus["help"].addAction(self.reportBugAct) |
3580 self.__menus["help"].addAction(self.requestFeatureAct) | 4150 self.__menus["help"].addAction(self.requestFeatureAct) |
3581 self.__menus["help"].addSeparator() | 4151 self.__menus["help"].addSeparator() |
3582 self.__menus["help"].addAction(self.whatsThisAct) | 4152 self.__menus["help"].addAction(self.whatsThisAct) |
3583 self.__menus["help"].aboutToShow.connect(self.__showHelpMenu) | 4153 self.__menus["help"].aboutToShow.connect(self.__showHelpMenu) |
3584 | 4154 |
3585 def getToolBarIconSize(self): | 4155 def getToolBarIconSize(self): |
3586 """ | 4156 """ |
3587 Public method to get the toolbar icon size. | 4157 Public method to get the toolbar icon size. |
3588 | 4158 |
3589 @return toolbar icon size (QSize) | 4159 @return toolbar icon size (QSize) |
3590 """ | 4160 """ |
3591 return Config.ToolBarIconSize | 4161 return Config.ToolBarIconSize |
3592 | 4162 |
3593 def __initToolbars(self): | 4163 def __initToolbars(self): |
3594 """ | 4164 """ |
3595 Private slot to create the toolbars. | 4165 Private slot to create the toolbars. |
3596 """ | 4166 """ |
3597 filetb = self.viewmanager.initFileToolbar(self.toolbarManager) | 4167 filetb = self.viewmanager.initFileToolbar(self.toolbarManager) |
3607 spellingtb = self.viewmanager.initSpellingToolbar(self.toolbarManager) | 4177 spellingtb = self.viewmanager.initSpellingToolbar(self.toolbarManager) |
3608 settingstb = QToolBar(self.tr("Settings"), self) | 4178 settingstb = QToolBar(self.tr("Settings"), self) |
3609 helptb = QToolBar(self.tr("Help"), self) | 4179 helptb = QToolBar(self.tr("Help"), self) |
3610 profilestb = QToolBar(self.tr("Profiles"), self) | 4180 profilestb = QToolBar(self.tr("Profiles"), self) |
3611 pluginstb = QToolBar(self.tr("Plugins"), self) | 4181 pluginstb = QToolBar(self.tr("Plugins"), self) |
3612 | 4182 |
3613 toolstb.setIconSize(Config.ToolBarIconSize) | 4183 toolstb.setIconSize(Config.ToolBarIconSize) |
3614 testingtb.setIconSize(Config.ToolBarIconSize) | 4184 testingtb.setIconSize(Config.ToolBarIconSize) |
3615 settingstb.setIconSize(Config.ToolBarIconSize) | 4185 settingstb.setIconSize(Config.ToolBarIconSize) |
3616 helptb.setIconSize(Config.ToolBarIconSize) | 4186 helptb.setIconSize(Config.ToolBarIconSize) |
3617 profilestb.setIconSize(Config.ToolBarIconSize) | 4187 profilestb.setIconSize(Config.ToolBarIconSize) |
3618 pluginstb.setIconSize(Config.ToolBarIconSize) | 4188 pluginstb.setIconSize(Config.ToolBarIconSize) |
3619 | 4189 |
3620 toolstb.setObjectName("ToolsToolbar") | 4190 toolstb.setObjectName("ToolsToolbar") |
3621 testingtb.setObjectName("UnittestToolbar") | 4191 testingtb.setObjectName("UnittestToolbar") |
3622 settingstb.setObjectName("SettingsToolbar") | 4192 settingstb.setObjectName("SettingsToolbar") |
3623 helptb.setObjectName("HelpToolbar") | 4193 helptb.setObjectName("HelpToolbar") |
3624 profilestb.setObjectName("ProfilesToolbar") | 4194 profilestb.setObjectName("ProfilesToolbar") |
3625 pluginstb.setObjectName("PluginsToolbar") | 4195 pluginstb.setObjectName("PluginsToolbar") |
3626 | 4196 |
3627 toolstb.setToolTip(self.tr("Tools")) | 4197 toolstb.setToolTip(self.tr("Tools")) |
3628 testingtb.setToolTip(self.tr("Unittest")) | 4198 testingtb.setToolTip(self.tr("Unittest")) |
3629 settingstb.setToolTip(self.tr("Settings")) | 4199 settingstb.setToolTip(self.tr("Settings")) |
3630 helptb.setToolTip(self.tr("Help")) | 4200 helptb.setToolTip(self.tr("Help")) |
3631 profilestb.setToolTip(self.tr("Profiles")) | 4201 profilestb.setToolTip(self.tr("Profiles")) |
3632 pluginstb.setToolTip(self.tr("Plugins")) | 4202 pluginstb.setToolTip(self.tr("Plugins")) |
3633 | 4203 |
3634 filetb.addSeparator() | 4204 filetb.addSeparator() |
3635 filetb.addAction(self.restartAct) | 4205 filetb.addAction(self.restartAct) |
3636 filetb.addAction(self.exitAct) | 4206 filetb.addAction(self.exitAct) |
3637 act = filetb.actions()[0] | 4207 act = filetb.actions()[0] |
3638 sep = filetb.insertSeparator(act) | 4208 sep = filetb.insertSeparator(act) |
3639 filetb.insertAction(sep, self.newWindowAct) | 4209 filetb.insertAction(sep, self.newWindowAct) |
3640 self.toolbarManager.addToolBar(filetb, filetb.windowTitle()) | 4210 self.toolbarManager.addToolBar(filetb, filetb.windowTitle()) |
3641 | 4211 |
3642 # setup the testing toolbar | 4212 # setup the testing toolbar |
3643 testingtb.addAction(self.testingDialogAct) | 4213 testingtb.addAction(self.testingDialogAct) |
3644 testingtb.addSeparator() | 4214 testingtb.addSeparator() |
3645 testingtb.addAction(self.restartTestAct) | 4215 testingtb.addAction(self.restartTestAct) |
3646 testingtb.addAction(self.rerunFailedTestsAct) | 4216 testingtb.addAction(self.rerunFailedTestsAct) |
3647 testingtb.addSeparator() | 4217 testingtb.addSeparator() |
3648 testingtb.addAction(self.testScriptAct) | 4218 testingtb.addAction(self.testScriptAct) |
3649 testingtb.addAction(self.testProjectAct) | 4219 testingtb.addAction(self.testProjectAct) |
3650 self.toolbarManager.addToolBar(testingtb, testingtb.windowTitle()) | 4220 self.toolbarManager.addToolBar(testingtb, testingtb.windowTitle()) |
3651 | 4221 |
3652 # setup the tools toolbar | 4222 # setup the tools toolbar |
3653 if self.designer4Act is not None: | 4223 if self.designer4Act is not None: |
3654 toolstb.addAction(self.designer4Act) | 4224 toolstb.addAction(self.designer4Act) |
3655 if self.linguist4Act is not None: | 4225 if self.linguist4Act is not None: |
3656 toolstb.addAction(self.linguist4Act) | 4226 toolstb.addAction(self.linguist4Act) |
3668 toolstb.addAction(self.snapshotAct) | 4238 toolstb.addAction(self.snapshotAct) |
3669 if self.webBrowserAct: | 4239 if self.webBrowserAct: |
3670 toolstb.addSeparator() | 4240 toolstb.addSeparator() |
3671 toolstb.addAction(self.webBrowserAct) | 4241 toolstb.addAction(self.webBrowserAct) |
3672 self.toolbarManager.addToolBar(toolstb, toolstb.windowTitle()) | 4242 self.toolbarManager.addToolBar(toolstb, toolstb.windowTitle()) |
3673 | 4243 |
3674 # setup the settings toolbar | 4244 # setup the settings toolbar |
3675 settingstb.addAction(self.prefAct) | 4245 settingstb.addAction(self.prefAct) |
3676 settingstb.addAction(self.configViewProfilesAct) | 4246 settingstb.addAction(self.configViewProfilesAct) |
3677 settingstb.addAction(self.configToolBarsAct) | 4247 settingstb.addAction(self.configToolBarsAct) |
3678 settingstb.addAction(self.shortcutsAct) | 4248 settingstb.addAction(self.shortcutsAct) |
3679 settingstb.addAction(self.showExternalToolsAct) | 4249 settingstb.addAction(self.showExternalToolsAct) |
3680 self.toolbarManager.addToolBar(settingstb, settingstb.windowTitle()) | 4250 self.toolbarManager.addToolBar(settingstb, settingstb.windowTitle()) |
3681 self.toolbarManager.addActions([ | 4251 self.toolbarManager.addActions( |
3682 self.exportShortcutsAct, | 4252 [ |
3683 self.importShortcutsAct, | 4253 self.exportShortcutsAct, |
3684 self.prefExportAct, | 4254 self.importShortcutsAct, |
3685 self.prefImportAct, | 4255 self.prefExportAct, |
3686 self.themeExportAct, | 4256 self.prefImportAct, |
3687 self.themeImportAct, | 4257 self.themeExportAct, |
3688 self.showExternalToolsAct, | 4258 self.themeImportAct, |
3689 self.editMessageFilterAct, | 4259 self.showExternalToolsAct, |
3690 self.clearPrivateDataAct, | 4260 self.editMessageFilterAct, |
3691 ], settingstb.windowTitle()) | 4261 self.clearPrivateDataAct, |
4262 ], | |
4263 settingstb.windowTitle(), | |
4264 ) | |
3692 if SSL_AVAILABLE: | 4265 if SSL_AVAILABLE: |
3693 self.toolbarManager.addAction( | 4266 self.toolbarManager.addAction( |
3694 self.certificatesAct, settingstb.windowTitle()) | 4267 self.certificatesAct, settingstb.windowTitle() |
3695 | 4268 ) |
4269 | |
3696 # setup the help toolbar | 4270 # setup the help toolbar |
3697 helptb.addAction(self.whatsThisAct) | 4271 helptb.addAction(self.whatsThisAct) |
3698 self.toolbarManager.addToolBar(helptb, helptb.windowTitle()) | 4272 self.toolbarManager.addToolBar(helptb, helptb.windowTitle()) |
3699 if self.helpviewerAct: | 4273 if self.helpviewerAct: |
3700 self.toolbarManager.addAction(self.helpviewerAct, | 4274 self.toolbarManager.addAction(self.helpviewerAct, helptb.windowTitle()) |
3701 helptb.windowTitle()) | 4275 |
3702 | |
3703 # setup the view profiles toolbar | 4276 # setup the view profiles toolbar |
3704 profilestb.addActions(self.viewProfileActGrp.actions()) | 4277 profilestb.addActions(self.viewProfileActGrp.actions()) |
3705 self.toolbarManager.addToolBar(profilestb, profilestb.windowTitle()) | 4278 self.toolbarManager.addToolBar(profilestb, profilestb.windowTitle()) |
3706 | 4279 |
3707 # setup the plugins toolbar | 4280 # setup the plugins toolbar |
3708 pluginstb.addAction(self.pluginInfoAct) | 4281 pluginstb.addAction(self.pluginInfoAct) |
3709 pluginstb.addAction(self.pluginInstallAct) | 4282 pluginstb.addAction(self.pluginInstallAct) |
3710 pluginstb.addAction(self.pluginDeinstallAct) | 4283 pluginstb.addAction(self.pluginDeinstallAct) |
3711 pluginstb.addSeparator() | 4284 pluginstb.addSeparator() |
3712 pluginstb.addAction(self.pluginRepoAct) | 4285 pluginstb.addAction(self.pluginRepoAct) |
3713 self.toolbarManager.addToolBar(pluginstb, pluginstb.windowTitle()) | 4286 self.toolbarManager.addToolBar(pluginstb, pluginstb.windowTitle()) |
3714 | 4287 |
3715 # add the various toolbars | 4288 # add the various toolbars |
3716 self.addToolBar(filetb) | 4289 self.addToolBar(filetb) |
3717 self.addToolBar(edittb) | 4290 self.addToolBar(edittb) |
3718 self.addToolBar(searchtb) | 4291 self.addToolBar(searchtb) |
3719 self.addToolBar(viewtb) | 4292 self.addToolBar(viewtb) |
3728 self.addToolBar(bookmarktb) | 4301 self.addToolBar(bookmarktb) |
3729 self.addToolBar(spellingtb) | 4302 self.addToolBar(spellingtb) |
3730 self.addToolBar(testingtb) | 4303 self.addToolBar(testingtb) |
3731 self.addToolBar(profilestb) | 4304 self.addToolBar(profilestb) |
3732 self.addToolBar(pluginstb) | 4305 self.addToolBar(pluginstb) |
3733 | 4306 |
3734 # hide toolbars not wanted in the initial layout | 4307 # hide toolbars not wanted in the initial layout |
3735 searchtb.hide() | 4308 searchtb.hide() |
3736 viewtb.hide() | 4309 viewtb.hide() |
3737 debugtb.hide() | 4310 debugtb.hide() |
3738 multiprojecttb.hide() | 4311 multiprojecttb.hide() |
3750 self.__toolbars["start"] = [starttb.windowTitle(), starttb, ""] | 4323 self.__toolbars["start"] = [starttb.windowTitle(), starttb, ""] |
3751 self.__toolbars["debug"] = [debugtb.windowTitle(), debugtb, ""] | 4324 self.__toolbars["debug"] = [debugtb.windowTitle(), debugtb, ""] |
3752 self.__toolbars["project"] = [projecttb.windowTitle(), projecttb, ""] | 4325 self.__toolbars["project"] = [projecttb.windowTitle(), projecttb, ""] |
3753 self.__toolbars["tools"] = [toolstb.windowTitle(), toolstb, ""] | 4326 self.__toolbars["tools"] = [toolstb.windowTitle(), toolstb, ""] |
3754 self.__toolbars["help"] = [helptb.windowTitle(), helptb, ""] | 4327 self.__toolbars["help"] = [helptb.windowTitle(), helptb, ""] |
3755 self.__toolbars["settings"] = [settingstb.windowTitle(), settingstb, | 4328 self.__toolbars["settings"] = [settingstb.windowTitle(), settingstb, ""] |
3756 ""] | 4329 self.__toolbars["bookmarks"] = [bookmarktb.windowTitle(), bookmarktb, ""] |
3757 self.__toolbars["bookmarks"] = [bookmarktb.windowTitle(), bookmarktb, | |
3758 ""] | |
3759 self.__toolbars["testing"] = [testingtb.windowTitle(), testingtb, ""] | 4330 self.__toolbars["testing"] = [testingtb.windowTitle(), testingtb, ""] |
3760 self.__toolbars["view_profiles"] = [profilestb.windowTitle(), | 4331 self.__toolbars["view_profiles"] = [profilestb.windowTitle(), profilestb, ""] |
3761 profilestb, ""] | |
3762 self.__toolbars["plugins"] = [pluginstb.windowTitle(), pluginstb, ""] | 4332 self.__toolbars["plugins"] = [pluginstb.windowTitle(), pluginstb, ""] |
3763 self.__toolbars["multiproject"] = [multiprojecttb.windowTitle(), | 4333 self.__toolbars["multiproject"] = [ |
3764 multiprojecttb, ""] | 4334 multiprojecttb.windowTitle(), |
3765 self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb, | 4335 multiprojecttb, |
3766 ""] | 4336 "", |
4337 ] | |
4338 self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb, ""] | |
3767 self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb, "vcs"] | 4339 self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb, "vcs"] |
3768 | 4340 |
3769 def __initDebugToolbarsLayout(self): | 4341 def __initDebugToolbarsLayout(self): |
3770 """ | 4342 """ |
3771 Private slot to initialize the toolbars layout for the debug profile. | 4343 Private slot to initialize the toolbars layout for the debug profile. |
3772 """ | 4344 """ |
3773 # Step 1: set the edit profile to be sure | 4345 # Step 1: set the edit profile to be sure |
3774 self.__setEditProfile() | 4346 self.__setEditProfile() |
3775 | 4347 |
3776 # Step 2: switch to debug profile and do the layout | 4348 # Step 2: switch to debug profile and do the layout |
3777 initSize = self.size() | 4349 initSize = self.size() |
3778 self.setDebugProfile() | 4350 self.setDebugProfile() |
3779 self.__toolbars["project"][1].hide() | 4351 self.__toolbars["project"][1].hide() |
3780 self.__toolbars["debug"][1].show() | 4352 self.__toolbars["debug"][1].show() |
3781 self.resize(initSize) | 4353 self.resize(initSize) |
3782 | 4354 |
3783 # Step 3: switch back to edit profile | 4355 # Step 3: switch back to edit profile |
3784 self.__setEditProfile() | 4356 self.__setEditProfile() |
3785 | 4357 |
3786 def __initStatusbar(self): | 4358 def __initStatusbar(self): |
3787 """ | 4359 """ |
3788 Private slot to set up the status bar. | 4360 Private slot to set up the status bar. |
3789 """ | 4361 """ |
3790 self.__statusBar = self.statusBar() | 4362 self.__statusBar = self.statusBar() |
3791 self.__statusBar.setSizeGripEnabled(True) | 4363 self.__statusBar.setSizeGripEnabled(True) |
3792 | 4364 |
3793 self.sbLanguage = EricClickableLabel(self.__statusBar) | 4365 self.sbLanguage = EricClickableLabel(self.__statusBar) |
3794 self.__statusBar.addPermanentWidget(self.sbLanguage) | 4366 self.__statusBar.addPermanentWidget(self.sbLanguage) |
3795 self.sbLanguage.setWhatsThis(self.tr( | 4367 self.sbLanguage.setWhatsThis( |
3796 """<p>This part of the status bar displays the""" | 4368 self.tr( |
3797 """ current editors language.</p>""" | 4369 """<p>This part of the status bar displays the""" |
3798 )) | 4370 """ current editors language.</p>""" |
4371 ) | |
4372 ) | |
3799 | 4373 |
3800 self.sbEncoding = EricClickableLabel(self.__statusBar) | 4374 self.sbEncoding = EricClickableLabel(self.__statusBar) |
3801 self.__statusBar.addPermanentWidget(self.sbEncoding) | 4375 self.__statusBar.addPermanentWidget(self.sbEncoding) |
3802 self.sbEncoding.setWhatsThis(self.tr( | 4376 self.sbEncoding.setWhatsThis( |
3803 """<p>This part of the status bar displays the""" | 4377 self.tr( |
3804 """ current editors encoding.</p>""" | 4378 """<p>This part of the status bar displays the""" |
3805 )) | 4379 """ current editors encoding.</p>""" |
4380 ) | |
4381 ) | |
3806 | 4382 |
3807 self.sbEol = EricClickableLabel(self.__statusBar) | 4383 self.sbEol = EricClickableLabel(self.__statusBar) |
3808 self.__statusBar.addPermanentWidget(self.sbEol) | 4384 self.__statusBar.addPermanentWidget(self.sbEol) |
3809 self.sbEol.setWhatsThis(self.tr( | 4385 self.sbEol.setWhatsThis( |
3810 """<p>This part of the status bar displays the""" | 4386 self.tr( |
3811 """ current editors eol setting.</p>""" | 4387 """<p>This part of the status bar displays the""" |
3812 )) | 4388 """ current editors eol setting.</p>""" |
4389 ) | |
4390 ) | |
3813 | 4391 |
3814 self.sbWritable = QLabel(self.__statusBar) | 4392 self.sbWritable = QLabel(self.__statusBar) |
3815 self.__statusBar.addPermanentWidget(self.sbWritable) | 4393 self.__statusBar.addPermanentWidget(self.sbWritable) |
3816 self.sbWritable.setWhatsThis(self.tr( | 4394 self.sbWritable.setWhatsThis( |
3817 """<p>This part of the status bar displays an indication of the""" | 4395 self.tr( |
3818 """ current editors files writability.</p>""" | 4396 """<p>This part of the status bar displays an indication of the""" |
3819 )) | 4397 """ current editors files writability.</p>""" |
4398 ) | |
4399 ) | |
3820 | 4400 |
3821 self.sbLine = QLabel(self.__statusBar) | 4401 self.sbLine = QLabel(self.__statusBar) |
3822 self.__statusBar.addPermanentWidget(self.sbLine) | 4402 self.__statusBar.addPermanentWidget(self.sbLine) |
3823 self.sbLine.setWhatsThis(self.tr( | 4403 self.sbLine.setWhatsThis( |
3824 """<p>This part of the status bar displays the line number of""" | 4404 self.tr( |
3825 """ the current editor.</p>""" | 4405 """<p>This part of the status bar displays the line number of""" |
3826 )) | 4406 """ the current editor.</p>""" |
4407 ) | |
4408 ) | |
3827 | 4409 |
3828 self.sbPos = QLabel(self.__statusBar) | 4410 self.sbPos = QLabel(self.__statusBar) |
3829 self.__statusBar.addPermanentWidget(self.sbPos) | 4411 self.__statusBar.addPermanentWidget(self.sbPos) |
3830 self.sbPos.setWhatsThis(self.tr( | 4412 self.sbPos.setWhatsThis( |
3831 """<p>This part of the status bar displays the cursor position""" | 4413 self.tr( |
3832 """ of the current editor.</p>""" | 4414 """<p>This part of the status bar displays the cursor position""" |
3833 )) | 4415 """ of the current editor.</p>""" |
3834 | 4416 ) |
4417 ) | |
4418 | |
3835 self.sbZoom = EricZoomWidget( | 4419 self.sbZoom = EricZoomWidget( |
3836 UI.PixmapCache.getPixmap("zoomOut"), | 4420 UI.PixmapCache.getPixmap("zoomOut"), |
3837 UI.PixmapCache.getPixmap("zoomIn"), | 4421 UI.PixmapCache.getPixmap("zoomIn"), |
3838 UI.PixmapCache.getPixmap("zoomReset"), | 4422 UI.PixmapCache.getPixmap("zoomReset"), |
3839 self.__statusBar) | 4423 self.__statusBar, |
4424 ) | |
3840 self.__statusBar.addPermanentWidget(self.sbZoom) | 4425 self.__statusBar.addPermanentWidget(self.sbZoom) |
3841 self.sbZoom.setWhatsThis(self.tr( | 4426 self.sbZoom.setWhatsThis( |
3842 """<p>This part of the status bar allows zooming the current""" | 4427 self.tr( |
3843 """ editor or shell.</p>""" | 4428 """<p>This part of the status bar allows zooming the current""" |
3844 )) | 4429 """ editor or shell.</p>""" |
3845 | 4430 ) |
4431 ) | |
4432 | |
3846 self.viewmanager.setSbInfo( | 4433 self.viewmanager.setSbInfo( |
3847 self.sbLine, self.sbPos, self.sbWritable, self.sbEncoding, | 4434 self.sbLine, |
3848 self.sbLanguage, self.sbEol, self.sbZoom) | 4435 self.sbPos, |
4436 self.sbWritable, | |
4437 self.sbEncoding, | |
4438 self.sbLanguage, | |
4439 self.sbEol, | |
4440 self.sbZoom, | |
4441 ) | |
3849 | 4442 |
3850 from VCS.StatusMonitorLed import StatusMonitorLedWidget | 4443 from VCS.StatusMonitorLed import StatusMonitorLedWidget |
3851 self.sbVcsMonitorLed = StatusMonitorLedWidget( | 4444 |
3852 self.project, self.__statusBar) | 4445 self.sbVcsMonitorLed = StatusMonitorLedWidget(self.project, self.__statusBar) |
3853 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) | 4446 self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed) |
3854 | 4447 |
3855 self.networkIcon = EricNetworkIcon(self.__statusBar) | 4448 self.networkIcon = EricNetworkIcon(self.__statusBar) |
3856 self.__statusBar.addPermanentWidget(self.networkIcon) | 4449 self.__statusBar.addPermanentWidget(self.networkIcon) |
3857 self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) | 4450 self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged) |
3858 self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged) | 4451 self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged) |
3859 | 4452 |
3860 def __initExternalToolsActions(self): | 4453 def __initExternalToolsActions(self): |
3861 """ | 4454 """ |
3862 Private slot to create actions for the configured external tools. | 4455 Private slot to create actions for the configured external tools. |
3863 """ | 4456 """ |
3864 self.toolGroupActions = {} | 4457 self.toolGroupActions = {} |
3865 for toolGroup in self.toolGroups: | 4458 for toolGroup in self.toolGroups: |
3866 category = self.tr("External Tools/{0}").format(toolGroup[0]) | 4459 category = self.tr("External Tools/{0}").format(toolGroup[0]) |
3867 for tool in toolGroup[1]: | 4460 for tool in toolGroup[1]: |
3868 if tool['menutext'] != '--': | 4461 if tool["menutext"] != "--": |
3869 act = QAction(UI.PixmapCache.getIcon(tool['icon']), | 4462 act = QAction( |
3870 tool['menutext'], self) | 4463 UI.PixmapCache.getIcon(tool["icon"]), tool["menutext"], self |
3871 act.setObjectName("{0}@@{1}".format(toolGroup[0], | 4464 ) |
3872 tool['menutext'])) | 4465 act.setObjectName("{0}@@{1}".format(toolGroup[0], tool["menutext"])) |
3873 act.triggered.connect( | 4466 act.triggered.connect( |
3874 functools.partial(self.__toolActionTriggered, act)) | 4467 functools.partial(self.__toolActionTriggered, act) |
4468 ) | |
3875 self.toolGroupActions[act.objectName()] = act | 4469 self.toolGroupActions[act.objectName()] = act |
3876 | 4470 |
3877 self.toolbarManager.addAction(act, category) | 4471 self.toolbarManager.addAction(act, category) |
3878 | 4472 |
3879 def __updateExternalToolsActions(self): | 4473 def __updateExternalToolsActions(self): |
3880 """ | 4474 """ |
3881 Private method to update the external tools actions for the current | 4475 Private method to update the external tools actions for the current |
3882 tool group. | 4476 tool group. |
3883 """ | 4477 """ |
3886 groupActionKeys = [] | 4480 groupActionKeys = [] |
3887 # step 1: get actions for this group | 4481 # step 1: get actions for this group |
3888 for key in self.toolGroupActions: | 4482 for key in self.toolGroupActions: |
3889 if key.startswith(groupkey): | 4483 if key.startswith(groupkey): |
3890 groupActionKeys.append(key) | 4484 groupActionKeys.append(key) |
3891 | 4485 |
3892 # step 2: build keys for all actions i.a.w. current configuration | 4486 # step 2: build keys for all actions i.a.w. current configuration |
3893 ckeys = [] | 4487 ckeys = [] |
3894 for tool in toolGroup[1]: | 4488 for tool in toolGroup[1]: |
3895 if tool['menutext'] != '--': | 4489 if tool["menutext"] != "--": |
3896 ckeys.append("{0}@@{1}".format(toolGroup[0], tool['menutext'])) | 4490 ckeys.append("{0}@@{1}".format(toolGroup[0], tool["menutext"])) |
3897 | 4491 |
3898 # step 3: remove all actions not configured any more | 4492 # step 3: remove all actions not configured any more |
3899 for key in groupActionKeys: | 4493 for key in groupActionKeys: |
3900 if key not in ckeys: | 4494 if key not in ckeys: |
3901 self.toolbarManager.removeAction(self.toolGroupActions[key]) | 4495 self.toolbarManager.removeAction(self.toolGroupActions[key]) |
3902 self.toolGroupActions[key].triggered.disconnect() | 4496 self.toolGroupActions[key].triggered.disconnect() |
3903 del self.toolGroupActions[key] | 4497 del self.toolGroupActions[key] |
3904 | 4498 |
3905 # step 4: add all newly configured tools | 4499 # step 4: add all newly configured tools |
3906 category = self.tr("External Tools/{0}").format(toolGroup[0]) | 4500 category = self.tr("External Tools/{0}").format(toolGroup[0]) |
3907 for tool in toolGroup[1]: | 4501 for tool in toolGroup[1]: |
3908 if tool['menutext'] != '--': | 4502 if tool["menutext"] != "--": |
3909 key = "{0}@@{1}".format(toolGroup[0], tool['menutext']) | 4503 key = "{0}@@{1}".format(toolGroup[0], tool["menutext"]) |
3910 if key not in groupActionKeys: | 4504 if key not in groupActionKeys: |
3911 act = QAction(UI.PixmapCache.getIcon(tool['icon']), | 4505 act = QAction( |
3912 tool['menutext'], self) | 4506 UI.PixmapCache.getIcon(tool["icon"]), tool["menutext"], self |
4507 ) | |
3913 act.setObjectName(key) | 4508 act.setObjectName(key) |
3914 act.triggered.connect( | 4509 act.triggered.connect( |
3915 functools.partial(self.__toolActionTriggered, act)) | 4510 functools.partial(self.__toolActionTriggered, act) |
4511 ) | |
3916 self.toolGroupActions[key] = act | 4512 self.toolGroupActions[key] = act |
3917 | 4513 |
3918 self.toolbarManager.addAction(act, category) | 4514 self.toolbarManager.addAction(act, category) |
3919 | 4515 |
3920 def __showFileMenu(self): | 4516 def __showFileMenu(self): |
3921 """ | 4517 """ |
3922 Private slot to display the File menu. | 4518 Private slot to display the File menu. |
3923 """ | 4519 """ |
3924 self.showMenu.emit("File", self.__menus["file"]) | 4520 self.showMenu.emit("File", self.__menus["file"]) |
3925 | 4521 |
3926 def __showExtrasMenu(self): | 4522 def __showExtrasMenu(self): |
3927 """ | 4523 """ |
3928 Private slot to display the Extras menu. | 4524 Private slot to display the Extras menu. |
3929 """ | 4525 """ |
3930 self.showMenu.emit("Extras", self.__menus["extras"]) | 4526 self.showMenu.emit("Extras", self.__menus["extras"]) |
3931 | 4527 |
3932 def __showWizardsMenu(self): | 4528 def __showWizardsMenu(self): |
3933 """ | 4529 """ |
3934 Private slot to display the Wizards menu. | 4530 Private slot to display the Wizards menu. |
3935 """ | 4531 """ |
3936 self.showMenu.emit("Wizards", self.__menus["wizards"]) | 4532 self.showMenu.emit("Wizards", self.__menus["wizards"]) |
3937 | 4533 |
3938 def __showHelpMenu(self): | 4534 def __showHelpMenu(self): |
3939 """ | 4535 """ |
3940 Private slot to display the Help menu. | 4536 Private slot to display the Help menu. |
3941 """ | 4537 """ |
3942 self.showErrorLogAct.setEnabled(self.__hasErrorLog()) | 4538 self.showErrorLogAct.setEnabled(self.__hasErrorLog()) |
3943 | 4539 |
3944 infoFileName = Globals.getInstallInfoFilePath() | 4540 infoFileName = Globals.getInstallInfoFilePath() |
3945 self.showInstallInfoAct.setEnabled(os.path.exists(infoFileName)) | 4541 self.showInstallInfoAct.setEnabled(os.path.exists(infoFileName)) |
3946 | 4542 |
3947 self.showMenu.emit("Help", self.__menus["help"]) | 4543 self.showMenu.emit("Help", self.__menus["help"]) |
3948 | 4544 |
3949 def __showSettingsMenu(self): | 4545 def __showSettingsMenu(self): |
3950 """ | 4546 """ |
3951 Private slot to show the Settings menu. | 4547 Private slot to show the Settings menu. |
3952 """ | 4548 """ |
3953 self.editMessageFilterAct.setEnabled( | 4549 self.editMessageFilterAct.setEnabled(EricErrorMessage.messageHandlerInstalled()) |
3954 EricErrorMessage.messageHandlerInstalled()) | 4550 |
3955 | |
3956 self.showMenu.emit("Settings", self.__menus["settings"]) | 4551 self.showMenu.emit("Settings", self.__menus["settings"]) |
3957 | 4552 |
3958 def __showNext(self): | 4553 def __showNext(self): |
3959 """ | 4554 """ |
3960 Private slot used to show the next tab or file. | 4555 Private slot used to show the next tab or file. |
3961 """ | 4556 """ |
3962 fwidget = QApplication.focusWidget() | 4557 fwidget = QApplication.focusWidget() |
3963 while fwidget and not hasattr(fwidget, 'nextTab'): | 4558 while fwidget and not hasattr(fwidget, "nextTab"): |
3964 fwidget = fwidget.parent() | 4559 fwidget = fwidget.parent() |
3965 if fwidget: | 4560 if fwidget: |
3966 fwidget.nextTab() | 4561 fwidget.nextTab() |
3967 | 4562 |
3968 def __showPrevious(self): | 4563 def __showPrevious(self): |
3969 """ | 4564 """ |
3970 Private slot used to show the previous tab or file. | 4565 Private slot used to show the previous tab or file. |
3971 """ | 4566 """ |
3972 fwidget = QApplication.focusWidget() | 4567 fwidget = QApplication.focusWidget() |
3973 while fwidget and not hasattr(fwidget, 'prevTab'): | 4568 while fwidget and not hasattr(fwidget, "prevTab"): |
3974 fwidget = fwidget.parent() | 4569 fwidget = fwidget.parent() |
3975 if fwidget: | 4570 if fwidget: |
3976 fwidget.prevTab() | 4571 fwidget.prevTab() |
3977 | 4572 |
3978 def __switchTab(self): | 4573 def __switchTab(self): |
3979 """ | 4574 """ |
3980 Private slot used to switch between the current and the previous | 4575 Private slot used to switch between the current and the previous |
3981 current tab. | 4576 current tab. |
3982 """ | 4577 """ |
3983 fwidget = QApplication.focusWidget() | 4578 fwidget = QApplication.focusWidget() |
3984 while fwidget and not hasattr(fwidget, 'switchTab'): | 4579 while fwidget and not hasattr(fwidget, "switchTab"): |
3985 fwidget = fwidget.parent() | 4580 fwidget = fwidget.parent() |
3986 if fwidget: | 4581 if fwidget: |
3987 fwidget.switchTab() | 4582 fwidget.switchTab() |
3988 | 4583 |
3989 def __whatsThis(self): | 4584 def __whatsThis(self): |
3990 """ | 4585 """ |
3991 Private slot called in to enter Whats This mode. | 4586 Private slot called in to enter Whats This mode. |
3992 """ | 4587 """ |
3993 QWhatsThis.enterWhatsThisMode() | 4588 QWhatsThis.enterWhatsThisMode() |
3994 | 4589 |
3995 def __showVersions(self): | 4590 def __showVersions(self): |
3996 """ | 4591 """ |
3997 Private slot to handle the Versions dialog. | 4592 Private slot to handle the Versions dialog. |
3998 """ | 4593 """ |
3999 from .VersionsDialog import VersionsDialog | 4594 from .VersionsDialog import VersionsDialog |
4000 | 4595 |
4001 try: | 4596 try: |
4002 try: | 4597 try: |
4003 from PyQt6 import sip | 4598 from PyQt6 import sip |
4004 except ImportError: | 4599 except ImportError: |
4005 import sip | 4600 import sip |
4006 sip_version_str = sip.SIP_VERSION_STR | 4601 sip_version_str = sip.SIP_VERSION_STR |
4007 except (ImportError, AttributeError): | 4602 except (ImportError, AttributeError): |
4008 sip_version_str = "sip version not available" | 4603 sip_version_str = "sip version not available" |
4009 | 4604 |
4010 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" | 4605 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" |
4011 | 4606 |
4012 versionText = self.tr( | 4607 versionText = self.tr("""<h2>Version Numbers</h2>""" """<table>""") |
4013 """<h2>Version Numbers</h2>""" | 4608 |
4014 """<table>""") | |
4015 | |
4016 # Python version | 4609 # Python version |
4017 versionText += ( | 4610 versionText += ("""<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""").format( |
4018 """<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>""" | 4611 sys.version.split()[0], sizeStr |
4019 ).format(sys.version.split()[0], sizeStr) | 4612 ) |
4020 | 4613 |
4021 # Qt version | 4614 # Qt version |
4022 versionText += ( | 4615 versionText += ("""<tr><td><b>Qt</b></td><td>{0}</td></tr>""").format( |
4023 """<tr><td><b>Qt</b></td><td>{0}</td></tr>""" | 4616 qVersion() |
4024 ).format(qVersion()) | 4617 ) |
4025 | 4618 |
4026 # PyQt versions | 4619 # PyQt versions |
4027 versionText += ( | 4620 versionText += ("""<tr><td><b>PyQt6</b></td><td>{0}</td></tr>""").format( |
4028 """<tr><td><b>PyQt6</b></td><td>{0}</td></tr>""" | 4621 PYQT_VERSION_STR |
4029 ).format(PYQT_VERSION_STR) | 4622 ) |
4030 with contextlib.suppress(ImportError, AttributeError): | 4623 with contextlib.suppress(ImportError, AttributeError): |
4031 from PyQt6 import QtCharts | 4624 from PyQt6 import QtCharts |
4625 | |
4032 versionText += ( | 4626 versionText += ( |
4033 """<tr><td><b>PyQt6-Charts</b></td><td>{0}</td></tr>""" | 4627 """<tr><td><b>PyQt6-Charts</b></td><td>{0}</td></tr>""" |
4034 ).format(QtCharts.PYQT_CHART_VERSION_STR) | 4628 ).format(QtCharts.PYQT_CHART_VERSION_STR) |
4035 with contextlib.suppress(ImportError, AttributeError): | 4629 with contextlib.suppress(ImportError, AttributeError): |
4036 from PyQt6 import QtWebEngineCore | 4630 from PyQt6 import QtWebEngineCore |
4631 | |
4037 versionText += ( | 4632 versionText += ( |
4038 """<tr><td><b>PyQt6-WebEngine</b></td><td>{0}</td></tr>""" | 4633 """<tr><td><b>PyQt6-WebEngine</b></td><td>{0}</td></tr>""" |
4039 ).format(QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) | 4634 ).format(QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
4040 versionText += ( | 4635 versionText += ( |
4041 """<tr><td><b>PyQt6-QScintilla</b></td><td>{0}</td></tr>""" | 4636 """<tr><td><b>PyQt6-QScintilla</b></td><td>{0}</td></tr>""" |
4042 ).format(QSCINTILLA_VERSION_STR) | 4637 ).format(QSCINTILLA_VERSION_STR) |
4043 versionText += ( | 4638 versionText += ("""<tr><td><b>sip</b></td><td>{0}</td></tr>""").format( |
4044 """<tr><td><b>sip</b></td><td>{0}</td></tr>""" | 4639 sip_version_str |
4045 ).format(sip_version_str) | 4640 ) |
4046 | 4641 |
4047 # webengine (chromium) version | 4642 # webengine (chromium) version |
4048 with contextlib.suppress(ImportError): | 4643 with contextlib.suppress(ImportError): |
4049 from WebBrowser.Tools import WebBrowserTools | 4644 from WebBrowser.Tools import WebBrowserTools |
4050 chromiumVersion, chromiumSecurityVersion = ( | 4645 |
4051 WebBrowserTools.getWebEngineVersions()[0:2] | 4646 ( |
4052 ) | 4647 chromiumVersion, |
4053 versionText += ( | 4648 chromiumSecurityVersion, |
4054 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>""" | 4649 ) = WebBrowserTools.getWebEngineVersions()[0:2] |
4055 .format(chromiumVersion) | 4650 versionText += """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>""".format( |
4651 chromiumVersion | |
4056 ) | 4652 ) |
4057 if chromiumSecurityVersion: | 4653 if chromiumSecurityVersion: |
4058 versionText += self.tr( | 4654 versionText += self.tr( |
4059 """<tr><td><b>WebEngine (Security)</b></td>""" | 4655 """<tr><td><b>WebEngine (Security)</b></td>""" |
4060 """<td>{0}</td></tr>""" | 4656 """<td>{0}</td></tr>""" |
4061 ).format(chromiumSecurityVersion) | 4657 ).format(chromiumSecurityVersion) |
4062 | 4658 |
4063 # eric7 version | 4659 # eric7 version |
4064 versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>""" | 4660 versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>""").format( |
4065 ).format(Program, Version) | 4661 Program, Version |
4066 | 4662 ) |
4663 | |
4067 # desktop and session type | 4664 # desktop and session type |
4068 desktop = Globals.desktopName() | 4665 desktop = Globals.desktopName() |
4069 session = Globals.sessionType() | 4666 session = Globals.sessionType() |
4070 if desktop or session: | 4667 if desktop or session: |
4071 versionText += "<tr><td></td><td></td></tr>" | 4668 versionText += "<tr><td></td><td></td></tr>" |
4072 if desktop: | 4669 if desktop: |
4073 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>" | 4670 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>").format( |
4074 ).format(self.tr("Desktop"), desktop) | 4671 self.tr("Desktop"), desktop |
4672 ) | |
4075 if session: | 4673 if session: |
4076 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>" | 4674 versionText += ("<tr><td><b>{0}</b></td><td>{1}</td></tr>").format( |
4077 ).format(self.tr("Session Type"), session) | 4675 self.tr("Session Type"), session |
4078 | 4676 ) |
4677 | |
4079 versionText += self.tr("""</table>""") | 4678 versionText += self.tr("""</table>""") |
4080 | 4679 |
4081 VersionsDialog(self, Program, versionText) | 4680 VersionsDialog(self, Program, versionText) |
4082 | 4681 |
4083 def __reportBug(self): | 4682 def __reportBug(self): |
4084 """ | 4683 """ |
4085 Private slot to handle the Report Bug dialog. | 4684 Private slot to handle the Report Bug dialog. |
4086 """ | 4685 """ |
4087 self.showEmailDialog("bug") | 4686 self.showEmailDialog("bug") |
4088 | 4687 |
4089 def __requestFeature(self): | 4688 def __requestFeature(self): |
4090 """ | 4689 """ |
4091 Private slot to handle the Feature Request dialog. | 4690 Private slot to handle the Feature Request dialog. |
4092 """ | 4691 """ |
4093 self.showEmailDialog("feature") | 4692 self.showEmailDialog("feature") |
4094 | 4693 |
4095 def showEmailDialog(self, mode, attachFile=None, deleteAttachFile=False): | 4694 def showEmailDialog(self, mode, attachFile=None, deleteAttachFile=False): |
4096 """ | 4695 """ |
4097 Public slot to show the email dialog in a given mode. | 4696 Public slot to show the email dialog in a given mode. |
4098 | 4697 |
4099 @param mode mode of the email dialog (string, "bug" or "feature") | 4698 @param mode mode of the email dialog (string, "bug" or "feature") |
4100 @param attachFile name of a file to attach to the email (string) | 4699 @param attachFile name of a file to attach to the email (string) |
4101 @param deleteAttachFile flag indicating to delete the attached file | 4700 @param deleteAttachFile flag indicating to delete the attached file |
4102 after it has been sent (boolean) | 4701 after it has been sent (boolean) |
4103 """ | 4702 """ |
4104 if Preferences.getUser("UseSystemEmailClient"): | 4703 if Preferences.getUser("UseSystemEmailClient"): |
4105 self.__showSystemEmailClient(mode, attachFile, deleteAttachFile) | 4704 self.__showSystemEmailClient(mode, attachFile, deleteAttachFile) |
4106 else: | 4705 else: |
4107 if not Preferences.getUser("UseGoogleMailOAuth2") and ( | 4706 if not Preferences.getUser("UseGoogleMailOAuth2") and ( |
4108 Preferences.getUser("Email") == "" or | 4707 Preferences.getUser("Email") == "" |
4109 Preferences.getUser("MailServer") == ""): | 4708 or Preferences.getUser("MailServer") == "" |
4709 ): | |
4110 EricMessageBox.critical( | 4710 EricMessageBox.critical( |
4111 self, | 4711 self, |
4112 self.tr("Report Bug"), | 4712 self.tr("Report Bug"), |
4113 self.tr( | 4713 self.tr( |
4114 """Email address or mail server address is empty.""" | 4714 """Email address or mail server address is empty.""" |
4115 """ Please configure your Email settings in the""" | 4715 """ Please configure your Email settings in the""" |
4116 """ Preferences Dialog.""")) | 4716 """ Preferences Dialog.""" |
4717 ), | |
4718 ) | |
4117 self.showPreferences("emailPage") | 4719 self.showPreferences("emailPage") |
4118 return | 4720 return |
4119 | 4721 |
4120 from .EmailDialog import EmailDialog | 4722 from .EmailDialog import EmailDialog |
4723 | |
4121 self.dlg = EmailDialog(mode=mode) | 4724 self.dlg = EmailDialog(mode=mode) |
4122 if attachFile is not None: | 4725 if attachFile is not None: |
4123 self.dlg.attachFile(attachFile, deleteAttachFile) | 4726 self.dlg.attachFile(attachFile, deleteAttachFile) |
4124 self.dlg.show() | 4727 self.dlg.show() |
4125 | 4728 |
4126 def __showSystemEmailClient(self, mode, attachFile=None, | 4729 def __showSystemEmailClient(self, mode, attachFile=None, deleteAttachFile=False): |
4127 deleteAttachFile=False): | |
4128 """ | 4730 """ |
4129 Private slot to show the system email dialog. | 4731 Private slot to show the system email dialog. |
4130 | 4732 |
4131 @param mode mode of the email dialog (string, "bug" or "feature") | 4733 @param mode mode of the email dialog (string, "bug" or "feature") |
4132 @param attachFile name of a file to put into the body of the | 4734 @param attachFile name of a file to put into the body of the |
4133 email (string) | 4735 email (string) |
4134 @param deleteAttachFile flag indicating to delete the file after | 4736 @param deleteAttachFile flag indicating to delete the file after |
4135 it has been read (boolean) | 4737 it has been read (boolean) |
4143 os.remove(attachFile) | 4745 os.remove(attachFile) |
4144 else: | 4746 else: |
4145 body = "\r\n----\r\n{0}\r\n----\r\n{1}\r\n----\r\n{2}".format( | 4747 body = "\r\n----\r\n{0}\r\n----\r\n{1}\r\n----\r\n{2}".format( |
4146 Utilities.generateVersionInfo("\r\n"), | 4748 Utilities.generateVersionInfo("\r\n"), |
4147 Utilities.generatePluginsVersionInfo("\r\n"), | 4749 Utilities.generatePluginsVersionInfo("\r\n"), |
4148 Utilities.generateDistroInfo("\r\n")) | 4750 Utilities.generateDistroInfo("\r\n"), |
4149 | 4751 ) |
4752 | |
4150 url = QUrl("mailto:{0}".format(address)) | 4753 url = QUrl("mailto:{0}".format(address)) |
4151 urlQuery = QUrlQuery(url) | 4754 urlQuery = QUrlQuery(url) |
4152 urlQuery.addQueryItem("subject", subject) | 4755 urlQuery.addQueryItem("subject", subject) |
4153 urlQuery.addQueryItem("body", body) | 4756 urlQuery.addQueryItem("body", body) |
4154 url.setQuery(urlQuery) | 4757 url.setQuery(urlQuery) |
4155 QDesktopServices.openUrl(url) | 4758 QDesktopServices.openUrl(url) |
4156 | 4759 |
4157 def checkForErrorLog(self): | 4760 def checkForErrorLog(self): |
4158 """ | 4761 """ |
4159 Public method to check for the presence of an error log and ask the | 4762 Public method to check for the presence of an error log and ask the |
4160 user, what to do with it. | 4763 user, what to do with it. |
4161 """ | 4764 """ |
4162 if Preferences.getUI("CheckErrorLog"): | 4765 if Preferences.getUI("CheckErrorLog"): |
4163 logFile = os.path.join(Utilities.getConfigDir(), | 4766 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4164 self.ErrorLogFileName) | |
4165 if os.path.exists(logFile): | 4767 if os.path.exists(logFile): |
4166 from .ErrorLogDialog import ErrorLogDialog | 4768 from .ErrorLogDialog import ErrorLogDialog |
4769 | |
4167 dlg = ErrorLogDialog(logFile, False, self) | 4770 dlg = ErrorLogDialog(logFile, False, self) |
4168 dlg.exec() | 4771 dlg.exec() |
4169 | 4772 |
4170 def __hasErrorLog(self): | 4773 def __hasErrorLog(self): |
4171 """ | 4774 """ |
4172 Private method to check, if an error log file exists. | 4775 Private method to check, if an error log file exists. |
4173 | 4776 |
4174 @return flag indicating the existence of an error log file (boolean) | 4777 @return flag indicating the existence of an error log file (boolean) |
4175 """ | 4778 """ |
4176 logFile = os.path.join(Utilities.getConfigDir(), | 4779 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4177 self.ErrorLogFileName) | |
4178 return os.path.exists(logFile) | 4780 return os.path.exists(logFile) |
4179 | 4781 |
4180 def __showErrorLog(self): | 4782 def __showErrorLog(self): |
4181 """ | 4783 """ |
4182 Private slot to show the most recent error log message. | 4784 Private slot to show the most recent error log message. |
4183 """ | 4785 """ |
4184 logFile = os.path.join(Utilities.getConfigDir(), | 4786 logFile = os.path.join(Utilities.getConfigDir(), self.ErrorLogFileName) |
4185 self.ErrorLogFileName) | |
4186 if os.path.exists(logFile): | 4787 if os.path.exists(logFile): |
4187 from .ErrorLogDialog import ErrorLogDialog | 4788 from .ErrorLogDialog import ErrorLogDialog |
4789 | |
4188 dlg = ErrorLogDialog(logFile, True, self) | 4790 dlg = ErrorLogDialog(logFile, True, self) |
4189 dlg.show() | 4791 dlg.show() |
4190 | 4792 |
4191 def __showInstallInfo(self): | 4793 def __showInstallInfo(self): |
4192 """ | 4794 """ |
4193 Private slot to show a dialog containing information about the | 4795 Private slot to show a dialog containing information about the |
4194 installation process. | 4796 installation process. |
4195 """ | 4797 """ |
4196 from .InstallInfoDialog import InstallInfoDialog | 4798 from .InstallInfoDialog import InstallInfoDialog |
4799 | |
4197 dlg = InstallInfoDialog(self) | 4800 dlg = InstallInfoDialog(self) |
4198 if dlg.wasLoaded(): | 4801 if dlg.wasLoaded(): |
4199 dlg.exec() | 4802 dlg.exec() |
4200 | 4803 |
4201 def __compareFiles(self): | 4804 def __compareFiles(self): |
4202 """ | 4805 """ |
4203 Private slot to handle the Compare Files dialog. | 4806 Private slot to handle the Compare Files dialog. |
4204 """ | 4807 """ |
4205 aw = self.viewmanager.activeWindow() | 4808 aw = self.viewmanager.activeWindow() |
4206 fn = aw and aw.getFileName() or None | 4809 fn = aw and aw.getFileName() or None |
4207 if self.diffDlg is None: | 4810 if self.diffDlg is None: |
4208 from .DiffDialog import DiffDialog | 4811 from .DiffDialog import DiffDialog |
4812 | |
4209 self.diffDlg = DiffDialog() | 4813 self.diffDlg = DiffDialog() |
4210 self.diffDlg.show(fn) | 4814 self.diffDlg.show(fn) |
4211 | 4815 |
4212 def __compareFilesSbs(self): | 4816 def __compareFilesSbs(self): |
4213 """ | 4817 """ |
4214 Private slot to handle the Compare Files dialog. | 4818 Private slot to handle the Compare Files dialog. |
4215 """ | 4819 """ |
4216 aw = self.viewmanager.activeWindow() | 4820 aw = self.viewmanager.activeWindow() |
4217 fn = aw and aw.getFileName() or None | 4821 fn = aw and aw.getFileName() or None |
4218 if self.compareDlg is None: | 4822 if self.compareDlg is None: |
4219 from .CompareDialog import CompareDialog | 4823 from .CompareDialog import CompareDialog |
4824 | |
4220 self.compareDlg = CompareDialog() | 4825 self.compareDlg = CompareDialog() |
4221 self.compareDlg.show(fn) | 4826 self.compareDlg.show(fn) |
4222 | 4827 |
4223 def __openMiniEditor(self): | 4828 def __openMiniEditor(self): |
4224 """ | 4829 """ |
4225 Private slot to show a mini editor window. | 4830 Private slot to show a mini editor window. |
4226 """ | 4831 """ |
4227 from QScintilla.MiniEditor import MiniEditor | 4832 from QScintilla.MiniEditor import MiniEditor |
4833 | |
4228 editor = MiniEditor(parent=self) | 4834 editor = MiniEditor(parent=self) |
4229 editor.show() | 4835 editor.show() |
4230 | 4836 |
4231 def addEricActions(self, actions, actionType): | 4837 def addEricActions(self, actions, actionType): |
4232 """ | 4838 """ |
4233 Public method to add actions to the list of actions. | 4839 Public method to add actions to the list of actions. |
4234 | 4840 |
4235 @param actions list of actions to be added (list of EricAction) | 4841 @param actions list of actions to be added (list of EricAction) |
4236 @param actionType string denoting the action set to add to. | 4842 @param actionType string denoting the action set to add to. |
4237 It must be one of "ui" or "wizards". | 4843 It must be one of "ui" or "wizards". |
4238 """ | 4844 """ |
4239 if actionType == 'ui': | 4845 if actionType == "ui": |
4240 self.actions.extend(actions) | 4846 self.actions.extend(actions) |
4241 elif actionType == 'wizards': | 4847 elif actionType == "wizards": |
4242 self.wizardsActions.extend(actions) | 4848 self.wizardsActions.extend(actions) |
4243 | 4849 |
4244 def removeEricActions(self, actions, actionType='ui'): | 4850 def removeEricActions(self, actions, actionType="ui"): |
4245 """ | 4851 """ |
4246 Public method to remove actions from the list of actions. | 4852 Public method to remove actions from the list of actions. |
4247 | 4853 |
4248 @param actions list of actions (list of EricAction) | 4854 @param actions list of actions (list of EricAction) |
4249 @param actionType string denoting the action set to remove from. | 4855 @param actionType string denoting the action set to remove from. |
4250 It must be one of "ui" or "wizards". | 4856 It must be one of "ui" or "wizards". |
4251 """ | 4857 """ |
4252 for act in actions: | 4858 for act in actions: |
4253 with contextlib.suppress(ValueError): | 4859 with contextlib.suppress(ValueError): |
4254 if actionType == 'ui': | 4860 if actionType == "ui": |
4255 self.actions.remove(act) | 4861 self.actions.remove(act) |
4256 elif actionType == 'wizards': | 4862 elif actionType == "wizards": |
4257 self.wizardsActions.remove(act) | 4863 self.wizardsActions.remove(act) |
4258 | 4864 |
4259 def getActions(self, actionType): | 4865 def getActions(self, actionType): |
4260 """ | 4866 """ |
4261 Public method to get a list of all actions. | 4867 Public method to get a list of all actions. |
4262 | 4868 |
4263 @param actionType string denoting the action set to get. | 4869 @param actionType string denoting the action set to get. |
4264 It must be one of "ui" or "wizards". | 4870 It must be one of "ui" or "wizards". |
4265 @return list of all actions (list of EricAction) | 4871 @return list of all actions (list of EricAction) |
4266 """ | 4872 """ |
4267 if actionType == 'ui': | 4873 if actionType == "ui": |
4268 return self.actions[:] | 4874 return self.actions[:] |
4269 elif actionType == 'wizards': | 4875 elif actionType == "wizards": |
4270 return self.wizardsActions[:] | 4876 return self.wizardsActions[:] |
4271 else: | 4877 else: |
4272 return [] | 4878 return [] |
4273 | 4879 |
4274 def getMenuAction(self, menuName, actionName): | 4880 def getMenuAction(self, menuName, actionName): |
4275 """ | 4881 """ |
4276 Public method to get a reference to an action of a menu. | 4882 Public method to get a reference to an action of a menu. |
4277 | 4883 |
4278 @param menuName name of the menu to search in (string) | 4884 @param menuName name of the menu to search in (string) |
4279 @param actionName object name of the action to search for | 4885 @param actionName object name of the action to search for |
4280 (string) | 4886 (string) |
4281 @return reference to the menu action (QAction) | 4887 @return reference to the menu action (QAction) |
4282 """ | 4888 """ |
4283 try: | 4889 try: |
4284 menu = self.__menus[menuName] | 4890 menu = self.__menus[menuName] |
4285 except KeyError: | 4891 except KeyError: |
4286 return None | 4892 return None |
4287 | 4893 |
4288 for act in menu.actions(): | 4894 for act in menu.actions(): |
4289 if act.objectName() == actionName: | 4895 if act.objectName() == actionName: |
4290 return act | 4896 return act |
4291 | 4897 |
4292 return None | 4898 return None |
4293 | 4899 |
4294 def getMenuBarAction(self, menuName): | 4900 def getMenuBarAction(self, menuName): |
4295 """ | 4901 """ |
4296 Public method to get a reference to an action of the main menu. | 4902 Public method to get a reference to an action of the main menu. |
4297 | 4903 |
4298 @param menuName name of the menu to search in (string) | 4904 @param menuName name of the menu to search in (string) |
4299 @return reference to the menu bar action (QAction) | 4905 @return reference to the menu bar action (QAction) |
4300 """ | 4906 """ |
4301 try: | 4907 try: |
4302 menu = self.__menus[menuName] | 4908 menu = self.__menus[menuName] |
4303 except KeyError: | 4909 except KeyError: |
4304 return None | 4910 return None |
4305 | 4911 |
4306 return menu.menuAction() | 4912 return menu.menuAction() |
4307 | 4913 |
4308 def getMenu(self, name): | 4914 def getMenu(self, name): |
4309 """ | 4915 """ |
4310 Public method to get a reference to a specific menu. | 4916 Public method to get a reference to a specific menu. |
4311 | 4917 |
4312 @param name name of the menu (string) | 4918 @param name name of the menu (string) |
4313 @return reference to the menu (QMenu) | 4919 @return reference to the menu (QMenu) |
4314 """ | 4920 """ |
4315 try: | 4921 try: |
4316 return self.__menus[name] | 4922 return self.__menus[name] |
4317 except KeyError: | 4923 except KeyError: |
4318 return None | 4924 return None |
4319 | 4925 |
4320 def registerToolbar(self, name, text, toolbar, category=""): | 4926 def registerToolbar(self, name, text, toolbar, category=""): |
4321 """ | 4927 """ |
4322 Public method to register a toolbar. | 4928 Public method to register a toolbar. |
4323 | 4929 |
4324 This method must be called in order to make a toolbar manageable by the | 4930 This method must be called in order to make a toolbar manageable by the |
4325 UserInterface object. | 4931 UserInterface object. |
4326 | 4932 |
4327 @param name name of the toolbar. This is used as the key into | 4933 @param name name of the toolbar. This is used as the key into |
4328 the dictionary of toolbar references. | 4934 the dictionary of toolbar references. |
4329 @type str | 4935 @type str |
4330 @param text user visible text for the toolbar entry | 4936 @param text user visible text for the toolbar entry |
4331 @type str | 4937 @type str |
4336 @exception KeyError raised, if a toolbar with the given name was | 4942 @exception KeyError raised, if a toolbar with the given name was |
4337 already registered | 4943 already registered |
4338 """ | 4944 """ |
4339 if name in self.__toolbars: | 4945 if name in self.__toolbars: |
4340 raise KeyError("Toolbar '{0}' already registered.".format(name)) | 4946 raise KeyError("Toolbar '{0}' already registered.".format(name)) |
4341 | 4947 |
4342 self.__toolbars[name] = [text, toolbar, category] | 4948 self.__toolbars[name] = [text, toolbar, category] |
4343 | 4949 |
4344 def reregisterToolbar(self, name, text, category=""): | 4950 def reregisterToolbar(self, name, text, category=""): |
4345 """ | 4951 """ |
4346 Public method to change the visible text for the named toolbar. | 4952 Public method to change the visible text for the named toolbar. |
4347 | 4953 |
4348 @param name name of the toolbar to be changed | 4954 @param name name of the toolbar to be changed |
4349 @type str | 4955 @type str |
4350 @param text new user visible text for the toolbar entry | 4956 @param text new user visible text for the toolbar entry |
4351 @type str | 4957 @type str |
4352 @param category new toolbar category for the toolbar entry | 4958 @param category new toolbar category for the toolbar entry |
4353 @type str | 4959 @type str |
4354 """ | 4960 """ |
4355 if name in self.__toolbars: | 4961 if name in self.__toolbars: |
4356 self.__toolbars[name][0] = text | 4962 self.__toolbars[name][0] = text |
4357 self.__toolbars[name][2] = category | 4963 self.__toolbars[name][2] = category |
4358 | 4964 |
4359 def unregisterToolbar(self, name): | 4965 def unregisterToolbar(self, name): |
4360 """ | 4966 """ |
4361 Public method to unregister a toolbar. | 4967 Public method to unregister a toolbar. |
4362 | 4968 |
4363 @param name name of the toolbar (string). | 4969 @param name name of the toolbar (string). |
4364 """ | 4970 """ |
4365 if name in self.__toolbars: | 4971 if name in self.__toolbars: |
4366 del self.__toolbars[name] | 4972 del self.__toolbars[name] |
4367 | 4973 |
4368 def getToolbar(self, name): | 4974 def getToolbar(self, name): |
4369 """ | 4975 """ |
4370 Public method to get a reference to a specific toolbar. | 4976 Public method to get a reference to a specific toolbar. |
4371 | 4977 |
4372 @param name name of the toolbar (string) | 4978 @param name name of the toolbar (string) |
4373 @return reference to the toolbar entry (tuple of string and QToolBar) | 4979 @return reference to the toolbar entry (tuple of string and QToolBar) |
4374 """ | 4980 """ |
4375 try: | 4981 try: |
4376 return self.__toolbars[name] | 4982 return self.__toolbars[name] |
4377 except KeyError: | 4983 except KeyError: |
4378 return None | 4984 return None |
4379 | 4985 |
4380 def getToolbarsByCategory(self, category): | 4986 def getToolbarsByCategory(self, category): |
4381 """ | 4987 """ |
4382 Public method to get a list of toolbars belonging to a given toolbar | 4988 Public method to get a list of toolbars belonging to a given toolbar |
4383 category. | 4989 category. |
4384 | 4990 |
4385 @param category toolbar category | 4991 @param category toolbar category |
4386 @type str | 4992 @type str |
4387 @return list of toolbars | 4993 @return list of toolbars |
4388 @rtype list of QToolBar | 4994 @rtype list of QToolBar |
4389 """ | 4995 """ |
4390 toolbars = [] | 4996 toolbars = [] |
4391 for tbName in self.__toolbars: | 4997 for tbName in self.__toolbars: |
4392 with contextlib.suppress(IndexError): | 4998 with contextlib.suppress(IndexError): |
4393 if self.__toolbars[tbName][2] == category: | 4999 if self.__toolbars[tbName][2] == category: |
4394 toolbars.append(self.__toolbars[tbName][1]) | 5000 toolbars.append(self.__toolbars[tbName][1]) |
4395 | 5001 |
4396 return toolbars | 5002 return toolbars |
4397 | 5003 |
4398 def getLocale(self): | 5004 def getLocale(self): |
4399 """ | 5005 """ |
4400 Public method to get the locale of the IDE. | 5006 Public method to get the locale of the IDE. |
4401 | 5007 |
4402 @return locale of the IDE (string or None) | 5008 @return locale of the IDE (string or None) |
4403 """ | 5009 """ |
4404 return self.locale | 5010 return self.locale |
4405 | 5011 |
4406 def __quit(self): | 5012 def __quit(self): |
4407 """ | 5013 """ |
4408 Private method to quit the application. | 5014 Private method to quit the application. |
4409 """ | 5015 """ |
4410 if self.__shutdown(): | 5016 if self.__shutdown(): |
4411 ericApp().closeAllWindows() | 5017 ericApp().closeAllWindows() |
4412 | 5018 |
4413 @pyqtSlot() | 5019 @pyqtSlot() |
4414 def __restart(self, ask=False): | 5020 def __restart(self, ask=False): |
4415 """ | 5021 """ |
4416 Private method to restart the application. | 5022 Private method to restart the application. |
4417 | 5023 |
4418 @param ask flag indicating to ask the user for permission | 5024 @param ask flag indicating to ask the user for permission |
4419 @type bool | 5025 @type bool |
4420 """ | 5026 """ |
4421 res = ( | 5027 res = ( |
4422 EricMessageBox.yesNo( | 5028 EricMessageBox.yesNo( |
4423 self, | 5029 self, |
4424 self.tr("Restart application"), | 5030 self.tr("Restart application"), |
4425 self.tr( | 5031 self.tr("""The application needs to be restarted. Do it now?"""), |
4426 """The application needs to be restarted. Do it now?"""), | 5032 yesDefault=True, |
4427 yesDefault=True) | 5033 ) |
4428 if ask else | 5034 if ask |
4429 True | 5035 else True |
4430 ) | 5036 ) |
4431 | 5037 |
4432 if res and self.__shutdown(): | 5038 if res and self.__shutdown(): |
4433 ericApp().closeAllWindows() | 5039 ericApp().closeAllWindows() |
4434 program = Globals.getPythonExecutable() | 5040 program = Globals.getPythonExecutable() |
4435 args = ["-m", "eric7", "--start-session"] | 5041 args = ["-m", "eric7", "--start-session"] |
4436 args.extend(self.__restartArgs) | 5042 args.extend(self.__restartArgs) |
4437 QProcess.startDetached(program, args) | 5043 QProcess.startDetached(program, args) |
4438 | 5044 |
4439 @pyqtSlot() | 5045 @pyqtSlot() |
4440 def upgradePyQt(self): | 5046 def upgradePyQt(self): |
4441 """ | 5047 """ |
4442 Public slot to upgrade the PyQt packages of the eric7 environment. | 5048 Public slot to upgrade the PyQt packages of the eric7 environment. |
4443 | 5049 |
4444 @return flag indicating a successful upgrade | 5050 @return flag indicating a successful upgrade |
4445 @rtype bool | 5051 @rtype bool |
4446 """ | 5052 """ |
4447 yes = EricMessageBox.yesNo( | 5053 yes = EricMessageBox.yesNo( |
4448 None, | 5054 None, |
4449 self.tr("Upgrade PyQt"), | 5055 self.tr("Upgrade PyQt"), |
4450 self.tr("""eric needs to be closed in order to upgrade PyQt. It""" | 5056 self.tr( |
4451 """ will be restarted once the upgrade process has""" | 5057 """eric needs to be closed in order to upgrade PyQt. It""" |
4452 """ finished. This may take some time.\n\nShall the""" | 5058 """ will be restarted once the upgrade process has""" |
4453 """ upgrade be done now?""") | 5059 """ finished. This may take some time.\n\nShall the""" |
4454 ) | 5060 """ upgrade be done now?""" |
4455 | 5061 ), |
5062 ) | |
5063 | |
4456 if yes and self.__shutdown(): | 5064 if yes and self.__shutdown(): |
4457 self.__performUpgrade("pyqt") | 5065 self.__performUpgrade("pyqt") |
4458 return True | 5066 return True |
4459 | 5067 |
4460 return False | 5068 return False |
4461 | 5069 |
4462 @pyqtSlot() | 5070 @pyqtSlot() |
4463 def upgradeEric(self): | 5071 def upgradeEric(self): |
4464 """ | 5072 """ |
4465 Public slot to upgrade the eric-ide package of the eric7 environment. | 5073 Public slot to upgrade the eric-ide package of the eric7 environment. |
4466 | 5074 |
4467 @return flag indicating a successful upgrade | 5075 @return flag indicating a successful upgrade |
4468 @rtype bool | 5076 @rtype bool |
4469 """ | 5077 """ |
4470 yes = EricMessageBox.yesNo( | 5078 yes = EricMessageBox.yesNo( |
4471 None, | 5079 None, |
4472 self.tr("Upgrade Eric"), | 5080 self.tr("Upgrade Eric"), |
4473 self.tr("""eric needs to be closed in order to be upgraded. It""" | 5081 self.tr( |
4474 """ will be restarted once the upgrade process has""" | 5082 """eric needs to be closed in order to be upgraded. It""" |
4475 """ finished. This may take some time.\n\nShall the""" | 5083 """ will be restarted once the upgrade process has""" |
4476 """ upgrade be done now?""") | 5084 """ finished. This may take some time.\n\nShall the""" |
4477 ) | 5085 """ upgrade be done now?""" |
4478 | 5086 ), |
5087 ) | |
5088 | |
4479 if yes and self.__shutdown(): | 5089 if yes and self.__shutdown(): |
4480 self.__performUpgrade("eric") | 5090 self.__performUpgrade("eric") |
4481 return True | 5091 return True |
4482 | 5092 |
4483 return False | 5093 return False |
4484 | 5094 |
4485 @pyqtSlot() | 5095 @pyqtSlot() |
4486 def upgradeEricPyQt(self): | 5096 def upgradeEricPyQt(self): |
4487 """ | 5097 """ |
4488 Public slot to upgrade the eric-ide and Pyqt packages of the eric7 | 5098 Public slot to upgrade the eric-ide and Pyqt packages of the eric7 |
4489 environment. | 5099 environment. |
4490 | 5100 |
4491 @return flag indicating a successful upgrade | 5101 @return flag indicating a successful upgrade |
4492 @rtype bool | 5102 @rtype bool |
4493 """ | 5103 """ |
4494 yes = EricMessageBox.yesNo( | 5104 yes = EricMessageBox.yesNo( |
4495 None, | 5105 None, |
4496 self.tr("Upgrade Eric"), | 5106 self.tr("Upgrade Eric"), |
4497 self.tr("""eric needs to be closed in order to upgrade eric and""" | 5107 self.tr( |
4498 """ PyQt. It will be restarted once the upgrade process""" | 5108 """eric needs to be closed in order to upgrade eric and""" |
4499 """ has finished. This may take some time.\n\n Shall""" | 5109 """ PyQt. It will be restarted once the upgrade process""" |
4500 """ the upgrade be done now?""") | 5110 """ has finished. This may take some time.\n\n Shall""" |
4501 ) | 5111 """ the upgrade be done now?""" |
4502 | 5112 ), |
5113 ) | |
5114 | |
4503 if yes and self.__shutdown(): | 5115 if yes and self.__shutdown(): |
4504 self.__performUpgrade("ericpyqt") | 5116 self.__performUpgrade("ericpyqt") |
4505 return True | 5117 return True |
4506 | 5118 |
4507 return False | 5119 return False |
4508 | 5120 |
4509 def __performUpgrade(self, upgradeType): | 5121 def __performUpgrade(self, upgradeType): |
4510 """ | 5122 """ |
4511 Private method to perform the requested upgrade operation. | 5123 Private method to perform the requested upgrade operation. |
4512 | 5124 |
4513 This action needs to shut down eric first, start a non-PyQt application | 5125 This action needs to shut down eric first, start a non-PyQt application |
4514 performing the upgrade of the PyQt packages via pip and restart eric | 5126 performing the upgrade of the PyQt packages via pip and restart eric |
4515 with the passed arguments. The upgrade process is not visible. | 5127 with the passed arguments. The upgrade process is not visible. |
4516 | 5128 |
4517 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt', | 5129 @param upgradeType upgrade operation (one of 'eric', 'ericpyqt', |
4518 'pyqt') | 5130 'pyqt') |
4519 @type str | 5131 @type str |
4520 """ | 5132 """ |
4521 ericApp().closeAllWindows() | 5133 ericApp().closeAllWindows() |
4522 program = Globals.getPythonExecutable() | 5134 program = Globals.getPythonExecutable() |
4523 ericStartArgs = ["-m", "eric7", "--start-session"] | 5135 ericStartArgs = ["-m", "eric7", "--start-session"] |
4524 ericStartArgs.extend(self.__restartArgs) | 5136 ericStartArgs.extend(self.__restartArgs) |
4525 | 5137 |
4526 upgrader = os.path.join( | 5138 upgrader = os.path.join(os.path.dirname(__file__), "upgrader.py") |
4527 os.path.dirname(__file__), "upgrader.py" | |
4528 ) | |
4529 upgraderArgs = [ | 5139 upgraderArgs = [ |
4530 upgrader, | 5140 upgrader, |
4531 "--type={0}".format(upgradeType), | 5141 "--type={0}".format(upgradeType), |
4532 "--delay={0}".format(Preferences.getUI("UpgraderDelay")), | 5142 "--delay={0}".format(Preferences.getUI("UpgraderDelay")), |
4533 "--" | 5143 "--", |
4534 ] + ericStartArgs | 5144 ] + ericStartArgs |
4535 QProcess.startDetached(program, upgraderArgs) | 5145 QProcess.startDetached(program, upgraderArgs) |
4536 | 5146 |
4537 def __newWindow(self): | 5147 def __newWindow(self): |
4538 """ | 5148 """ |
4539 Private slot to start a new instance of eric. | 5149 Private slot to start a new instance of eric. |
4540 """ | 5150 """ |
4541 if not Preferences.getUI("SingleApplicationMode"): | 5151 if not Preferences.getUI("SingleApplicationMode"): |
4542 # start eric without any arguments | 5152 # start eric without any arguments |
4543 program = Globals.getPythonExecutable() | 5153 program = Globals.getPythonExecutable() |
4544 eric7 = os.path.join(getConfig("ericDir"), "eric7.py") | 5154 eric7 = os.path.join(getConfig("ericDir"), "eric7.py") |
4545 args = [eric7] | 5155 args = [eric7] |
4546 QProcess.startDetached(program, args) | 5156 QProcess.startDetached(program, args) |
4547 | 5157 |
4548 def __initToolsMenus(self, menu): | 5158 def __initToolsMenus(self, menu): |
4549 """ | 5159 """ |
4550 Private slot to initialize the various tool menus. | 5160 Private slot to initialize the various tool menus. |
4551 | 5161 |
4552 @param menu reference to the parent menu | 5162 @param menu reference to the parent menu |
4553 @type QMenu | 5163 @type QMenu |
4554 """ | 5164 """ |
4555 btMenu = QMenu(self.tr("&Builtin Tools"), self) | 5165 btMenu = QMenu(self.tr("&Builtin Tools"), self) |
4556 if self.designer4Act is not None: | 5166 if self.designer4Act is not None: |
4566 btMenu.addAction(self.hexEditorAct) | 5176 btMenu.addAction(self.hexEditorAct) |
4567 btMenu.addAction(self.iconEditorAct) | 5177 btMenu.addAction(self.iconEditorAct) |
4568 btMenu.addAction(self.snapshotAct) | 5178 btMenu.addAction(self.snapshotAct) |
4569 if self.webBrowserAct: | 5179 if self.webBrowserAct: |
4570 btMenu.addAction(self.webBrowserAct) | 5180 btMenu.addAction(self.webBrowserAct) |
4571 | 5181 |
4572 ptMenu = QMenu(self.tr("&Plugin Tools"), self) | 5182 ptMenu = QMenu(self.tr("&Plugin Tools"), self) |
4573 ptMenu.aboutToShow.connect(self.__showPluginToolsMenu) | 5183 ptMenu.aboutToShow.connect(self.__showPluginToolsMenu) |
4574 | 5184 |
4575 utMenu = QMenu(self.tr("&User Tools"), self) | 5185 utMenu = QMenu(self.tr("&User Tools"), self) |
4576 utMenu.triggered.connect(self.__toolExecute) | 5186 utMenu.triggered.connect(self.__toolExecute) |
4577 utMenu.aboutToShow.connect(self.__showUserToolsMenu) | 5187 utMenu.aboutToShow.connect(self.__showUserToolsMenu) |
4578 | 5188 |
4579 menu.addMenu(btMenu) | 5189 menu.addMenu(btMenu) |
4580 menu.addMenu(ptMenu) | 5190 menu.addMenu(ptMenu) |
4581 menu.addMenu(utMenu) | 5191 menu.addMenu(utMenu) |
4582 | 5192 |
4583 self.__menus["builtin_tools"] = btMenu | 5193 self.__menus["builtin_tools"] = btMenu |
4584 self.__menus["plugin_tools"] = ptMenu | 5194 self.__menus["plugin_tools"] = ptMenu |
4585 self.__menus["user_tools"] = utMenu | 5195 self.__menus["user_tools"] = utMenu |
4586 | 5196 |
4587 def __showPluginToolsMenu(self): | 5197 def __showPluginToolsMenu(self): |
4588 """ | 5198 """ |
4589 Private slot to show the Plugin Tools menu. | 5199 Private slot to show the Plugin Tools menu. |
4590 """ | 5200 """ |
4591 self.showMenu.emit("PluginTools", self.__menus["plugin_tools"]) | 5201 self.showMenu.emit("PluginTools", self.__menus["plugin_tools"]) |
4592 | 5202 |
4593 def __showUserToolsMenu(self): | 5203 def __showUserToolsMenu(self): |
4594 """ | 5204 """ |
4595 Private slot to display the User Tools menu. | 5205 Private slot to display the User Tools menu. |
4596 """ | 5206 """ |
4597 self.__menus["user_tools"].clear() | 5207 self.__menus["user_tools"].clear() |
4598 | 5208 |
4599 self.__menus["user_tools"].addMenu(self.toolGroupsMenu) | 5209 self.__menus["user_tools"].addMenu(self.toolGroupsMenu) |
4600 act = self.__menus["user_tools"].addAction( | 5210 act = self.__menus["user_tools"].addAction( |
4601 self.tr("Configure Tool Groups ..."), | 5211 self.tr("Configure Tool Groups ..."), self.__toolGroupsConfiguration |
4602 self.__toolGroupsConfiguration) | 5212 ) |
4603 act.setData(-1) | 5213 act.setData(-1) |
4604 act = self.__menus["user_tools"].addAction( | 5214 act = self.__menus["user_tools"].addAction( |
4605 self.tr("Configure current Tool Group ..."), | 5215 self.tr("Configure current Tool Group ..."), self.__toolsConfiguration |
4606 self.__toolsConfiguration) | 5216 ) |
4607 act.setData(-2) | 5217 act.setData(-2) |
4608 act.setEnabled(self.currentToolGroup >= 0) | 5218 act.setEnabled(self.currentToolGroup >= 0) |
4609 self.__menus["user_tools"].addSeparator() | 5219 self.__menus["user_tools"].addSeparator() |
4610 | 5220 |
4611 # add the configurable entries | 5221 # add the configurable entries |
4612 try: | 5222 try: |
4613 for idx, tool in enumerate( | 5223 for idx, tool in enumerate(self.toolGroups[self.currentToolGroup][1]): |
4614 self.toolGroups[self.currentToolGroup][1] | 5224 if tool["menutext"] == "--": |
4615 ): | |
4616 if tool['menutext'] == '--': | |
4617 self.__menus["user_tools"].addSeparator() | 5225 self.__menus["user_tools"].addSeparator() |
4618 else: | 5226 else: |
4619 act = self.__menus["user_tools"].addAction( | 5227 act = self.__menus["user_tools"].addAction( |
4620 UI.PixmapCache.getIcon(tool['icon']), | 5228 UI.PixmapCache.getIcon(tool["icon"]), tool["menutext"] |
4621 tool['menutext']) | 5229 ) |
4622 act.setData(idx) | 5230 act.setData(idx) |
4623 except IndexError: | 5231 except IndexError: |
4624 # the current tool group might have been deleted | 5232 # the current tool group might have been deleted |
4625 act = self.__menus["user_tools"].addAction( | 5233 act = self.__menus["user_tools"].addAction( |
4626 self.tr("No User Tools Configured")) | 5234 self.tr("No User Tools Configured") |
5235 ) | |
4627 act.setData(-3) | 5236 act.setData(-3) |
4628 | 5237 |
4629 def __showToolGroupsMenu(self): | 5238 def __showToolGroupsMenu(self): |
4630 """ | 5239 """ |
4631 Private slot to display the Tool Groups menu. | 5240 Private slot to display the Tool Groups menu. |
4632 """ | 5241 """ |
4633 self.toolGroupsMenu.clear() | 5242 self.toolGroupsMenu.clear() |
4634 | 5243 |
4635 # add the configurable tool groups | 5244 # add the configurable tool groups |
4636 if self.toolGroups: | 5245 if self.toolGroups: |
4637 for idx, toolGroup in enumerate(self.toolGroups): | 5246 for idx, toolGroup in enumerate(self.toolGroups): |
4638 act = self.toolGroupsMenu.addAction(toolGroup[0]) | 5247 act = self.toolGroupsMenu.addAction(toolGroup[0]) |
4639 act.setData(idx) | 5248 act.setData(idx) |
4640 if self.currentToolGroup == idx: | 5249 if self.currentToolGroup == idx: |
4641 font = act.font() | 5250 font = act.font() |
4642 font.setBold(True) | 5251 font.setBold(True) |
4643 act.setFont(font) | 5252 act.setFont(font) |
4644 else: | 5253 else: |
4645 act = self.toolGroupsMenu.addAction( | 5254 act = self.toolGroupsMenu.addAction(self.tr("No User Tools Configured")) |
4646 self.tr("No User Tools Configured")) | |
4647 act.setData(-3) | 5255 act.setData(-3) |
4648 | 5256 |
4649 def __toolGroupSelected(self, act): | 5257 def __toolGroupSelected(self, act): |
4650 """ | 5258 """ |
4651 Private slot to set the current tool group. | 5259 Private slot to set the current tool group. |
4652 | 5260 |
4653 @param act reference to the action that was triggered (QAction) | 5261 @param act reference to the action that was triggered (QAction) |
4654 """ | 5262 """ |
4655 self.toolGroupsMenuTriggered = True | 5263 self.toolGroupsMenuTriggered = True |
4656 idx = act.data() | 5264 idx = act.data() |
4657 if idx is not None: | 5265 if idx is not None: |
4658 self.currentToolGroup = idx | 5266 self.currentToolGroup = idx |
4659 | 5267 |
4660 def __showWindowMenu(self): | 5268 def __showWindowMenu(self): |
4661 """ | 5269 """ |
4662 Private slot to display the Window menu. | 5270 Private slot to display the Window menu. |
4663 """ | 5271 """ |
4664 self.__menus["window"].clear() | 5272 self.__menus["window"].clear() |
4665 | 5273 |
4666 self.__menus["window"].addActions(self.viewProfileActGrp.actions()) | 5274 self.__menus["window"].addActions(self.viewProfileActGrp.actions()) |
4667 self.__menus["window"].addSeparator() | 5275 self.__menus["window"].addSeparator() |
4668 | 5276 |
4669 if self.__layoutType == "Toolboxes": | 5277 if self.__layoutType == "Toolboxes": |
4670 self.__menus["window"].addAction(self.ltAct) | 5278 self.__menus["window"].addAction(self.ltAct) |
4671 self.ltAct.setChecked(not self.lToolboxDock.isHidden()) | 5279 self.ltAct.setChecked(not self.lToolboxDock.isHidden()) |
4672 self.__menus["window"].addAction(self.rtAct) | 5280 self.__menus["window"].addAction(self.rtAct) |
4673 self.rtAct.setChecked(not self.lToolboxDock.isHidden()) | 5281 self.rtAct.setChecked(not self.lToolboxDock.isHidden()) |
4679 if self.rsbAct: | 5287 if self.rsbAct: |
4680 self.__menus["window"].addAction(self.rsbAct) | 5288 self.__menus["window"].addAction(self.rsbAct) |
4681 self.rsbAct.setChecked(not self.rightSidebar.isHidden()) | 5289 self.rsbAct.setChecked(not self.rightSidebar.isHidden()) |
4682 self.__menus["window"].addAction(self.bsbAct) | 5290 self.__menus["window"].addAction(self.bsbAct) |
4683 self.bsbAct.setChecked(not self.bottomSidebar.isHidden()) | 5291 self.bsbAct.setChecked(not self.bottomSidebar.isHidden()) |
4684 | 5292 |
4685 # Insert menu entry for sub-windows | 5293 # Insert menu entry for sub-windows |
4686 self.__menus["window"].addSeparator() | 5294 self.__menus["window"].addSeparator() |
4687 self.__menus["window"].addMenu(self.__menus["subwindow"]) | 5295 self.__menus["window"].addMenu(self.__menus["subwindow"]) |
4688 | 5296 |
4689 # Insert menu entry for toolbar settings | 5297 # Insert menu entry for toolbar settings |
4690 self.__menus["window"].addSeparator() | 5298 self.__menus["window"].addSeparator() |
4691 self.__menus["window"].addMenu(self.__menus["toolbars"]) | 5299 self.__menus["window"].addMenu(self.__menus["toolbars"]) |
4692 | 5300 |
4693 # Now do any Source Viewer related stuff. | 5301 # Now do any Source Viewer related stuff. |
4694 self.viewmanager.showWindowMenu(self.__menus["window"]) | 5302 self.viewmanager.showWindowMenu(self.__menus["window"]) |
4695 | 5303 |
4696 self.showMenu.emit("Window", self.__menus["window"]) | 5304 self.showMenu.emit("Window", self.__menus["window"]) |
4697 | 5305 |
4698 def __showSubWindowMenu(self): | 5306 def __showSubWindowMenu(self): |
4699 """ | 5307 """ |
4700 Private slot to display the Window menu of the Window menu. | 5308 Private slot to display the Window menu of the Window menu. |
4701 """ | 5309 """ |
4702 self.showMenu.emit("Subwindows", self.__menus["subwindow"]) | 5310 self.showMenu.emit("Subwindows", self.__menus["subwindow"]) |
4703 | 5311 |
4704 def __populateToolbarsMenu(self, menu): | 5312 def __populateToolbarsMenu(self, menu): |
4705 """ | 5313 """ |
4706 Private method to populate a toolbars menu. | 5314 Private method to populate a toolbars menu. |
4707 | 5315 |
4708 @param menu reference to the menu to be populated (QMenu) | 5316 @param menu reference to the menu to be populated (QMenu) |
4709 """ | 5317 """ |
4710 menu.clear() | 5318 menu.clear() |
4711 | 5319 |
4712 for name, (text, tb, _category) in sorted( | 5320 for name, (text, tb, _category) in sorted( |
4713 self.__toolbars.items(), key=lambda t: t[1][0] | 5321 self.__toolbars.items(), key=lambda t: t[1][0] |
4714 ): | 5322 ): |
4715 act = menu.addAction(text) | 5323 act = menu.addAction(text) |
4716 act.setCheckable(True) | 5324 act.setCheckable(True) |
4719 menu.addSeparator() | 5327 menu.addSeparator() |
4720 act = menu.addAction(self.tr("&Show all")) | 5328 act = menu.addAction(self.tr("&Show all")) |
4721 act.setData("__SHOW__") | 5329 act.setData("__SHOW__") |
4722 act = menu.addAction(self.tr("&Hide all")) | 5330 act = menu.addAction(self.tr("&Hide all")) |
4723 act.setData("__HIDE__") | 5331 act.setData("__HIDE__") |
4724 | 5332 |
4725 def createPopupMenu(self): | 5333 def createPopupMenu(self): |
4726 """ | 5334 """ |
4727 Public method to create the toolbars menu for Qt. | 5335 Public method to create the toolbars menu for Qt. |
4728 | 5336 |
4729 @return toolbars menu (QMenu) | 5337 @return toolbars menu (QMenu) |
4730 """ | 5338 """ |
4731 menu = QMenu(self) | 5339 menu = QMenu(self) |
4732 menu.triggered.connect(self.__TBPopupMenuTriggered) | 5340 menu.triggered.connect(self.__TBPopupMenuTriggered) |
4733 | 5341 |
4734 self.__populateToolbarsMenu(menu) | 5342 self.__populateToolbarsMenu(menu) |
4735 | 5343 |
4736 return menu | 5344 return menu |
4737 | 5345 |
4738 def __showToolbarsMenu(self): | 5346 def __showToolbarsMenu(self): |
4739 """ | 5347 """ |
4740 Private slot to display the Toolbars menu. | 5348 Private slot to display the Toolbars menu. |
4741 """ | 5349 """ |
4742 self.__populateToolbarsMenu(self.__menus["toolbars"]) | 5350 self.__populateToolbarsMenu(self.__menus["toolbars"]) |
4743 | 5351 |
4744 def __TBMenuTriggered(self, act): | 5352 def __TBMenuTriggered(self, act): |
4745 """ | 5353 """ |
4746 Private method to handle the toggle of a toolbar via the Window-> | 5354 Private method to handle the toggle of a toolbar via the Window-> |
4747 Toolbars submenu. | 5355 Toolbars submenu. |
4748 | 5356 |
4749 @param act reference to the action that was triggered (QAction) | 5357 @param act reference to the action that was triggered (QAction) |
4750 """ | 5358 """ |
4751 name = act.data() | 5359 name = act.data() |
4752 if name: | 5360 if name: |
4753 if name == "__SHOW__": | 5361 if name == "__SHOW__": |
4770 | 5378 |
4771 def __TBPopupMenuTriggered(self, act): | 5379 def __TBPopupMenuTriggered(self, act): |
4772 """ | 5380 """ |
4773 Private method to handle the toggle of a toolbar via the QMainWindow | 5381 Private method to handle the toggle of a toolbar via the QMainWindow |
4774 Toolbars popup menu. | 5382 Toolbars popup menu. |
4775 | 5383 |
4776 @param act reference to the action that was triggered (QAction) | 5384 @param act reference to the action that was triggered (QAction) |
4777 """ | 5385 """ |
4778 name = act.data() | 5386 name = act.data() |
4779 if name: | 5387 if name: |
4780 if name == "__SHOW__": | 5388 if name == "__SHOW__": |
4790 tb.setEnabled(True) | 5398 tb.setEnabled(True) |
4791 else: | 5399 else: |
4792 tb.hide() | 5400 tb.hide() |
4793 if self.__menus["toolbars"].isTearOffMenuVisible(): | 5401 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4794 self.__menus["toolbars"].hideTearOffMenu() | 5402 self.__menus["toolbars"].hideTearOffMenu() |
4795 | 5403 |
4796 def __saveCurrentViewProfile(self, save): | 5404 def __saveCurrentViewProfile(self, save): |
4797 """ | 5405 """ |
4798 Private slot to save the window geometries of the active profile. | 5406 Private slot to save the window geometries of the active profile. |
4799 | 5407 |
4800 @param save flag indicating that the current profile should | 5408 @param save flag indicating that the current profile should |
4801 be saved (boolean) | 5409 be saved (boolean) |
4802 """ | 5410 """ |
4803 if self.currentProfile and save: | 5411 if self.currentProfile and save: |
4804 # step 1: save the window geometries of the active profile | 5412 # step 1: save the window geometries of the active profile |
4808 if self.__layoutType == "Sidebars": | 5416 if self.__layoutType == "Sidebars": |
4809 state = self.horizontalSplitter.saveState() | 5417 state = self.horizontalSplitter.saveState() |
4810 self.profiles[self.currentProfile][2][0] = state | 5418 self.profiles[self.currentProfile][2][0] = state |
4811 state = self.verticalSplitter.saveState() | 5419 state = self.verticalSplitter.saveState() |
4812 self.profiles[self.currentProfile][2][1] = state | 5420 self.profiles[self.currentProfile][2][1] = state |
4813 | 5421 |
4814 state = self.leftSidebar.saveState() | 5422 state = self.leftSidebar.saveState() |
4815 self.profiles[self.currentProfile][2][2] = state | 5423 self.profiles[self.currentProfile][2][2] = state |
4816 state = self.bottomSidebar.saveState() | 5424 state = self.bottomSidebar.saveState() |
4817 self.profiles[self.currentProfile][2][3] = state | 5425 self.profiles[self.currentProfile][2][3] = state |
4818 if self.rightSidebar: | 5426 if self.rightSidebar: |
4819 state = self.rightSidebar.saveState() | 5427 state = self.rightSidebar.saveState() |
4820 self.profiles[self.currentProfile][2][4] = state | 5428 self.profiles[self.currentProfile][2][4] = state |
4821 | 5429 |
4822 # step 2: save the visibility of the windows of the active profile | 5430 # step 2: save the visibility of the windows of the active profile |
4823 if self.__layoutType == "Toolboxes": | 5431 if self.__layoutType == "Toolboxes": |
4824 self.profiles[self.currentProfile][1][0] = ( | 5432 self.profiles[self.currentProfile][1][0] = self.lToolboxDock.isVisible() |
4825 self.lToolboxDock.isVisible() | 5433 self.profiles[self.currentProfile][1][1] = self.hToolboxDock.isVisible() |
4826 ) | 5434 self.profiles[self.currentProfile][1][2] = self.rToolboxDock.isVisible() |
4827 self.profiles[self.currentProfile][1][1] = ( | |
4828 self.hToolboxDock.isVisible() | |
4829 ) | |
4830 self.profiles[self.currentProfile][1][2] = ( | |
4831 self.rToolboxDock.isVisible() | |
4832 ) | |
4833 elif self.__layoutType == "Sidebars": | 5435 elif self.__layoutType == "Sidebars": |
4834 self.profiles[self.currentProfile][1][0] = ( | 5436 self.profiles[self.currentProfile][1][0] = self.leftSidebar.isVisible() |
4835 self.leftSidebar.isVisible() | 5437 self.profiles[self.currentProfile][1][ |
4836 ) | 5438 1 |
4837 self.profiles[self.currentProfile][1][1] = ( | 5439 ] = self.bottomSidebar.isVisible() |
4838 self.bottomSidebar.isVisible() | |
4839 ) | |
4840 if self.rightSidebar: | 5440 if self.rightSidebar: |
4841 self.profiles[self.currentProfile][1][2] = ( | 5441 self.profiles[self.currentProfile][1][ |
4842 self.rightSidebar.isVisible() | 5442 2 |
4843 ) | 5443 ] = self.rightSidebar.isVisible() |
4844 Preferences.setUI("ViewProfiles", self.profiles) | 5444 Preferences.setUI("ViewProfiles", self.profiles) |
4845 | 5445 |
4846 def __activateViewProfile(self, name, save=True): | 5446 def __activateViewProfile(self, name, save=True): |
4847 """ | 5447 """ |
4848 Private slot to activate a view profile. | 5448 Private slot to activate a view profile. |
4849 | 5449 |
4850 @param name name of the profile to be activated (string) | 5450 @param name name of the profile to be activated (string) |
4851 @param save flag indicating that the current profile should | 5451 @param save flag indicating that the current profile should |
4852 be saved (boolean) | 5452 be saved (boolean) |
4853 """ | 5453 """ |
4854 if self.currentProfile != name or not save: | 5454 if self.currentProfile != name or not save: |
4855 # step 1: save the active profile | 5455 # step 1: save the active profile |
4856 self.__saveCurrentViewProfile(save) | 5456 self.__saveCurrentViewProfile(save) |
4857 | 5457 |
4858 # step 2: set the window geometries of the new profile | 5458 # step 2: set the window geometries of the new profile |
4859 if self.__layoutType in ["Toolboxes", "Sidebars"]: | 5459 if self.__layoutType in ["Toolboxes", "Sidebars"]: |
4860 state = self.profiles[name][0] | 5460 state = self.profiles[name][0] |
4861 if not state.isEmpty(): | 5461 if not state.isEmpty(): |
4862 self.restoreState(state) | 5462 self.restoreState(state) |
4865 if not state.isEmpty(): | 5465 if not state.isEmpty(): |
4866 self.horizontalSplitter.restoreState(state) | 5466 self.horizontalSplitter.restoreState(state) |
4867 state = self.profiles[name][2][1] | 5467 state = self.profiles[name][2][1] |
4868 if not state.isEmpty(): | 5468 if not state.isEmpty(): |
4869 self.verticalSplitter.restoreState(state) | 5469 self.verticalSplitter.restoreState(state) |
4870 | 5470 |
4871 state = self.profiles[name][2][2] | 5471 state = self.profiles[name][2][2] |
4872 if state: | 5472 if state: |
4873 self.leftSidebar.restoreState(state) | 5473 self.leftSidebar.restoreState(state) |
4874 state = self.profiles[name][2][3] | 5474 state = self.profiles[name][2][3] |
4875 if state: | 5475 if state: |
4876 self.bottomSidebar.restoreState(state) | 5476 self.bottomSidebar.restoreState(state) |
4877 if self.rightSidebar: | 5477 if self.rightSidebar: |
4878 state = self.profiles[name][2][4] | 5478 state = self.profiles[name][2][4] |
4879 if state: | 5479 if state: |
4880 self.rightSidebar.restoreState(state) | 5480 self.rightSidebar.restoreState(state) |
4881 | 5481 |
4882 if self.__layoutType == "Toolboxes": | 5482 if self.__layoutType == "Toolboxes": |
4883 # set the corner usages | 5483 # set the corner usages |
4884 self.setCorner(Qt.Corner.TopLeftCorner, | 5484 self.setCorner( |
4885 Qt.DockWidgetArea.LeftDockWidgetArea) | 5485 Qt.Corner.TopLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea |
4886 self.setCorner(Qt.Corner.BottomLeftCorner, | 5486 ) |
4887 Qt.DockWidgetArea.LeftDockWidgetArea) | 5487 self.setCorner( |
4888 self.setCorner(Qt.Corner.TopRightCorner, | 5488 Qt.Corner.BottomLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea |
4889 Qt.DockWidgetArea.RightDockWidgetArea) | 5489 ) |
4890 self.setCorner(Qt.Corner.BottomRightCorner, | 5490 self.setCorner( |
4891 Qt.DockWidgetArea.RightDockWidgetArea) | 5491 Qt.Corner.TopRightCorner, Qt.DockWidgetArea.RightDockWidgetArea |
4892 | 5492 ) |
5493 self.setCorner( | |
5494 Qt.Corner.BottomRightCorner, | |
5495 Qt.DockWidgetArea.RightDockWidgetArea, | |
5496 ) | |
5497 | |
4893 # step 3: activate the windows of the new profile | 5498 # step 3: activate the windows of the new profile |
4894 if self.__layoutType == "Toolboxes": | 5499 if self.__layoutType == "Toolboxes": |
4895 self.lToolboxDock.setVisible(self.profiles[name][1][0]) | 5500 self.lToolboxDock.setVisible(self.profiles[name][1][0]) |
4896 self.hToolboxDock.setVisible(self.profiles[name][1][1]) | 5501 self.hToolboxDock.setVisible(self.profiles[name][1][1]) |
4897 self.rToolboxDock.setVisible(self.profiles[name][1][2]) | 5502 self.rToolboxDock.setVisible(self.profiles[name][1][2]) |
4898 elif self.__layoutType == "Sidebars": | 5503 elif self.__layoutType == "Sidebars": |
4899 self.leftSidebar.setVisible(self.profiles[name][1][0]) | 5504 self.leftSidebar.setVisible(self.profiles[name][1][0]) |
4900 self.bottomSidebar.setVisible(self.profiles[name][1][1]) | 5505 self.bottomSidebar.setVisible(self.profiles[name][1][1]) |
4901 if self.rightSidebar: | 5506 if self.rightSidebar: |
4902 self.rightSidebar.setVisible(self.profiles[name][1][2]) | 5507 self.rightSidebar.setVisible(self.profiles[name][1][2]) |
4903 | 5508 |
4904 # step 4: remember the new profile | 5509 # step 4: remember the new profile |
4905 self.currentProfile = name | 5510 self.currentProfile = name |
4906 | 5511 |
4907 # step 5: make sure that cursor of the shell is visible | 5512 # step 5: make sure that cursor of the shell is visible |
4908 self.shell.ensureCursorVisible() | 5513 self.shell.ensureCursorVisible() |
4909 | 5514 |
4910 # step 6: make sure, that the toolbars and window menu are | 5515 # step 6: make sure, that the toolbars and window menu are |
4911 # shown correctly | 5516 # shown correctly |
4912 if self.__menus["toolbars"].isTearOffMenuVisible(): | 5517 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4913 self.__showToolbarsMenu() | 5518 self.__showToolbarsMenu() |
4914 if self.__menus["window"].isTearOffMenuVisible(): | 5519 if self.__menus["window"].isTearOffMenuVisible(): |
4915 self.__showWindowMenu() | 5520 self.__showWindowMenu() |
4916 | 5521 |
4917 def __debuggingStarted(self): | 5522 def __debuggingStarted(self): |
4918 """ | 5523 """ |
4919 Private slot to handle the start of a debugging session. | 5524 Private slot to handle the start of a debugging session. |
4920 """ | 5525 """ |
4921 self.setDebugProfile() | 5526 self.setDebugProfile() |
4931 else: | 5536 else: |
4932 self.__currentRightWidget = self.leftSidebar.currentWidget() | 5537 self.__currentRightWidget = self.leftSidebar.currentWidget() |
4933 self.leftSidebar.setCurrentWidget(self.debugViewer) | 5538 self.leftSidebar.setCurrentWidget(self.debugViewer) |
4934 self.__currentBottomWidget = self.bottomSidebar.currentWidget() | 5539 self.__currentBottomWidget = self.bottomSidebar.currentWidget() |
4935 self.bottomSidebar.setCurrentWidget(self.shellAssembly) | 5540 self.bottomSidebar.setCurrentWidget(self.shellAssembly) |
4936 | 5541 |
4937 def __debuggingDone(self): | 5542 def __debuggingDone(self): |
4938 """ | 5543 """ |
4939 Private slot to handle the end of a debugging session. | 5544 Private slot to handle the end of a debugging session. |
4940 """ | 5545 """ |
4941 self.__setEditProfile() | 5546 self.__setEditProfile() |
4945 if self.__currentBottomWidget: | 5550 if self.__currentBottomWidget: |
4946 self.hToolbox.setCurrentWidget(self.__currentBottomWidget) | 5551 self.hToolbox.setCurrentWidget(self.__currentBottomWidget) |
4947 elif self.__layoutType == "Sidebars": | 5552 elif self.__layoutType == "Sidebars": |
4948 if self.__currentRightWidget: | 5553 if self.__currentRightWidget: |
4949 if self.rightSidebar: | 5554 if self.rightSidebar: |
4950 self.rightSidebar.setCurrentWidget( | 5555 self.rightSidebar.setCurrentWidget(self.__currentRightWidget) |
4951 self.__currentRightWidget) | |
4952 else: | 5556 else: |
4953 self.leftSidebar.setCurrentWidget( | 5557 self.leftSidebar.setCurrentWidget(self.__currentRightWidget) |
4954 self.__currentRightWidget) | |
4955 if self.__currentBottomWidget: | 5558 if self.__currentBottomWidget: |
4956 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget) | 5559 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget) |
4957 self.__currentRightWidget = None | 5560 self.__currentRightWidget = None |
4958 self.__currentBottomWidget = None | 5561 self.__currentBottomWidget = None |
4959 self.__activateViewmanager() | 5562 self.__activateViewmanager() |
4960 | 5563 |
4961 @pyqtSlot() | 5564 @pyqtSlot() |
4962 def __setEditProfile(self, save=True): | 5565 def __setEditProfile(self, save=True): |
4963 """ | 5566 """ |
4964 Private slot to activate the edit view profile. | 5567 Private slot to activate the edit view profile. |
4965 | 5568 |
4966 @param save flag indicating that the current profile should | 5569 @param save flag indicating that the current profile should |
4967 be saved (boolean) | 5570 be saved (boolean) |
4968 """ | 5571 """ |
4969 self.__activateViewProfile("edit", save) | 5572 self.__activateViewProfile("edit", save) |
4970 self.setEditProfileAct.setChecked(True) | 5573 self.setEditProfileAct.setChecked(True) |
4971 | 5574 |
4972 @pyqtSlot() | 5575 @pyqtSlot() |
4973 def setDebugProfile(self, save=True): | 5576 def setDebugProfile(self, save=True): |
4974 """ | 5577 """ |
4975 Public slot to activate the debug view profile. | 5578 Public slot to activate the debug view profile. |
4976 | 5579 |
4977 @param save flag indicating that the current profile should | 5580 @param save flag indicating that the current profile should |
4978 be saved (boolean) | 5581 be saved (boolean) |
4979 """ | 5582 """ |
4980 self.viewmanager.searchWidget().hide() | 5583 self.viewmanager.searchWidget().hide() |
4981 self.viewmanager.replaceWidget().hide() | 5584 self.viewmanager.replaceWidget().hide() |
4982 self.__activateViewProfile("debug", save) | 5585 self.__activateViewProfile("debug", save) |
4983 self.setDebugProfileAct.setChecked(True) | 5586 self.setDebugProfileAct.setChecked(True) |
4984 | 5587 |
4985 def getViewProfile(self): | 5588 def getViewProfile(self): |
4986 """ | 5589 """ |
4987 Public method to get the current view profile. | 5590 Public method to get the current view profile. |
4988 | 5591 |
4989 @return the name of the current view profile (string) | 5592 @return the name of the current view profile (string) |
4990 """ | 5593 """ |
4991 return self.currentProfile | 5594 return self.currentProfile |
4992 | 5595 |
4993 def getLayoutType(self): | 5596 def getLayoutType(self): |
4994 """ | 5597 """ |
4995 Public method to get the current layout type. | 5598 Public method to get the current layout type. |
4996 | 5599 |
4997 @return current layout type | 5600 @return current layout type |
4998 @rtype str | 5601 @rtype str |
4999 """ | 5602 """ |
5000 return self.__layoutType | 5603 return self.__layoutType |
5001 | 5604 |
5002 def __activateLeftRightSidebarWidget(self, widget): | 5605 def __activateLeftRightSidebarWidget(self, widget): |
5003 """ | 5606 """ |
5004 Private method to activate the given widget in the left or right | 5607 Private method to activate the given widget in the left or right |
5005 sidebar. | 5608 sidebar. |
5006 | 5609 |
5007 @param widget reference to the widget to be activated | 5610 @param widget reference to the widget to be activated |
5008 @type QWidget | 5611 @type QWidget |
5009 """ | 5612 """ |
5010 sidebar = ( | 5613 sidebar = ( |
5011 self.leftSidebar | 5614 self.leftSidebar |
5012 if Preferences.getUI("CombinedLeftRightSidebar") else | 5615 if Preferences.getUI("CombinedLeftRightSidebar") |
5013 self.rightSidebar | 5616 else self.rightSidebar |
5014 ) | 5617 ) |
5015 sidebar.show() | 5618 sidebar.show() |
5016 sidebar.setCurrentWidget(widget) | 5619 sidebar.setCurrentWidget(widget) |
5017 | 5620 |
5018 def __activateProjectBrowser(self): | 5621 def __activateProjectBrowser(self): |
5019 """ | 5622 """ |
5020 Private slot to handle the activation of the project browser. | 5623 Private slot to handle the activation of the project browser. |
5021 """ | 5624 """ |
5022 if self.__layoutType == "Toolboxes": | 5625 if self.__layoutType == "Toolboxes": |
5024 self.lToolbox.setCurrentWidget(self.projectBrowser) | 5627 self.lToolbox.setCurrentWidget(self.projectBrowser) |
5025 elif self.__layoutType == "Sidebars": | 5628 elif self.__layoutType == "Sidebars": |
5026 self.leftSidebar.show() | 5629 self.leftSidebar.show() |
5027 self.leftSidebar.setCurrentWidget(self.projectBrowser) | 5630 self.leftSidebar.setCurrentWidget(self.projectBrowser) |
5028 self.projectBrowser.currentWidget().setFocus( | 5631 self.projectBrowser.currentWidget().setFocus( |
5029 Qt.FocusReason.ActiveWindowFocusReason) | 5632 Qt.FocusReason.ActiveWindowFocusReason |
5030 | 5633 ) |
5634 | |
5031 def __activateMultiProjectBrowser(self): | 5635 def __activateMultiProjectBrowser(self): |
5032 """ | 5636 """ |
5033 Private slot to handle the activation of the project browser. | 5637 Private slot to handle the activation of the project browser. |
5034 """ | 5638 """ |
5035 if self.__layoutType == "Toolboxes": | 5639 if self.__layoutType == "Toolboxes": |
5036 self.lToolboxDock.show() | 5640 self.lToolboxDock.show() |
5037 self.lToolbox.setCurrentWidget(self.multiProjectBrowser) | 5641 self.lToolbox.setCurrentWidget(self.multiProjectBrowser) |
5038 elif self.__layoutType == "Sidebars": | 5642 elif self.__layoutType == "Sidebars": |
5039 self.leftSidebar.show() | 5643 self.leftSidebar.show() |
5040 self.leftSidebar.setCurrentWidget(self.multiProjectBrowser) | 5644 self.leftSidebar.setCurrentWidget(self.multiProjectBrowser) |
5041 self.multiProjectBrowser.setFocus( | 5645 self.multiProjectBrowser.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5042 Qt.FocusReason.ActiveWindowFocusReason) | 5646 |
5043 | |
5044 def activateDebugViewer(self): | 5647 def activateDebugViewer(self): |
5045 """ | 5648 """ |
5046 Public slot to handle the activation of the debug viewer. | 5649 Public slot to handle the activation of the debug viewer. |
5047 """ | 5650 """ |
5048 if self.__layoutType == "Toolboxes": | 5651 if self.__layoutType == "Toolboxes": |
5049 self.rToolboxDock.show() | 5652 self.rToolboxDock.show() |
5050 self.rToolbox.setCurrentWidget(self.debugViewer) | 5653 self.rToolbox.setCurrentWidget(self.debugViewer) |
5051 elif self.__layoutType == "Sidebars": | 5654 elif self.__layoutType == "Sidebars": |
5052 self.__activateLeftRightSidebarWidget(self.debugViewer) | 5655 self.__activateLeftRightSidebarWidget(self.debugViewer) |
5053 self.debugViewer.currentWidget().setFocus( | 5656 self.debugViewer.currentWidget().setFocus( |
5054 Qt.FocusReason.ActiveWindowFocusReason) | 5657 Qt.FocusReason.ActiveWindowFocusReason |
5055 | 5658 ) |
5659 | |
5056 def __activateShell(self): | 5660 def __activateShell(self): |
5057 """ | 5661 """ |
5058 Private slot to handle the activation of the Shell window. | 5662 Private slot to handle the activation of the Shell window. |
5059 """ | 5663 """ |
5060 if self.__layoutType == "Toolboxes": | 5664 if self.__layoutType == "Toolboxes": |
5062 self.__shellParent.widget().setCurrentWidget(self.shellAssembly) | 5666 self.__shellParent.widget().setCurrentWidget(self.shellAssembly) |
5063 elif self.__layoutType == "Sidebars": | 5667 elif self.__layoutType == "Sidebars": |
5064 self.__shellParent.show() | 5668 self.__shellParent.show() |
5065 self.__shellParent.setCurrentWidget(self.shellAssembly) | 5669 self.__shellParent.setCurrentWidget(self.shellAssembly) |
5066 self.shell.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5670 self.shell.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5067 | 5671 |
5068 def __activateLogViewer(self): | 5672 def __activateLogViewer(self): |
5069 """ | 5673 """ |
5070 Private slot to handle the activation of the Log Viewer. | 5674 Private slot to handle the activation of the Log Viewer. |
5071 """ | 5675 """ |
5072 if self.__layoutType == "Toolboxes": | 5676 if self.__layoutType == "Toolboxes": |
5074 self.hToolbox.setCurrentWidget(self.logViewer) | 5678 self.hToolbox.setCurrentWidget(self.logViewer) |
5075 elif self.__layoutType == "Sidebars": | 5679 elif self.__layoutType == "Sidebars": |
5076 self.bottomSidebar.show() | 5680 self.bottomSidebar.show() |
5077 self.bottomSidebar.setCurrentWidget(self.logViewer) | 5681 self.bottomSidebar.setCurrentWidget(self.logViewer) |
5078 self.logViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5682 self.logViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5079 | 5683 |
5080 def __activateTaskViewer(self): | 5684 def __activateTaskViewer(self): |
5081 """ | 5685 """ |
5082 Private slot to handle the activation of the Task Viewer. | 5686 Private slot to handle the activation of the Task Viewer. |
5083 """ | 5687 """ |
5084 if self.__layoutType == "Toolboxes": | 5688 if self.__layoutType == "Toolboxes": |
5086 self.hToolbox.setCurrentWidget(self.taskViewer) | 5690 self.hToolbox.setCurrentWidget(self.taskViewer) |
5087 elif self.__layoutType == "Sidebars": | 5691 elif self.__layoutType == "Sidebars": |
5088 self.bottomSidebar.show() | 5692 self.bottomSidebar.show() |
5089 self.bottomSidebar.setCurrentWidget(self.taskViewer) | 5693 self.bottomSidebar.setCurrentWidget(self.taskViewer) |
5090 self.taskViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5694 self.taskViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5091 | 5695 |
5092 def __activateTemplateViewer(self): | 5696 def __activateTemplateViewer(self): |
5093 """ | 5697 """ |
5094 Private slot to handle the activation of the Template Viewer. | 5698 Private slot to handle the activation of the Template Viewer. |
5095 """ | 5699 """ |
5096 if self.templateViewer is not None: | 5700 if self.templateViewer is not None: |
5098 self.lToolboxDock.show() | 5702 self.lToolboxDock.show() |
5099 self.lToolbox.setCurrentWidget(self.templateViewer) | 5703 self.lToolbox.setCurrentWidget(self.templateViewer) |
5100 elif self.__layoutType == "Sidebars": | 5704 elif self.__layoutType == "Sidebars": |
5101 self.leftSidebar.show() | 5705 self.leftSidebar.show() |
5102 self.leftSidebar.setCurrentWidget(self.templateViewer) | 5706 self.leftSidebar.setCurrentWidget(self.templateViewer) |
5103 self.templateViewer.setFocus( | 5707 self.templateViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5104 Qt.FocusReason.ActiveWindowFocusReason) | 5708 |
5105 | |
5106 def __activateBrowser(self): | 5709 def __activateBrowser(self): |
5107 """ | 5710 """ |
5108 Private slot to handle the activation of the file browser. | 5711 Private slot to handle the activation of the file browser. |
5109 """ | 5712 """ |
5110 if self.browser is not None: | 5713 if self.browser is not None: |
5113 self.lToolbox.setCurrentWidget(self.browser) | 5716 self.lToolbox.setCurrentWidget(self.browser) |
5114 elif self.__layoutType == "Sidebars": | 5717 elif self.__layoutType == "Sidebars": |
5115 self.leftSidebar.show() | 5718 self.leftSidebar.show() |
5116 self.leftSidebar.setCurrentWidget(self.browser) | 5719 self.leftSidebar.setCurrentWidget(self.browser) |
5117 self.browser.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5720 self.browser.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5118 | 5721 |
5119 def __toggleLeftToolbox(self): | 5722 def __toggleLeftToolbox(self): |
5120 """ | 5723 """ |
5121 Private slot to handle the toggle of the Left Toolbox window. | 5724 Private slot to handle the toggle of the Left Toolbox window. |
5122 """ | 5725 """ |
5123 hasFocus = self.lToolbox.currentWidget().hasFocus() | 5726 hasFocus = self.lToolbox.currentWidget().hasFocus() |
5124 shown = self.__toggleWindow(self.lToolboxDock) | 5727 shown = self.__toggleWindow(self.lToolboxDock) |
5125 if shown: | 5728 if shown: |
5126 self.lToolbox.currentWidget().setFocus( | 5729 self.lToolbox.currentWidget().setFocus( |
5127 Qt.FocusReason.ActiveWindowFocusReason) | 5730 Qt.FocusReason.ActiveWindowFocusReason |
5731 ) | |
5128 else: | 5732 else: |
5129 if hasFocus: | 5733 if hasFocus: |
5130 self.__activateViewmanager() | 5734 self.__activateViewmanager() |
5131 | 5735 |
5132 def __toggleRightToolbox(self): | 5736 def __toggleRightToolbox(self): |
5133 """ | 5737 """ |
5134 Private slot to handle the toggle of the Right Toolbox window. | 5738 Private slot to handle the toggle of the Right Toolbox window. |
5135 """ | 5739 """ |
5136 hasFocus = self.rToolbox.currentWidget().hasFocus() | 5740 hasFocus = self.rToolbox.currentWidget().hasFocus() |
5137 shown = self.__toggleWindow(self.rToolboxDock) | 5741 shown = self.__toggleWindow(self.rToolboxDock) |
5138 if shown: | 5742 if shown: |
5139 self.rToolbox.currentWidget().setFocus( | 5743 self.rToolbox.currentWidget().setFocus( |
5140 Qt.FocusReason.ActiveWindowFocusReason) | 5744 Qt.FocusReason.ActiveWindowFocusReason |
5745 ) | |
5141 else: | 5746 else: |
5142 if hasFocus: | 5747 if hasFocus: |
5143 self.__activateViewmanager() | 5748 self.__activateViewmanager() |
5144 | 5749 |
5145 def __toggleHorizontalToolbox(self): | 5750 def __toggleHorizontalToolbox(self): |
5146 """ | 5751 """ |
5147 Private slot to handle the toggle of the Horizontal Toolbox window. | 5752 Private slot to handle the toggle of the Horizontal Toolbox window. |
5148 """ | 5753 """ |
5149 hasFocus = self.hToolbox.currentWidget().hasFocus() | 5754 hasFocus = self.hToolbox.currentWidget().hasFocus() |
5150 shown = self.__toggleWindow(self.hToolboxDock) | 5755 shown = self.__toggleWindow(self.hToolboxDock) |
5151 if shown: | 5756 if shown: |
5152 self.hToolbox.currentWidget().setFocus( | 5757 self.hToolbox.currentWidget().setFocus( |
5153 Qt.FocusReason.ActiveWindowFocusReason) | 5758 Qt.FocusReason.ActiveWindowFocusReason |
5759 ) | |
5154 else: | 5760 else: |
5155 if hasFocus: | 5761 if hasFocus: |
5156 self.__activateViewmanager() | 5762 self.__activateViewmanager() |
5157 | 5763 |
5158 def __toggleLeftSidebar(self): | 5764 def __toggleLeftSidebar(self): |
5159 """ | 5765 """ |
5160 Private slot to handle the toggle of the left sidebar window. | 5766 Private slot to handle the toggle of the left sidebar window. |
5161 """ | 5767 """ |
5162 hasFocus = self.leftSidebar.currentWidget().hasFocus() | 5768 hasFocus = self.leftSidebar.currentWidget().hasFocus() |
5163 shown = self.__toggleWindow(self.leftSidebar) | 5769 shown = self.__toggleWindow(self.leftSidebar) |
5164 if shown: | 5770 if shown: |
5165 self.leftSidebar.currentWidget().setFocus( | 5771 self.leftSidebar.currentWidget().setFocus( |
5166 Qt.FocusReason.ActiveWindowFocusReason) | 5772 Qt.FocusReason.ActiveWindowFocusReason |
5773 ) | |
5167 else: | 5774 else: |
5168 if hasFocus: | 5775 if hasFocus: |
5169 self.__activateViewmanager() | 5776 self.__activateViewmanager() |
5170 | 5777 |
5171 def __toggleRightSidebar(self): | 5778 def __toggleRightSidebar(self): |
5172 """ | 5779 """ |
5173 Private slot to handle the toggle of the right sidebar window. | 5780 Private slot to handle the toggle of the right sidebar window. |
5174 """ | 5781 """ |
5175 hasFocus = self.rightSidebar.currentWidget().hasFocus() | 5782 hasFocus = self.rightSidebar.currentWidget().hasFocus() |
5176 shown = self.__toggleWindow(self.rightSidebar) | 5783 shown = self.__toggleWindow(self.rightSidebar) |
5177 if shown: | 5784 if shown: |
5178 self.rightSidebar.currentWidget().setFocus( | 5785 self.rightSidebar.currentWidget().setFocus( |
5179 Qt.FocusReason.ActiveWindowFocusReason) | 5786 Qt.FocusReason.ActiveWindowFocusReason |
5787 ) | |
5180 else: | 5788 else: |
5181 if hasFocus: | 5789 if hasFocus: |
5182 self.__activateViewmanager() | 5790 self.__activateViewmanager() |
5183 | 5791 |
5184 def __toggleBottomSidebar(self): | 5792 def __toggleBottomSidebar(self): |
5185 """ | 5793 """ |
5186 Private slot to handle the toggle of the bottom sidebar window. | 5794 Private slot to handle the toggle of the bottom sidebar window. |
5187 """ | 5795 """ |
5188 hasFocus = self.bottomSidebar.currentWidget().hasFocus() | 5796 hasFocus = self.bottomSidebar.currentWidget().hasFocus() |
5189 shown = self.__toggleWindow(self.bottomSidebar) | 5797 shown = self.__toggleWindow(self.bottomSidebar) |
5190 if shown: | 5798 if shown: |
5191 self.bottomSidebar.currentWidget().setFocus( | 5799 self.bottomSidebar.currentWidget().setFocus( |
5192 Qt.FocusReason.ActiveWindowFocusReason) | 5800 Qt.FocusReason.ActiveWindowFocusReason |
5801 ) | |
5193 else: | 5802 else: |
5194 if hasFocus: | 5803 if hasFocus: |
5195 self.__activateViewmanager() | 5804 self.__activateViewmanager() |
5196 | 5805 |
5197 def activateCooperationViewer(self): | 5806 def activateCooperationViewer(self): |
5198 """ | 5807 """ |
5199 Public slot to handle the activation of the cooperation window. | 5808 Public slot to handle the activation of the cooperation window. |
5200 """ | 5809 """ |
5201 if self.cooperation is not None: | 5810 if self.cooperation is not None: |
5203 self.rToolboxDock.show() | 5812 self.rToolboxDock.show() |
5204 self.rToolbox.setCurrentWidget(self.cooperation) | 5813 self.rToolbox.setCurrentWidget(self.cooperation) |
5205 elif self.__layoutType == "Sidebars": | 5814 elif self.__layoutType == "Sidebars": |
5206 self.__activateLeftRightSidebarWidget(self.cooperation) | 5815 self.__activateLeftRightSidebarWidget(self.cooperation) |
5207 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5816 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5208 | 5817 |
5209 def __activateIRC(self): | 5818 def __activateIRC(self): |
5210 """ | 5819 """ |
5211 Private slot to handle the activation of the IRC window. | 5820 Private slot to handle the activation of the IRC window. |
5212 """ | 5821 """ |
5213 if self.irc is not None: | 5822 if self.irc is not None: |
5215 self.rToolboxDock.show() | 5824 self.rToolboxDock.show() |
5216 self.rToolbox.setCurrentWidget(self.irc) | 5825 self.rToolbox.setCurrentWidget(self.irc) |
5217 elif self.__layoutType == "Sidebars": | 5826 elif self.__layoutType == "Sidebars": |
5218 self.__activateLeftRightSidebarWidget(self.irc) | 5827 self.__activateLeftRightSidebarWidget(self.irc) |
5219 self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5828 self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5220 | 5829 |
5221 def __activateSymbolsViewer(self): | 5830 def __activateSymbolsViewer(self): |
5222 """ | 5831 """ |
5223 Private slot to handle the activation of the Symbols Viewer. | 5832 Private slot to handle the activation of the Symbols Viewer. |
5224 """ | 5833 """ |
5225 if self.symbolsViewer is not None: | 5834 if self.symbolsViewer is not None: |
5228 self.lToolbox.setCurrentWidget(self.symbolsViewer) | 5837 self.lToolbox.setCurrentWidget(self.symbolsViewer) |
5229 elif self.__layoutType == "Sidebars": | 5838 elif self.__layoutType == "Sidebars": |
5230 self.leftSidebar.show() | 5839 self.leftSidebar.show() |
5231 self.leftSidebar.setCurrentWidget(self.symbolsViewer) | 5840 self.leftSidebar.setCurrentWidget(self.symbolsViewer) |
5232 self.symbolsViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5841 self.symbolsViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5233 | 5842 |
5234 def __activateNumbersViewer(self): | 5843 def __activateNumbersViewer(self): |
5235 """ | 5844 """ |
5236 Private slot to handle the activation of the Numbers Viewer. | 5845 Private slot to handle the activation of the Numbers Viewer. |
5237 """ | 5846 """ |
5238 if self.numbersViewer is not None: | 5847 if self.numbersViewer is not None: |
5241 self.hToolbox.setCurrentWidget(self.numbersViewer) | 5850 self.hToolbox.setCurrentWidget(self.numbersViewer) |
5242 elif self.__layoutType == "Sidebars": | 5851 elif self.__layoutType == "Sidebars": |
5243 self.bottomSidebar.show() | 5852 self.bottomSidebar.show() |
5244 self.bottomSidebar.setCurrentWidget(self.numbersViewer) | 5853 self.bottomSidebar.setCurrentWidget(self.numbersViewer) |
5245 self.numbersViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5854 self.numbersViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5246 | 5855 |
5247 def __activateViewmanager(self): | 5856 def __activateViewmanager(self): |
5248 """ | 5857 """ |
5249 Private slot to handle the activation of the current editor. | 5858 Private slot to handle the activation of the current editor. |
5250 """ | 5859 """ |
5251 aw = self.viewmanager.activeWindow() | 5860 aw = self.viewmanager.activeWindow() |
5252 if aw is not None: | 5861 if aw is not None: |
5253 aw.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5862 aw.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5254 | 5863 |
5255 def activateCodeDocumentationViewer(self, switchFocus=True): | 5864 def activateCodeDocumentationViewer(self, switchFocus=True): |
5256 """ | 5865 """ |
5257 Public slot to handle the activation of the Code Documentation Viewer. | 5866 Public slot to handle the activation of the Code Documentation Viewer. |
5258 | 5867 |
5259 @param switchFocus flag indicating to transfer the input focus | 5868 @param switchFocus flag indicating to transfer the input focus |
5260 @type bool | 5869 @type bool |
5261 """ | 5870 """ |
5262 if self.codeDocumentationViewer is not None: | 5871 if self.codeDocumentationViewer is not None: |
5263 if self.__layoutType == "Toolboxes": | 5872 if self.__layoutType == "Toolboxes": |
5264 self.rToolboxDock.show() | 5873 self.rToolboxDock.show() |
5265 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) | 5874 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) |
5266 elif self.__layoutType == "Sidebars": | 5875 elif self.__layoutType == "Sidebars": |
5267 self.__activateLeftRightSidebarWidget( | 5876 self.__activateLeftRightSidebarWidget(self.codeDocumentationViewer) |
5268 self.codeDocumentationViewer) | |
5269 if switchFocus: | 5877 if switchFocus: |
5270 self.codeDocumentationViewer.setFocus( | 5878 self.codeDocumentationViewer.setFocus( |
5271 Qt.FocusReason.ActiveWindowFocusReason) | 5879 Qt.FocusReason.ActiveWindowFocusReason |
5272 | 5880 ) |
5881 | |
5273 def __activatePipWidget(self): | 5882 def __activatePipWidget(self): |
5274 """ | 5883 """ |
5275 Private slot to handle the activation of the PyPI manager widget. | 5884 Private slot to handle the activation of the PyPI manager widget. |
5276 """ | 5885 """ |
5277 if self.pipWidget is not None: | 5886 if self.pipWidget is not None: |
5279 self.rToolboxDock.show() | 5888 self.rToolboxDock.show() |
5280 self.rToolbox.setCurrentWidget(self.pipWidget) | 5889 self.rToolbox.setCurrentWidget(self.pipWidget) |
5281 elif self.__layoutType == "Sidebars": | 5890 elif self.__layoutType == "Sidebars": |
5282 self.__activateLeftRightSidebarWidget(self.pipWidget) | 5891 self.__activateLeftRightSidebarWidget(self.pipWidget) |
5283 self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5892 self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5284 | 5893 |
5285 def __activateCondaWidget(self): | 5894 def __activateCondaWidget(self): |
5286 """ | 5895 """ |
5287 Private slot to handle the activation of the Conda manager widget. | 5896 Private slot to handle the activation of the Conda manager widget. |
5288 """ | 5897 """ |
5289 if self.condaWidget is not None: | 5898 if self.condaWidget is not None: |
5291 self.rToolboxDock.show() | 5900 self.rToolboxDock.show() |
5292 self.rToolbox.setCurrentWidget(self.condaWidget) | 5901 self.rToolbox.setCurrentWidget(self.condaWidget) |
5293 elif self.__layoutType == "Sidebars": | 5902 elif self.__layoutType == "Sidebars": |
5294 self.__activateLeftRightSidebarWidget(self.condaWidget) | 5903 self.__activateLeftRightSidebarWidget(self.condaWidget) |
5295 self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) | 5904 self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5296 | 5905 |
5297 def __activateMicroPython(self): | 5906 def __activateMicroPython(self): |
5298 """ | 5907 """ |
5299 Private slot to handle the activation of the MicroPython widget. | 5908 Private slot to handle the activation of the MicroPython widget. |
5300 """ | 5909 """ |
5301 if self.microPythonWidget is not None: | 5910 if self.microPythonWidget is not None: |
5302 if self.__layoutType == "Toolboxes": | 5911 if self.__layoutType == "Toolboxes": |
5303 self.rToolboxDock.show() | 5912 self.rToolboxDock.show() |
5304 self.rToolbox.setCurrentWidget(self.microPythonWidget) | 5913 self.rToolbox.setCurrentWidget(self.microPythonWidget) |
5305 elif self.__layoutType == "Sidebars": | 5914 elif self.__layoutType == "Sidebars": |
5306 self.__activateLeftRightSidebarWidget(self.microPythonWidget) | 5915 self.__activateLeftRightSidebarWidget(self.microPythonWidget) |
5307 self.microPythonWidget.setFocus( | 5916 self.microPythonWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
5308 Qt.FocusReason.ActiveWindowFocusReason) | 5917 |
5309 | |
5310 def __toggleWindow(self, w): | 5918 def __toggleWindow(self, w): |
5311 """ | 5919 """ |
5312 Private method to toggle a workspace editor window. | 5920 Private method to toggle a workspace editor window. |
5313 | 5921 |
5314 @param w reference to the workspace editor window | 5922 @param w reference to the workspace editor window |
5315 @return flag indicating, if the window was shown (boolean) | 5923 @return flag indicating, if the window was shown (boolean) |
5316 """ | 5924 """ |
5317 if w.isHidden(): | 5925 if w.isHidden(): |
5318 w.show() | 5926 w.show() |
5319 return True | 5927 return True |
5320 else: | 5928 else: |
5321 w.hide() | 5929 w.hide() |
5322 return False | 5930 return False |
5323 | 5931 |
5324 def __toolsConfiguration(self): | 5932 def __toolsConfiguration(self): |
5325 """ | 5933 """ |
5326 Private slot to handle the tools configuration menu entry. | 5934 Private slot to handle the tools configuration menu entry. |
5327 """ | 5935 """ |
5328 from Preferences.ToolConfigurationDialog import ToolConfigurationDialog | 5936 from Preferences.ToolConfigurationDialog import ToolConfigurationDialog |
5329 dlg = ToolConfigurationDialog( | 5937 |
5330 self.toolGroups[self.currentToolGroup][1], self) | 5938 dlg = ToolConfigurationDialog(self.toolGroups[self.currentToolGroup][1], self) |
5331 if dlg.exec() == QDialog.DialogCode.Accepted: | 5939 if dlg.exec() == QDialog.DialogCode.Accepted: |
5332 self.toolGroups[self.currentToolGroup][1] = dlg.getToollist() | 5940 self.toolGroups[self.currentToolGroup][1] = dlg.getToollist() |
5333 self.__updateExternalToolsActions() | 5941 self.__updateExternalToolsActions() |
5334 | 5942 |
5335 def __toolGroupsConfiguration(self): | 5943 def __toolGroupsConfiguration(self): |
5336 """ | 5944 """ |
5337 Private slot to handle the tool groups configuration menu entry. | 5945 Private slot to handle the tool groups configuration menu entry. |
5338 """ | 5946 """ |
5339 from Preferences.ToolGroupConfigurationDialog import ( | 5947 from Preferences.ToolGroupConfigurationDialog import ( |
5340 ToolGroupConfigurationDialog | 5948 ToolGroupConfigurationDialog, |
5341 ) | 5949 ) |
5342 dlg = ToolGroupConfigurationDialog( | 5950 |
5343 self.toolGroups, self.currentToolGroup, self) | 5951 dlg = ToolGroupConfigurationDialog(self.toolGroups, self.currentToolGroup, self) |
5344 if dlg.exec() == QDialog.DialogCode.Accepted: | 5952 if dlg.exec() == QDialog.DialogCode.Accepted: |
5345 self.toolGroups, self.currentToolGroup = dlg.getToolGroups() | 5953 self.toolGroups, self.currentToolGroup = dlg.getToolGroups() |
5346 | 5954 |
5347 def __createTestingDialog(self): | 5955 def __createTestingDialog(self): |
5348 """ | 5956 """ |
5349 Private slot to generate the testing dialog on demand. | 5957 Private slot to generate the testing dialog on demand. |
5350 """ | 5958 """ |
5351 if self.__testingWidget is None: | 5959 if self.__testingWidget is None: |
5352 from Testing.TestingWidget import TestingWidget | 5960 from Testing.TestingWidget import TestingWidget |
5961 | |
5353 self.__testingWidget = TestingWidget() | 5962 self.__testingWidget = TestingWidget() |
5354 self.__testingWidget.testFile.connect( | 5963 self.__testingWidget.testFile.connect(self.viewmanager.setFileLine) |
5355 self.viewmanager.setFileLine) | 5964 self.__testingWidget.testRunStopped.connect(self.__testingStopped) |
5356 self.__testingWidget.testRunStopped.connect( | 5965 |
5357 self.__testingStopped) | |
5358 | |
5359 def __testingStopped(self): | 5966 def __testingStopped(self): |
5360 """ | 5967 """ |
5361 Private slot to handle the end of a test run. | 5968 Private slot to handle the end of a test run. |
5362 """ | 5969 """ |
5363 self.rerunFailedTestsAct.setEnabled( | 5970 self.rerunFailedTestsAct.setEnabled(self.__testingWidget.hasFailedTests()) |
5364 self.__testingWidget.hasFailedTests()) | |
5365 self.restartTestAct.setEnabled(True) | 5971 self.restartTestAct.setEnabled(True) |
5366 | 5972 |
5367 def __startTesting(self): | 5973 def __startTesting(self): |
5368 """ | 5974 """ |
5369 Private slot for displaying the testing dialog. | 5975 Private slot for displaying the testing dialog. |
5370 """ | 5976 """ |
5371 self.__createTestingDialog() | 5977 self.__createTestingDialog() |
5372 self.__testingWidget.show() | 5978 self.__testingWidget.show() |
5373 self.__testingWidget.raise_() | 5979 self.__testingWidget.raise_() |
5374 | 5980 |
5375 @pyqtSlot() | 5981 @pyqtSlot() |
5376 @pyqtSlot(str) | 5982 @pyqtSlot(str) |
5377 def __startTestScript(self, testFile=None): | 5983 def __startTestScript(self, testFile=None): |
5378 """ | 5984 """ |
5379 Private slot for displaying the testing dialog and run the current | 5985 Private slot for displaying the testing dialog and run the current |
5380 script. | 5986 script. |
5381 | 5987 |
5382 @param testFile file containing the tests to be run | 5988 @param testFile file containing the tests to be run |
5383 @type str | 5989 @type str |
5384 """ | 5990 """ |
5385 if testFile is None: | 5991 if testFile is None: |
5386 aw = self.viewmanager.activeWindow() | 5992 aw = self.viewmanager.activeWindow() |
5387 fn = aw.getFileName() | 5993 fn = aw.getFileName() |
5388 testFile = [ | 5994 testFile = [ |
5389 f for f in Utilities.getTestFileNames(fn) + [fn] | 5995 f for f in Utilities.getTestFileNames(fn) + [fn] if os.path.exists(f) |
5390 if os.path.exists(f) | |
5391 ][0] | 5996 ][0] |
5392 | 5997 |
5393 self.__startTesting() | 5998 self.__startTesting() |
5394 self.__testingWidget.setTestFile(testFile, forProject=False) | 5999 self.__testingWidget.setTestFile(testFile, forProject=False) |
5395 self.restartTestAct.setEnabled(False) | 6000 self.restartTestAct.setEnabled(False) |
5396 self.rerunFailedTestsAct.setEnabled(False) | 6001 self.rerunFailedTestsAct.setEnabled(False) |
5397 | 6002 |
5398 @pyqtSlot() | 6003 @pyqtSlot() |
5399 def __startTestProject(self): | 6004 def __startTestProject(self): |
5400 """ | 6005 """ |
5401 Private slot for displaying the testing dialog and run the test for | 6006 Private slot for displaying the testing dialog and run the test for |
5402 the current project. | 6007 the current project. |
5403 """ | 6008 """ |
5404 testFile = None | 6009 testFile = None |
5405 fn = self.project.getMainScript(True) | 6010 fn = self.project.getMainScript(True) |
5406 if fn: | 6011 if fn: |
5407 testFile = [ | 6012 testFile = [ |
5408 f for f in Utilities.getTestFileNames(fn) + [fn] | 6013 f for f in Utilities.getTestFileNames(fn) + [fn] if os.path.exists(f) |
5409 if os.path.exists(f) | |
5410 ][0] | 6014 ][0] |
5411 | 6015 |
5412 self.__startTesting() | 6016 self.__startTesting() |
5413 self.__testingWidget.setTestFile(testFile, forProject=True) | 6017 self.__testingWidget.setTestFile(testFile, forProject=True) |
5414 self.restartTestAct.setEnabled(False) | 6018 self.restartTestAct.setEnabled(False) |
5415 self.rerunFailedTestsAct.setEnabled(False) | 6019 self.rerunFailedTestsAct.setEnabled(False) |
5416 | 6020 |
5417 def __restartTest(self): | 6021 def __restartTest(self): |
5418 """ | 6022 """ |
5419 Private slot to display the testing dialog and rerun the last | 6023 Private slot to display the testing dialog and rerun the last |
5420 test run. | 6024 test run. |
5421 """ | 6025 """ |
5422 self.__startTesting() | 6026 self.__startTesting() |
5423 self.__testingWidget.startTests() | 6027 self.__testingWidget.startTests() |
5424 | 6028 |
5425 def __rerunFailedTests(self): | 6029 def __rerunFailedTests(self): |
5426 """ | 6030 """ |
5427 Private slot to display the testing dialog and rerun all failed tests | 6031 Private slot to display the testing dialog and rerun all failed tests |
5428 of the last run. | 6032 of the last run. |
5429 """ | 6033 """ |
5430 self.__startTesting() | 6034 self.__startTesting() |
5431 self.__testingWidget.startTests(failedOnly=True) | 6035 self.__testingWidget.startTests(failedOnly=True) |
5432 | 6036 |
5433 @pyqtSlot() | 6037 @pyqtSlot() |
5434 @pyqtSlot(str) | 6038 @pyqtSlot(str) |
5435 def __designer(self, fn=None): | 6039 def __designer(self, fn=None): |
5436 """ | 6040 """ |
5437 Private slot to start the Qt-Designer executable. | 6041 Private slot to start the Qt-Designer executable. |
5438 | 6042 |
5439 @param fn filename of the form to be opened | 6043 @param fn filename of the form to be opened |
5440 @type str | 6044 @type str |
5441 """ | 6045 """ |
5442 args = [] | 6046 args = [] |
5443 if fn is not None: | 6047 if fn is not None: |
5445 if os.path.isfile(fn) and os.path.getsize(fn): | 6049 if os.path.isfile(fn) and os.path.getsize(fn): |
5446 args.append(fn) | 6050 args.append(fn) |
5447 else: | 6051 else: |
5448 EricMessageBox.critical( | 6052 EricMessageBox.critical( |
5449 self, | 6053 self, |
5450 self.tr('Problem'), | 6054 self.tr("Problem"), |
5451 self.tr( | 6055 self.tr( |
5452 '<p>The file <b>{0}</b> does not exist or' | 6056 "<p>The file <b>{0}</b> does not exist or" |
5453 ' is zero length.</p>') | 6057 " is zero length.</p>" |
5454 .format(fn)) | 6058 ).format(fn), |
6059 ) | |
5455 return | 6060 return |
5456 except OSError: | 6061 except OSError: |
5457 EricMessageBox.critical( | 6062 EricMessageBox.critical( |
5458 self, | 6063 self, |
5459 self.tr('Problem'), | 6064 self.tr("Problem"), |
5460 self.tr( | 6065 self.tr( |
5461 '<p>The file <b>{0}</b> does not exist or' | 6066 "<p>The file <b>{0}</b> does not exist or" |
5462 ' is zero length.</p>') | 6067 " is zero length.</p>" |
5463 .format(fn)) | 6068 ).format(fn), |
6069 ) | |
5464 return | 6070 return |
5465 | 6071 |
5466 if Utilities.isMacPlatform(): | 6072 if Utilities.isMacPlatform(): |
5467 designer, args = Utilities.prepareQtMacBundle( | 6073 designer, args = Utilities.prepareQtMacBundle("designer", args) |
5468 "designer", args) | |
5469 else: | 6074 else: |
5470 designer = os.path.join( | 6075 designer = os.path.join( |
5471 Utilities.getQtBinariesPath(), | 6076 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("designer") |
5472 Utilities.generateQtToolName("designer")) | 6077 ) |
5473 if Utilities.isWindowsPlatform(): | 6078 if Utilities.isWindowsPlatform(): |
5474 designer += '.exe' | 6079 designer += ".exe" |
5475 | 6080 |
5476 if designer: | 6081 if designer: |
5477 proc = QProcess() | 6082 proc = QProcess() |
5478 if not proc.startDetached(designer, args): | 6083 if not proc.startDetached(designer, args): |
5479 EricMessageBox.critical( | 6084 EricMessageBox.critical( |
5480 self, | 6085 self, |
5481 self.tr('Process Generation Error'), | 6086 self.tr("Process Generation Error"), |
5482 self.tr( | 6087 self.tr( |
5483 '<p>Could not start Qt-Designer.<br>' | 6088 "<p>Could not start Qt-Designer.<br>" |
5484 'Ensure that it is available as <b>{0}</b>.</p>' | 6089 "Ensure that it is available as <b>{0}</b>.</p>" |
5485 ).format(designer) | 6090 ).format(designer), |
5486 ) | 6091 ) |
5487 else: | 6092 else: |
5488 EricMessageBox.critical( | 6093 EricMessageBox.critical( |
5489 self, | 6094 self, |
5490 self.tr('Process Generation Error'), | 6095 self.tr("Process Generation Error"), |
5491 self.tr( | 6096 self.tr( |
5492 '<p>Could not find the Qt-Designer executable.<br>' | 6097 "<p>Could not find the Qt-Designer executable.<br>" |
5493 'Ensure that it is installed and optionally configured on' | 6098 "Ensure that it is installed and optionally configured on" |
5494 ' the Qt configuration page.</p>' | 6099 " the Qt configuration page.</p>" |
5495 ) | 6100 ), |
5496 ) | 6101 ) |
5497 | 6102 |
5498 @pyqtSlot() | 6103 @pyqtSlot() |
5499 @pyqtSlot(str) | 6104 @pyqtSlot(str) |
5500 def __linguist(self, fn=None): | 6105 def __linguist(self, fn=None): |
5501 """ | 6106 """ |
5502 Private slot to start the Qt-Linguist executable. | 6107 Private slot to start the Qt-Linguist executable. |
5503 | 6108 |
5504 @param fn filename of the translation file to be opened | 6109 @param fn filename of the translation file to be opened |
5505 @type str | 6110 @type str |
5506 """ | 6111 """ |
5507 args = [] | 6112 args = [] |
5508 if fn is not None: | 6113 if fn is not None: |
5509 fn = fn.replace('.qm', '.ts') | 6114 fn = fn.replace(".qm", ".ts") |
5510 try: | 6115 try: |
5511 if ( | 6116 if os.path.isfile(fn) and os.path.getsize(fn) and fn not in args: |
5512 os.path.isfile(fn) and | |
5513 os.path.getsize(fn) and | |
5514 fn not in args | |
5515 ): | |
5516 args.append(fn) | 6117 args.append(fn) |
5517 else: | 6118 else: |
5518 EricMessageBox.critical( | 6119 EricMessageBox.critical( |
5519 self, | 6120 self, |
5520 self.tr('Problem'), | 6121 self.tr("Problem"), |
5521 self.tr( | 6122 self.tr( |
5522 '<p>The file <b>{0}</b> does not exist or' | 6123 "<p>The file <b>{0}</b> does not exist or" |
5523 ' is zero length.</p>') | 6124 " is zero length.</p>" |
5524 .format(fn)) | 6125 ).format(fn), |
6126 ) | |
5525 return | 6127 return |
5526 except OSError: | 6128 except OSError: |
5527 EricMessageBox.critical( | 6129 EricMessageBox.critical( |
5528 self, | 6130 self, |
5529 self.tr('Problem'), | 6131 self.tr("Problem"), |
5530 self.tr( | 6132 self.tr( |
5531 '<p>The file <b>{0}</b> does not exist or' | 6133 "<p>The file <b>{0}</b> does not exist or" |
5532 ' is zero length.</p>') | 6134 " is zero length.</p>" |
5533 .format(fn)) | 6135 ).format(fn), |
6136 ) | |
5534 return | 6137 return |
5535 | 6138 |
5536 if Utilities.isMacPlatform(): | 6139 if Utilities.isMacPlatform(): |
5537 linguist, args = Utilities.prepareQtMacBundle( | 6140 linguist, args = Utilities.prepareQtMacBundle("linguist", args) |
5538 "linguist", args) | |
5539 else: | 6141 else: |
5540 linguist = os.path.join( | 6142 linguist = os.path.join( |
5541 Utilities.getQtBinariesPath(), | 6143 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("linguist") |
5542 Utilities.generateQtToolName("linguist")) | 6144 ) |
5543 if Utilities.isWindowsPlatform(): | 6145 if Utilities.isWindowsPlatform(): |
5544 linguist += '.exe' | 6146 linguist += ".exe" |
5545 | 6147 |
5546 if linguist: | 6148 if linguist: |
5547 proc = QProcess() | 6149 proc = QProcess() |
5548 if not proc.startDetached(linguist, args): | 6150 if not proc.startDetached(linguist, args): |
5549 EricMessageBox.critical( | 6151 EricMessageBox.critical( |
5550 self, | 6152 self, |
5551 self.tr('Process Generation Error'), | 6153 self.tr("Process Generation Error"), |
5552 self.tr( | 6154 self.tr( |
5553 '<p>Could not start Qt-Linguist.<br>' | 6155 "<p>Could not start Qt-Linguist.<br>" |
5554 'Ensure that it is available as <b>{0}</b>.</p>' | 6156 "Ensure that it is available as <b>{0}</b>.</p>" |
5555 ).format(linguist) | 6157 ).format(linguist), |
5556 ) | 6158 ) |
5557 else: | 6159 else: |
5558 EricMessageBox.critical( | 6160 EricMessageBox.critical( |
5559 self, | 6161 self, |
5560 self.tr('Process Generation Error'), | 6162 self.tr("Process Generation Error"), |
5561 self.tr( | 6163 self.tr( |
5562 '<p>Could not find the Qt-Linguist executable.<br>' | 6164 "<p>Could not find the Qt-Linguist executable.<br>" |
5563 'Ensure that it is installed and optionally configured on' | 6165 "Ensure that it is installed and optionally configured on" |
5564 ' the Qt configuration page.</p>' | 6166 " the Qt configuration page.</p>" |
5565 ) | 6167 ), |
5566 ) | 6168 ) |
5567 | 6169 |
5568 def __assistant(self, home=None): | 6170 def __assistant(self, home=None): |
5569 """ | 6171 """ |
5570 Private slot to start the Qt-Assistant executable. | 6172 Private slot to start the Qt-Assistant executable. |
5571 | 6173 |
5572 @param home full pathname of a file to display | 6174 @param home full pathname of a file to display |
5573 @type str | 6175 @type str |
5574 """ | 6176 """ |
5575 args = [] | 6177 args = [] |
5576 if home: | 6178 if home: |
5577 args.append('-showUrl') | 6179 args.append("-showUrl") |
5578 args.append(home) | 6180 args.append(home) |
5579 | 6181 |
5580 if Utilities.isMacPlatform(): | 6182 if Utilities.isMacPlatform(): |
5581 assistant, args = Utilities.prepareQtMacBundle( | 6183 assistant, args = Utilities.prepareQtMacBundle("assistant", args) |
5582 "assistant", args) | |
5583 else: | 6184 else: |
5584 assistant = os.path.join( | 6185 assistant = os.path.join( |
5585 Utilities.getQtBinariesPath(), | 6186 Utilities.getQtBinariesPath(), Utilities.generateQtToolName("assistant") |
5586 Utilities.generateQtToolName("assistant")) | 6187 ) |
5587 if Utilities.isWindowsPlatform(): | 6188 if Utilities.isWindowsPlatform(): |
5588 assistant += '.exe' | 6189 assistant += ".exe" |
5589 | 6190 |
5590 if assistant: | 6191 if assistant: |
5591 proc = QProcess() | 6192 proc = QProcess() |
5592 if not proc.startDetached(assistant, args): | 6193 if not proc.startDetached(assistant, args): |
5593 EricMessageBox.critical( | 6194 EricMessageBox.critical( |
5594 self, | 6195 self, |
5595 self.tr('Process Generation Error'), | 6196 self.tr("Process Generation Error"), |
5596 self.tr( | 6197 self.tr( |
5597 '<p>Could not start Qt-Assistant.<br>' | 6198 "<p>Could not start Qt-Assistant.<br>" |
5598 'Ensure that it is available as <b>{0}</b>.</p>' | 6199 "Ensure that it is available as <b>{0}</b>.</p>" |
5599 ).format(assistant) | 6200 ).format(assistant), |
5600 ) | 6201 ) |
5601 else: | 6202 else: |
5602 EricMessageBox.critical( | 6203 EricMessageBox.critical( |
5603 self, | 6204 self, |
5604 self.tr('Process Generation Error'), | 6205 self.tr("Process Generation Error"), |
5605 self.tr( | 6206 self.tr( |
5606 '<p>Could not find the Qt-Assistant executable.<br>' | 6207 "<p>Could not find the Qt-Assistant executable.<br>" |
5607 'Ensure that it is installed and optionally configured on' | 6208 "Ensure that it is installed and optionally configured on" |
5608 ' the Qt configuration page.</p>' | 6209 " the Qt configuration page.</p>" |
5609 ) | 6210 ), |
5610 ) | 6211 ) |
5611 | 6212 |
5612 def __startWebBrowser(self): | 6213 def __startWebBrowser(self): |
5613 """ | 6214 """ |
5614 Private slot to start the eric web browser. | 6215 Private slot to start the eric web browser. |
5615 """ | 6216 """ |
5616 self.launchHelpViewer("") | 6217 self.launchHelpViewer("") |
5617 | 6218 |
5618 def __customViewer(self, home=None): | 6219 def __customViewer(self, home=None): |
5619 """ | 6220 """ |
5620 Private slot to start a custom viewer. | 6221 Private slot to start a custom viewer. |
5621 | 6222 |
5622 @param home full pathname of a file to display (string) | 6223 @param home full pathname of a file to display (string) |
5623 """ | 6224 """ |
5624 customViewer = Preferences.getHelp("CustomViewer") | 6225 customViewer = Preferences.getHelp("CustomViewer") |
5625 if not customViewer: | 6226 if not customViewer: |
5626 EricMessageBox.information( | 6227 EricMessageBox.information( |
5627 self, | 6228 self, |
5628 self.tr("Help"), | 6229 self.tr("Help"), |
5629 self.tr( | 6230 self.tr( |
5630 """Currently no custom viewer is selected.""" | 6231 """Currently no custom viewer is selected.""" |
5631 """ Please use the preferences dialog to specify one.""")) | 6232 """ Please use the preferences dialog to specify one.""" |
6233 ), | |
6234 ) | |
5632 return | 6235 return |
5633 | 6236 |
5634 proc = QProcess() | 6237 proc = QProcess() |
5635 args = [] | 6238 args = [] |
5636 if home: | 6239 if home: |
5637 args.append(home) | 6240 args.append(home) |
5638 | 6241 |
5639 if not proc.startDetached(customViewer, args): | 6242 if not proc.startDetached(customViewer, args): |
5640 EricMessageBox.critical( | 6243 EricMessageBox.critical( |
5641 self, | 6244 self, |
5642 self.tr('Process Generation Error'), | 6245 self.tr("Process Generation Error"), |
5643 self.tr( | 6246 self.tr( |
5644 '<p>Could not start custom viewer.<br>' | 6247 "<p>Could not start custom viewer.<br>" |
5645 'Ensure that it is available as <b>{0}</b>.</p>' | 6248 "Ensure that it is available as <b>{0}</b>.</p>" |
5646 ).format(customViewer)) | 6249 ).format(customViewer), |
5647 | 6250 ) |
6251 | |
5648 def __chmViewer(self, home=None): | 6252 def __chmViewer(self, home=None): |
5649 """ | 6253 """ |
5650 Private slot to start the win help viewer to show *.chm files. | 6254 Private slot to start the win help viewer to show *.chm files. |
5651 | 6255 |
5652 @param home full pathname of a file to display (string) | 6256 @param home full pathname of a file to display (string) |
5653 """ | 6257 """ |
5654 if home: | 6258 if home: |
5655 proc = QProcess() | 6259 proc = QProcess() |
5656 args = [] | 6260 args = [] |
5657 args.append(home) | 6261 args.append(home) |
5658 | 6262 |
5659 if not proc.startDetached("hh", args): | 6263 if not proc.startDetached("hh", args): |
5660 EricMessageBox.critical( | 6264 EricMessageBox.critical( |
5661 self, | 6265 self, |
5662 self.tr('Process Generation Error'), | 6266 self.tr("Process Generation Error"), |
5663 self.tr( | 6267 self.tr( |
5664 '<p>Could not start the help viewer.<br>' | 6268 "<p>Could not start the help viewer.<br>" |
5665 'Ensure that it is available as <b>hh</b>.</p>' | 6269 "Ensure that it is available as <b>hh</b>.</p>" |
5666 )) | 6270 ), |
5667 | 6271 ) |
6272 | |
5668 @pyqtSlot() | 6273 @pyqtSlot() |
5669 @pyqtSlot(str) | 6274 @pyqtSlot(str) |
5670 def __UIPreviewer(self, fn=None): | 6275 def __UIPreviewer(self, fn=None): |
5671 """ | 6276 """ |
5672 Private slot to start the UI Previewer executable. | 6277 Private slot to start the UI Previewer executable. |
5673 | 6278 |
5674 @param fn filename of the form to be previewed (string) | 6279 @param fn filename of the form to be previewed (string) |
5675 """ | 6280 """ |
5676 proc = QProcess() | 6281 proc = QProcess() |
5677 | 6282 |
5678 viewer = os.path.join(getConfig("ericDir"), "eric7_uipreviewer.py") | 6283 viewer = os.path.join(getConfig("ericDir"), "eric7_uipreviewer.py") |
5679 | 6284 |
5680 args = [] | 6285 args = [] |
5681 args.append(viewer) | 6286 args.append(viewer) |
5682 | 6287 |
5683 if fn is not None: | 6288 if fn is not None: |
5684 try: | 6289 try: |
5685 if os.path.isfile(fn) and os.path.getsize(fn): | 6290 if os.path.isfile(fn) and os.path.getsize(fn): |
5686 args.append(fn) | 6291 args.append(fn) |
5687 else: | 6292 else: |
5688 EricMessageBox.critical( | 6293 EricMessageBox.critical( |
5689 self, | 6294 self, |
5690 self.tr('Problem'), | 6295 self.tr("Problem"), |
5691 self.tr( | 6296 self.tr( |
5692 '<p>The file <b>{0}</b> does not exist or' | 6297 "<p>The file <b>{0}</b> does not exist or" |
5693 ' is zero length.</p>') | 6298 " is zero length.</p>" |
5694 .format(fn)) | 6299 ).format(fn), |
6300 ) | |
5695 return | 6301 return |
5696 except OSError: | 6302 except OSError: |
5697 EricMessageBox.critical( | 6303 EricMessageBox.critical( |
5698 self, | 6304 self, |
5699 self.tr('Problem'), | 6305 self.tr("Problem"), |
5700 self.tr( | 6306 self.tr( |
5701 '<p>The file <b>{0}</b> does not exist or' | 6307 "<p>The file <b>{0}</b> does not exist or" |
5702 ' is zero length.</p>') | 6308 " is zero length.</p>" |
5703 .format(fn)) | 6309 ).format(fn), |
6310 ) | |
5704 return | 6311 return |
5705 | 6312 |
5706 if ( | 6313 if not os.path.isfile(viewer) or not proc.startDetached( |
5707 not os.path.isfile(viewer) or | 6314 Globals.getPythonExecutable(), args |
5708 not proc.startDetached(Globals.getPythonExecutable(), args) | |
5709 ): | 6315 ): |
5710 EricMessageBox.critical( | 6316 EricMessageBox.critical( |
5711 self, | 6317 self, |
5712 self.tr('Process Generation Error'), | 6318 self.tr("Process Generation Error"), |
5713 self.tr( | 6319 self.tr( |
5714 '<p>Could not start UI Previewer.<br>' | 6320 "<p>Could not start UI Previewer.<br>" |
5715 'Ensure that it is available as <b>{0}</b>.</p>' | 6321 "Ensure that it is available as <b>{0}</b>.</p>" |
5716 ).format(viewer)) | 6322 ).format(viewer), |
5717 | 6323 ) |
6324 | |
5718 @pyqtSlot() | 6325 @pyqtSlot() |
5719 @pyqtSlot(list) | 6326 @pyqtSlot(list) |
5720 @pyqtSlot(list, bool) | 6327 @pyqtSlot(list, bool) |
5721 def __TRPreviewer(self, fileNames=None, ignore=False): | 6328 def __TRPreviewer(self, fileNames=None, ignore=False): |
5722 """ | 6329 """ |
5723 Private slot to start the Translation Previewer executable. | 6330 Private slot to start the Translation Previewer executable. |
5724 | 6331 |
5725 @param fileNames filenames of forms and/or translations to be previewed | 6332 @param fileNames filenames of forms and/or translations to be previewed |
5726 (list of strings) | 6333 (list of strings) |
5727 @param ignore flag indicating non existing files should be ignored | 6334 @param ignore flag indicating non existing files should be ignored |
5728 (boolean) | 6335 (boolean) |
5729 """ | 6336 """ |
5730 proc = QProcess() | 6337 proc = QProcess() |
5731 | 6338 |
5732 viewer = os.path.join(getConfig("ericDir"), "eric7_trpreviewer.py") | 6339 viewer = os.path.join(getConfig("ericDir"), "eric7_trpreviewer.py") |
5733 | 6340 |
5734 args = [] | 6341 args = [] |
5735 args.append(viewer) | 6342 args.append(viewer) |
5736 | 6343 |
5737 if fileNames is not None: | 6344 if fileNames is not None: |
5738 for fn in fileNames: | 6345 for fn in fileNames: |
5739 try: | 6346 try: |
5740 if os.path.isfile(fn) and os.path.getsize(fn): | 6347 if os.path.isfile(fn) and os.path.getsize(fn): |
5741 args.append(fn) | 6348 args.append(fn) |
5742 else: | 6349 else: |
5743 if not ignore: | 6350 if not ignore: |
5744 EricMessageBox.critical( | 6351 EricMessageBox.critical( |
5745 self, | 6352 self, |
5746 self.tr('Problem'), | 6353 self.tr("Problem"), |
5747 self.tr( | 6354 self.tr( |
5748 '<p>The file <b>{0}</b> does not exist or' | 6355 "<p>The file <b>{0}</b> does not exist or" |
5749 ' is zero length.</p>') | 6356 " is zero length.</p>" |
5750 .format(fn)) | 6357 ).format(fn), |
6358 ) | |
5751 return | 6359 return |
5752 except OSError: | 6360 except OSError: |
5753 if not ignore: | 6361 if not ignore: |
5754 EricMessageBox.critical( | 6362 EricMessageBox.critical( |
5755 self, | 6363 self, |
5756 self.tr('Problem'), | 6364 self.tr("Problem"), |
5757 self.tr( | 6365 self.tr( |
5758 '<p>The file <b>{0}</b> does not exist or' | 6366 "<p>The file <b>{0}</b> does not exist or" |
5759 ' is zero length.</p>') | 6367 " is zero length.</p>" |
5760 .format(fn)) | 6368 ).format(fn), |
6369 ) | |
5761 return | 6370 return |
5762 | 6371 |
5763 if ( | 6372 if not os.path.isfile(viewer) or not proc.startDetached( |
5764 not os.path.isfile(viewer) or | 6373 Globals.getPythonExecutable(), args |
5765 not proc.startDetached(Globals.getPythonExecutable(), args) | |
5766 ): | 6374 ): |
5767 EricMessageBox.critical( | 6375 EricMessageBox.critical( |
5768 self, | 6376 self, |
5769 self.tr('Process Generation Error'), | 6377 self.tr("Process Generation Error"), |
5770 self.tr( | 6378 self.tr( |
5771 '<p>Could not start Translation Previewer.<br>' | 6379 "<p>Could not start Translation Previewer.<br>" |
5772 'Ensure that it is available as <b>{0}</b>.</p>' | 6380 "Ensure that it is available as <b>{0}</b>.</p>" |
5773 ).format(viewer)) | 6381 ).format(viewer), |
5774 | 6382 ) |
6383 | |
5775 def __sqlBrowser(self): | 6384 def __sqlBrowser(self): |
5776 """ | 6385 """ |
5777 Private slot to start the SQL browser tool. | 6386 Private slot to start the SQL browser tool. |
5778 """ | 6387 """ |
5779 proc = QProcess() | 6388 proc = QProcess() |
5780 | 6389 |
5781 browser = os.path.join(getConfig("ericDir"), "eric7_sqlbrowser.py") | 6390 browser = os.path.join(getConfig("ericDir"), "eric7_sqlbrowser.py") |
5782 | 6391 |
5783 args = [] | 6392 args = [] |
5784 args.append(browser) | 6393 args.append(browser) |
5785 | 6394 |
5786 if ( | 6395 if not os.path.isfile(browser) or not proc.startDetached( |
5787 not os.path.isfile(browser) or | 6396 Globals.getPythonExecutable(), args |
5788 not proc.startDetached(Globals.getPythonExecutable(), args) | |
5789 ): | 6397 ): |
5790 EricMessageBox.critical( | 6398 EricMessageBox.critical( |
5791 self, | 6399 self, |
5792 self.tr('Process Generation Error'), | 6400 self.tr("Process Generation Error"), |
5793 self.tr( | 6401 self.tr( |
5794 '<p>Could not start SQL Browser.<br>' | 6402 "<p>Could not start SQL Browser.<br>" |
5795 'Ensure that it is available as <b>{0}</b>.</p>' | 6403 "Ensure that it is available as <b>{0}</b>.</p>" |
5796 ).format(browser)) | 6404 ).format(browser), |
5797 | 6405 ) |
6406 | |
5798 @pyqtSlot() | 6407 @pyqtSlot() |
5799 @pyqtSlot(str) | 6408 @pyqtSlot(str) |
5800 def __openHexEditor(self, fn=""): | 6409 def __openHexEditor(self, fn=""): |
5801 """ | 6410 """ |
5802 Private slot to open the hex editor window. | 6411 Private slot to open the hex editor window. |
5803 | 6412 |
5804 @param fn filename of the file to show (string) | 6413 @param fn filename of the file to show (string) |
5805 """ | 6414 """ |
5806 from HexEdit.HexEditMainWindow import HexEditMainWindow | 6415 from HexEdit.HexEditMainWindow import HexEditMainWindow |
6416 | |
5807 dlg = HexEditMainWindow(fn, self, fromEric=True, project=self.project) | 6417 dlg = HexEditMainWindow(fn, self, fromEric=True, project=self.project) |
5808 dlg.show() | 6418 dlg.show() |
5809 | 6419 |
5810 @pyqtSlot() | 6420 @pyqtSlot() |
5811 @pyqtSlot(str) | 6421 @pyqtSlot(str) |
5812 def __editPixmap(self, fn=""): | 6422 def __editPixmap(self, fn=""): |
5813 """ | 6423 """ |
5814 Private slot to show a pixmap in a dialog. | 6424 Private slot to show a pixmap in a dialog. |
5815 | 6425 |
5816 @param fn filename of the file to show (string) | 6426 @param fn filename of the file to show (string) |
5817 """ | 6427 """ |
5818 from IconEditor.IconEditorWindow import IconEditorWindow | 6428 from IconEditor.IconEditorWindow import IconEditorWindow |
6429 | |
5819 dlg = IconEditorWindow(fn, self, fromEric=True, project=self.project) | 6430 dlg = IconEditorWindow(fn, self, fromEric=True, project=self.project) |
5820 dlg.show() | 6431 dlg.show() |
5821 | 6432 |
5822 @pyqtSlot() | 6433 @pyqtSlot() |
5823 @pyqtSlot(str) | 6434 @pyqtSlot(str) |
5824 def __showPixmap(self, fn): | 6435 def __showPixmap(self, fn): |
5825 """ | 6436 """ |
5826 Private slot to show a pixmap in a dialog. | 6437 Private slot to show a pixmap in a dialog. |
5827 | 6438 |
5828 @param fn filename of the file to show (string) | 6439 @param fn filename of the file to show (string) |
5829 """ | 6440 """ |
5830 from Graphics.PixmapDiagram import PixmapDiagram | 6441 from Graphics.PixmapDiagram import PixmapDiagram |
6442 | |
5831 dlg = PixmapDiagram(fn, self) | 6443 dlg = PixmapDiagram(fn, self) |
5832 if dlg.getStatus(): | 6444 if dlg.getStatus(): |
5833 dlg.show() | 6445 dlg.show() |
5834 | 6446 |
5835 @pyqtSlot() | 6447 @pyqtSlot() |
5836 @pyqtSlot(str) | 6448 @pyqtSlot(str) |
5837 def __showSvg(self, fn): | 6449 def __showSvg(self, fn): |
5838 """ | 6450 """ |
5839 Private slot to show a SVG file in a dialog. | 6451 Private slot to show a SVG file in a dialog. |
5840 | 6452 |
5841 @param fn filename of the file to show (string) | 6453 @param fn filename of the file to show (string) |
5842 """ | 6454 """ |
5843 from Graphics.SvgDiagram import SvgDiagram | 6455 from Graphics.SvgDiagram import SvgDiagram |
6456 | |
5844 dlg = SvgDiagram(fn, self) | 6457 dlg = SvgDiagram(fn, self) |
5845 dlg.show() | 6458 dlg.show() |
5846 | 6459 |
5847 @pyqtSlot(str) | 6460 @pyqtSlot(str) |
5848 def __showUml(self, fn): | 6461 def __showUml(self, fn): |
5849 """ | 6462 """ |
5850 Private slot to show an eric graphics file in a dialog. | 6463 Private slot to show an eric graphics file in a dialog. |
5851 | 6464 |
5852 @param fn name of the file to be shown | 6465 @param fn name of the file to be shown |
5853 @type str | 6466 @type str |
5854 """ | 6467 """ |
5855 from Graphics.UMLDialog import UMLDialog, UMLDialogType | 6468 from Graphics.UMLDialog import UMLDialog, UMLDialogType |
6469 | |
5856 dlg = UMLDialog(UMLDialogType.NO_DIAGRAM, self.project, parent=self) | 6470 dlg = UMLDialog(UMLDialogType.NO_DIAGRAM, self.project, parent=self) |
5857 if dlg.load(fn): | 6471 if dlg.load(fn): |
5858 dlg.show(fromFile=True) | 6472 dlg.show(fromFile=True) |
5859 | 6473 |
5860 def __snapshot(self): | 6474 def __snapshot(self): |
5861 """ | 6475 """ |
5862 Private slot to start the snapshot tool. | 6476 Private slot to start the snapshot tool. |
5863 """ | 6477 """ |
5864 proc = QProcess() | 6478 proc = QProcess() |
5865 | 6479 |
5866 snap = os.path.join(getConfig("ericDir"), "eric7_snap.py") | 6480 snap = os.path.join(getConfig("ericDir"), "eric7_snap.py") |
5867 | 6481 |
5868 args = [] | 6482 args = [] |
5869 args.append(snap) | 6483 args.append(snap) |
5870 | 6484 |
5871 if ( | 6485 if not os.path.isfile(snap) or not proc.startDetached( |
5872 not os.path.isfile(snap) or | 6486 Globals.getPythonExecutable(), args |
5873 not proc.startDetached(Globals.getPythonExecutable(), args) | |
5874 ): | 6487 ): |
5875 EricMessageBox.critical( | 6488 EricMessageBox.critical( |
5876 self, | 6489 self, |
5877 self.tr('Process Generation Error'), | 6490 self.tr("Process Generation Error"), |
5878 self.tr( | 6491 self.tr( |
5879 '<p>Could not start Snapshot tool.<br>' | 6492 "<p>Could not start Snapshot tool.<br>" |
5880 'Ensure that it is available as <b>{0}</b>.</p>' | 6493 "Ensure that it is available as <b>{0}</b>.</p>" |
5881 ).format(snap)) | 6494 ).format(snap), |
5882 | 6495 ) |
6496 | |
5883 def __toolActionTriggered(self, act): | 6497 def __toolActionTriggered(self, act): |
5884 """ | 6498 """ |
5885 Private slot called by external tools toolbar actions. | 6499 Private slot called by external tools toolbar actions. |
5886 | 6500 |
5887 @param act reference to the action that triggered the slot | 6501 @param act reference to the action that triggered the slot |
5888 @type QAction | 6502 @type QAction |
5889 """ | 6503 """ |
5890 toolGroupName, toolMenuText = act.objectName().split('@@', 1) | 6504 toolGroupName, toolMenuText = act.objectName().split("@@", 1) |
5891 for toolGroup in self.toolGroups: | 6505 for toolGroup in self.toolGroups: |
5892 if toolGroup[0] == toolGroupName: | 6506 if toolGroup[0] == toolGroupName: |
5893 for tool in toolGroup[1]: | 6507 for tool in toolGroup[1]: |
5894 if tool['menutext'] == toolMenuText: | 6508 if tool["menutext"] == toolMenuText: |
5895 self.__startToolProcess(tool) | 6509 self.__startToolProcess(tool) |
5896 return | 6510 return |
5897 | 6511 |
5898 EricMessageBox.information( | 6512 EricMessageBox.information( |
5899 self, | 6513 self, |
5900 self.tr("External Tools"), | 6514 self.tr("External Tools"), |
5901 self.tr( | 6515 self.tr( |
5902 """No tool entry found for external tool '{0}' """ | 6516 """No tool entry found for external tool '{0}' """ |
5903 """in tool group '{1}'.""") | 6517 """in tool group '{1}'.""" |
5904 .format(toolMenuText, toolGroupName)) | 6518 ).format(toolMenuText, toolGroupName), |
6519 ) | |
5905 return | 6520 return |
5906 | 6521 |
5907 EricMessageBox.information( | 6522 EricMessageBox.information( |
5908 self, | 6523 self, |
5909 self.tr("External Tools"), | 6524 self.tr("External Tools"), |
5910 self.tr("""No toolgroup entry '{0}' found.""") | 6525 self.tr("""No toolgroup entry '{0}' found.""").format(toolGroupName), |
5911 .format(toolGroupName) | 6526 ) |
5912 ) | 6527 |
5913 | |
5914 def __toolExecute(self, act): | 6528 def __toolExecute(self, act): |
5915 """ | 6529 """ |
5916 Private slot to execute a particular tool. | 6530 Private slot to execute a particular tool. |
5917 | 6531 |
5918 @param act reference to the action that was triggered (QAction) | 6532 @param act reference to the action that was triggered (QAction) |
5919 """ | 6533 """ |
5920 if self.toolGroupsMenuTriggered: | 6534 if self.toolGroupsMenuTriggered: |
5921 # ignore actions triggered from the select tool group submenu | 6535 # ignore actions triggered from the select tool group submenu |
5922 self.toolGroupsMenuTriggered = False | 6536 self.toolGroupsMenuTriggered = False |
5923 return | 6537 return |
5924 | 6538 |
5925 if self.currentToolGroup < 0: | 6539 if self.currentToolGroup < 0: |
5926 # it was an action not to be handled here | 6540 # it was an action not to be handled here |
5927 return | 6541 return |
5928 | 6542 |
5929 idx = act.data() | 6543 idx = act.data() |
5930 if idx is not None and idx >= 0: | 6544 if idx is not None and idx >= 0: |
5931 tool = self.toolGroups[self.currentToolGroup][1][idx] | 6545 tool = self.toolGroups[self.currentToolGroup][1][idx] |
5932 self.__startToolProcess(tool) | 6546 self.__startToolProcess(tool) |
5933 | 6547 |
5934 def __startToolProcess(self, tool): | 6548 def __startToolProcess(self, tool): |
5935 """ | 6549 """ |
5936 Private slot to start an external tool process. | 6550 Private slot to start an external tool process. |
5937 | 6551 |
5938 @param tool list of tool entries | 6552 @param tool list of tool entries |
5939 """ | 6553 """ |
5940 proc = QProcess() | 6554 proc = QProcess() |
5941 procData = (None,) | 6555 procData = (None,) |
5942 program = tool['executable'] | 6556 program = tool["executable"] |
5943 args = [] | 6557 args = [] |
5944 argv = Utilities.parseOptionString(tool['arguments']) | 6558 argv = Utilities.parseOptionString(tool["arguments"]) |
5945 args.extend(argv) | 6559 args.extend(argv) |
5946 t = self.tr("Starting process '{0} {1}'.\n" | 6560 t = self.tr("Starting process '{0} {1}'.\n").format(program, tool["arguments"]) |
5947 ).format(program, tool['arguments']) | |
5948 self.appendToStdout(t) | 6561 self.appendToStdout(t) |
5949 | 6562 |
5950 proc.finished.connect(self.__toolFinished) | 6563 proc.finished.connect(self.__toolFinished) |
5951 if tool['redirect'] != 'no': | 6564 if tool["redirect"] != "no": |
5952 proc.readyReadStandardOutput.connect(self.__processToolStdout) | 6565 proc.readyReadStandardOutput.connect(self.__processToolStdout) |
5953 proc.readyReadStandardError.connect(self.__processToolStderr) | 6566 proc.readyReadStandardError.connect(self.__processToolStderr) |
5954 if tool['redirect'] in ["insert", "replaceSelection"]: | 6567 if tool["redirect"] in ["insert", "replaceSelection"]: |
5955 aw = self.viewmanager.activeWindow() | 6568 aw = self.viewmanager.activeWindow() |
5956 procData = (aw, tool['redirect'], []) | 6569 procData = (aw, tool["redirect"], []) |
5957 if aw is not None: | 6570 if aw is not None: |
5958 aw.beginUndoAction() | 6571 aw.beginUndoAction() |
5959 | 6572 |
5960 proc.start(program, args) | 6573 proc.start(program, args) |
5961 if not proc.waitForStarted(): | 6574 if not proc.waitForStarted(): |
5962 EricMessageBox.critical( | 6575 EricMessageBox.critical( |
5963 self, | 6576 self, |
5964 self.tr('Process Generation Error'), | 6577 self.tr("Process Generation Error"), |
5965 self.tr( | 6578 self.tr( |
5966 '<p>Could not start the tool entry <b>{0}</b>.<br>' | 6579 "<p>Could not start the tool entry <b>{0}</b>.<br>" |
5967 'Ensure that it is available as <b>{1}</b>.</p>') | 6580 "Ensure that it is available as <b>{1}</b>.</p>" |
5968 .format(tool['menutext'], tool['executable'])) | 6581 ).format(tool["menutext"], tool["executable"]), |
6582 ) | |
5969 else: | 6583 else: |
5970 self.toolProcs.append((program, proc, procData)) | 6584 self.toolProcs.append((program, proc, procData)) |
5971 if tool['redirect'] == 'no': | 6585 if tool["redirect"] == "no": |
5972 proc.closeReadChannel(QProcess.ProcessChannel.StandardOutput) | 6586 proc.closeReadChannel(QProcess.ProcessChannel.StandardOutput) |
5973 proc.closeReadChannel(QProcess.ProcessChannel.StandardError) | 6587 proc.closeReadChannel(QProcess.ProcessChannel.StandardError) |
5974 proc.closeWriteChannel() | 6588 proc.closeWriteChannel() |
5975 | 6589 |
5976 def __processToolStdout(self): | 6590 def __processToolStdout(self): |
5977 """ | 6591 """ |
5978 Private slot to handle the readyReadStdout signal of a tool process. | 6592 Private slot to handle the readyReadStdout signal of a tool process. |
5979 """ | 6593 """ |
5980 ioEncoding = Preferences.getSystem("IOEncoding") | 6594 ioEncoding = Preferences.getSystem("IOEncoding") |
5981 | 6595 |
5982 # loop through all running tool processes | 6596 # loop through all running tool processes |
5983 for program, toolProc, toolProcData in self.toolProcs: | 6597 for program, toolProc, toolProcData in self.toolProcs: |
5984 toolProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) | 6598 toolProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
5985 | 6599 |
5986 if ( | 6600 if toolProcData[0] is None or toolProcData[1] not in [ |
5987 toolProcData[0] is None or | 6601 "insert", |
5988 toolProcData[1] not in ["insert", "replaceSelection"] | 6602 "replaceSelection", |
5989 ): | 6603 ]: |
5990 # not connected to an editor or wrong mode | 6604 # not connected to an editor or wrong mode |
5991 while toolProc.canReadLine(): | 6605 while toolProc.canReadLine(): |
5992 output = str(toolProc.readLine(), ioEncoding, 'replace') | 6606 output = str(toolProc.readLine(), ioEncoding, "replace") |
5993 s = "{0} - {1}".format(program, output) | 6607 s = "{0} - {1}".format(program, output) |
5994 self.appendToStdout(s) | 6608 self.appendToStdout(s) |
5995 else: | 6609 else: |
5996 if toolProcData[1] == "insert": | 6610 if toolProcData[1] == "insert": |
5997 text = str(toolProc.readAll(), ioEncoding, 'replace') | 6611 text = str(toolProc.readAll(), ioEncoding, "replace") |
5998 toolProcData[0].insert(text) | 6612 toolProcData[0].insert(text) |
5999 elif toolProcData[1] == "replaceSelection": | 6613 elif toolProcData[1] == "replaceSelection": |
6000 text = str(toolProc.readAll(), ioEncoding, 'replace') | 6614 text = str(toolProc.readAll(), ioEncoding, "replace") |
6001 toolProcData[2].append(text) | 6615 toolProcData[2].append(text) |
6002 | 6616 |
6003 def __processToolStderr(self): | 6617 def __processToolStderr(self): |
6004 """ | 6618 """ |
6005 Private slot to handle the readyReadStderr signal of a tool process. | 6619 Private slot to handle the readyReadStderr signal of a tool process. |
6006 """ | 6620 """ |
6007 ioEncoding = Preferences.getSystem("IOEncoding") | 6621 ioEncoding = Preferences.getSystem("IOEncoding") |
6008 | 6622 |
6009 # loop through all running tool processes | 6623 # loop through all running tool processes |
6010 for program, toolProc, _toolProcData in self.toolProcs: | 6624 for program, toolProc, _toolProcData in self.toolProcs: |
6011 toolProc.setReadChannel(QProcess.ProcessChannel.StandardError) | 6625 toolProc.setReadChannel(QProcess.ProcessChannel.StandardError) |
6012 | 6626 |
6013 while toolProc.canReadLine(): | 6627 while toolProc.canReadLine(): |
6014 error = str(toolProc.readLine(), ioEncoding, 'replace') | 6628 error = str(toolProc.readLine(), ioEncoding, "replace") |
6015 s = "{0} - {1}".format(program, error) | 6629 s = "{0} - {1}".format(program, error) |
6016 self.appendToStderr(s) | 6630 self.appendToStderr(s) |
6017 | 6631 |
6018 def __toolFinished(self, exitCode, exitStatus): | 6632 def __toolFinished(self, exitCode, exitStatus): |
6019 """ | 6633 """ |
6020 Private slot to handle the finished signal of a tool process. | 6634 Private slot to handle the finished signal of a tool process. |
6021 | 6635 |
6022 @param exitCode exit code of the process (integer) | 6636 @param exitCode exit code of the process (integer) |
6023 @param exitStatus exit status of the process (QProcess.ExitStatus) | 6637 @param exitStatus exit status of the process (QProcess.ExitStatus) |
6024 """ | 6638 """ |
6025 exitedProcs = [] | 6639 exitedProcs = [] |
6026 | 6640 |
6027 # loop through all running tool processes | 6641 # loop through all running tool processes |
6028 for program, toolProc, toolProcData in self.toolProcs: | 6642 for program, toolProc, toolProcData in self.toolProcs: |
6029 if toolProc.state() == QProcess.ProcessState.NotRunning: | 6643 if toolProc.state() == QProcess.ProcessState.NotRunning: |
6030 exitedProcs.append((program, toolProc, toolProcData)) | 6644 exitedProcs.append((program, toolProc, toolProcData)) |
6031 if toolProcData[0] is not None: | 6645 if toolProcData[0] is not None: |
6032 if toolProcData[1] == "replaceSelection": | 6646 if toolProcData[1] == "replaceSelection": |
6033 text = ''.join(toolProcData[2]) | 6647 text = "".join(toolProcData[2]) |
6034 toolProcData[0].replace(text) | 6648 toolProcData[0].replace(text) |
6035 toolProcData[0].endUndoAction() | 6649 toolProcData[0].endUndoAction() |
6036 | 6650 |
6037 # now delete the exited procs from the list of running processes | 6651 # now delete the exited procs from the list of running processes |
6038 for proc in exitedProcs: | 6652 for proc in exitedProcs: |
6039 self.toolProcs.remove(proc) | 6653 self.toolProcs.remove(proc) |
6040 t = self.tr("Process '{0}' has exited.\n").format(proc[0]) | 6654 t = self.tr("Process '{0}' has exited.\n").format(proc[0]) |
6041 self.appendToStdout(t) | 6655 self.appendToStdout(t) |
6042 | 6656 |
6043 def __showPythonDoc(self): | 6657 def __showPythonDoc(self): |
6044 """ | 6658 """ |
6045 Private slot to show the Python 3 documentation. | 6659 Private slot to show the Python 3 documentation. |
6046 """ | 6660 """ |
6047 pythonDocDir = Preferences.getHelp("PythonDocDir") | 6661 pythonDocDir = Preferences.getHelp("PythonDocDir") |
6048 if not pythonDocDir: | 6662 if not pythonDocDir: |
6049 if Utilities.isWindowsPlatform(): | 6663 if Utilities.isWindowsPlatform(): |
6050 venvName = Preferences.getDebugger("Python3VirtualEnv") | 6664 venvName = Preferences.getDebugger("Python3VirtualEnv") |
6051 interpreter = ( | 6665 interpreter = ( |
6052 ericApp().getObject("VirtualEnvManager") | 6666 ericApp() |
6667 .getObject("VirtualEnvManager") | |
6053 .getVirtualenvInterpreter(venvName) | 6668 .getVirtualenvInterpreter(venvName) |
6054 ) | 6669 ) |
6055 if interpreter: | 6670 if interpreter: |
6056 default = os.path.join(os.path.dirname(interpreter), "doc") | 6671 default = os.path.join(os.path.dirname(interpreter), "doc") |
6057 else: | 6672 else: |
6058 default = "" | 6673 default = "" |
6059 pythonDocDir = Utilities.getEnvironmentEntry( | 6674 pythonDocDir = Utilities.getEnvironmentEntry("PYTHON3DOCDIR", default) |
6060 "PYTHON3DOCDIR", default) | |
6061 else: | 6675 else: |
6062 pythonDocDir = Utilities.getEnvironmentEntry( | 6676 pythonDocDir = Utilities.getEnvironmentEntry( |
6063 "PYTHON3DOCDIR", | 6677 "PYTHON3DOCDIR", "/usr/share/doc/packages/python3/html" |
6064 '/usr/share/doc/packages/python3/html') | 6678 ) |
6065 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): | 6679 if not pythonDocDir.startswith(("http://", "https://", "qthelp://")): |
6066 if pythonDocDir.startswith("file://"): | 6680 if pythonDocDir.startswith("file://"): |
6067 pythonDocDir = pythonDocDir[7:] | 6681 pythonDocDir = pythonDocDir[7:] |
6068 if not os.path.splitext(pythonDocDir)[1]: | 6682 if not os.path.splitext(pythonDocDir)[1]: |
6069 home = Utilities.normjoinpath(pythonDocDir, 'index.html') | 6683 home = Utilities.normjoinpath(pythonDocDir, "index.html") |
6070 | 6684 |
6071 if Utilities.isWindowsPlatform() and not os.path.exists(home): | 6685 if Utilities.isWindowsPlatform() and not os.path.exists(home): |
6072 pyversion = sys.hexversion >> 16 | 6686 pyversion = sys.hexversion >> 16 |
6073 vers = "{0:d}{1:d}".format((pyversion >> 8) & 0xff, | 6687 vers = "{0:d}{1:d}".format( |
6074 pyversion & 0xff) | 6688 (pyversion >> 8) & 0xFF, pyversion & 0xFF |
6075 home = os.path.join( | 6689 ) |
6076 pythonDocDir, "python{0}.chm".format(vers)) | 6690 home = os.path.join(pythonDocDir, "python{0}.chm".format(vers)) |
6077 else: | 6691 else: |
6078 home = pythonDocDir | 6692 home = pythonDocDir |
6079 | 6693 |
6080 if not os.path.exists(home): | 6694 if not os.path.exists(home): |
6081 EricMessageBox.warning( | 6695 EricMessageBox.warning( |
6082 self, | 6696 self, |
6083 self.tr("Documentation Missing"), | 6697 self.tr("Documentation Missing"), |
6084 self.tr("""<p>The documentation starting point""" | 6698 self.tr( |
6085 """ "<b>{0}</b>" could not be found.</p>""") | 6699 """<p>The documentation starting point""" |
6086 .format(home)) | 6700 """ "<b>{0}</b>" could not be found.</p>""" |
6701 ).format(home), | |
6702 ) | |
6087 return | 6703 return |
6088 | 6704 |
6089 if not home.endswith(".chm"): | 6705 if not home.endswith(".chm"): |
6090 if Utilities.isWindowsPlatform(): | 6706 if Utilities.isWindowsPlatform(): |
6091 home = "file:///" + Utilities.fromNativeSeparators(home) | 6707 home = "file:///" + Utilities.fromNativeSeparators(home) |
6092 else: | 6708 else: |
6093 home = "file://" + home | 6709 home = "file://" + home |
6094 else: | 6710 else: |
6095 home = pythonDocDir | 6711 home = pythonDocDir |
6096 | 6712 |
6097 if home.endswith(".chm"): | 6713 if home.endswith(".chm"): |
6098 self.__chmViewer(home) | 6714 self.__chmViewer(home) |
6099 else: | 6715 else: |
6100 hvType = Preferences.getHelp("HelpViewerType") | 6716 hvType = Preferences.getHelp("HelpViewerType") |
6101 if hvType == 0: | 6717 if hvType == 0: |
6113 self.__customViewer(home) | 6729 self.__customViewer(home) |
6114 | 6730 |
6115 def __showQtDoc(self, version): | 6731 def __showQtDoc(self, version): |
6116 """ | 6732 """ |
6117 Private method to show the Qt documentation. | 6733 Private method to show the Qt documentation. |
6118 | 6734 |
6119 @param version Qt version to show documentation for | 6735 @param version Qt version to show documentation for |
6120 @type int | 6736 @type int |
6121 """ | 6737 """ |
6122 if version in [5, 6]: | 6738 if version in [5, 6]: |
6123 qtDocDir = Preferences.getQtDocDir(version) | 6739 qtDocDir = Preferences.getQtDocDir(version) |
6124 else: | 6740 else: |
6125 return | 6741 return |
6126 | 6742 |
6127 if qtDocDir.startswith("qthelp://"): | 6743 if qtDocDir.startswith("qthelp://"): |
6128 if not os.path.splitext(qtDocDir)[1]: | 6744 if not os.path.splitext(qtDocDir)[1]: |
6129 home = qtDocDir + "/index.html" | 6745 home = qtDocDir + "/index.html" |
6130 else: | 6746 else: |
6131 home = qtDocDir | 6747 home = qtDocDir |
6133 home = qtDocDir | 6749 home = qtDocDir |
6134 else: | 6750 else: |
6135 if qtDocDir.startswith("file://"): | 6751 if qtDocDir.startswith("file://"): |
6136 qtDocDir = qtDocDir[7:] | 6752 qtDocDir = qtDocDir[7:] |
6137 if not os.path.splitext(qtDocDir)[1]: | 6753 if not os.path.splitext(qtDocDir)[1]: |
6138 home = Utilities.normjoinpath(qtDocDir, 'index.html') | 6754 home = Utilities.normjoinpath(qtDocDir, "index.html") |
6139 else: | 6755 else: |
6140 home = qtDocDir | 6756 home = qtDocDir |
6141 | 6757 |
6142 if not os.path.exists(home): | 6758 if not os.path.exists(home): |
6143 EricMessageBox.warning( | 6759 EricMessageBox.warning( |
6144 self, | 6760 self, |
6145 self.tr("Documentation Missing"), | 6761 self.tr("Documentation Missing"), |
6146 self.tr("""<p>The documentation starting point""" | 6762 self.tr( |
6147 """ "<b>{0}</b>" could not be found.</p>""") | 6763 """<p>The documentation starting point""" |
6148 .format(home)) | 6764 """ "<b>{0}</b>" could not be found.</p>""" |
6765 ).format(home), | |
6766 ) | |
6149 return | 6767 return |
6150 | 6768 |
6151 if Utilities.isWindowsPlatform(): | 6769 if Utilities.isWindowsPlatform(): |
6152 home = "file:///" + Utilities.fromNativeSeparators(home) | 6770 home = "file:///" + Utilities.fromNativeSeparators(home) |
6153 else: | 6771 else: |
6154 home = "file://" + home | 6772 home = "file://" + home |
6155 | 6773 |
6156 hvType = Preferences.getHelp("HelpViewerType") | 6774 hvType = Preferences.getHelp("HelpViewerType") |
6157 if hvType == 0: | 6775 if hvType == 0: |
6158 self.__activateHelpViewerWidget(urlStr=home) | 6776 self.__activateHelpViewerWidget(urlStr=home) |
6159 elif hvType == 1: | 6777 elif hvType == 1: |
6160 self.launchHelpViewer(home) | 6778 self.launchHelpViewer(home) |
6165 self.__webBrowser(home) | 6783 self.__webBrowser(home) |
6166 elif hvType == 3: | 6784 elif hvType == 3: |
6167 self.__webBrowser(home) | 6785 self.__webBrowser(home) |
6168 else: | 6786 else: |
6169 self.__customViewer(home) | 6787 self.__customViewer(home) |
6170 | 6788 |
6171 def __showPyQtDoc(self, variant=5): | 6789 def __showPyQtDoc(self, variant=5): |
6172 """ | 6790 """ |
6173 Private slot to show the PyQt5/6 documentation. | 6791 Private slot to show the PyQt5/6 documentation. |
6174 | 6792 |
6175 @param variant PyQt variant to show documentation for (5 or 6) | 6793 @param variant PyQt variant to show documentation for (5 or 6) |
6176 @type int or str | 6794 @type int or str |
6177 """ | 6795 """ |
6178 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant)) | 6796 pyqtDocDir = Preferences.getHelp("PyQt{0}DocDir".format(variant)) |
6179 if not pyqtDocDir: | 6797 if not pyqtDocDir: |
6180 pyqtDocDir = Utilities.getEnvironmentEntry( | 6798 pyqtDocDir = Utilities.getEnvironmentEntry( |
6181 "PYQT{0}DOCDIR".format(variant), None) | 6799 "PYQT{0}DOCDIR".format(variant), None |
6182 | 6800 ) |
6801 | |
6183 if not pyqtDocDir: | 6802 if not pyqtDocDir: |
6184 EricMessageBox.warning( | 6803 EricMessageBox.warning( |
6185 self, | 6804 self, |
6186 self.tr("Documentation"), | 6805 self.tr("Documentation"), |
6187 self.tr("""<p>The PyQt{0} documentation starting point""" | 6806 self.tr( |
6188 """ has not been configured.</p>""").format(variant)) | 6807 """<p>The PyQt{0} documentation starting point""" |
6808 """ has not been configured.</p>""" | |
6809 ).format(variant), | |
6810 ) | |
6189 return | 6811 return |
6190 | 6812 |
6191 if not pyqtDocDir.startswith(("http://", "https://", "qthelp://")): | 6813 if not pyqtDocDir.startswith(("http://", "https://", "qthelp://")): |
6192 home = "" | 6814 home = "" |
6193 if pyqtDocDir: | 6815 if pyqtDocDir: |
6194 if pyqtDocDir.startswith("file://"): | 6816 if pyqtDocDir.startswith("file://"): |
6195 pyqtDocDir = pyqtDocDir[7:] | 6817 pyqtDocDir = pyqtDocDir[7:] |
6196 if not os.path.splitext(pyqtDocDir)[1]: | 6818 if not os.path.splitext(pyqtDocDir)[1]: |
6197 possibleHomes = [ | 6819 possibleHomes = [ |
6198 Utilities.normjoinpath( | 6820 Utilities.normjoinpath(pyqtDocDir, "index.html"), |
6199 pyqtDocDir, 'index.html'), | 6821 Utilities.normjoinpath(pyqtDocDir, "class_reference.html"), |
6200 Utilities.normjoinpath( | |
6201 pyqtDocDir, 'class_reference.html'), | |
6202 ] | 6822 ] |
6203 for possibleHome in possibleHomes: | 6823 for possibleHome in possibleHomes: |
6204 if os.path.exists(possibleHome): | 6824 if os.path.exists(possibleHome): |
6205 home = possibleHome | 6825 home = possibleHome |
6206 break | 6826 break |
6207 else: | 6827 else: |
6208 home = pyqtDocDir | 6828 home = pyqtDocDir |
6209 | 6829 |
6210 if not home or not os.path.exists(home): | 6830 if not home or not os.path.exists(home): |
6211 EricMessageBox.warning( | 6831 EricMessageBox.warning( |
6212 self, | 6832 self, |
6213 self.tr("Documentation Missing"), | 6833 self.tr("Documentation Missing"), |
6214 self.tr("""<p>The documentation starting point""" | 6834 self.tr( |
6215 """ "<b>{0}</b>" could not be found.</p>""") | 6835 """<p>The documentation starting point""" |
6216 .format(home)) | 6836 """ "<b>{0}</b>" could not be found.</p>""" |
6837 ).format(home), | |
6838 ) | |
6217 return | 6839 return |
6218 | 6840 |
6219 if Utilities.isWindowsPlatform(): | 6841 if Utilities.isWindowsPlatform(): |
6220 home = "file:///" + Utilities.fromNativeSeparators(home) | 6842 home = "file:///" + Utilities.fromNativeSeparators(home) |
6221 else: | 6843 else: |
6222 home = "file://" + home | 6844 home = "file://" + home |
6223 else: | 6845 else: |
6224 home = pyqtDocDir | 6846 home = pyqtDocDir |
6225 | 6847 |
6226 hvType = Preferences.getHelp("HelpViewerType") | 6848 hvType = Preferences.getHelp("HelpViewerType") |
6227 if hvType == 0: | 6849 if hvType == 0: |
6228 self.__activateHelpViewerWidget(urlStr=home) | 6850 self.__activateHelpViewerWidget(urlStr=home) |
6229 elif hvType == 1: | 6851 elif hvType == 1: |
6230 self.launchHelpViewer(home) | 6852 self.launchHelpViewer(home) |
6235 self.__webBrowser(home) | 6857 self.__webBrowser(home) |
6236 elif hvType == 3: | 6858 elif hvType == 3: |
6237 self.__webBrowser(home) | 6859 self.__webBrowser(home) |
6238 else: | 6860 else: |
6239 self.__customViewer(home) | 6861 self.__customViewer(home) |
6240 | 6862 |
6241 def __showEricDoc(self): | 6863 def __showEricDoc(self): |
6242 """ | 6864 """ |
6243 Private slot to show the Eric documentation. | 6865 Private slot to show the Eric documentation. |
6244 """ | 6866 """ |
6245 home = Preferences.getHelp("EricDocDir") | 6867 home = Preferences.getHelp("EricDocDir") |
6246 if not home: | 6868 if not home: |
6247 home = Utilities.normjoinpath( | 6869 home = Utilities.normjoinpath( |
6248 getConfig('ericDocDir'), "Source", "index.html") | 6870 getConfig("ericDocDir"), "Source", "index.html" |
6249 | 6871 ) |
6872 | |
6250 if not home.startswith(("http://", "https://", "qthelp://")): | 6873 if not home.startswith(("http://", "https://", "qthelp://")): |
6251 if not os.path.exists(home): | 6874 if not os.path.exists(home): |
6252 EricMessageBox.warning( | 6875 EricMessageBox.warning( |
6253 self, | 6876 self, |
6254 self.tr("Documentation Missing"), | 6877 self.tr("Documentation Missing"), |
6255 self.tr("""<p>The documentation starting point""" | 6878 self.tr( |
6256 """ "<b>{0}</b>" could not be found.</p>""") | 6879 """<p>The documentation starting point""" |
6257 .format(home)) | 6880 """ "<b>{0}</b>" could not be found.</p>""" |
6881 ).format(home), | |
6882 ) | |
6258 return | 6883 return |
6259 | 6884 |
6260 if Utilities.isWindowsPlatform(): | 6885 if Utilities.isWindowsPlatform(): |
6261 home = "file:///" + Utilities.fromNativeSeparators(home) | 6886 home = "file:///" + Utilities.fromNativeSeparators(home) |
6262 else: | 6887 else: |
6263 home = "file://" + home | 6888 home = "file://" + home |
6264 | 6889 |
6265 hvType = Preferences.getHelp("HelpViewerType") | 6890 hvType = Preferences.getHelp("HelpViewerType") |
6266 if hvType == 0: | 6891 if hvType == 0: |
6267 self.__activateHelpViewerWidget(urlStr=home) | 6892 self.__activateHelpViewerWidget(urlStr=home) |
6268 elif hvType == 1: | 6893 elif hvType == 1: |
6269 self.launchHelpViewer(home) | 6894 self.launchHelpViewer(home) |
6274 self.__webBrowser(home) | 6899 self.__webBrowser(home) |
6275 elif hvType == 3: | 6900 elif hvType == 3: |
6276 self.__webBrowser(home) | 6901 self.__webBrowser(home) |
6277 else: | 6902 else: |
6278 self.__customViewer(home) | 6903 self.__customViewer(home) |
6279 | 6904 |
6280 def __showPySideDoc(self, variant=2): | 6905 def __showPySideDoc(self, variant=2): |
6281 """ | 6906 """ |
6282 Private slot to show the PySide2/PySide6 documentation. | 6907 Private slot to show the PySide2/PySide6 documentation. |
6283 | 6908 |
6284 @param variant PySide variant (2 or 6) | 6909 @param variant PySide variant (2 or 6) |
6285 @type int or str | 6910 @type int or str |
6286 """ | 6911 """ |
6287 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant)) | 6912 pysideDocDir = Preferences.getHelp("PySide{0}DocDir".format(variant)) |
6288 if not pysideDocDir: | 6913 if not pysideDocDir: |
6289 pysideDocDir = Utilities.getEnvironmentEntry( | 6914 pysideDocDir = Utilities.getEnvironmentEntry( |
6290 "PYSIDE{0}DOCDIR".format(variant), None) | 6915 "PYSIDE{0}DOCDIR".format(variant), None |
6291 | 6916 ) |
6917 | |
6292 if not pysideDocDir: | 6918 if not pysideDocDir: |
6293 EricMessageBox.warning( | 6919 EricMessageBox.warning( |
6294 self, | 6920 self, |
6295 self.tr("Documentation"), | 6921 self.tr("Documentation"), |
6296 self.tr("""<p>The PySide{0} documentation starting point""" | 6922 self.tr( |
6297 """ has not been configured.</p>""").format( | 6923 """<p>The PySide{0} documentation starting point""" |
6298 variant) | 6924 """ has not been configured.</p>""" |
6925 ).format(variant), | |
6299 ) | 6926 ) |
6300 return | 6927 return |
6301 | 6928 |
6302 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): | 6929 if not pysideDocDir.startswith(("http://", "https://", "qthelp://")): |
6303 if pysideDocDir.startswith("file://"): | 6930 if pysideDocDir.startswith("file://"): |
6304 pysideDocDir = pysideDocDir[7:] | 6931 pysideDocDir = pysideDocDir[7:] |
6305 if not os.path.splitext(pysideDocDir)[1]: | 6932 if not os.path.splitext(pysideDocDir)[1]: |
6306 home = Utilities.normjoinpath(pysideDocDir, 'index.html') | 6933 home = Utilities.normjoinpath(pysideDocDir, "index.html") |
6307 else: | 6934 else: |
6308 home = pysideDocDir | 6935 home = pysideDocDir |
6309 if not os.path.exists(home): | 6936 if not os.path.exists(home): |
6310 EricMessageBox.warning( | 6937 EricMessageBox.warning( |
6311 self, | 6938 self, |
6312 self.tr("Documentation Missing"), | 6939 self.tr("Documentation Missing"), |
6313 self.tr("""<p>The documentation starting point""" | 6940 self.tr( |
6314 """ "<b>{0}</b>" could not be found.</p>""") | 6941 """<p>The documentation starting point""" |
6315 .format(home)) | 6942 """ "<b>{0}</b>" could not be found.</p>""" |
6943 ).format(home), | |
6944 ) | |
6316 return | 6945 return |
6317 | 6946 |
6318 if Utilities.isWindowsPlatform(): | 6947 if Utilities.isWindowsPlatform(): |
6319 home = "file:///" + Utilities.fromNativeSeparators(home) | 6948 home = "file:///" + Utilities.fromNativeSeparators(home) |
6320 else: | 6949 else: |
6321 home = "file://" + home | 6950 home = "file://" + home |
6322 else: | 6951 else: |
6323 home = pysideDocDir | 6952 home = pysideDocDir |
6324 | 6953 |
6325 hvType = Preferences.getHelp("HelpViewerType") | 6954 hvType = Preferences.getHelp("HelpViewerType") |
6326 if hvType == 0: | 6955 if hvType == 0: |
6327 self.__activateHelpViewerWidget(urlStr=home) | 6956 self.__activateHelpViewerWidget(urlStr=home) |
6328 elif hvType == 1: | 6957 elif hvType == 1: |
6329 self.launchHelpViewer(home) | 6958 self.launchHelpViewer(home) |
6334 self.__webBrowser(home) | 6963 self.__webBrowser(home) |
6335 elif hvType == 3: | 6964 elif hvType == 3: |
6336 self.__webBrowser(home) | 6965 self.__webBrowser(home) |
6337 else: | 6966 else: |
6338 self.__customViewer(home) | 6967 self.__customViewer(home) |
6339 | 6968 |
6340 @pyqtSlot(QUrl) | 6969 @pyqtSlot(QUrl) |
6341 def handleUrl(self, url): | 6970 def handleUrl(self, url): |
6342 """ | 6971 """ |
6343 Public slot to handle opening a URL. | 6972 Public slot to handle opening a URL. |
6344 | 6973 |
6345 @param url URL to be shown | 6974 @param url URL to be shown |
6346 @type QUrl | 6975 @type QUrl |
6347 """ | 6976 """ |
6348 self.launchHelpViewer(url) | 6977 self.launchHelpViewer(url) |
6349 | 6978 |
6350 def launchHelpViewer(self, home, searchWord=None, useSingle=False): | 6979 def launchHelpViewer(self, home, searchWord=None, useSingle=False): |
6351 """ | 6980 """ |
6352 Public slot to start the help viewer/web browser. | 6981 Public slot to start the help viewer/web browser. |
6353 | 6982 |
6354 @param home filename of file to be shown or URL to be opened | 6983 @param home filename of file to be shown or URL to be opened |
6355 @type str or QUrl | 6984 @type str or QUrl |
6356 @param searchWord word to search for | 6985 @param searchWord word to search for |
6357 @type str | 6986 @type str |
6358 @param useSingle flag indicating to use a single browser window | 6987 @param useSingle flag indicating to use a single browser window |
6359 @type bool | 6988 @type bool |
6360 """ | 6989 """ |
6361 if isinstance(home, QUrl): | 6990 if isinstance(home, QUrl): |
6362 home = home.toString(QUrl.UrlFormattingOption.None_) | 6991 home = home.toString(QUrl.UrlFormattingOption.None_) |
6363 | 6992 |
6364 if len(home) > 0: | 6993 if len(home) > 0: |
6365 homeUrl = QUrl(home) | 6994 homeUrl = QUrl(home) |
6366 if not homeUrl.scheme(): | 6995 if not homeUrl.scheme(): |
6367 home = QUrl.fromLocalFile(home).toString() | 6996 home = QUrl.fromLocalFile(home).toString() |
6368 | 6997 |
6369 launchResult = self.__launchExternalWebBrowser( | 6998 launchResult = self.__launchExternalWebBrowser(home, searchWord=searchWord) |
6370 home, searchWord=searchWord) | |
6371 if not launchResult: | 6999 if not launchResult: |
6372 self.__webBrowser(home) | 7000 self.__webBrowser(home) |
6373 | 7001 |
6374 def __launchExternalWebBrowser(self, home, searchWord=None): | 7002 def __launchExternalWebBrowser(self, home, searchWord=None): |
6375 """ | 7003 """ |
6376 Private method to start an external web browser and communicate with | 7004 Private method to start an external web browser and communicate with |
6377 it. | 7005 it. |
6378 | 7006 |
6379 @param home filename of file to be shown or URL to be opened | 7007 @param home filename of file to be shown or URL to be opened |
6380 @type str | 7008 @type str |
6381 @param searchWord word to search for | 7009 @param searchWord word to search for |
6382 @type str | 7010 @type str |
6383 @return flag indicating a successful launch | 7011 @return flag indicating a successful launch |
6384 @rtype bool | 7012 @rtype bool |
6385 """ | 7013 """ |
6386 clientArgs = [] | 7014 clientArgs = [] |
6387 if searchWord: | 7015 if searchWord: |
6388 clientArgs.append("--search={0}".format(searchWord)) | 7016 clientArgs.append("--search={0}".format(searchWord)) |
6389 | 7017 |
6390 if self.__webBrowserProcess is None: | 7018 if self.__webBrowserProcess is None: |
6391 webBrowsers = [ | 7019 webBrowsers = [ |
6392 os.path.join( | 7020 os.path.join(os.path.dirname(__file__), "..", "eric7_browser.py"), |
6393 os.path.dirname(__file__), "..", "eric7_browser.py"), | |
6394 # QtWebEngine based web browser | 7021 # QtWebEngine based web browser |
6395 ] | 7022 ] |
6396 process = QProcess() | 7023 process = QProcess() |
6397 for browser in webBrowsers: | 7024 for browser in webBrowsers: |
6398 args = [ | 7025 args = [ |
6399 browser, | 7026 browser, |
6400 "--quiet", | 7027 "--quiet", |
6401 "--qthelp", | 7028 "--qthelp", |
6402 "--single", | 7029 "--single", |
6403 "--name={0}".format(self.__webBrowserSAName), | 7030 "--name={0}".format(self.__webBrowserSAName), |
6404 home | 7031 home, |
6405 ] | 7032 ] |
6406 process.start(Globals.getPythonExecutable(), args) | 7033 process.start(Globals.getPythonExecutable(), args) |
6407 if not process.waitForStarted(): | 7034 if not process.waitForStarted(): |
6408 EricMessageBox.warning( | 7035 EricMessageBox.warning( |
6409 self, | 7036 self, |
6410 self.tr("Start Web Browser"), | 7037 self.tr("Start Web Browser"), |
6411 self.tr("""The eric web browser could not be""" | 7038 self.tr( |
6412 """ started.""")) | 7039 """The eric web browser could not be""" """ started.""" |
7040 ), | |
7041 ) | |
6413 return False | 7042 return False |
6414 | 7043 |
6415 res = self.__connectToWebBrowser(process) | 7044 res = self.__connectToWebBrowser(process) |
6416 if res == 1: | 7045 if res == 1: |
6417 # connection unsuccessful | 7046 # connection unsuccessful |
6418 return False | 7047 return False |
6419 elif res == 0: | 7048 elif res == 0: |
6422 elif res == -1: | 7051 elif res == -1: |
6423 # web browser did not start | 7052 # web browser did not start |
6424 continue | 7053 continue |
6425 else: | 7054 else: |
6426 return False | 7055 return False |
6427 | 7056 |
6428 process.finished.connect(self.__webBrowserFinished) | 7057 process.finished.connect(self.__webBrowserFinished) |
6429 self.__webBrowserProcess = process | 7058 self.__webBrowserProcess = process |
6430 | 7059 |
6431 else: | 7060 else: |
6432 clientArgs.append("--newtab={0}".format(home)) | 7061 clientArgs.append("--newtab={0}".format(home)) |
6433 | 7062 |
6434 if clientArgs and self.__webBrowserClient: | 7063 if clientArgs and self.__webBrowserClient: |
6435 self.__webBrowserClient.processArgs(clientArgs, disconnect=False) | 7064 self.__webBrowserClient.processArgs(clientArgs, disconnect=False) |
6436 | 7065 |
6437 return True | 7066 return True |
6438 | 7067 |
6439 def __connectToWebBrowser(self, process): | 7068 def __connectToWebBrowser(self, process): |
6440 """ | 7069 """ |
6441 Private method to connect to a started web browser. | 7070 Private method to connect to a started web browser. |
6442 | 7071 |
6443 @param process reference to the started web browser process | 7072 @param process reference to the started web browser process |
6444 @type QProcess | 7073 @type QProcess |
6445 @return error indication (1 = connection not possible, 0 = ok, | 7074 @return error indication (1 = connection not possible, 0 = ok, |
6446 -1 = server exited with an error code) | 7075 -1 = server exited with an error code) |
6447 @rtype int | 7076 @rtype int |
6448 """ | 7077 """ |
6449 from WebBrowser.WebBrowserSingleApplication import ( | 7078 from WebBrowser.WebBrowserSingleApplication import ( |
6450 WebBrowserSingleApplicationClient | 7079 WebBrowserSingleApplicationClient, |
6451 ) | 7080 ) |
6452 | 7081 |
6453 webBrowserClient = WebBrowserSingleApplicationClient( | 7082 webBrowserClient = WebBrowserSingleApplicationClient(self.__webBrowserSAName) |
6454 self.__webBrowserSAName) | |
6455 connectCount = 30 | 7083 connectCount = 30 |
6456 while connectCount: | 7084 while connectCount: |
6457 res = webBrowserClient.connect() | 7085 res = webBrowserClient.connect() |
6458 if res != 0: | 7086 if res != 0: |
6459 break | 7087 break |
6460 else: | 7088 else: |
6461 connectCount -= 1 | 7089 connectCount -= 1 |
6462 QThread.msleep(1000) | 7090 QThread.msleep(1000) |
6463 QApplication.processEvents() | 7091 QApplication.processEvents() |
6464 if ( | 7092 if ( |
6465 process.state() == QProcess.ProcessState.NotRunning and | 7093 process.state() == QProcess.ProcessState.NotRunning |
6466 process.exitStatus() == QProcess.ExitStatus.NormalExit and | 7094 and process.exitStatus() == QProcess.ExitStatus.NormalExit |
6467 process.exitCode() == 100 | 7095 and process.exitCode() == 100 |
6468 ): | 7096 ): |
6469 # Process exited prematurely due to missing pre-requisites | 7097 # Process exited prematurely due to missing pre-requisites |
6470 return -1 | 7098 return -1 |
6471 if res <= 0: | 7099 if res <= 0: |
6472 EricMessageBox.warning( | 7100 EricMessageBox.warning( |
6473 self, | 7101 self, |
6474 self.tr("Start Web Browser"), | 7102 self.tr("Start Web Browser"), |
6475 self.tr("""<p>The eric web browser is not started.</p>""" | 7103 self.tr( |
6476 """<p>Reason: {0}</p>""").format( | 7104 """<p>The eric web browser is not started.</p>""" |
6477 webBrowserClient.errstr()) | 7105 """<p>Reason: {0}</p>""" |
7106 ).format(webBrowserClient.errstr()), | |
6478 ) | 7107 ) |
6479 return 1 | 7108 return 1 |
6480 | 7109 |
6481 self.__webBrowserClient = webBrowserClient | 7110 self.__webBrowserClient = webBrowserClient |
6482 return 0 | 7111 return 0 |
6483 | 7112 |
6484 def __webBrowserFinished(self): | 7113 def __webBrowserFinished(self): |
6485 """ | 7114 """ |
6486 Private slot handling the end of the external web browser process. | 7115 Private slot handling the end of the external web browser process. |
6487 """ | 7116 """ |
6488 self.__webBrowserProcess = None | 7117 self.__webBrowserProcess = None |
6489 self.__webBrowserClient = None | 7118 self.__webBrowserClient = None |
6490 | 7119 |
6491 def __webBrowserShutdown(self): | 7120 def __webBrowserShutdown(self): |
6492 """ | 7121 """ |
6493 Private method to shut down the web browser. | 7122 Private method to shut down the web browser. |
6494 """ | 7123 """ |
6495 self.__webBrowserClient.processArgs(["--shutdown"], disconnect=False) | 7124 self.__webBrowserClient.processArgs(["--shutdown"], disconnect=False) |
6496 | 7125 |
6497 def __helpViewer(self): | 7126 def __helpViewer(self): |
6498 """ | 7127 """ |
6499 Private slot to start an empty help viewer/web browser. | 7128 Private slot to start an empty help viewer/web browser. |
6500 """ | 7129 """ |
6501 searchWord = self.viewmanager.textForFind(False) | 7130 searchWord = self.viewmanager.textForFind(False) |
6502 if searchWord == "": | 7131 if searchWord == "": |
6503 searchWord = None | 7132 searchWord = None |
6504 | 7133 |
6505 self.launchHelpViewer("", searchWord=searchWord) | 7134 self.launchHelpViewer("", searchWord=searchWord) |
6506 | 7135 |
6507 def __webBrowser(self, home=""): | 7136 def __webBrowser(self, home=""): |
6508 """ | 7137 """ |
6509 Private slot to start the eric web browser. | 7138 Private slot to start the eric web browser. |
6510 | 7139 |
6511 @param home full pathname of a file to display (string) | 7140 @param home full pathname of a file to display (string) |
6512 """ | 7141 """ |
6513 started = QDesktopServices.openUrl(QUrl(home)) | 7142 started = QDesktopServices.openUrl(QUrl(home)) |
6514 if not started: | 7143 if not started: |
6515 EricMessageBox.critical( | 7144 EricMessageBox.critical( |
6516 self, | 7145 self, self.tr("Open Browser"), self.tr("Could not start a web browser") |
6517 self.tr('Open Browser'), | 7146 ) |
6518 self.tr('Could not start a web browser')) | |
6519 | 7147 |
6520 @pyqtSlot() | 7148 @pyqtSlot() |
6521 @pyqtSlot(str) | 7149 @pyqtSlot(str) |
6522 def showPreferences(self, pageName=None): | 7150 def showPreferences(self, pageName=None): |
6523 """ | 7151 """ |
6524 Public slot to set the preferences. | 7152 Public slot to set the preferences. |
6525 | 7153 |
6526 @param pageName name of the configuration page to show (string) | 7154 @param pageName name of the configuration page to show (string) |
6527 """ | 7155 """ |
6528 if self.__configurationDialog is None: | 7156 if self.__configurationDialog is None: |
6529 # only one invocation at a time is allowed | 7157 # only one invocation at a time is allowed |
6530 from Preferences.ConfigurationDialog import ConfigurationDialog | 7158 from Preferences.ConfigurationDialog import ConfigurationDialog |
7159 | |
6531 self.__configurationDialog = ConfigurationDialog( | 7160 self.__configurationDialog = ConfigurationDialog( |
6532 self, 'Configuration', | 7161 self, |
7162 "Configuration", | |
6533 expandedEntries=self.__expandedConfigurationEntries, | 7163 expandedEntries=self.__expandedConfigurationEntries, |
6534 ) | 7164 ) |
6535 self.__configurationDialog.preferencesChanged.connect( | 7165 self.__configurationDialog.preferencesChanged.connect( |
6536 self.__preferencesChanged) | 7166 self.__preferencesChanged |
7167 ) | |
6537 self.__configurationDialog.masterPasswordChanged.connect( | 7168 self.__configurationDialog.masterPasswordChanged.connect( |
6538 self.__masterPasswordChanged) | 7169 self.__masterPasswordChanged |
7170 ) | |
6539 self.__configurationDialog.show() | 7171 self.__configurationDialog.show() |
6540 if pageName is not None: | 7172 if pageName is not None: |
6541 self.__configurationDialog.showConfigurationPageByName( | 7173 self.__configurationDialog.showConfigurationPageByName(pageName) |
6542 pageName) | |
6543 elif self.__lastConfigurationPageName: | 7174 elif self.__lastConfigurationPageName: |
6544 self.__configurationDialog.showConfigurationPageByName( | 7175 self.__configurationDialog.showConfigurationPageByName( |
6545 self.__lastConfigurationPageName) | 7176 self.__lastConfigurationPageName |
7177 ) | |
6546 else: | 7178 else: |
6547 self.__configurationDialog.showConfigurationPageByName("empty") | 7179 self.__configurationDialog.showConfigurationPageByName("empty") |
6548 self.__configurationDialog.exec() | 7180 self.__configurationDialog.exec() |
6549 QApplication.processEvents() | 7181 QApplication.processEvents() |
6550 if ( | 7182 if self.__configurationDialog.result() == QDialog.DialogCode.Accepted: |
6551 self.__configurationDialog.result() == | |
6552 QDialog.DialogCode.Accepted | |
6553 ): | |
6554 self.__configurationDialog.setPreferences() | 7183 self.__configurationDialog.setPreferences() |
6555 Preferences.syncPreferences() | 7184 Preferences.syncPreferences() |
6556 self.__preferencesChanged() | 7185 self.__preferencesChanged() |
6557 self.__lastConfigurationPageName = ( | 7186 self.__lastConfigurationPageName = ( |
6558 self.__configurationDialog.getConfigurationPageName() | 7187 self.__configurationDialog.getConfigurationPageName() |
6559 ) | 7188 ) |
6560 self.__expandedConfigurationEntries = ( | 7189 self.__expandedConfigurationEntries = ( |
6561 self.__configurationDialog.getExpandedEntries() | 7190 self.__configurationDialog.getExpandedEntries() |
6562 ) | 7191 ) |
6563 | 7192 |
6564 self.__configurationDialog.deleteLater() | 7193 self.__configurationDialog.deleteLater() |
6565 self.__configurationDialog = None | 7194 self.__configurationDialog = None |
6566 | 7195 |
6567 @pyqtSlot() | 7196 @pyqtSlot() |
6568 def __exportPreferences(self): | 7197 def __exportPreferences(self): |
6569 """ | 7198 """ |
6570 Private slot to export the current preferences. | 7199 Private slot to export the current preferences. |
6571 """ | 7200 """ |
6572 Preferences.exportPreferences() | 7201 Preferences.exportPreferences() |
6573 | 7202 |
6574 @pyqtSlot() | 7203 @pyqtSlot() |
6575 def __importPreferences(self): | 7204 def __importPreferences(self): |
6576 """ | 7205 """ |
6577 Private slot to import preferences. | 7206 Private slot to import preferences. |
6578 """ | 7207 """ |
6579 Preferences.importPreferences() | 7208 Preferences.importPreferences() |
6580 self.__preferencesChanged() | 7209 self.__preferencesChanged() |
6581 | 7210 |
6582 @pyqtSlot() | 7211 @pyqtSlot() |
6583 def __exportTheme(self): | 7212 def __exportTheme(self): |
6584 """ | 7213 """ |
6585 Private slot to export the current theme to a file. | 7214 Private slot to export the current theme to a file. |
6586 """ | 7215 """ |
6587 from Preferences.ThemeManager import ThemeManager | 7216 from Preferences.ThemeManager import ThemeManager |
7217 | |
6588 ThemeManager().exportTheme() | 7218 ThemeManager().exportTheme() |
6589 | 7219 |
6590 @pyqtSlot() | 7220 @pyqtSlot() |
6591 def __importTheme(self): | 7221 def __importTheme(self): |
6592 """ | 7222 """ |
6593 Private slot to import a previously exported theme. | 7223 Private slot to import a previously exported theme. |
6594 """ | 7224 """ |
6595 from Preferences.ThemeManager import ThemeManager | 7225 from Preferences.ThemeManager import ThemeManager |
7226 | |
6596 if ThemeManager().importTheme(): | 7227 if ThemeManager().importTheme(): |
6597 self.__preferencesChanged() | 7228 self.__preferencesChanged() |
6598 | 7229 |
6599 @pyqtSlot() | 7230 @pyqtSlot() |
6600 def __preferencesChanged(self): | 7231 def __preferencesChanged(self): |
6601 """ | 7232 """ |
6602 Private slot to handle a change of the preferences. | 7233 Private slot to handle a change of the preferences. |
6603 """ | 7234 """ |
6604 self.setStyle(Preferences.getUI("Style"), | 7235 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
6605 Preferences.getUI("StyleSheet")) | 7236 |
6606 | |
6607 if Preferences.getUI("SingleApplicationMode"): | 7237 if Preferences.getUI("SingleApplicationMode"): |
6608 if self.SAServer is None: | 7238 if self.SAServer is None: |
6609 self.SAServer = EricSingleApplicationServer() | 7239 self.SAServer = EricSingleApplicationServer() |
6610 else: | 7240 else: |
6611 if self.SAServer is not None: | 7241 if self.SAServer is not None: |
6612 self.SAServer.shutdown() | 7242 self.SAServer.shutdown() |
6613 self.SAServer = None | 7243 self.SAServer = None |
6614 self.newWindowAct.setEnabled( | 7244 self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode")) |
6615 not Preferences.getUI("SingleApplicationMode")) | 7245 |
6616 | |
6617 if self.__layoutType == "Sidebars": | 7246 if self.__layoutType == "Sidebars": |
6618 self.leftSidebar.setIconBarColor( | 7247 self.leftSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
6619 Preferences.getUI("IconBarColor")) | 7248 self.leftSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
6620 self.leftSidebar.setIconBarSize( | 7249 |
6621 Preferences.getUI("IconBarSize")) | 7250 self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
6622 | 7251 self.bottomSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
6623 self.bottomSidebar.setIconBarColor( | 7252 |
6624 Preferences.getUI("IconBarColor")) | |
6625 self.bottomSidebar.setIconBarSize( | |
6626 Preferences.getUI("IconBarSize")) | |
6627 | |
6628 if self.rightSidebar: | 7253 if self.rightSidebar: |
6629 self.rightSidebar.setIconBarColor( | 7254 self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) |
6630 Preferences.getUI("IconBarColor")) | 7255 self.rightSidebar.setIconBarSize(Preferences.getUI("IconBarSize")) |
6631 self.rightSidebar.setIconBarSize( | 7256 |
6632 Preferences.getUI("IconBarSize")) | |
6633 | |
6634 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") | 7257 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") |
6635 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") | 7258 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") |
6636 if not self.captionShowsFilename: | 7259 if not self.captionShowsFilename: |
6637 self.__setWindowCaption(editor="") | 7260 self.__setWindowCaption(editor="") |
6638 else: | 7261 else: |
6640 fn = aw and aw.getFileName() or None | 7263 fn = aw and aw.getFileName() or None |
6641 if fn: | 7264 if fn: |
6642 self.__setWindowCaption(editor=fn) | 7265 self.__setWindowCaption(editor=fn) |
6643 else: | 7266 else: |
6644 self.__setWindowCaption(editor="") | 7267 self.__setWindowCaption(editor="") |
6645 | 7268 |
6646 self.performVersionCheck() | 7269 self.performVersionCheck() |
6647 | 7270 |
6648 from QScintilla.SpellChecker import SpellChecker | 7271 from QScintilla.SpellChecker import SpellChecker |
7272 | |
6649 SpellChecker.setDefaultLanguage( | 7273 SpellChecker.setDefaultLanguage( |
6650 Preferences.getEditor("SpellCheckingDefaultLanguage")) | 7274 Preferences.getEditor("SpellCheckingDefaultLanguage") |
6651 | 7275 ) |
7276 | |
6652 with contextlib.suppress(ImportError, AttributeError): | 7277 with contextlib.suppress(ImportError, AttributeError): |
6653 from EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin | 7278 from EricWidgets.EricSpellCheckedTextEdit import SpellCheckMixin |
7279 | |
6654 pwl = SpellChecker.getUserDictionaryPath(isException=False) | 7280 pwl = SpellChecker.getUserDictionaryPath(isException=False) |
6655 pel = SpellChecker.getUserDictionaryPath(isException=True) | 7281 pel = SpellChecker.getUserDictionaryPath(isException=True) |
6656 SpellCheckMixin.setDefaultLanguage( | 7282 SpellCheckMixin.setDefaultLanguage( |
6657 Preferences.getEditor("SpellCheckingDefaultLanguage"), | 7283 Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel |
6658 pwl, pel) | 7284 ) |
6659 | 7285 |
6660 if Preferences.getUI("UseSystemProxy"): | 7286 if Preferences.getUI("UseSystemProxy"): |
6661 QNetworkProxyFactory.setUseSystemConfiguration(True) | 7287 QNetworkProxyFactory.setUseSystemConfiguration(True) |
6662 else: | 7288 else: |
6663 self.__proxyFactory = EricNetworkProxyFactory() | 7289 self.__proxyFactory = EricNetworkProxyFactory() |
6664 QNetworkProxyFactory.setApplicationProxyFactory( | 7290 QNetworkProxyFactory.setApplicationProxyFactory(self.__proxyFactory) |
6665 self.__proxyFactory) | |
6666 QNetworkProxyFactory.setUseSystemConfiguration(False) | 7291 QNetworkProxyFactory.setUseSystemConfiguration(False) |
6667 | 7292 |
6668 from HexEdit.HexEditMainWindow import HexEditMainWindow | 7293 from HexEdit.HexEditMainWindow import HexEditMainWindow |
7294 | |
6669 for hexEditor in HexEditMainWindow.windows: | 7295 for hexEditor in HexEditMainWindow.windows: |
6670 hexEditor.preferencesChanged() | 7296 hexEditor.preferencesChanged() |
6671 | 7297 |
6672 # set the keyboard input interval | 7298 # set the keyboard input interval |
6673 interval = Preferences.getUI("KeyboardInputInterval") | 7299 interval = Preferences.getUI("KeyboardInputInterval") |
6674 if interval > 0: | 7300 if interval > 0: |
6675 QApplication.setKeyboardInputInterval(interval) | 7301 QApplication.setKeyboardInputInterval(interval) |
6676 else: | 7302 else: |
6677 QApplication.setKeyboardInputInterval(-1) | 7303 QApplication.setKeyboardInputInterval(-1) |
6678 | 7304 |
6679 if not self.__disableCrashSession: | 7305 if not self.__disableCrashSession: |
6680 if Preferences.getUI("CrashSessionEnabled"): | 7306 if Preferences.getUI("CrashSessionEnabled"): |
6681 self.__writeCrashSession() | 7307 self.__writeCrashSession() |
6682 else: | 7308 else: |
6683 self.__deleteCrashSession() | 7309 self.__deleteCrashSession() |
6684 | 7310 |
6685 self.preferencesChanged.emit() | 7311 self.preferencesChanged.emit() |
6686 | 7312 |
6687 def __masterPasswordChanged(self, oldPassword, newPassword): | 7313 def __masterPasswordChanged(self, oldPassword, newPassword): |
6688 """ | 7314 """ |
6689 Private slot to handle the change of the master password. | 7315 Private slot to handle the change of the master password. |
6690 | 7316 |
6691 @param oldPassword current master password (string) | 7317 @param oldPassword current master password (string) |
6692 @param newPassword new master password (string) | 7318 @param newPassword new master password (string) |
6693 """ | 7319 """ |
6694 import Globals | 7320 import Globals |
6695 | 7321 |
6696 self.masterPasswordChanged.emit(oldPassword, newPassword) | 7322 self.masterPasswordChanged.emit(oldPassword, newPassword) |
6697 Preferences.convertPasswords(oldPassword, newPassword) | 7323 Preferences.convertPasswords(oldPassword, newPassword) |
6698 variant = Globals.getWebBrowserSupport() | 7324 variant = Globals.getWebBrowserSupport() |
6699 if variant == "QtWebEngine": | 7325 if variant == "QtWebEngine": |
6700 from WebBrowser.Passwords.PasswordManager import ( | 7326 from WebBrowser.Passwords.PasswordManager import PasswordManager |
6701 PasswordManager | 7327 |
6702 ) | |
6703 pwManager = PasswordManager() | 7328 pwManager = PasswordManager() |
6704 pwManager.masterPasswordChanged(oldPassword, newPassword) | 7329 pwManager.masterPasswordChanged(oldPassword, newPassword) |
6705 Utilities.crypto.changeRememberedMaster(newPassword) | 7330 Utilities.crypto.changeRememberedMaster(newPassword) |
6706 | 7331 |
6707 def __reloadAPIs(self): | 7332 def __reloadAPIs(self): |
6708 """ | 7333 """ |
6709 Private slot to reload the api information. | 7334 Private slot to reload the api information. |
6710 """ | 7335 """ |
6711 self.reloadAPIs.emit() | 7336 self.reloadAPIs.emit() |
6712 | 7337 |
6713 def __showExternalTools(self): | 7338 def __showExternalTools(self): |
6714 """ | 7339 """ |
6715 Private slot to display a dialog show a list of external tools used | 7340 Private slot to display a dialog show a list of external tools used |
6716 by eric. | 7341 by eric. |
6717 """ | 7342 """ |
6718 if self.programsDialog is None: | 7343 if self.programsDialog is None: |
6719 from Preferences.ProgramsDialog import ProgramsDialog | 7344 from Preferences.ProgramsDialog import ProgramsDialog |
7345 | |
6720 self.programsDialog = ProgramsDialog(self) | 7346 self.programsDialog = ProgramsDialog(self) |
6721 self.programsDialog.show() | 7347 self.programsDialog.show() |
6722 | 7348 |
6723 def __configViewProfiles(self): | 7349 def __configViewProfiles(self): |
6724 """ | 7350 """ |
6725 Private slot to configure the various view profiles. | 7351 Private slot to configure the various view profiles. |
6726 """ | 7352 """ |
6727 from Preferences.ViewProfileDialog import ViewProfileDialog | 7353 from Preferences.ViewProfileDialog import ViewProfileDialog |
6728 dlg = ViewProfileDialog(self.__layoutType, self.profiles['edit'][1], | 7354 |
6729 self.profiles['debug'][1]) | 7355 dlg = ViewProfileDialog( |
7356 self.__layoutType, self.profiles["edit"][1], self.profiles["debug"][1] | |
7357 ) | |
6730 if dlg.exec() == QDialog.DialogCode.Accepted: | 7358 if dlg.exec() == QDialog.DialogCode.Accepted: |
6731 edit, debug = dlg.getVisibilities() | 7359 edit, debug = dlg.getVisibilities() |
6732 self.profiles['edit'][1] = edit | 7360 self.profiles["edit"][1] = edit |
6733 self.profiles['debug'][1] = debug | 7361 self.profiles["debug"][1] = debug |
6734 Preferences.setUI("ViewProfiles", self.profiles) | 7362 Preferences.setUI("ViewProfiles", self.profiles) |
6735 if self.currentProfile == "edit": | 7363 if self.currentProfile == "edit": |
6736 self.__setEditProfile(False) | 7364 self.__setEditProfile(False) |
6737 elif self.currentProfile == "debug": | 7365 elif self.currentProfile == "debug": |
6738 self.setDebugProfile(False) | 7366 self.setDebugProfile(False) |
6739 | 7367 |
6740 def __configToolBars(self): | 7368 def __configToolBars(self): |
6741 """ | 7369 """ |
6742 Private slot to configure the various toolbars. | 7370 Private slot to configure the various toolbars. |
6743 """ | 7371 """ |
6744 from EricWidgets.EricToolBarDialog import EricToolBarDialog | 7372 from EricWidgets.EricToolBarDialog import EricToolBarDialog |
7373 | |
6745 dlg = EricToolBarDialog(self.toolbarManager) | 7374 dlg = EricToolBarDialog(self.toolbarManager) |
6746 if dlg.exec() == QDialog.DialogCode.Accepted: | 7375 if dlg.exec() == QDialog.DialogCode.Accepted: |
6747 Preferences.setUI( | 7376 Preferences.setUI("ToolbarManagerState", self.toolbarManager.saveState()) |
6748 "ToolbarManagerState", self.toolbarManager.saveState()) | 7377 |
6749 | |
6750 def __configShortcuts(self): | 7378 def __configShortcuts(self): |
6751 """ | 7379 """ |
6752 Private slot to configure the keyboard shortcuts. | 7380 Private slot to configure the keyboard shortcuts. |
6753 """ | 7381 """ |
6754 if self.shortcutsDialog is None: | 7382 if self.shortcutsDialog is None: |
6755 from Preferences.ShortcutsDialog import ShortcutsDialog | 7383 from Preferences.ShortcutsDialog import ShortcutsDialog |
7384 | |
6756 self.shortcutsDialog = ShortcutsDialog(self) | 7385 self.shortcutsDialog = ShortcutsDialog(self) |
6757 self.shortcutsDialog.populate() | 7386 self.shortcutsDialog.populate() |
6758 self.shortcutsDialog.show() | 7387 self.shortcutsDialog.show() |
6759 | 7388 |
6760 def __exportShortcuts(self): | 7389 def __exportShortcuts(self): |
6761 """ | 7390 """ |
6762 Private slot to export the keyboard shortcuts. | 7391 Private slot to export the keyboard shortcuts. |
6763 """ | 7392 """ |
6764 fn, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( | 7393 fn, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
6765 None, | 7394 None, |
6766 self.tr("Export Keyboard Shortcuts"), | 7395 self.tr("Export Keyboard Shortcuts"), |
6767 "", | 7396 "", |
6768 self.tr("Keyboard Shortcuts File (*.ekj)"), | 7397 self.tr("Keyboard Shortcuts File (*.ekj)"), |
6769 "", | 7398 "", |
6770 EricFileDialog.DontConfirmOverwrite) | 7399 EricFileDialog.DontConfirmOverwrite, |
6771 | 7400 ) |
7401 | |
6772 if not fn: | 7402 if not fn: |
6773 return | 7403 return |
6774 | 7404 |
6775 fpath = pathlib.Path(fn) | 7405 fpath = pathlib.Path(fn) |
6776 if not fpath.suffix: | 7406 if not fpath.suffix: |
6777 ex = selectedFilter.split("(*")[1].split(")")[0] | 7407 ex = selectedFilter.split("(*")[1].split(")")[0] |
6778 if ex: | 7408 if ex: |
6779 fpath = fpath.with_suffix(ex) | 7409 fpath = fpath.with_suffix(ex) |
6780 | 7410 |
6781 ok = ( | 7411 ok = ( |
6782 EricMessageBox.yesNo( | 7412 EricMessageBox.yesNo( |
6783 self, | 7413 self, |
6784 self.tr("Export Keyboard Shortcuts"), | 7414 self.tr("Export Keyboard Shortcuts"), |
6785 self.tr("""<p>The keyboard shortcuts file <b>{0}</b> exists""" | 7415 self.tr( |
6786 """ already. Overwrite it?</p>""").format(fpath)) | 7416 """<p>The keyboard shortcuts file <b>{0}</b> exists""" |
6787 if fpath.exists() else | 7417 """ already. Overwrite it?</p>""" |
6788 True | 7418 ).format(fpath), |
6789 ) | 7419 ) |
6790 | 7420 if fpath.exists() |
7421 else True | |
7422 ) | |
7423 | |
6791 if ok: | 7424 if ok: |
6792 from Preferences import Shortcuts | 7425 from Preferences import Shortcuts |
7426 | |
6793 Shortcuts.exportShortcuts(str(fpath)) | 7427 Shortcuts.exportShortcuts(str(fpath)) |
6794 | 7428 |
6795 def __importShortcuts(self): | 7429 def __importShortcuts(self): |
6796 """ | 7430 """ |
6797 Private slot to import the keyboard shortcuts. | 7431 Private slot to import the keyboard shortcuts. |
6798 """ | 7432 """ |
6799 fn = EricFileDialog.getOpenFileName( | 7433 fn = EricFileDialog.getOpenFileName( |
6800 None, | 7434 None, |
6801 self.tr("Import Keyboard Shortcuts"), | 7435 self.tr("Import Keyboard Shortcuts"), |
6802 "", | 7436 "", |
6803 self.tr("Keyboard Shortcuts File (*.ekj);;" | 7437 self.tr( |
6804 "XML Keyboard shortcut file (*.e4k)")) | 7438 "Keyboard Shortcuts File (*.ekj);;" "XML Keyboard shortcut file (*.e4k)" |
6805 | 7439 ), |
7440 ) | |
7441 | |
6806 if fn: | 7442 if fn: |
6807 from Preferences import Shortcuts | 7443 from Preferences import Shortcuts |
7444 | |
6808 Shortcuts.importShortcuts(fn) | 7445 Shortcuts.importShortcuts(fn) |
6809 | 7446 |
6810 def __showCertificatesDialog(self): | 7447 def __showCertificatesDialog(self): |
6811 """ | 7448 """ |
6812 Private slot to show the certificates management dialog. | 7449 Private slot to show the certificates management dialog. |
6813 """ | 7450 """ |
6814 from EricNetwork.EricSslCertificatesDialog import ( | 7451 from EricNetwork.EricSslCertificatesDialog import EricSslCertificatesDialog |
6815 EricSslCertificatesDialog | 7452 |
6816 ) | |
6817 | |
6818 dlg = EricSslCertificatesDialog(self) | 7453 dlg = EricSslCertificatesDialog(self) |
6819 dlg.exec() | 7454 dlg.exec() |
6820 | 7455 |
6821 def __clearPrivateData(self): | 7456 def __clearPrivateData(self): |
6822 """ | 7457 """ |
6823 Private slot to clear the private data lists. | 7458 Private slot to clear the private data lists. |
6824 """ | 7459 """ |
6825 from .ClearPrivateDataDialog import ClearPrivateDataDialog | 7460 from .ClearPrivateDataDialog import ClearPrivateDataDialog |
7461 | |
6826 dlg = ClearPrivateDataDialog(self) | 7462 dlg = ClearPrivateDataDialog(self) |
6827 if dlg.exec() == QDialog.DialogCode.Accepted: | 7463 if dlg.exec() == QDialog.DialogCode.Accepted: |
6828 # recent files, recent projects, recent multi projects, | 7464 # recent files, recent projects, recent multi projects, |
6829 # debug histories, shell histories | 7465 # debug histories, shell histories |
6830 (files, projects, multiProjects, debug, shell, testing, vcs, | 7466 ( |
6831 plugins) = dlg.getData() | 7467 files, |
7468 projects, | |
7469 multiProjects, | |
7470 debug, | |
7471 shell, | |
7472 testing, | |
7473 vcs, | |
7474 plugins, | |
7475 ) = dlg.getData() | |
6832 if files: | 7476 if files: |
6833 # clear list of recently opened files | 7477 # clear list of recently opened files |
6834 self.viewmanager.clearRecent() | 7478 self.viewmanager.clearRecent() |
6835 if projects: | 7479 if projects: |
6836 # clear list of recently opened projects and other histories | 7480 # clear list of recently opened projects and other histories |
6846 self.shell.clearAllHistories() | 7490 self.shell.clearAllHistories() |
6847 if testing: | 7491 if testing: |
6848 # clear the unit test histories | 7492 # clear the unit test histories |
6849 if self.__testingWidget is None: | 7493 if self.__testingWidget is None: |
6850 from Testing.TestingWidget import clearSavedHistories | 7494 from Testing.TestingWidget import clearSavedHistories |
7495 | |
6851 clearSavedHistories() | 7496 clearSavedHistories() |
6852 else: | 7497 else: |
6853 self.__testingWidget.clearRecent() | 7498 self.__testingWidget.clearRecent() |
6854 if vcs: | 7499 if vcs: |
6855 # clear the VCS related histories | 7500 # clear the VCS related histories |
6856 self.pluginManager.clearPluginsPrivateData("version_control") | 7501 self.pluginManager.clearPluginsPrivateData("version_control") |
6857 if plugins: | 7502 if plugins: |
6858 # clear private data of plug-ins not covered above | 7503 # clear private data of plug-ins not covered above |
6859 self.pluginManager.clearPluginsPrivateData("") | 7504 self.pluginManager.clearPluginsPrivateData("") |
6860 | 7505 |
6861 Preferences.syncPreferences() | 7506 Preferences.syncPreferences() |
6862 | 7507 |
6863 def __newProject(self): | 7508 def __newProject(self): |
6864 """ | 7509 """ |
6865 Private slot to handle the NewProject signal. | 7510 Private slot to handle the NewProject signal. |
6866 """ | 7511 """ |
6867 self.__setWindowCaption(project=self.project.name) | 7512 self.__setWindowCaption(project=self.project.name) |
6868 | 7513 |
6869 def __projectOpened(self): | 7514 def __projectOpened(self): |
6870 """ | 7515 """ |
6871 Private slot to handle the projectOpened signal. | 7516 Private slot to handle the projectOpened signal. |
6872 """ | 7517 """ |
6873 import Testing | 7518 import Testing |
7519 | |
6874 self.__setWindowCaption(project=self.project.name) | 7520 self.__setWindowCaption(project=self.project.name) |
6875 supported = Testing.isLanguageSupported( | 7521 supported = Testing.isLanguageSupported(self.project.getProjectLanguage()) |
6876 self.project.getProjectLanguage()) | |
6877 self.testProjectAct.setEnabled(supported) | 7522 self.testProjectAct.setEnabled(supported) |
6878 self.__testingProjectOpen = supported | 7523 self.__testingProjectOpen = supported |
6879 | 7524 |
6880 def __projectClosed(self): | 7525 def __projectClosed(self): |
6881 """ | 7526 """ |
6882 Private slot to handle the projectClosed signal. | 7527 Private slot to handle the projectClosed signal. |
6883 """ | 7528 """ |
6884 self.__setWindowCaption(project="") | 7529 self.__setWindowCaption(project="") |
6885 self.testProjectAct.setEnabled(False) | 7530 self.testProjectAct.setEnabled(False) |
6886 if not self.__testingEditorOpen: | 7531 if not self.__testingEditorOpen: |
6887 self.restartTestAct.setEnabled(False) | 7532 self.restartTestAct.setEnabled(False) |
6888 self.rerunFailedTestsAct.setEnabled(False) | 7533 self.rerunFailedTestsAct.setEnabled(False) |
6889 self.__testingProjectOpen = False | 7534 self.__testingProjectOpen = False |
6890 | 7535 |
6891 def __programChange(self, fn): | 7536 def __programChange(self, fn): |
6892 """ | 7537 """ |
6893 Private slot to handle the programChange signal. | 7538 Private slot to handle the programChange signal. |
6894 | 7539 |
6895 This primarily is here to set the currentProg variable. | 7540 This primarily is here to set the currentProg variable. |
6896 | 7541 |
6897 @param fn filename to be set as current prog (string) | 7542 @param fn filename to be set as current prog (string) |
6898 """ | 7543 """ |
6899 # Delete the old program if there was one. | 7544 # Delete the old program if there was one. |
6900 if self.currentProg is not None: | 7545 if self.currentProg is not None: |
6901 del self.currentProg | 7546 del self.currentProg |
6902 | 7547 |
6903 self.currentProg = os.path.normpath(fn) | 7548 self.currentProg = os.path.normpath(fn) |
6904 | 7549 |
6905 def __lastEditorClosed(self): | 7550 def __lastEditorClosed(self): |
6906 """ | 7551 """ |
6907 Private slot to handle the lastEditorClosed signal. | 7552 Private slot to handle the lastEditorClosed signal. |
6908 """ | 7553 """ |
6909 self.wizardsMenuAct.setEnabled(False) | 7554 self.wizardsMenuAct.setEnabled(False) |
6911 self.__testingEditorOpen = False | 7556 self.__testingEditorOpen = False |
6912 if not self.__testingProjectOpen: | 7557 if not self.__testingProjectOpen: |
6913 self.restartTestAct.setEnabled(False) | 7558 self.restartTestAct.setEnabled(False) |
6914 self.rerunFailedTestsAct.setEnabled(False) | 7559 self.rerunFailedTestsAct.setEnabled(False) |
6915 self.__setWindowCaption(editor="") | 7560 self.__setWindowCaption(editor="") |
6916 | 7561 |
6917 def __editorOpened(self, fn): | 7562 def __editorOpened(self, fn): |
6918 """ | 7563 """ |
6919 Private slot to handle the editorOpened signal. | 7564 Private slot to handle the editorOpened signal. |
6920 | 7565 |
6921 @param fn filename of the opened editor (string) | 7566 @param fn filename of the opened editor (string) |
6922 """ | 7567 """ |
6923 self.wizardsMenuAct.setEnabled( | 7568 self.wizardsMenuAct.setEnabled(len(self.__menus["wizards"].actions()) > 0) |
6924 len(self.__menus["wizards"].actions()) > 0) | 7569 |
6925 | |
6926 if fn and str(fn) != "None": | 7570 if fn and str(fn) != "None": |
6927 import Testing | 7571 import Testing |
7572 | |
6928 if Testing.isLanguageSupported( | 7573 if Testing.isLanguageSupported( |
6929 self.viewmanager.getOpenEditor(fn).getFileType() | 7574 self.viewmanager.getOpenEditor(fn).getFileType() |
6930 ): | 7575 ): |
6931 self.testScriptAct.setEnabled(True) | 7576 self.testScriptAct.setEnabled(True) |
6932 self.__testingEditorOpen = True | 7577 self.__testingEditorOpen = True |
6933 | 7578 |
6934 def __checkActions(self, editor): | 7579 def __checkActions(self, editor): |
6935 """ | 7580 """ |
6936 Private slot to check some actions for their enable/disable status. | 7581 Private slot to check some actions for their enable/disable status. |
6937 | 7582 |
6938 @param editor editor window | 7583 @param editor editor window |
6939 """ | 7584 """ |
6940 fn = editor.getFileName() if editor else None | 7585 fn = editor.getFileName() if editor else None |
6941 | 7586 |
6942 if fn: | 7587 if fn: |
6943 import Testing | 7588 import Testing |
7589 | |
6944 if Testing.isLanguageSupported(editor.getFileType()): | 7590 if Testing.isLanguageSupported(editor.getFileType()): |
6945 self.testScriptAct.setEnabled(True) | 7591 self.testScriptAct.setEnabled(True) |
6946 self.__testingEditorOpen = True | 7592 self.__testingEditorOpen = True |
6947 return | 7593 return |
6948 | 7594 |
6949 self.testScriptAct.setEnabled(False) | 7595 self.testScriptAct.setEnabled(False) |
6950 | 7596 |
6951 def __writeTasks(self): | 7597 def __writeTasks(self): |
6952 """ | 7598 """ |
6953 Private slot to write the tasks data to a JSON file (.etj). | 7599 Private slot to write the tasks data to a JSON file (.etj). |
6954 """ | 7600 """ |
6955 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") | 7601 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") |
6956 self.__tasksFile.writeFile(fn) | 7602 self.__tasksFile.writeFile(fn) |
6957 | 7603 |
6958 def __readTasks(self): | 7604 def __readTasks(self): |
6959 """ | 7605 """ |
6960 Private slot to read in the tasks file (.etj or .e6t). | 7606 Private slot to read in the tasks file (.etj or .e6t). |
6961 """ | 7607 """ |
6962 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") | 7608 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.etj") |
6968 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.e6t") | 7614 fn = os.path.join(Utilities.getConfigDir(), "eric7tasks.e6t") |
6969 if os.path.exists(fn): | 7615 if os.path.exists(fn): |
6970 f = QFile(fn) | 7616 f = QFile(fn) |
6971 if f.open(QIODevice.OpenModeFlag.ReadOnly): | 7617 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
6972 from EricXML.TasksReader import TasksReader | 7618 from EricXML.TasksReader import TasksReader |
7619 | |
6973 reader = TasksReader(f, viewer=self.taskViewer) | 7620 reader = TasksReader(f, viewer=self.taskViewer) |
6974 reader.readXML() | 7621 reader.readXML() |
6975 f.close() | 7622 f.close() |
6976 else: | 7623 else: |
6977 EricMessageBox.critical( | 7624 EricMessageBox.critical( |
6978 self, | 7625 self, |
6979 self.tr("Read Tasks"), | 7626 self.tr("Read Tasks"), |
6980 self.tr( | 7627 self.tr( |
6981 "<p>The tasks file <b>{0}</b> could not be" | 7628 "<p>The tasks file <b>{0}</b> could not be" " read.</p>" |
6982 " read.</p>") | 7629 ).format(fn), |
6983 .format(fn)) | 7630 ) |
6984 | 7631 |
6985 def __writeSession(self, filename="", crashSession=False): | 7632 def __writeSession(self, filename="", crashSession=False): |
6986 """ | 7633 """ |
6987 Private slot to write the session data to a JSON file (.esj). | 7634 Private slot to write the session data to a JSON file (.esj). |
6988 | 7635 |
6989 @param filename name of a session file to write | 7636 @param filename name of a session file to write |
6990 @type str | 7637 @type str |
6991 @param crashSession flag indicating to write a crash session file | 7638 @param crashSession flag indicating to write a crash session file |
6992 @type bool | 7639 @type bool |
6993 @return flag indicating success | 7640 @return flag indicating success |
6994 @rtype bool | 7641 @rtype bool |
6995 """ | 7642 """ |
6996 if filename: | 7643 if filename: |
6997 fn = filename | 7644 fn = filename |
6998 elif crashSession: | 7645 elif crashSession: |
6999 fn = os.path.join(Utilities.getConfigDir(), | 7646 fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj") |
7000 "eric7_crash_session.esj") | |
7001 else: | 7647 else: |
7002 fn = os.path.join(Utilities.getConfigDir(), | 7648 fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj") |
7003 "eric7session.esj") | 7649 |
7004 | |
7005 return self.__sessionFile.writeFile(fn) | 7650 return self.__sessionFile.writeFile(fn) |
7006 | 7651 |
7007 def __readSession(self, filename=""): | 7652 def __readSession(self, filename=""): |
7008 """ | 7653 """ |
7009 Private slot to read in the session file (.esj or .e5s). | 7654 Private slot to read in the session file (.esj or .e5s). |
7010 | 7655 |
7011 @param filename name of a session file to read | 7656 @param filename name of a session file to read |
7012 @type str | 7657 @type str |
7013 @return flag indicating success | 7658 @return flag indicating success |
7014 @rtype bool | 7659 @rtype bool |
7015 """ | 7660 """ |
7016 if filename: | 7661 if filename: |
7017 fn = filename | 7662 fn = filename |
7018 else: | 7663 else: |
7019 fn = os.path.join(Utilities.getConfigDir(), | 7664 fn = os.path.join(Utilities.getConfigDir(), "eric7session.esj") |
7020 "eric7session.esj") | |
7021 if not os.path.exists(fn): | 7665 if not os.path.exists(fn): |
7022 fn = os.path.join(Utilities.getConfigDir(), | 7666 fn = os.path.join(Utilities.getConfigDir(), "eric7session.e5s") |
7023 "eric7session.e5s") | |
7024 if not os.path.exists(fn): | 7667 if not os.path.exists(fn): |
7025 EricMessageBox.critical( | 7668 EricMessageBox.critical( |
7026 self, | 7669 self, |
7027 self.tr("Read Session"), | 7670 self.tr("Read Session"), |
7028 self.tr("<p>The session file <b>{0}</b> could not" | 7671 self.tr( |
7029 " be read.</p>") | 7672 "<p>The session file <b>{0}</b> could not" " be read.</p>" |
7030 .format(fn)) | 7673 ).format(fn), |
7674 ) | |
7031 fn = "" | 7675 fn = "" |
7032 | 7676 |
7033 res = False | 7677 res = False |
7034 if fn: | 7678 if fn: |
7035 if fn.endswith(".esj"): | 7679 if fn.endswith(".esj"): |
7036 # new JSON based format | 7680 # new JSON based format |
7037 self.__readingSession = True | 7681 self.__readingSession = True |
7040 else: | 7684 else: |
7041 # old XML based format | 7685 # old XML based format |
7042 f = QFile(fn) | 7686 f = QFile(fn) |
7043 if f.open(QIODevice.OpenModeFlag.ReadOnly): | 7687 if f.open(QIODevice.OpenModeFlag.ReadOnly): |
7044 from EricXML.SessionReader import SessionReader | 7688 from EricXML.SessionReader import SessionReader |
7689 | |
7045 self.__readingSession = True | 7690 self.__readingSession = True |
7046 reader = SessionReader(f, True) | 7691 reader = SessionReader(f, True) |
7047 reader.readXML() | 7692 reader.readXML() |
7048 self.__readingSession = False | 7693 self.__readingSession = False |
7049 f.close() | 7694 f.close() |
7050 res = True | 7695 res = True |
7051 else: | 7696 else: |
7052 EricMessageBox.critical( | 7697 EricMessageBox.critical( |
7053 self, | 7698 self, |
7054 self.tr("Read session"), | 7699 self.tr("Read session"), |
7055 self.tr("<p>The session file <b>{0}</b> could not be" | 7700 self.tr( |
7056 " read.</p>") | 7701 "<p>The session file <b>{0}</b> could not be" " read.</p>" |
7057 .format(fn)) | 7702 ).format(fn), |
7058 | 7703 ) |
7704 | |
7059 # Write a crash session after a session was read. | 7705 # Write a crash session after a session was read. |
7060 self.__writeCrashSession() | 7706 self.__writeCrashSession() |
7061 | 7707 |
7062 return res | 7708 return res |
7063 | 7709 |
7064 def __saveSessionToFile(self): | 7710 def __saveSessionToFile(self): |
7065 """ | 7711 """ |
7066 Private slot to save a session to disk. | 7712 Private slot to save a session to disk. |
7067 """ | 7713 """ |
7068 sessionFile, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( | 7714 sessionFile, selectedFilter = EricFileDialog.getSaveFileNameAndFilter( |
7069 self, | 7715 self, |
7070 self.tr("Save Session"), | 7716 self.tr("Save Session"), |
7071 Utilities.getHomeDir(), | 7717 Utilities.getHomeDir(), |
7072 self.tr("eric Session Files (*.esj)"), | 7718 self.tr("eric Session Files (*.esj)"), |
7073 "") | 7719 "", |
7074 | 7720 ) |
7721 | |
7075 if not sessionFile: | 7722 if not sessionFile: |
7076 return | 7723 return |
7077 | 7724 |
7078 fpath = pathlib.Path(sessionFile) | 7725 fpath = pathlib.Path(sessionFile) |
7079 if not fpath.suffix: | 7726 if not fpath.suffix: |
7080 ex = selectedFilter.split("(*")[1].split(")")[0] | 7727 ex = selectedFilter.split("(*")[1].split(")")[0] |
7081 if ex: | 7728 if ex: |
7082 fpath = fpath.with_suffix(ex) | 7729 fpath = fpath.with_suffix(ex) |
7083 | 7730 |
7084 self.__writeSession(filename=str(fpath)) | 7731 self.__writeSession(filename=str(fpath)) |
7085 | 7732 |
7086 def __loadSessionFromFile(self): | 7733 def __loadSessionFromFile(self): |
7087 """ | 7734 """ |
7088 Private slot to load a session from disk. | 7735 Private slot to load a session from disk. |
7089 """ | 7736 """ |
7090 sessionFile = EricFileDialog.getOpenFileName( | 7737 sessionFile = EricFileDialog.getOpenFileName( |
7091 self, | 7738 self, |
7092 self.tr("Load session"), | 7739 self.tr("Load session"), |
7093 Utilities.getHomeDir(), | 7740 Utilities.getHomeDir(), |
7094 self.tr("eric Session Files (*.esj);;" | 7741 self.tr("eric Session Files (*.esj);;" "eric XML Session Files (*.e5s)"), |
7095 "eric XML Session Files (*.e5s)")) | 7742 ) |
7096 | 7743 |
7097 if not sessionFile: | 7744 if not sessionFile: |
7098 return | 7745 return |
7099 | 7746 |
7100 self.__readSession(filename=sessionFile) | 7747 self.__readSession(filename=sessionFile) |
7101 | 7748 |
7102 def __deleteCrashSession(self): | 7749 def __deleteCrashSession(self): |
7103 """ | 7750 """ |
7104 Private slot to delete the crash session file. | 7751 Private slot to delete the crash session file. |
7105 """ | 7752 """ |
7106 for ext in (".esj", ".e5s"): | 7753 for ext in (".esj", ".e5s"): |
7107 fn = os.path.join(Utilities.getConfigDir(), | 7754 fn = os.path.join(Utilities.getConfigDir(), f"eric7_crash_session{ext}") |
7108 f"eric7_crash_session{ext}") | |
7109 if os.path.exists(fn): | 7755 if os.path.exists(fn): |
7110 with contextlib.suppress(OSError): | 7756 with contextlib.suppress(OSError): |
7111 os.remove(fn) | 7757 os.remove(fn) |
7112 | 7758 |
7113 def __writeCrashSession(self): | 7759 def __writeCrashSession(self): |
7114 """ | 7760 """ |
7115 Private slot to write a crash session file. | 7761 Private slot to write a crash session file. |
7116 """ | 7762 """ |
7117 if ( | 7763 if ( |
7118 not self.__readingSession and | 7764 not self.__readingSession |
7119 not self.__disableCrashSession and | 7765 and not self.__disableCrashSession |
7120 Preferences.getUI("CrashSessionEnabled") | 7766 and Preferences.getUI("CrashSessionEnabled") |
7121 ): | 7767 ): |
7122 self.__writeSession(crashSession=True) | 7768 self.__writeSession(crashSession=True) |
7123 | 7769 |
7124 def __readCrashSession(self): | 7770 def __readCrashSession(self): |
7125 """ | 7771 """ |
7126 Private method to check for and read a crash session. | 7772 Private method to check for and read a crash session. |
7127 | 7773 |
7128 @return flag indicating a crash session file was found and read | 7774 @return flag indicating a crash session file was found and read |
7129 @rtype bool | 7775 @rtype bool |
7130 """ | 7776 """ |
7131 res = False | 7777 res = False |
7132 if ( | 7778 if ( |
7133 not self.__disableCrashSession and | 7779 not self.__disableCrashSession |
7134 not self.__noCrashOpenAtStartup and | 7780 and not self.__noCrashOpenAtStartup |
7135 Preferences.getUI("OpenCrashSessionOnStartup") | 7781 and Preferences.getUI("OpenCrashSessionOnStartup") |
7136 ): | 7782 ): |
7137 fn = os.path.join(Utilities.getConfigDir(), | 7783 fn = os.path.join(Utilities.getConfigDir(), "eric7_crash_session.esj") |
7138 "eric7_crash_session.esj") | |
7139 if os.path.exists(fn): | 7784 if os.path.exists(fn): |
7140 yes = EricMessageBox.yesNo( | 7785 yes = EricMessageBox.yesNo( |
7141 self, | 7786 self, |
7142 self.tr("Crash Session found!"), | 7787 self.tr("Crash Session found!"), |
7143 self.tr("""A session file of a crashed session was""" | 7788 self.tr( |
7144 """ found. Shall this session be restored?""")) | 7789 """A session file of a crashed session was""" |
7790 """ found. Shall this session be restored?""" | |
7791 ), | |
7792 ) | |
7145 if yes: | 7793 if yes: |
7146 res = self.__readSession(filename=fn) | 7794 res = self.__readSession(filename=fn) |
7147 | 7795 |
7148 return res | 7796 return res |
7149 | 7797 |
7150 def showFindFileByNameDialog(self): | 7798 def showFindFileByNameDialog(self): |
7151 """ | 7799 """ |
7152 Public slot to show the Find File by Name dialog. | 7800 Public slot to show the Find File by Name dialog. |
7153 """ | 7801 """ |
7154 if self.findFileNameDialog is None: | 7802 if self.findFileNameDialog is None: |
7155 from .FindFileNameDialog import FindFileNameDialog | 7803 from .FindFileNameDialog import FindFileNameDialog |
7804 | |
7156 self.findFileNameDialog = FindFileNameDialog(self.project) | 7805 self.findFileNameDialog = FindFileNameDialog(self.project) |
7157 self.findFileNameDialog.sourceFile.connect( | 7806 self.findFileNameDialog.sourceFile.connect(self.viewmanager.openSourceFile) |
7158 self.viewmanager.openSourceFile) | |
7159 self.findFileNameDialog.designerFile.connect(self.__designer) | 7807 self.findFileNameDialog.designerFile.connect(self.__designer) |
7160 self.findFileNameDialog.show() | 7808 self.findFileNameDialog.show() |
7161 self.findFileNameDialog.raise_() | 7809 self.findFileNameDialog.raise_() |
7162 self.findFileNameDialog.activateWindow() | 7810 self.findFileNameDialog.activateWindow() |
7163 | 7811 |
7164 def showFindFilesWidget(self, txt="", searchDir="", openFiles=False): | 7812 def showFindFilesWidget(self, txt="", searchDir="", openFiles=False): |
7165 """ | 7813 """ |
7166 Public slot to show the Find In Files widget. | 7814 Public slot to show the Find In Files widget. |
7167 | 7815 |
7168 @param txt text to search for (defaults to "") | 7816 @param txt text to search for (defaults to "") |
7169 @type str (optional) | 7817 @type str (optional) |
7170 @param searchDir directory to search in (defaults to "") | 7818 @param searchDir directory to search in (defaults to "") |
7171 @type str (optional) | 7819 @type str (optional) |
7172 @param openFiles flag indicating to operate on open files only | 7820 @param openFiles flag indicating to operate on open files only |
7175 """ | 7823 """ |
7176 if Preferences.getUI("ShowFindFileWidget"): | 7824 if Preferences.getUI("ShowFindFileWidget"): |
7177 # embedded tool | 7825 # embedded tool |
7178 self.__activateFindFileWidget() | 7826 self.__activateFindFileWidget() |
7179 self.__findFileWidget.activate( | 7827 self.__findFileWidget.activate( |
7180 replaceMode=False, txt=txt, searchDir=searchDir, | 7828 replaceMode=False, txt=txt, searchDir=searchDir, openFiles=openFiles |
7181 openFiles=openFiles) | 7829 ) |
7182 else: | 7830 else: |
7183 # external dialog | 7831 # external dialog |
7184 if self.__findFileDialog is None: | 7832 if self.__findFileDialog is None: |
7185 from .FindFileWidget import FindFileDialog | 7833 from .FindFileWidget import FindFileDialog |
7834 | |
7186 self.__findFileDialog = FindFileDialog(self.project, self) | 7835 self.__findFileDialog = FindFileDialog(self.project, self) |
7187 self.__findFileDialog.sourceFile.connect( | 7836 self.__findFileDialog.sourceFile.connect( |
7188 self.viewmanager.openSourceFile) | 7837 self.viewmanager.openSourceFile |
7838 ) | |
7189 self.__findFileDialog.designerFile.connect(self.__designer) | 7839 self.__findFileDialog.designerFile.connect(self.__designer) |
7190 self.__findFileDialog.linguistFile.connect(self.__linguist) | 7840 self.__findFileDialog.linguistFile.connect(self.__linguist) |
7191 self.__findFileDialog.trpreview.connect(self.__TRPreviewer) | 7841 self.__findFileDialog.trpreview.connect(self.__TRPreviewer) |
7192 self.__findFileDialog.pixmapFile.connect(self.__showPixmap) | 7842 self.__findFileDialog.pixmapFile.connect(self.__showPixmap) |
7193 self.__findFileDialog.svgFile.connect(self.__showSvg) | 7843 self.__findFileDialog.svgFile.connect(self.__showSvg) |
7194 self.__findFileDialog.umlFile.connect(self.__showUml) | 7844 self.__findFileDialog.umlFile.connect(self.__showUml) |
7195 self.__findFileDialog.activate( | 7845 self.__findFileDialog.activate( |
7196 replaceMode=False, txt=txt, searchDir=searchDir, | 7846 replaceMode=False, txt=txt, searchDir=searchDir, openFiles=openFiles |
7197 openFiles=openFiles) | 7847 ) |
7198 | 7848 |
7199 def showReplaceFilesWidget(self, txt="", searchDir="", openFiles=False): | 7849 def showReplaceFilesWidget(self, txt="", searchDir="", openFiles=False): |
7200 """ | 7850 """ |
7201 Public slot to show the Find In Files widget in replace mode. | 7851 Public slot to show the Find In Files widget in replace mode. |
7202 | 7852 |
7203 @param txt text to search for (defaults to "") | 7853 @param txt text to search for (defaults to "") |
7204 @type str (optional) | 7854 @type str (optional) |
7205 @param searchDir directory to search in (defaults to "") | 7855 @param searchDir directory to search in (defaults to "") |
7206 @type str (optional) | 7856 @type str (optional) |
7207 @param openFiles flag indicating to operate on open files only | 7857 @param openFiles flag indicating to operate on open files only |
7210 """ | 7860 """ |
7211 if Preferences.getUI("ShowFindFileWidget"): | 7861 if Preferences.getUI("ShowFindFileWidget"): |
7212 # embedded tool | 7862 # embedded tool |
7213 self.__activateFindFileWidget() | 7863 self.__activateFindFileWidget() |
7214 self.__findFileWidget.activate( | 7864 self.__findFileWidget.activate( |
7215 replaceMode=True, txt=txt, searchDir=searchDir, | 7865 replaceMode=True, txt=txt, searchDir=searchDir, openFiles=openFiles |
7216 openFiles=openFiles) | 7866 ) |
7217 else: | 7867 else: |
7218 # external dialog | 7868 # external dialog |
7219 if self.__replaceFileDialog is None: | 7869 if self.__replaceFileDialog is None: |
7220 from .FindFileWidget import FindFileDialog | 7870 from .FindFileWidget import FindFileDialog |
7871 | |
7221 self.__replaceFileDialog = FindFileDialog(self.project, self) | 7872 self.__replaceFileDialog = FindFileDialog(self.project, self) |
7222 self.__replaceFileDialog.sourceFile.connect( | 7873 self.__replaceFileDialog.sourceFile.connect( |
7223 self.viewmanager.openSourceFile) | 7874 self.viewmanager.openSourceFile |
7875 ) | |
7224 self.__replaceFileDialog.designerFile.connect(self.__designer) | 7876 self.__replaceFileDialog.designerFile.connect(self.__designer) |
7225 self.__replaceFileDialog.linguistFile.connect(self.__linguist) | 7877 self.__replaceFileDialog.linguistFile.connect(self.__linguist) |
7226 self.__replaceFileDialog.trpreview.connect(self.__TRPreviewer) | 7878 self.__replaceFileDialog.trpreview.connect(self.__TRPreviewer) |
7227 self.__replaceFileDialog.pixmapFile.connect(self.__showPixmap) | 7879 self.__replaceFileDialog.pixmapFile.connect(self.__showPixmap) |
7228 self.__replaceFileDialog.svgFile.connect(self.__showSvg) | 7880 self.__replaceFileDialog.svgFile.connect(self.__showSvg) |
7229 self.__replaceFileDialog.umlFile.connect(self.__showUml) | 7881 self.__replaceFileDialog.umlFile.connect(self.__showUml) |
7230 self.__replaceFileDialog.activate( | 7882 self.__replaceFileDialog.activate( |
7231 replaceMode=True, txt=txt, searchDir=searchDir, | 7883 replaceMode=True, txt=txt, searchDir=searchDir, openFiles=openFiles |
7232 openFiles=openFiles) | 7884 ) |
7233 | 7885 |
7234 def __activateFindFileWidget(self): | 7886 def __activateFindFileWidget(self): |
7235 """ | 7887 """ |
7236 Private slot to activate the Find In Files widget. | 7888 Private slot to activate the Find In Files widget. |
7237 """ | 7889 """ |
7238 if self.__layoutType == "Toolboxes": | 7890 if self.__layoutType == "Toolboxes": |
7239 self.lToolboxDock.show() | 7891 self.lToolboxDock.show() |
7240 self.lToolbox.setCurrentWidget(self.__findFileWidget) | 7892 self.lToolbox.setCurrentWidget(self.__findFileWidget) |
7241 elif self.__layoutType == "Sidebars": | 7893 elif self.__layoutType == "Sidebars": |
7242 self.leftSidebar.show() | 7894 self.leftSidebar.show() |
7243 self.leftSidebar.setCurrentWidget(self.__findFileWidget) | 7895 self.leftSidebar.setCurrentWidget(self.__findFileWidget) |
7244 self.__findFileWidget.setFocus( | 7896 self.__findFileWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7245 Qt.FocusReason.ActiveWindowFocusReason) | 7897 |
7246 | |
7247 self.__findFileWidget.activate() | 7898 self.__findFileWidget.activate() |
7248 | 7899 |
7249 def showFindLocationWidget(self): | 7900 def showFindLocationWidget(self): |
7250 """ | 7901 """ |
7251 Public method to show the Find File widget. | 7902 Public method to show the Find File widget. |
7252 """ | 7903 """ |
7253 if Preferences.getUI("ShowFindLocationWidget"): | 7904 if Preferences.getUI("ShowFindLocationWidget"): |
7255 self.__activateFindLocationWidget() | 7906 self.__activateFindLocationWidget() |
7256 else: | 7907 else: |
7257 # external dialog | 7908 # external dialog |
7258 if self.__findLocationDialog is None: | 7909 if self.__findLocationDialog is None: |
7259 from .FindLocationWidget import FindLocationDialog | 7910 from .FindLocationWidget import FindLocationDialog |
7260 self.__findLocationDialog = FindLocationDialog(self.project, | 7911 |
7261 self) | 7912 self.__findLocationDialog = FindLocationDialog(self.project, self) |
7262 self.__findLocationDialog.sourceFile.connect( | 7913 self.__findLocationDialog.sourceFile.connect( |
7263 self.viewmanager.openSourceFile) | 7914 self.viewmanager.openSourceFile |
7915 ) | |
7264 self.__findLocationDialog.designerFile.connect(self.__designer) | 7916 self.__findLocationDialog.designerFile.connect(self.__designer) |
7265 self.__findLocationDialog.linguistFile.connect(self.__linguist) | 7917 self.__findLocationDialog.linguistFile.connect(self.__linguist) |
7266 self.__findLocationDialog.trpreview.connect(self.__TRPreviewer) | 7918 self.__findLocationDialog.trpreview.connect(self.__TRPreviewer) |
7267 self.__findLocationDialog.pixmapFile.connect(self.__showPixmap) | 7919 self.__findLocationDialog.pixmapFile.connect(self.__showPixmap) |
7268 self.__findLocationDialog.svgFile.connect(self.__showSvg) | 7920 self.__findLocationDialog.svgFile.connect(self.__showSvg) |
7269 self.__findLocationDialog.umlFile.connect(self.__showUml) | 7921 self.__findLocationDialog.umlFile.connect(self.__showUml) |
7270 self.__findLocationDialog.activate() | 7922 self.__findLocationDialog.activate() |
7271 | 7923 |
7272 def __activateFindLocationWidget(self): | 7924 def __activateFindLocationWidget(self): |
7273 """ | 7925 """ |
7274 Private method to activate the Find File widget. | 7926 Private method to activate the Find File widget. |
7275 """ | 7927 """ |
7276 if self.__layoutType == "Toolboxes": | 7928 if self.__layoutType == "Toolboxes": |
7277 self.lToolboxDock.show() | 7929 self.lToolboxDock.show() |
7278 self.lToolbox.setCurrentWidget(self.__findLocationWidget) | 7930 self.lToolbox.setCurrentWidget(self.__findLocationWidget) |
7279 elif self.__layoutType == "Sidebars": | 7931 elif self.__layoutType == "Sidebars": |
7280 self.leftSidebar.show() | 7932 self.leftSidebar.show() |
7281 self.leftSidebar.setCurrentWidget(self.__findLocationWidget) | 7933 self.leftSidebar.setCurrentWidget(self.__findLocationWidget) |
7282 self.__findLocationWidget.setFocus( | 7934 self.__findLocationWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7283 Qt.FocusReason.ActiveWindowFocusReason) | 7935 |
7284 | |
7285 self.__findLocationWidget.activate() | 7936 self.__findLocationWidget.activate() |
7286 | 7937 |
7287 def __activateVcsStatusList(self): | 7938 def __activateVcsStatusList(self): |
7288 """ | 7939 """ |
7289 Private slot to activate the VCS Status List. | 7940 Private slot to activate the VCS Status List. |
7290 """ | 7941 """ |
7291 if self.__layoutType == "Toolboxes": | 7942 if self.__layoutType == "Toolboxes": |
7292 self.lToolboxDock.show() | 7943 self.lToolboxDock.show() |
7293 self.lToolbox.setCurrentWidget(self.__vcsStatusWidget) | 7944 self.lToolbox.setCurrentWidget(self.__vcsStatusWidget) |
7294 elif self.__layoutType == "Sidebars": | 7945 elif self.__layoutType == "Sidebars": |
7295 self.leftSidebar.show() | 7946 self.leftSidebar.show() |
7296 self.leftSidebar.setCurrentWidget(self.__vcsStatusWidget) | 7947 self.leftSidebar.setCurrentWidget(self.__vcsStatusWidget) |
7297 self.__vcsStatusWidget.setFocus( | 7948 self.__vcsStatusWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7298 Qt.FocusReason.ActiveWindowFocusReason) | 7949 |
7299 | |
7300 def __activateHelpViewerWidget(self, urlStr=None): | 7950 def __activateHelpViewerWidget(self, urlStr=None): |
7301 """ | 7951 """ |
7302 Private method to activate the embedded Help Viewer window. | 7952 Private method to activate the embedded Help Viewer window. |
7303 | 7953 |
7304 @param urlStr URL to be shown | 7954 @param urlStr URL to be shown |
7305 @type str | 7955 @type str |
7306 """ | 7956 """ |
7307 if self.__helpViewerWidget is not None: | 7957 if self.__helpViewerWidget is not None: |
7308 if self.__layoutType == "Toolboxes": | 7958 if self.__layoutType == "Toolboxes": |
7309 self.rToolboxDock.show() | 7959 self.rToolboxDock.show() |
7310 self.rToolbox.setCurrentWidget(self.__helpViewerWidget) | 7960 self.rToolbox.setCurrentWidget(self.__helpViewerWidget) |
7311 elif self.__layoutType == "Sidebars": | 7961 elif self.__layoutType == "Sidebars": |
7312 self.__activateLeftRightSidebarWidget(self.__helpViewerWidget) | 7962 self.__activateLeftRightSidebarWidget(self.__helpViewerWidget) |
7313 self.__helpViewerWidget.setFocus( | 7963 self.__helpViewerWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7314 Qt.FocusReason.ActiveWindowFocusReason) | 7964 |
7315 | |
7316 url = None | 7965 url = None |
7317 searchWord = None | 7966 searchWord = None |
7318 | 7967 |
7319 if urlStr: | 7968 if urlStr: |
7320 url = QUrl(urlStr) | 7969 url = QUrl(urlStr) |
7321 if not url.isValid(): | 7970 if not url.isValid(): |
7322 url = None | 7971 url = None |
7323 | 7972 |
7324 if url is None: | 7973 if url is None: |
7325 searchWord = self.viewmanager.textForFind(False) | 7974 searchWord = self.viewmanager.textForFind(False) |
7326 if searchWord == "": | 7975 if searchWord == "": |
7327 searchWord = None | 7976 searchWord = None |
7328 | 7977 |
7329 self.__helpViewerWidget.activate(searchWord=searchWord, url=url) | 7978 self.__helpViewerWidget.activate(searchWord=searchWord, url=url) |
7330 | 7979 |
7331 ########################################################## | 7980 ########################################################## |
7332 ## Below are slots to handle StdOut and StdErr | 7981 ## Below are slots to handle StdOut and StdErr |
7333 ########################################################## | 7982 ########################################################## |
7334 | 7983 |
7335 def appendToStdout(self, s): | 7984 def appendToStdout(self, s): |
7336 """ | 7985 """ |
7337 Public slot to append text to the stdout log viewer tab. | 7986 Public slot to append text to the stdout log viewer tab. |
7338 | 7987 |
7339 @param s output to be appended (string) | 7988 @param s output to be appended (string) |
7340 """ | 7989 """ |
7341 self.appendStdout.emit(s) | 7990 self.appendStdout.emit(s) |
7342 | 7991 |
7343 def appendToStderr(self, s): | 7992 def appendToStderr(self, s): |
7344 """ | 7993 """ |
7345 Public slot to append text to the stderr log viewer tab. | 7994 Public slot to append text to the stderr log viewer tab. |
7346 | 7995 |
7347 @param s output to be appended (string) | 7996 @param s output to be appended (string) |
7348 """ | 7997 """ |
7349 self.appendStderr.emit(s) | 7998 self.appendStderr.emit(s) |
7350 | 7999 |
7351 ########################################################## | 8000 ########################################################## |
7352 ## Below are slots needed by the plugin menu | 8001 ## Below are slots needed by the plugin menu |
7353 ########################################################## | 8002 ########################################################## |
7354 | 8003 |
7355 def __showPluginInfo(self): | 8004 def __showPluginInfo(self): |
7356 """ | 8005 """ |
7357 Private slot to show the plugin info dialog. | 8006 Private slot to show the plugin info dialog. |
7358 """ | 8007 """ |
7359 from PluginManager.PluginInfoDialog import PluginInfoDialog | 8008 from PluginManager.PluginInfoDialog import PluginInfoDialog |
8009 | |
7360 self.__pluginInfoDialog = PluginInfoDialog(self.pluginManager, self) | 8010 self.__pluginInfoDialog = PluginInfoDialog(self.pluginManager, self) |
7361 self.__pluginInfoDialog.show() | 8011 self.__pluginInfoDialog.show() |
7362 | 8012 |
7363 @pyqtSlot() | 8013 @pyqtSlot() |
7364 def __installPlugins(self, pluginFileNames=None): | 8014 def __installPlugins(self, pluginFileNames=None): |
7365 """ | 8015 """ |
7366 Private slot to show a dialog to install a new plugin. | 8016 Private slot to show a dialog to install a new plugin. |
7367 | 8017 |
7368 @param pluginFileNames list of plugin files suggested for | 8018 @param pluginFileNames list of plugin files suggested for |
7369 installation list of strings | 8019 installation list of strings |
7370 """ | 8020 """ |
7371 from PluginManager.PluginInstallDialog import PluginInstallDialog | 8021 from PluginManager.PluginInstallDialog import PluginInstallDialog |
8022 | |
7372 self.__pluginInstallDialog = PluginInstallDialog( | 8023 self.__pluginInstallDialog = PluginInstallDialog( |
7373 self.pluginManager, | 8024 self.pluginManager, |
7374 [] if pluginFileNames is None else pluginFileNames[:], | 8025 [] if pluginFileNames is None else pluginFileNames[:], |
7375 self) | 8026 self, |
8027 ) | |
7376 self.__pluginInstallDialog.setModal(False) | 8028 self.__pluginInstallDialog.setModal(False) |
7377 self.__pluginInstallDialog.finished.connect( | 8029 self.__pluginInstallDialog.finished.connect(self.__pluginInstallFinished) |
7378 self.__pluginInstallFinished) | |
7379 self.__pluginInstallDialog.show() | 8030 self.__pluginInstallDialog.show() |
7380 | 8031 |
7381 @pyqtSlot() | 8032 @pyqtSlot() |
7382 def __pluginInstallFinished(self): | 8033 def __pluginInstallFinished(self): |
7383 """ | 8034 """ |
7384 Private slot to handle the finishing of the plugin install dialog. | 8035 Private slot to handle the finishing of the plugin install dialog. |
7385 """ | 8036 """ |
7386 if self.__pluginInstallDialog.restartNeeded(): | 8037 if self.__pluginInstallDialog.restartNeeded(): |
7387 self.__pluginInstallDialog.deleteLater() | 8038 self.__pluginInstallDialog.deleteLater() |
7388 del self.__pluginInstallDialog | 8039 del self.__pluginInstallDialog |
7389 self.__restart(ask=True) | 8040 self.__restart(ask=True) |
7390 | 8041 |
7391 self.pluginRepositoryViewer.reloadList() | 8042 self.pluginRepositoryViewer.reloadList() |
7392 | 8043 |
7393 def __deinstallPlugin(self): | 8044 def __deinstallPlugin(self): |
7394 """ | 8045 """ |
7395 Private slot to show a dialog to uninstall a plugin. | 8046 Private slot to show a dialog to uninstall a plugin. |
7396 """ | 8047 """ |
7397 from PluginManager.PluginUninstallDialog import PluginUninstallDialog | 8048 from PluginManager.PluginUninstallDialog import PluginUninstallDialog |
8049 | |
7398 dlg = PluginUninstallDialog(self.pluginManager, self) | 8050 dlg = PluginUninstallDialog(self.pluginManager, self) |
7399 dlg.exec() | 8051 dlg.exec() |
7400 | 8052 |
7401 @pyqtSlot() | 8053 @pyqtSlot() |
7402 def __showPluginsAvailable(self): | 8054 def __showPluginsAvailable(self): |
7403 """ | 8055 """ |
7404 Private slot to show the plugins available for download. | 8056 Private slot to show the plugins available for download. |
7405 """ | 8057 """ |
7406 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog | 8058 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog |
8059 | |
7407 dlg = PluginRepositoryDialog(self.pluginManager, self) | 8060 dlg = PluginRepositoryDialog(self.pluginManager, self) |
7408 res = dlg.exec() | 8061 res = dlg.exec() |
7409 if res == (QDialog.DialogCode.Accepted + 1): | 8062 if res == (QDialog.DialogCode.Accepted + 1): |
7410 self.__installPlugins(dlg.getDownloadedPlugins()) | 8063 self.__installPlugins(dlg.getDownloadedPlugins()) |
7411 | 8064 |
7412 def __pluginsConfigure(self): | 8065 def __pluginsConfigure(self): |
7413 """ | 8066 """ |
7414 Private slot to show the plugin manager configuration page. | 8067 Private slot to show the plugin manager configuration page. |
7415 """ | 8068 """ |
7416 self.showPreferences("pluginManagerPage") | 8069 self.showPreferences("pluginManagerPage") |
7417 | 8070 |
7418 def checkPluginUpdatesAvailable(self): | 8071 def checkPluginUpdatesAvailable(self): |
7419 """ | 8072 """ |
7420 Public method to check the availability of updates of plug-ins. | 8073 Public method to check the availability of updates of plug-ins. |
7421 """ | 8074 """ |
7422 if self.isOnline(): | 8075 if self.isOnline(): |
7423 self.pluginManager.checkPluginUpdatesAvailable() | 8076 self.pluginManager.checkPluginUpdatesAvailable() |
7424 | 8077 |
7425 @pyqtSlot() | 8078 @pyqtSlot() |
7426 def __installDownloadedPlugins(self): | 8079 def __installDownloadedPlugins(self): |
7427 """ | 8080 """ |
7428 Private slot to handle the installation of plugins downloaded via the | 8081 Private slot to handle the installation of plugins downloaded via the |
7429 plugin repository viewer. | 8082 plugin repository viewer. |
7430 """ | 8083 """ |
7431 self.__installPlugins( | 8084 self.__installPlugins(self.pluginRepositoryViewer.getDownloadedPlugins()) |
7432 self.pluginRepositoryViewer.getDownloadedPlugins()) | 8085 |
7433 | |
7434 @pyqtSlot() | 8086 @pyqtSlot() |
7435 def activatePluginRepositoryViewer(self): | 8087 def activatePluginRepositoryViewer(self): |
7436 """ | 8088 """ |
7437 Public slot to activate the plugin repository viewer. | 8089 Public slot to activate the plugin repository viewer. |
7438 """ | 8090 """ |
7439 self.pluginRepositoryViewer.reloadList() | 8091 self.pluginRepositoryViewer.reloadList() |
7440 | 8092 |
7441 if self.__layoutType == "Toolboxes": | 8093 if self.__layoutType == "Toolboxes": |
7442 self.rToolboxDock.show() | 8094 self.rToolboxDock.show() |
7443 self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer) | 8095 self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer) |
7444 elif self.__layoutType == "Sidebars": | 8096 elif self.__layoutType == "Sidebars": |
7445 self.__activateLeftRightSidebarWidget(self.pluginRepositoryViewer) | 8097 self.__activateLeftRightSidebarWidget(self.pluginRepositoryViewer) |
7446 self.pluginRepositoryViewer.setFocus( | 8098 self.pluginRepositoryViewer.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7447 Qt.FocusReason.ActiveWindowFocusReason) | 8099 |
7448 | |
7449 ################################################################# | 8100 ################################################################# |
7450 ## Drag and Drop Support | 8101 ## Drag and Drop Support |
7451 ################################################################# | 8102 ################################################################# |
7452 | 8103 |
7453 def dragEnterEvent(self, event): | 8104 def dragEnterEvent(self, event): |
7454 """ | 8105 """ |
7455 Protected method to handle the drag enter event. | 8106 Protected method to handle the drag enter event. |
7456 | 8107 |
7457 @param event the drag enter event (QDragEnterEvent) | 8108 @param event the drag enter event (QDragEnterEvent) |
7458 """ | 8109 """ |
7459 self.inDragDrop = event.mimeData().hasUrls() | 8110 self.inDragDrop = event.mimeData().hasUrls() |
7460 if self.inDragDrop: | 8111 if self.inDragDrop: |
7461 event.acceptProposedAction() | 8112 event.acceptProposedAction() |
7462 | 8113 |
7463 def dragMoveEvent(self, event): | 8114 def dragMoveEvent(self, event): |
7464 """ | 8115 """ |
7465 Protected method to handle the drag move event. | 8116 Protected method to handle the drag move event. |
7466 | 8117 |
7467 @param event the drag move event (QDragMoveEvent) | 8118 @param event the drag move event (QDragMoveEvent) |
7468 """ | 8119 """ |
7469 if self.inDragDrop: | 8120 if self.inDragDrop: |
7470 event.acceptProposedAction() | 8121 event.acceptProposedAction() |
7471 | 8122 |
7472 def dragLeaveEvent(self, event): | 8123 def dragLeaveEvent(self, event): |
7473 """ | 8124 """ |
7474 Protected method to handle the drag leave event. | 8125 Protected method to handle the drag leave event. |
7475 | 8126 |
7476 @param event the drag leave event (QDragLeaveEvent) | 8127 @param event the drag leave event (QDragLeaveEvent) |
7477 """ | 8128 """ |
7478 if self.inDragDrop: | 8129 if self.inDragDrop: |
7479 self.inDragDrop = False | 8130 self.inDragDrop = False |
7480 | 8131 |
7481 def dropEvent(self, event): | 8132 def dropEvent(self, event): |
7482 """ | 8133 """ |
7483 Protected method to handle the drop event. | 8134 Protected method to handle the drop event. |
7484 | 8135 |
7485 @param event the drop event (QDropEvent) | 8136 @param event the drop event (QDropEvent) |
7486 """ | 8137 """ |
7487 if event.mimeData().hasUrls(): | 8138 if event.mimeData().hasUrls(): |
7488 event.acceptProposedAction() | 8139 event.acceptProposedAction() |
7489 for url in event.mimeData().urls(): | 8140 for url in event.mimeData().urls(): |
7493 self.viewmanager.openSourceFile(fname) | 8144 self.viewmanager.openSourceFile(fname) |
7494 else: | 8145 else: |
7495 EricMessageBox.information( | 8146 EricMessageBox.information( |
7496 self, | 8147 self, |
7497 self.tr("Drop Error"), | 8148 self.tr("Drop Error"), |
7498 self.tr("""<p><b>{0}</b> is not a file.</p>""") | 8149 self.tr("""<p><b>{0}</b> is not a file.</p>""").format( |
7499 .format(fname)) | 8150 fname |
7500 | 8151 ), |
8152 ) | |
8153 | |
7501 self.inDragDrop = False | 8154 self.inDragDrop = False |
7502 | 8155 |
7503 ########################################################## | 8156 ########################################################## |
7504 ## Below are methods needed for shutting down the IDE | 8157 ## Below are methods needed for shutting down the IDE |
7505 ########################################################## | 8158 ########################################################## |
7506 | 8159 |
7507 def closeEvent(self, event): | 8160 def closeEvent(self, event): |
7508 """ | 8161 """ |
7509 Protected event handler for the close event. | 8162 Protected event handler for the close event. |
7510 | 8163 |
7511 This event handler saves the preferences. | 8164 This event handler saves the preferences. |
7512 | 8165 |
7513 @param event close event (QCloseEvent) | 8166 @param event close event (QCloseEvent) |
7514 """ | 8167 """ |
7515 if self.__shutdown(): | 8168 if self.__shutdown(): |
7516 event.accept() | 8169 event.accept() |
7517 if not self.inCloseEvent: | 8170 if not self.inCloseEvent: |
7521 event.ignore() | 8174 event.ignore() |
7522 | 8175 |
7523 def __shutdown(self): | 8176 def __shutdown(self): |
7524 """ | 8177 """ |
7525 Private method to perform all necessary steps to close down the IDE. | 8178 Private method to perform all necessary steps to close down the IDE. |
7526 | 8179 |
7527 @return flag indicating success | 8180 @return flag indicating success |
7528 """ | 8181 """ |
7529 if self.shutdownCalled: | 8182 if self.shutdownCalled: |
7530 return True | 8183 return True |
7531 | 8184 |
7532 if self.__webBrowserProcess is not None: | 8185 if self.__webBrowserProcess is not None: |
7533 self.__webBrowserShutdown() | 8186 self.__webBrowserShutdown() |
7534 | 8187 |
7535 if self.irc is not None and not self.irc.shutdown(): | 8188 if self.irc is not None and not self.irc.shutdown(): |
7536 return False | 8189 return False |
7537 | 8190 |
7538 sessionCreated = self.__writeSession() | 8191 sessionCreated = self.__writeSession() |
7539 | 8192 |
7540 self.__astViewer.hide() | 8193 self.__astViewer.hide() |
7541 | 8194 |
7542 if not self.project.closeProject(shutdown=True): | 8195 if not self.project.closeProject(shutdown=True): |
7543 return False | 8196 return False |
7544 | 8197 |
7545 if not self.multiProject.closeMultiProject(): | 8198 if not self.multiProject.closeMultiProject(): |
7546 return False | 8199 return False |
7547 | 8200 |
7548 if not self.viewmanager.closeViewManager(): | 8201 if not self.viewmanager.closeViewManager(): |
7549 return False | 8202 return False |
7550 | 8203 |
7551 QDesktopServices.unsetUrlHandler("file") | 8204 QDesktopServices.unsetUrlHandler("file") |
7552 QDesktopServices.unsetUrlHandler("http") | 8205 QDesktopServices.unsetUrlHandler("http") |
7553 QDesktopServices.unsetUrlHandler("https") | 8206 QDesktopServices.unsetUrlHandler("https") |
7554 | 8207 |
7555 if sessionCreated and not self.__disableCrashSession: | 8208 if sessionCreated and not self.__disableCrashSession: |
7556 self.__deleteCrashSession() | 8209 self.__deleteCrashSession() |
7557 | 8210 |
7558 if self.codeDocumentationViewer is not None: | 8211 if self.codeDocumentationViewer is not None: |
7559 self.codeDocumentationViewer.shutdown() | 8212 self.codeDocumentationViewer.shutdown() |
7560 | 8213 |
7561 self.__previewer.shutdown() | 8214 self.__previewer.shutdown() |
7562 | 8215 |
7563 self.__astViewer.shutdown() | 8216 self.__astViewer.shutdown() |
7564 | 8217 |
7565 self.shell.closeShell() | 8218 self.shell.closeShell() |
7566 | 8219 |
7567 self.__writeTasks() | 8220 self.__writeTasks() |
7568 | 8221 |
7569 if self.templateViewer is not None: | 8222 if self.templateViewer is not None: |
7570 self.templateViewer.save() | 8223 self.templateViewer.save() |
7571 | 8224 |
7572 if not self.debuggerUI.shutdownServer(): | 8225 if not self.debuggerUI.shutdownServer(): |
7573 return False | 8226 return False |
7574 self.debuggerUI.shutdown() | 8227 self.debuggerUI.shutdown() |
7575 | 8228 |
7576 self.backgroundService.shutdown() | 8229 self.backgroundService.shutdown() |
7577 | 8230 |
7578 if self.cooperation is not None: | 8231 if self.cooperation is not None: |
7579 self.cooperation.shutdown() | 8232 self.cooperation.shutdown() |
7580 | 8233 |
7581 if self.__helpViewerWidget is not None: | 8234 if self.__helpViewerWidget is not None: |
7582 self.__helpViewerWidget.shutdown() | 8235 self.__helpViewerWidget.shutdown() |
7583 | 8236 |
7584 self.pluginManager.doShutdown() | 8237 self.pluginManager.doShutdown() |
7585 | 8238 |
7586 if self.SAServer is not None: | 8239 if self.SAServer is not None: |
7587 self.SAServer.shutdown() | 8240 self.SAServer.shutdown() |
7588 self.SAServer = None | 8241 self.SAServer = None |
7589 | 8242 |
7590 # set proxy factory to None to avoid crashes | 8243 # set proxy factory to None to avoid crashes |
7591 QNetworkProxyFactory.setApplicationProxyFactory(None) | 8244 QNetworkProxyFactory.setApplicationProxyFactory(None) |
7592 | 8245 |
7593 Preferences.setGeometry("MainMaximized", self.isMaximized()) | 8246 Preferences.setGeometry("MainMaximized", self.isMaximized()) |
7594 if not self.isMaximized(): | 8247 if not self.isMaximized(): |
7595 Preferences.setGeometry("MainGeometry", self.saveGeometry()) | 8248 Preferences.setGeometry("MainGeometry", self.saveGeometry()) |
7596 | 8249 |
7597 if self.browser is not None: | 8250 if self.browser is not None: |
7598 self.browser.saveToplevelDirs() | 8251 self.browser.saveToplevelDirs() |
7599 | 8252 |
7600 Preferences.setUI( | 8253 Preferences.setUI("ToolbarManagerState", self.toolbarManager.saveState()) |
7601 "ToolbarManagerState", self.toolbarManager.saveState()) | |
7602 self.__saveCurrentViewProfile(True) | 8254 self.__saveCurrentViewProfile(True) |
7603 Preferences.saveToolGroups(self.toolGroups, self.currentToolGroup) | 8255 Preferences.saveToolGroups(self.toolGroups, self.currentToolGroup) |
7604 Preferences.syncPreferences() | 8256 Preferences.syncPreferences() |
7605 self.shutdownCalled = True | 8257 self.shutdownCalled = True |
7606 return True | 8258 return True |
7607 | 8259 |
7608 def isOnline(self): | 8260 def isOnline(self): |
7609 """ | 8261 """ |
7610 Public method to get the online state. | 8262 Public method to get the online state. |
7611 | 8263 |
7612 @return online state | 8264 @return online state |
7613 @rtype bool | 8265 @rtype bool |
7614 """ | 8266 """ |
7615 return self.networkIcon.isOnline() | 8267 return self.networkIcon.isOnline() |
7616 | 8268 |
7617 def __onlineStateChanged(self, online): | 8269 def __onlineStateChanged(self, online): |
7618 """ | 8270 """ |
7619 Private slot handling changes in online state. | 8271 Private slot handling changes in online state. |
7620 | 8272 |
7621 @param online flag indicating the online state | 8273 @param online flag indicating the online state |
7622 @type bool | 8274 @type bool |
7623 """ | 8275 """ |
7624 if online: | 8276 if online: |
7625 self.performVersionCheck() | 8277 self.performVersionCheck() |
7626 | 8278 |
7627 ############################################## | 8279 ############################################## |
7628 ## Below are methods to check for new versions | 8280 ## Below are methods to check for new versions |
7629 ############################################## | 8281 ############################################## |
7630 | 8282 |
7631 def performVersionCheck(self): | 8283 def performVersionCheck(self): |
7632 """ | 8284 """ |
7633 Public method to check for an update even if not installed via PyPI. | 8285 Public method to check for an update even if not installed via PyPI. |
7634 """ | 8286 """ |
7635 if self.isOnline(): | 8287 if self.isOnline(): |
7640 period = Preferences.getUI("PerformVersionCheck") | 8292 period = Preferences.getUI("PerformVersionCheck") |
7641 if period == 0: | 8293 if period == 0: |
7642 return | 8294 return |
7643 elif period in [2, 3, 4]: | 8295 elif period in [2, 3, 4]: |
7644 lastCheck = Preferences.getSettings().value( | 8296 lastCheck = Preferences.getSettings().value( |
7645 "Updates/LastCheckDate", QDate(1970, 1, 1)) | 8297 "Updates/LastCheckDate", QDate(1970, 1, 1) |
8298 ) | |
7646 if lastCheck.isValid(): | 8299 if lastCheck.isValid(): |
7647 now = QDate.currentDate() | 8300 now = QDate.currentDate() |
7648 if ( | 8301 if ( |
7649 (period == 2 and | 8302 (period == 2 and lastCheck.day() == now.day()) |
7650 lastCheck.day() == now.day()) or | 8303 or (period == 3 and lastCheck.daysTo(now) < 7) |
7651 (period == 3 and lastCheck.daysTo(now) < 7) or | 8304 or ( |
7652 (period == 4 and (lastCheck.daysTo(now) < | 8305 period == 4 |
7653 lastCheck.daysInMonth())) | 8306 and (lastCheck.daysTo(now) < lastCheck.daysInMonth()) |
8307 ) | |
7654 ): | 8308 ): |
7655 # daily, weekly, monthly | 8309 # daily, weekly, monthly |
7656 return | 8310 return |
7657 | 8311 |
7658 availableVersions = ( | 8312 availableVersions = self.pipInterface.getPackageVersions("eric-ide") |
7659 self.pipInterface.getPackageVersions("eric-ide") | 8313 updateAvailable = bool([v for v in availableVersions if v > VersionOnly]) |
7660 ) | |
7661 updateAvailable = bool( | |
7662 [v for v in availableVersions if v > VersionOnly] | |
7663 ) | |
7664 if updateAvailable: | 8314 if updateAvailable: |
7665 EricMessageBox.information( | 8315 EricMessageBox.information( |
7666 self, | 8316 self, |
7667 self.tr("Upgrade available"), | 8317 self.tr("Upgrade available"), |
7668 self.tr( | 8318 self.tr( |
7669 """A newer version of the <b>eric-ide</b> package is""" | 8319 """A newer version of the <b>eric-ide</b> package is""" |
7670 """ available at <a href="{0}/eric-ide/">""" | 8320 """ available at <a href="{0}/eric-ide/">""" |
7671 """PyPI</a>.""" | 8321 """PyPI</a>.""" |
7672 ).format(self.pipInterface.getIndexUrlPypi()) | 8322 ).format(self.pipInterface.getIndexUrlPypi()), |
7673 ) | 8323 ) |
7674 | 8324 |
7675 def __sslErrors(self, reply, errors): | 8325 def __sslErrors(self, reply, errors): |
7676 """ | 8326 """ |
7677 Private slot to handle SSL errors. | 8327 Private slot to handle SSL errors. |
7678 | 8328 |
7679 @param reply reference to the reply object (QNetworkReply) | 8329 @param reply reference to the reply object (QNetworkReply) |
7680 @param errors list of SSL errors (list of QSslError) | 8330 @param errors list of SSL errors (list of QSslError) |
7681 """ | 8331 """ |
7682 ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0] | 8332 ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0] |
7683 if ignored == EricSslErrorState.NOT_IGNORED: | 8333 if ignored == EricSslErrorState.NOT_IGNORED: |
7684 self.__downloadCancelled = True | 8334 self.__downloadCancelled = True |
7685 | 8335 |
7686 ####################################### | 8336 ####################################### |
7687 ## Below are methods for various checks | 8337 ## Below are methods for various checks |
7688 ####################################### | 8338 ####################################### |
7689 | 8339 |
7690 def checkConfigurationStatus(self): | 8340 def checkConfigurationStatus(self): |
7692 Public method to check, if eric has been configured. If it is not, | 8342 Public method to check, if eric has been configured. If it is not, |
7693 the configuration dialog is shown. | 8343 the configuration dialog is shown. |
7694 """ | 8344 """ |
7695 if not Preferences.isConfigured(): | 8345 if not Preferences.isConfigured(): |
7696 self.__initDebugToolbarsLayout() | 8346 self.__initDebugToolbarsLayout() |
7697 | 8347 |
7698 if Preferences.hasEric6Configuration(): | 8348 if Preferences.hasEric6Configuration(): |
7699 yes = EricMessageBox.yesNo( | 8349 yes = EricMessageBox.yesNo( |
7700 self, | 8350 self, |
7701 self.tr("First time usage"), | 8351 self.tr("First time usage"), |
7702 self.tr("eric7 has not been configured yet but an eric6" | 8352 self.tr( |
7703 " configuration was found. Shall this be" | 8353 "eric7 has not been configured yet but an eric6" |
7704 " imported?"), | 8354 " configuration was found. Shall this be" |
7705 yesDefault=True | 8355 " imported?" |
8356 ), | |
8357 yesDefault=True, | |
7706 ) | 8358 ) |
7707 if yes: | 8359 if yes: |
7708 Preferences.importEric6Configuration() | 8360 Preferences.importEric6Configuration() |
7709 else: | 8361 else: |
7710 EricMessageBox.information( | 8362 EricMessageBox.information( |
7711 self, | 8363 self, |
7712 self.tr("First time usage"), | 8364 self.tr("First time usage"), |
7713 self.tr("""eric has not been configured yet. """ | 8365 self.tr( |
7714 """The configuration dialog will be started.""")) | 8366 """eric has not been configured yet. """ |
7715 | 8367 """The configuration dialog will be started.""" |
8368 ), | |
8369 ) | |
8370 | |
7716 self.showPreferences() | 8371 self.showPreferences() |
7717 Preferences.setConfigured() | 8372 Preferences.setConfigured() |
7718 | 8373 |
7719 def checkProjectsWorkspace(self): | 8374 def checkProjectsWorkspace(self): |
7720 """ | 8375 """ |
7721 Public method to check, if a projects workspace has been configured. If | 8376 Public method to check, if a projects workspace has been configured. If |
7722 it has not, a dialog is shown. | 8377 it has not, a dialog is shown. |
7723 """ | 8378 """ |
7724 if not Preferences.isConfigured(): | 8379 if not Preferences.isConfigured(): |
7725 # eric hasn't been configured at all | 8380 # eric hasn't been configured at all |
7726 self.checkConfigurationStatus() | 8381 self.checkConfigurationStatus() |
7727 | 8382 |
7728 workspace = Preferences.getMultiProject("Workspace") | 8383 workspace = Preferences.getMultiProject("Workspace") |
7729 if workspace == "": | 8384 if workspace == "": |
7730 default = Utilities.getHomeDir() | 8385 default = Utilities.getHomeDir() |
7731 workspace = EricFileDialog.getExistingDirectory( | 8386 workspace = EricFileDialog.getExistingDirectory( |
7732 None, | 8387 None, |
7733 self.tr("Select Workspace Directory"), | 8388 self.tr("Select Workspace Directory"), |
7734 default, | 8389 default, |
7735 EricFileDialog.Option(0)) | 8390 EricFileDialog.Option(0), |
8391 ) | |
7736 Preferences.setMultiProject("Workspace", workspace) | 8392 Preferences.setMultiProject("Workspace", workspace) |
7737 | 8393 |
7738 def versionIsNewer(self, required, snapshot=None): | 8394 def versionIsNewer(self, required, snapshot=None): |
7739 """ | 8395 """ |
7740 Public method to check, if the eric version is good compared to | 8396 Public method to check, if the eric version is good compared to |
7741 the required version. | 8397 the required version. |
7742 | 8398 |
7743 @param required required version (string) | 8399 @param required required version (string) |
7744 @param snapshot required snapshot version (string) | 8400 @param snapshot required snapshot version (string) |
7745 @return flag indicating, that the version is newer than the required | 8401 @return flag indicating, that the version is newer than the required |
7746 one (boolean) | 8402 one (boolean) |
7747 """ | 8403 """ |
7748 if VersionOnly.startswith("@@"): | 8404 if VersionOnly.startswith("@@"): |
7749 # development version, always newer | 8405 # development version, always newer |
7750 return True | 8406 return True |
7751 | 8407 |
7752 if VersionOnly.startswith("rev_"): | 8408 if VersionOnly.startswith("rev_"): |
7753 # installed from cloned sources, always newer | 8409 # installed from cloned sources, always newer |
7754 return True | 8410 return True |
7755 | 8411 |
7756 if "snapshot-" in VersionOnly: | 8412 if "snapshot-" in VersionOnly: |
7757 # check snapshot version | 8413 # check snapshot version |
7758 if snapshot is None: | 8414 if snapshot is None: |
7759 return True | 8415 return True |
7760 else: | 8416 else: |
7761 vers = VersionOnly.split("snapshot-")[1] | 8417 vers = VersionOnly.split("snapshot-")[1] |
7762 return vers > snapshot | 8418 return vers > snapshot |
7763 | 8419 |
7764 versionTuple = self.__versionToTuple(VersionOnly) | 8420 versionTuple = self.__versionToTuple(VersionOnly) |
7765 if isinstance(required, str): | 8421 if isinstance(required, str): |
7766 required = self.__versionToTuple(required) | 8422 required = self.__versionToTuple(required) |
7767 try: | 8423 try: |
7768 res = versionTuple > required | 8424 res = versionTuple > required |
7769 except TypeError: | 8425 except TypeError: |
7770 # some mismatching types, assume newer | 8426 # some mismatching types, assume newer |
7771 res = True | 8427 res = True |
7772 return res | 8428 return res |
7773 | 8429 |
7774 def __versionToTuple(self, version): | 8430 def __versionToTuple(self, version): |
7775 """ | 8431 """ |
7776 Private method to convert a version string into a tuple. | 8432 Private method to convert a version string into a tuple. |
7777 | 8433 |
7778 @param version version string | 8434 @param version version string |
7779 @type str | 8435 @type str |
7780 @return version tuple | 8436 @return version tuple |
7781 @rtype tuple of int | 8437 @rtype tuple of int |
7782 """ | 8438 """ |
7789 except ValueError: | 8445 except ValueError: |
7790 # not an integer, ignore | 8446 # not an integer, ignore |
7791 continue | 8447 continue |
7792 versionParts.append(part) | 8448 versionParts.append(part) |
7793 return tuple(versionParts) | 8449 return tuple(versionParts) |
7794 | 8450 |
7795 ################################# | 8451 ################################# |
7796 ## Below are some utility methods | 8452 ## Below are some utility methods |
7797 ################################# | 8453 ################################# |
7798 | 8454 |
7799 def __getFloatingGeometry(self, w): | 8455 def __getFloatingGeometry(self, w): |
7800 """ | 8456 """ |
7801 Private method to get the geometry of a floating windows. | 8457 Private method to get the geometry of a floating windows. |
7802 | 8458 |
7803 @param w reference to the widget to be saved (QWidget) | 8459 @param w reference to the widget to be saved (QWidget) |
7804 @return list giving the widget's geometry and its visibility | 8460 @return list giving the widget's geometry and its visibility |
7805 """ | 8461 """ |
7806 s = w.size() | 8462 s = w.size() |
7807 p = w.pos() | 8463 p = w.pos() |
7808 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()] | 8464 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()] |
7809 | 8465 |
7810 def getOriginalPathString(self): | 8466 def getOriginalPathString(self): |
7811 """ | 8467 """ |
7812 Public method to get the original PATH environment variable | 8468 Public method to get the original PATH environment variable |
7813 (i.e. before modifications by eric and PyQt5). | 8469 (i.e. before modifications by eric and PyQt5). |
7814 | 8470 |
7815 @return original PATH environment variable | 8471 @return original PATH environment variable |
7816 @rtype str | 8472 @rtype str |
7817 """ | 8473 """ |
7818 return self.__originalPathString | 8474 return self.__originalPathString |
7819 | 8475 |
7820 ############################ | 8476 ############################ |
7821 ## some event handlers below | 8477 ## some event handlers below |
7822 ############################ | 8478 ############################ |
7823 | 8479 |
7824 def showEvent(self, evt): | 8480 def showEvent(self, evt): |
7825 """ | 8481 """ |
7826 Protected method to handle the show event. | 8482 Protected method to handle the show event. |
7827 | 8483 |
7828 @param evt reference to the show event (QShowEvent) | 8484 @param evt reference to the show event (QShowEvent) |
7829 """ | 8485 """ |
7830 if self.__startup: | 8486 if self.__startup: |
7831 if Preferences.getGeometry("MainMaximized"): | 8487 if Preferences.getGeometry("MainMaximized"): |
7832 self.setWindowState(Qt.WindowState.WindowMaximized) | 8488 self.setWindowState(Qt.WindowState.WindowMaximized) |
7833 self.__startup = False | 8489 self.__startup = False |
7834 | 8490 |
7835 ########################################## | 8491 ########################################## |
7836 ## Support for desktop notifications below | 8492 ## Support for desktop notifications below |
7837 ########################################## | 8493 ########################################## |
7838 | 8494 |
7839 def showNotification(self, icon, heading, text, | 8495 def showNotification( |
7840 kind=NotificationTypes.INFORMATION, timeout=None): | 8496 self, icon, heading, text, kind=NotificationTypes.INFORMATION, timeout=None |
8497 ): | |
7841 """ | 8498 """ |
7842 Public method to show a desktop notification. | 8499 Public method to show a desktop notification. |
7843 | 8500 |
7844 @param icon icon to be shown in the notification | 8501 @param icon icon to be shown in the notification |
7845 @type QPixmap | 8502 @type QPixmap |
7846 @param heading heading of the notification | 8503 @param heading heading of the notification |
7847 @type str | 8504 @type str |
7848 @param text text of the notification | 8505 @param text text of the notification |
7853 (None = use configured timeout, 0 = indefinitely) | 8510 (None = use configured timeout, 0 = indefinitely) |
7854 @type int | 8511 @type int |
7855 """ | 8512 """ |
7856 if self.__notification is None: | 8513 if self.__notification is None: |
7857 from .NotificationWidget import NotificationWidget | 8514 from .NotificationWidget import NotificationWidget |
8515 | |
7858 self.__notification = NotificationWidget(parent=self) | 8516 self.__notification = NotificationWidget(parent=self) |
7859 if timeout is None: | 8517 if timeout is None: |
7860 timeout = Preferences.getUI("NotificationTimeout") | 8518 timeout = Preferences.getUI("NotificationTimeout") |
7861 self.__notification.showNotification(icon, heading, text, kind=kind, | 8519 self.__notification.showNotification( |
7862 timeout=timeout) | 8520 icon, heading, text, kind=kind, timeout=timeout |
7863 | 8521 ) |
8522 | |
7864 ######################### | 8523 ######################### |
7865 ## Support for IRC below | 8524 ## Support for IRC below |
7866 ######################### | 8525 ######################### |
7867 | 8526 |
7868 def autoConnectIrc(self): | 8527 def autoConnectIrc(self): |
7869 """ | 8528 """ |
7870 Public method to initiate the IRC auto connection. | 8529 Public method to initiate the IRC auto connection. |
7871 """ | 8530 """ |
7872 if self.irc is not None: | 8531 if self.irc is not None: |
7873 self.irc.autoConnect() | 8532 self.irc.autoConnect() |
7874 | 8533 |
7875 def __ircAutoConnected(self): | 8534 def __ircAutoConnected(self): |
7876 """ | 8535 """ |
7877 Private slot handling the automatic connection of the IRC client. | 8536 Private slot handling the automatic connection of the IRC client. |
7878 """ | 8537 """ |
7879 self.__activateIRC() | 8538 self.__activateIRC() |
7880 | 8539 |
7881 ############################################## | 8540 ############################################## |
7882 ## Support for Code Documentation Viewer below | 8541 ## Support for Code Documentation Viewer below |
7883 ############################################## | 8542 ############################################## |
7884 | 8543 |
7885 def documentationViewer(self): | 8544 def documentationViewer(self): |
7886 """ | 8545 """ |
7887 Public method to provide a reference to the code documentation viewer. | 8546 Public method to provide a reference to the code documentation viewer. |
7888 | 8547 |
7889 @return reference to the code documentation viewer | 8548 @return reference to the code documentation viewer |
7890 @rtype CodeDocumentationViewer | 8549 @rtype CodeDocumentationViewer |
7891 """ | 8550 """ |
7892 return self.codeDocumentationViewer | 8551 return self.codeDocumentationViewer |
7893 | 8552 |
7894 ############################################### | 8553 ############################################### |
7895 ## Support for Desktop session management below | 8554 ## Support for Desktop session management below |
7896 ############################################### | 8555 ############################################### |
7897 | 8556 |
7898 def __commitData(self, manager: QSessionManager): | 8557 def __commitData(self, manager: QSessionManager): |
7899 """ | 8558 """ |
7900 Private slot to commit unsaved data when instructed by the desktop | 8559 Private slot to commit unsaved data when instructed by the desktop |
7901 session manager. | 8560 session manager. |
7902 | 8561 |
7903 @param manager reference to the desktop session manager | 8562 @param manager reference to the desktop session manager |
7904 @type QSessionManager | 8563 @type QSessionManager |
7905 """ | 8564 """ |
7906 if self.viewmanager.hasDirtyEditor(): | 8565 if self.viewmanager.hasDirtyEditor(): |
7907 if manager.allowsInteraction(): | 8566 if manager.allowsInteraction(): |
7908 res = EricMessageBox.warning( | 8567 res = EricMessageBox.warning( |
7909 self, | 8568 self, |
7910 self.tr("Unsaved Data Detected"), | 8569 self.tr("Unsaved Data Detected"), |
7911 self.tr("Some editors contain unsaved data. Shall these" | 8570 self.tr( |
7912 " be saved?"), | 8571 "Some editors contain unsaved data. Shall these" " be saved?" |
7913 EricMessageBox.Abort | | 8572 ), |
7914 EricMessageBox.Discard | | 8573 EricMessageBox.Abort |
7915 EricMessageBox.Save | | 8574 | EricMessageBox.Discard |
8575 | EricMessageBox.Save | |
8576 | EricMessageBox.SaveAll, | |
7916 EricMessageBox.SaveAll, | 8577 EricMessageBox.SaveAll, |
7917 EricMessageBox.SaveAll) | 8578 ) |
7918 if res == EricMessageBox.SaveAll: | 8579 if res == EricMessageBox.SaveAll: |
7919 manager.release() | 8580 manager.release() |
7920 self.viewmanager.saveAllEditors() | 8581 self.viewmanager.saveAllEditors() |
7921 elif res == EricMessageBox.Save: | 8582 elif res == EricMessageBox.Save: |
7922 manager.release() | 8583 manager.release() |
7931 manager.cancel() | 8592 manager.cancel() |
7932 else: | 8593 else: |
7933 # We did not get permission to interact, play it safe and | 8594 # We did not get permission to interact, play it safe and |
7934 # save all data. | 8595 # save all data. |
7935 self.viewmanager.saveAllEditors() | 8596 self.viewmanager.saveAllEditors() |
7936 | 8597 |
7937 ############################################################ | 8598 ############################################################ |
7938 ## Interface to the virtual environment manager widget below | 8599 ## Interface to the virtual environment manager widget below |
7939 ############################################################ | 8600 ############################################################ |
7940 | 8601 |
7941 @pyqtSlot() | 8602 @pyqtSlot() |
7942 def activateVirtualenvManager(self): | 8603 def activateVirtualenvManager(self): |
7943 """ | 8604 """ |
7944 Public slot to activate the virtual environments manager widget. | 8605 Public slot to activate the virtual environments manager widget. |
7945 """ | 8606 """ |
7946 if self.__layoutType == "Toolboxes": | 8607 if self.__layoutType == "Toolboxes": |
7947 self.rToolboxDock.show() | 8608 self.rToolboxDock.show() |
7948 self.rToolbox.setCurrentWidget(self.__virtualenvManagerWidget) | 8609 self.rToolbox.setCurrentWidget(self.__virtualenvManagerWidget) |
7949 elif self.__layoutType == "Sidebars": | 8610 elif self.__layoutType == "Sidebars": |
7950 self.__activateLeftRightSidebarWidget( | 8611 self.__activateLeftRightSidebarWidget(self.__virtualenvManagerWidget) |
7951 self.__virtualenvManagerWidget) | 8612 self.__virtualenvManagerWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
7952 self.__virtualenvManagerWidget.setFocus( | |
7953 Qt.FocusReason.ActiveWindowFocusReason) |