def prepareDocument(): """creates the new document, sets up colors """ colorList = getColorsFromDocument() spotDict = getSpotColors() scribus.statusMessage("Preparing new document...") scribus.newDocument(scribus.PAPER_A4, (15,15, 20, 20), scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.PAGE_1, 0, 1) scribus.setUnit(scribus.UNIT_MILLIMETERS) #delete existing colors cols = scribus.getColorNames() for col in cols: scribus.deleteColor(col, "None") #create our new colors for color in colorList: cname=color[0] c = int(color[1]) m = int(color[2]) y = int(color[3]) k = int(color[4]) scribus.defineColorCMYK(cname, c, m, y, k ) if spotDict.has_key(cname): scribus.setSpotColor(cname, spotDict[cname]) #get the pageTitle form user and store it in PageTitle global pageTitle pageTitle=scribus.valueDialog("ColorChart by Sebastian Stetter", "Please enter document title", "Scribus COLOR CHART") drawHeaderFooter(pageTitle)
def importColors(colorlist): """check if colors exists an import""" colordict=getColorDict() scribus.statusMessage("Defining new colors...") scribus.progressTotal(len(colorlist)) i=0 for color in colorlist: name=color[0] c=color[1] m=color[2] y=color[3] k=color[4] while colordict.has_key(name):# check if color already exists - then add PREFIX to name name = PREFIX+name scribus.defineColorCMYK(name, c, m, y, k) i=i+1 scribus.progressSet(i)
def importColors(colorlist): """check if colors exists an import""" colordict = getColorDict() scribus.statusMessage("Defining new colors...") scribus.progressTotal(len(colorlist)) i = 0 for color in colorlist: name = color[0] c = color[1] m = color[2] y = color[3] k = color[4] while name in colordict: # check if color already exists - then add PREFIX to name name = PREFIX + name scribus.defineColorCMYK(name, c, m, y, k) i = i + 1 scribus.progressSet(i)