Commit 8cfd8bd8 authored by Etienne Nadji's avatar Etienne Nadji
Browse files

Documentation

	modifié :         source/guide/en/quickstart.rst
	modifié :         source/index.rst
parent fe9c53a2
......@@ -2,6 +2,29 @@
Quickstart
**********
Install PyScribus
=================
Pip
---
PyScribus is available through pip :
**For Python versions >= 3.8 :**
``pip install pyscribus``
**For older Python versions :**
``pip install -i https://test.pypi.org/simple/ pyscribus-backported``
Git
---
The code of PyScribus is available as a GIT repository on Framagit.
``git clone https://framagit.org/etnadji/pyscribus.git``
An introduction to PyScribus modules
====================================
......@@ -92,7 +115,78 @@ most of the other ones.
Basics of PyScribus objects
===========================
TODO: fromdefault(), pyscribus_defaults attribute, listdefaults()
Each PyScribus object corresponding to a objet in the SLA source file, for
example, a color definition, a paragraph style… has some common methods.
Defaults
--------
You can import default attributes of a PyScribus object with `.fromdefault`
method. Sometimes, there is not one set of defaults attributes but many (for
example, the colors included in every new Scribus document); in that case, you
would find the set name with `.listdefaults` method and
in `pyscribus_defaults` attributes.
::
import pyscribus.colors as colors
black = colors.Color()
black.listdefaults()
# ['Black',
# 'Blue',
# 'Cool Black',
# 'Cyan',
# 'Green',
# 'Magenta',
# 'Red',
# 'Registration',
# 'Rich Black',
# 'Warm Black',
# 'White',
# 'Yellow']
# For the Color object, no set name -> Black set.
black.fromdefault()
# {'C': 0.0, 'M': 0.0, 'Y': 0.0, 'K': 100.0}, True
print(black.colors, black.is_cmyk)
red = colors.Color()
# Red, Green, Blue are default colors in RGB color space
red.fromdefault("Red")
# {'R': 255.0, 'G': 0.0, 'B': 0.0}, False
print(red.colors, red.is_cmyk)
XML
---
The SLA file format is an XML one. So if you only want to convert a portion
of a SLA file into a Python object, you can do that with the `.fromxml` method.
::
import lxml.etree as ET
import pyscribus.colors as colors
# SLA color definition -----------------------
code = '<COLOR NAME="Black" SPACE="CMYK" C="0" M="0" Y="0" K="100"/>'
# Create the color object and load from code -
source = ET.fromstring(code)
color = colors.Color()
color.fromxml(source)
# --------------------------------------------
# {'C': 0.0, 'M': 0.0, 'Y': 0.0, 'K': 100.0}, True
print(color.colors, color.is_cmyk)
Measures and geometry in PyScribus
==================================
......
......@@ -4,8 +4,14 @@ PyScribus
Read, create and update Scribus .sla files.
**For Python versions >= 3.8**
``pip install pyscribus``
**For older Python versions**
``pip install -i https://test.pypi.org/simple/ pyscribus-backported``
-------------------
User Guide
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment