[scribus] Spin-boxes and interface issues

Gregory Pittman gpittman at iglou.com
Fri Nov 9 00:01:45 UTC 2018


On 11/7/18 3:12 PM, JLuc wrote:
> Le 07/11/2018 à 18:05, Gregory Pittman a écrit :
>>> 2. Image scaling:  when working on a magazine article image frames often have similar scaling for the images within them, and image frames can be cloned and copied  - however, every time a new image is inserted into a frame, it defaults to 100% instead of the inherited frame aspect - which is how I would expect it to happen.  This then necessitates lots of clicks to reset the image scaling to the one it was copied from.
>>
>> If you are scaling to frame size, it will stay in that when you load a new image. Note that you can set the default behavior for frames in Preferences > Item Tools > Images, in case that might be helpful. Otherwise, it's a matter of looking at the Scaling of the image in Properties before you load a new image.
> 
> I agree with Colin that there is a usability issue when loading a new image into an image frame.
> Most of the time i wish the scale would not change.
> The report is there :
> https://bugs.scribus.net/view.php?id=12253
> 

I've written a script, retainscaling.py that manages this issue. It's actually quite simple. After some error checking to make sure there is only one frame and it's an image frame, its scaling is obtained.
A file dialog opens to choose a new image file. The file is loaded and the scaling set to the previous settings.

Greg

#!/usr/bin/env python
# -*- coding: utf-8  -*-

"""
retainscaling.py

USAGE
You must have a single image frame selected. Its scaling is noted.
A file dialog opens to load a new image. New image is loaded, scaling set to
same as previous image.

"""

try:
    import scribus
except ImportError:
    print "Unable to import the 'scribus' module. This script will only run within"
    print "the Python interpreter embedded in Scribus. Try Script->Execute Script."
    sys.exit(1)

if scribus.selectionCount() != 1:
    scribus.messageBox('Selection Count', "You must have a frame selected",
                       scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)

frame1 = scribus.getSelectedObject()
ftype1 = scribus.getObjectType(frame1)
if (ftype1 != "ImageFrame"):
    scribus.messageBox('Object Type', "Selected object must be an image frame",
                       scribus.ICON_WARNING, scribus.BUTTON_OK)
    sys.exit(2)

scribus.setRedraw(False)
currentscale = scribus.getImageScale(frame1)   # this returns a tuple x,y
newimage = scribus.fileDialog('Get Image', 'Image file (*.*)')
scribus.loadImage(newimage, frame1)
scribus.setImageScale(currentscale[0], currentscale[1], frame1)

scribus.setRedraw(True)




More information about the scribus mailing list