Commit Graph

24 Commits

Author SHA1 Message Date
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
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
4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
Cole Robinson
3aa941571a uiutil: Drop check for old pygobject row handling
Once upon a time it couldn't handle setting a row value to None,
but we've bumped the dep now
2016-05-17 17:49:56 -04:00
Cole Robinson
f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Cole Robinson
34db1af7b6 createpool: Fix adding iscsi pools (bz 1231558) 2015-06-21 15:47:31 -04:00
Cole Robinson
8a20a71c46 uiutil: Merge set_combo_entry into set_list_selection 2015-05-19 18:29:46 -04:00
Cole Robinson
23bf115024 uiutil: Rename select_list_row* to match getter functions 2015-05-19 18:29:46 -04:00
Cole Robinson
490aee74de uiutil: select_list_row_by_value: Handle value=None
Which is a legit value we use as a key in several places. Fix up
a potentially problematic caller
2015-05-19 18:29:46 -04:00
Cole Robinson
08116d2869 uiutil: Group similar functions with comment blocks 2015-05-19 18:29:45 -04:00
Cole Robinson
5219e49eec uiutil: Merge get_combo_entry into get_list_selection
There's no reason we can't handle it together
2015-05-19 18:29:45 -04:00
Cole Robinson
fdad3efe24 uiutil: streamline column vs rowidx parameter name 2015-05-19 18:29:45 -04:00
Cole Robinson
4781ad6cd6 connection: Simplify manager row 'pretty name' handling
Unify all the callers, and use some UI ellipsizing to handle
crazy long hostnames.

This drops the conn name collision prevention stuff which can be
useful when you have lots of similar connection names. But upcoming
patches will make it mostly redundant.
2015-04-11 12:57:32 -04:00
Cole Robinson
6071ab0ea4 uiutil: Clarify a few ambiguous function names 2015-04-10 15:00:34 -04:00
Cole Robinson
932e6e00bb details: Fix changing graphics type (bz 1083903)
And clean up the API usage to avoid these types of issues in the future.
2014-04-03 10:53:54 -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
3da3a432e1 details: Fix setting cache/io to hypervisor default 2014-03-22 18:02:50 -04:00
Cole Robinson
90c9b3ca2e details: Reword the CPU model UI a bit more
- Add options in the model drop down for clear, hvdefault, and app default
- Make 'copy host' a check box, when enabled it hides the model dropdown
- Detect if the VM CPU is a copy of the host CPU
- Undocumented bit that allows passing in host-model/host-passthrough
    to the model field for people that really want those settings.
2014-01-31 13:40:09 -05:00
Cole Robinson
bff94f2365 console: Support spice 'resize-guest' (bz 754559)
This will auto change the guest resolution to match the window size.
Off by default, can be enabled like scaling preferences.
2014-01-31 10:08:18 -05:00
Cole Robinson
64b2d0c6b7 Move shared graphics editing UI to gfxdetails.py
Fixes a couple UI bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=696217
https://bugzilla.redhat.com/show_bug.cgi?id=875403
2014-01-29 09:22:28 -05:00
Cole Robinson
169ae1203d Break out shared network list UI to netlist.py
Use this to show vport stuff in addhw, give a warning about macvtap
networking, and allow macvtap from the create wizard.
2014-01-28 10:00:06 -05:00
Cole Robinson
889ec18031 uiutil: Use list selection helpers everywhere 2014-01-27 10:46:14 -05:00
Cole Robinson
2771511946 uiutil: Make more use of set_combo_text_column 2014-01-26 21:35:42 -05:00
Cole Robinson
708a2737cf Split uihelpers into sharedui and uiutil
Reserve uiutil for the little gtk helper functions, rest goes into shared
UI (which all should probably be factored into their own files but thats
a task for another day)
2014-01-26 18:15:50 -05:00