#
from BWizardPage import *
+from libbertos import *
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
<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>