Add in the first wizard page the possibility of create a new project directory and...
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 11 Dec 2008 19:41:27 +0000 (19:41 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 11 Dec 2008 19:41:27 +0000 (19:41 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2014 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BStartPage.py
wizard/start.ui

index 8ee076e2b30ab139db7d22e94dce520dc71d1c55..ea39f19fa11f4324a3ff269972a51d54045dc3e3 100644 (file)
@@ -10,6 +10,7 @@
 #
 
 from BWizardPage import *
+from libbertos import *
 
 class BStartPage(BWizardPage):
     
@@ -17,15 +18,33 @@ class BStartPage(BWizardPage):
         BWizardPage.__init__(self, "start.ui")
         self._connectSignals()
         self.setTitle(self.tr("Create or edit a beRTOS project"))
+        self._initializeButtons()
+        self._setupUi()
         
     def _connectSignals(self):
-        self.connect(self.pageContent.newButton, SIGNAL("clicked()"), lambda: self.mutualExclusion("new"))
-        self.connect(self.pageContent.editButton, SIGNAL("clicked()"), lambda: self.mutualExclusion("edit"))
-        
-    def mutualExclusion(self, button):
-        if(button == "new"):
-            self.pageContent.newButton.setChecked(True)
-            self.pageContent.editButton.setChecked(False)
-        elif(button == "edit"):
-            self.pageContent.newButton.setChecked(False)
-            self.pageContent.editButton.setChecked(True)
\ No newline at end of file
+        self.connect(self.pageContent.newButton, SIGNAL("clicked()"), self.newProject)
+        self.connect(self.pageContent.editButton, SIGNAL("clicked()"), self.editProject)
+    
+    def _initializeButtons(self):
+        self.buttonGroup = QButtonGroup()
+        self.buttonGroup.addButton(self.pageContent.newButton)
+        self.buttonGroup.addButton(self.pageContent.editButton)
+        self.buttonGroup.setExclusive(True)
+
+    def _setupUi(self):
+        self.pageContent.newDescription.setVisible(False)
+        self.pageContent.editDescription.setVisible(False)
+    
+    def newProject(self):
+        filename = QFileDialog.getSaveFileName(self, self.tr("Destination directory"), "", "", "", QFileDialog.ShowDirsOnly)
+        if not filename.isEmpty():
+            self.pageContent.newDescription.setText("(\"" + filename + "\")")
+            self.pageContent.newDescription.setVisible(True)
+            # TODO: It's better to create it at the end of the wizard...
+            createBertosProject(filename)
+        else:
+            self.pageContent.newDescription.setText("")
+            self.pageContent.newDescription.setVisible(False)
+    
+    def editProject(self):
+        pass
\ No newline at end of file
index 38b0d1d9900a9ca87e5fcda5497b316a4ca7004b..7fc0a55362c08f7fb43ee4fa360dbff20e224412 100644 (file)
@@ -5,16 +5,16 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>355</width>
+    <width>358</width>
     <height>311</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2" >
+  <layout class="QVBoxLayout" name="verticalLayout_4" >
    <item>
-    <layout class="QVBoxLayout" name="verticalLayout" >
+    <layout class="QVBoxLayout" name="verticalLayout_3" >
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout" >
        <item>
           <bool>true</bool>
          </property>
          <property name="checked" >
-          <bool>true</bool>
+          <bool>false</bool>
          </property>
         </widget>
        </item>
        <item>
-        <widget class="QLabel" name="newDescription" >
-         <property name="text" >
-          <string>Create a new bertos project</string>
-         </property>
-        </widget>
+        <layout class="QVBoxLayout" name="verticalLayout" >
+         <item>
+          <widget class="QLabel" name="newAction" >
+           <property name="text" >
+            <string>Create a new bertos project</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="newDescription" >
+           <property name="text" >
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
      </item>
         </widget>
        </item>
        <item>
-        <widget class="QLabel" name="editDescription" >
-         <property name="text" >
-          <string>Edit an existent bertos project</string>
-         </property>
-        </widget>
+        <layout class="QVBoxLayout" name="verticalLayout_2" >
+         <item>
+          <widget class="QLabel" name="editAction" >
+           <property name="text" >
+            <string>Edit an existent bertos project</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="editDescription" >
+           <property name="text" >
+            <string/>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
      </item>