From 13e7470f480a8988b0c166d9c5af90a51eb647ec Mon Sep 17 00:00:00 2001 From: "R. Richard" Date: Thu, 20 Jun 2019 16:04:21 +0200 Subject: [PATCH] Separate event handlers from independent components --- lib/tfw/builtins/__init__.py | 10 ++++++++++ .../directory_monitoring_event_handler.py | 0 .../directory_snapshotting_event_handler.py | 0 .../frontend_event_handler.py | 3 +-- .../fsm_managing_event_handler.py | 0 .../ide_event_handler.py | 3 +-- .../log_monitoring_event_handler.py | 0 .../pipe_io_event_handler.py | 3 +-- .../process_managing_event_handler.py | 0 .../terminal_event_handler.py | 0 lib/tfw/components/__init__.py | 17 ++++------------- lib/tfw/components/file_manager/__init__.py | 1 + .../file_manager.py | 0 .../test_file_manager.py | 0 .../components/ide_event_handler/__init__.py | 1 - 15 files changed, 18 insertions(+), 20 deletions(-) create mode 100644 lib/tfw/builtins/__init__.py rename lib/tfw/{components => builtins}/directory_monitoring_event_handler.py (100%) rename lib/tfw/{components => builtins}/directory_snapshotting_event_handler.py (100%) rename lib/tfw/{components => builtins}/frontend_event_handler.py (96%) rename lib/tfw/{components => builtins}/fsm_managing_event_handler.py (100%) rename lib/tfw/{components/ide_event_handler => builtins}/ide_event_handler.py (99%) rename lib/tfw/{components => builtins}/log_monitoring_event_handler.py (100%) rename lib/tfw/{components => builtins}/pipe_io_event_handler.py (98%) rename lib/tfw/{components => builtins}/process_managing_event_handler.py (100%) rename lib/tfw/{components => builtins}/terminal_event_handler.py (100%) create mode 100644 lib/tfw/components/file_manager/__init__.py rename lib/tfw/components/{ide_event_handler => file_manager}/file_manager.py (100%) rename lib/tfw/components/{ide_event_handler => file_manager}/test_file_manager.py (100%) delete mode 100644 lib/tfw/components/ide_event_handler/__init__.py diff --git a/lib/tfw/builtins/__init__.py b/lib/tfw/builtins/__init__.py new file mode 100644 index 0000000..7e94f10 --- /dev/null +++ b/lib/tfw/builtins/__init__.py @@ -0,0 +1,10 @@ +from .directory_monitoring_event_handler import DirectoryMonitoringEventHandler +from .directory_snapshotting_event_handler import DirectorySnapshottingEventHandler +from .frontend_event_handler import FrontendEventHandler +from .fsm_managing_event_handler import FSMManagingEventHandler +from .ide_event_handler import IdeEventHandler +from .log_monitoring_event_handler import LogMonitoringEventHandler +from .pipe_io_event_handler import PipeIOEventHandlerBase, PipeIOEventHandler, PipeIOServer +from .pipe_io_event_handler import TransformerPipeIOEventHandler, CommandEventHandler +from .process_managing_event_handler import ProcessManagingEventHandler +from .terminal_event_handler import TerminalEventHandler diff --git a/lib/tfw/components/directory_monitoring_event_handler.py b/lib/tfw/builtins/directory_monitoring_event_handler.py similarity index 100% rename from lib/tfw/components/directory_monitoring_event_handler.py rename to lib/tfw/builtins/directory_monitoring_event_handler.py diff --git a/lib/tfw/components/directory_snapshotting_event_handler.py b/lib/tfw/builtins/directory_snapshotting_event_handler.py similarity index 100% rename from lib/tfw/components/directory_snapshotting_event_handler.py rename to lib/tfw/builtins/directory_snapshotting_event_handler.py diff --git a/lib/tfw/components/frontend_event_handler.py b/lib/tfw/builtins/frontend_event_handler.py similarity index 96% rename from lib/tfw/components/frontend_event_handler.py rename to lib/tfw/builtins/frontend_event_handler.py index 1a76abe..b372023 100644 --- a/lib/tfw/components/frontend_event_handler.py +++ b/lib/tfw/builtins/frontend_event_handler.py @@ -1,10 +1,9 @@ from abc import ABC, abstractmethod from contextlib import suppress +from tfw.components.message_sender import MessageSender from tfw.event_handlers import FrontendEventHandlerBase -from .message_sender import MessageSender - class FrontendEventHandler(FrontendEventHandlerBase): def __init__(self): diff --git a/lib/tfw/components/fsm_managing_event_handler.py b/lib/tfw/builtins/fsm_managing_event_handler.py similarity index 100% rename from lib/tfw/components/fsm_managing_event_handler.py rename to lib/tfw/builtins/fsm_managing_event_handler.py diff --git a/lib/tfw/components/ide_event_handler/ide_event_handler.py b/lib/tfw/builtins/ide_event_handler.py similarity index 99% rename from lib/tfw/components/ide_event_handler/ide_event_handler.py rename to lib/tfw/builtins/ide_event_handler.py index 218d3ed..e91213b 100644 --- a/lib/tfw/components/ide_event_handler/ide_event_handler.py +++ b/lib/tfw/builtins/ide_event_handler.py @@ -9,10 +9,9 @@ from typing import Iterable from tfw.event_handlers import FrontendEventHandlerBase from tfw.mixins.monitor_manager_mixin import MonitorManagerMixin +from tfw.components import FileManager from tfw.components.directory_monitor import DirectoryMonitor -from .file_manager import FileManager - LOG = logging.getLogger(__name__) diff --git a/lib/tfw/components/log_monitoring_event_handler.py b/lib/tfw/builtins/log_monitoring_event_handler.py similarity index 100% rename from lib/tfw/components/log_monitoring_event_handler.py rename to lib/tfw/builtins/log_monitoring_event_handler.py diff --git a/lib/tfw/components/pipe_io_event_handler.py b/lib/tfw/builtins/pipe_io_event_handler.py similarity index 98% rename from lib/tfw/components/pipe_io_event_handler.py rename to lib/tfw/builtins/pipe_io_event_handler.py index da3e726..9ab4db5 100644 --- a/lib/tfw/components/pipe_io_event_handler.py +++ b/lib/tfw/builtins/pipe_io_event_handler.py @@ -11,8 +11,7 @@ from threading import Thread from contextlib import suppress from tfw.event_handlers import EventHandlerBase - -from .pipe_io_server import PipeIOServer, terminate_process_on_failure +from tfw.components.pipe_io_server import PipeIOServer, terminate_process_on_failure LOG = logging.getLogger(__name__) DEFAULT_PERMISSIONS = 0o600 diff --git a/lib/tfw/components/process_managing_event_handler.py b/lib/tfw/builtins/process_managing_event_handler.py similarity index 100% rename from lib/tfw/components/process_managing_event_handler.py rename to lib/tfw/builtins/process_managing_event_handler.py diff --git a/lib/tfw/components/terminal_event_handler.py b/lib/tfw/builtins/terminal_event_handler.py similarity index 100% rename from lib/tfw/components/terminal_event_handler.py rename to lib/tfw/builtins/terminal_event_handler.py diff --git a/lib/tfw/components/__init__.py b/lib/tfw/components/__init__.py index b955ad8..60bd615 100644 --- a/lib/tfw/components/__init__.py +++ b/lib/tfw/components/__init__.py @@ -1,18 +1,9 @@ # Copyright (C) 2018 Avatao.com Innovative Learning Kft. # All Rights Reserved. See LICENSE file for details. -from .directory_monitoring_event_handler import DirectoryMonitoringEventHandler -from .process_managing_event_handler import ProcessManagingEventHandler -from .terminal_event_handler import TerminalEventHandler -from .ide_event_handler import IdeEventHandler -from .history_monitor import HistoryMonitor, BashMonitor, GDBMonitor -from .terminal_commands import TerminalCommands -from .log_monitoring_event_handler import LogMonitoringEventHandler -from .fsm_managing_event_handler import FSMManagingEventHandler -from .snapshot_provider import SnapshotProvider -from .pipe_io_event_handler import PipeIOEventHandlerBase, PipeIOEventHandler, PipeIOServer -from .pipe_io_event_handler import TransformerPipeIOEventHandler, CommandEventHandler -from .directory_snapshotting_event_handler import DirectorySnapshottingEventHandler from .commands_equal import CommandsEqual -from .frontend_event_handler import FrontendEventHandler +from .file_manager import FileManager +from .history_monitor import HistoryMonitor, BashMonitor, GDBMonitor from .message_sender import MessageSender +from .snapshot_provider import SnapshotProvider +from .terminal_commands import TerminalCommands diff --git a/lib/tfw/components/file_manager/__init__.py b/lib/tfw/components/file_manager/__init__.py new file mode 100644 index 0000000..1a24998 --- /dev/null +++ b/lib/tfw/components/file_manager/__init__.py @@ -0,0 +1 @@ +from .file_manager import FileManager diff --git a/lib/tfw/components/ide_event_handler/file_manager.py b/lib/tfw/components/file_manager/file_manager.py similarity index 100% rename from lib/tfw/components/ide_event_handler/file_manager.py rename to lib/tfw/components/file_manager/file_manager.py diff --git a/lib/tfw/components/ide_event_handler/test_file_manager.py b/lib/tfw/components/file_manager/test_file_manager.py similarity index 100% rename from lib/tfw/components/ide_event_handler/test_file_manager.py rename to lib/tfw/components/file_manager/test_file_manager.py diff --git a/lib/tfw/components/ide_event_handler/__init__.py b/lib/tfw/components/ide_event_handler/__init__.py deleted file mode 100644 index d597b12..0000000 --- a/lib/tfw/components/ide_event_handler/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .ide_event_handler import IdeEventHandler