Subversion Repositories Scribus

Rev

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