Tools/TrayStarter.py

changeset 3670
f0cb7579c0b4
parent 3656
441956d8fce5
child 4021
195a471c327b
equal deleted inserted replaced
3669:ac84ac3c0f05 3670:f0cb7579c0b4
22 import UI.PixmapCache 22 import UI.PixmapCache
23 23
24 import Utilities 24 import Utilities
25 import Preferences 25 import Preferences
26 26
27 from eric5config import getConfig 27 from eric6config import getConfig
28 28
29 29
30 class TrayStarter(QSystemTrayIcon): 30 class TrayStarter(QSystemTrayIcon):
31 """ 31 """
32 Class implementing a starter for the system tray. 32 Class implementing a starter for the system tray.
54 self.recentFiles = [] 54 self.recentFiles = []
55 self.__loadRecentFiles() 55 self.__loadRecentFiles()
56 56
57 self.activated.connect(self.__activated) 57 self.activated.connect(self.__activated)
58 58
59 self.__menu = QMenu(self.tr("Eric5 tray starter")) 59 self.__menu = QMenu(self.tr("Eric6 tray starter"))
60 60
61 self.recentProjectsMenu = QMenu( 61 self.recentProjectsMenu = QMenu(
62 self.tr('Recent Projects'), self.__menu) 62 self.tr('Recent Projects'), self.__menu)
63 self.recentProjectsMenu.aboutToShow.connect( 63 self.recentProjectsMenu.aboutToShow.connect(
64 self.__showRecentProjectsMenu) 64 self.__showRecentProjectsMenu)
73 self.recentFilesMenu = QMenu(self.tr('Recent Files'), self.__menu) 73 self.recentFilesMenu = QMenu(self.tr('Recent Files'), self.__menu)
74 self.recentFilesMenu.aboutToShow.connect(self.__showRecentFilesMenu) 74 self.recentFilesMenu.aboutToShow.connect(self.__showRecentFilesMenu)
75 self.recentFilesMenu.triggered.connect(self.__openRecent) 75 self.recentFilesMenu.triggered.connect(self.__openRecent)
76 76
77 act = self.__menu.addAction( 77 act = self.__menu.addAction(
78 self.tr("Eric5 tray starter"), self.__about) 78 self.tr("Eric6 tray starter"), self.__about)
79 font = act.font() 79 font = act.font()
80 font.setBold(True) 80 font.setBold(True)
81 act.setFont(font) 81 act.setFont(font)
82 self.__menu.addSeparator() 82 self.__menu.addSeparator()
83 83
96 self.__menu.addAction( 96 self.__menu.addAction(
97 UI.PixmapCache.getIcon("unittest.png"), 97 UI.PixmapCache.getIcon("unittest.png"),
98 self.tr("Unittest"), self.__startUnittest) 98 self.tr("Unittest"), self.__startUnittest)
99 self.__menu.addAction( 99 self.__menu.addAction(
100 UI.PixmapCache.getIcon("ericWeb.png"), 100 UI.PixmapCache.getIcon("ericWeb.png"),
101 self.tr("eric5 Web Browser"), self.__startHelpViewer) 101 self.tr("eric6 Web Browser"), self.__startHelpViewer)
102 self.__menu.addSeparator() 102 self.__menu.addSeparator()
103 103
104 self.__menu.addAction( 104 self.__menu.addAction(
105 UI.PixmapCache.getIcon("diffFiles.png"), 105 UI.PixmapCache.getIcon("diffFiles.png"),
106 self.tr("Compare Files"), self.__startDiff) 106 self.tr("Compare Files"), self.__startDiff)
136 self.__menu.addAction( 136 self.__menu.addAction(
137 UI.PixmapCache.getIcon("configure.png"), 137 UI.PixmapCache.getIcon("configure.png"),
138 self.tr('Preferences'), self.__startPreferences) 138 self.tr('Preferences'), self.__startPreferences)
139 self.__menu.addAction( 139 self.__menu.addAction(
140 UI.PixmapCache.getIcon("erict.png"), 140 UI.PixmapCache.getIcon("erict.png"),
141 self.tr("eric5 IDE"), self.__startEric) 141 self.tr("eric6 IDE"), self.__startEric)
142 self.__menu.addAction( 142 self.__menu.addAction(
143 UI.PixmapCache.getIcon("editor.png"), 143 UI.PixmapCache.getIcon("editor.png"),
144 self.tr("eric5 Mini Editor"), self.__startMiniEditor) 144 self.tr("eric6 Mini Editor"), self.__startMiniEditor)
145 self.__menu.addSeparator() 145 self.__menu.addSeparator()
146 146
147 self.__menu.addAction( 147 self.__menu.addAction(
148 UI.PixmapCache.getIcon("configure.png"), 148 UI.PixmapCache.getIcon("configure.png"),
149 self.tr('Configure Tray Starter'), self.__showPreferences) 149 self.tr('Configure Tray Starter'), self.__showPreferences)
222 pos.setY(y > 0 and y or 0) 222 pos.setY(y > 0 and y or 0)
223 self.__menu.popup(pos) 223 self.__menu.popup(pos)
224 224
225 def __startProc(self, applName, *applArgs): 225 def __startProc(self, applName, *applArgs):
226 """ 226 """
227 Private method to start an eric5 application. 227 Private method to start an eric6 application.
228 228
229 @param applName name of the eric5 application script (string) 229 @param applName name of the eric6 application script (string)
230 @param *applArgs variable list of application arguments 230 @param *applArgs variable list of application arguments
231 """ 231 """
232 proc = QProcess() 232 proc = QProcess()
233 applPath = os.path.join(getConfig("ericDir"), applName) 233 applPath = os.path.join(getConfig("ericDir"), applName)
234 234
248 ).format(applPath), 248 ).format(applPath),
249 self.tr('OK')) 249 self.tr('OK'))
250 250
251 def __startMiniEditor(self): 251 def __startMiniEditor(self):
252 """ 252 """
253 Private slot to start the eric5 Mini Editor. 253 Private slot to start the eric6 Mini Editor.
254 """ 254 """
255 self.__startProc("eric5_editor.py", "--config={0}".format( 255 self.__startProc("eric6_editor.py", "--config={0}".format(
256 Utilities.getConfigDir())) 256 Utilities.getConfigDir()))
257 257
258 def __startEric(self): 258 def __startEric(self):
259 """ 259 """
260 Private slot to start the eric5 IDE. 260 Private slot to start the eric6 IDE.
261 """ 261 """
262 self.__startProc("eric5.py", "--config={0}".format( 262 self.__startProc("eric6.py", "--config={0}".format(
263 Utilities.getConfigDir())) 263 Utilities.getConfigDir()))
264 264
265 def __startPreferences(self): 265 def __startPreferences(self):
266 """ 266 """
267 Private slot to start the eric5 configuration dialog. 267 Private slot to start the eric6 configuration dialog.
268 """ 268 """
269 self.__startProc("eric5_configure.py", "--config={0}".format( 269 self.__startProc("eric6_configure.py", "--config={0}".format(
270 Utilities.getConfigDir())) 270 Utilities.getConfigDir()))
271 271
272 def __startPluginInstall(self): 272 def __startPluginInstall(self):
273 """ 273 """
274 Private slot to start the eric5 plugin installation dialog. 274 Private slot to start the eric6 plugin installation dialog.
275 """ 275 """
276 self.__startProc("eric5_plugininstall.py", "--config={0}".format( 276 self.__startProc("eric6_plugininstall.py", "--config={0}".format(
277 Utilities.getConfigDir())) 277 Utilities.getConfigDir()))
278 278
279 def __startPluginUninstall(self): 279 def __startPluginUninstall(self):
280 """ 280 """
281 Private slot to start the eric5 plugin uninstallation dialog. 281 Private slot to start the eric6 plugin uninstallation dialog.
282 """ 282 """
283 self.__startProc("eric5_pluginuninstall.py", "--config={0}".format( 283 self.__startProc("eric6_pluginuninstall.py", "--config={0}".format(
284 Utilities.getConfigDir())) 284 Utilities.getConfigDir()))
285 285
286 def __startPluginRepository(self): 286 def __startPluginRepository(self):
287 """ 287 """
288 Private slot to start the eric5 plugin repository dialog. 288 Private slot to start the eric6 plugin repository dialog.
289 """ 289 """
290 self.__startProc("eric5_pluginrepository.py", "--config={0}".format( 290 self.__startProc("eric6_pluginrepository.py", "--config={0}".format(
291 Utilities.getConfigDir())) 291 Utilities.getConfigDir()))
292 292
293 def __startHelpViewer(self): 293 def __startHelpViewer(self):
294 """ 294 """
295 Private slot to start the eric5 web browser. 295 Private slot to start the eric6 web browser.
296 """ 296 """
297 self.__startProc("eric5_webbrowser.py", "--config={0}".format( 297 self.__startProc("eric6_webbrowser.py", "--config={0}".format(
298 Utilities.getConfigDir())) 298 Utilities.getConfigDir()))
299 299
300 def __startUIPreviewer(self): 300 def __startUIPreviewer(self):
301 """ 301 """
302 Private slot to start the eric5 UI previewer. 302 Private slot to start the eric6 UI previewer.
303 """ 303 """
304 self.__startProc("eric5_uipreviewer.py", "--config={0}".format( 304 self.__startProc("eric6_uipreviewer.py", "--config={0}".format(
305 Utilities.getConfigDir())) 305 Utilities.getConfigDir()))
306 306
307 def __startTRPreviewer(self): 307 def __startTRPreviewer(self):
308 """ 308 """
309 Private slot to start the eric5 translations previewer. 309 Private slot to start the eric6 translations previewer.
310 """ 310 """
311 self.__startProc("eric5_trpreviewer.py", "--config={0}".format( 311 self.__startProc("eric6_trpreviewer.py", "--config={0}".format(
312 Utilities.getConfigDir())) 312 Utilities.getConfigDir()))
313 313
314 def __startUnittest(self): 314 def __startUnittest(self):
315 """ 315 """
316 Private slot to start the eric5 unittest dialog. 316 Private slot to start the eric6 unittest dialog.
317 """ 317 """
318 self.__startProc("eric5_unittest.py", "--config={0}".format( 318 self.__startProc("eric6_unittest.py", "--config={0}".format(
319 Utilities.getConfigDir())) 319 Utilities.getConfigDir()))
320 320
321 def __startDiff(self): 321 def __startDiff(self):
322 """ 322 """
323 Private slot to start the eric5 diff dialog. 323 Private slot to start the eric6 diff dialog.
324 """ 324 """
325 self.__startProc("eric5_diff.py", "--config={0}".format( 325 self.__startProc("eric6_diff.py", "--config={0}".format(
326 Utilities.getConfigDir())) 326 Utilities.getConfigDir()))
327 327
328 def __startCompare(self): 328 def __startCompare(self):
329 """ 329 """
330 Private slot to start the eric5 compare dialog. 330 Private slot to start the eric6 compare dialog.
331 """ 331 """
332 self.__startProc("eric5_compare.py", "--config={0}".format( 332 self.__startProc("eric6_compare.py", "--config={0}".format(
333 Utilities.getConfigDir())) 333 Utilities.getConfigDir()))
334 334
335 def __startSqlBrowser(self): 335 def __startSqlBrowser(self):
336 """ 336 """
337 Private slot to start the eric5 sql browser dialog. 337 Private slot to start the eric6 sql browser dialog.
338 """ 338 """
339 self.__startProc("eric5_sqlbrowser.py", "--config={0}".format( 339 self.__startProc("eric6_sqlbrowser.py", "--config={0}".format(
340 Utilities.getConfigDir())) 340 Utilities.getConfigDir()))
341 341
342 def __startIconEditor(self): 342 def __startIconEditor(self):
343 """ 343 """
344 Private slot to start the eric5 icon editor dialog. 344 Private slot to start the eric6 icon editor dialog.
345 """ 345 """
346 self.__startProc("eric5_iconeditor.py", "--config={0}".format( 346 self.__startProc("eric6_iconeditor.py", "--config={0}".format(
347 Utilities.getConfigDir())) 347 Utilities.getConfigDir()))
348 348
349 def __startSnapshot(self): 349 def __startSnapshot(self):
350 """ 350 """
351 Private slot to start the eric5 snapshot dialog. 351 Private slot to start the eric6 snapshot dialog.
352 """ 352 """
353 self.__startProc("eric5_snap.py", "--config={0}".format( 353 self.__startProc("eric6_snap.py", "--config={0}".format(
354 Utilities.getConfigDir())) 354 Utilities.getConfigDir()))
355 355
356 def __startQRegExp(self): 356 def __startQRegExp(self):
357 """ 357 """
358 Private slot to start the eric5 QRegExp editor dialog. 358 Private slot to start the eric6 QRegExp editor dialog.
359 """ 359 """
360 self.__startProc("eric5_qregexp.py", "--config={0}".format( 360 self.__startProc("eric6_qregexp.py", "--config={0}".format(
361 Utilities.getConfigDir())) 361 Utilities.getConfigDir()))
362 362
363 def __startPyRe(self): 363 def __startPyRe(self):
364 """ 364 """
365 Private slot to start the eric5 Python re editor dialog. 365 Private slot to start the eric6 Python re editor dialog.
366 """ 366 """
367 self.__startProc("eric5_re.py", "--config={0}".format( 367 self.__startProc("eric6_re.py", "--config={0}".format(
368 Utilities.getConfigDir())) 368 Utilities.getConfigDir()))
369 369
370 def __showRecentProjectsMenu(self): 370 def __showRecentProjectsMenu(self):
371 """ 371 """
372 Private method to set up the recent projects menu. 372 Private method to set up the recent projects menu.
440 440
441 @param act reference to the action that triggered (QAction) 441 @param act reference to the action that triggered (QAction)
442 """ 442 """
443 filename = act.data() 443 filename = act.data()
444 if filename: 444 if filename:
445 self.__startProc("eric5.py", filename) 445 self.__startProc("eric6.py", filename)
446 446
447 def __showPreferences(self): 447 def __showPreferences(self):
448 """ 448 """
449 Private slot to set the preferences. 449 Private slot to set the preferences.
450 """ 450 """

eric ide

mercurial