From: duplo Date: Mon, 19 Jan 2009 18:24:33 +0000 (+0000) Subject: Add the module selection page X-Git-Tag: 2.1.0~498 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=2592938af49faf571b1fafbdfbd7ae43bdd629e8;p=bertos.git Add the module selection page git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2184 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py new file mode 100644 index 00000000..ada00db5 --- /dev/null +++ b/wizard/BModulePage.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# encoding: utf-8 +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# $Id:$ +# +# Author: Lorenzo Berni +# + +import os + +from PyQt4.QtGui import * +from BWizardPage import * +import bertos_utils + + +class BModulePage(BWizardPage): + + def __init__(self): + BWizardPage.__init__(self, "module_select.ui") + self.setTitle(self.tr("Configure the modules")) + self._setupUi() + self._connectSignals() + + def reloadData(self): + self._fillModuleList() + + def _setupUi(self): + self.pageContent.moduleList.setSortingEnabled(True) + self.pageContent.propertyTable.horizontalHeader().setResizeMode(QHeaderView.Stretch) + self.pageContent.propertyTable.horizontalHeader().setVisible(False) + #self.pageContent.propertyTable.verticalHeader().setResizeMode(QHeaderView.Stretch) + self.pageContent.propertyTable.verticalHeader().setVisible(False) + self.pageContent.propertyTable.setColumnCount(2) + self.pageContent.propertyTable.setRowCount(0) + + def _connectSignals(self): + self.connect(self.pageContent.moduleList, SIGNAL("currentRowChanged(int)"), self.moduleItemClicked) + + def _fillModuleList(self): + moduleInfos = bertos_utils.loadModuleInfos(self._projectInfoRetrieve("SOURCES_PATH")) + self._projectInfoStore("MODULE_INFO", moduleInfos) + for key, value in moduleInfos.items(): + self.pageContent.moduleList.addItem(QListWidgetItem(key)) + + def _fillParameterTable(self, value): + self.pageContent.propertyTable.clear() + self.pageContent.propertyTable.setRowCount(len(value)) + for index, element in enumerate(value): + self.pageContent.propertyTable.setItem(index, 0, QTableWidgetItem(element[0])) + self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(element[1])) + + def moduleItemClicked(self): + module = unicode(self.pageContent.moduleList.currentItem().text()) + self._fillParameterTable(self._projectInfoRetrieve("MODULE_INFO")[module]) + + + diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 2996f2a1..851021ce 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -16,6 +16,7 @@ import BFolderPage import BVersionPage import BCpuPage import BToolchainPage +import BModulePage class BWizard(QWizard): @@ -30,6 +31,7 @@ class BWizard(QWizard): self.addPage(BVersionPage.BVersionPage()) self.addPage(BCpuPage.BCpuPage()) self.addPage(BToolchainPage.BToolchainPage()) + self.addPage(BModulePage.BModulePage()) def _connectSignals(self): self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)