[scribus] Scripter: slow createCharStyle() and createParagraphStyle()

Stefano Danzi s.danzi at hawai.it
Wed Apr 10 09:16:09 UTC 2013


Il 10/04/2013 0.27, Owen ha scritto:
>
> It is if your program is written to do that.
>
> Maybe you could post the script for more eyes to debug, but generally,
> this case will occur when "calls" aren't completed and another started.
> Just fills up one of your quotas.
>
> Then again, the fault could be in the underlying createCharStyle or
> createParagraphStyle code in which case it needs to reported as a bug.
>
This is a very semplified version of my script:

###########################################################
import sys,time

try:
     import scribus
except ImportError,err:
     print "This script must be run within Scribus."
     sys.exit(1)


def main(argv):
     """
     Test function: slow createCharStyle() and createParagraphStyle()
     """
     stylesList = ['01','02','03','04','05','06','07','08','09','10', \
                   '11','12','13','14','15','16','17','18','19','20']


     for item in stylesList :
       start = time.time()
       scribus.createCharStyle("CS-" + item + "-label", "Arial Regular" 
,10,"inherit","Black")
       elapsed = (time.time() - start)
       print "createCharStyle("+"CS-" + item + "-label" +  " ...) took 
", elapsed, " time to finish"

       start = time.time()
       scribus.createParagraphStyle("PS-" + item + "-label", 1, 1, 1, 0, 
0, 0, 0, 0, 0, 0, 0, "CS-" + item + "-label")
       elapsed = (time.time() - start)
       print "createParagraphStyle("+"PS-" + item + "-label" +  " ...) 
