#!/usr/bin/env python # -*- coding: utf-8 -*- """ DESCRIPTION & USAGE: This script needs Tkinter. It will create a GUI with available options for easy dropshadow creation. You'll get a group of object that will have incremental shade or opacity value that simulates roughly a shadow blur. Best print result if at least quality = attenuation*3 Steps to create: TODO: * auto detect install version to propose as default value for correction * add UI to give a more efficient way to select through version * display a message that says some things might be lost * try to do a list of what is lost AUTHOR: Cedric Gemy LICENSE: 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. V1.0 - convert scribus file to a given format - ask if file has to be open """ #from lxml import etree from scribus import * import re try: from Tkinter import * except ImportError: print "This script requires Python's Tkinter properly installed." messageBox('Script failed','This script requires Python\'s Tkinter properly installed.', ICON_CRITICAL) sys.exit(1) class VersionHandling: def __init__(self): self.file = fileDialog('Enter name of file to convert ', filter='Scribus Files (*.sla);;All Files (*)') convert2val = valueDialog('Choose format','Convert file to (1.3.3.14, 1.4.0):','1.4.0') fs = open(self.file, 'r') newfile = self.file+"-convert.sla" fd = open(newfile, 'w') self.newstr2 = fs.read() #ou readline pour acceder directement a la bonne ligne self.newstr2 = re.sub('Version="(.*)"', 'Version="'+convert2val+'"', self.newstr2) # fd.write(self.newstr2) fs.close() fd.close() #messageBox('Info','File converted to '+convert2val+' as '+newfile,ICON_CRITICAL) launch = valueDialog('Open document','File converted to '+convert2val+' as '+newfile+'. Open in scribus ? (yes|no)','no') if launch=="yes": openDoc(self.file+"-convert.sla") def actions(self): self.NoSignSpace() def uidesign(self): frame = Frame(self.topobject,width=200,height=220) self.topobject.title("Clear Blanks") self.topobject.geometry('200x220-400+400') self.topobject.resizable(FALSE,FALSE) self.tabs = Checkbutton(frame, text="EraseTabDuplicates", variable=self.tabsV) self.backup = Checkbutton(frame, text="BackUpFile", variable=self.bakV) self.button = Button(frame, text="Cancel", command=self.quit) self.apply = Button(frame, text="Apply", command=self.self.clearDoubleSpaces()) self.tabs.place(x=10,y=10) self.backup.place(x=10,y=40) self.button.place(x=10,y=190) self.apply.place(x=110,y=190) frame.pack() def quit(self): self.quit() #root = Tk() #app = TextHandling(root) app = VersionHandling() #root.mainloop() #if haveDoc(): # setRedraw(1) # docChanged(1) #else: # openDoc(app.file) #open if a checkbox is set #root.mainloop()