View Issue Details

IDProjectCategoryView StatusLast Update
0008651ScribusScripterpublic2012-07-15 20:58
Reporterale Assigned Tojainbasil  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.0svn 
Target Version1.5.0svnFixed in Version1.5.0svn 
Summary0008651: new scripter engine
Descriptionintegration of the new scripter engine from henning into trunk (1.5svn)
TagsNo tags attached.
Patch

Activities

ale

2009-12-16 16:11

manager   ~0022968

i got the new scripter to work on my system.

i can run existing scripts, but i can't launch the editor hennings has developed.

steps to install the scripter:

* add the scripter directory into the scribus/plugins/ of your current 1.5svn source files
* edit CMakeLists.txt:
    #IF(NOT WIN32)
      #ADD_SUBDIRECTORY(scriptplugin)
    #ENDIF(NOT WIN32)
    ADD_SUBDIRECTORY(scripter)
* cmake && make && make install
* scripter > run script from file and run scribus_bin_path/lib/scribus/plugin/scripter/example/test.spy

please test it and report wether it works or not.


i can't get any feedback from scribus or gdb when the script editor hangs. please help!


ciao
a.l.e

2009-12-16 16:16

 

scripter.tar.bz (3,758,202 bytes)

christoph_s

2009-12-16 18:50

administrator   ~0022970

Reminder sent to: h_a_j_s

Any idea?

2009-12-17 03:07

 

highlighter.patch (1,747 bytes)   
--- highlighter.py.old	2009-10-11 22:57:50.000000000 +0200
+++ highlighter.py	2009-12-17 04:08:55.000000000 +0100
@@ -63,7 +63,7 @@
         
         startIndex = 0
         if self.previousBlockState() != 1:
-            startIndex = text.indexOf(self.multiLineStringBegin)
+            startIndex = self.multiLineStringBegin.indexIn(text)
         
         if startIndex > -1:
             self.highlightRules(text, 0, startIndex)
@@ -72,7 +72,7 @@
         
         while startIndex >= 0:
         
-            endIndex = text.indexOf(self.multiLineStringEnd,
+            endIndex = self.multiLineStringEnd.indexIn(text,
                 startIndex + len(self.multiLineStringBegin.pattern()))
             if endIndex == -1:
                 self.setCurrentBlockState(1)
@@ -83,18 +83,18 @@
                 self.highlightRules(text, endIndex, len(text))
             
             self.setFormat(startIndex, commentLength, self.multiLineStringFormat)
-            startIndex = text.indexOf(self.multiLineStringBegin,
+            startIndex = self.multiLineStringBegin.indexIn(text,
                                       startIndex + commentLength)
     
     def highlightRules(self, text, start, finish):
     
         for expression, format in self.rules:
         
-            index = text.indexOf(expression, start)
+            index = expression.indexIn(text, start)
             while index >= start and index < finish:
                 length = expression.matchedLength()
                 self.setFormat(index, min(length, finish - index), format)
-                index = text.indexOf(expression, index + length)
+                index = expression.indexIn(text, index + length)
     
     def updateFonts(self, font):
     
highlighter.patch (1,747 bytes)   

2009-12-17 03:10

 

highlighter.py (8,095 bytes)

h_a_j_s

2009-12-17 03:19

developer   ~0022972

This is related to a change in Qt 4.5
The issue is mentioned at http://labs.trolltech.com/blogs/2008/11/04/910/
Attached you will find a fixed highlighter module for scedit.

h_a_j_s

2009-12-17 03:30

developer   ~0022973

Last edited: 2009-12-18 22:23

I have looked through the changes, looks good so far :-)

You could also apply the following:
--- scripter_hooks.py.old 2009-10-11 22:57:49.000000000 +0200
+++ scripter_hooks.py 2009-12-17 04:23:11.000000000 +0100
@@ -27,7 +27,7 @@
     def createMenu(self, title):
         m = QMenu(title)
         self.menus.append(m)
- self.menubar.addAction(m)
+ self.menubar.addMenu(m)
         return m


BTW I worked on a new editor widget ( https://launchpad.net/codeaide ) which could replace scedit in the very near future.

ale

2009-12-17 13:25

manager   ~0022976

thanks for the comments!

i will have a look at it on friday evening / saturday morning

ale

2009-12-18 22:25

manager   ~0022988

everything i've looked at works now...

ale

2009-12-19 08:53

manager   ~0022989

i propose that the scripter gets added to 1.5 as currently is (the attached tar.bz + the .py file from henning + the small patch in the comment above).

once it is integrated into 1.5svn, i would go through the scribus functions supported by the scribus and check that all are supported also in the new scripter.

as soon as it is somehow mature, we will then ask for feedback from scripts authors and users.

before pushing it to svn, it would be a good idea to announce it on the -dev list (users of 1.5svn who rely on the scripter should then refrain from updating for a while).

i will have some time between christmas and new year to go through the functions.

cbradney

2010-02-05 23:15

administrator   ~0023209

committed code, currently inactive due to some issues found as discussed.

ale

2010-02-06 15:35

manager   ~0023214

@craig: checked out, edited makefile and made: i get a scripter menu here. and it works! :-)
i wonder if there is a new dependency involved... (pyqt?)

h_a_j_s

2010-02-09 19:46

developer   ~0023231

Fine :)
There should be no new build-dependency. But PyQt is required to run the plug-in. Most distribution install PyQt if you run a full KDE desktop. For Windows there is an installer at http://www.riverbankcomputing.co.uk/software/pyqt/download

