Subversion Repositories Scribus

Rev

Rev 792 | Rev 900 | 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
 
899 cbradney 17
PyObject *scribus_filedia(PyObject *self, PyObject* args, PyObject* kw)
82 Franz 18
{
899 cbradney 19
        char *caption = NULL;
20
        char *filter = "";
21
        char *defName = "";
22
        int haspreview = 0;
23
        int issave = 0;
24
        char* kwargs[] = {"caption", "filter", "defaultname", "haspreview", "issave", NULL};
25
        if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssii", kwargs, &caption, &filter, &defName, &haspreview, &issave))
332 Franz 26
                return NULL;
645 fschmid 27
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
899 cbradney 28
        QString fName = Carrier->CFileDialog(".", caption, filter, defName, static_cast<bool>(haspreview), static_cast<bool>(issave), 0, 0);
645 fschmid 29
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
30
        return PyString_FromString(fName.utf8());
82 Franz 31
}
32
 
899 cbradney 33
PyObject *scribus_messdia(PyObject *self, PyObject* args, PyObject* kw)
138 Franz 34
{
35
        char *caption = "";
36
        char *message = "";
645 fschmid 37
        uint result;
138 Franz 38
        QMessageBox::Icon ico = QMessageBox::NoIcon;
899 cbradney 39
        int butt1 = QMessageBox::Ok|QMessageBox::Default;
138 Franz 40
        int butt2 = QMessageBox::NoButton;
41
        int butt3 = QMessageBox::NoButton;
899 cbradney 42
        char* kwargs[] = {"caption", "message", "icon", "button1", "button2", "button3", NULL};
43
        if (!PyArg_ParseTupleAndKeywords(args, kw, "ss|iiii", kwargs, &caption, &message, &ico, &butt1, &butt2, &butt3))
138 Franz 44
                return NULL;
645 fschmid 45
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
138 Franz 46
        QMessageBox mb(caption, message, ico, butt1, butt2, butt3, Carrier);
645 fschmid 47
        result = mb.exec();
48
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
49
        return PyInt_FromLong(static_cast<long>(result));
138 Franz 50
}
51
 
418 Franz 52
PyObject *scribus_valdialog(PyObject *self, PyObject* args)
53
{
54
        char *caption = "";
55
        char *message = "";
56
        char *value = "";
57
        if (!PyArg_ParseTuple(args, "ss|s", &caption, &message, &value))
58
                return NULL;
645 fschmid 59
        QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
418 Franz 60
        ValueDialog *d = new ValueDialog(Carrier, "d", TRUE, 0);
61
        d->dialogLabel->setText(message);
62
        d->valueEdit->setText(value);
63
        d->setCaption(caption);
64
        d->exec();
645 fschmid 65
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
418 Franz 66
        return PyString_FromString(d->valueEdit->text().utf8());
67
}