Python PyQt4.QtCore.QVariant() Examples

The following are 30 code examples of PyQt4.QtCore.QVariant(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtCore , or try the search function .
Example #1
Source File: setting.py    From mishkal with GNU General Public License v3.0 6 votes vote down vote up
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
            dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            family=settings.value("font_base_family", "Traditional Arabic")
            size=settings.value("font_base_size", "12")
            size= int(size)
            ok = bool(size)
            bold=settings.value("font_base_bold", True)
            bold = bool(bold)
            dictsetting =settings.value("DictSetting", "1")
            dictsetting = int(dictsetting)
        if not ok:size=12;
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        
        if not ok:dictsetting=1;

##        self.BDictSetting.setCheckState(dictsetting); 
Example #2
Source File: compat.py    From P4VFX with MIT License 6 votes vote down vote up
def from_qvariant(qobj=None, convfunc=None):
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            assert isinstance(convfunc, collections.Callable)
            if convfunc in TEXT_TYPES or convfunc is to_text_string:
                return convfunc(qobj.toString())
            elif convfunc is bool:
                return qobj.toBool()
            elif convfunc is int:
                return qobj.toInt()[0]
            elif convfunc is float:
                return qobj.toDouble()[0]
            else:
                return convfunc(qobj)
        else:
            # PyQt API #2
            return qobj 
Example #3
Source File: ObjectCollection.py    From FlatCAM with MIT License 6 votes vote down vote up
def flags(self, index):
        if not index.isValid():
            return 0

        # Prevent groups from selection
        if not index.internalPointer().obj:
            return Qt.Qt.ItemIsEnabled
        else:
            return Qt.Qt.ItemIsEnabled | Qt.Qt.ItemIsSelectable | Qt.Qt.ItemIsEditable

        return QtCore.QAbstractItemModel.flags(self, index)

    # def data(self, index, role=Qt.Qt.DisplayRole):
    #     if not index.isValid() or not 0 <= index.row() < self.rowCount():
    #         return QtCore.QVariant()
    #     row = index.row()
    #     if role == Qt.Qt.DisplayRole:
    #         return self.object_list[row].options["name"]
    #     if role == Qt.Qt.DecorationRole:
    #         return self.icons[self.object_list[row].kind]
    #     # if role == Qt.Qt.CheckStateRole:
    #     #     if row in self.checked_indexes:
    #     #         return Qt.Qt.Checked
    #     #     else:
    #     #         return Qt.Qt.Unchecked 
Example #4
Source File: compat.py    From winpython with MIT License 6 votes vote down vote up
def from_qvariant(qobj=None, convfunc=None):
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            assert isinstance(convfunc, collections.Callable)
            if convfunc in TEXT_TYPES or convfunc is to_text_string:
                return convfunc(qobj.toString())
            elif convfunc is bool:
                return qobj.toBool()
            elif convfunc is int:
                return qobj.toInt()[0]
            elif convfunc is float:
                return qobj.toDouble()[0]
            else:
                return convfunc(qobj)
        else:
            # PyQt API #2
            return qobj 
Example #5
Source File: variables.py    From hashmal with GNU General Public License v3.0 6 votes vote down vote up
def headerData(self, section, orientation, role = QtCore.Qt.DisplayRole):
        if orientation == QtCore.Qt.Vertical:
            return QtCore.QVariant(None)

        data = None
        if section == 0:
            if role == QtCore.Qt.DisplayRole:
                data = 'Key'
            elif role == QtCore.Qt.ToolTipRole:
                data = 'Variable name'
        elif section == 1:
            if role == QtCore.Qt.DisplayRole:
                data = 'Value'
            elif role == QtCore.Qt.ToolTipRole:
                data = 'Variable value'

        return QtCore.QVariant(data) 
Example #6
Source File: driverWindow.py    From crazyflieROS with GNU General Public License v2.0 6 votes vote down vote up
def writeSettings(self):
        """ Write settings to load at next start up """
        rospy.logdebug("Saving session settings")
        settings = QSettings("omwdunkley", "flieROS"+str(self.options.radio))
        settings.setValue("pos", QVariant(self.pos()))
        settings.setValue("size", QVariant(self.size()))

        settings.setValue("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked()))
        settings.setValue("beepOn", QVariant(self.ui.checkBox_beep.isChecked()))
        settings.setValue("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked()))
        settings.setValue("killOn", QVariant(self.ui.checkBox_kill.isChecked()))
        settings.setValue("startConnect", QVariant(self.ui.checkBox_startupConnect.isChecked()))

        settings.setValue("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked()))
        settings.setValue("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked()))
        settings.setValue("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value()))
        settings.setValue("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value()))
        settings.setValue("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value()))
        settings.setValue("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value()))

        settings.setValue("logTreeH",QVariant(self.logManager.header().saveState()))
        settings.setValue("paramTreeH",QVariant(self.paramManager.header().saveState())) 
Example #7
Source File: driverWindow.py    From crazyflieROS with GNU General Public License v2.0 6 votes vote down vote up
def readSettings(self):
        """ Load settings from previous session """
        rospy.logdebug("Loading previous session settings")
        settings = QSettings("omwdunkley", "reset" if self.options.reset else "flieROS"+str(self.options.radio) )
        self.resize(settings.value("size", QVariant(QSize(300, 500))).toSize())
        self.move(settings.value("pos", QVariant(QPoint(200, 200))).toPoint())

        self.ui.checkBox_reconnect.setChecked(settings.value("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked())).toBool())
        self.ui.checkBox_beep.setChecked(settings.value("beepOn", QVariant(self.ui.checkBox_beep.isChecked())).toBool())
        self.ui.checkBox_xmode.setChecked(settings.value("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked())).toBool())
        self.ui.checkBox_kill.setChecked(settings.value("killOn", QVariant(self.ui.checkBox_kill.isChecked())).toBool())
        self.ui.checkBox_startupConnect.setChecked(settings.value("startConnect", QVariant(self.ui.checkBox_startupConnect)).toBool())

        self.ui.checkBox_pktHZ.setChecked(settings.value("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked())).toBool())
        self.ui.checkBox_logHZ.setChecked(settings.value("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked())).toBool())
        self.ui.horizontalSlider_pktHZ.setValue(settings.value("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value())).toInt()[0])
        self.ui.horizontalSlider_logHZ.setValue(settings.value("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value())).toInt()[0])
        self.ui.horizontalSlider_guiHZ.setValue(settings.value("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value())).toInt()[0])
        self.ui.horizontalSlider_AI.setValue(settings.value("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value())).toInt()[0])

        self.logManager.header().restoreState(settings.value("logTreeH", self.logManager.header().saveState()).toByteArray())
        self.paramManager.header().restoreState(settings.value("paramTreeH", self.paramManager.header().saveState()).toByteArray()) 
Example #8
Source File: variables.py    From hashmal with GNU General Public License v3.0 6 votes vote down vote up
def data(self, index, role = QtCore.Qt.DisplayRole):
        if role not in [QtCore.Qt.DisplayRole, QtCore.Qt.UserRole]:
            return QtCore.QVariant(None)
        data = None
        r = index.row()
        c = index.column()
        key = self.vars_data.keys()[r]

        if c == 0:
            data = key
        elif c == 1:
            if role == QtCore.Qt.DisplayRole:
                data = self.vars_data[key]
            elif role == QtCore.Qt.UserRole:
                value = self.vars_data[key]
                cached = self.classification_cache.get(value, None)
                if cached is None:
                    data = classify_data(value)
                    self.classification_cache[value] = data
                else:
                    data = cached

        return QtCore.QVariant(data) 
Example #9
Source File: tx_builder.py    From hashmal with GNU General Public License v3.0 6 votes vote down vote up
def set_fields(self, script=None, txTo=None, inIdx=None, hashType=None):
        """Populate model.

        Args:
            script (str): Human-readable script.
            txTo (Transaction): Transaction.
            inIdx (int): Input index.
            hashType (int): SigHash type.

        """
        if script is not None:
            self.setData(self.index(0, 0), QVariant(script))
        if txTo is not None:
            self.setData(self.index(0, 1), QVariant(b2x(txTo.serialize())))
        if inIdx is not None:
            self.setData(self.index(0, 2), QVariant(inIdx))
        if hashType is not None:
            self.setData(self.index(0, 3), QVariant(hashType & 0x1f), RawRole)
            self.setData(self.index(0, 4), QVariant(hashType & SIGHASH_ANYONECANPAY)) 
Example #10
Source File: compat.py    From qtpy with MIT License 6 votes vote down vote up
def from_qvariant(qobj=None, convfunc=None):
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            assert isinstance(convfunc, collections.Callable)
            if convfunc in TEXT_TYPES or convfunc is to_text_string:
                return convfunc(qobj.toString())
            elif convfunc is bool:
                return qobj.toBool()
            elif convfunc is int:
                return qobj.toInt()[0]
            elif convfunc is float:
                return qobj.toDouble()[0]
            else:
                return convfunc(qobj)
        else:
            # PyQt API #2
            return qobj 
Example #11
Source File: compat.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def from_qvariant(qobj=None, convfunc=None):
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            assert isinstance(convfunc, collections.Callable)
            if convfunc in TEXT_TYPES or convfunc is to_text_string:
                return convfunc(qobj.toString())
            elif convfunc is bool:
                return qobj.toBool()
            elif convfunc is int:
                return qobj.toInt()[0]
            elif convfunc is float:
                return qobj.toDouble()[0]
            else:
                return convfunc(qobj)
        else:
            # PyQt API #2
            return qobj 
Example #12
Source File: modeltest.py    From lic with GNU General Public License v3.0 5 votes vote down vote up
def nonDestructiveBasicTest(self):
        """
        nonDestructiveBasicTest tries to call a number of the basic functions (not all)
        to make sure the model doesn't outright segfault, testing the functions that makes sense.
        """
        assert(self.model.buddy(QtCore.QModelIndex()) == QtCore.QModelIndex())
        self.model.canFetchMore(QtCore.QModelIndex())
        assert(self.model.columnCount(QtCore.QModelIndex()) >= 0)
        assert(self.model.data(QtCore.QModelIndex(), QtCore.Qt.DisplayRole) == QtCore.QVariant())
        self.fetchingMore = True
        self.model.fetchMore(QtCore.QModelIndex())
        self.fetchingMore = False
        flags = self.model.flags(QtCore.QModelIndex())
        assert(int(flags & QtCore.Qt.ItemIsEnabled) == QtCore.Qt.ItemIsEnabled or int(flags & QtCore.Qt.ItemIsEnabled) == 0)
        self.model.hasChildren(QtCore.QModelIndex())
        self.model.hasIndex(0, 0)
        self.model.headerData(0, QtCore.Qt.Horizontal, QtCore.Qt.DisplayRole)
        self.model.index(0, 0, QtCore.QModelIndex())
        self.model.itemData(QtCore.QModelIndex())
        cache = QtCore.QVariant()
        self.model.match(QtCore.QModelIndex(), -1, cache)
        self.model.mimeTypes()
        assert(self.model.parent(QtCore.QModelIndex()) == QtCore.QModelIndex())
        assert(self.model.rowCount(QtCore.QModelIndex()) >= 0)
        variant = QtCore.QVariant()
        self.model.setData(QtCore.QModelIndex(), variant, -1)
        self.model.setHeaderData(-1, QtCore.Qt.Horizontal, QtCore.QVariant())
        self.model.setHeaderData(0, QtCore.Qt.Horizontal, QtCore.QVariant())
        self.model.setHeaderData(999999, QtCore.Qt.Horizontal, QtCore.QVariant())
        self.model.sibling(0, 0, QtCore.QModelIndex())
        self.model.span(QtCore.QModelIndex())
        self.model.supportedDropActions() 
Example #13
Source File: compat.py    From P4VFX with MIT License 5 votes vote down vote up
def to_qvariant(obj=None):  # analysis:ignore
        """Convert Python object to QVariant
        This is a transitional function from PyQt API#1 (QVariant exist)
        to PyQt API#2 and Pyside (QVariant does not exist)"""
        return obj 
Example #14
Source File: compat.py    From P4VFX with MIT License 5 votes vote down vote up
def from_qvariant(qobj=None, pytype=None):  # analysis:ignore
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        return qobj


# =============================================================================
# Wrappers around QFileDialog static methods
# ============================================================================= 
Example #15
Source File: dialogs.py    From deosorg with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, deviceMap):
        """
        Create dialog and fill it with labels from deviceMap
        @param deviceMap: dict device string -> device label
        """
        QtGui.QDialog.__init__(self)
        self.setupUi(self)

        for deviceStr, label in deviceMap.items():
            item = QtGui.QListWidgetItem(label)
            item.setData(QtCore.Qt.UserRole, QtCore.QVariant(deviceStr))
            self.trezorList.addItem(item)
        self.trezorList.setCurrentRow(0) 
Example #16
Source File: ObjectCollection.py    From FlatCAM with MIT License 5 votes vote down vote up
def data(self, index, role=None):
        if not index.isValid():
            return QtCore.QVariant()

        if role in [Qt.Qt.DisplayRole, Qt.Qt.EditRole]:
            obj = index.internalPointer().obj
            if obj:
                return obj.options["name"]
            else:
                return index.internalPointer().data(index.column())

        if role == Qt.Qt.ForegroundRole:
            obj = index.internalPointer().obj
            if obj:
                return Qt.QBrush(QtCore.Qt.black) if obj.options["plot"] else Qt.QBrush(QtCore.Qt.darkGray)
            else:
                return index.internalPointer().data(index.column())

        elif role == Qt.Qt.DecorationRole:
            icon = index.internalPointer().icon
            if icon:
                return icon
            else:
                return Qt.QPixmap()
        else:
            return QtCore.QVariant() 
Example #17
Source File: appgui.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
        except TypeError:
            family = str(settings.value("font_base_family", "Traditional Arabic"))
        try:
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
        except TypeError:
            size = settings.value("font_base_size", 12)
            size = int(size)
            ok = bool(size)
            
        if not ok:size=12;
        try:
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
        except TypeError:
            bold= bool(settings.value("font_base_bold", True))
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        try:
            dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            dictsetting = settings.value("DictSetting", 1);
            ok = bool(dictsetting)
        if not ok:dictsetting=1;

        self.BDictOption=dictsetting; 
Example #18
Source File: LNTextEdit.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def highlight(self):
            hi_selection = QtWidgets.QTextEdit.ExtraSelection()
 
            hi_selection.format.setBackground(self.palette().alternateBase())
            hi_selection.format.setProperty(QtGui.QTextFormat.FullWidthSelection, 1) #QtCore.QVariant(True)
            hi_selection.cursor = self.textCursor()
            hi_selection.cursor.clearSelection()
 
            self.setExtraSelections([hi_selection]) 
Example #19
Source File: vault.py    From deosorg with GNU General Public License v3.0 5 votes vote down vote up
def cachePassword(self, row, password):
        """
        Cache decrypted password for group and row. Cached items are
        keps as data of QTableWidgetItem so that deletion invalidates
        cache. Cache applies to currently selectedGroup. Switching
        between groups clears the table and thus invalidates cached
        passwords.
        """
        item = self.passwordTable.item(row, MainWindow.CACHE_IDX)
        item.setData(QtCore.Qt.UserRole, QtCore.QVariant(s2q(password))) 
Example #20
Source File: LNTextEdit_v3.2.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def highlight(self):
            hi_selection = QtGui.QTextEdit.ExtraSelection()
 
            hi_selection.format.setBackground(self.palette().alternateBase())
            hi_selection.format.setProperty(QtGui.QTextFormat.FullWidthSelection, 1) #QtCore.QVariant(True)
            hi_selection.cursor = self.textCursor()
            hi_selection.cursor.clearSelection()
 
            self.setExtraSelections([hi_selection]) 
Example #21
Source File: stonix_log_viewer.py    From stonix with GNU General Public License v2.0 5 votes vote down vote up
def highlight_search_results(self):
        """
        search through log output and highlight all matching search terms

        """

        # get search field text and set up cursor
        searchterm = self.log_search_text.toPlainText()
        cursor = self.log_display_browser.textCursor()
        cursor.select(QtGui.QTextCursor.Document)
        cursor.setCharFormat(QtGui.QTextCharFormat())

        # clear all highlighted items for each new search
        cursor.clearSelection()
        self.log_display_browser.moveCursor(QtGui.QTextCursor.End)

        # reset search results for each new search
        self.search_results = []

        # search through log_display and highlight all matching search terms
        while self.log_display_browser.find(searchterm, QtGui.QTextDocument.FindBackward):
            result = self.log_display_browser.ExtraSelection()

            highlighter = QtGui.QColor(QtCore.Qt.yellow).lighter(160)

            result.format.setBackground(highlighter)
            result.format.setProperty(QtGui.QTextFormat.FullWidthSelection, QVariant(True))
            result.cursor = self.log_display_browser.textCursor()
            result.cursor.clearSelection()
            self.search_results.append(result)

        self.log_display_browser.setExtraSelections(self.search_results)
        num_results = str(len(self.search_results))
        self.log_search_results_label.setText("Search Results: " + num_results) 
Example #22
Source File: main_window.py    From hashmal with GNU General Public License v3.0 5 votes vote down vote up
def closeEvent(self, event):
        # Save layout if configured to.
        if self.qt_settings.value('saveLayoutOnExit', defaultValue=QtCore.QVariant(False)).toBool():
            self.qt_settings.setValue('toolLayout/default', self.saveState())

        if self.close_script():
            logging.shutdown()
            event.accept()
        else:
            event.ignore() 
Example #23
Source File: gui_utils.py    From hashmal with GNU General Public License v3.0 5 votes vote down vote up
def set_amount(self, amount):
        if isinstance(amount, QtCore.QVariant):
            amount = amount.toUInt()
        self.setText(str(amount)) 
Example #24
Source File: compat.py    From qtpy with MIT License 5 votes vote down vote up
def from_qvariant(qobj=None, pytype=None):  # analysis:ignore
        """Convert QVariant object to Python object
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        return qobj


# =============================================================================
# Wrappers around QFileDialog static methods
# ============================================================================= 
Example #25
Source File: compat.py    From qtpy with MIT License 5 votes vote down vote up
def to_qvariant(obj=None):  # analysis:ignore
        """Convert Python object to QVariant
        This is a transitional function from PyQt API#1 (QVariant exist)
        to PyQt API#2 and Pyside (QVariant does not exist)"""
        return obj 
Example #26
Source File: compat.py    From qtpy with MIT License 5 votes vote down vote up
def to_qvariant(pyobj=None):
        """Convert Python object to QVariant
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            from PyQt4.QtCore import QVariant
            return QVariant(pyobj)
        else:
            # PyQt API #2
            return pyobj 
Example #27
Source File: layoutcombo.py    From segyviewer with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _get_spec(self, index):
        user_data = self.itemData(index)
        """ :type: QVariant"""
        spec = user_data.toPyObject()
        return {str(key): value for key, value in spec.items()} 
Example #28
Source File: paramManager.py    From crazyflieROS with GNU General Public License v2.0 5 votes vote down vote up
def requestValueChange(self, value):
        """ Send new value to flie. Flie callback updates GUI """
        try:
            self.cf.param.set_value("%s.%s" % (self.param.group, self.param.name), value)
        except NameError, err:
            QtGui.QTreeWidgetItem.setData(self, 2, Qt.DisplayRole, QVariant("Invalid..."))
            rospy.logwarn("Parameter [%s.%s] could not be updated from [%s] to [%s]: %s ", self.param.group, self.param.name, self.text(2), value, err)
            self.requestUpdate() 
Example #29
Source File: setting.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def writeSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            settings.setValue("font_base_family", QtCore.QVariant(self.font_result.family()))
            settings.setValue("font_base_size", QtCore.QVariant(self.font_result.pointSize()))
            settings.setValue("font_base_bold", QtCore.QVariant(self.font_result.bold()))
        except:
            settings.setValue("font_base_family", self.font_result.family())
            settings.setValue("font_base_size", self.font_result.pointSize())
            settings.setValue("font_base_bold", self.font_result.bold())
        #write of dictsetting options
##        settings.setValue("DictSetting", QtCore.QVariant(self.BDictSetting.checkState())); 
Example #30
Source File: compat.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def to_qvariant(pyobj=None):
        """Convert Python object to QVariant
        This is a transitional function from PyQt API #1 (QVariant exist)
        to PyQt API #2 and Pyside (QVariant does not exist)"""
        if PYQT_API_1:
            # PyQt API #1
            from PyQt4.QtCore import QVariant
            return QVariant(pyobj)
        else:
            # PyQt API #2
            return pyobj