From: duplo Date: Wed, 22 Apr 2009 13:00:55 +0000 (+0000) Subject: Improove the ui X-Git-Tag: 2.1.0~57 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=f4d6115ee9868297dfa5be71a2de3eba3d44edc2;p=bertos.git Improove the ui git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2625 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BOutputPage.py b/wizard/BOutputPage.py index ef3c305a..72c32f5c 100644 --- a/wizard/BOutputPage.py +++ b/wizard/BOutputPage.py @@ -42,14 +42,21 @@ class BOutputPage(BWizardPage): Overload of the BWizardPage setupUi method. """ self._plugin_dict = {} - layout = QVBoxLayout() + scrollLayout = QVBoxLayout() + group, check = self.createNewOutput("BeRTOS Build System", + "Classic BeRTOS makefile based project", + True, False) + scrollLayout.addWidget(group) for plugin in self.availablePlugins(): - check = QCheckBox(plugin) - layout.addWidget(check) - check.setCheckState(Qt.Checked) + module = bertos_utils.loadPlugin(plugin) + group, check = self.createNewOutput(module.PLUGIN_NAME, + module.PLUGIN_DESCRIPTION, + True, True) + scrollLayout.addWidget(group) self._plugin_dict[check] = plugin + scrollLayout.addStretch() widget = QWidget() - widget.setLayout(layout) + widget.setLayout(scrollLayout) self.pageContent.scrollArea.setWidget(widget) def reloadData(self): @@ -75,4 +82,25 @@ class BOutputPage(BWizardPage): #### def availablePlugins(self): - return plugins.__all__ \ No newline at end of file + """ + Returns the list of the available plugins. + """ + return plugins.__all__ + + def createNewOutput(self, name, description, checked=True, enabled=True): + """ + Create a groupBox for the given pieces of information. Returns the + groupBox and the checkBox + """ + check = QCheckBox(description) + if checked: + check.setCheckState(Qt.Checked) + else: + check.setCheckState(Qt.Unchecked) + groupLayout = QVBoxLayout() + groupLayout.addWidget(check) + group = QGroupBox(name) + group.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) + group.setLayout(groupLayout) + group.setEnabled(enabled) + return group, check \ No newline at end of file diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 5bf0b430..b7898630 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -97,10 +97,16 @@ def createBertosProject(project_info): # Files for selected plugins relevants_files = {} for plugin in project_info.info("OUTPUT"): - module = getattr(__import__("plugins", {}, {}, [plugin]), plugin) + module = loadPlugin(plugin) relevants_files[plugin] = module.createProject(project_info) project_info.setInfo("RELEVANTS_FILES", relevants_files) +def loadPlugin(plugin): + """ + Returns the given plugin module. + """ + return getattr(__import__("plugins", {}, {}, [plugin]), plugin) + def mkGenerator(project_info, makefile): """ Generates the mk file for the current project. diff --git a/wizard/plugins/codelite.py b/wizard/plugins/codelite.py index 6e14f51e..d286f57e 100644 --- a/wizard/plugins/codelite.py +++ b/wizard/plugins/codelite.py @@ -13,6 +13,26 @@ import os import const +## Plugin interface ## + +PLUGIN_NAME = "CodeLite" + +PLUGIN_DESCRIPTION = "Create CodeLite project files" + +def createProject(project_info): + """ + Function that creates codelite projects and return the project relevant file. + """ + directory = project_info.info("PROJECT_PATH") + prjdir = directory + "/" + os.path.basename(directory) + workspace = codeliteWorkspaceGenerator(project_info) + open(directory + "/" + os.path.basename(prjdir) + ".workspace", "w").write(workspace) + project = codeliteProjectGenerator(project_info) + open(directory + "/" + os.path.basename(prjdir) + ".project", "w").write(project) + return directory + "/" + os.path.basename(prjdir) + ".workspace" + +#### + def clFiles(file_dict, directory): """ Creates the list of the lines for the files founded in file_dict, using @@ -68,15 +88,3 @@ def codeliteWorkspaceGenerator(project_info): while template.find("$project") != -1: template = template.replace("$project", project_name) return template - -def createProject(project_info): - """ - Function that creates codelite projects and return the project relevant file. - """ - directory = project_info.info("PROJECT_PATH") - prjdir = directory + "/" + os.path.basename(directory) - workspace = codeliteWorkspaceGenerator(project_info) - open(directory + "/" + os.path.basename(prjdir) + ".workspace", "w").write(workspace) - project = codeliteProjectGenerator(project_info) - open(directory + "/" + os.path.basename(prjdir) + ".project", "w").write(project) - return directory + "/" + os.path.basename(prjdir) + ".workspace" diff --git a/wizard/ui/output_select.ui b/wizard/ui/output_select.ui index aaccb714..ad4bfe72 100644 --- a/wizard/ui/output_select.ui +++ b/wizard/ui/output_select.ui @@ -20,60 +20,14 @@ Form - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - false - - - BeRTOS build system - - - true - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Classic BeRTOS makefile based project - - - - - - - - + + + 0 + 0 + + true @@ -83,7 +37,7 @@ 0 0 321 - 152 + 242