#!/usr/bin/env python # -*- coding: utf-8 -*- # selectojbects.py # © 2016.11.20 Gregory Pittman # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. """ USAGE Before running this script, you should have created and selected one or more image frames. """ import sys import os 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 not scribus.haveDoc(): scribus.messageBox('Error','You must have a document open',scribus.ICON_WARNING,scribus.BUTTON_OK) sys.exit(2) scribus.setRedraw(False) framecount = scribus.selectionCount() if framecount == 0: scribus.messageBox('Scribus - Script Error','There is no object selected. Please select at least one image frame and try again.',scribus.ICON_WARNING, scribus.BUTTON_OK) sys.exit(2) count = 0 newstyle = scribus.valueDialog('What Style to Apply?','Give a style name') frames = [] while count <= framecount-1: currframe = scribus.getSelectedObject(count) frames.append(currframe) count += 1 for item in frames: frametype = scribus.getObjectType(item) if frametype == "TextFrame": scribus.setStyle(newstyle, item) scribus.setRedraw(True)