def main(): # first on console: d = console.textprinter() doit(d) # now on the printer: if console.confirm("print it on your default Windows printer?"): d = Win32PrinterDocument() doit(d) # and now on a PDF document: filename = "test.pdf" if console.confirm("start Acrobat Reader on %s?" % filename): d = PdfDocument(filename) doit(d) os.system("start " + filename)
def main(): # first on console: d = console.textprinter() doit(d) # now on the printer: if console.confirm( "print it on your default Windows printer?"): d = Win32PrinterDocument() doit(d) # and now on a PDF document: filename = "test.pdf" if console.confirm("start Acrobat Reader on %s?" % filename): d = PdfDocument(filename) doit(d) os.system("start "+filename)
def wmm2html(srcdir, files=None, outdir=None, force=False): """convert a complete module to static html """ # if outdir is None: outdir = srcdir site = Site(srcdir) site.init() node2html(site.root, outdir, force) if console.confirm("Show output?", default="n"): import webbrowser webbrowser.open(os.path.join(outdir, 'index.html'), new=True)
def wmm2html(srcdir, files=None, outdir=None, force=False): """convert a complete module to static html """ # if outdir is None: outdir = srcdir site = Site(srcdir) site.init() node2html(site.root,outdir,force) if console.confirm("Show output?",default="n"): import webbrowser webbrowser.open(os.path.join(outdir,'index.html'),new=True)
def main(argv): console.copyleft(name="Lino/makelc",years='2002-2005') parser = console.getOptionParser( usage="usage: %prog [options] DIR1 [DIR2 ...]", description="""\ where DIR1 DIR2... are the root directories to be processed. Subdirectories of these directories will automatically be processed. """) (options, args) = parser.parse_args(argv) if len(args) == 0: parser.print_help() return -1 collector = Collector() for DIR in args: collect_upper(DIR,collector) if len(collector) > 0: if console.confirm( \ "Okay to rename %d directories or files [Yn]?" % \ len(collector)): for (o,n) in collector.filenames: os.rename(o,n) console.info("%d files renamed" % \ len(collector.filenames)) for (o,n) in collector.dirnames: os.rename(o,n) console.info("%d directories renamed" % \ len(collector.dirnames))
def main(argv): console.copyleft(name="Lino/makelc", years='2002-2005') parser = console.getOptionParser( usage="usage: %prog [options] DIR1 [DIR2 ...]", description="""\ where DIR1 DIR2... are the root directories to be processed. Subdirectories of these directories will automatically be processed. """) (options, args) = parser.parse_args(argv) if len(args) == 0: parser.print_help() return -1 collector = Collector() for DIR in args: collect_upper(DIR, collector) if len(collector) > 0: if console.confirm( \ "Okay to rename %d directories or files [Yn]?" % \ len(collector)): for (o, n) in collector.filenames: os.rename(o, n) console.info("%d files renamed" % \ len(collector.filenames)) for (o, n) in collector.dirnames: os.rename(o, n) console.info("%d directories renamed" % \ len(collector.dirnames))
assert len(l) == 2 assert l[0] == "mailto" #assert arg.startswith("mailto:") subject = None body = None l = l[1].split("?", 2) assert len(l) >= 1 to = urllib.unquote(l[0]) if len(l) == 2: l = l[1].split('&') for i in l: name, value = i.split('=') if name.lower() == 'subject': subject = urllib.unquote(value.strip()) elif name.lower() == 'body': body = urllib.unquote(value.strip()) args = 'to=%s' % to if subject: args += ',subject=%s' % subject if body: body = body.replace('\n', '\\n') body = body.replace('"', '\\"') args += ',body=%s' % body cmd = mozilla + ' -compose "%s"' % args print cmd if not confirm("okay"): raise "not ok" os.system(cmd)