Commit Graph

47 Commits

Author SHA1 Message Date
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
34543b3ecd ui: Remove use of deprecated GtkAlignment
Mostly this is replaced with widget padding, and GtkBox for generic
containers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-20 09:53:17 -05:00
Cole Robinson
5ecacfdfed uitests: Finish error.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson
e3be4b677e error: Remove some dead code
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson
3c861131dd virtManager: error: Break long lines in error dialogs
Errors from libvirt can be super long, and stretch out the dialog like
crazy.

This causes some changes in test suite output, so adjust tests to
match

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 11:21:59 -05:00
Cole Robinson
a9cbc4e583 error: Set a cap on error dialog text size
Otherwise we can get some crazy sized dialogs with errors from
libvirt

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-14 12:40:39 -05: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
f7ba2f2f99 error: Add helper confirm_unapplied_changes
For the common dialog we use to confirm changes
2019-04-14 18:24:04 -04:00
Cole Robinson
12a7a18be0 cli: Fix traceback detection 2018-09-06 18:39:14 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
259c70a090 error: Drop unused parent callback 2018-03-17 18:49:55 -04:00
Cole Robinson
3c1e0a8a12 virtManager/*: Give pylint hints about singleton classes
It can't seem to figure out that what 'cls' is in this context,
so make it explicit.
2018-03-17 18:46:39 -04:00
Cole Robinson
2f0e730efc error: Don't double log summary
details is often composed of a summary + traceback, so if users copy
it into a bug report we get all the info. But when logging the contents
we don't want to double log the summary, so try to strip it out
2018-03-16 17:30:39 -04:00
Cole Robinson
dabbc8d5bd engine: Remove centralized conn.open handling
Move connection opening logic to each caller, since needs are
slightly different.
2018-03-15 21:24:48 -04:00
Cole Robinson
d8d71bddfb ui: Add createnet/pool/vol/interface tests 2018-01-11 21:02:34 -05:00
Cole Robinson
dc344fc8ee error: Add accessible strings for error dialogs
Makes UI testing easier
2018-01-09 17:58:55 -05:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Cole Robinson
7d03190cb5 spice: s/OK/Close/ in USB redirection dialog (bz 1465907)
To make it more clear that USB redirection happens immediately

https://bugzilla.redhat.com/show_bug.cgi?id=1465907
2017-07-17 15:46:12 -04: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
c39592ae7b localization: mark several strings as translatable
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-02-06 16:25:08 +01:00
Cole Robinson
cca72a73c4 create: Fix backtrace when reporting OS error (bz 1241902) 2015-08-10 12:56:11 -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
058c06972e Break out shared storage UI to storagelist.py (bz 1060433)
We were already sharing a chunk of this in a haphazard way. Now officially
break it all out, similar to netlist.py. This mostly unifies the views
of host->storage and storagebrowser.py
2015-04-09 12:31:24 -04:00
Guido Günther
1726505fd6 s/gconf/gsettings/
GConf got replaced by GSettings but some methods kept the old name
2014-09-29 08:56:37 -04:00
Cole Robinson
226c4562d5 virtManager: Switch to relative imports 2014-09-12 16:28:38 -04:00
Giuseppe Scrivano
92de2db42b virtManager: always save "do not show again" setting
Any other message box performs different than "Unapplied changes",
which stores this information regardless of the user choice of
Yes/No.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2014-07-28 19:19:17 +02:00
Cole Robinson
196ff823b3 Fix warnings with latest pep8 2014-05-02 10:20:59 -04:00
Cole Robinson
341a453d28 error: Don't log redundant details bits 2014-04-16 12:17:10 -04:00
Cole Robinson
a398d245cb Clean up pylint integration
- Drop no longer needed disable= bits
- Use string names for all skipped pylint messages
2014-04-02 19:00:24 -04:00
Cole Robinson
8562c3258e More pylint fixes 2014-03-22 11:21:19 -04:00
Cole Robinson
2a34b353da uihelpers: Move browse_local to error.py
It doesn't fit any better, but now it's accessible to all UI classes
more easily.
2014-01-26 18:01:10 -05:00
Cole Robinson
58d5e0b799 uihelpers: Move a few more functions closer to their callers 2014-01-26 17:51:15 -05:00
Cole Robinson
3ac0cb06ac error: Make sure labels aren't overly large 2013-12-18 15:42:02 -05:00
Giuseppe Scrivano
0df75c7603 headers: update "Red Hat, Inc." copyright for the year 2013
Ensure that any file touched by a @redhat.com author in 2013 has an
updated copyright header.

The files were updated using the build-aux/update-copyright gnulib
script and manually added where the copyright line wasn't present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2013-10-28 17:22:26 +01:00
Cole Robinson
090bc60ade error: Drop padding with checkboxes, looks weird 2013-09-27 13:43:43 -04:00
Cole Robinson
0551d8956b error: Rename confusing sync/async param to modal 2013-09-06 20:16:37 -04:00
Guannan Ren
d6fc079ae8 error: use helper function to embed customized widget into dialog 2013-07-01 14:33:32 -04:00
Cole Robinson
cafaea8999 error: Don't append empty tb to details 2013-06-30 12:42:32 -04:00
Cole Robinson
555b2d960d Revert "error: new helper function to embed customized widget into dialog"
This reverts commit ee7794a616.

Was accidentally applied while patches are still in review.
2013-06-28 11:11:28 -04:00
Guannan Ren
ee7794a616 error: new helper function to embed customized widget into dialog
helper function: show_info_with_widget()
Widget argument has to be type of Gtk.VBox
2013-06-24 12:39:11 -04:00
Cole Robinson
8804e59518 error: Minor improvement to error dialog logging 2013-06-13 14:12:19 -04:00
Cole Robinson
0d243983d0 Revive pep8 and clean up the code
autopep8 is pretty cool :)
2013-04-13 15:22:43 -04:00
Cole Robinson
ae471007fc Tons of misc pylint fixes 2013-04-13 13:40:29 -04:00
Cole Robinson
9515a8575d Disable pylint warnings about gi.repository
Since pylint still can't handle the dynamic nature of gobject
introspection.
2013-04-12 08:27:45 -04:00
Cole Robinson
9d05583c26 Remove autotools, replace with distutils-extra
Despite being a known quantity, autotools is so overkill for our needs,
so let's drop it and replace it with a much simpler and easy to customize
system.
2013-04-03 18:20:51 -04:00