add config entry and preferences GUI

This commit is contained in:
Matt Rose 2020-10-19 17:14:40 -04:00
parent 657c45abb7
commit 1822d6ccb1
4 changed files with 46 additions and 8 deletions

View File

@ -121,6 +121,7 @@ DEFAULTS = {
'putty_paste_style' : False, 'putty_paste_style' : False,
'putty_paste_style_source_clipboard': False, 'putty_paste_style_source_clipboard': False,
'smart_copy' : True, 'smart_copy' : True,
'clear_select_on_copy' : False,
'line_height' : 1.0, 'line_height' : 1.0,
}, },
'keybindings': { 'keybindings': {

View File

@ -605,7 +605,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">2</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
@ -638,7 +638,7 @@
</child> </child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
@ -673,7 +673,6 @@
<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">3</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -754,7 +753,7 @@
<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">3</property> <property name="width">4</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -770,7 +769,7 @@
<signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/> <signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
</packing> </packing>
</child> </child>
@ -788,10 +787,43 @@
<signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/> <signal name="toggled" handler="on_putty_paste_style_source_clipboard_toggled" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left_attach">2</property> <property name="left_attach">3</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton">
<property name="label" translatable="yes">Clear selection on copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_clear_select_on_copy_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -824,6 +824,11 @@ class PrefsEditor:
self.config['smart_copy'] = widget.get_active() self.config['smart_copy'] = widget.get_active()
self.config.save() self.config.save()
def on_clear_select_on_copy_toggled(self,widget):
"""Clear selection on smart copy"""
self.config['clear_select_on_copy'] = widget.get_active()
self.config.save()
def on_cursor_blink_toggled(self, widget): def on_cursor_blink_toggled(self, widget):
"""Cursor blink setting changed""" """Cursor blink setting changed"""
self.config['cursor_blink'] = widget.get_active() self.config['cursor_blink'] = widget.get_active()

View File

@ -1773,7 +1773,7 @@ class Terminal(Gtk.VBox):
def key_copy(self): def key_copy(self):
self.vte.copy_clipboard() self.vte.copy_clipboard()
if self.config['smart_copy']: if self.config['clear_select_on_copy']:
self.vte.unselect_all() self.vte.unselect_all()
def key_paste(self): def key_paste(self):