summaryrefslogtreecommitdiffstats
path: root/fedora_business_cards
diff options
context:
space:
mode:
authorIan Weller <ianweller@gmail.com>2008-10-06 21:08:32 -0500
committerIan Weller <ianweller@gmail.com>2008-10-06 21:08:32 -0500
commit05d8e7d7b1c485078b98e4aa8043f803965670a6 (patch)
tree437802d935666d02339c0eeb9b1ca1a20d2f4a10 /fedora_business_cards
parentaf022f88c9e5ad8a8973475d1d78aae60ca892a0 (diff)
downloadfedora-business-cards-05d8e7d7b1c485078b98e4aa8043f803965670a6.tar.gz
fedora-business-cards-05d8e7d7b1c485078b98e4aa8043f803965670a6.tar.xz
fedora-business-cards-05d8e7d7b1c485078b98e4aa8043f803965670a6.zip
Comply to PEP 8, make pylint happier
Diffstat (limited to 'fedora_business_cards')
-rw-r--r--fedora_business_cards/__init__.py4
-rw-r--r--fedora_business_cards/export.py23
-rw-r--r--fedora_business_cards/frontend.py10
3 files changed, 21 insertions, 16 deletions
diff --git a/fedora_business_cards/__init__.py b/fedora_business_cards/__init__.py
index 07a90f4..3546a94 100644
--- a/fedora_business_cards/__init__.py
+++ b/fedora_business_cards/__init__.py
@@ -19,8 +19,8 @@
"""
The Fedora business cards generator will generate business cards for Fedora
-contributors. It connects to FAS to retrieve user information and lays it out on
-a SVG, then exports that to a PDF and PNG. Different templates are/will be
+contributors. It connects to FAS to retrieve user information and lays it out
+on a SVG, then exports that to a PDF and PNG. Different templates are/will be
available for different business card sizes, or different requirements by
different companies.
"""
diff --git a/fedora_business_cards/export.py b/fedora_business_cards/export.py
index 655ccc6..baff368 100644
--- a/fedora_business_cards/export.py
+++ b/fedora_business_cards/export.py
@@ -28,11 +28,12 @@ def svg_to_file(xmlstring, filename):
"""
Write an SVG to a file.
"""
- f = file(filename, 'w')
- f.write(xmlstring.encode('utf-8'))
- f.close()
+ handle = file(filename, 'w')
+ handle.write(xmlstring.encode('utf-8'))
+ handle.close()
return True
+
def svg_to_pdf_png(xmlstring, filename, format='png', dpi=300):
"""
Export an SVG to either a PDF or PNG.
@@ -44,16 +45,16 @@ def svg_to_pdf_png(xmlstring, filename, format='png', dpi=300):
stdin = xmlstring.encode('utf-8')
command = ['inkscape', '-C -z -d', str(dpi), '-e', filename, '/dev/stdin']
if format == 'png':
- sp = subprocess.Popen(' '.join(command), shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- sp.communicate(stdin)
+ proc = subprocess.Popen(' '.join(command), shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc.communicate(stdin)
elif format == 'pdf':
command[3] = '-A'
- sp = subprocess.Popen(' '.join(command), shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- sp.communicate(stdin)
+ proc = subprocess.Popen(' '.join(command), shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc.communicate(stdin)
else:
raise Exception("Invalid file format requested")
return True
diff --git a/fedora_business_cards/frontend.py b/fedora_business_cards/frontend.py
index 5306e69..bb7764f 100644
--- a/fedora_business_cards/frontend.py
+++ b/fedora_business_cards/frontend.py
@@ -35,6 +35,9 @@ import export
def cmdline_card_line(data):
+ """
+ Print a line of the business card for the cmdline frontend.
+ """
return "| %s%s |" % (data, ' '*(59-len(data)))
@@ -49,8 +52,8 @@ def cmdline():
parser.add_option("-d", "--dpi", dest="dpi", default=300, type="int",
help="DPI of exported file")
parser.add_option("-t", "--template", dest="template",
- default="northamerica", help="Name of template to use, "+\
- "run with --list-templates to see a list")
+ default="northamerica", help="Name of template to use,"+\
+ " run with --list-templates to see a list")
parser.add_option("--list-templates", action="store_true", default=False,
dest="listtemplates", help="List available templates")
parser.add_option("-u", "--username", dest="username", default="",
@@ -98,7 +101,8 @@ def cmdline():
password = getpass()
if options.username == "":
options.username = username
- infodict = information.get_information(username, password, options.username)
+ infodict = information.get_information(username, password,
+ options.username)
# setup default content
name = infodict['name']
title = infodict['title']