prepare for landing

This commit is contained in:
Chris Jones 2008-05-21 00:37:04 +01:00
commit ffd1485d54
3 changed files with 40 additions and 46 deletions

View File

@ -84,8 +84,7 @@ setup(name='Terminator',
('share/icons/hicolor/24x24/apps', glob.glob('data/icons/24x24/apps/*.png')), ('share/icons/hicolor/24x24/apps', glob.glob('data/icons/24x24/apps/*.png')),
('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')), ('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')),
], ],
py_modules=['terminatorconfig'], py_modules=['terminatorconfig', 'terminatorencoding'],
py_modules=['terminatorencoding'],
cmdclass={'build': BuildData, 'install_data': InstallData} cmdclass={'build': BuildData, 'install_data': InstallData}
) )

View File

@ -103,11 +103,9 @@ class TerminatorTerm (gtk.VBox):
self._title.show() self._title.show()
self._titlebox = gtk.EventBox() self._titlebox = gtk.EventBox()
self._titlebox.add(self._title) self._titlebox.add(self._title)
self.show() self.show()
self.pack_start(self._titlebox, False) self.pack_start(self._titlebox, False)
self.pack_start(self._termbox) self.pack_start(self._termbox)
if len(self.terminator.term_list) > 0 and self.conf.titlebars: if len(self.terminator.term_list) > 0 and self.conf.titlebars:
if len(self.terminator.term_list) == 1: if len(self.terminator.term_list) == 1:
self.terminator.term_list[0]._titlebox.show() self.terminator.term_list[0]._titlebox.show()
@ -150,12 +148,10 @@ class TerminatorTerm (gtk.VBox):
self.add_matches() self.add_matches()
env_proxy = os.getenv ('http_proxy') env_proxy = os.getenv ('http_proxy')
if not env_proxy: if not env_proxy and self.conf.http_proxy:
os.putenv ('http_proxy', self.conf.http_proxy) os.putenv ('http_proxy', self.conf.http_proxy)
if self.spawn_child () == -1: os.putenv ('COLORTERM', 'gnome-terminal')
# We failed to usefully create a child shell, we need to kill ourself
gobject.timeout_add (100, self.terminator.closeterm, self)
def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"): def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"):
userchars = "-A-Za-z0-9" userchars = "-A-Za-z0-9"
@ -209,11 +205,14 @@ class TerminatorTerm (gtk.VBox):
if not os.path.exists (shell): if not os.path.exists (shell):
# Give up, we're completely stuck # Give up, we're completely stuck
print >> sys.stderr, _('Unable to find a shell') print >> sys.stderr, _('Unable to find a shell')
gobject.timeout_add (100, self.terminator.closeterm, self)
return (-1) return (-1)
if not args: if not args:
args.append (shell) args.append (shell)
os.putenv ('WINDOWID', '%s'%self._vte.get_parent_window().xid)
self._pid = self._vte.fork_command (command = shell, argv = args, envv = [], directory=self.cwd, 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)
if self._pid == -1: if self._pid == -1:
@ -524,6 +523,8 @@ class TerminatorTerm (gtk.VBox):
item.connect ("toggled", lambda menu_item: self.do_title_toggle ()) item.connect ("toggled", lambda menu_item: self.do_title_toggle ())
menu.append (item) menu.append (item)
self._do_encoding_items (menu)
item = gtk.MenuItem () item = gtk.MenuItem ()
menu.append (item) menu.append (item)
@ -535,8 +536,6 @@ class TerminatorTerm (gtk.VBox):
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True)) item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True))
menu.append (item) menu.append (item)
self._do_encoding_items(menu)
item = gtk.MenuItem () item = gtk.MenuItem ()
menu.append (item) menu.append (item)
@ -547,25 +546,22 @@ class TerminatorTerm (gtk.VBox):
menu.show_all () menu.show_all ()
return menu return menu
def on_encoding_change (self, widget, encoding): def on_encoding_change (self, widget, encoding):
current = self._vte.get_encoding () current = self._vte.get_encoding ()
if current != encoding: if current != encoding:
print ('Setting Encoding to ' + encoding) dbg ('Setting Encoding to: %s'%encoding)
self._vte.set_encoding (encoding) self._vte.set_encoding (encoding)
def _do_encoding_items (self, menu): def _do_encoding_items (self, menu):
active_encodings = self.conf.active_encodings
item = gtk.MenuItem (_("Encodings")) item = gtk.MenuItem (_("Encodings"))
menu.append (item) menu.append (item)
submenu = gtk.Menu () submenu = gtk.Menu ()
item.set_submenu (submenu) item.set_submenu (submenu)
current_encoding = self._vte.get_encoding () current_encoding = self._vte.get_encoding ()
group = None group = None
for encoding in self.conf.active_encodings: for encoding in active_encodings:
radioitem = gtk.RadioMenuItem (group, _(encoding)) radioitem = gtk.RadioMenuItem (group, _(encoding))
if group is None: if group is None:
group = radioitem group = radioitem
@ -585,15 +581,16 @@ class TerminatorTerm (gtk.VBox):
encodings = TerminatorEncoding ().get_list () encodings = TerminatorEncoding ().get_list ()
encodings.sort (lambda x, y: cmp (x[2].lower (), y[2].lower ())) encodings.sort (lambda x, y: cmp (x[2].lower (), y[2].lower ()))
group = None group = None
for encoding in encodings: for encoding in encodings:
if encoding[1] in self.conf.active_encodings: if encoding[1] in active_encodings:
#already in active_encodings #already in active_encodings
continue continue
label = "" label = ""
if encoding[1] is None: if encoding[1] is None:
label = encoding[2]+" "+self._vte.get_encoding() label = "%s %s"%(encoding[2], self._vte.get_encoding ())
else: else:
label = encoding[2]+" "+encoding[1] label = "%s %s"%(encoding[2], encoding[1])
radioitem = gtk.RadioMenuItem (group, label) radioitem = gtk.RadioMenuItem (group, label)
if group is None: if group is None:
@ -605,8 +602,6 @@ class TerminatorTerm (gtk.VBox):
radioitem.connect ('activate', self.on_encoding_change, encoding[1]) radioitem.connect ('activate', self.on_encoding_change, encoding[1])
submenu.append (radioitem) submenu.append (radioitem)
def on_vte_title_change(self, vte): def on_vte_title_change(self, vte):
if self.conf.titletips: if self.conf.titletips:
vte.set_property ("has-tooltip", True) vte.set_property ("has-tooltip", True)
@ -688,6 +683,7 @@ class Terminator:
self.window.add (term) self.window.add (term)
self.window.show () self.window.show ()
term.spawn_child ()
def maximize (self): def maximize (self):
""" Maximize the Terminator window.""" """ Maximize the Terminator window."""
@ -805,6 +801,7 @@ class Terminator:
pane.show () pane.show ()
pane.set_position (position / 2) pane.set_position (position / 2)
terminal.show () terminal.show ()
terminal.spawn_child ()
# insert the term reference into the list # insert the term reference into the list
index = self.term_list.index (widget) index = self.term_list.index (widget)

View File

@ -243,8 +243,6 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
else: else:
value = self.client.get ('%s/%s'%(self.profile, key)) value = self.client.get ('%s/%s'%(self.profile, key))
if value: if value:
funcname = "get_" + self.defaults[key].__class__.__name__ funcname = "get_" + self.defaults[key].__class__.__name__
dbg (' GConf: picked function: %s'%funcname) dbg (' GConf: picked function: %s'%funcname)