Commit Graph

111 Commits

Author SHA1 Message Date
Cole Robinson
cad809fe80 Make all dialogs clean up when vm/conn disappears
Moves all the window cleanup handling to each class and audit for
all --test-leak-debug errors and fix
2018-03-15 21:24:48 -04:00
Cole Robinson
1d17b98852 engine: Move most remaining window tracking to UI classes
Kind of a big mess but it was difficult to untangle piecemeal.
Basically this drops nearly all the centralized window tracking
in engine.py and moves it to each UI class. If manager.py wants
to open a details window it does it directly, and vmmDetails tracks
the window object list itself. This simplifies things and makes
the code easier to follow.

There's still some weirdness with vmmConnect and connection callbacks,
but future patches will break those apart.
2018-03-15 21:24:48 -04:00
Cole Robinson
92aea7c565 engine: Have windows increment/decrement windows directly 2018-03-15 21:24:48 -04:00
Cole Robinson
9fa9777f1c engine: Have windows call exit_app directly 2018-03-15 21:24:48 -04:00
Cole Robinson
6180a3c81f engine: Cleanup function names, comments, etc. 2018-03-15 21:24:48 -04:00
Cole Robinson
58f872a205 clone: Convert to per-connection singleton-ish pattern
And convert the dialog VM handling to match other dialogs
2018-03-15 21:24:48 -04:00
Cole Robinson
b94a9fdffb migrate: convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
65b512ae6f delete: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
1780d0e9f0 details: Call inspection VM refresh directly 2018-03-15 21:24:48 -04:00
Cole Robinson
f088537798 engine: break out vmmConnectionManager
Have a separate class for tracking the connection list, and emitting
conn-added and conn-removed signals. It exists as a singleton instance
that UI classes can talk directly to
2018-03-15 21:24:48 -04:00
Cole Robinson
befafe9dc7 engine: connect conn-added in UI classes
This creates a weird situation where we pass the engine to those
classes UI functions, but this is a step towards untangling that.

While here, get rid of the conn-added connect magic and add a
simpler way to access the connection list from the engine
2018-03-15 21:24:48 -04:00
Cole Robinson
6b1278ccda prefs: Add a setting to enable/disable libguestfs inspection
Rather than key it on the library being available. Makes it much
easier to test both modes of behavior.

Fix up a few inspection bugs while I'm in the area, and convert
it to be more singleton like.
2018-03-15 21:24:48 -04:00
Cole Robinson
33def3c4af preferences: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
b6a61818af about: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
717ff72684 engine: Move VM action callbacks to vmmenu.py
Call the callbacks directly rather than using signals. engine.py
has become a bit of a catchall for shared functionality and this
is a step towards disentangling it
2018-03-15 21:24:48 -04:00
Cole Robinson
6ad6f44920 connection: Call virConnectClose and log the return value
This can help us find object leaks within the code. virConnectClose
is just a deference and will return 1 if other references are still
floating around.
2018-03-15 21:24:48 -04:00
Cole Robinson
7e1cddef18 virt-manager: Add hidden --test-leak-debug option
That enables the pre-existing debug_ref_leaks behavior
2018-03-15 21:24:48 -04:00
Cole Robinson
56cf42e6ea engine: Only init systray if launching new app
We were doing it too early, and the systray could pop up for a moment
when connecting to a remote app
2018-03-15 21:24:48 -04:00
Radostin Stoyanov
5854b7bb17 Replace "Queue" with "queue"
The Queue module has been renamed to queue in Python 3. [1]

[1] https://docs.python.org/2/library/queue.html
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Cole Robinson
b4a2c46f6a virt-manager: If --connect passed, wait for it to init
...before showing the UI. This helps the UI test suite be less
racy at least.
2018-01-09 13:51:53 -05:00
Cole Robinson
ab1b4f8628 virt-manager: Gracefully exit app on ctrl-c, not sys.exit
Will be needed for uitests coverage support
2018-01-09 09:57:20 -05:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08:00
Cole Robinson
2fe444323b engine: Don't attempt --test-first-run if --connect passed
Which we do for uitests, we don't want it trying to connect to
qemu:///system while uitests are running
2017-10-20 11:47:15 -04:00
Christian Ehrhardt
e76b904656 engine: improve message about missing binaries
The message when failing to connect can be misleading as package names
will differ per Distribution as well as not apply for e.g. self built
binaries.
This changes the message in a way to be more generic not implying literal
package names.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2017-08-16 17:32:18 -04:00
Cole Robinson
cf522bfc0c engine: Remove manual line wrapping of connect error messages
This was needed once upon a time when the UI was wrong, but it
wraps correctly now
2017-08-07 18:17:00 -04:00
Cole Robinson
9e7426b64f engine: Drop offer to install askpass package (bz 1354304)
Dealing with packagekit across desktops and in a consistent
manner is a pain. This code path is rarely exercised and difficult
to test, so just fallback to giving a hint error message and
let the user install if they care.
2017-08-07 17:41:52 -04:00
Cole Robinson
4cdae27cb2 engine: With --test-first-run, don't try default URI detection
default URI detection gets testing via the 'connect' dialog, this
makes it easier to test the fallback when no packages are locally
present
2017-08-07 17:27:30 -04:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Pino Toscano
409ae0bcf4 inspection: add a way to refresh the inspection info
Introduce a 'Refresh' button in the 'Information' page of a VM, and
wire it up so a refresh of the inspection data for it is triggered.
2017-03-01 16:25:47 -05:00
Cole Robinson
435de2d40c pylint: Fix some issues with F25 version 2016-12-13 12:36:49 -05:00
Pavel Hrdina
b327191a20 maint: fix pylint warnings wrong-import-order
standard import "import logging" comes before "from gi.repository import GLib"

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-07 17:37:06 +02:00
Pavel Hrdina
bf99c0ce82 virt-manager: fix --show-domain-creator to not depend on manager window
Commit a0c2fdf4 fixed a bug that there was no way how to close the app.

