Scripter2 API: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
No edit summary
(link to https://scribus-scripter.readthedocs.org/en/latest/)
 
(27 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:Scribus]]
Scripter2 API is described below. This is a reference for the actual documentation of new scripter.
==Document API==
 
==Layer API==
See also rather : https://scribus-scripter.readthedocs.org/en/latest/
 
The new Scripter is composed of different modules, which are either accessible externally, or via methods of other apis.
 
==Scripter==
===<u>Properties</u>===
====activeDocument====


QList<QVariant> '''getLayers'''()
:This property return '''DocumentAPI''' object.


void '''setActiveLayer'''(QString layer)
:Usage:


QString '''getActiveLayer'''()
::''document = Scripter.activeDocument''


void '''sendToLayer'''(QString layer, QString name)
::Here '''document''' will represent the active document, and is of type '''DocumentAPI'''


void '''setLayerVisible'''(QString layer, bool visible)
====activeWindow====
:This property return '''WindowAPI''' object.


void '''setLayerPrintable'''(QString layer, bool printable)
:Usage:
::''window = Scripter.activeWindow''


void '''setLayerLocked'''(QString layer, bool locked)
:: Here, '''window''' will represent the active window, and is of type '''WindowAPI'''. See WindowAPI for methods and properties available for this object.
====colors====
:This property will return a '''list''' of default colors in Scribus, each color as an object of '''ScColorWrapper'''.


void '''setLayerOutlined'''(QString layer, bool outline)
:Usage:
::''colors = Scripter.colors''
::''for i in colors:''
:::''print i.name''
:Result:
:::''Black''
:::''Blue''
:::''Cool Black''
:::''Cyan''
:::''Green''
:::''Magenta''
:::''Red''
:::''Registration''
:::''Rich Black''
:::''Warm Black''
:::''White''
:::''Yellow''
===Methods===
====openDocument====
====newDocument====


void '''setLayerFlow'''(QString layer, bool flow)
==Document API==
===Properties===
====name====
====available====
====margins====
====modified====
====activePage====
====pageCount====
====activeItem====
====dimensions====
====items====
====selection====
====selectionCount====
====colors====
====layers====
====masterPages====
====styles====


void '''setLayerBlendmode'''(QString layer, int blend)
===Methods===
* save
* saveAs(name)
* setInformation(author, title, comment)


void '''setLayerTransparency'''(QString layer, int trans)
====Layer Methods in activeDocument====
* newLayer
* removeLayer
* getActiveLayer
* getActiveLayerName
* setActiveLayer


bool '''isLayerVisible'''(QString layer)
=====Color Methods in activeDocument=====
* newColorCMYK
* newColorRGB
* getColor


bool '''isLayerPrintable'''(QString layer)
=====Printer method =====
* Printer


bool '''isLayerLocked'''(QString layer)
=====Image Export methods=====
* supportedImageTypes
* exportAsImages


bool '''isLayerOutlined'''(QString layer)
===Margins API===
====Properties====
* top
* left
* right
* bottom


bool '''isLayerFlow'''(QString layer)
===Dimensions API===
====Properties====
* width
* height


int '''getLayerBlendmode'''(QString layer)
===Page API===
====Properties====
* number
* items
* position
* selection
====Methods====
* newRectangle
* newEllipse
* newImage
* newText
* newLine
* placeSVG
* placeODG
* placeEPS
* placeSXD
* savePageAsEPS


double '''getLayerTransparency'''(QString layer)
===Layer API===
====Properties====
* name
* id
* level
* printable
* viewable
* editable
* flowControl
* outlineMode
* transparency
* blendMode
* active


void '''deleteLayer'''(QString layer)
===Color API===
====Properties====
* name
* spotColor
====Methods====
* changeCMYK
* changeRGB
* replace
* remove


void '''createLayer'''(QString name)
===Printer API===
 
==Object API==
==Page API==
==Color API==

Latest revision as of 10:00, 14 June 2013

Scripter2 API is described below. This is a reference for the actual documentation of new scripter.

See also rather : https://scribus-scripter.readthedocs.org/en/latest/

The new Scripter is composed of different modules, which are either accessible externally, or via methods of other apis.

Scripter

Properties

activeDocument

This property return DocumentAPI object.
Usage:
document = Scripter.activeDocument
Here document will represent the active document, and is of type DocumentAPI

activeWindow

This property return WindowAPI object.
Usage:
window = Scripter.activeWindow
Here, window will represent the active window, and is of type WindowAPI. See WindowAPI for methods and properties available for this object.

colors

This property will return a list of default colors in Scribus, each color as an object of ScColorWrapper.
Usage:
colors = Scripter.colors
for i in colors:
print i.name
Result:
Black
Blue
Cool Black
Cyan
Green
Magenta
Red
Registration
Rich Black
Warm Black
White
Yellow

Methods

openDocument

newDocument

Document API

Properties

name

available

margins

modified

activePage

pageCount

activeItem

dimensions

items

selection

selectionCount

colors

layers

masterPages

styles

Methods

  • save
  • saveAs(name)
  • setInformation(author, title, comment)

Layer Methods in activeDocument

  • newLayer
  • removeLayer
  • getActiveLayer
  • getActiveLayerName
  • setActiveLayer
Color Methods in activeDocument
  • newColorCMYK
  • newColorRGB
  • getColor
Printer method
  • Printer
Image Export methods
  • supportedImageTypes
  • exportAsImages

Margins API

Properties

  • top
  • left
  • right
  • bottom

Dimensions API

Properties

  • width
  • height

Page API

Properties

  • number
  • items
  • position
  • selection

Methods

  • newRectangle
  • newEllipse
  • newImage
  • newText
  • newLine
  • placeSVG
  • placeODG
  • placeEPS
  • placeSXD
  • savePageAsEPS

Layer API

Properties

  • name
  • id
  • level
  • printable
  • viewable
  • editable
  • flowControl
  • outlineMode
  • transparency
  • blendMode
  • active

Color API

Properties

  • name
  • spotColor

Methods

  • changeCMYK
  • changeRGB
  • replace
  • remove

Printer API