tagui.py
def close():
    """disconnect from tagui process by sending 'done' trigger instruction"""

    global _process, _tagui_started, _tagui_id, _tagui_visual, _tagui_chrome

    if not _tagui_started:
        print('[TAGUI][ERROR] - use init() before using close()')
        return False

    try:
        # failsafe exit if tagui process gets killed for whatever reason
        if _process.poll() is not None:
            print('[TAGUI][ERROR] - no active TagUI process to close()')
            _tagui_visual = False
            _tagui_chrome = False
            _tagui_started = False
            return False

        # send 'done' instruction to terminate live mode and exit tagui
        _tagui_write('echo "[TAGUI][FINISHED]"\n')
        _tagui_write('done\n')

        # loop until tagui process has closed before returning control
        while _process.poll() is None: pass

        # remove again generated tagui flow, js code and custom functions files
        if os.path.isfile('tagui_python'): os.remove('tagui_python')
        if os.path.isfile('tagui_python.js'): os.remove('tagui_python.js')
        if os.path.isfile('tagui_python.raw'): os.remove('tagui_python.raw')
        if os.path.isfile('tagui_local.js'): os.remove('tagui_local.js')

        # remove generated tagui log and data files if not in debug mode
        if not debug():
            if os.path.isfile('tagui_python.log'): os.remove('tagui_python.log')
            if os.path.isfile('tagui_python.txt'): os.remove('tagui_python.txt')

        _tagui_visual = False
        _tagui_chrome = False
        _tagui_started = False
        return True

    except Exception as e:
        print('[TAGUI][ERROR] - ' + str(e))
        _tagui_visual = False
        _tagui_chrome = False
        _tagui_started = False
        return False
disconnect from tagui process by sending 'done' trigger instruction
disconnect from tagui process by sending 'done' trigger instruction
disconnect from tagui process by sending ' done ' trigger instruction
def close():
    global _process, _tagui_started, _tagui_id, _tagui_visual, _tagui_chrome
    if not _tagui_started:
        print('[TAGUI][ERROR] - use init() before using close()')
        return False
    try:
        if _process.poll() is not None:
            print('[TAGUI][ERROR] - no active TagUI process to close()')
            _tagui_visual = False
            _tagui_chrome = False
            _tagui_started = False
            return False
        _tagui_write('echo "[TAGUI][FINISHED]"\n')
        _tagui_write('done\n')
        while _process.poll() is None: pass
        if os.path.isfile('tagui_python'): os.remove('tagui_python')
        if os.path.isfile('tagui_python.js'): os.remove('tagui_python.js')
        if os.path.isfile('tagui_python.raw'): os.remove('tagui_python.raw')
        if os.path.isfile('tagui_local.js'): os.remove('tagui_local.js')
        if not debug():
            if os.path.isfile('tagui_python.log'): os.remove('tagui_python.log')
            if os.path.isfile('tagui_python.txt'): os.remove('tagui_python.txt')
        _tagui_visual = False
        _tagui_chrome = False
        _tagui_started = False
        return True
    except Exception as e:
        print('[TAGUI][ERROR] - ' + str(e))
        _tagui_visual = False
        _tagui_chrome = False
        _tagui_started = False
        return False
def close ( ) : global _process , _tagui_started , _tagui_id , _tagui_visual , _tagui_chrome if not _tagui_started : print ( '[TAGUI][ERROR] - use init() before using close()' ) return False try : if _process . poll ( ) is not None : print ( '[TAGUI][ERROR] - no active TagUI process to close()' ) _tagui_visual = False _tagui_chrome = False _tagui_started = False return False _tagui_write ( 'echo "[TAGUI][FINISHED]"\n' ) _tagui_write ( 'done\n' ) while _process . poll ( ) is None : pass if os . path . isfile ( 'tagui_python' ) : os . remove ( 'tagui_python' ) if os . path . isfile ( 'tagui_python.js' ) : os . remove ( 'tagui_python.js' ) if os . path . isfile ( 'tagui_python.raw' ) : os . remove ( 'tagui_python.raw' ) if os . path . isfile ( 'tagui_local.js' ) : os . remove ( 'tagui_local.js' ) if not debug ( ) : if os . path . isfile ( 'tagui_python.log' ) : os . remove ( 'tagui_python.log' ) if os . path . isfile ( 'tagui_python.txt' ) : os . remove ( 'tagui_python.txt' ) _tagui_visual = False _tagui_chrome = False _tagui_started = False return True except Exception as e : print ( '[TAGUI][ERROR] - ' + str ( e ) ) _tagui_visual = False _tagui_chrome = False _tagui_started = False return False
disconnect from tagui process by sending 'done' trigger instruction
disconnect from tagui process by sending ' done ' trigger instruction
"""disconnect from tagui process by sending 'done' trigger instruction""" # failsafe exit if tagui process gets killed for whatever reason # send 'done' instruction to terminate live mode and exit tagui # loop until tagui process has closed before returning control # remove again generated tagui flow, js code and custom functions files # remove generated tagui log and data files if not in debug mode