The original issue isn't present anymore but reverting that commit isn't
enough.  We need to increment/decrement window count while
showing/closing the create window in order to not exit right after
the create window is opened.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1331707

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-20 12:02:03 -04:00
Cole Robinson
f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Cole Robinson
2b7a119457 engine: Drop handling for old asyncjob nested main loops
Hasn't been needed for a long time
2015-12-06 15:41:49 -05:00
Cole Robinson
febe0abdd2 virt-manager: Drop manual dbusapi, use GtkApplication
So I was confused here and completely missed that GtkApplication is
meant to handle the common case of invoking actions in an existing
app instance. So drop the manual dbus server and use the simpler
Gtk support.

Fix a bunch of other errors in this area too
2015-12-06 15:41:49 -05:00
Cole Robinson
a9bc56add3 virt-manager: revive cli dbus API (bz 1162815)
This allows virt-manager command line that launch windows to work for an
existing virt-manager instance. This is handy for scripting, and giving
other apps a reasonable way to launch a virt-manager VM window for
example.
2015-11-24 16:30:18 -05:00
Cole Robinson
d5e5068699 engine: Update details window mapping when VM is renamed
Fixes this issue:

- Rename VM from 'foo' to 'foo1'
- Create new VM named 'foo'
- It raises 'foo1' window
2015-11-03 16:01:04 -05:00
Cole Robinson
a91137dbdd engine: Clean up some object lifecycle leaks
pygobject doesn't seem to choke on debug_leak_check anymore, so we
can use it to find object leaks. just doing a few for now since it's
generally not a big deal.
2015-09-20 15:30:00 -04:00
Cole Robinson
d66b691035 virt-manager: Allow mixing --connect and --test-first-run
To run with just the passed connection, but skip the first run logic.
Useful for UI testing
2015-09-06 18:15:16 -04:00
Pavel Hrdina
0fbe8e7a1f translation: fix wrong usage of _() function
All the strings have to be at first translated and then we can fill the
formated and translated string.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-06-05 16:33:51 -04:00
Cole Robinson
62ad0e91ee migrate: Big reworking of the dialog
It's largely the same, but now

- The code is better organized
- The UI is much more streamlined, only showing relevant fields when
  required.
- We warn about the hostname/URI cases that we know libvirt will error on
- Drop some of the attempts at being smart, and just mimic what libvirt
  will do.
2015-04-21 17:15:58 -04:00
Cole Robinson
10ad151d4b connection: Clarify tick functions and who should use them 2015-04-13 16:56:46 -04:00
Cole Robinson
80c2dde350 virt-manager: Fix connection to domain from cli
Need to tweak our signal handling here with the recent connection changes.
2015-04-12 09:34:55 -04:00
Cole Robinson
d7a7d00e9e engine: Don't raise conn poll errors if only systray visible (bz 1082685) 2015-04-11 14:41:02 -04:00
Cole Robinson
f7b05912f0 engine: Before launching any error, try to find a parent dialog 2015-04-11 14:39:52 -04:00
Cole Robinson
839ce682b1 Drop support for non-managed save/restore
All major drivers either support it, or don't support save at all,
so I think we can safely drop it. If people still need it they can
get by with virsh.
2015-04-11 13:52:48 -04:00
Cole Robinson
fc171fc31d connection: Bunch of minor tweaks handling TCP URIs 2015-04-11 12:08:57 -04:00
Cole Robinson
20cd7f86ca domain: Remove manual_reboot
qemu has provided this feature for a long time, and every other driver
we care about provides a reboot implementation as well, so drop our
handling of it.
2015-04-11 11:13:05 -04:00