##// END OF EJS Templates
ipipe patch 5 from Walter Doerwald, featuring:...
ipipe patch 5 from Walter Doerwald, featuring: Change the way padding is done in ibrowse: Instead of creating a string long enough to fill the rest of the colum even if this column is much to long for the screen, only create a pad string large enough for the visible part. This speeds up scrolling with very long columns. Implement a workaround for eval() not accepting non-dicts as namespaces. (Patch contributed by Torsten Marek) xiter() now directly supports dictproxies, so e.g. "int.__dict__ | ibrowse" works. xrepr() has been rewritten as a generator (and all __xrepr__() methods too): This has two advantages: 1) xrepr() of large datastructure are usable now, because the generator is abandoned after "enough" output has been generated (defaults to 200 characters). 2) xrepr() methods can now return styles for each part of their output. xrepr() is used everywhere now: in the header and footer (like before) but also in the table cells. For this two new xrepr() modes habe been added: "cell" for an object in a ibrowse table cell and "default" which must be used as the mode in recursive calls to xrepr() (this returns a representation that has the most similarity to a normal repr()). Removed the special treatment of lists and tuples in xattrs(). If you want to see the list or tuple simply enter it. This is again done to keep ibrowse useable even with large data structures. Add a class List as a replacement for the old functionality (icsv needs this).

File last commit:

r0:6f629fcc
r225:a1ae16ad
Show More
win32_manual_post_install.py
130 lines | 4.4 KiB | text/x-python | PythonLexer
/ win32_manual_post_install.py
#!python
"""Windows-specific part of the installation"""
import os, sys
try:
import shutil,pythoncom
from win32com.shell import shell
import _winreg as wreg
except ImportError:
print """
You seem to be missing the PythonWin extensions necessary for automatic
installation. You can get them (free) from
http://starship.python.net/crew/mhammond/
Please see the manual for details if you want to finish the installation by
hand, or get PythonWin and repeat the procedure.
Press <Enter> to exit this installer."""
raw_input()
sys.exit()
def make_shortcut(fname,target,args='',start_in='',comment='',icon=None):
"""Make a Windows shortcut (.lnk) file.
make_shortcut(fname,target,args='',start_in='',comment='',icon=None)
Arguments:
fname - name of the final shortcut file (include the .lnk)
target - what the shortcut will point to
args - additional arguments to pass to the target program
start_in - directory where the target command will be called
comment - for the popup tooltips
icon - optional icon file. This must be a tuple of the type
(icon_file,index), where index is the index of the icon you want
in the file. For single .ico files, index=0, but for icon libraries
contained in a single file it can be >0.
"""
shortcut = pythoncom.CoCreateInstance(
shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink
)
shortcut.SetPath(target)
shortcut.SetArguments(args)
shortcut.SetWorkingDirectory(start_in)
shortcut.SetDescription(comment)
if icon:
shortcut.SetIconLocation(*icon)
shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(fname,0)
def run(wait=0):
# Find where the Start Menu and My Documents are on the filesystem
key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
r'Software\Microsoft\Windows\CurrentVersion'
r'\Explorer\Shell Folders')
programs_dir = wreg.QueryValueEx(key,'Programs')[0]
my_documents_dir = wreg.QueryValueEx(key,'Personal')[0]
key.Close()
# Find where the 'program files' directory is
key = wreg.OpenKey(wreg.HKEY_LOCAL_MACHINE,
r'SOFTWARE\Microsoft\Windows\CurrentVersion')
program_files_dir = wreg.QueryValueEx(key,'ProgramFilesDir')[0]
key.Close()
# File and directory names
ip_dir = program_files_dir + '\\IPython'
ip_prog_dir = programs_dir + '\\IPython'
doc_dir = ip_dir+'\\doc'
ip_filename = ip_dir+'\\IPython_shell.py'
pycon_icon = doc_dir+'\\pycon.ico'
if not os.path.isdir(ip_dir):
os.mkdir(ip_dir)
# Copy startup script and documentation
shutil.copy(sys.prefix+'\\Scripts\\ipython',ip_filename)
if os.path.isdir(doc_dir):
shutil.rmtree(doc_dir)
shutil.copytree('doc',doc_dir)
# make shortcuts for IPython, html and pdf docs.
print 'Making entries for IPython in Start Menu...',
# Create shortcuts in Programs\IPython:
if not os.path.isdir(ip_prog_dir):
os.mkdir(ip_prog_dir)
os.chdir(ip_prog_dir)
man_pdf = doc_dir + '\\manual.pdf'
man_htm = doc_dir + '\\manual\\manual.html'
make_shortcut('IPython.lnk',sys.executable, '"%s"' % ip_filename,
my_documents_dir,
'IPython - Enhanced python command line interpreter',
(pycon_icon,0))
make_shortcut('pysh.lnk',sys.executable, '"%s" -p pysh' % ip_filename,
my_documents_dir,
'pysh - a system shell with Python syntax (IPython based)',
(pycon_icon,0))
make_shortcut('Manual in HTML format.lnk',man_htm,'','',
'IPython Manual - HTML format')
make_shortcut('Manual in PDF format.lnk',man_pdf,'','',
'IPython Manual - PDF format')
print """Done.
I created the directory %s. There you will find the
IPython startup script and manuals.
An IPython menu was also created in your Start Menu, with entries for
IPython itself and the manual in HTML and PDF formats.
For reading PDF documents you need the freely available Adobe Acrobat
Reader. If you don't have it, you can download it from:
http://www.adobe.com/products/acrobat/readstep2.html
""" % ip_dir
if wait:
print "Finished with IPython installation. Press Enter to exit this installer.",
raw_input()
if __name__ == '__main__':
run()