From ee276ea346d90090f039720664dbb18d50e6bf7b Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 12 Jan 2009 09:51:47 +0000 Subject: [PATCH] Attempt to make usable the wizard for the pyqt<4.4.4 users git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2158 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 5 ++- wizard/BToolchainPage.py | 5 ++- wizard/BToolchainSearch.py | 5 ++- wizard/BVersionPage.py | 5 ++- wizard/BWizardPage.py | 5 ++- wizard/qvariant_converter_old.py | 53 ++++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 wizard/qvariant_converter_old.py diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index 6494e34d..e329dbc8 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -12,7 +12,10 @@ from BWizardPage import * import bertos_utils -import qvariant_converter +if PYQT_VERSION_STR > "4.4.3": + import qvariant_converter_new as qvariant_converter +else: + import qvariant_converter_old as qvariant_converter class BCpuPage(BWizardPage): diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index 2383c393..164f1324 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -14,7 +14,10 @@ import os from BWizardPage import * import BToolchainSearch import bertos_utils -import qvariant_converter +if PYQT_VERSION_STR > "4.4.3": + import qvariant_converter_new as qvariant_converter +else: + import qvariant_converter_old as qvariant_converter class BToolchainPage(BWizardPage): diff --git a/wizard/BToolchainSearch.py b/wizard/BToolchainSearch.py index c2f57e34..48f8c764 100644 --- a/wizard/BToolchainSearch.py +++ b/wizard/BToolchainSearch.py @@ -13,7 +13,10 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * import PyQt4.uic as uic -import qvariant_converter +if PYQT_VERSION_STR > "4.4.3": + import qvariant_converter_new as qvariant_converter +else: + import qvariant_converter_old as qvariant_converter class BToolchainSearch(QDialog): diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index 2f5a6260..1d078565 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -12,7 +12,10 @@ from PyQt4.QtGui import * from BWizardPage import * import bertos_utils -import qvariant_converter +if PYQT_VERSION_STR > "4.4.3": + import qvariant_converter_new as qvariant_converter +else: + import qvariant_converter_old as qvariant_converter class BVersionPage(BWizardPage): diff --git a/wizard/BWizardPage.py b/wizard/BWizardPage.py index b4fc6217..f7b60c37 100644 --- a/wizard/BWizardPage.py +++ b/wizard/BWizardPage.py @@ -13,7 +13,10 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import uic -import qvariant_converter +if PYQT_VERSION_STR > "4.4.3": + import qvariant_converter_new as qvariant_converter +else: + import qvariant_converter_old as qvariant_converter class BWizardPage(QWizardPage): diff --git a/wizard/qvariant_converter_old.py b/wizard/qvariant_converter_old.py new file mode 100644 index 00000000..0a41919d --- /dev/null +++ b/wizard/qvariant_converter_old.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# encoding: utf-8 +# +# Copyright 2009 Develer S.r.l. (http://www.develer.com/) +# All rights reserved. +# +# $Id:$ +# +# Author: Lorenzo Berni +# + +from PyQt4.QtCore import * + +def getString(qvariant): + string = qvariant.toPyObject() + return string + +def convertString(string): + return QVariant(string) + +def getStringList(qvariant): + string_list = qvariant.toPyObject() + return string_list + +def convertStringList(string_list): + return QVariant(string_list) + +def getStringDict(qvariant): + dict_str_str = qvariant.toPyObject() + return dict_str_str + +def convertStringDict(string_dict): + return QVariant(string_dict) + +def getBool(qvariant): + return qvariant.toBool() + +def convertBool(boolean): + return QVariant(boolean) + +def getBoolDict(qvariant): + dict_str_bool = qvariant.toPyObject() + return dict_str_bool + +def convertBoolDict(dict_str_bool): + return QVariant(dict_str_bool) + +def getDict(qvariant): + dict_str_variant = qvariant.toPyObject() + return dict_str_variant + +def convertDict(dict_str_variant): + return QVariant(dict_str_variant) -- 2.25.1