~ubuntu-branches/ubuntu/wily/scribus/wily-proposed

« back to all changes in this revision

Viewing changes to scribus/plugins/scriptplugin/scriptercore.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-09 21:50:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120209215056-2wrx1ara0jbm7fi5
Tags: 1.4.0.dfsg+r17287-1
* New upstream stable release upload into Debian (Closes: #654703).
* Applied the Ubuntu armel patch.
* Removed non-free color swatches from resources.
* debian/control:
  - Moved icc-profiles from Recommends to Suggests (Closes: #655885).
  - Updated Standards-Version to 3.9.2.
  - Updated extended description per lintian warning.
* debian/rules:
  - Update mailcap (Closes: #630751). A request for mime.types update has
    been sent to the mime-support maintainer.
  - Added build-arch and build-indep targets per lintian warning.
* debian/patches:
  - top_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't copy extra docs and changelogs.
  - scribus_cmakelists.patch - don't install the non-free "doc" dir.
  - profiles_cmakelists.patch - don't install non-free sRGB profile.
* debian/copyright: 
  - Converted to the DEP5 machine readable foramt.
  - Added licenses for free color swatches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
{
89
89
        QString pfad = ScPaths::instance().scriptDir();
90
90
        QString pfad2;
91
 
        pfad2 = QDir::convertSeparators(pfad);
 
91
        pfad2 = QDir::toNativeSeparators(pfad);
92
92
        QDir ds(pfad2, "*.py", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::NoSymLinks);
93
93
        if ((ds.exists()) && (ds.count() != 0))
94
94
        {
96
96
                {
97
97
                        QFileInfo fs(ds[dc]);
98
98
                        QString strippedName=fs.baseName();
99
 
                        scrScripterActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, QPixmap(), QPixmap(), strippedName, QKeySequence(), this));
 
99
                        scrScripterActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, strippedName, QKeySequence(), this));
100
100
                        connect( scrScripterActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(StdScript(QString)) );
101
101
                        menuMgr->addMenuItem(scrScripterActions[strippedName], "ScribusScripts");
102
102
                }
116
116
        {
117
117
                QString strippedName=RecentScripts[m];
118
118
                strippedName.remove(QDir::separator());
119
 
                scrRecentScriptActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, QPixmap(), QPixmap(), RecentScripts[m], QKeySequence(), this));
 
119
                scrRecentScriptActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, RecentScripts[m], QKeySequence(), this));
120
120
                connect( scrRecentScriptActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(RecentScript(QString)) );
121
121
                menuMgr->addMenuItem(scrRecentScriptActions[strippedName], "RecentScripts");
122
122
        }
136
136
                        {
137
137
                                QString strippedName=SavedRecentScripts[m];
138
138
                                strippedName.remove(QDir::separator());
139
 
                                scrRecentScriptActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, QPixmap(), QPixmap(), SavedRecentScripts[m], QKeySequence(), this));
 
139
                                scrRecentScriptActions.insert(strippedName, new ScrAction( ScrAction::RecentScript, SavedRecentScripts[m], QKeySequence(), this));
140
140
                                connect( scrRecentScriptActions[strippedName], SIGNAL(triggeredData(QString)), this, SLOT(RecentScript(QString)) );
141
141
                                menuMgr->addMenuItem(scrRecentScriptActions[strippedName], "RecentScripts");
142
142
                        }
233
233
{
234
234
        QString pfad = ScPaths::instance().scriptDir();
235
235
        QString pfad2;
236
 
        pfad2 = QDir::convertSeparators(pfad);
 
236
        pfad2 = QDir::toNativeSeparators(pfad);
237
237
        QString fn = pfad2+basefilename+".py";
238
238
        QFileInfo fd(fn);
239
239
        if (!fd.exists())
257
257
 
258
258
void ScripterCore::slotRunScriptFile(QString fileName, bool inMainInterpreter)
259
259
{
260
 
        PyThreadState *stateo = NULL;
261
260
        PyThreadState *state = NULL;
262
261
        QFileInfo fi(fileName);
263
262
        QByteArray na = fi.fileName().toLocal8Bit();
264
263
        // Set up a sub-interpreter if needed:
 
264
        PyThreadState* global_state = NULL;
265
265
        if (!inMainInterpreter)
266
266
        {
267
267
                ScCore->primaryMainWindow()->propertiesPalette->unsetDoc();
270
270
                qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
271
271
                // Create the sub-interpreter
272
272
                // FIXME: This calls abort() in a Python debug build. We're doing something wrong.
273
 
                stateo = PyEval_SaveThread();
 
273
                //stateo = PyEval_SaveThread();
 
274
                global_state = PyThreadState_Get();
274
275
                state = Py_NewInterpreter();
275
276
                // Chdir to the dir the script is in
276
277
                QDir::setCurrent(fi.absolutePath());
354
355
                                QClipboard *cp = QApplication::clipboard();
355
356
                                cp->setText(errorMsg);
356
357
                                ScCore->closeSplash();
 
358
                                qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
357
359
                                QMessageBox::warning(ScCore->primaryMainWindow(),
358
360
                                                                        tr("Script error"),
359
361
                                                                        "<qt><p>"
369
371
        if (!inMainInterpreter)
370
372
        {
371
373
                Py_EndInterpreter(state);
372
 
                PyEval_RestoreThread(stateo);
 
374
                PyThreadState_Swap(global_state);
 
375
                //PyEval_RestoreThread(stateo);
373
376
//              qApp->restoreOverrideCursor();
374
377
                ScCore->primaryMainWindow()->setScriptRunning(false);
375
378
        }
608
611
        m_enableExtPython = enable;
609
612
}
610
613
 
 
614
void ScripterCore::updateSyntaxHighlighter()
 
615
{
 
616
        pcon->updateSyntaxHighlighter();
 
617
}
 
618
 
611
619
const QString & ScripterCore::startupScript() const
612
620
{
613
621
        return m_startupScript;