https://github.com/kpalin/EEL
Raw File
Tip revision: c0cd936bedca30564088c8aeb8f43ebe4e05421f authored by Kimmo Palin on 07 November 2012, 13:23:26 UTC
Fixed a variable format clash which sometimes caused core dumps.
Tip revision: c0cd936
eel
#!/usr/bin/env python
# -*- coding: UTF-8 -*- 
        
"""The basic command that starts up the commandline interface"""

from eellib import Commandline
#from Commandline import Commandline
import sys


# $Log$
# Revision 1.7  2005/05/19 07:49:25  kpalin
# Merged Waterman-Eggert style suboptimal alignments and
# SNP matching.
#
# Revision 1.6.2.1  2005/05/19 06:49:50  kpalin
# renamed class eelgui to eelGUI
#
# Revision 1.6  2005/03/22 13:16:30  kpalin
# Cleaner way to parse commandline arguments. Allows negative numerical inputs.
#
# Revision 1.5  2005/01/14 12:51:48  kpalin
# Fixes for TCL/TIX gui in windows
#
# Revision 1.4  2005/01/12 13:34:35  kpalin
# Added Tkinter/Tix Graphical user interface and command -no-gui to
# avoid it.
#
# Revision 1.3  2004/12/22 11:14:16  kpalin
# Some fixes for better distributability
#
# Revision 1.2  2004/12/14 14:06:32  kpalin
# *** empty log message ***
#
# Revision 1.1  2004/12/14 13:07:52  kpalin
#
# Name change from MABS to EEL (Enhancer Element Locator / Monty Python pun
# "My hovercraft is full of EELs" )
#
# Revision 1.5  2004/10/21 12:46:31  kpalin
# Removed reference to a specific version of python (2.2)
#
# Revision 1.4  2004/01/14 10:04:19  kpalin
# Added documentation
#
# Revision 1.3  2004/01/13 07:54:35  kpalin
# Paljon kaiken laista.
#
# setup.py: debug asetukset saa komentoriviltä
#
# Revision 1.2  2003/12/12 12:34:57  kpalin
# Lisättiin loki ja tulostettava ID
#


cl=Commandline.Commandline()

if len(sys.argv)==1:
    try:
        import Tkinter
        from _tkinter import TclError
        try:
            root=Tkinter.Tk()
            root.tk.eval('package require Tix')
            import Tix
            from eellib.eelgui import eelGUI
            o=eelGUI(root)
            o.pack(side=Tkinter.TOP,fill=Tkinter.BOTH,expand=1)
            root.mainloop()
        except TclError,e:
            print "Error importing Tix:",e
            try:
                root.destroy()
            except NameError:
                pass
            raise ImportError()
    except ImportError,e:
        print e
        try:
            cl.run()
        except EOFError:
            pass
else:
    commands=' '.join(sys.argv[1:])
    import re
    commandPat=re.compile(r"\s?-(.+?)(?= -[^0-9.]|$)")
    commands=commandPat.findall(commands)

    error=0
    for c in commands:
        if not cl.isCommand(c.split()[0]):
            print 'unknown argument: -'+c.split()[0]
            error=1

    if error or commands==[]:
        cl.help(['add -'])
    else:
        for c in commands:
            cl.execute(c)
back to top