From c8db3e38aa75844c0917da8f7831a4425ea23a29 Mon Sep 17 00:00:00 2001 From: robertoetcheverryr Date: Fri, 19 Jun 2020 02:15:13 -0300 Subject: [PATCH] Added putty_paste_style_source_clipboard --- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 53 ++++++++++++++++++++++++++++----- terminatorlib/prefseditor.py | 13 ++++++++ terminatorlib/terminal.py | 2 +- 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 1806677d..d161d560 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -117,6 +117,7 @@ DEFAULTS = { 'title_use_system_font' : True, 'title_font' : 'Sans 9', 'putty_paste_style' : False, + 'putty_paste_style_source_clipboard': False, 'smart_copy' : True, }, 'keybindings': { diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 56f1f961..d24f4f50 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1,5 +1,5 @@ - + @@ -359,6 +359,9 @@ Terminator Preferences 640 400 + + + True @@ -595,6 +598,7 @@ 1 0 + 2 @@ -627,11 +631,12 @@ 1 1 + 2 - PuTTY style paste + PuTTY style paste: False True True @@ -643,7 +648,6 @@ 0 2 - 2 @@ -660,7 +664,7 @@ 0 3 - 2 + 3 @@ -677,7 +681,7 @@ 0 4 - 2 + 3 @@ -694,7 +698,7 @@ 0 5 - 2 + 3 @@ -741,7 +745,42 @@ 0 6 - 2 + 3 + + + + + PRIMARY + False + True + True + False + 0.5 + True + True + + + + 1 + 2 + + + + + Clipboard + False + True + True + False + 0.5 + True + True + putty_paste_style_source_primary_radiobutton + + + + 2 + 2 diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 405b6afb..cddc09f3 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -319,6 +319,12 @@ class PrefsEditor: # Putty paste style widget = guiget('putty_paste_style') widget.set_active(self.config['putty_paste_style']) + # Putty paste style source clipboard + if self.config['putty_paste_style_source_clipboard']: + widget = guiget('putty_paste_style_source_clipboard_radiobutton') + else: + widget = guiget('putty_paste_style_source_primary_radiobutton') + widget.set_active(True) # Smart copy widget = guiget('smart_copy') widget.set_active(self.config['smart_copy']) @@ -771,6 +777,13 @@ class PrefsEditor: self.config['putty_paste_style'] = widget.get_active() self.config.save() + def on_putty_paste_style_source_clipboard_toggled(self, widget): + """PuTTY paste style source changed""" + guiget = self.builder.get_object + clipboardwidget = guiget('putty_paste_style_source_clipboard_radiobutton') + self.config['putty_paste_style_source_clipboard'] = clipboardwidget.get_active() + self.config.save() + def on_smart_copy_toggled(self, widget): """Putty paste style setting changed""" self.config['smart_copy'] = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index ce07b4cf..f806c50c 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -947,7 +947,7 @@ class Terminal(Gtk.VBox): if self.config['putty_paste_style']: middle_click = [self.popup_menu, (widget, event)] - right_click = [self.paste_clipboard, (True, )] + right_click = [self.paste_clipboard, (not self.config['putty_paste_style_source_clipboard'], )] else: middle_click = [self.paste_clipboard, (True, )] right_click = [self.popup_menu, (widget, event)]