took ", elapsed, " time to finish"

       start = time.time()
       scribus.createCharStyle("CS-" + item + "-number", "Arial 
Regular",8,"inherit","Black")
       elapsed = (time.time() - start)
       print "createCharStyle("+"CS-" + item + "-number" +  " ...) took 
", elapsed, " time to finish"

       start = time.time()
       scribus.createParagraphStyle("PS-" + item + "-number", 1, 1, 0, 
0, 0, 0, 0, 0, 0, 0, 0, "CS-" + item + "-number")
       elapsed = (time.time() - start)
       print "createParagraphStyle("+"PS-" + item + "-number"+  " ...) 
took ", elapsed, " time to finish"


def main_wrapper(argv):
     """ Boiler plate from /share/samples/boilerplate.py """
     try:
         scribus.statusMessage("Running script...")
         scribus.progressReset()
         main(argv)
     finally:
         if scribus.haveDoc():
             scribus.setRedraw(True)
         scribus.statusMessage("")
         scribus.progressReset()

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

############################################################################################

And this is the result:

createCharStyle(CS-01-label ...) took  1.09299993515  time to finish
createParagraphStyle(PS-01-label ...) took  3.24699997902  time to finish
createCharStyle(CS-01-number ...) took  4.87000012398  time to finish
createParagraphStyle(PS-01-number ...) took  6.86800003052  time to finish
createCharStyle(CS-02-label ...) took  8.46099996567  time to finish
createParagraphStyle(PS-02-label ...) took  10.0989999771  time to finish
createCharStyle(CS-02-number ...) took  14.501999855  time to finish
createParagraphStyle(PS-02-number ...) took  16.0010001659  time to finish
createCharStyle(CS-03-label ...) took  15.111000061  time to finish
createParagraphStyle(PS-03-label ...) took  16.3589999676  time to finish
createCharStyle(CS-03-number ...) took  18.9189999104  time to finish
createParagraphStyle(PS-03-number ...) took  19.4440000057  time to finish
createCharStyle(CS-04-label ...) took  22.0810000896  time to finish
createParagraphStyle(PS-04-label ...) took  23.001999855  time to finish
createCharStyle(CS-04-number ...) took  25.8259999752  time to finish
createParagraphStyle(PS-04-number ...) took  33.3009998798  time to finish
createCharStyle(CS-05-label ...) took  33.7690000534  time to finish
createParagraphStyle(PS-05-label ...) took  34.5490000248  time to finish
createCharStyle(CS-05-number ...) took  30.3050000668  time to finish
createParagraphStyle(PS-05-number ...) took  35.2509999275  time to finish
createCharStyle(CS-06-label ...) took  32.6930000782  time to finish
createParagraphStyle(PS-06-label ...) took  35.0289998055  time to finish
createCharStyle(CS-06-number ...) took  35.6059999466  time to finish
createParagraphStyle(PS-06-number ...) took  37.478000164  time to finish
createCharStyle(CS-07-label ...) took  38.9479999542  time to finish
createParagraphStyle(PS-07-label ...) took  40.9319999218  time to finish
createCharStyle(CS-07-number ...) took  43.1840000153  time to finish
createParagraphStyle(PS-07-number ...) took  55.728000164  time to finish
createCharStyle(CS-08-label ...) took  48.8459999561  time to finish
createParagraphStyle(PS-08-label ...) took  49.878000021  time to finish
createCharStyle(CS-08-number ...) took  51.6079998016  time to finish
createParagraphStyle(PS-08-number ...) took  57.3040001392  time to finish
createCharStyle(CS-09-label ...) took  58.7409999371  time to finish
createParagraphStyle(PS-09-label ...) took  70.5950000286  time to finish
createCharStyle(CS-09-number ...) took  76.5929999352  time to finish
createParagraphStyle(PS-09-number ...) took  46.7230000496  time to finish
createCharStyle(CS-10-label ...) took  42.0699999332  time to finish
createParagraphStyle(PS-10-label ...) took  39.3849999905  time to finish
createCharStyle(CS-10-number ...) took  39.1670000553  time to finish
createParagraphStyle(PS-10-number ...) took  42.3510000706  time to finish
createCharStyle(CS-11-label ...) took  41.1800000668  time to finish
createParagraphStyle(PS-11-label ...) took  42.4759998322  time to finish
createCharStyle(CS-11-number ...) took  43.5830001831  time to finish
createParagraphStyle(PS-11-number ...) took  44.9340000153  time to finish
createCharStyle(CS-12-label ...) took  57.1869997978  time to finish
createParagraphStyle(PS-12-label ...) took  60.4990000725  time to finish
createCharStyle(CS-12-number ...) took  66.1909999847  time to finish
createParagraphStyle(PS-12-number ...) took  62.125  time to finish
createCharStyle(CS-13-label ...) took  54.0250000954  time to finish
createParagraphStyle(PS-13-label ...) took  53.368999958  time to finish
createCharStyle(CS-13-number ...) took  55.9149999619  time to finish
createParagraphStyle(PS-13-number ...) took  68.7699999809  time to finish
createCharStyle(CS-14-label ...) took  69.4419999123  time to finish
createParagraphStyle(PS-14-label ...) took  63.4140000343  time to finish
createCharStyle(CS-14-number ...) took  73.370000124  time to finish
createParagraphStyle(PS-14-number ...) took  81.6689999104  time to finish
createCharStyle(CS-15-label ...) took  76.0640001297  time to finish
createParagraphStyle(PS-15-label ...) took  64.2769999504  time to finish
createCharStyle(CS-15-number ...) took  73.1419999599  time to finish
createParagraphStyle(PS-15-number ...) took  70.1990001202  time to finish
createCharStyle(CS-16-label ...) took  61.9259998798  time to finish
createParagraphStyle(PS-16-label ...) took  68.1050000191  time to finish
createCharStyle(CS-16-number ...) took  64.8280000687  time to finish
createParagraphStyle(PS-16-number ...) took  73.396999836  time to finish
createCharStyle(CS-17-label ...) took  74.0370001793  time to finish
createParagraphStyle(PS-17-label ...) took  69.4459998608  time to finish
createCharStyle(CS-17-number ...) took  72.3340001106  time to finish
createParagraphStyle(PS-17-number ...) took  81.4649999142  time to finish
createCharStyle(CS-18-label ...) took  75.9230000973  time to finish
createParagraphStyle(PS-18-label ...) took  77.0149998665  time to finish
createCharStyle(CS-18-number ...) took  78.1860001087  time to finish
createParagraphStyle(PS-18-number ...) took  81.993999958  time to finish
createCharStyle(CS-19-label ...) took  75.7190001011  time to finish
createParagraphStyle(PS-19-label ...) took  77.9509999752  time to finish
createCharStyle(CS-19-number ...) took  78.121999979  time to finish
createParagraphStyle(PS-19-number ...) took  80.1989998817  time to finish
createCharStyle(CS-20-label ...) took  81.6500000954  time to finish
createParagraphStyle(PS-20-label ...) took  82.7739999294  time to finish
createCharStyle(CS-20-number ...) took  82.2279999256  time to finish
createParagraphStyle(PS-20-number ...) took  86.0520000458  time to finish





More information about the scribus mailing list