Clean up code. Add comments. Init module with callback to register all
[bertos.git] / wizard / BWizardPage.py
index 8fa44c1e1304da964b5cc1d4c8f527cff7ec5e39..f6aeac67eeba83f9f7d1a3cdfa69a03b0d4fa058 100644 (file)
@@ -1,20 +1,47 @@
 #!/usr/bin/env python
 # encoding: utf-8
 #
 #!/usr/bin/env python
 # encoding: utf-8
 #
+# This file is part of BeRTOS.
+#
+# 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 2008 Develer S.r.l. (http://www.develer.com/)
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
-# All rights reserved.
 #
 #
-# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
 
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
 
+import os
+
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 from PyQt4 import uic
 
 import qvariant_converter
 
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 from PyQt4 import uic
 
 import qvariant_converter
 
+import const
+
 class BWizardPage(QWizardPage):
     """
     Base class for all the wizard pages. It has the utility method used in all
 class BWizardPage(QWizardPage):
     """
     Base class for all the wizard pages. It has the utility method used in all
@@ -23,7 +50,7 @@ class BWizardPage(QWizardPage):
     
     def __init__(self, wizardGui, parent = None):
         QWizardPage.__init__(self, parent)
     
     def __init__(self, wizardGui, parent = None):
         QWizardPage.__init__(self, parent)
-        self.pageContent = uic.loadUi(wizardGui, None)
+        self.pageContent = uic.loadUi(os.path.join(const.DATA_DIR, wizardGui), None)
         layout = QVBoxLayout()
         layout.addWidget(self.pageContent)
         self.setLayout(layout)
         layout = QVBoxLayout()
         layout.addWidget(self.pageContent)
         self.setLayout(layout)
@@ -57,6 +84,7 @@ class BWizardPage(QWizardPage):
         """
         return QApplication.instance().project.info(key)
     
         """
         return QApplication.instance().project.info(key)
     
+    @property
     def project(self):
         """
         Returns the BProject instance.
     def project(self):
         """
         Returns the BProject instance.
@@ -79,6 +107,18 @@ class BWizardPage(QWizardPage):
         Value is a QVariant and neet to be converted in a standard type.
         """
         return QApplication.instance().settings.value(QString(key), QVariant())
         Value is a QVariant and neet to be converted in a standard type.
         """
         return QApplication.instance().settings.value(QString(key), QVariant())
+
+    def plugins(self):
+        """
+        Returns the list of actived plugins.
+        """
+        return qvariant_converter.getStringList(self.settingsRetrieve("plugins"))
+
+    def setPlugins(self, plugins):
+        """
+        Stores the given list of actived plugins.
+        """
+        self.settingsStore("plugins", qvariant_converter.convertStringList(plugins))
     
     def versions(self):
         """
     
     def versions(self):
         """
@@ -144,7 +184,7 @@ class BWizardPage(QWizardPage):
     
     ## Methodo to be implemented in child classes when needed ##
     
     
     ## Methodo to be implemented in child classes when needed ##
     
-    def reloadData(self):
+    def reloadData(self, previous_id=None):
         """
         Method called before the page is loaded. The pages that need to use this
         method have to implement it.
         """
         Method called before the page is loaded. The pages that need to use this
         method have to implement it.
@@ -167,4 +207,4 @@ class BWizardPage(QWizardPage):
         """
         pass
     
         """
         pass
     
-    ####
\ No newline at end of file
+    ####