Apply terminator-gtk3-vte038-v4.patch from Egmont Koblinger

This commit is contained in:
Stephen Boddy 2014-09-19 16:10:43 +02:00
parent 7ca6dd96c6
commit 22ed84abdd
20 changed files with 253 additions and 650 deletions

View File

@ -314,18 +314,10 @@ Each profile should be its own subsection with a header in the format \fB[[name]
If true, allow applications in the terminal to make text boldface.
Default value: \fBTrue\fR
.TP
.B antialias\fR (boolean)
If false, do not apply anti-aliasing to fonts in the terminal.
Default value: \fBTrue\fR
.TP
.B audible_bell\fR (boolean)
If true, make a noise when applications send the escape sequence for the terminal bell.
Default value: \fBFalse\fR
.TP
.B visible_bell\fR (boolean)
If true, flash the terminal when applications send the escape sequence for the terminal bell.
Default value: \fBFalse\fR
.TP
.B urgent_bell\fR (boolean)
If true, set the window manager "urgent" hint when applications send the escale sequence for the terminal bell. Any keypress will cancel the urgent status.
Default value: \fBFalse\fR
@ -351,13 +343,9 @@ A value between 0.0 and 1.0 indicating how much to darken the background image.
Default value: \fB0.5\fR
.TP
.B background_type
Type of terminal background. May be "solid" for a solid colour, "image" for an image, or "transparent" for full transparency in compositing window managers, otherwise pseudo transparency.
Type of terminal background. May be "solid" for a solid colour or "transparent" for full transparency in compositing window managers.
Default value: \fBsolid\fR
.TP
.B background_image
Path to an image file to be used for the background of terminals.
Default value: Nothing
.TP
.B backspace_binding
Sets what code the backspace key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "ascii-del" is normally considered the correct setting for the Backspace key.
Default value: \fBascii\-del\fR
@ -382,10 +370,6 @@ Default value: Current value of \fBforeground_color\fR
Default shape of cursor. Possibilities are "block", "ibeam", and "underline".
Default value: \fBblock\fR
.TP
.B emulation
Sets what type of terminal should be emulated.
Default value: \fBxterm\fR
.TP
.B xterm
This translates into the value that will be set for TERM in the environment of your terminals.
Default value: \fBxterm\fR
@ -426,10 +410,6 @@ Default value: \fBTrue\fR
If true, whenever there's new output the terminal will scroll to the bottom.
Default value: \fBTrue\fR
.TP
.B alternate_screen_scroll \fR(boolean)
Whether or not the mouse wheel scrolls alternate screen buffers (man, vim, mutt, etc). This is the default behavior of VTE, however Ubuntu and possbly other distributions feature patched versions of VTE where this functionality is optional. The option only effects the patched versions of VTE, otherwise it is ignored.
Default value: \fBTrue\fR
.TP
.B scrollback_lines
Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. Be careful with this setting; it's the primary factor in determining how much memory the terminal will use.
Default value: \fB500\fR
@ -450,10 +430,6 @@ Default value: \fBclose\fR
.B palette
Terminals have a 16-colour palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of colour names. Colour names should be in hex format e.g. "#FF00FF".
.TP
.B word_chars
When selecting text by word, sequences of these characters are considered single words. Ranges can be given as "A-Z". Literal hyphen (not expressing a range) should be the first character given.
Default value: \fB'\-A\-Za\-z0\-9,./?%&#:_'\fR
.TP
.B mouse_autohide \fR(boolean)
Controls whether the mouse cursor should be hidden while typing.
Default value: \fBTrue\fR

View File

@ -28,9 +28,8 @@ except OSError:
# Check we have simple basics like Gtk+ and a valid $DISPLAY
try:
import gi
pyGtk.require ("2.0")
# pylint: disable-msg=W0611
import gtk, pango, gobject
from gi.repository import Gtk, Gdk
if Gdk.Display.get_default() == None:
print('You need to run terminator in an X environment. ' \
@ -66,7 +65,7 @@ if __name__ == '__main__':
dbg('dbus disabled by command line')
raise ImportError
from terminatorlib import ipc
import dbus
from gi import DBus # VERIFY FOR GTK3
try:
dbus_service = ipc.DBusService()
except ipc.DBusException:
@ -81,7 +80,7 @@ if __name__ == '__main__':
if val == True:
val = 'True'
optionslist[opt] = val and '%s'%val or ''
optionslist = dbus.Dictionary(optionslist, signature='ss')
optionslist = DBus.Dictionary(optionslist, signature='ss') # VERIFY FOR GTK3
if OPTIONS.new_tab:
dbg('Requesting a new tab')
ipc.new_tab(optionslist)

View File

@ -181,22 +181,18 @@ DEFAULTS = {
'profiles': {
'default': {
'allow_bold' : True,
'antialias' : True,
'audible_bell' : False,
'visible_bell' : False,
'urgent_bell' : False,
'icon_bell' : True,
'background_color' : '#000000',
'background_darkness' : 0.5,
'background_type' : 'solid',
'background_image' : None,
'backspace_binding' : 'ascii-del',
'delete_binding' : 'escape-sequence',
'color_scheme' : 'grey_on_black',
'cursor_blink' : True,
'cursor_shape' : 'block',
'cursor_color' : '#aaaaaa',
'emulation' : 'xterm',
'term' : 'xterm',
'colorterm' : 'gnome-terminal',
'font' : 'Mono 10',
@ -212,7 +208,6 @@ DEFAULTS = {
'palette' : '#2e3436:#cc0000:#4e9a06:#c4a000:\
#3465a4:#75507b:#06989a:#d3d7cf:#555753:#ef2929:#8ae234:#fce94f:\
#729fcf:#ad7fa8:#34e2e2:#eeeeec',
'word_chars' : '-A-Za-z0-9,./?%&#:_',
'mouse_autohide' : True,
'update_records' : True,
'login_shell' : False,
@ -226,7 +221,6 @@ DEFAULTS = {
'force_no_bell' : False,
'cycle_term_tab' : True,
'copy_on_selection' : False,
'alternate_screen_scroll': True,
'split_to_group' : False,
'autoclean_groups' : True,
'http_proxy' : '',
@ -517,8 +511,6 @@ class ConfigBase(Borg):
keytype = keymap[keytype]
elif keytype == 'list':
value = 'list(%s)' % ','.join(value)
if key == 'background_image':
keytype = 'string'
if keytype == 'string':
value = '"%s"' % value

View File

@ -6,9 +6,6 @@
>>> cwd = get_default_cwd()
>>> cwd.__class__.__name__
'str'
>>> func = get_pid_cwd()
>>> func.__class__.__name__
'function'
"""
@ -28,47 +25,4 @@ def get_default_cwd():
return(cwd)
def get_pid_cwd():
"""Determine an appropriate cwd function for the OS we are running on"""
func = lambda pid: None
system = platform.system()
if system == 'Linux':
dbg('Using Linux get_pid_cwd')
func = linux_get_pid_cwd
elif system == 'FreeBSD':
try:
import freebsd
func = freebsd.get_process_cwd
dbg('Using FreeBSD get_pid_cwd')
except (OSError, NotImplementedError, ImportError):
dbg('FreeBSD version too old for get_pid_cwd')
elif system == 'SunOS':
dbg('Using SunOS get_pid_cwd')
func = sunos_get_pid_cwd
else:
dbg('Unable to determine a get_pid_cwd for OS: %s' % system)
return(func)
def proc_get_pid_cwd(pid, path):
"""Extract the cwd of a PID from proc, given the PID and the /proc path to
insert it into, e.g. /proc/%s/cwd"""
try:
cwd = os.path.realpath(path % pid)
except Exception, ex:
err('Unable to get cwd for PID %s: %s' % (pid, ex))
cwd = '/'
return(cwd)
def linux_get_pid_cwd(pid):
"""Determine the cwd for a given PID on Linux kernels"""
return(proc_get_pid_cwd(pid, '/proc/%s/cwd'))
def sunos_get_pid_cwd(pid):
"""Determine the cwd for a given PID on SunOS kernels"""
return(proc_get_pid_cwd(pid, '/proc/%s/path/cwd'))
# vim: set expandtab ts=4 sw=4:

View File

@ -18,8 +18,7 @@
# , Boston, MA 02110-1301 USA
""" Editable Label class"""
from gi.repository import Gtk
from gi.repository import GObject
from gi.repository import GLib, GObject, Gtk, Gdk
class EditableLabel(Gtk.EventBox):
# pylint: disable-msg=W0212
@ -42,7 +41,6 @@ class EditableLabel(Gtk.EventBox):
def __init__(self, text = ""):
""" Class initialiser"""
GObject.GObject.__init__(self)
self.__gobject_init__()
self._entry_handler_id = []
self._label = Gtk.Label(label=text)
@ -74,7 +72,7 @@ class EditableLabel(Gtk.EventBox):
"""event handling text edition"""
if event.button != 1:
return False
if event.type == Gdk._2BUTTON_PRESS:
if event.type == Gdk.EventType._2BUTTON_PRESS:
self.remove (self._label)
self._entry = Gtk.Entry ()
self._entry.set_text (self._label.get_text ())

View File

@ -4,9 +4,7 @@
"""ipc.py - DBus server and API calls"""
from gi.repository import Gtk
import dbus.service
from dbus.exceptions import DBusException
import dbus.glib
from gi.repository import DBus, DBusGLib # VERIFY/FIXME FOR GTK3: DBusException?? Replace all "dbus" with "DBus" in this file, and stuff??
from borg import Borg
from terminator import Terminator
from config import Config

View File

@ -23,7 +23,7 @@ keyboard shortcuts.
"""
import re
from gi.repository import Gtk
from gi.repository import Gtk, Gdk
from util import err
class KeymapError(Exception):
@ -39,7 +39,7 @@ class Keybindings:
'primary': Gdk.ModifierType.CONTROL_MASK,
'shift': Gdk.ModifierType.SHIFT_MASK,
'alt': Gdk.ModifierType.MOD1_MASK,
'super': Gdk.EventMask.SUPER_MASK,
'super': Gdk.ModifierType.SUPER_MASK,
}
empty = {}
@ -48,7 +48,7 @@ class Keybindings:
_lookup = None
def __init__(self):
self.keymap = Gdk.keymap_get_default()
self.keymap = Gdk.Keymap.get_default()
self.configure({})
def configure(self, bindings):
@ -115,9 +115,9 @@ class Keybindings:
def lookup(self, event):
"""Translate a keyboard event into a mapped key"""
try:
keyval, _egp, _lvl, consumed = self.keymap.translate_keyboard_state(
_found, keyval, _egp, _lvl, consumed = self.keymap.translate_keyboard_state(
event.hardware_keycode,
event.get_state() & ~Gdk.ModifierType.LOCK_MASK,
Gdk.ModifierType(event.get_state() & ~Gdk.ModifierType.LOCK_MASK),
event.group)
except TypeError:
err ("keybindings.lookup failed to translate keyboard event: %s" %

View File

@ -52,24 +52,23 @@ class Notebook(Container, Gtk.Notebook):
# the new order of terminals. We probably need to preserve this for
# navigation to next/prev terminals.
#self.connect('page-reordered', self.on_page_reordered)
self.set_property('homogeneous', self.config['homogeneous_tabbar'])
self.set_scrollable(self.config['scroll_tabbar'])
if self.config['tab_position'] == 'hidden' or self.config['hide_tabbar']:
self.set_show_tabs(False)
else:
self.set_show_tabs(True)
pos = getattr(gtk, 'POS_%s' % self.config['tab_position'].upper())
pos = getattr(Gtk.PositionType, self.config['tab_position'].upper())
self.set_tab_pos(pos)
for tab in xrange(0, self.get_n_pages()):
label = self.get_tab_label(self.get_nth_page(tab))
label.update_angle()
style = Gtk.RcStyle()
style.xthickness = 0
style.ythickness = 0
self.modify_style(style)
# style = Gtk.RcStyle() # FIXME FOR GTK3 how to do it there? actually do we really want to override the theme?
# style.xthickness = 0
# style.ythickness = 0
# self.modify_style(style)
self.last_active_term = {}
def create_layout(self, layout):
@ -166,6 +165,8 @@ class Notebook(Container, Gtk.Notebook):
sibling.force_set_profile(None, widget.get_profile())
self.insert_page(container, None, page_num)
self.child_set_property(container, 'tab-expand', True)
self.child_set_property(container, 'tab-fill', True)
self.set_tab_reorderable(container, True)
self.set_tab_label(container, label)
self.show_all()
@ -290,11 +291,13 @@ class Notebook(Container, Gtk.Notebook):
if maker.isinstance(term_widget, 'Terminal'):
self.set_last_active_term(term_widget.uuid)
self.set_tab_label(term_widget, label)
self.set_tab_label_packing(term_widget, not self.config['scroll_tabbar'],
not self.config['scroll_tabbar'],
Gtk.PACK_START)
# self.set_tab_label_packing(term_widget, not self.config['scroll_tabbar'], # FIXME FOR GTK3 how to do it there?
# not self.config['scroll_tabbar'],
# Gtk.PACK_START)
break
self.child_set_property(widget, 'tab-expand', True)
self.child_set_property(widget, 'tab-fill', True)
self.set_tab_reorderable(widget, True)
self.set_current_page(tabpos)
self.show_all()
@ -497,7 +500,6 @@ class TabLabel(Gtk.HBox):
def __init__(self, title, notebook):
"""Class initialiser"""
GObject.GObject.__init__(self)
self.__gobject_init__()
self.notebook = notebook
self.terminator = Terminator()
@ -506,7 +508,7 @@ class TabLabel(Gtk.HBox):
self.label = EditableLabel(title)
self.update_angle()
self.pack_start(self.label, True, True)
self.pack_start(self.label, True, True, 0)
self.update_button()
self.show_all()
@ -551,16 +553,16 @@ class TabLabel(Gtk.HBox):
self.button.set_focus_on_click(False)
self.button.set_relief(Gtk.ReliefStyle.NONE)
style = Gtk.RcStyle()
style.xthickness = 0
style.ythickness = 0
self.button.modify_style(style)
# style = Gtk.RcStyle() # FIXME FOR GTK3 how to do it there? actually do we really want to override the theme?
# style.xthickness = 0
# style.ythickness = 0
# self.button.modify_style(style)
self.button.add(self.icon)
self.button.connect('clicked', self.on_close)
self.button.set_name('terminator-tab-close-button')
if hasattr(self.button, 'set_tooltip_text'):
self.button.set_tooltip_text(_('Close Tab'))
self.pack_start(self.button, False, False)
self.pack_start(self.button, False, False, 0)
self.show_all()
def update_angle(self):

View File

@ -4,8 +4,7 @@
"""paned.py - a base Paned container class and the vertical/horizontal
variants"""
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import GObject, Gtk, Gdk
from util import dbg, err
from terminator import Terminator
@ -132,7 +131,7 @@ class Paned(Container):
def on_button_press(self, widget, event):
"""Handle button presses on a Pane"""
if event.button == 1 and event.type == Gdk._2BUTTON_PRESS:
if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
if event.get_state() & Gdk.ModifierType.MOD4_MASK == Gdk.ModifierType.MOD4_MASK:
recurse_up=True
else:
@ -406,7 +405,7 @@ class HPaned(Paned, Gtk.HPaned):
self.cnxids.new(self, 'button-press-event', self.on_button_press)
def get_length(self):
return(self.allocation.width)
return(self.get_allocated_width())
def set_pos(self, pos):
Gtk.HPaned.set_position(self, pos)
@ -421,7 +420,7 @@ class VPaned(Paned, Gtk.VPaned):
self.cnxids.new(self, 'button-press-event', self.on_button_press)
def get_length(self):
return(self.allocation.height)
return(self.get_allocated_height())
def set_pos(self, pos):
Gtk.VPaned.set_position(self, pos)

View File

@ -52,13 +52,13 @@ class ActivityWatch(plugin.MenuItem):
def watch(self, _widget, terminal):
"""Watch a terminal"""
vte = terminal.get_vte()
self.watches[terminal] = vte.connect('contents-changed',
self.watches[terminal] = Vte.connect('contents-changed',
self.notify, terminal)
def unwatch(self, _widget, terminal):
"""Stop watching a terminal"""
vte = terminal.get_vte()
vte.disconnect(self.watches[terminal])
Vte.disconnect(self.watches[terminal])
del(self.watches[terminal])
def notify(self, _vte, terminal):
@ -118,7 +118,7 @@ class InactivityWatch(plugin.MenuItem):
def watch(self, _widget, terminal):
"""Watch a terminal"""
vte = terminal.get_vte()
self.watches[terminal] = vte.connect('contents-changed',
self.watches[terminal] = Vte.connect('contents-changed',
self.reset_timer, terminal)
timeout_id = GObject.timeout_add(5000, self.check_times, terminal)
self.timers[terminal] = timeout_id
@ -127,7 +127,7 @@ class InactivityWatch(plugin.MenuItem):
def unwatch(self, _vte, terminal):
"""Unwatch a terminal"""
vte = terminal.get_vte()
vte.disconnect(self.watches[terminal])
Vte.disconnect(self.watches[terminal])
del(self.watches[terminal])
GObject.source_remove(self.timers[terminal])
del(self.timers[terminal])

View File

@ -110,7 +110,7 @@ class CustomCommandsMenu(plugin.MenuItem):
command = data['command']
if command[len(command)-1] != '\n':
command = command + '\n'
data['terminal'].vte.feed_child(command)
data['terminal'].vte.feed_child(command, len(command))
def configure(self, widget, data = None):
ui = {}

View File

@ -1388,22 +1388,6 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="antialias_checkbutton">
<property name="label" translatable="yes">Anti-alias text</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_antialias_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show_titlebar">
<property name="label" translatable="yes">Show titlebar</property>
@ -1436,47 +1420,6 @@
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox136">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="word_chars_entry_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Select-by-_word characters:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">word_chars_entry</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="word_chars_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
<signal name="changed" handler="on_word_chars_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox8">
<property name="visible">True</property>
@ -1669,23 +1612,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="visual_bell_checkbutton">
<property name="label" translatable="yes">Visual flash</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="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_visual_bell_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="audible_bell_checkbutton">
<property name="label" translatable="yes">Audible beep</property>
@ -2632,114 +2558,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox87">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkRadioButton" id="image_radiobutton">
<property name="label" translatable="yes">_Background image</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="use_underline">True</property>
<property name="draw_indicator">True</property>
<property name="group">solid_radiobutton</property>
<signal name="toggled" handler="on_background_type_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment10103">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox89">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="background_image_filechooser_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Image _file:</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
<property name="mnemonic_widget">background_image_filechooser</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="background_image_filechooser">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="create_folders">False</property>
<property name="title" translatable="yes">Select Background Image</property>
<signal name="file-set" handler="on_background_image_filechooser_file_set" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="scroll_background_checkbutton">
<property name="label" translatable="yes">Background image _scrolls</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="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scroll_background_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="transparent_radiobutton">
<property name="label" translatable="yes">_Transparent background</property>
@ -2768,7 +2586,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">S_hade transparent or image background:</property>
<property name="label" translatable="yes">S_hade transparent background:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">darken_background_scale</property>
</object>
@ -2869,24 +2687,6 @@
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkCheckButton" id="alternate_screen_scroll_checkbutton">
<property name="label" translatable="yes">Use keystrokes to scroll on _alternate screen</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="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_alternate_screen_scroll_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="scroll_on_keystroke_checkbutton">
<property name="label" translatable="yes">Scroll on _keystroke</property>

View File

@ -8,8 +8,7 @@ write it to a config file
"""
import os
from gi.repository import Gtk
from gi.repository import GObject
from gi.repository import GObject, Gtk, Gdk
from util import dbg, err
import config
@ -371,15 +370,9 @@ class PrefsEditor:
# Allow bold text
widget = guiget('allow_bold_checkbutton')
widget.set_active(self.config['allow_bold'])
# Anti-alias
widget = guiget('antialias_checkbutton')
widget.set_active(self.config['antialias'])
# Icon terminal bell
widget = guiget('icon_bell_checkbutton')
widget.set_active(self.config['icon_bell'])
# Visual terminal bell
widget = guiget('visual_bell_checkbutton')
widget.set_active(self.config['visible_bell'])
# Audible terminal bell
widget = guiget('audible_bell_checkbutton')
widget.set_active(self.config['audible_bell'])
@ -392,9 +385,6 @@ class PrefsEditor:
# Copy on selection
widget = guiget('copy_on_selection')
widget.set_active(self.config['copy_on_selection'])
# Word chars
widget = guiget('word_chars_entry')
widget.set_text(self.config['word_chars'])
# Cursor shape
widget = guiget('cursor_shape_combobox')
if self.config['cursor_shape'] == 'underline':
@ -410,10 +400,10 @@ class PrefsEditor:
# Cursor colour
widget = guiget('cursor_color')
try:
widget.set_color(Gdk.Color(self.config['cursor_color']))
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
except ValueError:
self.config['cursor_color'] = "#FFFFFF"
widget.set_color(Gdk.Color(self.config['cursor_color']))
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
## Command tab
# Login shell
@ -462,14 +452,14 @@ class PrefsEditor:
# NOTE: The scheme is set in the GUI widget after the fore/back colours
# Foreground color
widget = guiget('foreground_colorpicker')
widget.set_color(Gdk.Color(self.config['foreground_color']))
widget.set_color(Gdk.color_parse(self.config['foreground_color']))
if scheme == 'custom':
widget.set_sensitive(True)
else:
widget.set_sensitive(False)
# Background color
widget = guiget('background_colorpicker')
widget.set_color(Gdk.Color(self.config['background_color']))
widget.set_color(Gdk.color_parse(self.config['background_color']))
if scheme == 'custom':
widget.set_sensitive(True)
else:
@ -493,7 +483,7 @@ class PrefsEditor:
colourpalette = self.config['palette'].split(':')
for i in xrange(1, 17):
widget = guiget('palette_colorpicker_%d' % i)
widget.set_color(Gdk.Color(colourpalette[i - 1]))
widget.set_color(Gdk.color_parse(colourpalette[i - 1]))
# Now set the palette selector widget
widget = guiget('palette_combobox')
widget.set_active(self.palettevalues[palette])
@ -502,7 +492,7 @@ class PrefsEditor:
'title_receive_fg_color', 'title_receive_bg_color',
'title_inactive_fg_color', 'title_inactive_bg_color']:
widget = guiget(bit)
widget.set_color(Gdk.Color(self.config[bit]))
widget.set_color(Gdk.color_parse(self.config[bit]))
# Inactive terminal shading
widget = guiget('inactive_color_offset')
widget.set_value(float(self.config['inactive_color_offset']))
@ -518,20 +508,9 @@ class PrefsEditor:
# Radio values
if self.config['background_type'] == 'solid':
guiget('solid_radiobutton').set_active(True)
elif self.config['background_type'] == 'image':
guiget('image_radiobutton').set_active(True)
elif self.config['background_type'] == 'transparent':
guiget('transparent_radiobutton').set_active(True)
self.update_background_tab()
# Background image file
if self.config['background_image'] != '':
widget = guiget('background_image_filechooser')
if self.config['background_image'] is not None and \
self.config['background_image'] != '':
widget.set_filename(self.config['background_image'])
# Background image scrolls
widget = guiget('scroll_background_checkbutton')
widget.set_active(self.config['scroll_background'])
# Background shading
widget = guiget('background_darkness_scale')
widget.set_value(float(self.config['background_darkness']))
@ -558,9 +537,6 @@ class PrefsEditor:
# Scroll on keystroke
widget = guiget('scroll_on_keystroke_checkbutton')
widget.set_active(self.config['scroll_on_keystroke'])
# Scroll in alternate mode
widget = guiget('alternate_screen_scroll_checkbutton')
widget.set_active(self.config['alternate_screen_scroll'])
## Compatibility tab
# Backspace key
@ -674,11 +650,6 @@ class PrefsEditor:
self.config['allow_bold'] = widget.get_active()
self.config.save()
def on_antialias_checkbutton_toggled(self, widget):
"""Anti-alias setting changed"""
self.config['antialias'] = widget.get_active()
self.config.save()
def on_show_titlebar_toggled(self, widget):
"""Show titlebar setting changed"""
self.config['show_titlebar'] = widget.get_active()
@ -699,11 +670,6 @@ class PrefsEditor:
self.config['icon_bell'] = widget.get_active()
self.config.save()
def on_visual_bell_checkbutton_toggled(self, widget):
"""Visual bell setting changed"""
self.config['visible_bell'] = widget.get_active()
self.config.save()
def on_audible_bell_checkbutton_toggled(self, widget):
"""Audible bell setting changed"""
self.config['audible_bell'] = widget.get_active()
@ -729,11 +695,6 @@ class PrefsEditor:
self.config['scroll_background'] = widget.get_active()
self.config.save()
def on_alternate_screen_scroll_checkbutton_toggled(self, widget):
"""Scroll in alt-mode setting changed"""
self.config['alternate_screen_scroll'] = widget.get_active()
self.config.save()
def on_scroll_on_keystroke_checkbutton_toggled(self, widget):
"""Scroll on keystrong setting changed"""
self.config['scroll_on_keystroke'] = widget.get_active()
@ -815,11 +776,6 @@ class PrefsEditor:
self.config['background_darkness'] = round(value, 2)
self.config.save()
def on_background_image_filechooser_file_set(self, widget):
"""Background image setting changed"""
self.config['background_image'] = widget.get_filename()
self.config.save()
def on_palette_combobox_changed(self, widget):
"""Palette selector changed"""
value = None
@ -845,7 +801,7 @@ class PrefsEditor:
for num in xrange(1, 17):
# Update the visible elements
picker = guiget('palette_colorpicker_%d' % num)
picker.set_color(Gdk.Color(palettebits[num - 1]))
picker.set_color(Gdk.color_parse(palettebits[num - 1]))
elif value == 'custom':
palettebits = []
for num in xrange(1, 17):
@ -924,11 +880,6 @@ class PrefsEditor:
self.config['cursor_shape'] = value
self.config.save()
def on_word_chars_entry_changed(self, widget):
"""Word characters changed"""
self.config['word_chars'] = widget.get_text()
self.config.save()
def on_font_selector_font_set(self, widget):
"""Font changed"""
self.config['font'] = widget.get_font_name()
@ -1166,19 +1117,11 @@ class PrefsEditor:
transwidget = guiget('transparent_radiobutton')
if transwidget.get_active() == True:
backtype = 'transparent'
elif imagewidget.get_active() == True:
backtype = 'image'
else:
backtype = 'solid'
self.config['background_type'] = backtype
self.config.save()
if backtype == 'image':
guiget('background_image_filechooser').set_sensitive(True)
guiget('scroll_background_checkbutton').set_sensitive(True)
else:
guiget('background_image_filechooser').set_sensitive(False)
guiget('scroll_background_checkbutton').set_sensitive(False)
if backtype in ('transparent', 'image'):
guiget('darken_background_scale').set_sensitive(True)
else:
@ -1334,8 +1277,8 @@ class PrefsEditor:
err('Unknown colourscheme value: %s' % value)
return
fore.set_color(Gdk.Color(forecol))
back.set_color(Gdk.Color(backcol))
fore.set_color(Gdk.color_parse(forecol))
back.set_color(Gdk.color_parse(backcol))
self.config['foreground_color'] = forecol
self.config['background_color'] = backcol

View File

@ -35,7 +35,6 @@ class Searchbar(Gtk.HBox):
def __init__(self):
"""Class initialiser"""
GObject.GObject.__init__(self)
self.__gobject_init__()
self.config = Config()
@ -79,12 +78,12 @@ class Searchbar(Gtk.HBox):
self.prev.set_sensitive(False)
self.prev.connect('clicked', self.prev_search)
self.pack_start(label, False)
self.pack_start(label, False, True, 0)
self.pack_start(self.entry, True, True, 0)
self.pack_start(self.reslabel, False)
self.pack_start(self.prev, False, False)
self.pack_start(self.next, False, False)
self.pack_end(close, False, False)
self.pack_start(self.reslabel, False, True, 0)
self.pack_start(self.prev, False, False, 0)
self.pack_start(self.next, False, False, 0)
self.pack_end(close, False, False, 0)
self.hide()
self.set_no_show_all(True)

View File

@ -8,10 +8,9 @@ import sys
import os
import signal
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GObject
from gi.repository import Pango
from gi.repository import GLib, GObject, Pango, Gtk, Gdk
gi.require_version('Vte', '2.91') # vte-0.38 (gnome-3.14)
from gi.repository import Vte
import subprocess
import urllib
@ -29,12 +28,6 @@ from signalman import Signalman
import plugin
from terminatorlib.layoutlauncher import LayoutLauncher
try:
import vte
except ImportError:
gerr('You need to install python bindings for libvte')
sys.exit(1)
# pylint: disable-msg=R0904
class Terminal(Gtk.VBox):
"""Class implementing the VTE widget and its wrappings"""
@ -114,7 +107,6 @@ class Terminal(Gtk.VBox):
def __init__(self):
"""Class initialiser"""
GObject.GObject.__init__(self)
self.__gobject_init__()
self.terminator = Terminator()
self.terminator.register_terminal(self)
@ -131,11 +123,11 @@ class Terminal(Gtk.VBox):
self.cwd = get_default_cwd()
self.origcwd = self.terminator.origcwd
self.clipboard = Gtk.clipboard_get(Gdk.SELECTION_CLIPBOARD)
self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
self.pending_on_vte_size_allocate = False
self.vte = vte.Terminal()
self.vte = Vte.Terminal()
self.vte._expose_data = None
if not hasattr(self.vte, "set_opacity") or \
not hasattr(self.vte, "is_composited"):
@ -162,7 +154,7 @@ class Terminal(Gtk.VBox):
self.searchbar.connect('end-search', self.on_search_done)
self.show()
self.pack_start(self.titlebar, False)
self.pack_start(self.titlebar, False, True, 0)
self.pack_start(self.terminalbox, True, True, 0)
self.pack_end(self.searchbar, True, True, 0)
@ -198,7 +190,7 @@ class Terminal(Gtk.VBox):
def get_cwd(self):
"""Return our cwd"""
return(self.terminator.pid_cwd(self.pid))
return(GLib.filename_from_uri(self.vte.get_current_directory_uri())[0])
def close(self):
"""Close ourselves"""
@ -218,7 +210,7 @@ class Terminal(Gtk.VBox):
"""Create a GtkHBox containing the terminal and a scrollbar"""
terminalbox = Gtk.HBox()
self.scrollbar = Gtk.VScrollbar(self.vte.get_adjustment())
self.scrollbar = Gtk.VScrollbar(self.vte.get_vadjustment())
self.scrollbar.set_no_show_all(True)
self.scrollbar_position = self.config['scrollbar_position']
@ -230,8 +222,8 @@ class Terminal(Gtk.VBox):
else:
func = terminalbox.pack_start
func(self.vte)
func(self.scrollbar, False)
func(self.vte, True, True, 0)
func(self.scrollbar, False, True, 0)
terminalbox.show_all()
return(terminalbox)
@ -255,9 +247,19 @@ class Terminal(Gtk.VBox):
lboundry = "\\<"
rboundry = "\\>"
self.matches['full_uri'] = self.vte.match_add(lboundry + schemes +
# VERIFY/FIXME FOR GTK3: What's this with the POSIX and GNU mode l/r boundry[sic] values?
# Neither of the two works for me since the Vte 0.38 update.
# Should we get rid of them and the try_posix_regexp option totally?
# They don't seem to be necessary, and there really shouldn't be any difference
# between Linux and non-Linux systems, GLib should hide this (does it?).
lboundry = ''
rboundry = ''
re = (lboundry + schemes +
"//(" + user + "@)?[" + hostchars +".]+(:[0-9]+)?(" +
urlpath + ")?" + rboundry + "/?")
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches['full_uri'] = self.vte.match_add_gregex(reg, 0)
if self.matches['full_uri'] == -1:
if posix:
@ -266,20 +268,28 @@ class Terminal(Gtk.VBox):
else:
err ('Terminal::update_url_matches: Failed adding URL matches')
else:
self.matches['voip'] = self.vte.match_add(lboundry +
re = (lboundry +
'(callto:|h323:|sip:)' + "[" + userchars + "+][" +
userchars + ".]*(:[0-9]+)?@?[" + pathchars + "]+" +
rboundry)
self.matches['addr_only'] = self.vte.match_add (lboundry +
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches['voip'] = self.vte.match_add_gregex(reg, 0)
re = (lboundry +
"(www|ftp)[" + hostchars + "]*\.[" + hostchars +
".]+(:[0-9]+)?(" + urlpath + ")?" + rboundry + "/?")
self.matches['email'] = self.vte.match_add (lboundry +
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches['addr_only'] = self.vte.match_add_gregex(reg, 0)
re = (lboundry +
"(mailto:)?[a-zA-Z0-9][a-zA-Z0-9.+-]*@[a-zA-Z0-9]" +
"[a-zA-Z0-9-]*\.[a-zA-Z0-9][a-zA-Z0-9-]+" +
"[.a-zA-Z0-9-]*" + rboundry)
self.matches['nntp'] = self.vte.match_add (lboundry +
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches['email'] = self.vte.match_add_gregex(reg, 0)
re = (lboundry +
"""news:[-A-Z\^_a-z{|}~!"#$%&'()*+,./0-9;:=?`]+@""" +
"[-A-Za-z0-9.]+(:[0-9]+)?" + rboundry)
reg = GLib.Regex.new(re, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches['nntp'] = self.vte.match_add_gregex(reg, 0)
# Now add any matches from plugins
try:
@ -293,7 +303,8 @@ class Terminal(Gtk.VBox):
if name in self.matches:
dbg('refusing to add duplicate match %s' % name)
continue
self.matches[name] = self.vte.match_add(match)
reg = GLib.Regex.new(match, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches[name] = self.vte.match_add_gregex(reg, 0)
dbg('added plugin URL handler for %s (%s) as %d' %
(name, urlplugin.__class__.__name__,
self.matches[name]))
@ -305,7 +316,8 @@ class Terminal(Gtk.VBox):
if name in self.matches:
err('Terminal::match_add: Refusing to create duplicate match %s' % name)
return
self.matches[name] = self.vte.match_add(match)
reg = GLib.Regex.new(match, GLib.RegexCompileFlags.OPTIMIZE, 0)
self.matches[name] = self.vte.match_add_gregex(reg, 0)
def match_remove(self, name):
"""Remove a previously registered URL match"""
@ -326,18 +338,18 @@ class Terminal(Gtk.VBox):
dsttargets = [("vte", Gtk.TargetFlags.SAME_APP, self.TARGET_TYPE_VTE),
('text/x-moz-url', 0, 0),
('_NETSCAPE_URL', 0, 0)]
dsttargets = Gtk.target_list_add_text_targets(dsttargets)
dsttargets = Gtk.target_list_add_uri_targets(dsttargets)
# dsttargets = Gtk.target_list_add_text_targets(dsttargets) # FIXME FOR GTK3
# dsttargets = Gtk.target_list_add_uri_targets(dsttargets)
dbg('Finalised drag targets: %s' % dsttargets)
for (widget, mask) in [
(self.vte, Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.BUTTON3_MASK),
(self.titlebar, Gdk.ModifierType.BUTTON1_MASK)]:
widget.drag_source_set(mask, srcvtetargets, Gdk.DragAction.MOVE)
self.vte.drag_dest_set(Gtk.DestDefaults.MOTION |
Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP,
dsttargets, Gdk.DragAction.COPY | Gdk.DragAction.MOVE)
# for (widget, mask) in [
# (self.vte, Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.BUTTON3_MASK),
# (self.titlebar, Gdk.ModifierType.BUTTON1_MASK)]:
# widget.drag_source_set(mask, srcvtetargets, Gdk.DragAction.MOVE) # FIXME FOR GTK3
#
# self.vte.drag_dest_set(Gtk.DestDefaults.MOTION |
# Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP,
# dsttargets, Gdk.DragAction.COPY | Gdk.DragAction.MOVE) # FIXME FOR GTK3
for widget in [self.vte, self.titlebar]:
widget.connect('drag-begin', self.on_drag_begin, self)
@ -380,13 +392,13 @@ class Terminal(Gtk.VBox):
menu = self.populate_group_menu()
menu.show_all()
menu.popup(None, None, self.position_popup_group_menu, button, time,
widget)
menu.popup(None, None, self.position_popup_group_menu, widget, button, time)
return(True)
def populate_group_menu(self):
"""Fill out a group menu"""
menu = Gtk.Menu()
self.group_menu = menu # from http://stackoverflow.com/questions/21960298/python-gtk3-right-click-menu -- is this the right way?
groupitem = None
item = Gtk.MenuItem(_('New group...'))
@ -394,13 +406,13 @@ class Terminal(Gtk.VBox):
menu.append(item)
if len(self.terminator.groups) > 0:
groupitem = Gtk.RadioMenuItem(groupitem, _('None'))
groupitem = Gtk.RadioMenuItem(_('None'), groupitem)
groupitem.set_active(self.group == None)
groupitem.connect('activate', self.set_group, None)
menu.append(groupitem)
for group in self.terminator.groups:
item = Gtk.RadioMenuItem(groupitem, group, False)
item = Gtk.RadioMenuItem(group, groupitem, False) # VERIFY FOR GTK3 what is the last arg?
item.set_active(self.group == group)
item.connect('toggled', self.set_group, group)
menu.append(item)
@ -415,12 +427,12 @@ class Terminal(Gtk.VBox):
menu.append(item)
if util.has_ancestor(self, Gtk.Notebook):
item = Gtk.MenuItem(_('G_roup all in tab'))
item = Gtk.MenuItem.new_with_mnemonic(_('G_roup all in tab'))
item.connect('activate', lambda x: self.emit('group_tab'))
menu.append(item)
if len(self.terminator.groups) > 0:
item = Gtk.MenuItem(_('Ungr_oup all in tab'))
item = Gtk.MenuItem.new_with_mnemonic(_('Ungr_oup all in tab'))
item.connect('activate', lambda x: self.emit('ungroup_tab'))
menu.append(item)
@ -444,7 +456,7 @@ class Terminal(Gtk.VBox):
for key, value in {_('Broadcast all'):'all',
_('Broadcast group'):'group',
_('Broadcast off'):'off'}.items():
groupitem = Gtk.RadioMenuItem(groupitem, key)
groupitem = Gtk.RadioMenuItem(key, groupitem)
dbg('Terminal::populate_group_menu: %s active: %s' %
(key, self.terminator.groupsend ==
self.terminator.groupsend_type[value]))
@ -483,14 +495,13 @@ class Terminal(Gtk.VBox):
_screen_w = Gdk.Screen.width()
screen_h = Gdk.Screen.height()
if Gtk.gtk_version >= (2, 14):
widget_win = widget.get_window()
else:
widget_win = widget.window
widget_x, widget_y = widget_win.get_origin()
_widget_w, widget_h = widget_win.get_size()
widget_win = widget.get_window()
_something, widget_x, widget_y = widget_win.get_origin() # VERIFY FOR GTK3: what's the first return value?
_widget_w = widget_win.get_width()
widget_h = widget_win.get_height()
_menu_w, menu_h = menu.size_request()
_menu_w = menu.size_request().width
menu_h = menu.size_request().height
if widget_y + widget_h + menu_h > screen_h:
menu_y = max(widget_y - menu_h, 0)
@ -554,12 +565,10 @@ class Terminal(Gtk.VBox):
self.cnxids.new(self.vte, 'child-exited', self.spawn_child, True)
elif self.config['exit_action'] in ('close', 'left'):
self.cnxids.new(self.vte, 'child-exited',
lambda x: self.emit('close-term'))
lambda x, y: self.emit('close-term'))
self.vte.set_emulation(self.config['emulation'])
if self.custom_encoding != True:
self.vte.set_encoding(self.config['encoding'])
self.vte.set_word_chars(self.config['word_chars'])
self.vte.set_mouse_autohide(self.config['mouse_autohide'])
backspace = self.config['backspace_binding']
@ -567,13 +576,13 @@ class Terminal(Gtk.VBox):
try:
if backspace == 'ascii-del':
backbind = vte.ERASE_ASCII_DELETE
backbind = Vte.ERASE_ASCII_DELETE
elif backspace == 'control-h':
backbind = vte.ERASE_ASCII_BACKSPACE
backbind = Vte.ERASE_ASCII_BACKSPACE
elif backspace == 'escape-sequence':
backbind = vte.ERASE_DELETE_SEQUENCE
backbind = Vte.ERASE_DELETE_SEQUENCE
else:
backbind = vte.ERASE_AUTO
backbind = Vte.ERASE_AUTO
except AttributeError:
if backspace == 'ascii-del':
backbind = 2
@ -586,13 +595,13 @@ class Terminal(Gtk.VBox):
try:
if delete == 'ascii-del':
delbind = vte.ERASE_ASCII_DELETE
delbind = Vte.ERASE_ASCII_DELETE
elif delete == 'control-h':
delbind = vte.ERASE_ASCII_BACKSPACE
delbind = Vte.ERASE_ASCII_BACKSPACE
elif delete == 'escape-sequence':
delbind = vte.ERASE_DELETE_SEQUENCE
delbind = Vte.ERASE_DELETE_SEQUENCE
else:
delbind = vte.ERASE_AUTO
delbind = Vte.ERASE_AUTO
except AttributeError:
if delete == 'ascii-del':
delbind = 2
@ -617,11 +626,18 @@ class Terminal(Gtk.VBox):
pass
self.vte.set_allow_bold(self.config['allow_bold'])
if self.config['use_theme_colors']:
self.fgcolor_active = self.vte.get_style().text[Gtk.StateType.NORMAL]
self.bgcolor = self.vte.get_style().base[Gtk.StateType.NORMAL]
self.fgcolor_active = self.vte.get_style_context().get_color(Gtk.StateType.NORMAL) # VERIFY FOR GTK3: do these really take the theme colors?
self.bgcolor = self.vte.get_style_context().get_background_color(Gtk.StateType.NORMAL)
else:
self.fgcolor_active = Gdk.color_parse(self.config['foreground_color'])
self.bgcolor = Gdk.color_parse(self.config['background_color'])
self.fgcolor_active = Gdk.RGBA()
self.fgcolor_active.parse(self.config['foreground_color'])
self.bgcolor = Gdk.RGBA()
self.bgcolor.parse(self.config['background_color'])
if self.config['background_type'] == 'transparent':
self.bgcolor.alpha = self.config['background_darkness']
else:
self.bgcolor.alpha = 1
factor = self.config['inactive_color_offset']
if factor > 1.0:
@ -643,7 +659,8 @@ class Terminal(Gtk.VBox):
self.palette_inactive = []
for color in colors:
if color:
newcolor = Gdk.color_parse(color)
newcolor = Gdk.RGBA()
newcolor.parse(color)
newcolor_inactive = newcolor.copy()
for bit in ['red', 'green', 'blue']:
setattr(newcolor_inactive, bit,
@ -653,85 +670,26 @@ class Terminal(Gtk.VBox):
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
self.palette_active)
self.set_cursor_color()
if hasattr(self.vte, 'set_cursor_shape'):
self.vte.set_cursor_shape(getattr(vte, 'CURSOR_SHAPE_' +
self.config['cursor_shape'].upper()))
self.vte.set_cursor_shape(getattr(Vte.CursorShape,
self.config['cursor_shape'].upper()));
background_type = self.config['background_type']
dbg('background_type=%s' % background_type)
if background_type == 'image' and \
self.config['background_image'] is not None and \
self.config['background_image'] != '':
self.vte.set_background_image_file(self.config['background_image'])
self.vte.set_scroll_background(self.config['scroll_background'])
if self.config['cursor_blink'] == True:
self.vte.set_cursor_blink_mode(Vte.CursorBlinkMode.ON)
else:
try:
self.vte.set_background_image(None)
except TypeError:
# FIXME: I think this is only necessary because of
# https://bugzilla.gnome.org/show_bug.cgi?id=614910
pass
self.vte.set_scroll_background(False)
if background_type in ('image', 'transparent'):
self.vte.set_background_tint_color(Gdk.color_parse(
self.config['background_color']))
opacity = int(self.config['background_darkness'] * 65536)
saturation = 1.0 - float(self.config['background_darkness'])
dbg('setting background saturation: %f' % saturation)
self.vte.set_background_saturation(saturation)
else:
dbg('setting background_saturation: 1')
opacity = 65535
self.vte.set_background_saturation(1)
if self.composite_support:
dbg('setting opacity: %d' % opacity)
self.vte.set_opacity(opacity)
# This is quite hairy, but the basic explanation is that we should
# set_background_transparent(True) when we have no compositing and want
# fake background transparency, otherwise it should be False.
if not self.composite_support or self.config['disable_real_transparency']:
# We have no compositing support, fake background only
background_transparent = True
else:
if self.vte.is_composited() == False:
# We have compositing and it's enabled. no fake background.
background_transparent = True
else:
# We have compositing, but it's not enabled. fake background
background_transparent = False
if self.config['background_type'] == 'transparent':
dbg('setting background_transparent=%s' % background_transparent)
self.vte.set_background_transparent(background_transparent)
else:
dbg('setting background_transparent=False')
self.vte.set_background_transparent(False)
if hasattr(vte, 'VVVVTE_CURSOR_BLINK_ON'):
if self.config['cursor_blink'] == True:
self.vte.set_cursor_blink_mode('VTE_CURSOR_BLINK_ON')
else:
self.vte.set_cursor_blink_mode('VTE_CURSOR_BLINK_OFF')
else:
self.vte.set_cursor_blinks(self.config['cursor_blink'])
self.vte.set_cursor_blink_mode(Vte.CursorBlinkMode.OFF)
if self.config['force_no_bell'] == True:
self.vte.set_audible_bell(False)
self.vte.set_visible_bell(False)
self.cnxids.remove_signal(self.vte, 'beep')
self.cnxids.remove_signal(self.vte, 'bell')
else:
self.vte.set_audible_bell(self.config['audible_bell'])
self.vte.set_visible_bell(self.config['visible_bell'])
self.cnxids.remove_signal(self.vte, 'beep')
self.cnxids.remove_signal(self.vte, 'bell')
if self.config['urgent_bell'] == True or \
self.config['icon_bell'] == True:
try:
self.cnxids.new(self.vte, 'beep', self.on_beep)
self.cnxids.new(self.vte, 'bell', self.on_bell)
except TypeError:
err('beep signal unavailable with this version of VTE')
err('bell signal unavailable with this version of VTE')
if self.config['scrollback_infinite'] == True:
scrollback_lines = -1
@ -747,15 +705,11 @@ class Terminal(Gtk.VBox):
self.scrollbar.hide()
else:
self.scrollbar.show()
if self.config['scrollbar_position'] == 'left':
if self.config['scrollbar_position'] == 'left': # FIXME FOR GTK3: moving the scrollbar to the other side (by changing prefs) doesn't work
self.reorder_child(self.scrollbar, 0)
elif self.config['scrollbar_position'] == 'right':
self.reorder_child(self.vte, 0)
if hasattr(self.vte, 'set_alternate_screen_scroll'):
self.vte.set_alternate_screen_scroll(
self.config['alternate_screen_scroll'])
self.titlebar.update()
self.vte.queue_draw()
@ -769,8 +723,9 @@ class Terminal(Gtk.VBox):
# https://bugzilla.gnome.org/show_bug.cgi?id=614910
pass
elif self.config['cursor_color'] != '':
self.vte.set_color_cursor(Gdk.color_parse(
self.config['cursor_color']))
cursor_color = Gdk.RGBA()
cursor_color.parse(self.config['cursor_color'])
self.vte.set_color_cursor(cursor_color)
def get_window_title(self):
"""Return the window title"""
@ -779,8 +734,8 @@ class Terminal(Gtk.VBox):
def on_group_button_press(self, widget, event):
"""Handler for the group button"""
if event.button == 1:
if event.type == Gdk._2BUTTON_PRESS or \
event.type == Gdk._3BUTTON_PRESS:
if event.type == Gdk.EventType._2BUTTON_PRESS or \
event.type == Gdk.EventType._3BUTTON_PRESS:
# Ignore these, or they make the interaction bad
return True
# Super key applies interaction to all terms in group
@ -930,9 +885,10 @@ class Terminal(Gtk.VBox):
rect = (0, 0, alloc.width, alloc.height)
if self.config['use_theme_colors']:
color = self.vte.get_style().text[Gtk.StateType.NORMAL]
color = self.vte.get_style_context().get_color(Gtk.StateType.NORMAL) # VERIFY FOR GTK3 as above
else:
color = Gdk.color_parse(self.config['foreground_color'])
color = Gdk.RGBA()
color.parse(self.config['foreground_color']) # VERIFY FOR GTK3
pos = self.get_location(widget, x, y)
topleft = (0, 0)
@ -1008,7 +964,7 @@ class Terminal(Gtk.VBox):
srchbox = widgetsrc
# The widget argument is actually a vte.Terminal(). Turn that into a
# The widget argument is actually a Vte.Terminal(). Turn that into a
# terminatorlib Terminal()
maker = Factory()
while True:
@ -1061,8 +1017,8 @@ class Terminal(Gtk.VBox):
def grab_focus(self):
"""Steal focus for this terminal"""
if not self.vte.flags()&Gtk.HAS_FOCUS:
self.vte.grab_focus()
# if not self.vte.flags()&Gtk.HAS_FOCUS: # VERIFY FOR GTK3: how to do this? or should we just simply omit this and grab unconditionally?
self.vte.grab_focus()
def ensure_visible_and_focussed(self):
"""Make sure that we're visible and focussed"""
@ -1140,7 +1096,7 @@ class Terminal(Gtk.VBox):
def on_vte_size_allocate(self, widget, allocation):
self.titlebar.update_terminal_size(self.vte.get_column_count(),
self.vte.get_row_count())
if self.vte.window and self.config['geometry_hinting']:
if self.config['geometry_hinting']:
window = self.get_toplevel()
window.deferred_set_rough_geometry_hints()
@ -1313,11 +1269,14 @@ class Terminal(Gtk.VBox):
envv.append('TERMINATOR_DBUS_PATH=%s' % self.terminator.dbus_path)
dbg('Forking shell: "%s" with args: %s' % (shell, args))
self.pid = self.vte.fork_command(command=shell, argv=args, envv=envv,
loglastlog=login,
logwtmp=update_records,
logutmp=update_records,
directory=self.cwd)
self.pid = self.vte.spawn_sync(Vte.PtyFlags.DEFAULT,
self.cwd,
args,
envv,
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
None,
None,
None)
self.command = shell
self.titlebar.update()
@ -1364,8 +1323,6 @@ class Terminal(Gtk.VBox):
def open_url(self, url, prepare=False):
"""Open a given URL, conditionally unpacking it from a VTE match"""
oldstyle = False
if prepare == True:
url = self.prepare_url(url)
dbg('open_url: URL: %s (prepared: %s)' % (url, prepare))
@ -1379,25 +1336,14 @@ class Terminal(Gtk.VBox):
except:
dbg('custom url handler did not work, falling back to defaults')
if Gtk.gtk_version < (2, 14, 0) or \
not hasattr(gtk, 'show_uri') or \
not hasattr(Gtk.gdk, 'CURRENT_TIME'):
oldstyle = True
Gtk.show_uri(None, url, Gdk.CURRENT_TIME)
if oldstyle == False:
try:
Gtk.show_uri(None, url, Gdk.CURRENT_TIME)
except:
oldstyle = True
if oldstyle == True:
dbg('Old gtk (%s,%s,%s), calling xdg-open' % Gtk.gtk_version)
try:
subprocess.Popen(["xdg-open", url])
except:
dbg('xdg-open did not work, falling back to webbrowser.open')
import webbrowser
webbrowser.open(url)
try:
subprocess.Popen(["xdg-open", url])
except:
dbg('xdg-open did not work, falling back to webbrowser.open')
import webbrowser
webbrowser.open(url)
def paste_clipboard(self, primary=False):
"""Paste one of the two clipboards"""
@ -1410,7 +1356,7 @@ class Terminal(Gtk.VBox):
def feed(self, text):
"""Feed the supplied text to VTE"""
self.vte.feed_child(text)
self.vte.feed_child(text, len(text))
def zoom_in(self):
"""Increase the font size"""
@ -1446,18 +1392,7 @@ class Terminal(Gtk.VBox):
def set_font(self, fontdesc):
"""Set the font we want in VTE"""
antialias = self.config['antialias']
if antialias:
try:
antialias = vte.ANTI_ALIAS_FORCE_ENABLE
except AttributeError:
antialias = 1
else:
try:
antialias = vte.ANTI_ALIAS_FORCE_DISABLE
except AttributeError:
antialias = 2
self.vte.set_font_full(fontdesc, antialias)
self.vte.set_font(fontdesc)
def get_cursor_position(self):
"""Return the co-ordinates of our cursor"""
@ -1475,7 +1410,7 @@ class Terminal(Gtk.VBox):
"""Return the column/rows of the terminal"""
return((self.vte.get_column_count(), self.vte.get_row_count()))
def on_beep(self, widget):
def on_bell(self, widget):
"""Set the urgency hint for our window"""
if self.config['urgent_bell'] == True:
window = self.get_toplevel()
@ -1592,10 +1527,10 @@ class Terminal(Gtk.VBox):
self.emit('navigate', 'right')
def key_split_horiz(self):
self.emit('split-horiz', self.terminator.pid_cwd(self.pid))
self.emit('split-horiz', self.get_cwd)
def key_split_vert(self):
self.emit('split-vert', self.terminator.pid_cwd(self.pid))
self.emit('split-vert', self.get_cwd)
def key_rotate_cw(self):
self.emit('rotate-cw')
@ -1697,7 +1632,7 @@ class Terminal(Gtk.VBox):
self.emit('ungroup-tab')
def key_new_window(self):
self.terminator.new_window(self.terminator.pid_cwd(self.pid))
self.terminator.new_window(self.get_cwd)
def key_new_terminator(self):
spawn_new_terminator(self.origcwd, ['-u'])

View File

@ -32,6 +32,7 @@ class TerminalPopupMenu(object):
terminal = self.terminal
menu = Gtk.Menu()
self.popup_menu = menu # from http://stackoverflow.com/questions/21960298/python-gtk3-right-click-menu -- is this the right way?
url = None
button = None
time = None
@ -46,7 +47,7 @@ class TerminalPopupMenu(object):
time = 0
button = 3
if url:
if url and url[0]:
dbg("URL matches id: %d" % url[1])
if not url[1] in terminal.matches.values():
err("Unknown URL match id: %d" % url[1])
@ -86,108 +87,108 @@ class TerminalPopupMenu(object):
icon = Gtk.Image.new_from_stock(Gtk.STOCK_JUMP_TO,
Gtk.IconSize.MENU)
item = Gtk.ImageMenuItem(nameopen)
item = Gtk.ImageMenuItem.new_with_mnemonic(nameopen)
item.set_property('image', icon)
item.connect('activate', lambda x: terminal.open_url(url, True))
menu.append(item)
item = Gtk.MenuItem(namecopy)
item = Gtk.MenuItem.new_with_mnemonic(namecopy)
item.connect('activate',
lambda x: terminal.clipboard.set_text(terminal.prepare_url(url)))
lambda x: terminal.clipboard.set_text(terminal.prepare_url(url), len(terminal.prepare_url(url))))
menu.append(item)
menu.append(Gtk.MenuItem())
item = Gtk.ImageMenuItem(Gtk.STOCK_COPY)
item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Copy'))
item.connect('activate', lambda x: terminal.vte.copy_clipboard())
item.set_sensitive(terminal.vte.get_has_selection())
menu.append(item)
item = Gtk.ImageMenuItem(Gtk.STOCK_PASTE)
item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Paste'))
item.connect('activate', lambda x: terminal.paste_clipboard())
menu.append(item)
menu.append(Gtk.MenuItem())
if not terminal.is_zoomed():
item = Gtk.ImageMenuItem(_('Split H_orizontally'))
item = Gtk.ImageMenuItem.new_with_mnemonic(_('Split H_orizontally'))
image = Gtk.Image()
image.set_from_icon_name(APP_NAME + '_horiz', Gtk.IconSize.MENU)
item.set_image(image)
if hasattr(item, 'set_always_show_image'):
item.set_always_show_image(True)
item.connect('activate', lambda x: terminal.emit('split-horiz',
self.terminator.pid_cwd(self.terminal.pid)))
self.terminal.get_cwd()))
menu.append(item)
item = Gtk.ImageMenuItem(_('Split V_ertically'))
item = Gtk.ImageMenuItem.new_with_mnemonic(_('Split V_ertically'))
image = Gtk.Image()
image.set_from_icon_name(APP_NAME + '_vert', Gtk.IconSize.MENU)
item.set_image(image)
if hasattr(item, 'set_always_show_image'):
item.set_always_show_image(True)
item.connect('activate', lambda x: terminal.emit('split-vert',
self.terminator.pid_cwd(self.terminal.pid)))
self.terminal.get_cwd()))
menu.append(item)
item = Gtk.MenuItem(_('Open _Tab'))
item = Gtk.MenuItem.new_with_mnemonic(_('Open _Tab'))
item.connect('activate', lambda x: terminal.emit('tab-new', False,
terminal))
menu.append(item)
if self.terminator.debug_address is not None:
item = Gtk.MenuItem(_('Open _Debug Tab'))
item = Gtk.MenuItem.new_with_mnemonic(_('Open _Debug Tab'))
item.connect('activate', lambda x:
terminal.emit('tab-new', True, terminal))
menu.append(item)
menu.append(Gtk.MenuItem())
item = Gtk.ImageMenuItem(Gtk.STOCK_CLOSE)
item = Gtk.ImageMenuItem.new_with_mnemonic(_('_Close'))
item.connect('activate', lambda x: terminal.close())
menu.append(item)
menu.append(Gtk.MenuItem())
if not terminal.is_zoomed():
item = Gtk.MenuItem(_('_Zoom terminal'))
item = Gtk.MenuItem.new_with_mnemonic(_('_Zoom terminal'))
item.connect('activate', terminal.zoom)
menu.append(item)
item = Gtk.MenuItem(_('Ma_ximise terminal'))
item = Gtk.MenuItem.new_with_mnemonic(_('Ma_ximise terminal'))
item.connect('activate', terminal.maximise)
menu.append(item)
menu.append(Gtk.MenuItem())
else:
item = Gtk.MenuItem(_('_Restore all terminals'))
item = Gtk.MenuItem.new_with_mnemonic(_('_Restore all terminals'))
item.connect('activate', terminal.unzoom)
menu.append(item)
menu.append(Gtk.MenuItem())
if self.config['show_titlebar'] == False:
item = Gtk.MenuItem(_('Grouping'))
item = Gtk.MenuItem.new_with_mnemonic(_('Grouping'))
submenu = self.terminal.populate_group_menu()
submenu.show_all()
item.set_submenu(submenu)
menu.append(item)
menu.append(Gtk.MenuItem())
item = Gtk.CheckMenuItem(_('Show _scrollbar'))
item = Gtk.CheckMenuItem.new_with_mnemonic(_('Show _scrollbar'))
item.set_active(terminal.scrollbar.get_property('visible'))
item.connect('toggled', lambda x: terminal.do_scrollbar_toggle())
menu.append(item)
if hasattr(gtk, 'Builder'):
item = Gtk.MenuItem(_('_Preferences'))
if hasattr(Gtk, 'Builder'): # VERIFY FOR GTK3: is this ever false?
item = Gtk.MenuItem.new_with_mnemonic(_('_Preferences'))
item.connect('activate', lambda x: PrefsEditor(self.terminal))
menu.append(item)
profilelist = self.config.list_profiles()
if len(profilelist) > 1:
item = Gtk.MenuItem(_('Profiles'))
item = Gtk.MenuItem.new_with_mnemonic(_('Profiles'))
submenu = Gtk.Menu()
item.set_submenu(submenu)
menu.append(item)
@ -197,7 +198,7 @@ class TerminalPopupMenu(object):
group = None
for profile in profilelist:
item = Gtk.RadioMenuItem(group, profile.capitalize())
item = Gtk.RadioMenuItem(profile.capitalize(), group)
if profile == current:
item.set_active(True)
item.connect('activate', terminal.force_set_profile, profile)
@ -222,7 +223,7 @@ class TerminalPopupMenu(object):
err('TerminalPopupMenu::show: %s' % ex)
menu.show_all()
menu.popup(None, None, None, button, time)
menu.popup(None, None, None, None, button, time)
return(True)
@ -231,7 +232,7 @@ class TerminalPopupMenu(object):
"""Add the encoding list to the menu"""
terminal = self.terminal
active_encodings = terminal.config['active_encodings']
item = Gtk.MenuItem (_("Encodings"))
item = Gtk.MenuItem.new_with_mnemonic(_("Encodings"))
menu.append (item)
submenu = Gtk.Menu ()
item.set_submenu (submenu)
@ -253,7 +254,7 @@ class TerminalPopupMenu(object):
else:
extratext = ""
radioitem = Gtk.RadioMenuItem (group, _(encoding) + extratext)
radioitem = Gtk.RadioMenuItem (_(encoding) + extratext, group)
if encoding == current_encoding:
radioitem.set_active (True)
@ -265,7 +266,7 @@ class TerminalPopupMenu(object):
encoding)
submenu.append (radioitem)
item = Gtk.MenuItem (_("Other Encodings"))
item = Gtk.MenuItem.new_with_mnemonic(_("Other Encodings"))
submenu.append (item)
#second level
@ -282,7 +283,7 @@ class TerminalPopupMenu(object):
else:
label = "%s %s" % (encoding[2], encoding[1])
radioitem = Gtk.RadioMenuItem (group, label)
radioitem = Gtk.RadioMenuItem (label, group)
if group is None:
group = radioitem

View File

@ -5,16 +5,30 @@
import copy
import os
from gi.repository import Gtk
from gi.repository import Gtk, Gdk
from borg import Borg
from config import Config
from keybindings import Keybindings
from util import dbg, err, enumerate_descendants
from factory import Factory
from cwd import get_pid_cwd
from version import APP_NAME, APP_VERSION
def eventkey2gdkevent(eventkey): # FIXME FOR GTK3: is there a simpler way of casting from specific EventKey to generic (union) GdkEvent?
gdkevent = Gdk.Event(eventkey.type)
gdkevent.key.type = eventkey.type
gdkevent.key.window = eventkey.window
gdkevent.key.send_event = eventkey.send_event
gdkevent.key.time = eventkey.time
gdkevent.key.state = eventkey.state
gdkevent.key.keyval = eventkey.keyval
gdkevent.key.length = eventkey.length
gdkevent.key.string = eventkey.string
gdkevent.key.hardware_keycode = eventkey.hardware_keycode
gdkevent.key.group = eventkey.group
gdkevent.key.is_modifier = eventkey.is_modifier
return gdkevent
class Terminator(Borg):
"""master object for the application"""
@ -29,7 +43,6 @@ class Terminator(Borg):
origcwd = None
dbus_path = None
dbus_name = None
pid_cwd = None
gnome_client = None
debug_address = None
@ -65,8 +78,6 @@ class Terminator(Borg):
self.keybindings.configure(self.config['keybindings'])
if not self.doing_layout:
self.doing_layout = False
if not self.pid_cwd:
self.pid_cwd = get_pid_cwd()
if self.gnome_client is None:
self.attempt_gnome_client()
@ -86,10 +97,9 @@ class Terminator(Borg):
def attempt_gnome_client(self):
"""Attempt to find a GNOME Session to register with"""
try:
import gnome
import gnome.ui
self.gnome_program = gnome.init(APP_NAME, APP_VERSION)
self.gnome_client = gnome.ui.master_client()
from gi.repository import Gnome
self.gnome_program = Gnome.init(APP_NAME, APP_VERSION) # VERIFY FOR GTK3
self.gnome_client = Gnome.Ui.master_client() # VERIFY FOR GTK3
self.gnome_client.connect_to_session_manager()
self.gnome_client.connect('save-yourself', self.save_yourself)
self.gnome_client.connect('die', self.die)
@ -409,13 +419,13 @@ class Terminator(Borg):
group)
for term in self.terminals:
if term != terminal and term.group == group:
term.vte.emit(type, event)
term.vte.emit(type, eventkey2gdkevent(event))
def all_emit(self, terminal, type, event):
"""Emit to all terminals"""
for term in self.terminals:
if term != terminal:
term.vte.emit(type, event)
term.vte.emit(type, eventkey2gdkevent(event))
def do_enumerate(self, widget, pad):
"""Insert the number of each terminal in a group, into that terminal"""

View File

@ -3,7 +3,7 @@
# GPL v2 only
"""titlebar.py - classes necessary to provide a terminal title bar"""
from gi.repository import Gtk
from gi.repository import Gtk, Gdk
from gi.repository import GObject
import random
import itertools
@ -41,7 +41,6 @@ class Titlebar(Gtk.EventBox):
def __init__(self, terminal):
"""Class initialiser"""
GObject.GObject.__init__(self)
self.__gobject_init__()
self.terminator = Terminator()
self.terminal = terminal
@ -82,8 +81,8 @@ class Titlebar(Gtk.EventBox):
self.bellicon.set_from_icon_name('terminal-bell', Gtk.IconSize.MENU)
hbox = Gtk.HBox()
hbox.pack_start(self.ebox, False, True, 0)
hbox.pack_start(Gtk.VSeparator(, True, True, 0), False, True, 0)
hbox.pack_start(self.label, True, True)
hbox.pack_start(Gtk.VSeparator(), False, True, 0)
hbox.pack_start(self.label, True, True, 0)
hbox.pack_end(self.bellicon, False, False, 2)
self.add(hbox)
@ -160,7 +159,7 @@ class Titlebar(Gtk.EventBox):
Gdk.color_parse(title_bg))
if not self.get_desired_visibility():
if default_bg == True:
color = term.get_style().bg[Gtk.StateType.NORMAL]
color = term.get_style_context().get_background_color(Gtk.StateType.NORMAL) # VERIFY FOR GTK3
else:
color = Gdk.color_parse(title_bg)
self.update_visibility()

View File

@ -142,9 +142,6 @@ def shell_lookup():
def widget_pixbuf(widget, maxsize=None):
"""Generate a pixbuf of a widget"""
if Gtk.gtk_version < (2, 14):
return(None)
pixmap = widget.get_snapshot()
(width, height) = pixmap.get_size()
pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, False, 8, width, height)

View File

@ -7,9 +7,9 @@ import copy
import time
import uuid
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gtk, Gdk
from gi.repository import Keybinder
from util import dbg, err, make_uuid
import util
@ -20,7 +20,7 @@ from factory import Factory
from terminator import Terminator
try:
import keybinder
from gi.repository import Keybinder
except ImportError:
err('Warning: python-keybinder is not installed. This means the \
hide_window shortcut will be unavailable')
@ -62,7 +62,7 @@ class Window(Container, Gtk.Window):
GObject.type_register(Window)
self.register_signals(Window)
self.set_property('allow-shrink', True)
# self.set_property('allow-shrink', True) # FIXME FOR GTK3, or do we need this actually?
icon_to_apply=''
self.register_callbacks()
@ -121,7 +121,7 @@ class Window(Container, Gtk.Window):
# If we fail, we'll never hide the window, iconifying instead.
if self.config['keybindings']['hide_window'] != None:
try:
self.hidebound = keybinder.bind(
self.hidebound = Keybinder.bind(
self.config['keybindings']['hide_window'],
self.on_hide_window)
except (KeyError, NameError):
@ -184,11 +184,11 @@ class Window(Container, Gtk.Window):
except (NameError, GObject.GError):
dbg('Unable to load 48px %s icon' % (repr(requested_icon)))
if icon is None:
try:
icon = icon_theme.load_icon(self.wmclass_name, 48, 0)
except (NameError, GObject.GError):
dbg('Unable to load 48px %s icon' % (self.wmclass_name))
# if icon is None:
# try:
# icon = icon_theme.load_icon(self.wmclass_name, 48, 0) # FIXME FOR GTK3
# except (NameError, GObject.GError):
# dbg('Unable to load 48px %s icon' % (self.wmclass_name))
if icon is None:
try:
@ -376,14 +376,11 @@ class Window(Container, Gtk.Window):
screen = self.get_screen()
if value:
dbg('setting rgba colormap')
colormap = screen.get_rgba_colormap()
else:
dbg('setting rgb colormap')
colormap = screen.get_rgb_colormap()
dbg('setting rgba visual')
visual = screen.get_rgba_visual()
if colormap:
self.set_colormap(colormap)
if visual:
self.set_visual(visual)
def show(self, startup=False):
"""Undo the startup show request if started in hidden mode"""
@ -652,8 +649,12 @@ class Window(Container, Gtk.Window):
dbg('setting geometry hints: (ewidth:%s)(eheight:%s),\
(fwidth:%s)(fheight:%s)' % (extra_width, extra_height,
font_width, font_height))
self.set_geometry_hints(self, -1, -1, -1, -1, extra_width,
extra_height, font_width, font_height, -1.0, -1.0)
geometry = Gdk.Geometry()
geometry.base_width = extra_width
geometry.base_height = extra_height
geometry.width_inc = font_width
geometry.height_inc = font_height
self.set_geometry_hints(self, geometry, Gdk.WindowHints.BASE_SIZE | Gdk.WindowHints.RESIZE_INC)
def tab_change(self, widget, num=None):
"""Change to a specific tab"""