#####################################################################
# Python test script for Inkscape DBus API.
#
# Contains many examples of functions and various stress tests etc.
# Multiple tests can be run at once but the output will be a bit chaotic.
# List of test functions can be found at the bottom of the script.
#####################################################################
import dbus
import random
#####################################################################
# Various test functions, called at bottom of script
#####################################################################
listy = []
if x == 1000:
print "HALFWAY"
if x == 1:
print "BEGUN"
#randomrect(document)
print "DONE"
for x in listy:
print x
doc.document_set_css ("fill:#ff0000;fill-opacity:.5;stroke:#0000ff;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none")
if x == 1000:
print "HALFWAY"
if x == 1:
print "BEGUN"
#doc.rectangle( 0, 0, 100, 100)
doc.document_set_css ("fill:#000000;fill-opacity:.5;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none")
if x == 1000:
print "HALFWAY"
if x == 1:
print "BEGUN"
#document.pause_updates()
#document.resume_updates()
# CHANGE TO LOCAL SVG FILE!
for d in center:
print d
for d in result:
print d
for d in doc.selection_divide():
print d
doc.set_attribute(rect1, "transform", "matrix(0.08881734,0.94288151,-0.99604793,0.68505564,245.36153,118.60315)")
print result
for d in result:
print d
doc.document_set_css ("fill:#ff0000;fill-opacity:.5;stroke:#0000ff;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none")
doc.document_set_css ("fill:#ffff00;fill-opacity:1;stroke:#009002;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none")
doc.document_set_css ("fill:#ffff00;fill-opacity:1;stroke:#009002;stroke-width:5;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none")
#doc.get_node_coordinates(cr1)
# Needs work.
#####################################################################
# Setup bus connection, create documents.
#####################################################################
# Connect to bus
# Get interface for default document
# Create new window and get the interface for that. (optional)
'/org/inkscape/application')
#####################################################################
# Call desired test functions
#####################################################################
#lottaverbs (doc1)
#lottarects (doc1)
#testDrawing (doc1)
#doc1.pause_updates()
#testMovement(doc1)
#testImport(doc1) # EDIT FUNCTION TO OPEN EXISTING FILE!
#testcopypaste (doc1)
#testTransforms (doc1)
#testDocStyle(doc1)
#testLayers(doc1)
#testLoadSave(doc1)
#testArray(doc1)
#testSelections(doc1)
#testCombinations(doc1)
#testText(doc1)
#testPath(doc1)
#doc1.resume_updates
# Prevents asking if you want to save when closing document.