merging drag-and-drop to trunk tree

This commit is contained in:
Emmanuel Bretelle 2008-02-25 01:03:39 +00:00
commit 95059747fb
3 changed files with 129 additions and 95 deletions

View File

@ -7,13 +7,14 @@ terminator 0.9:
terminator 0.8.1: terminator 0.8.1:
* Fixed ChangeLog * Fixed ChangeLog
* Revert URI matching behaviour to the same as gnome-terminal * Revert URI matching behaviour to the same as gnome-terminal
* Close LP #179315 with a fuller fix that provides proper colour support
terminator 0.8: terminator 0.8:
* Make dependency on python-gnome optional. Non-gnome users can now reap * Make dependency on python-gnome optional. Non-gnome users can now reap
the glorious benefits of Terminator and will only lose the ability to the glorious benefits of Terminator and will only lose the ability to
open email URLs (assuming their browser won't handle this for them). open email URLs (assuming their browser won't handle this for them).
Closes LP #184809 Closes LP #184809
* Remove blank translations from .desktop file to fix empty menu entries * Remove blank translations from .desktop file to fix empty menu entries.
Closes LP #187187 Closes LP #187187
* Add application icon at various sizes including a window icon * Add application icon at various sizes including a window icon
* New options parser allowing -x support. Closes LP191124 * New options parser allowing -x support. Closes LP191124

View File

@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-29 23:57+0000\n" "POT-Creation-Date: 2008-01-29 23:57+0000\n"
"PO-Revision-Date: 2008-01-15 00:09+0000\n" "PO-Revision-Date: 2008-02-15 14:25+0000\n"
"Last-Translator: Nicolas Valcárcel <nvalcarcel@ubuntu-pe.org>\n" "Last-Translator: Nicolas Valcárcel <nvalcarcel@ubuntu-pe.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-02-14 23:16+0000\n" "X-Launchpad-Export-Date: 2008-02-19 23:16+0000\n"
"X-Generator: Launchpad (build Unknown)\n" "X-Generator: Launchpad (build Unknown)\n"
#: terminator:44 #: terminator:44
@ -22,23 +22,30 @@ msgid ""
"You need to install the python bindings for gobject, gtk, gconf and pango to " "You need to install the python bindings for gobject, gtk, gconf and pango to "
"run Terminator." "run Terminator."
msgstr "" msgstr ""
"Necesitas instalar los lazos python para gobject, gtk, gconf y pango para "
"ejecutar Terminator"
#: terminator:63 #: terminator:63
msgid "" msgid ""
"You need to install python bindings for libvte (\"python-vte\" in " "You need to install python bindings for libvte (\"python-vte\" in "
"debian/ubuntu)" "debian/ubuntu)"
msgstr "" msgstr ""
"Necesitas instalar lazos python para libvte (\"python-vte\" en debian/ubuntu)"
#: terminator:127 #: terminator:127
#, python-format #, python-format
msgid "Warning: unable to find profile %s. Continue with default values..." msgid "Warning: unable to find profile %s. Continue with default values..."
msgstr "" msgstr ""
"Advertencia: No es posible encontrar perfil %s. Continuar con valores por "
"defecto..."
#: terminator:213 #: terminator:213
msgid "" msgid ""
"Unknown value requested. Unable to find in gconf profile or default " "Unknown value requested. Unable to find in gconf profile or default "
"settings: " "settings: "
msgstr "" msgstr ""
"Valor desconocido requerido. No se pudo encontrar en perfil gconf o valores "
"por defecto "
#: terminator:414 #: terminator:414
msgid "_Open Link" msgid "_Open Link"

View File

