Gdk.Cursor.new() deprecation fixes

This commit is contained in:
prculley 2016-06-28 16:24:21 -05:00 committed by Nick Hall
parent 1abc0ad1fa
commit 55c99fe718
11 changed files with 64 additions and 21 deletions

View File

@ -110,6 +110,7 @@ BACKEND_COL = 7
RCS_BUTTON = {True : _('_Extract'), False : _('_Archive')}
class Information(ManagedWindow):
def __init__(self, uistate, data, parent):
super().__init__(uistate, [], self)
self.window = Gtk.Dialog()
@ -154,6 +155,9 @@ class DbManager(CLIDbManager):
ERROR = ErrorDialog
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH)
def __init__(self, uistate, dbstate, parent=None):
"""
Create the top level window from the glade description, and extracts
@ -936,7 +940,7 @@ class DbManager(CLIDbManager):
message
"""
self.msg.set_label(msg)
self.top.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self.top.get_window().set_cursor(self.BUSY_CURSOR)
while Gtk.events_pending():
Gtk.main_iteration()

View File

@ -386,7 +386,8 @@ class DisplayState(Callback):
'Note': _("No active note"),
}
BUSY_CURSOR = Gdk.Cursor.new(Gdk.CursorType.WATCH)
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH)
def __init__(self, window, status, uimanager, viewmanager=None):

View File

@ -759,8 +759,12 @@ class ToolManagedWindowBase(ManagedWindow):
self.results_text.connect('motion-notify-event',
self.on_motion)
self.tags = []
self.link_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
self.standard_cursor = Gdk.Cursor.new(Gdk.CursorType.XTERM)
self.link_cursor = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.LEFT_PTR)
self.standard_cursor = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.XTERM)
self.setup_other_frames()
self.set_current_frame(self.initial_frame())

View File

@ -625,8 +625,11 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
a part of ManagedWindow
"""
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH)
if value:
self.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self.get_window().set_cursor(BUSY_CURSOR)
#self.set_sensitive(0)
else:
self.get_window().set_cursor(None)

View File

@ -46,7 +46,8 @@ from gramps.gen.constfunc import has_display
#
#-------------------------------------------------------------------------
if has_display():
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
HAND_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.HAND2)
#-------------------------------------------------------------------------
#

View File

@ -197,14 +197,30 @@ GRABBERS_SWITCH = [
# cursors
try:
CURSOR_UPPER = Gdk.Cursor.new(Gdk.CursorType.TOP_SIDE)
CURSOR_LOWER = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_SIDE)
CURSOR_LEFT = Gdk.Cursor.new(Gdk.CursorType.LEFT_SIDE)
CURSOR_RIGHT = Gdk.Cursor.new(Gdk.CursorType.RIGHT_SIDE)
CURSOR_UPPER_LEFT = Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_CORNER)
CURSOR_UPPER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.TOP_RIGHT_CORNER)
CURSOR_LOWER_LEFT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_LEFT_CORNER)
CURSOR_LOWER_RIGHT = Gdk.Cursor.new(Gdk.CursorType.BOTTOM_RIGHT_CORNER)
CURSOR_UPPER = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.TOP_SIDE)
CURSOR_LOWER = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.BOTTOM_SIDE)
CURSOR_LEFT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.LEFT_SIDE)
CURSOR_RIGHT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.RIGHT_SIDE)
CURSOR_UPPER_LEFT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.TOP_LEFT_CORNER)
CURSOR_UPPER_RIGHT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.TOP_RIGHT_CORNER)
CURSOR_LOWER_LEFT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.BOTTOM_LEFT_CORNER)
CURSOR_LOWER_RIGHT = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.BOTTOM_RIGHT_CORNER)
except:
CURSOR_UPPER = None
CURSOR_LOWER = None

View File

@ -372,8 +372,12 @@ class GuiGramplet:
self.pui = None # user code
self.tooltips_text = None
self.link_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
self.standard_cursor = Gdk.Cursor.new(Gdk.CursorType.XTERM)
self.link_cursor = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.LEFT_PTR)
self.standard_cursor = \
Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.XTERM)
self.scrolledwindow = None
self.textview = None

View File

@ -56,7 +56,8 @@ from ..utils import rgb_to_hex
#
#-------------------------------------------------------------------------
if has_display():
HAND_CURSOR = Gdk.Cursor.new(Gdk.CursorType.HAND2)
HAND_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.HAND2)
#-------------------------------------------------------------------------
#

View File

@ -61,6 +61,9 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
OBJ_TYPE_COL = 3
OBJ_HANDLE_COL = 4
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH)
def __init__(self, dbstate, user, options_class, name, callback=None):
uistate = user.uistate
self.title = _('Unused Objects')
@ -236,7 +239,7 @@ class RemoveUnused(tool.Tool, ManagedWindow, UpdateCallback):
self.uistate.set_busy_cursor(True)
self.uistate.progress.show()
self.window.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self.window.get_window().set_cursor(self.BUSY_CURSOR)
self.real_model.clear()
self.collect_unused()

View File

@ -349,9 +349,11 @@ class Verify(tool.Tool, ManagedWindow, UpdateCallback):
self.uistate.set_busy_cursor(True)
self.uistate.progress.show()
self.window.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
BUSY_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.WATCH)
self.window.get_window().set_cursor(BUSY_CURSOR)
try:
self.vr.window.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH))
self.vr.window.get_window().set_cursor(BUSY_CURSOR)
except AttributeError:
pass

View File

@ -508,6 +508,10 @@ class PedigreeView(NavigationView):
('interface.pedview-show-unknown-people', True),
)
FLEUR_CURSOR = Gdk.Cursor.new_for_display(Gdk.Display.get_default(),
Gdk.CursorType.FLEUR)
def __init__(self, pdata, dbstate, uistate, nav_group=0):
NavigationView.__init__(self, _('Pedigree'), pdata, dbstate, uistate,
PersonBookmarks, nav_group)
@ -1325,7 +1329,7 @@ class PedigreeView(NavigationView):
or call option menu.
"""
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
widget.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.FLEUR))
widget.get_window().set_cursor(self.FLEUR_CURSOR)
self._last_x = event.x
self._last_y = event.y
self._in_move = True