1
from gourmet.gtk_extras import dialog_extras as de
4
from gettext import gettext as _
7
def __init__ (self, rd, recs, mult=1, dialog_title=_("Print Recipes"),
8
dialog_parent=None, change_units=True):
9
command = self.get_command(label='Enter print command',
10
sublabel='Please enter the command you would like to use to print.',
12
# TO TEST LOUSY COMMAND-ENTERING CODE, UNCOMMENT THE FOLLOWING
14
while os.system('which %s'%command.split()[0]) != 0:
15
label = _("Enter print command")
16
sublabel = _("Unable to find command \"%s\".")%command
17
sublabel += _('Please enter the command you would like to use to print.')
18
command=self.get_command(label=_('Enter print command'),
20
lpr = os.popen(command,'w')
22
label=_('Printing via %s')%command,
23
sublabel=_('If you install python-gnome, you will be able to print with a much more attractive interface.'))
25
exporter.exporter_mult(rd, r, out=lpr,mult=mult,change_units=change_units)
28
def get_command (self, label="",sublabel="",default_value=None):
29
cmd = de.getEntry(label=label,
31
entryLabel=_('Command:'),
32
default_value=default_value)
33
if not cmd: raise "User cancelled!"
38
def __init__ (self, file=None, dialog_parent=None, show_dialog=True):
40
self.out = open(file,'w')
42
self.out = os.popen('lpr','w')
45
label='Printing via LPR',
46
sublabel='If you install python-gnome, you will be able to print with a much more attractive interface.')
48
def write_header (self, text):
49
self.out.write("%s\n---\n"%text)
51
def write_subheader (self, text):
52
self.out.write("\n\n%s\n---\n"%text)
54
def write_paragraph (self, text):
55
self.out.write("%s\n"%text)