View Issue Details

IDProjectCategoryView StatusLast Update
0006062ScribusScripterpublic2008-07-24 19:35
Reporterbarros Assigned Toavox  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntu OS Version7.04
Product Version1.3.4 
Target Version1.3.5Fixed in Version1.3.5svn 
Summary0006062: setStyle problem
DescriptionScript in Scribus 1.3.4 does not handle setStyle properly.
When called, setStyle applies the style to the entire text frame, and not just to the selected text (selected using selectText).

This is the message I sent to the list:
http://nashi.altmuehlnet.de/pipermail/scribus/2007-August/025169.html
Steps To ReproduceCreate a new page with two styles:
 - STYLE_1: with red color;
 - STYLE_2: with blue color;

Then run the attached script (sample.py).
If you run in 1.3.3.9, it will display a red and a blue paragraph, but in 1.3.4, it will display two blue paragraphs.
TagsNo tags attached.
Patch

Relationships

child of 0005693 closedplinnell 1.3.5 bug collection (prior to roadmap) 

Activities

2007-08-03 13:48

 

sample.py (1,469 bytes)   
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

try:
	import scribus
except ImportError,err:
	print 'This Python script is written for the Scribus scripting interface.'
	print 'It can only be run from within Scribus.'
	sys.exit(1)

def main(argv):
	"""Main script routine"""

	str1 = "This is the first paragraph"
	str2 = "This is the second paragraph"

	frame = scribus.createText(50,50,200,300)

	# first paragraph
	scribus.insertText(str1,-1,frame)
	scribus.selectText(0,len(str1),frame)
	scribus.setStyle("STYLE_1",frame);

	# break
	scribus.insertText("\r",-1,frame);

	# second paragraph
	scribus.insertText(str2,-1,frame)
	scribus.selectText(len(str1)+1,len(str2),frame)
	scribus.setStyle("STYLE_2",frame);

def main_wrapper(argv):
	"""The main_wrapper() function disables redrawing, sets a sensible generic
	status bar message, and optionally sets up the progress bar. It then runs
	the main() function. Once everything finishes it cleans up after the main()
	function, making sure everything is sane before the script terminates."""

	try:
		scribus.statusMessage('Running script...')
		scribus.progressReset()
		main(argv)
	finally:
		# Exit neatly even if the script terminated with an exception,
		# so we leave the progress bar and status bar blank and make sure
		# drawing is enabled.
		if scribus.haveDoc():
			scribus.setRedraw(True)
		scribus.statusMessage('')
		scribus.progressReset()

if __name__ == '__main__':
	main_wrapper(sys.argv)

sample.py (1,469 bytes)   

jghali

2008-07-23 22:27

administrator   ~0020026

Seems to work ok now

Issue History

Date Modified Username Field Change
2007-08-03 13:48 barros New Issue
2007-08-03 13:48 barros File Added: sample.py
2007-08-03 22:18 christoph_s Status new => confirmed
2007-09-27 19:34 christoph_s Relationship added child of 0005693
2007-12-06 23:13 avox Status confirmed => assigned
2007-12-06 23:13 avox Assigned To => avox
2007-12-20 22:51 cbradney Target Version => 1.3.5svn
2007-12-26 17:02 cbradney Target Version 1.3.5svn => 1.3.5
2008-07-23 22:27 jghali Note Added: 0020026
2008-07-23 22:30 jghali Status assigned => resolved
2008-07-23 22:30 jghali Fixed in Version => 1.3.5svn
2008-07-23 22:30 jghali Resolution open => fixed
2008-07-24 19:35 cbradney Status resolved => closed