# Short description of this Python module.
#
# Longer description of this module with details about what it does.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import abc
from typing import Optional
from fortrace.core.qemu_monitor import QEMUMonitorSession
from fortrace.utility.applications.application import (
ApplicationType,
GenericApplication,
ParentNotifier,
)
from fortrace.utility.distribution_constants import ShellType
[docs]
class GenericTerminal(GenericApplication, abc.ABC):
"""Representation of a generic graphical terminal application."""
def __init__(
self,
name: str,
qs: QEMUMonitorSession,
parent_notifier: ParentNotifier,
shell_type: ShellType,
):
super().__init__(name, ApplicationType.TERMINAL, qs, parent_notifier)
self._shell_type = shell_type
[docs]
@abc.abstractmethod
def send_command(
self, command: str, get_output: bool = False, **kwargs
) -> Optional[list[str]]:
"""Send a command to the terminal.
Args:
command: command to be entered
get_output: whether the output should be returned (might be computational expensive)
**kwargs: can be relevant for Linux terminals
Returns:
Optionally, if get_output is set the (OCR-ed) output of the command
"""
pass
[docs]
def toggle_command_history(self):
pass