11 import glob |
11 import glob |
12 |
12 |
13 from PyQt6.QtCore import Qt |
13 from PyQt6.QtCore import Qt |
14 from PyQt6.QtWidgets import QTreeWidget, QTreeWidgetItem, QDialog, QMenu |
14 from PyQt6.QtWidgets import QTreeWidget, QTreeWidgetItem, QDialog, QMenu |
15 |
15 |
16 from E5Gui.E5Application import e5App |
16 from E5Gui.EricApplication import ericApp |
17 from E5Gui import E5MessageBox |
17 from E5Gui import EricMessageBox |
18 |
18 |
19 import UI.PixmapCache |
19 import UI.PixmapCache |
20 |
20 |
21 |
21 |
22 class MultiProjectBrowser(QTreeWidget): |
22 class MultiProjectBrowser(QTreeWidget): |
301 if itm is not None and itm.parent() is not None: |
301 if itm is not None and itm.parent() is not None: |
302 projectFile = itm.data(0, MultiProjectBrowser.ProjectFileNameRole) |
302 projectFile = itm.data(0, MultiProjectBrowser.ProjectFileNameRole) |
303 projectPath = os.path.dirname(projectFile) |
303 projectPath = os.path.dirname(projectFile) |
304 |
304 |
305 if self.project.getProjectPath() == projectPath: |
305 if self.project.getProjectPath() == projectPath: |
306 E5MessageBox.warning( |
306 EricMessageBox.warning( |
307 self, |
307 self, |
308 self.tr("Delete Project"), |
308 self.tr("Delete Project"), |
309 self.tr("""The current project cannot be deleted.""" |
309 self.tr("""The current project cannot be deleted.""" |
310 """ Please close it first.""")) |
310 """ Please close it first.""")) |
311 else: |
311 else: |
313 projectFiles += glob.glob(os.path.join(projectPath, "*.e4p")) |
313 projectFiles += glob.glob(os.path.join(projectPath, "*.e4p")) |
314 if not projectFiles: |
314 if not projectFiles: |
315 # Oops, that should not happen; play it save |
315 # Oops, that should not happen; play it save |
316 res = False |
316 res = False |
317 elif len(projectFiles) == 1: |
317 elif len(projectFiles) == 1: |
318 res = E5MessageBox.yesNo( |
318 res = EricMessageBox.yesNo( |
319 self, |
319 self, |
320 self.tr("Delete Project"), |
320 self.tr("Delete Project"), |
321 self.tr("""<p>Shall the project <b>{0}</b> (Path:""" |
321 self.tr("""<p>Shall the project <b>{0}</b> (Path:""" |
322 """ {1}) really be deleted?</p>""").format( |
322 """ {1}) really be deleted?</p>""").format( |
323 itm.text(0), projectPath)) |
323 itm.text(0), projectPath)) |
324 else: |
324 else: |
325 res = E5MessageBox.yesNo( |
325 res = EricMessageBox.yesNo( |
326 self, |
326 self, |
327 self.tr("Delete Project"), |
327 self.tr("Delete Project"), |
328 self.tr("""<p>Shall the project <b>{0}</b> (Path:""" |
328 self.tr("""<p>Shall the project <b>{0}</b> (Path:""" |
329 """ {1}) really be deleted?</p>""" |
329 """ {1}) really be deleted?</p>""" |
330 """<p><b>Warning:</b> It contains <b>{2}</b>""" |
330 """<p><b>Warning:</b> It contains <b>{2}</b>""" |