2017-06-21 11:49:16 +00:00
|
|
|
from adapter.implementations.ITerm import ITerm
|
|
|
|
from adapter.implementations.NullAdapter import NullAdapter
|
|
|
|
from adapter.implementations.Terminology import Terminology
|
|
|
|
from adapter.implementations.Tilix import Tilix
|
|
|
|
|
2017-06-21 16:30:28 +00:00
|
|
|
available_terminals = [
|
|
|
|
Terminology,
|
|
|
|
Tilix,
|
|
|
|
ITerm
|
|
|
|
]
|
|
|
|
|
2017-06-21 11:49:16 +00:00
|
|
|
|
|
|
|
def identify():
|
|
|
|
"""
|
|
|
|
Identify the terminal we are using based on env vars.
|
|
|
|
:return: A terminal adapter interface or a NullAdapter.
|
|
|
|
:rtype: TerminalAdapterInterface
|
|
|
|
"""
|
2017-06-21 16:30:28 +00:00
|
|
|
for terminal in available_terminals:
|
|
|
|
if terminal.is_available():
|
|
|
|
return terminal()
|
2017-06-21 11:49:16 +00:00
|
|
|
|
|
|
|
return NullAdapter()
|