I thought about splitting the plug-in into two parts. The first part (scripter-core) would contain the scripting api implementation in C++. The second part (scripter-python) would contain the Python stuff. A possible third plug-in could contain an independent QtScript connection to the api. Other C++ plug-ins could also use this (stable) api to interact with Scribus.

But that's not a very high priority right now IMHO. The question is what the current priority is? What are the next plans?
I would like to submit patches. Should I use this ticket?

cbradney

2010-02-09 20:04

administrator   ~0023232

PyQt dependencies are a PITA, at least on OSX.. I am going to build Qt from Macports tonight just for this... and uninstall from the DMG. gr. Oh well.

ale

2010-02-10 18:27

manager   ~0023234

hallo h_a_j_s,

personally, i'd like to have the scripter added as soon as possible. there are many requests for new scripter features pending and i don't want to add them them to the old scripter.

i like you idea of cleanly splitting the scripter in two/three modules.

i'd like to give you a hand, but i think that we first have to have a chat on how i can help you!

can you ping me on #scribus or #scribus-dev one of the next evenings, a wednesday or during the weekend?

finally, i think that new patches should go into new bug reports... they will be easier to track (the patches in this report are already applied to the trunk)

have a nice evening and thanks!
a.l.e

cbradney

2010-02-11 22:49

administrator   ~0023243

I have python 2.6 + pyqt4 installed on osx now .. but no idea how to make it find those versions of the python files (instead of the system ones) and the pyqt stuff.. so, I am at a loss here.

h_a_j_s

2010-04-13 00:04

developer  

compile_fix.patch (4,086 bytes)   
=== modified file 'scribus/plugins/scripter/api_page.cpp'
--- scribus/plugins/scripter/api_page.cpp	2010-02-05 23:14:08 +0000
+++ scribus/plugins/scripter/api_page.cpp	2010-04-12 23:51:45 +0000
@@ -182,13 +182,9 @@
 {
     return newItem(
                PageItem::Polygon, PageItem::Rectangle, x, y, width, height,
-               // @xxx: ale
-               // ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
-               // ScCore->primaryMainWindow()->doc->toolSettings.dBrush,
-               // ScCore->primaryMainWindow()->doc->toolSettings.dPen
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineWidth,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeFillColor,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineColor);
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeFillColor,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineColor);
 }
 
 
@@ -205,13 +201,9 @@
 {
     return newItem(
                PageItem::Polygon, PageItem::Ellipse, x, y, width, height,
-               // @xxx: ale
-               // ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
-               // ScCore->primaryMainWindow()->doc->toolSettings.dBrush,
-               // ScCore->primaryMainWindow()->doc->toolSettings.dPen);
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineWidth,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeFillColor,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineColor);
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeFillColor,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineColor);
 }
 
 
@@ -231,7 +223,7 @@
                1,
                // @xxx: ale
                // ScCore->primaryMainWindow()->doc->toolSettings.dBrushPict,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.imageFillColor,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().imageFillColor,
                CommonStrings::None);
 }
 
@@ -249,12 +241,9 @@
 {
     return newItem(
                PageItem::TextFrame, PageItem::Unspecified, x, y, width, height,
-               // @xxx: ale
-               // ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineWidth,
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
                CommonStrings::None,
-               // ScCore->primaryMainWindow()->doc->toolSettings.dPenText);
-               ScCore->primaryMainWindow()->doc->itemToolPrefs.textFont);
+               ScCore->primaryMainWindow()->doc->itemToolPrefs().textFont);
 }
 
 
