Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
cmddialog.h File Reference
#include "cmdvar.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 PyDoc_STRVAR (scribus_newdocdia__doc__, QT_TR_NOOP("newDocDialog() -> bool\n\ \n\ Displays the \"New Document\" dialog box. Creates a new document if the user\n\ accepts the settings. Does not create a document if the user presses cancel.\n\ Returns true if a new document was created.\n\ "))
 Calling Dialogs from Scribus.
PyObject * scribus_newdocdia (PyObject *)
 Raises the Scribus New Document dialog.
 PyDoc_STRVAR (scribus_filedia__doc__, QT_TR_NOOP("fileDialog(\"caption\", [\"filter\", \"defaultname\", haspreview, issave, isdir]) -> string with filename\n\ \n\ Shows a File Open dialog box with the caption \"caption\". Files are filtered\n\ with the filter string \"filter\". A default filename or file path can also\n\ supplied, leave this string empty when you don't want to use it. A value of\n\ True for haspreview enables a small preview widget in the FileSelect box. When\n\ the issave parameter is set to True the dialog acts like a \"Save As\" dialog\n\ otherwise it acts like a \"File Open Dialog\". When the isdir parameter is True\n\ the dialog shows and returns only directories. The default for all of the\n\ opional parameters is False.\n\ \n\ The filter, if specified, takes the form 'comment (*.type *.type2 ...)'.\n\ For example 'Images (*.png *.xpm *.jpg)'.\n\ \n\ Refer to the Qt-Documentation for QFileDialog for details on filters.\n\ \n\ Example: fileDialog('Open input', 'CSV files (*.csv)')\n\ Example: fileDialog('Save report', defaultname='report.txt', issave=True)\n\ "))
 docstring
PyObject * scribus_filedia (PyObject *, PyObject *args, PyObject *kw)
 Raises file dialog.
 PyDoc_STRVAR (scribus_messdia__doc__, QT_TR_NOOP("messageBox(\"caption\", \"message\",\n\ icon=ICON_NONE, button1=BUTTON_OK|BUTTONOPT_DEFAULT,\n\ button2=BUTTON_NONE, button3=BUTTON_NONE) -> integer\n\ \n\ Displays a message box with the title \"caption\", the message \"message\", and\n\ an icon \"icon\" and up to 3 buttons. By default no icon is used and a single\n\ button, OK, is displayed. Only the caption and message arguments are required,\n\ though setting an icon and appropriate button(s) is strongly\n\ recommended. The message text may contain simple HTML-like markup.\n\ \n\ Returns the number of the button the user pressed. Button numbers start\n\ at 1.\n\ \n\ For the icon and the button parameters there are predefined constants available\n\ with the same names as in the Qt Documentation. These are the BUTTON_* and\n\ ICON_* constants defined in the module. There are also two extra constants that\n\ can be binary-ORed with button constants:\n\ BUTTONOPT_DEFAULT Pressing enter presses this button.\n\ BUTTONOPT_ESCAPE Pressing escape presses this button.\n\ \n\ Usage examples:\n\ result = messageBox('Script failed',\n\ 'This script only works when you have a text frame selected.',\n\ ICON_ERROR)\n\ result = messageBox('Monkeys!', 'Something went ook! <i>Was it a monkey?</i>',\n\ ICON_WARNING, BUTTON_YES|BUTTONOPT_DEFAULT,\n\ BUTTON_NO, BUTTON_IGNORE|BUTTONOPT_ESCAPE)\n\ \n\ Defined button and icon constants:\n\ BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO,\n\ BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL,\n\ ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.\n\ "))
 docstring
PyObject * scribus_messdia (PyObject *, PyObject *args, PyObject *kw)
 Displays a message box with - caption, message, icon, button and two more buttons optional.
 PyDoc_STRVAR (scribus_valdialog__doc__, QT_TR_NOOP("valueDialog(caption, message [,defaultvalue]) -> string\n\ \n\ Shows the common 'Ask for string' dialog and returns its value as a string\n\ Parameters: window title, text in the window and optional 'default' value.\n\ \n\ Example: valueDialog('title', 'text in the window', 'optional')\n\ "))
 docstring
PyObject * scribus_valdialog (PyObject *, PyObject *args)
 PyDoc_STRVAR (scribus_newstyledialog__doc__, QT_TR_NOOP("newStyleDialog() -> string\n\ \n\ Shows 'Create new paragraph style' dialog. Function returns real\n\ style name or None when user cancels the dialog.\n\ "))
PyObject * scribus_newstyledialog (PyObject *, PyObject *args)

Function Documentation

