Add a label that warn the user if the selected directory exists
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 3 Feb 2009 09:43:43 +0000 (09:43 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 3 Feb 2009 09:43:43 +0000 (09:43 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2252 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BFolderPage.py
wizard/ui/dir_select.ui

index 374b231da7c5ff8c8c96fac6487ca5bdc7a9313a..a14dda2f5d000e8c358b77d5904d2a29ad5fc853 100644 (file)
@@ -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("<font color='#FF0000'>Warning: the selected directory exists, it will be destroyed with all contained subdirectories and files...</font>"))
+            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):
index 7b9faae8bcf54ae508215cc39c4a02982e6419a1..41bbb5e6532d5493f4b96e25b63e82b4d7318862 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>369</width>
-    <height>119</height>
+    <width>381</width>
+    <height>146</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -90,7 +90,7 @@
             <string/>
            </property>
            <property name="icon" >
-            <iconset resource="bertos.qrc" >
+            <iconset resource="../bertos.qrc" >
              <normaloff>:/images/folderopen.png</normaloff>:/images/folderopen.png</iconset>
            </property>
            <property name="iconSize" >
      </item>
     </layout>
    </item>
+   <item>
+    <widget class="QLabel" name="warningLabel" >
+     <property name="text" >
+      <string/>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources>
-  <include location="bertos.qrc" />
+  <include location="../bertos.qrc" />
  </resources>
  <connections/>
 </ui>