[Stats] Fix cairo error and failing tests
Fixed the Stats GTKUI test not updated to the new GTK3 dir layout. Fixed pygobject cairo ImageSurface error: AttributeError: 'gi.repository.cairo' object has no attribute 'ImageSurface' The documentation seems to suggest that using `import cairo` is the correct usage and this fixed the issue, along with adding suggested gi.require_foreign call. References: https://pygobject.readthedocs.io/en/latest/guide/cairo_integration.html
This commit is contained in:
parent
54674576db
commit
88fc21e993
|
@ -20,7 +20,11 @@ import logging
|
|||
import math
|
||||
import time
|
||||
|
||||
from gi.repository import cairo
|
||||
import gi
|
||||
|
||||
gi.require_foreign('cairo') # NOQA: E402
|
||||
|
||||
import cairo # isort:skip (gi checks required before import).
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -75,14 +75,14 @@ class StatsTestCase(BaseTestCase):
|
|||
from deluge_stats import graph, gtkui
|
||||
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
|
||||
from deluge.ui.gtkui.mainwindow import MainWindow
|
||||
from deluge.ui.gtkui.pluginmanager import PluginManager
|
||||
from deluge.ui.gtkui.preferences import Preferences
|
||||
from deluge.ui.gtkui.torrentdetails import TorrentDetails
|
||||
from deluge.ui.gtkui.torrentview import TorrentView
|
||||
from deluge.ui.gtk3.gtkui import DEFAULT_PREFS
|
||||
from deluge.ui.gtk3.mainwindow import MainWindow
|
||||
from deluge.ui.gtk3.pluginmanager import PluginManager
|
||||
from deluge.ui.gtk3.preferences import Preferences
|
||||
from deluge.ui.gtk3.torrentdetails import TorrentDetails
|
||||
from deluge.ui.gtk3.torrentview import TorrentView
|
||||
|
||||
ConfigManager('gtkui.conf', defaults=DEFAULT_PREFS)
|
||||
ConfigManager('gtk3ui.conf', defaults=DEFAULT_PREFS)
|
||||
|
||||
self.plugins = PluginManager()
|
||||
MainWindow()
|
||||
|
|
Loading…
Reference in New Issue