7 Module implementing a starter for the system tray. |
7 Module implementing a starter for the system tray. |
8 """ |
8 """ |
9 |
9 |
10 import sys |
10 import sys |
11 import os |
11 import os |
|
12 import pathlib |
12 import contextlib |
13 import contextlib |
13 |
14 |
14 from PyQt6.QtCore import QProcess, QSettings, QFileInfo |
15 from PyQt6.QtCore import QProcess, QSettings |
15 from PyQt6.QtGui import QCursor |
16 from PyQt6.QtGui import QCursor |
16 from PyQt6.QtWidgets import QSystemTrayIcon, QMenu, QDialog, QApplication |
17 from PyQt6.QtWidgets import QSystemTrayIcon, QMenu, QDialog, QApplication |
17 |
18 |
18 from EricWidgets import EricMessageBox |
19 from EricWidgets import EricMessageBox |
19 from EricWidgets.EricApplication import ericApp |
20 from EricWidgets.EricApplication import ericApp |
204 Private method to load the recently opened project filenames. |
205 Private method to load the recently opened project filenames. |
205 """ |
206 """ |
206 rp = self.rsettings.value(Globals.recentNameProject) |
207 rp = self.rsettings.value(Globals.recentNameProject) |
207 if rp is not None: |
208 if rp is not None: |
208 for f in rp: |
209 for f in rp: |
209 if QFileInfo(f).exists(): |
210 if pathlib.Path(f).exists(): |
210 self.recentProjects.append(f) |
211 self.recentProjects.append(f) |
211 |
212 |
212 def __loadRecentMultiProjects(self): |
213 def __loadRecentMultiProjects(self): |
213 """ |
214 """ |
214 Private method to load the recently opened multi project filenames. |
215 Private method to load the recently opened multi project filenames. |
215 """ |
216 """ |
216 rmp = self.rsettings.value(Globals.recentNameMultiProject) |
217 rmp = self.rsettings.value(Globals.recentNameMultiProject) |
217 if rmp is not None: |
218 if rmp is not None: |
218 for f in rmp: |
219 for f in rmp: |
219 if QFileInfo(f).exists(): |
220 if pathlib.Path(f).exists(): |
220 self.recentMultiProjects.append(f) |
221 self.recentMultiProjects.append(f) |
221 |
222 |
222 def __loadRecentFiles(self): |
223 def __loadRecentFiles(self): |
223 """ |
224 """ |
224 Private method to load the recently opened filenames. |
225 Private method to load the recently opened filenames. |
225 """ |
226 """ |
226 rf = self.rsettings.value(Globals.recentNameFiles) |
227 rf = self.rsettings.value(Globals.recentNameFiles) |
227 if rf is not None: |
228 if rf is not None: |
228 for f in rf: |
229 for f in rf: |
229 if QFileInfo(f).exists(): |
230 if pathlib.Path(f).exists(): |
230 self.recentFiles.append(f) |
231 self.recentFiles.append(f) |
231 |
232 |
232 def __activated(self, reason): |
233 def __activated(self, reason): |
233 """ |
234 """ |
234 Private slot to handle the activated signal. |
235 Private slot to handle the activated signal. |