Commit 5f5a5e5c authored by Cédric Bellegarde's avatar Cédric Bellegarde

Warn user about broken cursor themes. Fix #1546

parent 7be2cff3
Pipeline #41546 passed with stage
in 10 minutes and 23 seconds
......@@ -14,6 +14,7 @@ from gi.repository import Gtk, Gdk, GLib
from gettext import gettext as _
from lollypop.logger import Logger
from lollypop.pop_artwork import CoversPopover
from lollypop.define import App
......@@ -106,9 +107,12 @@ class OverlayHelper:
Change cursor over eventbox
@param eventbox as Gdk.Eventbox
"""
window = eventbox.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
window = eventbox.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
def _on_enter_notify_timeout(self):
"""
......
......@@ -12,6 +12,9 @@
from gi.repository import Gtk, Gdk
from gettext import gettext as _
from lollypop.logger import Logger
from lollypop.controller_information import InformationController
from lollypop.controller_progress import ProgressController
from lollypop.define import App, WindowSize
......@@ -113,7 +116,10 @@ class MiniPlayer(Gtk.Bin, InformationController, ProgressController):
Set mouse cursor
@param eventbox as Gtk.EventBox
"""
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
#######################
# PRIVATE #
......
......@@ -173,7 +173,10 @@ class InformationPopover(Gtk.Popover):
"""
@param eventbox as Gtk.EventBox
"""
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
#######################
# PRIVATE #
......
......@@ -12,6 +12,9 @@
from gi.repository import Gtk, Gdk, GLib
from gettext import gettext as _
from lollypop.logger import Logger
from lollypop.controller_information import InformationController
from lollypop.define import App, Type
......@@ -110,7 +113,10 @@ class ToolbarInfo(Gtk.Bin, InformationController):
"""
Show hand cursor over
"""
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
#######################
# PRIVATE #
......
......@@ -124,15 +124,22 @@ class ArtistView(ArtistAlbumsView):
Change cursor on label
@param eventbox as Gtk.EventBox
"""
if len(self._artist_ids) == 1:
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
if len(self._artist_ids) == 1:
eventbox.get_window().set_cursor(
Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
def _on_artwork_box_realize(self, eventbox):
"""
Change cursor on image
@param eventbox as Gtk.EventBox
"""
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
eventbox.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
def _on_label_button_release(self, eventbox, event):
"""
......
......@@ -14,6 +14,7 @@ from gi.repository import Gdk, Gtk, GLib
from gettext import gettext as _
from lollypop.logger import Logger
from lollypop.define import App, Type, ArtSize
from lollypop.widgets_albums_rounded import RoundedAlbumsWidget
from lollypop.helper_overlay import OverlayHelper
......@@ -159,6 +160,9 @@ class AlbumsDecadeWidget(RoundedAlbumsWidget, OverlayHelper):
Change cursor over eventbox
@param eventbox as Gdk.Eventbox
"""
window = eventbox.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
window = eventbox.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
......@@ -20,6 +20,7 @@ from lollypop.utils import get_icon_name
from lollypop.objects import Album
from lollypop.widgets_flowbox_rounded import RoundedFlowBoxWidget
from lollypop.helper_art import ArtHelper, ArtHelperEffect
from lollypop.logger import Logger
class RoundedArtistWidget(RoundedFlowBoxWidget):
......@@ -150,9 +151,12 @@ class RoundedArtistWidget(RoundedFlowBoxWidget):
Change cursor over eventbox
@param widget as Gtk.Widget
"""
window = widget.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
try:
window = widget.get_window()
if window is not None:
window.set_cursor(Gdk.Cursor(Gdk.CursorType.HAND2))
except:
Logger.warning(_("You are using a broken cursor theme!"))
def __on_artwork_set(self, image, spec):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment