Commit Graph

33 Commits

Author SHA1 Message Date
Daniel P. Berrange
3c3237b951 Convert to use GTK3 and GObject Introspection bindings
Switch over to use GObject introspection bindings for all python
modules related to GObject/GTK3/etc. It is not possible to mix
and match old pyggtk/pygobject manual bindings with new introspection
based bindings so it must be all changed in one go.

Imports like

    import gtk

Change to

    from gi.repository import Gtk

The vmmGObject class is changed to always inherit from GObject.GObject
There is no compelling reason to avoid a GObject dep for the
virt-manager TUI & it horribly messed up the code.

Signal declarations are changed from

  vmmChooseCD.signal_new(vmmChooseCD, "cdrom-chosen", [object, str])

To

     __gsignals__ = {
        "cdrom-chosen": (GObject.SignalFlags.RUN_FIRST, None, [object, str])
    }

which is required by new GObject bindings

Most of the rest of the change is simply dealing with renamed
constants / classes.

Alot of legacy compat code was removed - ie helpers which
check to see if certain GTK2 methods are available are no
longer required since we're mandating GTK3 only.

The event loop is replaced with LibvirtGLib's event loop.

Still todo

 - Rip out all DBus stuff & make vmmEngine class inherit GtkApplication
   which provides unique support & DBus method handling
 - Switch to use LibvirtGConfig & LibvirtGObject for libvirt interaction
 - Possibly switch to Python 3 too ?
 - Figure out why GNOME keyring is missing Introspection support

My suggestion is that the standalone GIT repo for virt-install
only live on as a support branch for legacy platforms.

A stable-0.9 branch of virt-manager can be kept for legacy PyGtk2
based virt-manager releases.

The virt-manager master branch should exclusively use GObject
inspection and ideally Python3 and contain both the virt-manager
and virt-install codebases in one since they are intimately
related to each other & using separate GIT repos has needlessly
complicated life for everyone.

crobinso:
    Some locking fixes
    Misc cleanups and dropping now-useless code
    Fix dbus usage
    Fix graph cell renderer regression
    Fix a couple tooltip issues
2013-04-03 18:13:24 -04:00
Cole Robinson
d01b28c740 Run close() before removing window signals in cleanup() 2012-07-08 20:56:36 -04:00
Cole Robinson
0c507ac98b Drop use of gtk threading
In general it complicates things for minor simplifications in some
cases. I think it's better just to learn that anything invoked from
a thread that _might_ touch the UI should just be dispatched in an
idle callback. Anything UI bits that we need immediately in a thread
can just use some creative trickery (like is done in connectauth) to
block in a safe manner.
2012-02-13 11:57:52 -05:00
Cole Robinson
8717e63687 Sanitize gtkbuilder XML for RHEL6
There's a pretty useless element added to ui files by f16 glade that
trips up RHEL6 gtk. If gtk is old enough, sanitize things.
2012-02-02 14:25:11 -05:00
Cole Robinson
103c2e0da1 Convert UI files from glade to gtkbuilder
Glade is long since deprecated, and the 'glade' tool in F15 and up doesn't
even handle glade format files!

This effectively drops support for running virt-manager on a RHEL5 host,
which has a GTK that is too old to support gtkbuilder.

The process here was:
- On RHEL6, open all glade files with glade3, use Edit->Preferences to
  change format to gtk builder. (the gtk-builder-convert tool
  produced all sorts of brokenness, and f16 glade3 can't even open
  old glade files).
- Open these new files in glade on f16 and resave (since glade is
  notorious for reformatting files over new versions, saves churn
  the first time someone goes to patch the UI using a modern glade)
