Make pygtk 2.14 failures more graceful
This commit is contained in:
parent
0b3cb3df9b
commit
63a17a88b4
@ -1661,17 +1661,21 @@ text/plain
|
||||
# Center it over the current terminal (not perfect?!?)
|
||||
# This could be replaced by a less bothersome dialog, but then that would
|
||||
# center over the window, not the terminal
|
||||
screen_w = gtk.gdk.screen_width()
|
||||
screen_h = gtk.gdk.screen_height()
|
||||
local_x, local_y = self.allocation.x, self.allocation.y
|
||||
local_w, local_h = self.allocation.width, self.allocation.height
|
||||
window_x, window_y = self.get_window().get_origin()
|
||||
x = window_x + local_x
|
||||
y = window_y + local_y
|
||||
win.realize()
|
||||
new_x = min(max(0, x+(local_w/2)-(win.allocation.width/2)), screen_w-win.allocation.width)
|
||||
new_y = min(max(0, y+(local_h/2)-(win.allocation.height/2)), screen_h-win.allocation.height)
|
||||
win.move(new_x, new_y)
|
||||
try:
|
||||
screen_w = gtk.gdk.screen_width()
|
||||
screen_h = gtk.gdk.screen_height()
|
||||
local_x, local_y = self.allocation.x, self.allocation.y
|
||||
local_w, local_h = self.allocation.width, self.allocation.height
|
||||
window_x, window_y = self.get_window().get_origin()
|
||||
x = window_x + local_x
|
||||
y = window_y + local_y
|
||||
win.realize()
|
||||
new_x = min(max(0, x+(local_w/2)-(win.allocation.width/2)), screen_w-win.allocation.width)
|
||||
new_y = min(max(0, y+(local_h/2)-(win.allocation.height/2)), screen_h-win.allocation.height)
|
||||
win.move(new_x, new_y)
|
||||
except AttributeError:
|
||||
# Old pygtk has no gtk.Widget.get_window()
|
||||
pass
|
||||
|
||||
win.show_all ()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user