Attachment 'makedot.py'

Download

   1 def run(win):
   2     class MOD:pass
   3     
   4     mod = MOD()
   5     
   6     mod.dialog = [
   7     ('savefile', 'imagefile', '', 'Saving image filename:', None),
   8     ('single', 'filetype', 'png', 'Image file type:', [('Gif', 'gif'), ('Png', 'png'), ('Jpeg', 'jpg')]),
   9     ('string', 'args', '', 'Other command line options:', None),
  10     ]
  11     mod.title = 'Input dot command line'
  12     
  13     from modules.EasyGui import EasyCommander
  14     from modules.Debug import error
  15     from modules import common
  16     
  17     easy = EasyCommander.EasyCommander(win, mod, cmdoption='')
  18     if easy.run():
  19         values = easy.GetValue()
  20         import os
  21         try:
  22             cmd = 'dot -T%s -o%s %s %s' % (values['filetype'], common.encode_string(values['imagefile'], common.defaultfilesystemencoding), values['args'], win.document.filename)
  23             os.system(cmd)
  24         except:
  25             error.traceback()
  26             common.showerror(win, tr("Cann't execute [%s]") % cmd)
  27             return
  28         if os.path.exists(values['imagefile']):
  29             from modules import ImageWin
  30             try:
  31                 win = ImageWin.ImageWin(win, values['imagefile'])
  32                 win.Show()
  33             except:
  34                 common.showerror(win, tr("Cann't open image file %s") % values['imagefile'])
  35     
  36 run(win)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2021-05-11 08:52:36, 4.4 KB) [[attachment:html2moin.py]]
  • [get | view] (2021-05-11 08:52:36, 1.3 KB) [[attachment:makedot.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.