Making margins in Guttenberg way

This script makes proportional margins in Gutemberg way, based in left margin value. Scribus automaticaly mirror margin in facing page documents.

Made après Sitespiegel OpenOffice.org macro.

--Meira da Rocha 18:37, 10 Jun 2005 (UTC)

"""Generate margins according Gutemberg way. """ import sys """Locale strings to be translated """ TITLE = "Generate margins" noDocMsg = "&lt;h2&gt;First, open a doc&lt;/h2&gt;This script only work on opened document.\ &lt;b&gt;Open a document&lt/b&gt; before run this script." runningMsg = "Running script..." noScribusMsg = "This Python script is written for the Scribus scripting interface.\ \nIt can only be run from within Scribus." try: import scribus except ImportError,err: print noScribusMsg sys.exit(1) from scribus import UNIT_POINTS,BUTTON_OK,ICON_WARNING def main(argv): """Generate margins""" if scribus.haveDoc: scribus.setRedraw(False) unit = scribus.getUnit # save original unit scribus.setUnit(UNIT_POINTS) # working in points, due a bug in getPageMargins pageWidth, pageHeight = scribus.getPageSize ratio = pageHeight / pageWidth topMargin, leftMargin, rightMargin, bottomMargin = scribus.getPageMargins topMargin = leftMargin * ratio rightMargin = leftMargin * 2 bottomMargin = rightMargin * ratio scribus.setMargins(leftMargin, rightMargin, topMargin, bottomMargin) scribus.setUnit(unit) # restore original unit else: scribus.messageBox(TITLE, noDocMsg, ICON_WARNING, BUTTON_OK) def main_wrapper(argv): try: scribus.statusMessage(runningMsg) scribus.progressReset main(argv) finally: if scribus.haveDoc: scribus.setRedraw(True) scribus.statusMessage("") scribus.progressReset if __name__ == '__main__': main_wrapper(sys.argv)
 * 1) !/usr/bin/env python2.3
 * 2) -*- coding: utf-8 -*-