Subversion Repositories Scribus

Rev

Rev 643 | Rev 654 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
104 Franz 1
#include <Python.h>
103 Franz 2
#include "cmddialog.h"
82 Franz 3
#include "cmdvar.h"
332 Franz 4
#include "cmdutil.h"
418 Franz 5
#include "valuedialog.h"
138 Franz 6
#include <qmessagebox.h>
645 fschmid 7
#include <qcursor.h>
82 Franz 8
 
9
PyObject *scribus_newdocdia(PyObject *self, PyObject* args)
10
{
11
        if (!PyArg_ParseTuple(args, ""))
332 Franz 12
        {
421 Franz 13
                PyErr_SetString(PyExc_Exception, ERRPARAM + QString("newDocDialog()"));
82 Franz 14
                return NULL;
332 Franz 15
        }
645 fschmid 16
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
82 Franz 17
        bool ret = Carrier->slotFileNew();
645 fschmid 18
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
173 Franz 19
//      qApp->processEvents();
82 Franz 20
        return PyInt_FromLong(static_cast<long>(ret));
21
}
22
 
23
PyObject *scribus_filedia(PyObject *self, PyObject* args)
24
{
25
        char *caption;
26
        char *filter;
27
        char *defName;
645 fschmid 28
        QString fName;
82 Franz 29
        int pre = 0;
30
        int mode = 0;
332 Franz 31
        if (!PyArg_ParseTuple(args, "sss|ii", &caption, &filter, &defName, &pre, &mode))
32
        {
421 Franz 33
                PyErr_SetString(PyExc_Exception, ERRPARAM + QString("fileDialog(caption, filter, defaultname, pre, mode)"));
332 Franz 34
                return NULL;
35
        }
645 fschmid 36
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
37
        fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(pre), static_cast<bool>(mode), 0, 0);
38
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
39
        return PyString_FromString(fName.utf8());
82 Franz 40
}
41
 
138 Franz 42
PyObject *scribus_mess(PyObject *self, PyObject* args)
43
{
44
        char *caption;
45
        if (!PyArg_ParseTuple(args, "s", &caption))
332 Franz 46
        {
421 Franz 47
                PyErr_SetString(PyExc_Exception, ERRPARAM + QString("statusMessage(text)"));
138 Franz 48
                return NULL;
332 Franz 49
        }
138 Franz 50
        Carrier->FMess->setText(caption);
51
        return Py_None;
52
}
53
 
54
PyObject *scribus_messdia(PyObject *self, PyObject* args)
55
{
56
        char *caption = "";
57
        char *message = "";
645 fschmid 58
        uint result;
138 Franz 59
        QMessageBox::Icon ico = QMessageBox::NoIcon;
60
        int butt1 = QMessageBox::NoButton;
61
        int butt2 = QMessageBox::NoButton;
62
        int butt3 = QMessageBox::NoButton;
63
        if (!PyArg_ParseTuple(args, "ssii|ii", &caption, &message, &ico, &butt1, &butt2, &butt3))
332 Franz 64
        {
421 Franz 65
                PyErr_SetString(PyExc_Exception, ERRPARAM + QString("messageBox(caption, message, ico, butt1, butt2, butt3)"));
138 Franz 66
                return NULL;
332 Franz 67
        }
645 fschmid 68
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
138 Franz 69
        QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
645 fschmid 70
        result = mb.exec();
71
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
72
        return PyInt_FromLong(static_cast<long>(result));
138 Franz 73
}
74
 
418 Franz 75
PyObject *scribus_valdialog(PyObject *self, PyObject* args)
76
{
77
        char *caption = "";
78
        char *message = "";
79
        char *value = "";
80
        if (!PyArg_ParseTuple(args, "ss|s", &caption, &message, &value))
81
        {
421 Franz 82
                PyErr_SetString(PyExc_Exception, ERRPARAM + QString("valueDialog(caption, message [,defaultvalue])"));
418 Franz 83
                return NULL;
84
        }
645 fschmid 85
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
418 Franz 86
        ValueDialog *d = new ValueDialog(Carrier, "d", TRUE, 0);
87
        d->dialogLabel->setText(message);
88
        d->valueEdit->setText(value);
89
        d->setCaption(caption);
90
        d->exec();
645 fschmid 91
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
418 Franz 92
        return PyString_FromString(d->valueEdit->text().utf8());
93
}