From 320721d8b6cab26650cbd91a4accb61f66ff0e62 Mon Sep 17 00:00:00 2001 From: duplo Date: Tue, 3 Feb 2009 09:43:43 +0000 Subject: [PATCH] Add a label that warn the user if the selected directory exists git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2252 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BFolderPage.py | 12 ++++++++++++ wizard/ui/dir_select.ui | 15 +++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/wizard/BFolderPage.py b/wizard/BFolderPage.py index 374b231d..a14dda2f 100644 --- a/wizard/BFolderPage.py +++ b/wizard/BFolderPage.py @@ -23,8 +23,12 @@ class BFolderPage(BWizardPage): BWizardPage.__init__(self, UI_LOCATION + "/dir_select.ui") self.setTitle(self.tr("Select the project name")) self._initializeAttributes() + self._setupUi() self._connectSignals() + def _setupUi(self): + self.pageContent.warningLabel.setVisible(False) + def _initializeAttributes(self): self._projectName = "" self._destinationFolder = os.path.expanduser("~") @@ -48,8 +52,16 @@ class BFolderPage(BWizardPage): if not self._destinationFolder.endswith(os.sep): self._destinationFolder += os.sep self.pageContent.projectPath.setText(self._destinationFolder + self._projectName) + if os.path.exists(self._destinationFolder + self._projectName): + self.pageContent.warningLabel.setVisible(True) + self.pageContent.warningLabel.setText(self.tr("Warning: the selected directory exists, it will be destroyed with all contained subdirectories and files...")) + else: + self.pageContent.warningLabel.setVisible(False) + self.pageContent.warningLabel.setText("") else: self.pageContent.projectPath.setText("None") + self.pageContent.warningLabel.setVisible(False) + self.pageContent.warningLabel.setText("") self.emit(SIGNAL("completeChanged()")) def _selectDirectory(self): diff --git a/wizard/ui/dir_select.ui b/wizard/ui/dir_select.ui index 7b9faae8..41bbb5e6 100644 --- a/wizard/ui/dir_select.ui +++ b/wizard/ui/dir_select.ui @@ -5,8 +5,8 @@ 0 0 - 369 - 119 + 381 + 146 @@ -90,7 +90,7 @@ - + :/images/folderopen.png:/images/folderopen.png @@ -131,10 +131,17 @@ + + + + + + + - + -- 2.25.1