14 import pathlib |
14 import pathlib |
15 |
15 |
16 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
16 from PyQt6.QtCore import QThread, pyqtSignal, QProcess |
17 from PyQt6.QtWidgets import QDialog, QInputDialog, QApplication, QMenu |
17 from PyQt6.QtWidgets import QDialog, QInputDialog, QApplication, QMenu |
18 |
18 |
19 from EricWidgets.EricApplication import ericApp |
19 from eric7.EricWidgets.EricApplication import ericApp |
20 from EricWidgets import EricMessageBox, EricFileDialog |
20 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
21 from EricWidgets.EricProgressDialog import EricProgressDialog |
21 from eric7.EricWidgets.EricProgressDialog import EricProgressDialog |
22 |
22 |
23 from .ProjectBrowserModel import ( |
23 from .ProjectBrowserModel import ( |
24 ProjectBrowserFileItem, |
24 ProjectBrowserFileItem, |
25 ProjectBrowserSimpleDirectoryItem, |
25 ProjectBrowserSimpleDirectoryItem, |
26 ProjectBrowserDirectoryItem, |
26 ProjectBrowserDirectoryItem, |
27 ProjectBrowserFormType, |
27 ProjectBrowserFormType, |
28 ) |
28 ) |
29 from .ProjectBaseBrowser import ProjectBaseBrowser |
29 from .ProjectBaseBrowser import ProjectBaseBrowser |
30 |
30 |
31 import UI.PixmapCache |
31 from eric7.EricGui import EricPixmapCache |
32 from UI.NotificationWidget import NotificationTypes |
32 from eric7.UI.NotificationWidget import NotificationTypes |
33 |
33 |
34 |
34 |
35 import Preferences |
35 from eric7 import Preferences, Utilities |
36 import Utilities |
|
37 |
36 |
38 from eric7config import getConfig |
37 from eric7config import getConfig |
39 |
38 |
40 |
39 |
41 class ProjectFormsBrowser(ProjectBaseBrowser): |
40 class ProjectFormsBrowser(ProjectBaseBrowser): |
666 fn2 = itm.fileName() |
665 fn2 = itm.fileName() |
667 fullNames.append(fn2) |
666 fullNames.append(fn2) |
668 fn = self.project.getRelativePath(fn2) |
667 fn = self.project.getRelativePath(fn2) |
669 files.append(fn) |
668 files.append(fn) |
670 |
669 |
671 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
670 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
672 |
671 |
673 dlg = DeleteFilesConfirmationDialog( |
672 dlg = DeleteFilesConfirmationDialog( |
674 self.parent(), |
673 self.parent(), |
675 self.tr("Delete forms"), |
674 self.tr("Delete forms"), |
676 self.tr("Do you really want to delete these forms from the project?"), |
675 self.tr("Do you really want to delete these forms from the project?"), |
775 for line in self.buf.splitlines(): |
774 for line in self.buf.splitlines(): |
776 f.write(line + "\n") |
775 f.write(line + "\n") |
777 if self.compiledFile not in self.project.pdata["SOURCES"]: |
776 if self.compiledFile not in self.project.pdata["SOURCES"]: |
778 self.project.appendFile(ofn) |
777 self.project.appendFile(ofn) |
779 ui.showNotification( |
778 ui.showNotification( |
780 UI.PixmapCache.getPixmap("designer48"), |
779 EricPixmapCache.getPixmap("designer48"), |
781 self.tr("Form Compilation"), |
780 self.tr("Form Compilation"), |
782 self.tr("The compilation of the form file" " was successful."), |
781 self.tr("The compilation of the form file" " was successful."), |
783 ) |
782 ) |
784 self.project.projectFormCompiled.emit(self.compiledFile) |
783 self.project.projectFormCompiled.emit(self.compiledFile) |
785 except OSError as msg: |
784 except OSError as msg: |
786 ui.showNotification( |
785 ui.showNotification( |
787 UI.PixmapCache.getPixmap("designer48"), |
786 EricPixmapCache.getPixmap("designer48"), |
788 self.tr("Form Compilation"), |
787 self.tr("Form Compilation"), |
789 self.tr( |
788 self.tr( |
790 "<p>The compilation of the form file failed.</p>" |
789 "<p>The compilation of the form file failed.</p>" |
791 "<p>Reason: {0}</p>" |
790 "<p>Reason: {0}</p>" |
792 ).format(str(msg)), |
791 ).format(str(msg)), |
793 kind=NotificationTypes.CRITICAL, |
792 kind=NotificationTypes.CRITICAL, |
794 timeout=0, |
793 timeout=0, |
795 ) |
794 ) |
796 else: |
795 else: |
797 ui.showNotification( |
796 ui.showNotification( |
798 UI.PixmapCache.getPixmap("designer48"), |
797 EricPixmapCache.getPixmap("designer48"), |
799 self.tr("Form Compilation"), |
798 self.tr("Form Compilation"), |
800 self.tr("The compilation of the form file failed."), |
799 self.tr("The compilation of the form file failed."), |
801 kind=NotificationTypes.CRITICAL, |
800 kind=NotificationTypes.CRITICAL, |
802 timeout=0, |
801 timeout=0, |
803 ) |
802 ) |