コード例 #1
0
    def test_qt_base_import(self):
        mods = set(sys.modules.keys())

        other_apis = set(_QtAPIs)
        other_apis.remove(self.QtAPI)

        from taurus.external.qt import getQtName

        self.assertEquals(getQtName(), self.QtAPI)

        for other_api in other_apis:
            self.assertFalse(other_api in mods, other_api + " loaded in " + self.QtAPI + " test")

        self.assertTrue(self.QtAPI in mods, self.QtAPI + " not loaded")
        self.assertTrue(self.QtAPI + ".QtCore" in mods, "QtCore not loaded")

        for opt_mod in self.opt_mods:
            mod = "{0}.{1}".format(self.QtAPI, opt_mod)
            self.assertFalse(mod in mods-self._orig_mods, mod + " is loaded")
コード例 #2
0
ファイル: QtCore.py プロジェクト: cmft/taurus
##
## Taurus 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with Taurus.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################

"""This module exposes QtCore module"""

from taurus.external.qt import getQtName

__backend = getQtName()


def __to_qvariant_1(pyobj=None):
    """Properly converts a python object into a proper QVariant according to
    the PySide or PyQt API version in use

    :param pyobj: object to be converted
    :return: A proper QVariant"""
    from PyQt4.QtCore import QVariant
    if pyobj is None:
        return QVariant()  # PyQt 4.4 doesn't accept QVariant(None)
    return QVariant(pyobj)


def __from_qvariant_1(qobj=None, convfunc=None):
コード例 #3
0
ファイル: QtCore.py プロジェクト: MaxIV-KitsControls/taurus
## (at your option) any later version.
##
## Taurus 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 Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with Taurus.  If not, see <http://www.gnu.org/licenses/>.
##
##############################################################################
"""This module exposes QtCore module"""

from taurus.external.qt import getQtName

__backend = getQtName()


def __to_qvariant_1(pyobj=None):
    """Properly converts a python object into a proper QVariant according to
    the PySide or PyQt API version in use

    :param pyobj: object to be converted
    :return: A proper QVariant"""
    from PyQt4.QtCore import QVariant
    if pyobj is None:
        return QVariant()  # PyQt 4.4 doesn't accept QVariant(None)
    return QVariant(pyobj)


def __from_qvariant_1(qobj=None, convfunc=None):