summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Weller <ianweller@gmail.com>2008-09-27 21:30:44 -0500
committerIan Weller <ianweller@gmail.com>2008-09-27 21:30:44 -0500
commit2f35d60fbefac011af3b82efb834581fce8f48e3 (patch)
treebe8e052dfff7e6d18a51b3610936455f8361c24d
parent64b925b4c193d618e7b7a5b6b4de6bcb56dd56af (diff)
downloadfedora-business-cards-2f35d60fbefac011af3b82efb834581fce8f48e3.zip
fedora-business-cards-2f35d60fbefac011af3b82efb834581fce8f48e3.tar.gz
fedora-business-cards-2f35d60fbefac011af3b82efb834581fce8f48e3.tar.xz
Minor housekeeping
-rw-r--r--generate.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/generate.py b/generate.py
index a87498d..fe23df6 100644
--- a/generate.py
+++ b/generate.py
@@ -25,7 +25,7 @@ templates that this script requires.
You'll need mgopen-fonts, python-fedora, and pygpgme from yum.
"""
-from fedora.accounts.fas2 import AccountSystem
+from fedora.client.fas2 import AccountSystem
from optparse import OptionParser
import gpgme
import re
@@ -34,7 +34,6 @@ from getpass import getpass
from xml.dom import minidom
import rsvg
import cairo
-import sys
if not cairo.HAS_PDF_SURFACE:
raise SystemExit('cairo was not compiled with PDF support')
@@ -74,11 +73,11 @@ class BusinessCardError(ValueError):
return "No GPG key ID for %s, use override" % self.args[0]
-def svg_to_pdf_png(basename=None,xmlstring=None):
+def svg_to_pdf_png(basename=None, xmlstring=None):
# thanks, spoleeba
svg = rsvg.Handle(data=xmlstring)
- pdfname=basename+'.pdf'
- pngname=basename+'.png'
+ pdfname = basename+'.pdf'
+ pngname = basename+'.png'
pdffile = file(pdfname, 'w')
surface = cairo.PDFSurface(pdffile, svg.props.width, svg.props.height)
ctx = cairo.Context(surface)
@@ -87,6 +86,7 @@ def svg_to_pdf_png(basename=None,xmlstring=None):
surface.finish()
pdffile.close()
+
def get_gpg_fingerprint(keyid):
"""
Gets the GPG fingerprint from the key ID.
@@ -133,10 +133,8 @@ def gen_front(name, title, lines, outfile):
for i in range(6):
node = find_node(dom, 'tspan', 'id', 'line%d' % (i+1))
node.appendChild(dom.createTextNode(lines[i]))
- hmm=dom.toxml()
- print dir(hmm)
- svg_to_pdf_png(basename=outfile,xmlstring=dom.toxml())
- svgfile=outfile+'.svg'
+ svg_to_pdf_png(basename=outfile, xmlstring=dom.toxml())
+ svgfile = outfile+'.svg'
out = file(svgfile, "w")
out.write(dom.toxml())
out.close()