Esempio n. 1
0
  PyObject* Window_DoModal(Window *self, PyObject *args)
  {
    if (self->bIsPythonWindow)
    {
      self->bModal = true;

      if(self->iWindowId != ACTIVE_WINDOW) Window_Show(self, NULL);

      while (self->bModal && !g_application.m_bStop)
      {
        PyXBMC_MakePendingCalls();

        CPyThreadState pyState;
        if (WindowXML_Check(self))
          ((CGUIPythonWindowXML*)self->pWindow)->WaitForActionEvent(INFINITE);
        else if (WindowXMLDialog_Check(self))
          ((CGUIPythonWindowXMLDialog*)self->pWindow)->WaitForActionEvent(INFINITE);
        else
          ((CGUIPythonWindow*)self->pWindow)->WaitForActionEvent(INFINITE);
      }
    }
    Py_INCREF(Py_None);
    return Py_None;
  }
Esempio n. 2
0
  PyObject* XBMC_Sleep(PyObject *self, PyObject *args)
  {
    PyObject *pObject;
    if (!PyArg_ParseTuple(args, (char*)"O", &pObject)) return NULL;
    if (!PyInt_Check(pObject))
    {
      PyErr_Format(PyExc_TypeError, "argument must be a bool(integer) value");
      return NULL;
    }

    long i = PyInt_AsLong(pObject);
    //while(i != 0)
    //{
      CPyThreadState pyState;
      Sleep(i);//(500);
      pyState.Restore();

      PyXBMC_MakePendingCalls();
      //i = PyInt_AsLong(pObject);
    //}

    Py_INCREF(Py_None);
    return Py_None;
  }