Merge in PuTTY paste mode (Nemilya, LP#1416682) with some alterations.

This commit is contained in:
Stephen Boddy 2015-09-30 00:00:04 +02:00
commit 195849a1ca
7 changed files with 62 additions and 12 deletions

View File

@ -13,12 +13,16 @@ terminator trunk:
* remotinator now uses argparse for commandline option handling, * remotinator now uses argparse for commandline option handling,
vastly improving the option handling vastly improving the option handling
* remotinator help strings are translatable now * remotinator help strings are translatable now
* PuTTY paste mode (Nemilya, LP#1416682) with some alterations
(Steve Boddy)
* Bug fixes * Bug fixes
* Fix for those not running IBus, where the IBus workaround caused * Fix for those not running IBus, where the IBus workaround caused
broken keys in other keymaps set with non-IBus tools (Steve broken keys in other keymaps set with non-IBus tools (Steve
Boddy, LP#1494606) Boddy, LP#1494606)
* Fix custom commands to use the standard gerr function instead * Fix custom commands to use the standard gerr function instead
of the broken local one (Steve Boddy) of the broken local one (Steve Boddy)
* Workaround for intltool not handling Python files without an
extension (Steve Boddy)
terminator 0.98: terminator 0.98:
* Features * Features

View File

@ -93,6 +93,12 @@ Behaviour
receive keystrokes. receive keystrokes.
- *None* - Only the current terminal receives keystrokes. - *None* - Only the current terminal receives keystrokes.
**PuTTY style paste** (default: off)
Make the right mouse button operate like in PuTTY, so ``right-click``
will paste the Primary selection, and ``middle-click`` will open
the :ref:`Context Menu <context-menu>`. (For ex-PuTTY users).
**Re-use profiles for new terminals** (default: off) **Re-use profiles for new terminals** (default: off)
When creating a new terminal with splitting or new tabs, if this is When creating a new terminal with splitting or new tabs, if this is

View File

@ -136,6 +136,10 @@ Controls whether splits/tabs will continue to use the profile of their peer term
the default profile. the default profile.
Default value: \fBFalse\fR Default value: \fBFalse\fR
.TP .TP
.B putty_paste_style \fR(boolean)
If set to True, right-click will paste the Primary selection, middle-click will popup the context menu.
Default value: \fBFalse\fR
.TP
.B enabled_plugins .B enabled_plugins
A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two
plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the

View File

@ -121,6 +121,7 @@ DEFAULTS = {
'always_split_with_profile': False, 'always_split_with_profile': False,
'title_use_system_font' : True, 'title_use_system_font' : True,
'title_font' : 'Sans 9', 'title_font' : 'Sans 9',
'putty_paste_style' : False,
}, },
'keybindings': { 'keybindings': {
'zoom_in' : '<Control>plus', 'zoom_in' : '<Control>plus',

View File

@ -547,7 +547,7 @@
<object class="GtkTable" id="table9"> <object class="GtkTable" id="table9">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="n_rows">6</property> <property name="n_rows">7</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">12</property> <property name="column_spacing">12</property>
<property name="row_spacing">6</property> <property name="row_spacing">6</property>
@ -620,6 +620,22 @@
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="putty_paste_style">
<property name="label" translatable="yes">Putty style paste</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_putty_paste_style_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child> <child>
<object class="GtkCheckButton" id="always_split_with_profile"> <object class="GtkCheckButton" id="always_split_with_profile">
<property name="label" translatable="yes">Re-use profiles for new terminals</property> <property name="label" translatable="yes">Re-use profiles for new terminals</property>
@ -633,8 +649,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">3</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -651,8 +667,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -703,8 +719,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>
@ -722,8 +738,8 @@
</object> </object>
<packing> <packing>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">5</property> <property name="top_attach">6</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"/> <property name="y_options"/>
</packing> </packing>

View File

@ -425,6 +425,9 @@ class PrefsEditor:
# Copy on selection # Copy on selection
widget = guiget('copy_on_selection') widget = guiget('copy_on_selection')
widget.set_active(self.config['copy_on_selection']) widget.set_active(self.config['copy_on_selection'])
# Putty paste style
widget = guiget('putty_paste_style')
widget.set_active(self.config['putty_paste_style'])
# Word chars # Word chars
widget = guiget('word_chars_entry') widget = guiget('word_chars_entry')
widget.set_text(self.config['word_chars']) widget.set_text(self.config['word_chars'])
@ -722,6 +725,11 @@ class PrefsEditor:
self.config['copy_on_selection'] = widget.get_active() self.config['copy_on_selection'] = widget.get_active()
self.config.save() self.config.save()
def on_putty_paste_style_toggled(self, widget):
"""Putty paste style setting changed"""
self.config['putty_paste_style'] = 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

@ -77,6 +77,10 @@ class Terminal(gtk.VBox):
TARGET_TYPE_VTE = 8 TARGET_TYPE_VTE = 8
MOUSEBUTTON_LEFT = 1
MOUSEBUTTON_MIDDLE = 2
MOUSEBUTTON_RIGHT = 3
terminator = None terminator = None
vte = None vte = None
terminalbox = None terminalbox = None
@ -895,17 +899,24 @@ class Terminal(gtk.VBox):
# Suppress double-click behavior # Suppress double-click behavior
return True return True
if event.button == 1: if self.config['putty_paste_style']:
btn_to_paste = self.MOUSEBUTTON_RIGHT
btn_to_context_menu = self.MOUSEBUTTON_MIDDLE
else:
btn_to_paste = self.MOUSEBUTTON_MIDDLE
btn_to_context_menu = self.MOUSEBUTTON_RIGHT
if event.button == self.MOUSEBUTTON_LEFT:
# Ctrl+leftclick on a URL should open it # Ctrl+leftclick on a URL should open it
if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK: if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK:
url = self.check_for_url(event) url = self.check_for_url(event)
if url: if url:
self.open_url(url, prepare=True) self.open_url(url, prepare=True)
elif event.button == 2: elif event.button == btn_to_paste:
# middleclick should paste the clipboard # middleclick should paste the clipboard
self.paste_clipboard(True) self.paste_clipboard(True)
return(True) return(True)
elif event.button == 3: elif event.button == btn_to_context_menu:
# rightclick should display a context menu if Ctrl is not pressed # rightclick should display a context menu if Ctrl is not pressed
if event.state & gtk.gdk.CONTROL_MASK == 0: if event.state & gtk.gdk.CONTROL_MASK == 0:
self.popup_menu(widget, event) self.popup_menu(widget, event)