Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 410 → Rev 411

/trunk/Scribus/scribus/plugins/scriptplugin/cmdpage.cpp
40,7 → 40,7
if (!Carrier->HaveDoc)
return PyInt_FromLong(0L);
bool ret = Carrier->DoSaveAsEps(QString(Name));
// qApp->processEvents();
// qApp->processEvents();
return PyInt_FromLong(static_cast<long>(ret));
}
 
59,7 → 59,7
if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
return Py_None;
Carrier->DeletePage2(e);
// qApp->processEvents();
// qApp->processEvents();
return Py_None;
}
 
78,7 → 78,7
if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
return Py_None;
Carrier->view->GotoPage(e);
// qApp->processEvents();
// qApp->processEvents();
return Py_None;
}
 
97,13 → 97,13
if (e < 0)
Carrier->slotNewPageP(Carrier->view->Pages.count(), QString(name));
else
{
{
e--;
if ((e < 0) || (e > static_cast<int>(Carrier->view->Pages.count())-1))
return Py_None;
Carrier->slotNewPageP(e, QString(name));
}
// qApp->processEvents();
}
// qApp->processEvents();
return Py_None;
}
 
133,10 → 133,10
}
PyObject *t;
t = Py_BuildValue(
"(dd)",
PointToValue(Carrier->doc->PageB), // it's just view scale... * Carrier->doc->Scale),
PointToValue(Carrier->doc->PageH) // * Carrier->doc->Scale)
);
"(dd)",
PointToValue(Carrier->doc->PageB), // it's just view scale... * Carrier->doc->Scale),
PointToValue(Carrier->doc->PageH) // * Carrier->doc->Scale)
);
return t;
}
 
154,11 → 154,127
for (uint i = 0; i<Carrier->doc->ActPage->Items.count(); ++i)
{
row = Py_BuildValue((char*)"(sii)",
Carrier->doc->ActPage->Items.at(i)->AnName.ascii(),
Carrier->doc->ActPage->Items.at(i)->PType,
Carrier->doc->ActPage->Items.at(i)->ItemNr
);
Carrier->doc->ActPage->Items.at(i)->AnName.ascii(),
Carrier->doc->ActPage->Items.at(i)->PType,
Carrier->doc->ActPage->Items.at(i)->ItemNr
);
PyList_SetItem(l, i, row);
} // for
return l;
}
 
PyObject *scribus_getHguides(PyObject *self, PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("GetHGuides()"));
return NULL;
}
int n;
if (!Carrier->HaveDoc || (n = Carrier->doc->ActPage->YGuides.count()) == 0)
{
Py_INCREF(Py_None);
return Py_None;
}
int i;
double tmp;
PyObject *l, *guide;
l = PyList_New(0);
for (i=0; i<n; i++)
{
tmp = Carrier->doc->ActPage->YGuides[i];
guide = Py_BuildValue("d", PointToValue(tmp));
PyList_Append(l, guide);
}
return l;
}
 
PyObject *scribus_setHguides(PyObject *self, PyObject* args)
{
PyObject *l;
if (!PyArg_ParseTuple(args, "O", &l))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("SetHGuides(guides)"));
return NULL;
}
if (!PyList_Check(l))
{
PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
return NULL;
}
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
int i, n;
n = PyList_Size(l);
double guide;
Carrier->doc->ActPage->YGuides.clear();
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
{
PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
return NULL;
}
Carrier->doc->ActPage->YGuides += ValueToPoint(guide);
}
return Py_None;
}
 
PyObject *scribus_getVguides(PyObject *self, PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("GetVGuides()"));
return NULL;
}
int n;
if (!Carrier->HaveDoc || (n = Carrier->doc->ActPage->XGuides.count()) == 0)
{
Py_INCREF(Py_None);
return Py_None;
}
int i;
double tmp;
PyObject *l, *guide;
l = PyList_New(0);
for (i=0; i<n; i++)
{
tmp = Carrier->doc->ActPage->XGuides[i];
guide = Py_BuildValue("d", PointToValue(tmp));
PyList_Append(l, guide);
}
return l;
}
 
PyObject *scribus_setVguides(PyObject *self, PyObject* args)
{
PyObject *l;
if (!PyArg_ParseTuple(args, "O", &l))
{
PyErr_SetString(PyExc_Exception, ERRPARAM + QString("SetVGuides(guides)"));
return NULL;
}
if (!PyList_Check(l))
{
PyErr_SetString(PyExc_TypeError, QString("argument is not list: must be list of float values"));
return NULL;
}
Py_INCREF(Py_None);
if (!Carrier->HaveDoc)
return Py_None;
int i, n;
n = PyList_Size(l);
double guide;
Carrier->doc->ActPage->XGuides.clear();
for (i=0; i<n; i++)
{
if (!PyArg_Parse(PyList_GetItem(l, i), "d", &guide))
{
PyErr_SetString(PyExc_TypeError, QString("argument contains no-numeric values: must be list of float values"));
return NULL;
}
Carrier->doc->ActPage->XGuides += ValueToPoint(guide);
}
return Py_None;
}