Difference between revisions of "Script Resize selected objects"

From Scribus Wiki
Jump to: navigation, search
(New page: #!/usr/bin/python """ this script asks for a percentage and scales all the selected by that percentage <pre>@author: alessandro rimoldi @version: 1.0 / 20091025 @copyright (c) 2009 alessa...)
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
#!/usr/bin/python
+
{{Scripting Index}}
 +
 
 +
<pre>#!/usr/bin/python
  
 
"""
 
"""
 
this script asks for a percentage and scales all the selected by that percentage
 
this script asks for a percentage and scales all the selected by that percentage
<pre>@author: alessandro rimoldi
+
@author: alessandro rimoldi
 
@version: 1.0 / 20091025
 
@version: 1.0 / 20091025
 
@copyright (c) 2009 alessandro rimoldi under the mit license
 
@copyright (c) 2009 alessandro rimoldi under the mit license
Line 21: Line 23:
 
     sys.exit(1)
 
     sys.exit(1)
  
x = int(scribus.valueDialog('group resize', 'percent to resize', '10'))
+
x = int(scribus.valueDialog('group resize', 'precent resize incremen', '10'))
  
 
for i in range(0, n):
 
for i in range(0, n):

Latest revision as of 15:00, 25 October 2009

This article is part of the Scripts series.
#!/usr/bin/python

"""
this script asks for a percentage and scales all the selected by that percentage
@author: alessandro rimoldi
@version: 1.0 / 20091025
@copyright (c) 2009 alessandro rimoldi under the mit license
           http://www.opensource.org/licenses/mit-license.html
"""
import sys
try:
   import scribus
except ImportError:
   print "This script only works from within Scribus"
   sys.exit(1)

n = scribus.selectionCount()

if n == 0 :
    scribus.messageBox('Error:', 'No frame selected');
    sys.exit(1)

x = int(scribus.valueDialog('group resize', 'precent resize incremen', '10'))

for i in range(0, n):
    frame = scribus.getSelectedObject(i)
    (w, h) = scribus.getSize(frame)
    w = w + (x * w / 100)
    h = h + (x * h / 100)
    scribus.sizeObject(w, h, frame)