Improove the ui
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 22 Apr 2009 13:00:55 +0000 (13:00 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 22 Apr 2009 13:00:55 +0000 (13:00 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2625 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BOutputPage.py
wizard/bertos_utils.py
wizard/plugins/codelite.py
wizard/ui/output_select.ui

index ef3c305af5d1813ea149d8cc6ab757798267aee9..72c32f5c5e634e2422826a13fe8a08d6f67add07 100644 (file)
@@ -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
index 5bf0b4306204ba1db4dbf89e7a2dc2ff8f6f6663..b7898630dae2be6cee032dd6c5e12d4d9520d070 100644 (file)
@@ -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.
index 6e14f51e61404a53b8f102883ec4b6e46927fb12..d286f57e242b703257a599841522b9addc382597 100644 (file)
@@ -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"
index aaccb714ec76f1b6b736c1292fbc8795698d5c80..ad4bfe72c89d46a45f7d90562e29e6da452d8886 100644 (file)
    <string>Form</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QFrame" name="frame">
-     <property name="frameShape">
-      <enum>QFrame::StyledPanel</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Raised</enum>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
-       <widget class="QCheckBox" name="standardCheckBox">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="text">
-         <string>BeRTOS build system</string>
-        </property>
-        <property name="checkable">
-         <bool>true</bool>
-        </property>
-        <property name="checked">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout">
-        <item>
-         <spacer name="horizontalSpacer">
-          <property name="orientation">
-           <enum>Qt::Horizontal</enum>
-          </property>
-          <property name="sizeHint" stdset="0">
-           <size>
-            <width>40</width>
-            <height>20</height>
-           </size>
-          </property>
-         </spacer>
-        </item>
-        <item>
-         <widget class="QLabel" name="bbsLabel">
-          <property name="text">
-           <string>Classic BeRTOS makefile based project</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-     </layout>
-    </widget>
-   </item>
    <item>
     <widget class="QScrollArea" name="scrollArea">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="widgetResizable">
       <bool>true</bool>
      </property>
@@ -83,7 +37,7 @@
         <x>0</x>
         <y>0</y>
         <width>321</width>
-        <height>152</height>
+        <height>242</height>
        </rect>
       </property>
      </widget>