From d84b6cedd40cf11b8fa5a58be676796fa3584fde Mon Sep 17 00:00:00 2001 From: berteh Date: Fri, 19 Jun 2020 23:34:51 +0200 Subject: [PATCH 1/8] add option to close GUI silently on successful run, #155 --- ScribusGenerator.py | 79 ++++++++++++++++++++++++-------------- ScribusGeneratorBackend.py | 12 +++++- 2 files changed, 62 insertions(+), 29 deletions(-) diff --git a/ScribusGenerator.py b/ScribusGenerator.py index b25888a..2e1a2dd 100644 --- a/ScribusGenerator.py +++ b/ScribusGenerator.py @@ -25,6 +25,7 @@ from Tkinter import Frame, LabelFrame, Label, Entry, Button, StringVar, OptionMenu, Checkbutton, IntVar, DISABLED, NORMAL, PhotoImage import tkMessageBox import tkFileDialog +import webbrowser import scribus import os @@ -53,6 +54,7 @@ def __init__(self, root): self.__fromVariable.set(CONST.EMPTY) self.__toVariable = StringVar() self.__toVariable.set(CONST.EMPTY) + self.__closeDialogVariable = IntVar() self.__root = root if scribus.haveDoc(): doc = scribus.getDocName() @@ -116,6 +118,11 @@ def getFromVariable(self): def getToVariable(self): return self.__toVariable + + def getCloseDialogVariable(self): + return self.__closeDialogVariable + + def allValuesSet(self): # Simple check whether input fields are NOT EMPTY. @@ -141,7 +148,8 @@ def createGeneratorDataObject(self): singleOutput=self.__mergeOutputCheckboxVariable.get(), firstRow=self.__fromVariable.get(), lastRow=self.__toVariable.get(), - saveSettings=self.__saveCheckboxVariable.get() + saveSettings=self.__saveCheckboxVariable.get(), + closeDialog=self.__closeDialogVariable.get() ) return result @@ -154,8 +162,13 @@ def buttonOkHandler(self): generator = ScribusGenerator(dataObject) try: generator.run() - tkMessageBox.showinfo( - 'Scribus Generator', message='Done. Generated files are in '+dataObject.getOutputDirectory()) + if(dataObject.getCloseDialog()): + self.__root.destroy() + else: + tkMessageBox.showinfo('Scribus Generator', + message='Done. Generated files are in '+dataObject.getOutputDirectory()) + + except IOError as e: # except FileNotFoundError as e: tkMessageBox.showerror( title='File Not Found', message="Could not find some input file, please verify your Scribus and Data file settings:\n\n %s" % e) @@ -172,10 +185,6 @@ def buttonOkHandler(self): tkMessageBox.showerror( title='Validation failed', message='Please check if all settings have been set correctly!') - def helpButtonHandler(self): - tkMessageBox.showinfo( - 'Help', message="More information at :\nhttps://github.com/berteh/ScribusGenerator/") - def scribusLoadSettingsHandler(self): slaFile = self.__scribusSourceFileEntryVariable.get() @@ -206,6 +215,7 @@ def scribusLoadSettingsHandler(self): # self.__saveCheckboxVariable = IntVar() #not loaded self.__fromVariable.set(dataObject.getFirstRow()) self.__toVariable.set(dataObject.getLastRow()) + self.__closeDialogVariable.set(dataObject.getCloseDialog()) else: tkMessageBox.showinfo( 'No Settings', message="Input scribus file contains no former saved settings.") @@ -244,9 +254,12 @@ def show(self): outputFrame = LabelFrame(mainFrame, text='Output Settings') outputFrame.columnconfigure(2, weight=1) outputFrame.grid(column=0, row=1, padx=5, pady=5, sticky='ew') + miscFrame = LabelFrame(mainFrame, text='Misc Settings') + miscFrame.columnconfigure(2, weight=1) + miscFrame.grid(column=0, row=2, padx=5, pady=5, sticky='ew') buttonFrame = Frame(mainFrame) buttonFrame.columnconfigure(3, weight=1) - buttonFrame.grid(column=0, row=2, padx=5, pady=5, sticky='ew') + buttonFrame.grid(column=0, row=3, padx=5, pady=5, sticky='ew') # Input-Settings scribusSourceFileLabel = Label( @@ -307,7 +320,7 @@ def show(self): column=1, columnspan=4, row=0, padx=5, pady=5, sticky='ew') outputDirectoryButton = Button( outputFrame, text='⏏', command=self.__ctrl.outputDirectoryEntryVariableHandler) - outputDirectoryButton.grid(column=5, row=0, padx=5, pady=5, sticky='e') + outputDirectoryButton.grid(column=5, row=0, padx=5, pady=5, sticky='w') outputFileNameLabel = Label( outputFrame, text='Output File Name:', width=15, anchor='w') @@ -317,36 +330,46 @@ def show(self): outputFileNameEntry.grid( column=1, columnspan=3, row=1, padx=5, pady=5, sticky='ew') - saveLabel = Label(outputFrame, text='Save Settings:', - width=15, anchor='w') - saveLabel.grid(column=4, row=1, padx=5, pady=5, sticky='w') - saveCheckbox = Checkbutton( - outputFrame, variable=self.__ctrl.getSaveCheckboxVariable()) - saveCheckbox.grid(column=5, row=1, padx=5, pady=5, sticky='w') - + outputFormatLabel = Label( + outputFrame, text='Format:', anchor='e') + outputFormatLabel.grid(column=4, row=1, padx=5, pady=5, sticky='e') + outputFormatListBox = OptionMenu(outputFrame, self.__ctrl.getSelectedOutputFormat(), *self.__ctrl.getOutputFormatList(), + command=lambda v=self.__ctrl.getSelectedOutputFormat(): self.updateState(v)) + outputFormatListBox.grid(column=5, row=1, padx=5, pady=5, sticky='w') + mergeOutputLabel = Label( - outputFrame, text='Merge in Single File:', width=15, anchor='w') - mergeOutputLabel.grid(column=0, row=2, padx=5, pady=5, sticky='w') + outputFrame, text='Merge in Single File:', width=17, anchor='w') + mergeOutputLabel.grid(column=0, columnspan=2, row=2, padx=5, pady=5, sticky='w') mergeOutputCheckbox = Checkbutton( outputFrame, variable=self.__ctrl.getMergeOutputCheckboxVariable()) - mergeOutputCheckbox.grid(column=1, row=2, padx=5, pady=5, sticky='w') + mergeOutputCheckbox.grid(column=2, row=2, padx=5, pady=5, sticky='w') self.keepGeneratedScribusFilesLabel = Label( - outputFrame, text='Keep Scribus Files:', width=15, anchor='e') + outputFrame, text='Keep Scribus Files:', width=15, anchor='w') self.keepGeneratedScribusFilesLabel.grid( - column=4, row=2, padx=5, pady=5, sticky='e') + column=3, columnspan=2, row=2, padx=5, pady=5, sticky='w') self.keepGeneratedScribusFilesCheckbox = Checkbutton( outputFrame, variable=self.__ctrl.getKeepGeneratedScribusFilesCheckboxVariable(), anchor='w') self.keepGeneratedScribusFilesCheckbox.grid( column=5, row=2, padx=5, pady=5, sticky='w') - outputFormatLabel = Label( - outputFrame, text='Output Format:', anchor='e') - outputFormatLabel.grid(column=2, row=2, padx=5, pady=5, sticky='e') - outputFormatListBox = OptionMenu(outputFrame, self.__ctrl.getSelectedOutputFormat(), *self.__ctrl.getOutputFormatList(), - command=lambda v=self.__ctrl.getSelectedOutputFormat(): self.updateState(v)) - outputFormatListBox.grid(column=3, row=2, padx=5, pady=5, sticky='w') + + # Misc Settings + saveLabel = Label(miscFrame, text='Save Settings:', + width=12, anchor='w') + saveLabel.grid(column=0, row=1, padx=5, pady=5, sticky='w') + saveCheckbox = Checkbutton( + miscFrame, variable=self.__ctrl.getSaveCheckboxVariable()) + saveCheckbox.grid(column=1, row=1, padx=5, pady=5, sticky='w') + + closeLabel = Label(miscFrame, text='Close dialog on success:', + width=20, anchor='w') + closeLabel.grid(column=3, columnspan=2, row=1, padx=5, pady=5, sticky='e') + closeCheckbox = Checkbutton( + miscFrame, variable=self.__ctrl.getCloseDialogVariable()) + closeCheckbox.grid(column=5, row=1, padx=5, pady=5, sticky='e') + # Bottom Buttons generateButton = Button( buttonFrame, text='✔\nGenerate', width=10, command=self.__ctrl.buttonOkHandler) @@ -355,7 +378,7 @@ def show(self): width=10, command=self.__ctrl.buttonCancelHandler) cancelButton.grid(column=1, row=0, padx=5, pady=5, sticky='e') helpButton = Button(buttonFrame, text='❓\nHelp', - width=7, command=self.__ctrl.helpButtonHandler) + width=7, command = lambda: webbrowser.open("https://github.com/berteh/ScribusGenerator/#how-to-use-scribus-generator")) helpButton.grid(column=3, row=0, padx=5, pady=5, sticky='e') # general layout diff --git a/ScribusGeneratorBackend.py b/ScribusGeneratorBackend.py index 30ada92..5a34f2f 100644 --- a/ScribusGeneratorBackend.py +++ b/ScribusGeneratorBackend.py @@ -600,7 +600,8 @@ def __init__(self, singleOutput=CONST.FALSE, firstRow=CONST.EMPTY, lastRow=CONST.EMPTY, - saveSettings=CONST.TRUE): + saveSettings=CONST.TRUE, + closeDialog=CONST.FALSE): self.__scribusSourceFile = scribusSourceFile self.__dataSourceFile = dataSourceFile self.__outputDirectory = outputDirectory @@ -612,6 +613,7 @@ def __init__(self, self.__firstRow = firstRow self.__lastRow = lastRow self.__saveSettings = saveSettings + self.__closeDialog = closeDialog # Get def getScribusSourceFile(self): @@ -647,6 +649,9 @@ def getLastRow(self): def getSaveSettings(self): return self.__saveSettings + def getCloseDialog(self): + return self.__closeDialog + # Set def setScribusSourceFile(self, fileName): self.__scribusSourceFile = fileName @@ -681,6 +686,9 @@ def setLastRow(self, value): def setSaveSettings(self, value): self.__saveSettings = value + def setCloseDialog(self, value): + self.__closeDialog = value + # (de)Serialize all options but scribusSourceFile and saveSettings def toString(self): return json.dumps({ @@ -695,6 +703,7 @@ def toString(self): 'single': self.__singleOutput, 'from': self.__firstRow, 'to': self.__lastRow, + 'close': self.__closeDialog # 'savesettings':self.__saveSettings NOT saved }, sort_keys=True) @@ -715,6 +724,7 @@ def loadFromString(self, string): self.__singleOutput = j["single"] self.__firstRow = j["from"] self.__lastRow = j["to"] + self.__closeDialog = j["close"] # self.__saveSettings NOT loaded logging.debug("loaded %d user settings" % (len(j)-1)) # -1 for the artificial "comment" From bcb5a612358034e24cfb9af8fdbecbf82190276c Mon Sep 17 00:00:00 2001 From: Salem Date: Mon, 24 Aug 2020 15:29:16 +1000 Subject: [PATCH 2/8] Update README.md append missing ``%`` to next record variable description --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0cc0f6..fdccfb6 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ The Scribus Generator script prioritizes items based on their _Level_ in Scribus Please note Scribus Generator v2.8 (from January 2019) changed the syntax of the ["Next Record" feature](https://github.com/berteh/ScribusGenerator#multiple-records-on-a-single-page) to a less confusing name, as per [suggestion #118](https://github.com/berteh/ScribusGenerator/issues/118) -Update your older templates manually, changing ``%VAR_NEXT-RECORD`` to ``%SG_NEXT-RECORD``, or all at once by calling, for instance: +Update your older templates manually, changing ``%VAR_NEXT-RECORD%`` to ``%SG_NEXT-RECORD%``, or all at once by calling, for instance: python ./ConvertVAR_NEXT-RECORDToSG28.py ~/ScribusProjects/*/*.sla From f70cfa96d8ef18125c7bd405ddb1e7390bca6237 Mon Sep 17 00:00:00 2001 From: Krot Eval <38257723+4n70w4@users.noreply.github.com> Date: Tue, 1 Sep 2020 20:25:38 +0300 Subject: [PATCH 3/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdccfb6..b5c0039 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ For the main platforms the script location is; - Windows: ``SCRIBUS_INSTALL_DIRECTORY\share\scripts\`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L110)) - macOS: ``SCRIBUS_INSTALL_DIRECTORY/Contents/share/scribus/scripts/`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L79)) -- Ubuntu/Debian/most Linux: ``/usr/share/scribus/scripts/`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L65) +- Ubuntu/Debian/most Linux: ``/usr/share/scribus/scripts/`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L65)) To be able to run from the system directory, the files you need to copy to the target ``scripts/`` directory are ``ScribusGenerator.py``, ``ScribusGeneratorBackend.py``, ``logging.conf`` and ``pic/ScribusGenerator_logo.gif``. From 0c8c09a14a68d2ef8b065bc8965a94f444912c33 Mon Sep 17 00:00:00 2001 From: Berteh <36950+berteh@users.noreply.github.com> Date: Sun, 22 Nov 2020 12:23:49 +0100 Subject: [PATCH 4/8] dynamic picture dialog workaround --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b5c0039..4d11fb3 100644 --- a/README.md +++ b/README.md @@ -105,17 +105,13 @@ Dynamic Images Images references can also be dynamically modified with **Scribus Generator**. See the [screencast video @6:10](https://www.youtube.com/watch?feature=player_detailpage&v=kMsRn38TOiQ#t=370). -All images supported by **Scribus** can be used. However, to work with ScribusGeneratr, they must all be located in a single folder containing all images. This folder can be located anywhere on your PC. +All images supported by **Scribus** can be used. However, to work with ScribusGenerator, they must all be located in a single folder containing all images. This folder can be located anywhere on your PC. Duplicate any image in this folder and rename it ``%VAR_pic%`` (and similarly for any other variable name you need to use for pictures, ``%VAR_pic2%, %VAR_photo%``). -Add an Image Frame anywhere in the Scribus file (_«Scribus → Insert → Insert Image Frame»_) and open the dialog for getting an image (_e.g. right click Image Frame → Get Image..._ on selected frame). Within the dialog navigate to the folder containing the images, though there won't be any images selected. Instead, the variable will be inserted into the value field of the _File name_. +Add an Image Frame anywhere in the Scribus file (_«Scribus → Insert → Insert Image Frame»_) and open the dialog for getting an image (_e.g. right click Image Frame → Get Image..._ on selected frame). Select the needed "placeholder" picture. ![Illustration: Insert variable instead of image](pic/SG-15-1.png) -After confirming the dialog, no image is displayed in the Image Frame any longer, however the variable name can be seen. - -![Illustration: Image Frame containing variable](pic/SG-15-2.png) - -The images file can be defined just like any other variable described in earlier. There just has to be a column with a column-name corresponding to the variable-name in the Scribus template file. +The images file can be defined just like any other variable described in earlier. There just has to be a column with a column-name corresponding to the variable-name in the Scribus template file. Just make sure to handle the file extension either in the file name, or in the CSV data, but not in both. ![Illustration: Data file referencing images](pic/SG-15-3.png) From a0d4633f161ff2baee7dee8027992c17a1f004a7 Mon Sep 17 00:00:00 2001 From: Berteh <36950+berteh@users.noreply.github.com> Date: Wed, 13 Jan 2021 17:14:39 +0100 Subject: [PATCH 5/8] add link to python3 version for Scribus 1.5.x --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d11fb3..7e53846 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ A [short *how to* video](https://www.youtube.com/watch/kMsRn38TOiQ) introduces t How to install Scribus Generator ? ------- -[Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). +For Scribus 1.4.x: [Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). + +For Scribus 1.5.x, please [download the Python3 ScribusGenerator](https://github.com/berteh/ScribusGenerator/archive/python3.zip) version. No features added, just a few syntactic updates. ### Alternative install options From 3ade87fd1bb3869c4d8d596da87a7142b4f30f39 Mon Sep 17 00:00:00 2001 From: Berteh <36950+berteh@users.noreply.github.com> Date: Wed, 13 Jan 2021 17:34:26 +0100 Subject: [PATCH 6/8] link to python3 for Scribus 1.5.6+ --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7e53846..994c8e6 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ A [short *how to* video](https://www.youtube.com/watch/kMsRn38TOiQ) introduces t How to install Scribus Generator ? ------- -For Scribus 1.4.x: [Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). +For Scribus 1.4.x to 1.5.5: [Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). -For Scribus 1.5.x, please [download the Python3 ScribusGenerator](https://github.com/berteh/ScribusGenerator/archive/python3.zip) version. No features added, just a few syntactic updates. +For Scribus 1.5.6+, please [download the Python3 ScribusGenerator](https://github.com/berteh/ScribusGenerator/archive/python3.zip) version. No features added, just a few syntactic updates for the more recent Python3 engine. ### Alternative install options From fa2bcab69a1a37e8cde161418a8ee18f43baa525 Mon Sep 17 00:00:00 2001 From: Berteh <36950+berteh@users.noreply.github.com> Date: Fri, 22 Jan 2021 11:27:58 +0100 Subject: [PATCH 7/8] wiki links & vector images notes --- README.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 994c8e6..100133d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ScribusGenerator ================ -Mail-Merge-like extension to Scribus, to generate Scribus and pdf documents automatically from external data. +Mail-Merge-like extension to Scribus, to generate Scribus and pdf documents automatically from external data (spreadsheet, database and more). -[Scribus Generator. Generate beautiful documents from data. Scribus Generator: Create beautiful documents with data](https://github.com/berteh/ScribusGenerator/). Open source high-quality pdf template and mail-merge alternative. +[Scribus Generator. Generate beautiful documents from data. Scribus Generator: Create beautiful documents with data](https://github.com/berteh/ScribusGenerator/). Open source high-quality pdf template and mail-merge alternative. Your imagination is the limit for creating beautiful yearbooks, personalised weedings invitations, game cards decks, clubs rosters and [many more](https://github.com/berteh/ScribusGenerator/wiki#gallery-of-examples--some-templates). What is Scribus Generator? ------- @@ -28,21 +28,10 @@ A [short *how to* video](https://www.youtube.com/watch/kMsRn38TOiQ) introduces t How to install Scribus Generator ? ------- -For Scribus 1.4.x to 1.5.5: [Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). +For Scribus 1.4.x to 1.5.5: [Download](https://github.com/berteh/ScribusGenerator/archive/master.zip) the script and uncompress it anywhere on the local machine in a folder your user can write to. **Scribus Generator** can then be started by choosing the script (``ScribusGenerator.py``) within the dialog: _«Scribus → Script → Execute Script»_, or from the [command line](#running-scribus-generator-from-the-command-line). For Scribus 1.5.6+, please [download the Python3 ScribusGenerator](https://github.com/berteh/ScribusGenerator/archive/python3.zip) version. No features added, just a few syntactic updates for the more recent Python3 engine. -### Alternative install options - -To show ScribusGennerator in the application menu _«Scribus → Script → Scribus Scripts → ScribusGenerator»_ you need to move the downloaded files to the system directory where extension scripts distributed with Scribus are placed. It might require administrator priviledges to write to the required location. - -For the main platforms the script location is; - -- Windows: ``SCRIBUS_INSTALL_DIRECTORY\share\scripts\`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L110)) -- macOS: ``SCRIBUS_INSTALL_DIRECTORY/Contents/share/scribus/scripts/`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L79)) -- Ubuntu/Debian/most Linux: ``/usr/share/scribus/scripts/`` ([source](https://github.com/scribusproject/scribus/blob/ec1238dbc3627f707a25fbc36181d67cba6d968d/scribus/scpaths.cpp#L65)) - -To be able to run from the system directory, the files you need to copy to the target ``scripts/`` directory are ``ScribusGenerator.py``, ``ScribusGeneratorBackend.py``, ``logging.conf`` and ``pic/ScribusGenerator_logo.gif``. ### MacOSX issues @@ -53,13 +42,13 @@ How to use Scribus Generator ### Create your Scribus "template" file -Create and design your Scribus file as any other. At the positions where you need to replace text with data, just add ``%VAR_name%`` where ``name`` is the column your data file. +Create and design your Scribus file as any other. At the positions where you need to replace text with data, just add ``%VAR_name%`` where ``name`` is the column your data file. Check out our [gallery of examples](https://github.com/berteh/ScribusGenerator/wiki#gallery-of-examples--some-templates) to see what others did. [Any existing Scribus file](https://www.scribus-templates.net/) can be used as template. You can place the variable at any position within a Text Frame. Apply all format and style to the variable that you wish to apply to the final text. ![Illustration: Scribus File for Generator](pic/SG-01.png) -If you wish to generate one page (or many) for each data entry you're done, congratulations ! If you would rather display many data entries on a single page simply add the text ``%SG_NEXT-RECORD%`` before each entry but the first: ScribusGenerator will automatically load the new data record as soon as it detects this token. +If you wish to generate one page (or many) for each data entry you're done, congratulations ! If you would rather display many data entries on a single page simply add the text ``%SG_NEXT-RECORD%`` **before each entry but the first**: ScribusGenerator will automatically load the new data record as soon as it detects this token. ### Create your (csv) Data File @@ -72,7 +61,9 @@ It is important to make sure the columns have the same ``name`` as the variables We recommend saving in UTF-8 encoding to enable the full set of accentuated characters, chinese, cyrillic, math symbols, arrows, braille, symbols and [many more](http://csbruce.com/software/utf-8.html). Simply copy-paste those for which you lack a keyboard combination. -To export well-formated CSV in UTF-8 encoding is easy as pie with OpenOffice or LibreOffice Calc, less so with Excel. If you are using excel you may be interested in this free add-in that provides good export/import features: http://www.csvio.net/ +To export well-formated CSV in UTF-8 encoding is easy as pie with OpenOffice or LibreOffice Calc, less so with Excel. If you are using Microsoft's Excel you may be interested in this free add-in that provides good export/import features: http://www.csvio.net/ + +CSV files can easily be generated from many existing data sources (incl. enterprise-grade ETL platforms, most databases like MySQL, PostgreSQL, SQLite3 and more, ), see our wiki page for using [other data sources](https://github.com/berteh/ScribusGenerator/wiki/Other-data-sources) Run the Generator Script - Settings --------- @@ -117,6 +108,12 @@ The images file can be defined just like any other variable described in earlier ![Illustration: Data file referencing images](pic/SG-15-3.png) +Importing vector images (SVG, PDF or other) as image frames does work in ScribusGenerator, just as with PNG or JPG images; just make sure your (relative or absolute) SVG *file path matches the generator **output directory***, as that is the place Scribus will be looking from when transforming the SLA into your PDF format. + +Scribus sometimes renders the included image in really low resolution, so you should check out the resolution (dpi) (and or size) or your source material. To quickly batch export SVG objects in multiple resolutions you may be interested in [Inkscape's object export script](https://github.com/berteh/svg-objects-export). + +There is unfortunately no way to include dynamically vector files (pdf or svg) with ScribusGenerator, because of the way Scribus imports them (from the menu File > Import > Vector) by converting them one-the-fly to scribus objects. Which is great for direct editing in Scribus, but not for including external files by reference. + Dynamic Colors --------------- From 1e880ae98d9b4c3bbdd0dfcd2ef9ba0b6f08df1f Mon Sep 17 00:00:00 2001 From: berteh <36950+berteh@users.noreply.github.com> Date: Fri, 22 Jan 2021 13:18:55 +0100 Subject: [PATCH 8/8] doc update --- README.md | 6 +++--- ScribusGenerator.py | 11 ++++------- ScribusGeneratorBackend.py | 17 +++-------------- ScribusGeneratorCLI.py | 2 +- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 100133d..5339959 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ScribusGenerator Mail-Merge-like extension to Scribus, to generate Scribus and pdf documents automatically from external data (spreadsheet, database and more). -[Scribus Generator. Generate beautiful documents from data. Scribus Generator: Create beautiful documents with data](https://github.com/berteh/ScribusGenerator/). Open source high-quality pdf template and mail-merge alternative. Your imagination is the limit for creating beautiful yearbooks, personalised weedings invitations, game cards decks, clubs rosters and [many more](https://github.com/berteh/ScribusGenerator/wiki#gallery-of-examples--some-templates). +[Scribus Generator. Generate beautiful documents from data. Scribus Generator: Create beautiful documents with data](https://github.com/berteh/ScribusGenerator/). Open source high-quality pdf template and mail-merge alternative. Your imagination is the limit for creating beautiful yearbooks, personalised weedings invitations, game cards decks, clubs rosters, art or work portfolio and [many more](https://github.com/berteh/ScribusGenerator/wiki#gallery-of-examples--some-templates). What is Scribus Generator? ------- @@ -329,7 +329,7 @@ This is only important for variable *names* in the scribus file and *column name ### Database source -To use data from a database instead a (manual) spreadsheet you can simply export the related query result to a csv file. Some examples below for common database engines: +To use data from a database instead a (manual) spreadsheet you can simply export the related query result to a CSV file. Some examples below for common database engines. Find out more about using external data sources in our [wiki](https://github.com/berteh/ScribusGenerator/wiki) . #### Mysql: @@ -376,7 +376,7 @@ Licence The MIT License
Copyright
(c) 2011, Ekkehard Will (www.ekkehardwill.de)
-(c) 2014-2017, Berteh (https://github.com/berteh/) +(c) 2014-2021, Berteh (https://github.com/berteh/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/ScribusGenerator.py b/ScribusGenerator.py index 2e1a2dd..de93e53 100644 --- a/ScribusGenerator.py +++ b/ScribusGenerator.py @@ -1,20 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Mail-Merge for Scribus. +# Mail-Merge for Scribus. This file provides the GUI (Windows and Linux). +# Tkinter is required and difficult to install in MacOS > use CLI version for Mac is recommended # # For further information (manual, description, etc.) please visit: # https://github.com/berteh/ScribusGenerator/ # -# v2.2 (2016-08-10): various bug fix (logging location in windows, dynamic colors in Scribus 1.5.2 and some more) -# v2.0 (2015-12-02): added features (merge, range, clean, save/load) -# v1.9 (2015-08-03): initial command-line support (SLA only, use GUI version to generate PDF) -# v1.1 (2014-10-01): Add support for overwriting attributes from data (eg text/area color) -# v1.0 (2012-01-07): Fixed problems when using an ampersand as values within CSV-data. +# v2.9.1 (2021-01-22): update port to Python3 for Scribut 1.5.6+, various DOC update # """ The MIT License -Copyright (c) 2010-2014 Ekkehard Will (www.ekkehardwill.de), 2014 Berteh (https://github.com/berteh/) +Copyright (c) 2010-2014 Ekkehard Will (www.ekkehardwill.de), 2014-2021 Berteh (https://github.com/berteh/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ diff --git a/ScribusGeneratorBackend.py b/ScribusGeneratorBackend.py index 5a34f2f..17d4a28 100644 --- a/ScribusGeneratorBackend.py +++ b/ScribusGeneratorBackend.py @@ -1,27 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Mail-Merge for Scribus. +# Mail-Merge for Scribus. This file provides the backend. # # For further information (manual, description, etc.) please visit: # https://github.com/berteh/ScribusGenerator/ # -# v2.8 (2019-01-29): code style > PEP8 approximate, renamed %VAR_NEXT-RECORD% into %SG_NEXT-RECORD% -# v2.7 (2018-04-22): change SGAttribute to work in Scribus 1.5.3 GUI. -# v2.6 (2018-04-07): bug fix (dynamic output file directory, linked frames limit, Python 3.6 syntax) -# v2.5 (2017-03-27): support for multiple records on same page (Next-Record mechanism), bug fix (multiple SGAttributes) -# v2.3 (2016-08-10): various bug fix (logging location in windows, dynamic colors in Scribus 1.5.2 and some more) -# v2.0 (2015-12-02): added features (merge, range, clean, save/load) -# v1.9 (2015-08-03): initial command-line support (SLA only, use GUI version to generate PDF) -# v1.1 (2014-10-01): Add support for overwriting attributes from data (eg text/area color) -# v1.0 (2012-01-07): Fixed problems when using an ampersand as values within CSV-data. -# v2011-01-18: Changed run() so that scribus- and pdf file creation and deletion works without problems. -# v2011-01-17: Fixed the ampersand ('&') problem. It now can be used within variables. -# v2011-01-01: Initial Release. +# v2.9.1 (2021-01-22): update port to Python3 for Scribut 1.5.6+, various DOC update # """ The MIT License -Copyright (c) 2010-2014 Ekkehard Will (www.ekkehardwill.de), 2014-2015 Berteh (https://github.com/berteh/) +Copyright (c) 2010-2014 Ekkehard Will (www.ekkehardwill.de), 2014-2021 Berteh (https://github.com/berteh/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ diff --git a/ScribusGeneratorCLI.py b/ScribusGeneratorCLI.py index f85e0d9..d15d3e0 100755 --- a/ScribusGeneratorCLI.py +++ b/ScribusGeneratorCLI.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Mail-Merge for Scribus. +# Mail-Merge for Scribus. This file provides the Command Line Interface (all OS) # # For further information (manual, description, etc.) please visit: # https://github.com/berteh/ScribusGenerator/