Added putty_paste_style_source_clipboard

This commit is contained in:
robertoetcheverryr 2020-06-19 02:15:13 -03:00
parent 616ed8a7aa
commit c8db3e38aa
4 changed files with 61 additions and 8 deletions

View File

@ -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': {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="BackspaceKeyListStore">
@ -359,6 +359,9 @@
<property name="title" translatable="yes">Terminator Preferences</property>
<property name="default_width">640</property>
<property name="default_height">400</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="dialog_vbox1">
<property name="visible">True</property>
@ -595,6 +598,7 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
@ -627,11 +631,12 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="putty_paste_style">
<property name="label" translatable="yes">PuTTY style paste</property>
<property name="label" translatable="yes">PuTTY style paste:</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -643,7 +648,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
@ -660,7 +664,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
@ -677,7 +681,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
@ -694,7 +698,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="width">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
@ -741,7 +745,42 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="width">2</property>
<property name="width">3</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="putty_paste_style_source_primary_radiobutton">
<property name="label" translatable="yes">PRIMARY</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="putty_paste_style_source_clipboard_radiobutton">
<property name="label" translatable="yes">Clipboard</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">putty_paste_style_source_primary_radiobutton</property>
<signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>

View File

@ -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()

View File

@ -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)]