2012-02-02 14:17:50 -05:00
Cole Robinson
1ff601138f Specify all logging string format args as function parameters
As warned about by pylint. Also clean up some pylint false positives
and a few scattered legit warnings.
2012-01-16 22:04:40 -05:00
Cole Robinson
5f22897f94 baseclass: Centralize exception reporting
Also add some checks to make sure subclasses always specify a proper
cleanup method
2011-07-23 21:16:54 -04:00
Cole Robinson
28839cab4d baseclass: Fix traceback if skipping leak check 2011-07-22 19:12:31 -04:00
Cole Robinson
77063968c9 baseclass: Fix timeout_add 2011-07-22 19:11:04 -04:00
Cole Robinson
ec38df2ee4 baseclass: Emulate gobject signals for TUI
Pretty easy to do with a high level language. Go python!
2011-07-22 18:45:24 -04:00
Cole Robinson
a84d10cee8 Add a smaller helper for self.window.get_widget
Saves us from having crazy long lines in a few places, and less characters
to type!
2011-07-14 13:13:13 -04:00
Cole Robinson
102c5468f0 Don't initialize HAL right before app closes 2011-06-01 16:09:48 -04:00
Cole Robinson
22db8a32ec Don't mask early startup errors do to import issue 2011-05-31 16:10:34 -04:00
Cole Robinson
992a513774 baseclass: If not use gtk/gobject, run idle callbacks immediately 2011-05-03 14:58:40 -04:00
Cole Robinson
d91f0afa3a baseclass: Make gtk/gobject dep optional
Add a new file 'guidiff' that sets up the enviroment for TUI vs GUI.
2011-04-28 17:25:06 -04:00
Cole Robinson
f26c2160b5 Don't warn about leaking halhelper 2011-04-28 17:03:22 -04:00
Cole Robinson
efde9cb863 Register all gobject signals through vmmGObject baseclass
Allows us to remove gobject imports in various places which will help when
merging code with TUI.
2011-04-28 16:06:57 -04:00
Cole Robinson
9fcf63b559 baseclass: Prevent a pylint warning about bind_escape_key_close 2011-04-28 14:38:46 -04:00
Cole Robinson
90679a0a0b Store running_config in util, not config.py
Will help with TUI integration
2011-04-18 13:24:23 -04:00
Cole Robinson
2fa12ffa15 Move bind_escape_key_close helper to baseclass 2011-04-18 11:25:28 -04:00
Cole Robinson
de8c901d7b Move idle wrappers to baseclass
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2011-04-18 11:13:33 -04:00
Cole Robinson
b7de618897 Move connect helpers from util to baseclass
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2011-04-18 11:13:33 -04:00
Cole Robinson
ad8060d191 baseclass: Fix early error reporting before we setup running_config 2011-04-15 18:38:29 -04:00
Cole Robinson
fc6814d186 baseclass: Use logging for logtrace 2011-04-14 12:51:52 -04:00
Cole Robinson
f2781ee62a Properly cleanup all dialogs
On app close, all dialogs are properly cleaned up so there are no
dangling references and python can garbage collect.

While this isn't that important when the app shuts down, it ensures that
lifecycle changes while the app is running (vm start/stop/remove, conn
start/stop/remove) have the infrastructure to properly release resources.
2011-04-13 10:20:47 -04:00
Cole Robinson
a52ad2eb37 details: Properly cleanup when VM/conn disappears
Make sure we are properly freeing all our state, so python can reap domains
and conn instances
2011-04-11 18:35:21 -04:00
Cole Robinson
a83fe73b1e error: Subclass vmmGObject
Gives us lifecycle tracking and useful helpers like refcount
2011-04-11 16:26:41 -04:00
Cole Robinson
d74066da21 baseclass: Simplify cleaning up gobject signals
Just add a custom connect/disconnect to keep track of the signals for us.
2011-04-11 16:16:07 -04:00
Cole Robinson
85340ca491 baseclass: Track object lifetime to help debug ref leaks 2011-04-11 12:54:47 -04:00
Cole Robinson
586f7b3274 domain: Fix ref count issues preventing proper cleanup
Make sure we unregister all callbacks so that the domain object
is properly reaped by python. Mediadev has somewhat similar issues,
so handle that.
2011-04-11 12:01:28 -04:00
Cole Robinson
d0d20148f7 asyncjob: Simplify error reporting 2010-12-10 09:57:42 -05:00
Cole Robinson
5c45358adc Remove 'config' passing from remaining classes/functions 2010-12-09 14:06:00 -05:00
Cole Robinson
2dd81900fa Have UI classes share a baseclass 2010-12-08 17:26:19 -05:00