Replace the get_top_window with the much quicker builtin get_toplevel widget call
This commit is contained in:
parent
b3bee59c9d
commit
05520fd5a7
|
@ -12,7 +12,7 @@ from factory import Factory
|
|||
from container import Container
|
||||
from editablelabel import EditableLabel
|
||||
from translation import _
|
||||
from util import err, dbg, get_top_window, enumerate_descendants
|
||||
from util import err, dbg, enumerate_descendants
|
||||
|
||||
class Notebook(Container, gtk.Notebook):
|
||||
"""Class implementing a gtk.Notebook container"""
|
||||
|
@ -173,7 +173,7 @@ class Notebook(Container, gtk.Notebook):
|
|||
def newtab(self, debugtab=False, widget=None, cwd=None):
|
||||
"""Add a new tab, optionally supplying a child widget"""
|
||||
maker = Factory()
|
||||
top_window = get_top_window(self)
|
||||
top_window = self.get_toplevel()
|
||||
|
||||
if not widget:
|
||||
widget = maker.make('Terminal')
|
||||
|
|
|
@ -7,7 +7,7 @@ variants"""
|
|||
import gobject
|
||||
import gtk
|
||||
|
||||
from util import dbg, err, get_top_window
|
||||
from util import dbg, err
|
||||
from terminator import Terminator
|
||||
from factory import Factory
|
||||
from container import Container
|
||||
|
@ -86,7 +86,7 @@ class Paned(Container):
|
|||
raise ValueError('Paned widgets can only have two children')
|
||||
|
||||
if maker.isinstance(widget, 'Terminal'):
|
||||
top_window = get_top_window(self)
|
||||
top_window = self.get_toplevel()
|
||||
signals = {'close-term': self.wrapcloseterm,
|
||||
'split-horiz': self.split_horiz,
|
||||
'split-vert': self.split_vert,
|
||||
|
|
|
@ -15,7 +15,7 @@ import pango
|
|||
import subprocess
|
||||
import urllib
|
||||
|
||||
from util import dbg, err, gerr, get_top_window
|
||||
from util import dbg, err, gerr
|
||||
import util
|
||||
from config import Config
|
||||
from cwd import get_default_cwd
|
||||
|
@ -960,7 +960,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
|
||||
def ensure_visible_and_focussed(self):
|
||||
"""Make sure that we're visible and focussed"""
|
||||
window = util.get_top_window(self)
|
||||
window = self.get_toplevel()
|
||||
topchild = window.get_child()
|
||||
maker = Factory()
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
self.titlebar.update_terminal_size(self.vte.get_column_count(),
|
||||
self.vte.get_row_count())
|
||||
if self.vte.window and self.config['geometry_hinting']:
|
||||
window = util.get_top_window(self)
|
||||
window = self.get_toplevel()
|
||||
window.set_rough_geometry_hints()
|
||||
|
||||
def on_vte_notify_enter(self, term, event):
|
||||
|
@ -1078,7 +1078,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
"""Determine if we are a zoomed terminal"""
|
||||
prop = None
|
||||
parent = self.get_parent()
|
||||
window = get_top_window(self)
|
||||
window = self.get_toplevel()
|
||||
|
||||
try:
|
||||
prop = window.get_property('term-zoomed')
|
||||
|
@ -1312,7 +1312,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
def on_beep(self, widget):
|
||||
"""Set the urgency hint for our window"""
|
||||
if self.config['urgent_bell'] == True:
|
||||
window = util.get_top_window(self)
|
||||
window = self.get_toplevel()
|
||||
window.set_urgency_hint(True)
|
||||
if self.config['icon_bell'] == True:
|
||||
self.titlebar.icon_bell()
|
||||
|
|
|
@ -89,14 +89,6 @@ def has_ancestor(widget, wtype):
|
|||
return(True)
|
||||
return(False)
|
||||
|
||||
def get_top_window(widget):
|
||||
"""Return the Window instance a widget belongs to"""
|
||||
parent = widget.get_parent()
|
||||
while parent:
|
||||
widget = parent
|
||||
parent = widget.get_parent()
|
||||
return(widget)
|
||||
|
||||
def path_lookup(command):
|
||||
'''Find a command in our path'''
|
||||
if os.path.isabs(command):
|
||||
|
|
Loading…
Reference in New Issue