Esempio n. 1
0
  /* For backwards compatability we have to check the action code
   * against an integer
   * The first argument is always an Action object
   */
  PyObject* Action_RichCompare(Action* obj1, PyObject* obj2, int method)
  {
    if (method == Py_EQ)
    {
      if (Action_Check(obj2))
      {
        // both are Action objects
        Action* a2 = (Action*)obj2;

        if (obj1->id == a2->id &&
            obj1->buttonCode == a2->buttonCode &&
            obj1->fAmount1 == a2->fAmount1 &&
            obj1->fAmount2 == a2->fAmount2 &&
            obj1->fRepeat == a2->fRepeat &&
            obj1->strAction == a2->strAction)
        {
          Py_RETURN_TRUE;
        }
        else
        {
          Py_RETURN_FALSE;
        }
      }
      else
      {
        // for backwards compatability in python scripts
        PyObject* o1 = PyLong_FromLong(obj1->id);
        return PyObject_RichCompare(o1, obj2, method);
      }
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
  }
Esempio n. 2
0
static PyObject* MMSV2GUI_invokeLater(PyObject *self, PyObject *args)
{
  PyObject* pObject = NULL;

  if (!PyArg_ParseTuple(args, "O", &pObject))
   return NULL;

  if(Action_Check(pObject))
  {
    PyMMSAction* pAction = new PyMMSAction;

    Py_INCREF(pObject);
    pAction->pCallback = pObject;

    Py_AddPendingCall(Py_MMS_InvokeLater, pAction);
    Py_PulseActionEvent();
  }

  Py_INCREF(Py_None);
  return Py_None;
}