Logo Search packages:      
Sourcecode: karrigell version File versions  Download package

def PIHapp::run (   event  ) 

Run the script and shows the resulting HTML code in a
new window
If started with the "Make HTML" button, saves HTML output in
a file

Definition at line 169 of file PIHapp.py.

00169               :
    """Run the script and shows the resulting HTML code in a
    new window
    If started with the "Make HTML" button, saves HTML output in
    a file"""
    pythonCode=pythonText.get(1.0,END)
    lines=string.split(pythonCode,'\n')
    lines=map(lambda x:x[5:],lines)
    pythonCode=string.join(lines,'\n')
    execWindow=Toplevel()
    execText=ScrolledText(execWindow,width=40,height=40,bg="white",
        font=FONT)
    execText.pack()
    s=sys.stdout
    sys.stdout=Output(execText)
    try:
        exec(pythonCode) in globals()
        if event.widget is bRunHTML:
            htmlFilename=os.path.splitext(pihText.filename)[0]+".htm"
            if os.path.exists(htmlFilename):
                override=tkMessageBox.askyesno("Override ?",
                    "File %s already exists - Override ?" \
                    %os.path.basename(htmlFilename))
                if not override:
                    return
            f=open(htmlFilename,"w")
            f.write(execText.get(1.0,END))
            f.close()
            path=os.path.join(os.getcwd(),htmlFilename)
            webbrowser.open_new("file://"+path)
    except:
        traceback.print_exc(file=sys.stdout)
    sys.stdout=s

pyChunkRE=re.compile("<%.*?%>",re.DOTALL)

# python syntax
# copied from the python.syn file for TextPad
pySyntax={}
pySyntax["py0"]=['and', 'del', 'for', 'is', 'raise', 'assert', 'elif', 'from', 'lambda', 
    'return', 'break', 'else', 'global', 'not', 'try', 'class', 'except', 
    'if', 'or', 'while', 'continue', 'exec', 'import', 'pass', 'def', 
    'finally', 'in', 'print']
pySyntax["py1"]=['__init__', '__repr__', '__del__', '__doc__', '__dict__']
pySyntax["py2"]=['abs', 'int', 'long', 'float', 'complex', 'conjugate', 'divmod', 'pow', 
    'len', 'min', 'max', 'append', 'extend', 'count', 'index', 'insert', 'pop', 
    'remove', 'reverse', 'sort', 'clear', 'copy', 'has_key', 'items', 'keys', 
    'update', 'values', 'get', 'close', 'flush', 'isatty', 'ArithmeticError', 
    'AssertionError', 'AttributeError', 'EOFError', 'Ellipsis', 'EnvironmentError', 
    'Exception', 'FloatingPointError', 'IOError', 'ImportError', 'IndexError', 
    'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 
    'None', 'NotImplementedError', 'OSError', 'OverflowError', 'RuntimeError', 
    'StandardError', 'SyntaxError', 'SystemError', 'SystemExit', 'TypeError', 
    'ValueError', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', 
    '__name__', 'abs', 'apply', 'buffer', 'callable', 'chr', 'cmp', 'coerce', 
    'compile', 'complex', 'delattr', 'dir', 'divmod', 'eval', 'execfile', 'exit', 
    'filter', 'float', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 
    'input', 'int', 'intern', 'isinstance', 'issubclass', 'len', 'list', 'locals', 
    'long', 'map', 'max', 'min', 'oct', 'open', 'ord', 'pow', 'quit', 'range', 
    'raw_input', 'reduce', 'reload', 'repr', 'round', 'setattr', 'slice', 'str', 
    'tuple', 'type', 'vars', 'xrange']
pySyntax["karrigell"]=["HIP","RESPONSE","HEADERS",
    "AUTH_USER","AUTH_PASSWORD","QUERY","SET_COOKIE","ACCEPTED_LANGUAGES",
    "SCRIPT_END","HTTP_ERROR","HTTP_REDIRECTION","SERVER_DIR",
    "Session","Authentication","Include"]
    
# compile regular expression for Python keywords
# used for syntax coloring
pyKwRE={}

for special_name in pySyntax.keys():


Generated by  Doxygen 1.6.0   Back to index