Subversion Repositories Scribus

Rev

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