r19316 by jghali - #12476: "importcvs2table" script crashes if no document is opened
scribus-commit
scribus-commit at lists.scribus.net
Sun Jul 6 10:35:36 UTC 2014
Author: jghali
Date: Sun Jul 6 10:35:36 2014
New Revision: 19316
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19316
Log:
#12476: "importcvs2table" script crashes if no document is opened
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/scripts/importcsv2table.py
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scripts/importcsv2table.py
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19316&path=/trunk/Scribus/scribus/plugins/scriptplugin/scripts/importcsv2table.py
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scripts/importcsv2table.py (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scripts/importcsv2table.py Sun Jul 6 10:35:36 2014
@@ -136,23 +136,32 @@
#########################
# YOUR CODE GOES HERE #
#########################
- userdim=scribus.getUnit() #get unit and change it to mm
+ if not scribus.haveDoc() > 0: #do we have a doc?
+ scribus.messageBox("importcvs2table", "No opened document.\nPlease open one first.")
+ sys.exit()
+ userdim = scribus.getUnit() #get unit and change it to mm
scribus.setUnit(scribus.UNIT_MILLIMETERS)
cellwidthleft = 0
cellwidthright = 0
cellHeight = 0
pos = getPosition()
while cellwidthleft <= 0:
- cellwidthL = scribus.valueDialog('Left Cell Width','How wide (mm) do you wish left cells to be?','30.0')
- cellwidthleft = float(cellwidthL)
+ cellwidthL = scribus.valueDialog('Left Cell Width','How wide (mm) do you wish left cells to be?','30.0')
+ if (not cellwidthL) :
+ sys.exit()
+ cellwidthleft = float(cellwidthL)
while cellwidthright <= 0:
- cellwidthR = scribus.valueDialog('Right Cell Width','How wide (mm) do you wish right cells to be?','30.0')
- cellwidthright = float(cellwidthR)
+ cellwidthR = scribus.valueDialog('Right Cell Width','How wide (mm) do you wish right cells to be?','30.0')
+ if (not cellwidthR) :
+ sys.exit()
+ cellwidthright = float(cellwidthR)
while cellHeight <= 0:
- cellheight = scribus.valueDialog('Cell Height','How tall (mm) do you wish cells to be?','10.0')
- cellHeight = float(cellheight)
+ cellheight = scribus.valueDialog('Cell Height','How tall (mm) do you wish cells to be?','10.0')
+ if (not cellheight) :
+ sys.exit()
+ cellHeight = float(cellheight)
data = getCSVdata()
- di= getDataInformation(data)
+ di = getDataInformation(data)
hposition=pos[1]
vposition=pos[0]
More information about the scribus-commit
mailing list