@ -18,7 +18,7 @@
"""Terminator by Chris Jones <cmsj@tenshu.net>""" """Terminator by Chris Jones <cmsj@tenshu.net>"""
# import standard python libs # import standard python libs
import os, sys, string, time, math import os, platform, sys, string, time, math
from optparse import OptionParser from optparse import OptionParser
import gettext import gettext
@ -85,7 +85,7 @@ class TerminatorTerm:
'scroll_on_output' : False, 'scroll_on_output' : False,
'scrollback_lines' : 100, 'scrollback_lines' : 100,
'focus' : 'sloppy', 'focus' : 'sloppy',
'child_restart' : False, 'exit_action' : 'close',
'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF', 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF',
'word_chars' : '-A-Za-z0-9,./?%&#:_', 'word_chars' : '-A-Za-z0-9,./?%&#:_',
'mouse_autohide' : True, 'mouse_autohide' : True,
@ -104,14 +104,15 @@ class TerminatorTerm:
matches = {} matches = {}
def __init__ (self, terminator, profile = None, command = None, cwd = None):
def __init__ (self, terminator, profile = None, command = None):
self.defaults['profile_dir'] = self.defaults['_profile_dir']%(self.defaults['gt_dir']) self.defaults['profile_dir'] = self.defaults['_profile_dir']%(self.defaults['gt_dir'])
self.terminator = terminator self.terminator = terminator
self.gconf_client = gconf.client_get_default () self.gconf_client = gconf.client_get_default ()
self.command = command self.command = command
self.cwd = cwd or os.getcwd();
if profile == None: if profile == None:
profile = self.gconf_client.get_string (self.defaults['gt_dir'] + '/global/default_profile') profile = self.gconf_client.get_string (self.defaults['gt_dir'] + '/global/default_profile')
@ -147,7 +148,7 @@ class TerminatorTerm:
self._box.show () self._box.show ()
self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ()) self._scrollbar = gtk.VScrollbar (self._vte.get_adjustment ())
if self.scrollbar_position != "hidden": if self.scrollbar_position != "hidden" and self.scrollbar_position != "disabled":
self._scrollbar.show () self._scrollbar.show ()
if self.scrollbar_position == 'right': if self.scrollbar_position == 'right':
@ -171,22 +172,18 @@ class TerminatorTerm:
#for testing purpose: drag-motion #for testing purpose: drag-motion
self._vte.connect("drag-motion", self.on_drag_motion) self._vte.connect("drag-motion", self.on_drag_motion)
self._vte.connect("drag-data-received", self.on_drag_data_received, self) self._vte.connect("drag-data-received", self.on_drag_data_received, self)
self._vte.connect ("composited-changed", self.on_composited_changed)
# self._vte.connect ("window-title-changed", self.on_vte_title_change) # self._vte.connect ("window-title-changed", self.on_vte_title_change)
exit_action = self.gconf_client.get_string (self.profile + "/exit_action") exit_action = self.gconf_client.get_string (self.profile + "/exit_action")
if not exit_action: exit_action = self.reconf ("exit_action")
if self.defaults['child_restart']:
exit_action = "restart"
else:
exit_action = "close"
if exit_action == "restart": if exit_action == "restart":
self._vte.connect ("child-exited", self.spawn_child) self._vte.connect ("child-exited", self.spawn_child)
#gnome-terminal Bug: http://bugzilla.gnome.org/show_bug.cgi?id=518184 # We need to support "left" because some buggy versions of gnome-terminal
#/apps/gnome-terminal/profiles/<profile name>/exit_action might be # set it in some situations
#set to "left" instead of close
# LP#194771
if exit_action in ("close", "left"): if exit_action in ("close", "left"):
self._vte.connect ("child-exited", lambda close_term: self.terminator.closeterm (self)) self._vte.connect ("child-exited", lambda close_term: self.terminator.closeterm (self))
@ -357,7 +354,21 @@ class TerminatorTerm:
shell = pwd.getpwuid (os.getuid ())[6] shell = pwd.getpwuid (os.getuid ())[6]
args = [os.path.basename (shell)] args = [os.path.basename (shell)]
self._vte.fork_command (command = shell, argv = args, envv = [], loglastlog = login, logwtmp = update_records, logutmp = update_records) self._pid = self._vte.fork_command (command = shell, argv = args, envv = [], directory=self.cwd, loglastlog = login, logwtmp = update_records, logutmp = update_records)
def get_cwd (self):
""" Return the current working directory of the subprocess.
This function requires OS specific behaviours
"""
system = platform.system ()
if system == 'Linux':
cwd = os.path.realpath ('/proc/%s/cwd' % self._pid)
else:
# We don't have a child cwd getter for this platform, so let
# TerminatorTerm use its default
cwd = None
return (cwd)
def reconf (self, property): def reconf (self, property):
value = self.gconf_client.get ('%s/%s'%(self.profile, property)) value = self.gconf_client.get ('%s/%s'%(self.profile, property))
@ -448,8 +459,13 @@ class TerminatorTerm:
self._vte.set_scroll_background (self.reconf ('scroll_background')) self._vte.set_scroll_background (self.reconf ('scroll_background'))
self._vte.set_background_transparent (False) self._vte.set_background_transparent (False)
if background_type == "transparent": if background_type == "transparent":
darkness = self.reconf ('background_darkness')
if self._vte.is_composited():
self._vte.set_background_transparent (False)
self._vte.set_opacity(int(darkness * 65535))
else:
self._vte.set_background_transparent (True) self._vte.set_background_transparent (True)
self._vte.set_background_saturation (1 - (self.reconf ('background_darkness'))) self._vte.set_background_saturation (1 - darkness)
colors = palette.split (':') colors = palette.split (':')
palette = [] palette = []
@ -474,7 +490,7 @@ class TerminatorTerm:
scrollbar_position = self.reconf ('scrollbar_position') scrollbar_position = self.reconf ('scrollbar_position')
if scrollbar_position != self.scrollbar_position: if scrollbar_position != self.scrollbar_position:
if scrollbar_position == 'hidden': if scrollbar_position == 'hidden' or scrollbar_position == 'disabled':
self._scrollbar.hide () self._scrollbar.hide ()
else: else:
self._scrollbar.show () self._scrollbar.show ()
@ -497,6 +513,9 @@ class TerminatorTerm:
def on_gconf_notification (self, client, cnxn_id, entry, what): def on_gconf_notification (self, client, cnxn_id, entry, what):
self.reconfigure_vte () self.reconfigure_vte ()
def on_composited_changed (self, widget):
self.reconfigure_vte ()
def on_vte_button_press (self, term, event): def on_vte_button_press (self, term, event):
# Left mouse button should transfer focus to this vte widget # Left mouse button should transfer focus to this vte widget
if event.button == 1: if event.button == 1:
@ -696,6 +715,13 @@ class Terminator:
self.window.set_property ('allow-shrink', True) self.window.set_property ('allow-shrink', True)
# Set RGBA colormap if possible so VTE can use real alpha
# channels for transparency.
screen = self.window.get_screen()
colormap = screen.get_rgba_colormap()
if colormap:
self.window.set_colormap(colormap)
# Start out with just one terminal # Start out with just one terminal
# FIXME: This should be really be decided from some kind of profile # FIXME: This should be really be decided from some kind of profile
term = (TerminatorTerm (self, self.profile, self.command)) term = (TerminatorTerm (self, self.profile, self.command))
@ -781,7 +807,7 @@ class Terminator:
""" Split the provided widget on the horizontal or vertical axis. """ """ Split the provided widget on the horizontal or vertical axis. """
# create a new terminal and parent pane. # create a new terminal and parent pane.
terminal = TerminatorTerm (self, self.profile, None) terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
pane = (vertical) and gtk.VPaned () or gtk.HPaned () pane = (vertical) and gtk.VPaned () or gtk.HPaned ()
# get the parent of the provided terminal # get the parent of the provided terminal