Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
103 Franz 1
#include "cmddialog.h"
332 Franz 2
#include "cmdutil.h"
418 Franz 3
#include "valuedialog.h"
792 subik 4
 
138 Franz 5
#include <qmessagebox.h>
645 fschmid 6
#include <qcursor.h>
792 subik 7
 
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
                return NULL;
645 fschmid 27
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
28
        fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(pre), static_cast<bool>(mode), 0, 0);
29
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
30
        return PyString_FromString(fName.utf8());
82 Franz 31
}
32
 
138 Franz 33
PyObject *scribus_messdia(PyObject *self, PyObject* args)
34
{
35
        char *caption = "";
36
        char *message = "";
645 fschmid 37
        uint result;
138 Franz 38
        QMessageBox::Icon ico = QMessageBox::NoIcon;
39
        int butt1 = QMessageBox::NoButton;
40
        int butt2 = QMessageBox::NoButton;
41
        int butt3 = QMessageBox::NoButton;
42
        if (!PyArg_ParseTuple(args, "ssii|ii", &caption, &message, &ico, &butt1, &butt2, &butt3))
43
                return NULL;
645 fschmid 44
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
138 Franz 45
        QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
645 fschmid 46
        result = mb.exec();
47
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
48
        return PyInt_FromLong(static_cast<long>(result));
138 Franz 49
}
50
 
418 Franz 51
PyObject *scribus_valdialog(PyObject *self, PyObject* args)
52
{
53
        char *caption = "";
54
        char *message = "";
55
        char *value = "";
56
        if (!PyArg_ParseTuple(args, "ss|s", &caption, &message, &value))
57
                return NULL;
645 fschmid 58
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
418 Franz 59
        ValueDialog *d = new ValueDialog(Carrier, "d", TRUE, 0);
60
        d->dialogLabel->setText(message);
61
        d->valueEdit->setText(value);
62
        d->setCaption(caption);
63
        d->exec();
645 fschmid 64
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
418 Franz 65
        return PyString_FromString(d->valueEdit->text().utf8());
66
}