def on_privmsg(self, nick, chan, msg): if chan == "#osp" and msg.startswith("!"): p = r"^([a-zA-Z]+)\((.+)*\)" r = re.search(p, msg[1:]) if r is None: return else: cmd, args = r.groups() if cmd in methodList: scribus.setRedraw(False) try: if args is None: r = getattr(scribus, cmd)() elif type(ast.literal_eval(args)) is tuple: r = getattr(scribus, cmd)(*ast.literal_eval(args)) else: r = getattr(scribus, cmd)(ast.literal_eval(args)) self.privmsg(chan, "called %s" % cmd) self.privmsg(chan, "returned %s" % r if r is not None else "nothing") # Ugly workaround to force scribus refreshing scribus.zoomDocument(101) scribus.zoomDocument(100) except TypeError: self.privmsg(chan, "%s" % getattr(scribus, cmd).__doc__) scribus.setRedraw(True) elif cmd == "help": for i in info(scribus): self.privmsg(chan, "%s" % i) else: self.privmsg(chan, "No such a command: %s" % cmd)
def run(self): sourceDir = scribus.fileDialog("Comic Directory", isdir=True) scribus.newDoc( self.pageSize, self.margins, scribus.PORTRAIT, 0, scribus.UNIT_MILLIMETERS, scribus.FACINGPAGES, scribus.FIRSTPAGERIGHT) for resource in os.walk(sourceDir): self.clean_up_and_queue(resource[0], resource[1], resource[2]) scribus.gotoPage(1) test = re.compile("[0-9]{1,}\.(%s)$" % self.formats, re.IGNORECASE) files = filter(test.search, self.images) files.sort() nImages = len(files) if nImages % 4 > 0: print "not" numPages = ( ((nImages / 4) +1 ) * 4 ) else: print ":p" numPages = nImages print numPages for page in range(1, numPages): scribus.newPage(-1) i = 1 for file in files: scribus.gotoPage(i) self.createImagePage(file, "image_%s" % i) i = i + 1 if os.path.isfile("%s/front_cover.jpg" % sourceDir): file = "%s/front_cover.jpg" % sourceDir scribus.newPage(1) scribus.gotoPage(1) self.createImagePage(file, "front_cover") if os.path.isfile("%s/back_cover.jpg" % sourceDir): file = "%s/back_cover.jpg" % sourceDir scribus.newPage(-1) scribus.gotoPage(scribus.pageCount()) self.createImagePage(file, "back_cover") if os.path.isfile("%s/logo_cover.svg" % sourceDir): file = "%s/logo_cover.svg" % sourceDir scribus.gotoPage(1) scribus.placeSVG(file, 0, 0) # result = scribus.messageBox('Debug', "%s" % self._comicInfo) scribus.setInfo("Fernando Michelotti", "Comics", "description") scribus.zoomDocument(-100) scribus.saveDoc()
scribus.progressTotal(len(files)) scribus.messagebarText("Creating pages...") progress = 0 for f in files: scribus.progressSet(progress) progress = progress + 1 add_image(f) if len(files) > progress: # add page for next image scribus.newPage(-1) scribus.progressReset() scribus.messagebarText("") scribus.deselectAll() scribus.gotoPage(1) if __name__ == "__main__": if scribus.haveDoc(): get_settings_from_document() else: create_document() scribus.zoomDocument(50) create_content()
scribus.progressTotal(len(files)) scribus.messagebarText("Creating pages...") progress = 0 for f in files: scribus.progressSet(progress) progress = progress + 1 add_image(f) if len(files) > progress: # add page for next image scribus.newPage(-1) scribus.progressReset() scribus.messagebarText("") scribus.deselectAll() scribus.gotoPage(1) if __name__ == '__main__': if scribus.haveDoc(): get_settings_from_document() else: create_document() scribus.zoomDocument(50) create_content()