PyDoc_STRVAR ( scribus_newdocdia__doc__  ,
QT_TR_NOOP("newDocDialog() -> bool\n\\n\Displays the \"New Document\" dialog box. Creates a new document if the user\n\accepts the settings. Does not create a document if the user presses cancel.\n\Returns true if a new document was created.\n\")   
)

Calling Dialogs from Scribus.

docstring

PyDoc_STRVAR ( scribus_filedia__doc__  ,
QT_TR_NOOP("fileDialog(\"caption\", [\"filter\", \"defaultname\", haspreview, issave, isdir]) -> string with filename\n\\n\Shows a File Open dialog box with the caption \"caption\". Files are filtered\n\with the filter string \"filter\". A default filename or file path can also\n\supplied, leave this string empty when you don't want to use it. A value of\n\True for haspreview enables a small preview widget in the FileSelect box. When\n\the issave parameter is set to True the dialog acts like a \"Save As\" dialog\n\otherwise it acts like a \"File Open Dialog\". When the isdir parameter is True\n\the dialog shows and returns only directories. The default for all of the\n\opional parameters is False.\n\\n\The filter, if specified, takes the form 'comment (*.type *.type2 ...)'.\n\For example 'Images (*.png *.xpm *.jpg)'.\n\\n\Refer to the Qt-Documentation for QFileDialog for details on filters.\n\\n\Example: fileDialog('Open input', 'CSV files (*.csv)')\n\Example: fileDialog('Save report', defaultname='report.txt', issave=True)\n\")   
)

docstring

PyDoc_STRVAR ( scribus_messdia__doc__  ,
QT_TR_NOOP("messageBox(\"caption\", \"message\",\n\ icon=ICON_NONE, button1=BUTTON_OK|BUTTONOPT_DEFAULT,\n\ button2=BUTTON_NONE, button3=BUTTON_NONE) -> integer\n\\n\Displays a message box with the title \"caption\", the message \"message\", and\n\an icon \"icon\" and up to 3 buttons. By default no icon is used and a single\n\button, OK, is displayed. Only the caption and message arguments are required,\n\though setting an icon and appropriate button(s) is strongly\n\recommended. The message text may contain simple HTML-like markup.\n\\n\Returns the number of the button the user pressed. Button numbers start\n\at 1.\n\\n\For the icon and the button parameters there are predefined constants available\n\with the same names as in the Qt Documentation. These are the BUTTON_* and\n\ICON_* constants defined in the module. There are also two extra constants that\n\can be binary-ORed with button constants:\n\ BUTTONOPT_DEFAULT Pressing enter presses this button.\n\ BUTTONOPT_ESCAPE Pressing escape presses this button.\n\\n\Usage examples:\n\result = messageBox('Script failed',\n\ 'This script only works when you have a text frame selected.',\n\ ICON_ERROR)\n\result = messageBox('Monkeys!', 'Something went ook! <i>Was it a monkey?</i>',\n\ ICON_WARNING, BUTTON_YES|BUTTONOPT_DEFAULT,\n\ BUTTON_NO, BUTTON_IGNORE|BUTTONOPT_ESCAPE)\n\\n\Defined button and icon constants:\n\BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO,\n\BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL,\n\ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.\n\")   
)

docstring

PyDoc_STRVAR ( scribus_valdialog__doc__  ,
QT_TR_NOOP("valueDialog(caption, message [,defaultvalue]) -> string\n\\n\Shows the common 'Ask for string' dialog and returns its value as a string\n\Parameters: window title, text in the window and optional 'default' value.\n\\n\Example: valueDialog('title', 'text in the window', 'optional')\n\")   
)

docstring

PyDoc_STRVAR ( scribus_newstyledialog__doc__  ,
QT_TR_NOOP("newStyleDialog() -> string\n\\n\Shows 'Create new paragraph style' dialog. Function returns real\n\style name or None when user cancels the dialog.\n\")   
)
PyObject* scribus_filedia ( PyObject *  ,
PyObject *  args,
PyObject *  kw 
)

Raises file dialog.

Params - caption, filter, default name and opt. pre, mode.

Definition at line 27 of file cmddialog.cpp.

{
       char *caption = const_cast<char*>("");
       char *filter = const_cast<char*>("");
       char *defName = const_cast<char*>("");
       int haspreview = 0;
       int issave = 0;
       int isdir = 0;
       // FIXME: parsing named params failure. e.g. fileDialog(caption="foo", issave=True)
       // FIXME: it's a bug in Python. I'm monitoring it
       // https://sourceforge.net/tracker/index.php?func=detail&aid=893549&group_id=5470&atid=105470
       char* kwargs[] = {const_cast<char*>("caption"), const_cast<char*>("filter"),
                                          const_cast<char*>("defaultname"), const_cast<char*>("haspreview"),
                                          const_cast<char*>("issave"), const_cast<char*>("isdir"),
                                          NULL};
       if (!PyArg_ParseTupleAndKeywords(args, kw, "es|esesiii", kwargs,
                                                                "utf-8", &caption, "utf-8", &filter, "utf-8", &defName,
                                                                &haspreview, &issave, &isdir))
       {
              return NULL;
       }
       QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
       /* nobool = Nothing doing boolean for CFileDialog last attrs.
       Due the 'isdir' parameter. CFileDialog needs the last 2 pointers
       initialized. */
       bool nobool = false;
       int optionFlags = 0;
       if (haspreview)
              optionFlags |= fdShowPreview;
       if (issave)
              optionFlags |= fdExistingFiles;
       if (isdir)
              optionFlags |= fdDirectoriesOnly;
       QString fName = ScCore->primaryMainWindow()->CFileDialog(".",
                                                                       QString::fromUtf8(caption),
                                                                       QString::fromUtf8(filter),
                                                                       QString::fromUtf8(defName),
                                                                       optionFlags,
                                                                       &nobool,
                                                                       &nobool,
                                                                       &nobool
                                                                      );
       QApplication::restoreOverrideCursor();
       // FIXME: filename return unicode OK?
       return PyString_FromString(fName.utf8());
}

Here is the call graph for this function:

PyObject* scribus_messdia ( PyObject *  ,
PyObject *  args,
PyObject *  kw 
)

Displays a message box with - caption, message, icon, button and two more buttons optional.

Definition at line 74 of file cmddialog.cpp.

{
       char *caption = const_cast<char*>("");
       char *message = const_cast<char*>("");
       uint result;
       QMessageBox::Icon ico = QMessageBox::NoIcon;
       int butt1 = QMessageBox::Ok|QMessageBox::Default;
       int butt2 = QMessageBox::NoButton;
       int butt3 = QMessageBox::NoButton;
       char* kwargs[] = {const_cast<char*>("caption"), const_cast<char*>("message"),
                                          const_cast<char*>("icon"), const_cast<char*>("button1"),
                                          const_cast<char*>("button2"), const_cast<char*>("button3"), NULL};
       if (!PyArg_ParseTupleAndKeywords(args, kw, "eses|iiii", kwargs, "utf-8", &caption, "utf-8", &message, &ico, &butt1, &butt2, &butt3))
              return NULL;
       QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
       QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, ScCore->primaryMainWindow());
       result = mb.exec();
       QApplication::restoreOverrideCursor();
       return PyInt_FromLong(static_cast<long>(result));
}

Here is the call graph for this function:

PyObject* scribus_newdocdia ( PyObject *  )

Raises the Scribus New Document dialog.

Definition at line 19 of file cmddialog.cpp.

{
       QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
       bool ret = ScCore->primaryMainWindow()->slotFileNew();
       QApplication::restoreOverrideCursor();
       return PyInt_FromLong(static_cast<long>(ret));
}

Here is the call graph for this function:

PyObject* scribus_newstyledialog ( PyObject *  ,
PyObject *  args 
)

Definition at line 112 of file cmddialog.cpp.

{
       if(!checkHaveDocument())
              return NULL;

       ScribusDoc *d = ScCore->primaryMainWindow()->doc;
       bool ok;
       QString s = QInputDialog::getText(
                     "New Paragraph Style",
                     "Enter name of the new paragraph style:",
                     QLineEdit::Normal,
                     QString::null, &ok, ScCore->primaryMainWindow());

       if (ok && !s.isEmpty())
       {
              StyleSet<ParagraphStyle> st;
              st.redefine(d->paragraphStyles(), true);
              ParagraphStyle p;
              p.setName(s);
              st.create(p);
              d->redefineStyles(st, false);
              ScCore->primaryMainWindow()->styleMgr()->setDoc(d);
              return PyString_FromString(s.utf8());
       }
       else
              Py_RETURN_NONE;
}

Here is the call graph for this function:

PyObject* scribus_valdialog ( PyObject *  ,
PyObject *  args 
)

Definition at line 95 of file cmddialog.cpp.

{
       char *caption = const_cast<char*>("");
       char *message = const_cast<char*>("");
       char *value = const_cast<char*>("");
       if (!PyArg_ParseTuple(args, "eses|es", "utf-8", &caption, "utf-8", &message, "utf-8", &value))
              return NULL;
       QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
       ValueDialog *d = new ValueDialog(ScCore->primaryMainWindow(), "d", true, 0);
       d->dialogLabel->setText(QString::fromUtf8(message));
       d->valueEdit->setText(QString::fromUtf8(value));
       d->setCaption(QString::fromUtf8(caption));
       d->exec();
       QApplication::restoreOverrideCursor();
       return PyString_FromString(d->valueEdit->text().utf8());
}

Here is the call graph for this function: