-
Notifications
You must be signed in to change notification settings - Fork 4
/
eaf_pyqterm_buffer.py
36 lines (26 loc) · 1.09 KB
/
eaf_pyqterm_buffer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (C) 2023 by Mumulhl <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import os
import shlex
import sys
from core.buffer import Buffer
sys.path.append(os.path.dirname(__file__))
from eaf_pyqterm_frontend import FrontendWidget
class AppBuffer(Buffer):
def __init__(self, buffer_id, url, arguments):
super().__init__(buffer_id, url, arguments, False)
arguments_dict = json.loads(arguments)
argv = shlex.split(arguments_dict["command"])
start_directory = arguments_dict["directory"]
term = FrontendWidget(argv, start_directory)
term.buffer_id = buffer_id
term.change_title = self.change_title
term.backend.close_buffer = self.close_buffer
term.send_input_message = self.send_input_message
self.resize_view = term.resize_view
self.fetch_marker_callback = term.fetch_marker_callback
self.handle_input_response = term.handle_input_response
self.cancel_input_response = term.cancel_input_response
self.add_widget(term)
self.build_all_methods(term)