From 3fc1755d8d15766e87a5fe19373cfa6b765bec9e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 16 Oct 2016 20:00:15 +0530 Subject: [PATCH] De-couple write_to_child --- kitty/boss.py | 3 ++- kitty/screen.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 388af1bae..ebf1febac 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -22,7 +22,8 @@ class Boss(QObject): self.write_notifier = QSocketNotifier(create_pty()[0], QSocketNotifier.Write, self) self.write_notifier.setEnabled(False) self.write_notifier.activated.connect(self.write_ready) - self.screen = Screen(opts, self.write_to_child, parent=self) + self.screen = s = Screen(opts, parent=self) + s.write_to_child.connect(self.write_to_child) self.term = TerminalWidget(opts, self.screen.linebuf, parent) self.term.relayout_lines.connect(self.relayout_lines) resize_pty(self.screen.columns, self.screen.lines) diff --git a/kitty/screen.py b/kitty/screen.py index 6fb9a550c..57b9dc744 100644 --- a/kitty/screen.py +++ b/kitty/screen.py @@ -43,11 +43,12 @@ class Screen(QObject): update_line_range = pyqtSignal(object, object) update_cell_range = pyqtSignal(object, object, object) line_added_to_history = pyqtSignal() + write_to_child = pyqtSignal(object) _notify_cursor_position = True - def __init__(self, opts, write_to_child, columns: int=80, lines: int=24, parent=None): + def __init__(self, opts, columns: int=80, lines: int=24, parent=None): QObject.__init__(self, parent) - self.write_process_input = write_to_child + self.write_process_input = self.write_to_child.emit self.savepoints = deque() self.columns = columns self.lines = lines