Commit Graph

24 Commits

Author SHA1 Message Date
Cole Robinson
371cd1ad60 console: Simplify usbredir menu handling
+ Don't check for redirdev devices, let the spice widget tell
  us if things aren't configured correctly.

+ Remove some duplication

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-10-02 13:34:47 -04:00
Cole Robinson
9929f2d676 vmwindow: Disable 'Resize to VM' menu when VM is offline
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-09-25 16:39:20 -04:00
Cole Robinson
20000fb313 vmwindow: Don't desensitive Auto resize
Right now you can select the option for an offline VM, but once
it starts up, and no spice agent is detected, the option is
set insensitive. This is a pain.

Keep the tooltip, but keep the option always selectable

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-09-25 16:39:20 -04:00
Michael Weghorn
db1b2fbce3 Use GtkFileChooserNative
Use GtkFileChooserNative [1] instead of GtkFileChooserDialog [2]
to integrate better with the platform (e.g. use the portal
implementation when run with GTK_USE_PORTAL=1, resulting in
the KDE Frameworks implementation being used when
xdg-desktop-portal-kde is in use). Quoting from
the GtkFileChooserDialog doc [2]:

> If you want to integrate well with the platform you should use the
> GtkFileChooserNative API, which will use a platform-specific dialog if
> available and fall back to GtkFileChooserDialog otherwise.

Also replace the use of GTK_STOCK_CANCEL [3] and GTK_STOCK_OPEN [4]
which were deprecated in GTK 3.10:

Both, the `accept_label` and `cancel_label` params of
`Gtk.FileChooserNative.new` can be `None` to use the default
text ("Open", "Cancel"). [5]

Adjust the only caller (in `vmmVMWindow#_takeScreenshot`)
that was passing an explicit label/icon name for the
accept button to pass `_("_Save")` as label, rather than
the also deprecated Gtk.STOCK_SAVE [6].
(GtkFileChooserDialog has special handling for Gtk.STOCK_SAVE
etc., but that's not generally the case for native dialogs).

Rename the method param from `choose_button` to `choose_label`
to make clearer that this is a label.

[1] https://docs.gtk.org/gtk3/class.FileChooserNative.html
[2] https://docs.gtk.org/gtk3/class.FileChooserDialog.html
[3] https://docs.gtk.org/gtk3/const.STOCK_CANCEL.html
[4] https://docs.gtk.org/gtk3/const.STOCK_OPEN.html
[5] http://pygobject-doc.gitee.io/pgi-docs/Gtk-3.0/classes/FileChooserNative.html#Gtk.FileChooserNative.new
[6] https://docs.gtk.org/gtk3/const.STOCK_SAVE.html

Fixes #315
2024-04-07 15:54:47 -04:00
Cole Robinson
cbc5b89707 Clean up FileChooser usage a bit
* Move browse_reason handling entirely into storagebrowser.py
* Open code some of the browse_local logic at the few callers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-12-14 12:31:17 -05:00
Cole Robinson
e7c936f16e vmwindow: Customize window should not be 'deletable'
This forces the user to use the 'Cancel' button, which gives a warning
about the install being aborted

Resolves: https://github.com/virt-manager/virt-manager/issues/416

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-01 09:44:48 -04:00
Cole Robinson
e58cc956b5 vmwindow: vm state-changed update flow changes
* Don't process events when the window isn't showing
* Only update console/details if that tab is actually selected.
    Otherwise in some corner cases we can connect to the VM console
    while on the details page

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
c0c704e1fa console: Move _change_title behavior to vmwindow
This is where it conceptually belongs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
95f363d634 vmwindow: Rename some functions for clarity
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
518f230f76 vmwindow: Remove non-events XML refreshing on resource tick
This is an awkward place to put it, and I'm pretty sure it's not
even useful in the non-events case nowadays due to improved
libvirtobject.py infrastructure

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-21 09:06:18 -04:00
Cole Robinson
ac8591192f console: Add option to disable autoconnect
As part of making virt-manager cooperate better with external viewers,
add an option to disable console autoconnect. When opening a VM window
for a running VM, you'll see a 'Connect to console' button in place
of the spice/vnc viewer. Click that and things proceed like normal.

This is useful to prevent virt-manager from disconnecting a virt-viewer
instance that's already attached to a VM

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:59:31 -04:00
Cole Robinson
bbbfd4b7c8 vmwindow: Default the console widget to 1024x768
When a VM window is launched for the first for a VM, currently we
set the top window size to 800x600 which is small and arbitrary and
is universally shrinks the viewer too much to fit any OS installer
I can find.

Instead do some hacks to resize the window to accomodate a viewer
widget of 1024x768 which seems to be what QXL graphics give us for
win10 and Fedora 32 installers. So for new VMs hitting the OS installer
we don't see scrollbars.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:37:11 -04:00
Cole Robinson
43512302f7 vmwindow: Cleanup the interaction with vmmConsolePages
- Add ui/console.ui for console-pages and below
- Add move auth and graphics unavailable pages to a new subnotebook
- Move all the menubar handling up into vmwindow
- Clarify the control flow as much as I can come up with

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:37:11 -04:00
Cole Robinson
8ff0da7664 connection: Pass object in -added/-removed signals
And not connkey. connkey == name, and name can change with object
rename, so it's a bad pattern to propagate that connkey can be used
as a static lookup key for objects. This begins unwinding it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-01 14:27:11 -04:00
Cole Robinson
687658832e uitests: details/domain/config coverage additions
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 12:37:52 -04:00
Cole Robinson
eda08f4c79 details: Big code modernization
* Privatize a lot of stuff
* Separate out many callbacks as thin wrappers around the real code
* Simplify registering EDIT_ handlers
* Organize things better

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-27 18:10:11 -04:00
Cole Robinson
eea394b9d3 uitests: Increase details + domain + vmwindow coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-27 18:10:11 -04:00
Cole Robinson
1684049fa3 virtManager: Misc coverage annotations
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:06 -04:00
Cole Robinson
16a608c37b virtManager: move vmwindow components to virtManager/details 2019-06-17 00:12:32 -04:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
ecc3e3d34e support: add is_libvirt_error_no_domain
Repurpose the generic util.exception_is_libvirt_error for the one
purpose that it's actually used, add it as a SupportCache staticmethod,
and test it
2019-06-07 16:44:14 -04:00
Cole Robinson
318e0c0a39 vmwindow: Clean up vmmDetails on window cleanup 2019-06-05 11:13:33 -04:00
Cole Robinson
cfa1a0569b create: Use self._guest less in install path
Pass it around to all the callbacks as needed. Makes the flow easier
to follow
2019-05-13 12:09:39 -04:00
Cole Robinson
f947afc3df details: split out a top level vmwindow
vmmVMWindow handles all the menuing, and coordinating between the
console, snapshots, and details panel. Simplifies the details
code a bit which will help when we add xmlediting
2019-05-13 12:08:55 -04:00