Skip to content

Commit

Permalink
Merge pull request #135 from robertoetcheverryr/master
Browse files Browse the repository at this point in the history
Added putty_paste_style_source_clipboard
  • Loading branch information
mattrose authored Jun 19, 2020
2 parents 30d9cbd + c8db3e3 commit 480bc47
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
1 change: 1 addition & 0 deletions terminatorlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
'title_use_system_font' : True,
'title_font' : 'Sans 9',
'putty_paste_style' : False,
'putty_paste_style_source_clipboard': False,
'smart_copy' : True,
},
'keybindings': {
Expand Down
53 changes: 46 additions & 7 deletions terminatorlib/preferences.glade
Original file line number Diff line number Diff line change
@@ -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">
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
13 changes: 13 additions & 0 deletions terminatorlib/prefseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ def set_values(self):
# 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'])
Expand Down Expand Up @@ -771,6 +777,13 @@ def on_putty_paste_style_toggled(self, widget):
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()
Expand Down
2 changes: 1 addition & 1 deletion terminatorlib/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def on_buttonpress(self, widget, event):

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)]
Expand Down

0 comments on commit 480bc47

Please sign in to comment.