Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
1718 craig 1
#ifndef SCRIPTERCORE_H
2
#define SCRIPTERCORE_H
1467 cbradney 3
 
4
#include "cmdvar.h"
5
 
1718 craig 6
#include "qmap.h"
7
#include "qguardedptr.h"
1467 cbradney 8
 
1718 craig 9
class ScrAction;
10
class MenuManager;
3254 craig 11
class PythonConsole;
1718 craig 12
 
1467 cbradney 13
class ScripterCore : public QObject
14
{
1718 craig 15
        Q_OBJECT
1467 cbradney 16
 
17
public:
1718 craig 18
        ScripterCore(QWidget* parent);
19
        ~ScripterCore();
20
 
1467 cbradney 21
public slots:
2622 craig 22
        void runScriptDialog();
1718 craig 23
        void StdScript(QString filebasename);
24
        void RecentScript(QString fn);
1752 craig 25
        void slotRunScriptFile(QString fileName, bool inMainInterpreter = false);
1718 craig 26
        QString slotRunScript(QString Script);
27
        void slotInteractiveScript(bool);
28
        void slotExecute();
29
        void aboutScript();
2706 craig 30
        /** Does setup for the main interpreter, particularly the interactive console. True for success. */
31
        bool setupMainInterpreter();
2503 subik 32
        /** Sets up the plugin for extension scripts, if enabled */
1752 craig 33
        void initExtensionScripts();
2503 subik 34
        /** Runs the startup script, if enabled */
1752 craig 35
        void runStartupScript();
2226 cbradney 36
        void languageChange();
1718 craig 37
 
3216 craig 38
        const QString & startupScript() const;
39
        bool extensionsEnabled() const;
40
        void setStartupScript(const QString& newScript);
41
        void setExtensionsEnabled(bool enable);
42
 
1718 craig 43
protected:
44
        // Private helper functions
45
        void FinishScriptRun();
46
        void ReadPlugPrefs();
47
        void SavePlugPrefs();
48
        void rebuildRecentScriptsMenu();
49
        void buildScribusScriptsMenu();
50
        void buildRecentScriptsMenu();
51
        void rebuildScribusScriptsMenu();
52
 
2503 subik 53
        //Internal members
54
        //! Reference to the "IDE" widget
55
        PythonConsole *pcon;
1718 craig 56
        int cons;
57
        int about;
58
        QStringList SavedRecentScripts;
59
        QStringList RecentScripts;
60
        MenuManager *menuMgr;
61
        QMap<QString, QGuardedPtr<ScrAction> > scrScripterActions;
62
        QMap<QString, QGuardedPtr<ScrAction> > scrRecentScriptActions;
1752 craig 63
 
64
        // Preferences
2503 subik 65
        /** pref: Enable access to main interpreter and 'extension scripts' */
3216 craig 66
        bool m_enableExtPython;
2503 subik 67
        /** pref: Run 'from scribus import *' at scripter startup */
3216 craig 68
        bool m_importAllNames;
2503 subik 69
        /** pref: Load this script on startup */
3216 craig 70
        QString m_startupScript;
1467 cbradney 71
};
72
 
73
#endif