Merge pull request #135 from robertoetcheverryr/master

Added putty_paste_style_source_clipboard
This commit is contained in:
Matt Rose 2020-06-19 16:38:31 -04:00 committed by GitHub
commit 480bc47d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 8 deletions

View File

@ -117,6 +117,7 @@ DEFAULTS = {
'title_use_system_font' : True, 'title_use_system_font' : True,
'title_font' : 'Sans 9', 'title_font' : 'Sans 9',
'putty_paste_style' : False, 'putty_paste_style' : False,
'putty_paste_style_source_clipboard': False,
'smart_copy' : True, 'smart_copy' : True,
}, },
'keybindings': { 'keybindings': {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.10"/> <requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="BackspaceKeyListStore"> <object class="GtkListStore" id="BackspaceKeyListStore">
@ -359,6 +359,9 @@
<property name="title" translatable="yes">Terminator Preferences</property> <property name="title" translatable="yes">Terminator Preferences</property>
<property name="default_width">640</property> <property name="default_width">640</property>
<property name="default_height">400</property> <property name="default_height">400</property>
<child>
<placeholder/>
</child>
<child> <child>
<object class="GtkBox" id="dialog_vbox1"> <object class="GtkBox" id="dialog_vbox1">
<property name="visible">True</property> <property name="visible">True</property>
@ -595,6 +598,7 @@
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -627,11 +631,12 @@
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">2</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton" id="putty_paste_style"> <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="use_action_appearance">False</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -643,7 +648,6 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="width">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -660,7 +664,7 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="width">2</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -677,7 +681,7 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">4</property> <property name="top_attach">4</property>
<property name="width">2</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -694,7 +698,7 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">5</property> <property name="top_attach">5</property>
<property name="width">2</property> <property name="width">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -741,7 +745,42 @@
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">6</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> </packing>
</child> </child>
</object> </object>

View File

@ -319,6 +319,12 @@ class PrefsEditor:
# Putty paste style # Putty paste style
widget = guiget('putty_paste_style') widget = guiget('putty_paste_style')
widget.set_active(self.config['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 # Smart copy
widget = guiget('smart_copy') widget = guiget('smart_copy')
widget.set_active(self.config['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['putty_paste_style'] = widget.get_active()
self.config.save() 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): def on_smart_copy_toggled(self, widget):
"""Putty paste style setting changed""" """Putty paste style setting changed"""
self.config['smart_copy'] = widget.get_active() self.config['smart_copy'] = widget.get_active()

View File

@ -947,7 +947,7 @@ class Terminal(Gtk.VBox):
if self.config['putty_paste_style']: if self.config['putty_paste_style']:
middle_click = [self.popup_menu, (widget, event)] 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: else:
middle_click = [self.paste_clipboard, (True, )] middle_click = [self.paste_clipboard, (True, )]
right_click = [self.popup_menu, (widget, event)] right_click = [self.popup_menu, (widget, event)]