示例#1
0
PyObject *Node_protectHTML(PyObject *i_s, PyObject *i_oArgs)
{
	PyObject *i_oObj1 = NULL;
	if (!PyArg_ParseTuple(i_oArgs, "O", &i_oObj1)) { Q_ASSERT(false); return NULL; }
	QString l_sKey = from_unicode(i_oObj1);
	QString l_sRet = bind_node::protectHTML(l_sKey);
	return from_qstring(l_sRet);
}
示例#2
0
PyObject *Node_get_var(PyObject *i_s, PyObject *i_oArgs)
{
	PyObject *i_oObj1 = NULL;
	if (!PyArg_ParseTuple(i_oArgs, "O", &i_oObj1)) { Q_ASSERT(false); return NULL; }
	QString l_sCmd = from_unicode(i_oObj1);
	QString l_s = bind_node::get_var(l_sCmd);
	return from_qstring(l_s);
}
示例#3
0
PyObject *Node_get_cell(PyObject *i_s, PyObject *i_oArgs)
{
	PyObject * i_oObj1 = NULL;
	int row = 0; int col = 0;
	if (!PyArg_ParseTuple(i_oArgs, "Oii", &i_oObj1, &row, &col)) { Q_ASSERT(false); return NULL; }
	bind_node *l_oParent = (bind_node*) PyCObject_AsVoidPtr(i_oObj1);
	Q_ASSERT(l_oParent);
	QString content = l_oParent->tbl_cell(row, col);
	return from_qstring(content);
}
示例#4
0
PyObject *Node_get_val(PyObject *i_s, PyObject *i_oArgs)
{
	PyObject *i_oObj1 = NULL;
	PyObject *l_oObj2 = NULL;
	if (!PyArg_ParseTuple(i_oArgs, "OO", &i_oObj1, &l_oObj2)) { Q_ASSERT(false); return NULL; }
	bind_node* l_o = (bind_node*) PyCObject_AsVoidPtr(i_oObj1);
	Q_ASSERT(l_o);
	QString l_sCmd = from_unicode(l_oObj2);
	QString l_s = l_o->get_val(l_sCmd);
	return from_qstring(l_s);
}
示例#5
0
void
QTMInteractiveInputHelper::commit (int result) {
  if (wid && result == QDialog::Accepted) {
    QString  item = "#f";
    QComboBox* cb = sender()->findChild<QComboBox*> ("input");
    if (cb)  item = cb->currentText();
    static_cast<qt_input_text_widget_rep*>(wid->int_input.rep)->input =
      from_qstring (item);
    static_cast<qt_input_text_widget_rep*>(wid->int_input.rep)->cmd ();
  }
  sender()->deleteLater();
}
示例#6
0
PyObject *Node_get_item_ids(PyObject *i_s, PyObject *i_oArgs)
{
	QString ids = bind_node::get_item_ids();
	return from_qstring(ids);
}
// Convert a QVariant to a Python object.
bool qpydbus_to_pyobject(const QVariant *varp, PyObject **objp)
{
    // Handle QDBusObjectPath.
    if (varp->userType() == qMetaTypeId<QDBusObjectPath>())
    {
        *objp = from_qstring(varp->value<QDBusObjectPath>().path());

        return true;
    }

    // Handle QDBusSignature.
    if (varp->userType() == qMetaTypeId<QDBusSignature>())
    {
        *objp = from_qstring(varp->value<QDBusSignature>().signature());

        return true;
    }

    // Handle QDBusVariant.
    if (varp->userType() == qMetaTypeId<QDBusVariant>())
    {
        *objp = from_qvariant(varp->value<QDBusVariant>().variant());

        return true;
    }

    // Anything else must be a QDBusArgument.
    if (varp->userType() != qMetaTypeId<QDBusArgument>())
        return false;

    QDBusArgument arg = varp->value<QDBusArgument>();

    switch (arg.currentType())
    {
    case QDBusArgument::BasicType:
        *objp = from_qvariant(arg.asVariant());
        break;

    case QDBusArgument::VariantType:
        *objp = from_variant_type(arg);
        break;

    case QDBusArgument::ArrayType:
        *objp = from_array_type(arg);
        break;

    case QDBusArgument::StructureType:
        *objp = from_structure_type(arg);
        break;

    case QDBusArgument::MapType:
        *objp = from_map_type(arg);
        break;

    default:
        PyErr_Format(PyExc_TypeError, "unsupported DBus argument type %d",
                (int)arg.currentType());
        *objp = 0;
    }

    return true;
}