@@ -271,13 +260,9 @@
 {
     PageItem *item = (PageItem*)newItem(
                          PageItem::Line, PageItem::Unspecified, x, y, width, height,
-                         // @xxx: ale
-                         // ScCore->primaryMainWindow()->doc->toolSettings.dWidth,
-                         // ScCore->primaryMainWindow()->doc->toolSettings.dBrush,
-                         // ScCore->primaryMainWindow()->doc->toolSettings.dPen);
-                         ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineWidth,
-                         ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeFillColor,
-                         ScCore->primaryMainWindow()->doc->itemToolPrefs.shapeLineColor);
+                         ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineWidth,
+                         ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeFillColor,
+                         ScCore->primaryMainWindow()->doc->itemToolPrefs().shapeLineColor);
     item->setRotation(xy2Deg(width-x, height-y));
     item->setWidthHeight(sqrt(pow(x-width, 2.0) + pow(y-height, 2.0)), 1.0);
     item->Sizing = false;

compile_fix.patch (4,086 bytes)   

h_a_j_s

2010-04-13 00:17

developer   ~0023671

Hi a.l.e,
sorry the last months I was very busy. I am glad that you would like to give me a hand :) I'll try to hang around #scribus more often again.
The attached small patch gets the plug-in compiling again (doc->itemToolPrefs is now a method).
Greets
Henning

cbradney

2010-04-13 18:52

administrator   ~0023673

Latest patch committed, thanks.

h_a_j_s

2010-04-13 20:53

developer   ~0023678

cbradney thanks, but please also apply the highlighter patch for scribus/plugins/scripter/python/sceditor/highlighter.py - without it the editor is unusable for Qt >= 4.5

Should I post further improvements as patches here or should I open new bugs for every part?

ale

2010-05-01 12:16

manager   ~0023857

ciao henning,

personally i think it's better to open a bug for each part... easier to track!

ciao
a.l.e

jainbasil

2012-07-10 05:29

administrator   ~0028411

New scripter engine added to trunk.

Issue History

Date Modified Username Field Change
2009-12-16 16:07 ale New Issue
2009-12-16 16:11 ale Note Added: 0022968
2009-12-16 16:16 ale File Added: scripter.tar.bz
2009-12-16 18:50 christoph_s Note Added: 0022970
2009-12-17 03:07 h_a_j_s File Added: highlighter.patch
2009-12-17 03:10 h_a_j_s File Added: highlighter.py
2009-12-17 03:19 h_a_j_s Note Added: 0022972
2009-12-17 03:30 h_a_j_s Note Added: 0022973
2009-12-17 13:25 ale Note Added: 0022976
2009-12-18 22:23 ale Note Edited: 0022973
2009-12-18 22:25 ale Note Added: 0022988
2009-12-19 08:53 ale Note Added: 0022989
2009-12-19 09:03 christoph_s Status new => assigned
2009-12-19 09:03 christoph_s Assigned To => cbradney
2010-02-05 22:21 plinnell Target Version => 1.5.0svn
2010-02-05 23:15 cbradney Note Added: 0023209
2010-02-06 15:35 ale Note Added: 0023214
2010-02-09 19:46 h_a_j_s Note Added: 0023231
2010-02-09 20:04 cbradney Note Added: 0023232
2010-02-10 18:27 ale Note Added: 0023234
2010-02-11 22:49 cbradney Note Added: 0023243
2010-02-11 23:00 cbradney Assigned To cbradney => ale
2010-04-13 00:04 h_a_j_s File Added: compile_fix.patch
2010-04-13 00:17 h_a_j_s Note Added: 0023671
2010-04-13 18:52 cbradney Note Added: 0023673
2010-04-13 20:53 h_a_j_s Note Added: 0023678
2010-05-01 12:16 ale Note Added: 0023857
2012-06-20 21:11 cbradney Assigned To ale => jainbasil
2012-07-10 05:29 jainbasil Note Added: 0028411
2012-07-10 05:29 jainbasil Status assigned => closed
2012-07-10 05:29 jainbasil Resolution open => fixed
2012-07-10 05:29 jainbasil Fixed in Version => 1.5.1
2012-07-15 20:58 jghali Fixed in Version 1.5.1 => 1.5.0svn