mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
Fix GObject deprecation warnings with latest pygobject
This commit is contained in:
parent
2787e0ba40
commit
6208d67129
@ -22,9 +22,9 @@ import logging
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
|
||||
import libvirt
|
||||
import urlgrabber
|
||||
@ -252,7 +252,7 @@ class vmmAsyncJob(vmmGObjectUI):
|
||||
###########
|
||||
|
||||
def run(self):
|
||||
timer = GObject.timeout_add(100, self.exit_if_necessary)
|
||||
timer = GLib.timeout_add(100, self.exit_if_necessary)
|
||||
|
||||
if self.show_progress:
|
||||
self.topwin.present()
|
||||
@ -266,7 +266,7 @@ class vmmAsyncJob(vmmGObjectUI):
|
||||
else:
|
||||
self.bg_thread.run()
|
||||
|
||||
GObject.source_remove(timer)
|
||||
GLib.source_remove(timer)
|
||||
|
||||
if self.bg_thread.isAlive():
|
||||
# This can happen if the user closes the whole app while the
|
||||
|
@ -22,10 +22,10 @@
|
||||
# MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import cairo
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
|
||||
class OverBox(Gtk.Box):
|
||||
"""
|
||||
@ -341,8 +341,8 @@ class Drawer(OverBox):
|
||||
self.period = period
|
||||
|
||||
if self.timer_pending:
|
||||
GObject.source_remove(self.timer_id)
|
||||
self.timer_id = GObject.timeout_add(self.period, self._on_timer)
|
||||
GLib.source_remove(self.timer_id)
|
||||
self.timer_id = GLib.timeout_add(self.period, self._on_timer)
|
||||
|
||||
self.step = step
|
||||
|
||||
@ -350,7 +350,7 @@ class Drawer(OverBox):
|
||||
self.goal = goal
|
||||
|
||||
if not self.timer_pending:
|
||||
self.timer_id = GObject.timeout_add(self.period, self._on_timer)
|
||||
self.timer_id = GLib.timeout_add(self.period, self._on_timer)
|
||||
self.timer_pending = True
|
||||
|
||||
def get_close_time(self):
|
||||
@ -485,7 +485,7 @@ class AutoDrawer(Drawer):
|
||||
self.opened = True
|
||||
|
||||
if self.delayConnection:
|
||||
GObject.source_remove(self.delayConnection)
|
||||
GLib.source_remove(self.delayConnection)
|
||||
|
||||
|
||||
if self.forceClosing:
|
||||
@ -493,7 +493,7 @@ class AutoDrawer(Drawer):
|
||||
elif do_immediate:
|
||||
self._enforce(False)
|
||||
else:
|
||||
self.delayConnection = GObject.timeout_add(self.delayValue,
|
||||
self.delayConnection = GLib.timeout_add(self.delayValue,
|
||||
self._on_enforce_delay)
|
||||
|
||||
|
||||
@ -608,7 +608,7 @@ class AutoDrawer(Drawer):
|
||||
toplevel.set_focus(None)
|
||||
|
||||
self.forceClosing = True
|
||||
self.closeConnection = GObject.timeout_add(
|
||||
self.closeConnection = GLib.timeout_add(
|
||||
self.get_close_time() + self.delayValue,
|
||||
self._on_close_delay)
|
||||
|
||||
|
@ -25,13 +25,14 @@ import logging
|
||||
import virtManager
|
||||
import virtManager.guidiff
|
||||
|
||||
from gi.repository import GLib
|
||||
from gi.repository import GObject
|
||||
if virtManager.guidiff.is_gui():
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
|
||||
class vmmGObject(GObject.GObject):
|
||||
|
||||
class vmmGObject(GObject.GObject):
|
||||
_leak_check = True
|
||||
|
||||
def __init__(self):
|
||||
@ -88,7 +89,7 @@ class vmmGObject(GObject.GObject):
|
||||
def add_gobject_timeout(self, handle):
|
||||
self._gobject_timeouts.append(handle)
|
||||
def remove_gobject_timeout(self, handle):
|
||||
GObject.source_remove(handle)
|
||||
GLib.source_remove(handle)
|
||||
self._gobject_timeouts.remove(handle)
|
||||
|
||||
def _logtrace(self, msg=""):
|
||||
@ -136,7 +137,7 @@ class vmmGObject(GObject.GObject):
|
||||
|
||||
def idle_emit(self, signal, *args):
|
||||
"""
|
||||
Safe wrapper for using 'self.emit' with GObject.idle_add
|
||||
Safe wrapper for using 'self.emit' with GLib.idle_add
|
||||
"""
|
||||
def emitwrap(_s, *_a):
|
||||
self.emit(_s, *_a)
|
||||
@ -148,13 +149,13 @@ class vmmGObject(GObject.GObject):
|
||||
"""
|
||||
Make sure idle functions are run thread safe
|
||||
"""
|
||||
return GObject.idle_add(func, *args)
|
||||
return GLib.idle_add(func, *args)
|
||||
|
||||
def timeout_add(self, timeout, func, *args):
|
||||
"""
|
||||
Make sure timeout functions are run thread safe
|
||||
"""
|
||||
return GObject.timeout_add(timeout, func, *args)
|
||||
return GLib.timeout_add(timeout, func, *args)
|
||||
|
||||
def emit(self, signal_name, *args):
|
||||
return GObject.GObject.emit(self, signal_name, *args)
|
||||
|
@ -18,7 +18,7 @@
|
||||
# MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import GLib
|
||||
|
||||
import logging
|
||||
import os
|
||||
@ -112,7 +112,7 @@ def creds_dialog(creds):
|
||||
ret = -1
|
||||
retipc.append(ret)
|
||||
|
||||
GObject.idle_add(wrapper, creds_dialog_main, creds)
|
||||
GLib.idle_add(wrapper, creds_dialog_main, creds)
|
||||
|
||||
while not retipc:
|
||||
time.sleep(.1)
|
||||
|
@ -18,6 +18,7 @@
|
||||
# MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
from gi.repository import GLib
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
|
||||
@ -298,7 +299,7 @@ class vmmEngine(vmmGObject):
|
||||
return 1
|
||||
|
||||
def change_timer_interval(self, ignore1, ignore2, ignore3, ignore4):
|
||||
GObject.source_remove(self.timer)
|
||||
GLib.source_remove(self.timer)
|
||||
self.schedule_timer()
|
||||
|
||||
def increment_window_counter(self, src):
|
||||
@ -326,7 +327,7 @@ class vmmEngine(vmmGObject):
|
||||
self.inspection = None
|
||||
|
||||
if self.timer is not None:
|
||||
GObject.source_remove(self.timer)
|
||||
GLib.source_remove(self.timer)
|
||||
|
||||
if self.systray:
|
||||
self.systray.cleanup()
|
||||
|
@ -22,9 +22,9 @@ import traceback
|
||||
import logging
|
||||
import threading
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
|
||||
import virtinst
|
||||
import libvirt
|
||||
@ -553,4 +553,4 @@ class vmmMigrateDialog(vmmGObjectUI):
|
||||
|
||||
vm.migrate(dstconn, migrate_uri, rate, live, secure, meter=meter)
|
||||
if timer:
|
||||
self.idle_add(GObject.source_remove, timer)
|
||||
self.idle_add(GLib.source_remove, timer)
|
||||
|
@ -25,9 +25,9 @@ import pty
|
||||
import fcntl
|
||||
import logging
|
||||
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Vte
|
||||
|
||||
import libvirt
|
||||
@ -79,8 +79,8 @@ class LocalConsoleConnection(ConsoleConnection):
|
||||
|
||||
self.fd = pty.slave_open(ipty)
|
||||
fcntl.fcntl(self.fd, fcntl.F_SETFL, os.O_NONBLOCK)
|
||||
self.source = GObject.io_add_watch(self.fd,
|
||||
GObject.IO_IN | GObject.IO_ERR | GObject.IO_HUP,
|
||||
self.source = GLib.io_add_watch(self.fd,
|
||||
GLib.IO_IN | GLib.IO_ERR | GLib.IO_HUP,
|
||||
self.display_data, terminal)
|
||||
|
||||
# Save term settings & set to raw mode
|
||||
@ -102,7 +102,7 @@ class LocalConsoleConnection(ConsoleConnection):
|
||||
os.close(self.fd)
|
||||
self.fd = None
|
||||
|
||||
GObject.source_remove(self.source)
|
||||
GLib.source_remove(self.source)
|
||||
self.source = None
|
||||
self.origtermios = None
|
||||
|
||||
@ -119,7 +119,7 @@ class LocalConsoleConnection(ConsoleConnection):
|
||||
def display_data(self, src, cond, terminal):
|
||||
ignore = src
|
||||
|
||||
if cond != GObject.IO_IN:
|
||||
if cond != GLib.IO_IN:
|
||||
self.close()
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user