View Issue Details

IDProjectCategoryView StatusLast Update
0008967ScribusScripterpublic2014-10-24 09:35
Reportermochouinard Assigned Tojainbasil  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformIntel 64bitOSUbuntuOS Version9.10
Product Version1.3.7svn 
Summary0008967: [patch] Implement --plugin-script-run in the command line to start a script on startup
DescriptionAnother patch will follow to disable the new on startup document action since the event get executed after this window close. But you can just disable it (do not show again) in the mean time

http://64.235.217.39/tmp/auto_git_export_scribus/scripter_cmd_line_autorun.diff
TagsNo tags attached.
Patch

Relationships

duplicate of 0012572 closedcbradney [patch] Add a --python-script command line option to run a script and exit 

Activities

ale

2010-03-24 21:59

manager  

scripter_cmd_line_autorun.diff (2,569 bytes)   
diff --git a/scribus/plugins/scriptplugin/scriptercore.cpp b/scribus/plugins/scriptplugin/scriptercore.cpp
index ce81243..6be3e26 100644
--- a/scribus/plugins/scriptplugin/scriptercore.cpp
+++ b/scribus/plugins/scriptplugin/scriptercore.cpp
@@ -33,6 +33,8 @@ for which a new license (GPL+exception) is in place.
 #include "prefstable.h"
 #include "prefsmanager.h"
 
+#define ARG_SCRIPT_RUN "--plugins-script-run"
+
 ScripterCore::ScripterCore(QWidget* parent)
 {
 	pcon = new PythonConsole(parent);
@@ -60,6 +62,7 @@ ScripterCore::ScripterCore(QWidget* parent)
 
 	QObject::connect(pcon, SIGNAL(runCommand()), this, SLOT(slotExecute()));
 	QObject::connect(pcon, SIGNAL(paletteShown(bool)), this, SLOT(slotInteractiveScript(bool)));
+	QObject::connect(ScCore, SIGNAL(appStarted()) , this, SLOT(slotStartedParseArguments()));
 }
 
 ScripterCore::~ScripterCore()
@@ -105,6 +108,25 @@ void ScripterCore::buildScribusScriptsMenu()
 
 }
 
+void ScripterCore::slotStartedParseArguments()
+{
+	QString arg("");
+	QString fileName;
+
+	for(int i = 1; i < QApplication::argc(); i++) {
+		arg = QApplication::argv()[i];
+
+		if (arg == ARG_SCRIPT_RUN) {
+			fileName = QFile::decodeName(QApplication::argv()[++i]);
+			if (QFileInfo(fileName).exists()) {
+				slotRunScriptFile(fileName);
+			}
+
+
+		}
+	}		
+}
+
 void ScripterCore::rebuildRecentScriptsMenu()
 {
 	for( QMap<QString, QPointer<ScrAction> >::Iterator it = scrRecentScriptActions.begin(); it!=scrRecentScriptActions.end(); ++it )
diff --git a/scribus/plugins/scriptplugin/scriptercore.h b/scribus/plugins/scriptplugin/scriptercore.h
index 5d1c42e..73b34d8 100644
--- a/scribus/plugins/scriptplugin/scriptercore.h
+++ b/scribus/plugins/scriptplugin/scriptercore.h
@@ -39,6 +39,7 @@ public slots:
 	void slotRunScript(const QString Script);
 	void slotInteractiveScript(bool);
 	void slotExecute();
+	void slotStartedParseArguments();
 	/*! \brief Show docstring of the script to the user.
 	* I don't know how to get docstring via e.g. pydoc because of
 	* it needs to run script => error cannot find scribus module
diff --git a/scribus/scribusapp.cpp b/scribus/scribusapp.cpp
index aec5373..4e9840e 100644
--- a/scribus/scribusapp.cpp
+++ b/scribus/scribusapp.cpp
@@ -209,6 +209,8 @@ void ScribusQApp::parseCommandLine()
 		} else if (strncmp(arg.toLocal8Bit().data(),"-psn_",4) == 0)
 		{
 			// Andreas Vox: Qt/Mac has -psn_blah flags that must be accepted.
+		} else if (arg.left(10) == "--plugins-") {
+			++i;
 		} else {
 			fileName = QFile::decodeName(argv()[i]);
 			if (!QFileInfo(fileName).exists()) {
scripter_cmd_line_autorun.diff (2,569 bytes)   

jghali

2010-03-27 13:28

administrator   ~0023617

Please reupload the patch in unified format. See issue 0008865 for an example.

Kunda

2014-07-30 03:50

updater   ~0033079

mochouinard would you be interested in patching the latest 1.5svn build ?

mochouinard

2014-07-31 17:14

reporter   ~0033110

Sure, since 2010 this patch didn't go in since there was intent to get rid of the current scripting engine. The last time I look, that new scripting engine still wasn't functioning well.

I'm heavily use the scripting for all my document generation, and also have a few other patch related to that.

I'll give the latest version a try in mid august, and if that new scripting engine work now, I'll port it.

Kunda

2014-07-31 17:31

updater   ~0033111

Thanks for your reply. Please talk to ale because he's spearheading the new scripter engine at the moment

ale

2014-08-01 09:34

manager   ~0033123

hi moc!

a couple of weeks ago, i made the new scripter compile again and found that very likely it has to be ported to python 3 and pyqt5.

probably, not a huge issue, but it has to be done.

i'm creating a scripter branch on github and will try to work on it as soon as the other tasks are done...

ale

2014-08-01 09:49

manager   ~0033124

https://github.com/scribusproject/scribus/tree/scripter

and i have created an issue on github for it.

https://github.com/scribusproject/scribus/issues/4

everybody is welcome to join the effort, if possible with small incremental patches and communication in advance on what you are up to...

Kunda

2014-10-22 03:56

updater   ~0034117

William & Juraj, any feedback here?

Kunda

2014-10-24 09:35

updater   ~0034134

Closing this as a duplicate of 0012572

Issue History

Date Modified Username Field Change
2010-03-23 21:28 mochouinard New Issue
2010-03-24 21:59 ale File Added: scripter_cmd_line_autorun.diff
2010-03-27 13:28 jghali Note Added: 0023617
2012-06-13 14:22 ale Assigned To => jainbasil
2012-06-13 14:22 ale Status new => assigned
2012-06-13 14:43 mochouinard File Added: Scribus_scripter_cmd_line_autorun.diff
2012-06-13 14:43 mochouinard File Deleted: Scribus_scripter_cmd_line_autorun.diff
2014-07-30 03:50 Kunda Note Added: 0033079
2014-07-31 17:14 mochouinard Note Added: 0033110
2014-07-31 17:31 Kunda Note Added: 0033111
2014-08-01 09:34 ale Note Added: 0033123
2014-08-01 09:49 ale Note Added: 0033124
2014-10-22 03:56 Kunda Note Added: 0034117
2014-10-22 11:55 Kunda Relationship added related to 0012572
2014-10-24 09:34 Kunda Relationship replaced duplicate of 0012572
2014-10-24 09:35 Kunda Note Added: 0034134
2014-10-24 09:35 Kunda Status assigned => closed
2014-10-24 09:35 Kunda Resolution open => duplicate