home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1738 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  3.1 KB  |  71 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import IPython.ipapi as IPython
  5. ip = IPython.ipapi.get()
  6. from IPython.Itpl import itplns
  7. import os
  8.  
  9. def install_editor(run_template, wait = False):
  10.     
  11.     def call_editor(self, file, line = (None, 0)):
  12.         if line is None:
  13.             line = 0
  14.         
  15.         cmd = itplns(run_template, locals())
  16.         print '>', cmd
  17.         if os.system(cmd) != 0:
  18.             raise IPython.ipapi.TryNext()
  19.         os.system(cmd) != 0
  20.         if wait:
  21.             raw_input('Press Enter when done editing:')
  22.         
  23.  
  24.     ip.set_hook('editor', call_editor)
  25.  
  26.  
  27. def komodo(exe = 'komodo'):
  28.     install_editor(exe + ' -l $line "$file"', wait = True)
  29.  
  30.  
  31. def scite(exe = 'scite'):
  32.     install_editor(exe + ' "$file" -goto:$line')
  33.  
  34.  
  35. def notepadplusplus(exe = 'notepad++'):
  36.     install_editor(exe + ' -n$line "$file"')
  37.  
  38.  
  39. def jed(exe = 'jed'):
  40.     install_editor(exe + ' +$line "$file"')
  41.  
  42.  
  43. def idle(exe = None):
  44.     if exe is None:
  45.         import idlelib
  46.         p = os.path.dirname(idlelib.__file__)
  47.         exe = p + '/idle.py'
  48.     
  49.     install_editor(exe + ' "$file"')
  50.  
  51.  
  52. def mate(exe = 'mate'):
  53.     install_editor(exe + ' -w -l $line "$file"')
  54.  
  55.  
  56. def emacs(exe = 'emacs'):
  57.     install_editor(exe + ' +$line "$file"')
  58.  
  59.  
  60. def gnuclient(exe = 'gnuclient'):
  61.     install_editor(exe + ' -nw +$line "$file"')
  62.  
  63.  
  64. def crimson_editor(exe = 'cedt.exe'):
  65.     install_editor(exe + ' /L:$line "$file"')
  66.  
  67.  
  68. def kate(exe = 'kate'):
  69.     install_editor(exe + ' -u -l $line "$file"')
  70.  
  71.