Remove the base/advance choice page.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 26 May 2010 14:16:12 +0000 (14:16 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 26 May 2010 14:16:12 +0000 (14:16 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3841 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BBoardPage.py
wizard/BTypePage.py [deleted file]
wizard/BWizard.py
wizard/bertos.py
wizard/ui/board_select.ui
wizard/ui/project_type_select.ui [deleted file]

index 301d46b7c36383abe30aa6a5aa50c11375d88686..6d7fc89b4d0347261ded550efb51f19b52f07202 100644 (file)
@@ -69,10 +69,18 @@ class BBoardPage(BWizardPage):
             preset_path = qvariant_converter.getStringDict(preset_path["info"])
             preset_path = preset_path["path"]
             self.setProjectInfo("PROJECT_BOARD", preset_path)
+            self.setProjectInfo("PROJECT_FROM_PRESET", True)
             return True
         else:
             return False
 
+    def nextId(self):
+        wizard = self.wizard()
+        if not self.projectInfo("PROJECT_FROM_PRESET"):
+            return wizard.pageIndex(BCpuPage)
+        else:
+            return QWizardPage.nextId(self)
+
     ####
 
     ## Overloaded BWizardPage methods ##
@@ -89,11 +97,13 @@ class BBoardPage(BWizardPage):
         """
         self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self.updateUi)
         self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self, SIGNAL("completeChanged()"))
+        self.connect(self.pageContent.customButton, SIGNAL("clicked()"), self.customButtonClicked)
 
     def reloadData(self):
         """
         Overload of the BWizardPage reloadData method.
         """
+        self.project.loadProjectPresets()
         preset_list = self.projectInfo("PRESET_TREE")
         preset_list = preset_list["children"]
         preset_list = sorted(preset_list.values(), _cmp)
@@ -116,6 +126,10 @@ class BBoardPage(BWizardPage):
                 self.pageContent.imageLabel.setVisible(False)
             self.pageContent.descriptionLabel.setText(description)
 
+    def customButtonClicked(self):
+        self.setProjectInfo("PROJECT_FROM_PRESET", False)
+        self.wizard().next()
+
     ####
 
     def setItems(self, preset_list):
diff --git a/wizard/BTypePage.py b/wizard/BTypePage.py
deleted file mode 100644 (file)
index 0968156..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-# encoding: utf-8
-#
-# This file is part of slimqc.
-#
-# Bertos is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-# As a special exception, you may use this file as part of a free software
-# library without restriction.  Specifically, if other files instantiate
-# templates or use macros or inline functions from this file, or you compile
-# this file and link it with other files to produce an executable, this
-# file does not by itself cause the resulting executable to be covered by
-# the GNU General Public License.  This exception does not however
-# invalidate any other reasons why the executable file might be covered by
-# the GNU General Public License.
-#
-# Copyright 2010 Develer S.r.l. (http://www.develer.com/)
-#
-# $Id$
-#
-# Author: Lorenzo Berni <duplo@develer.com>
-#
-
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-
-from BWizardPage import BWizardPage
-
-from BBoardPage import BBoardPage
-from BCpuPage import BCpuPage
-
-from const import UI_LOCATION
-
-class BTypePage(BWizardPage):
-    def __init__(self):
-        BWizardPage.__init__(self, UI_LOCATION + "/project_type_select.ui")
-        self.setTitle(self.tr("Select the project type"))
-
-    ## Overloaded QWizardPage methods ##
-
-    def isComplete(self):
-        self.setProjectInfo("PROJECT_FROM_PRESET", self.from_preset)
-        return True
-
-    def nextId(self):
-        if self.from_preset:
-            return self.wizard().pageIndex(BBoardPage)
-        else:
-            return self.wizard().pageIndex(BCpuPage)
-
-    ####
-
-    ## Overloaded BWizardPage methods ##
-
-    def connectSignals(self):
-        self.connect(self.pageContent.predefinedButton, SIGNAL("toggled(bool)"), self, SIGNAL("completeChanged()"))
-
-    def reloadData(self):
-        self.project.loadProjectPresets()
-        self.pageContent.predefinedButton.setEnabled(len(self.has_presets) > 0)
-        self.pageContent.predefinedButton.setChecked(len(self.has_presets) > 0)
-        self.pageContent.customButton.setChecked(len(self.has_presets) == 0)
-
-    ####
-
-    @property
-    def from_preset(self):
-        return self.pageContent.predefinedButton.isChecked()
-
-    @property
-    def has_presets(self):
-        preset_tree = self.project.info("PRESET_TREE")
-        return isinstance(preset_tree, dict) and preset_tree.get("children", [])
\ No newline at end of file
index 56d379437c3047e023033911f4e7356020deeeca..4fd560354d3a7b2ab86bd1a68782823169727682 100644 (file)
@@ -38,16 +38,6 @@ import copy
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
-import BFolderPage
-import BVersionPage
-import BTypePage
-import BCpuPage
-import BToolchainPage
-import BModulePage
-import BOutputPage
-import BCreationPage
-import BFinalPage
-
 try:
     from version import wizard_version
 except ImportError:
index abee435b7f05a033f0cf030bb17b2b99ce08a3b4..5576ab27e98a52d54e7a7fdd1122fb4a756187bc 100755 (executable)
@@ -48,7 +48,6 @@ from BWizard import BWizard
 
 from BIntroPage import BIntroPage
 from BFolderPage import BFolderPage
-from BTypePage import BTypePage
 from BBoardPage import BBoardPage
 from BProjectPresets import BProjectPresets
 from BRoutePage import BRoutePage
@@ -69,7 +68,7 @@ from LoadException import VersionException, ToolchainException
 
 def newProject():
     QApplication.instance().project = BProject()
-    page_list = [BIntroPage, BFolderPage, BVersionPage, BTypePage, BBoardPage, BProjectPresets, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage]
+    page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BProjectPresets, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage]
     wizard = BWizard(page_list)
     wizard.show()
     wizard.exec_()
index 0b59a125bc2591bb4ba2f7d911a5118cb5553b12..6731a70eca18f100734cd3e4fd03533100e2d83a 100644 (file)
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+  <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
    <item>
-    <layout class="QVBoxLayout" name="verticalLayout_2">
+    <layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0">
      <item>
-      <widget class="QListWidget" name="boardList">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="minimumSize">
-        <size>
-         <width>200</width>
-         <height>0</height>
-        </size>
-       </property>
-       <property name="maximumSize">
-        <size>
-         <width>200</width>
-         <height>16777215</height>
-        </size>
-       </property>
-      </widget>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QListWidget" name="boardList">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>200</width>
+           <height>16777215</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="customButton">
+         <property name="toolTip">
+          <string>&lt;p&gt;&lt;strong&gt;Custom board project &lt;/strong&gt;- select me when your board is not preset into the list above.&lt;/p&gt;</string>
+         </property>
+         <property name="text">
+          <string>Custom Board</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
      </item>
     </layout>
    </item>
@@ -50,7 +94,7 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>318</width>
+        <width>316</width>
         <height>336</height>
        </rect>
       </property>
diff --git a/wizard/ui/project_type_select.ui b/wizard/ui/project_type_select.ui
deleted file mode 100644 (file)
index 67c27be..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
-   <item>
-    <widget class="QGroupBox" name="groupBox">
-     <property name="title">
-      <string/>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QRadioButton" name="predefinedButton">
-        <property name="text">
-         <string>Predefined board</string>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QRadioButton" name="customButton">
-        <property name="text">
-         <string>Custom board</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>194</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>