Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 2621 → Rev 2622

/branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptercore.h
22,7 → 22,7
~ScripterCore();
 
public slots:
void slotTest();
void runScriptDialog();
void StdScript(QString filebasename);
void RecentScript(QString fn);
void slotRunScriptFile(QString fileName, bool inMainInterpreter = false);
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/runscriptdialog.cpp
0,0 → 1,29
#include "runscriptdialog.h"
#include "qdir.h"
 
RunScriptDialog::RunScriptDialog(QWidget* parent = 0, bool extEnable = false) :
QFileDialog(parent, "runScriptDialog", true)
{
this->extEnable = extEnable;
setDir(Carrier->Prefs.ScriptDir != "" ? Carrier->Prefs.ScriptDir : QDir::currentDirPath());
setFilters(tr("Python Scripts (*.py);; All Files (*)"));
 
if (extEnable)
{
extChk = new QCheckBox(tr("Run as Extension Script", "run script dialog"), this);
extChk->setChecked(false);
addWidgets(0, extChk, 0);
}
}
 
RunScriptDialog::~RunScriptDialog()
{
}
 
bool RunScriptDialog::extensionRequested()
{
if (extEnable)
return extChk->isChecked();
else
return false;
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp (revision 2621)
+++ branches/Version13x/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp (revision 2622)
@@ -11,7 +11,7 @@
#include <cstdlib>
#include <qtextedit.h>
-#include "customfdialog.h"
+#include "runscriptdialog.h"
#include "helpbrowser.h"
#include "mpalette.h"
#include "seiten.h"
@@ -41,7 +41,7 @@
scrScripterActions["scripterShowConsole"]->setToggleAction(true);
- QObject::connect( scrScripterActions["scripterExecuteScript"], SIGNAL(activated()) , this, SLOT(slotTest()) );
+ QObject::connect( scrScripterActions["scripterExecuteScript"], SIGNAL(activated()) , this, SLOT(runScriptDialog()) );
QObject::connect( scrScripterActions["scripterShowConsole"], SIGNAL(toggled(bool)) , this, SLOT(slotInteractiveScript(bool)) );
QObject::connect( scrScripterActions["scripterAboutScript"], SIGNAL(activated()) , this, SLOT(aboutScript()) );
@@ -153,18 +153,15 @@
}
}
-void ScripterCore::slotTest()
+void ScripterCore::runScriptDialog()
{
QString fileName;
- QString CurDirP = QDir::currentDirPath();
- QString scriptDir = Carrier->Prefs.ScriptDir;
- if (scriptDir == "")
- scriptDir = CurDirP;
- CustomFDialog diaf((QWidget*)parent(), scriptDir, QObject::tr("Open"), QObject::tr("Python Scripts (*.py);; All Files (*)"));
- if (diaf.exec())
+ QString curDirPath = QDir::currentDirPath();
+ RunScriptDialog dia( Carrier, enableExtPython );
+ if (dia.exec())
{
- fileName = diaf.selectedFile();
- slotRunScriptFile(fileName);
+ fileName = dia.selectedFile();
+ slotRunScriptFile(fileName, dia.extensionRequested());
if (RecentScripts.findIndex(fileName) == -1)
RecentScripts.prepend(fileName);
@@ -175,7 +172,7 @@
}
rebuildRecentScriptsMenu();
}
- QDir::setCurrent(CurDirP);
+ QDir::setCurrent(curDirPath);
FinishScriptRun();
}
/branches/Version13x/Scribus/scribus/plugins/scriptplugin/runscriptdialog.h
0,0 → 1,28
#ifndef _RUNSCRIPTDIALOG_H
#define _RUNSCRIPTDIALOG_H
 
// Pulls in Python.h
#include "cmdvar.h"
 
#include "qobject.h"
#include "qfiledialog.h"
#include "qlabel.h"
#include "qcheckbox.h"
 
class RunScriptDialog : public QFileDialog
{
Q_OBJECT
 
public:
RunScriptDialog(QWidget* parent, bool extEnable);
~RunScriptDialog();
 
/// Check if the user wanted the script run as an extension script
bool extensionRequested();
 
protected:
QCheckBox *extChk;
bool extEnable;
};
 
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/plugins/scriptplugin/Makefile.am
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/scriptplugin/Makefile.am (revision 2621)
+++ branches/Version13x/Scribus/scribus/plugins/scriptplugin/Makefile.am (revision 2622)
@@ -4,8 +4,8 @@
INCLUDES = $(LIBFREETYPE_CFLAGS) $(all_includes)
libscriptplugin_la_LDFLAGS = -version-info 0:0:0
libscriptplugin_la_METASOURCES = AUTO
-libscriptplugin_la_SOURCES = scriptercore.cpp valuedialog.cpp cmdutil.cpp cmddialog.cpp cmddoc.cpp cmdpage.cpp cmdobj.cpp cmdgetprop.cpp cmdsetprop.cpp cmdtext.cpp cmdmani.cpp cmdcolor.cpp cmdmisc.cpp objprinter.cpp objpdffile.cpp guiapp.cpp svgimport.cpp pconsole.cpp scriptplugin.cpp objimageexport.cpp cmdgetsetprop.cpp
-EXTRA_DIST = valuedialog.h cmdvar.h cmdutil.cpp cmdutil.h cmddialog.cpp cmddialog.h cmddoc.cpp cmddoc.h cmdpage.cpp cmdpage.h cmdobj.cpp cmdobj.h cmdgetprop.cpp cmdgetprop.h cmdsetprop.cpp cmdsetprop.h cmdtext.cpp cmdtext.h cmdmani.cpp cmdmani.h cmdcolor.cpp cmdcolor.h cmdmisc.cpp cmdmisc.h objprinter.cpp objprinter.h objpdffile.cpp objpdffile.h guiapp.cpp guiapp.h svgimport.cpp svgimport.h scriptplugin.cpp scriptplugin.h pconsole.cpp pconsole.h objimageexport.h cmdgetsetprop.h cmdgetsetprop.cpp scriptercore.h
+libscriptplugin_la_SOURCES = scriptercore.cpp valuedialog.cpp cmdutil.cpp cmddialog.cpp cmddoc.cpp cmdpage.cpp cmdobj.cpp cmdgetprop.cpp cmdsetprop.cpp cmdtext.cpp cmdmani.cpp cmdcolor.cpp cmdmisc.cpp objprinter.cpp objpdffile.cpp guiapp.cpp svgimport.cpp pconsole.cpp scriptplugin.cpp objimageexport.cpp cmdgetsetprop.cpp runscriptdialog.cpp
+EXTRA_DIST = valuedialog.h cmdvar.h cmdutil.cpp cmdutil.h cmddialog.cpp cmddialog.h cmddoc.cpp cmddoc.h cmdpage.cpp cmdpage.h cmdobj.cpp cmdobj.h cmdgetprop.cpp cmdgetprop.h cmdsetprop.cpp cmdsetprop.h cmdtext.cpp cmdtext.h cmdmani.cpp cmdmani.h cmdcolor.cpp cmdcolor.h cmdmisc.cpp cmdmisc.h objprinter.cpp objprinter.h objpdffile.cpp objpdffile.h guiapp.cpp guiapp.h svgimport.cpp svgimport.h scriptplugin.cpp scriptplugin.h pconsole.cpp pconsole.h objimageexport.h cmdgetsetprop.h cmdgetsetprop.cpp scriptercore.h runscriptdialog.h
KDE_OPTIONS = qtonly
AM_LDFLAGS = $(PYTHONLIB) $(LIBPYTHON) $(MODULE_LINK_FLAGS)