mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Clean up all pylint + pep8 violations
This commit is contained in:
parent
179e94fda5
commit
e741d9cab6
@ -289,7 +289,7 @@ def main():
|
||||
logging.debug("Libvirt tracing requested")
|
||||
import virtManager.module_trace
|
||||
import libvirt
|
||||
libvirt = virtManager.module_trace.wrap_module(libvirt)
|
||||
virtManager.module_trace.wrap_module(libvirt)
|
||||
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
@ -324,14 +324,14 @@ def main():
|
||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
|
||||
# Add our icon dir to icon theme
|
||||
icon_theme = gtk.icon_theme_get_default()
|
||||
icon_theme = Gtk.IconTheme.get_default()
|
||||
icon_theme.prepend_search_path(icon_dir)
|
||||
|
||||
from virtManager.engine import vmmEngine
|
||||
|
||||
Gtk.Window.set_default_icon_name(appname)
|
||||
|
||||
if options.show and options.uri == None:
|
||||
if options.show and options.uri is None:
|
||||
raise optparse.OptionValueError("can't use --show-* options "
|
||||
"without --connect")
|
||||
|
||||
@ -361,7 +361,7 @@ def main():
|
||||
# Finally start the app for real
|
||||
show_engine(engine, options.show, options.uri, options.uuid,
|
||||
options.no_conn_auto)
|
||||
if options.profile != None:
|
||||
if options.profile is not None:
|
||||
import hotshot
|
||||
prof = hotshot.Profile(options.profile)
|
||||
prof.runcall(Gtk.main)
|
||||
|
@ -29,7 +29,7 @@ class vmmAbout(vmmGObjectUI):
|
||||
self.get_window().connect_signals({
|
||||
"on_vmm_about_delete_event": self.close,
|
||||
"on_vmm_about_response": self.close,
|
||||
})
|
||||
})
|
||||
|
||||
def show(self):
|
||||
logging.debug("Showing about")
|
||||
|
@ -126,7 +126,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
"char_bind_host_focus_in": (self.update_doc, "bind_host"),
|
||||
"char_telnet_focus_in": (self.update_doc, "protocol"),
|
||||
"char_name_focus_in": (self.update_doc, "target_name"),
|
||||
})
|
||||
})
|
||||
self.bind_escape_key_close()
|
||||
|
||||
# XXX: Help docs useless/out of date
|
||||
@ -191,7 +191,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def remove_timers(self):
|
||||
try:
|
||||
if self.host_storage_timer:
|
||||
self.remove_timeout(self.host_storage_timer)
|
||||
self.remove_gobject_timeout(self.host_storage_timer)
|
||||
self.host_storage_timer = None
|
||||
except:
|
||||
pass
|
||||
@ -887,7 +887,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
def finish(self, ignore=None):
|
||||
notebook = self.widget("create-pages")
|
||||
try:
|
||||
if self.validate(notebook.get_current_page()) == False:
|
||||
if self.validate(notebook.get_current_page()) is False:
|
||||
return
|
||||
except Exception, e:
|
||||
self.err.show_err(_("Uncaught error validating hardware "
|
||||
@ -1345,7 +1345,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
disk.vmm_controller = None
|
||||
if (controller_model == "virtio-scsi") and (bus == "scsi"):
|
||||
controllers = self.vm.get_controller_devices()
|
||||
controller = VirtualControllerSCSI(conn = self.conn.vmm)
|
||||
controller = VirtualControllerSCSI(conn=self.conn.vmm)
|
||||
controller.set_model(controller_model)
|
||||
disk.vmm_controller = controller
|
||||
for d in controllers:
|
||||
@ -1371,7 +1371,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
ret = uihelpers.validate_network(self.topwin, self.conn,
|
||||
nettype, devname, mac, model)
|
||||
if ret == False:
|
||||
if ret is False:
|
||||
return False
|
||||
|
||||
self._dev = ret
|
||||
@ -1413,7 +1413,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
ret = self.get_config_host_device_info()
|
||||
nodedev_name = ret and ret[1] or None
|
||||
|
||||
if nodedev_name == None:
|
||||
if nodedev_name is None:
|
||||
return self.err.val_err(_("Physical Device Required"),
|
||||
_("A device must be selected."))
|
||||
|
||||
@ -1576,7 +1576,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
reason = (isdir and
|
||||
self.config.CONFIG_DIR_FS or
|
||||
self.config.CONFIG_DIR_IMAGE)
|
||||
if self.storage_browser == None:
|
||||
if self.storage_browser is None:
|
||||
self.storage_browser = vmmStorageBrowser(conn)
|
||||
|
||||
rhel6 = self.vm.rhel6_defaults()
|
||||
|
@ -44,6 +44,9 @@ class OverBox(Gtk.Box):
|
||||
self._fraction = 0
|
||||
self.verticalOffset = 0
|
||||
|
||||
self.window = None
|
||||
self.allocation = None
|
||||
|
||||
self.set_has_window(True)
|
||||
|
||||
####################
|
||||
@ -218,9 +221,9 @@ class OverBox(Gtk.Box):
|
||||
attr.width = self.allocation.width
|
||||
attr.height = self.allocation.height
|
||||
|
||||
mask = Gdk.WindowAttributesType.VISUAL | \
|
||||
Gdk.WindowAttributesType.X | \
|
||||
Gdk.WindowAttributesType.Y
|
||||
mask = (Gdk.WindowAttributesType.VISUAL |
|
||||
Gdk.WindowAttributesType.X |
|
||||
Gdk.WindowAttributesType.Y)
|
||||
|
||||
window = Gdk.Window.new(self.get_parent_window(), attr, mask)
|
||||
self.window = window
|
||||
|
@ -99,7 +99,7 @@ class vmmChooseCD(vmmGObjectUI):
|
||||
if idx != -1:
|
||||
path = model[idx][uihelpers.OPTICAL_DEV_PATH]
|
||||
|
||||
if path == "" or path == None:
|
||||
if path == "" or path is None:
|
||||
return self.err.val_err(_("Invalid Media Path"),
|
||||
_("A media path must be specified."))
|
||||
|
||||
@ -153,7 +153,7 @@ class vmmChooseCD(vmmGObjectUI):
|
||||
self.widget("iso-path").set_text(path)
|
||||
|
||||
def _browse_file(self):
|
||||
if self.storage_browser == None:
|
||||
if self.storage_browser is None:
|
||||
self.storage_browser = vmmStorageBrowser(self.conn)
|
||||
self.storage_browser.connect("storage-browse-finish",
|
||||
self.set_storage_path)
|
||||
|
@ -840,7 +840,7 @@ class vmmCloneVM(vmmGObjectUI):
|
||||
def callback(src_ignore, txt):
|
||||
self.widget("change-storage-new").set_text(txt)
|
||||
|
||||
if self.storage_browser == None:
|
||||
if self.storage_browser is None:
|
||||
self.storage_browser = vmmStorageBrowser(self.conn)
|
||||
self.storage_browser.connect("storage-browse-finish", callback)
|
||||
|
||||
|
@ -262,7 +262,7 @@ class vmmConfig(object):
|
||||
self._pervm_helper(uri, uuid, pref_func, self._PEROBJ_FUNC_SET, args)
|
||||
def get_pervm(self, uri, uuid, pref_func):
|
||||
ret = self._pervm_helper(uri, uuid, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret == None:
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
@ -274,7 +274,7 @@ class vmmConfig(object):
|
||||
self._perconn_helper(uri, pref_func, self._PEROBJ_FUNC_SET, value)
|
||||
def get_perconn(self, uri, pref_func):
|
||||
ret = self._perconn_helper(uri, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret == None:
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
@ -286,7 +286,7 @@ class vmmConfig(object):
|
||||
self._perhost_helper(uri, pref_func, self._PEROBJ_FUNC_SET, value)
|
||||
def get_perhost(self, uri, pref_func):
|
||||
ret = self._perhost_helper(uri, pref_func, self._PEROBJ_FUNC_GET)
|
||||
if ret == None:
|
||||
if ret is None:
|
||||
# If the GConf value is unset, return the global default.
|
||||
ret = pref_func()
|
||||
return ret
|
||||
@ -386,7 +386,7 @@ class vmmConfig(object):
|
||||
# If no schema is installed, we _really_ want this to default to True
|
||||
path = self.conf_dir + "/confirm/delete_storage"
|
||||
ret = self.conf.get(path)
|
||||
if ret == None:
|
||||
if ret is None:
|
||||
return True
|
||||
return self.conf.get_bool(path)
|
||||
|
||||
@ -478,7 +478,7 @@ class vmmConfig(object):
|
||||
def get_console_accels(self):
|
||||
console_pref = self.conf.get_bool(self.conf_dir +
|
||||
"/console/enable-accels")
|
||||
if console_pref == None:
|
||||
if console_pref is None:
|
||||
console_pref = False
|
||||
return console_pref
|
||||
def set_console_accels(self, pref):
|
||||
@ -488,7 +488,7 @@ class vmmConfig(object):
|
||||
return self.conf.notify_add(self.conf_dir + "/console/scaling", cb, userdata)
|
||||
def get_console_scaling(self):
|
||||
ret = self.conf.get(self.conf_dir + "/console/scaling")
|
||||
if ret != None:
|
||||
if ret is not None:
|
||||
ret = ret.get_int()
|
||||
return ret
|
||||
def set_console_scaling(self, pref):
|
||||
@ -497,7 +497,7 @@ class vmmConfig(object):
|
||||
# Show VM details toolbar
|
||||
def get_details_show_toolbar(self):
|
||||
res = self.conf.get_bool(self.conf_dir + "/details/show-toolbar")
|
||||
if res == None:
|
||||
if res is None:
|
||||
res = True
|
||||
return res
|
||||
def set_details_show_toolbar(self, state):
|
||||
@ -556,7 +556,7 @@ class vmmConfig(object):
|
||||
# URL/Media path history
|
||||
def _url_add_helper(self, gconf_path, url):
|
||||
urls = self.get_string_list(gconf_path)
|
||||
if urls == None:
|
||||
if urls is None:
|
||||
urls = []
|
||||
|
||||
if urls.count(url) == 0 and len(url) > 0 and not url.isspace():
|
||||
@ -610,7 +610,7 @@ class vmmConfig(object):
|
||||
return
|
||||
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/uris")
|
||||
if uris == None:
|
||||
if uris is None:
|
||||
uris = []
|
||||
|
||||
if uris.count(uri) == 0:
|
||||
@ -619,7 +619,7 @@ class vmmConfig(object):
|
||||
def remove_conn(self, uri):
|
||||
uris = self.get_string_list(self.conf_dir + "/connections/uris")
|
||||
|
||||
if uris == None:
|
||||
if uris is None:
|
||||
return
|
||||
|
||||
if uris.count(uri) != 0:
|
||||
@ -734,7 +734,7 @@ class vmmConfig(object):
|
||||
return "vm-console-" + vm.get_uuid()
|
||||
|
||||
def has_keyring(self):
|
||||
if self.keyring == None:
|
||||
if self.keyring is None:
|
||||
logging.warning("Initializing keyring")
|
||||
self.keyring = vmmKeyring()
|
||||
return self.keyring.is_available()
|
||||
@ -742,7 +742,7 @@ class vmmConfig(object):
|
||||
def clear_console_password(self, vm):
|
||||
_id = self.conf.get_int(self.conf_dir + "/console/passwords/" + vm.get_uuid())
|
||||
|
||||
if _id != None:
|
||||
if _id is not None:
|
||||
if not(self.has_keyring()):
|
||||
return
|
||||
|
||||
@ -756,12 +756,12 @@ class vmmConfig(object):
|
||||
if username is None:
|
||||
username = ""
|
||||
|
||||
if _id != None:
|
||||
if _id is not None:
|
||||
if not(self.has_keyring()):
|
||||
return ("", "")
|
||||
|
||||
secret = self.keyring.get_secret(_id)
|
||||
if secret != None and secret.get_name() == self.get_secret_name(vm):
|
||||
if secret is not None and secret.get_name() == self.get_secret_name(vm):
|
||||
if not(secret.has_attribute("hvuri")):
|
||||
return ("", "")
|
||||
if secret.get_attribute("hvuri") != vm.conn.get_uri():
|
||||
@ -787,6 +787,6 @@ class vmmConfig(object):
|
||||
{"uuid" : vm.get_uuid(),
|
||||
"hvuri": vm.conn.get_uri()})
|
||||
_id = self.keyring.add_secret(secret)
|
||||
if _id != None:
|
||||
if _id is not None:
|
||||
self.conf.set_int(self.conf_dir + "/console/passwords/" + vm.get_uuid(), _id)
|
||||
self.conf.set_string(self.conf_dir + "/console/usernames/" + vm.get_uuid(), username)
|
||||
|
@ -80,7 +80,7 @@ class vmmConnect(vmmGObjectUI):
|
||||
"on_cancel_clicked": self.cancel,
|
||||
"on_connect_clicked": self.open_conn,
|
||||
"on_vmm_open_connection_delete_event": self.cancel,
|
||||
})
|
||||
})
|
||||
|
||||
self.browser = None
|
||||
self.browser_sigs = []
|
||||
@ -393,10 +393,10 @@ class vmmConnect(vmmGObjectUI):
|
||||
# Attempt to resolve the name. If it fails, remove .local
|
||||
# if present, and try again
|
||||
if host.endswith(".local"):
|
||||
if self.can_resolve_local == False:
|
||||
if self.can_resolve_local is False:
|
||||
host = host[:-6]
|
||||
|
||||
elif self.can_resolve_local == None:
|
||||
elif self.can_resolve_local is None:
|
||||
try:
|
||||
socket.getaddrinfo(host, None)
|
||||
except:
|
||||
@ -408,9 +408,9 @@ class vmmConnect(vmmGObjectUI):
|
||||
self.can_resolve_local = True
|
||||
|
||||
else:
|
||||
if self.can_resolve_hostname == False:
|
||||
if self.can_resolve_hostname is False:
|
||||
host = ""
|
||||
elif self.can_resolve_hostname == None:
|
||||
elif self.can_resolve_hostname is None:
|
||||
try:
|
||||
socket.getaddrinfo(host, None)
|
||||
except:
|
||||
|
@ -514,7 +514,7 @@ class vmmConnection(vmmGObject):
|
||||
#######################
|
||||
|
||||
def is_storage_capable(self):
|
||||
if self._storage_capable == None:
|
||||
if self._storage_capable is None:
|
||||
self._storage_capable = virtinst.util.is_storage_capable(self.vmm)
|
||||
if self._storage_capable is False:
|
||||
logging.debug("Connection doesn't seem to support storage "
|
||||
@ -529,7 +529,7 @@ class vmmConnection(vmmGObject):
|
||||
return self._storage_capable
|
||||
|
||||
def is_network_capable(self):
|
||||
if self.network_capable == None:
|
||||
if self.network_capable is None:
|
||||
self.network_capable = virtinst.support.check_conn_support(
|
||||
self.vmm,
|
||||
virtinst.support.SUPPORT_CONN_NETWORK)
|
||||
@ -540,7 +540,7 @@ class vmmConnection(vmmGObject):
|
||||
return self.network_capable
|
||||
|
||||
def is_interface_capable(self):
|
||||
if self.interface_capable == None:
|
||||
if self.interface_capable is None:
|
||||
self.interface_capable = virtinst.support.check_conn_support(
|
||||
self.vmm,
|
||||
virtinst.support.SUPPORT_CONN_INTERFACE)
|
||||
@ -551,7 +551,7 @@ class vmmConnection(vmmGObject):
|
||||
return self.interface_capable
|
||||
|
||||
def is_nodedev_capable(self):
|
||||
if self._nodedev_capable == None:
|
||||
if self._nodedev_capable is None:
|
||||
self._nodedev_capable = virtinst.NodeDeviceParser.is_nodedev_capable(self.vmm)
|
||||
return self._nodedev_capable
|
||||
|
||||
@ -559,7 +559,7 @@ class vmmConnection(vmmGObject):
|
||||
ignore = obj
|
||||
flags_dict = self._xml_flags.get(key)
|
||||
|
||||
if flags_dict == None:
|
||||
if flags_dict is None:
|
||||
# Flags already set
|
||||
inact, act = check_func()
|
||||
flags_dict = {}
|
||||
|
@ -482,7 +482,7 @@ class SpiceViewer(Viewer):
|
||||
self.display_channel = None
|
||||
|
||||
def is_open(self):
|
||||
return self.spice_session != None
|
||||
return self.spice_session is not None
|
||||
|
||||
def _main_channel_event_cb(self, channel, event):
|
||||
if event == SpiceClientGLib.ChannelEvent.CLOSED:
|
||||
@ -817,10 +817,10 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
vnc_scroll = self.widget("console-vnc-scroll")
|
||||
|
||||
if (self.scale_type == self.config.CONSOLE_SCALE_NEVER
|
||||
and curscale == True):
|
||||
and curscale is True):
|
||||
self.viewer.set_scaling(False)
|
||||
elif (self.scale_type == self.config.CONSOLE_SCALE_ALWAYS
|
||||
and curscale == False):
|
||||
and curscale is False):
|
||||
self.viewer.set_scaling(True)
|
||||
elif (self.scale_type == self.config.CONSOLE_SCALE_FULLSCREEN
|
||||
and curscale != fs):
|
||||
@ -875,7 +875,7 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
def send_key(self, src, keys):
|
||||
ignore = src
|
||||
|
||||
if keys != None:
|
||||
if keys is not None:
|
||||
self.viewer.send_keys(keys)
|
||||
|
||||
|
||||
@ -1246,10 +1246,6 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
desktop_h = int(req.width / desktop_ratio)
|
||||
dy = (req.height - desktop_h) / 2
|
||||
|
||||
# XXX
|
||||
#@ viewer_alloc = (x=dx,
|
||||
# y=dy,
|
||||
# width=desktop_w,
|
||||
# height=desktop_h)
|
||||
|
||||
#self.viewer.display.size_allocate(viewer_alloc)
|
||||
#viewer_alloc = (x=dx, y=dy, width=desktop_w, height=desktop_h)
|
||||
viewer_alloc = (dx, dy, desktop_w, desktop_h)
|
||||
self.viewer.display.size_allocate(viewer_alloc)
|
||||
|
@ -213,7 +213,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
def remove_timers(self):
|
||||
try:
|
||||
if self.host_storage_timer:
|
||||
self.remove_timeout(self.host_storage_timer)
|
||||
self.remove_gobject_timeout(self.host_storage_timer)
|
||||
self.host_storage_timer = None
|
||||
except:
|
||||
pass
|
||||
@ -682,7 +682,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
if m[0] == label:
|
||||
label = None
|
||||
break
|
||||
if label == None:
|
||||
if label is None:
|
||||
continue
|
||||
|
||||
# Determine if this is the default given by guest_lookup
|
||||
@ -844,7 +844,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
|
||||
|
||||
def change_caps(self, gtype=None, dtype=None, arch=None):
|
||||
if gtype == None:
|
||||
if gtype is None:
|
||||
# If none specified, prefer HVM. This way, the default install
|
||||
# options won't be limited because we default to PV. If hvm not
|
||||
# supported, differ to guest_lookup
|
||||
@ -1114,7 +1114,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
ntype = row[0]
|
||||
key = row[6]
|
||||
|
||||
if (ntype == None or
|
||||
if (ntype is None or
|
||||
ntype == virtinst.VirtualNetworkInterface.TYPE_USER):
|
||||
show_pxe_warn = True
|
||||
elif ntype != virtinst.VirtualNetworkInterface.TYPE_VIRTUAL:
|
||||
@ -1372,7 +1372,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
self.detect_media_os(forward=True)
|
||||
return
|
||||
|
||||
if self.validate(notebook.get_current_page()) != True:
|
||||
if self.validate(notebook.get_current_page()) is not True:
|
||||
return
|
||||
|
||||
if curpage == PAGE_NAME:
|
||||
@ -1796,7 +1796,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
|
||||
nic = uihelpers.validate_network(self.topwin,
|
||||
self.conn, nettype, devname, macaddr)
|
||||
if nic == False:
|
||||
if nic is False:
|
||||
return False
|
||||
|
||||
if self.nic and self.nic in self.guest.get_devices("interface"):
|
||||
@ -1842,7 +1842,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
def finish(self, src_ignore):
|
||||
# Validate the final page
|
||||
page = self.widget("create-pages").get_current_page()
|
||||
if self.validate(page) != True:
|
||||
if self.validate(page) is not True:
|
||||
return False
|
||||
|
||||
self.rebuild_guest()
|
||||
@ -2151,7 +2151,7 @@ class vmmCreate(vmmGObjectUI):
|
||||
else:
|
||||
reason = self.config.CONFIG_DIR_IMAGE
|
||||
|
||||
if self.storage_browser == None:
|
||||
if self.storage_browser is None:
|
||||
self.storage_browser = vmmStorageBrowser(self.conn)
|
||||
|
||||
self.storage_browser.rhel6_defaults = self._rhel6_defaults()
|
||||
|
@ -838,7 +838,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
treepath = self.get_config_ipv6_address_selection()
|
||||
src = self.widget("ipv6-address-list")
|
||||
model = src.get_model()
|
||||
if treepath != None:
|
||||
if treepath is not None:
|
||||
del(model[treepath])
|
||||
|
||||
def ipv6_address_editted(self, src, path, new_text):
|
||||
@ -849,7 +849,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
|
||||
def ipv6_address_selected(self, src=None):
|
||||
treepath = self.get_config_ipv6_address_selection()
|
||||
has_selection = (treepath != None)
|
||||
has_selection = (treepath is not None)
|
||||
|
||||
self.widget("ipv6-address-remove").set_sensitive(has_selection)
|
||||
|
||||
@ -867,7 +867,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
notebook = self.widget("pages")
|
||||
curpage = notebook.get_current_page()
|
||||
|
||||
if self.validate(notebook.get_current_page()) != True:
|
||||
if self.validate(notebook.get_current_page()) is not True:
|
||||
return
|
||||
|
||||
self.widget("forward").grab_focus()
|
||||
@ -1103,7 +1103,7 @@ class vmmCreateInterface(vmmGObjectUI):
|
||||
|
||||
# Validate the final page
|
||||
page = self.widget("pages").get_current_page()
|
||||
if self.validate(page) != True:
|
||||
if self.validate(page) is not True:
|
||||
return False
|
||||
|
||||
activate = self.widget("interface-activate").get_active()
|
||||
|
@ -143,7 +143,7 @@ class vmmCreateNetwork(vmmGObjectUI):
|
||||
|
||||
def forward(self, ignore=None):
|
||||
notebook = self.widget("create-pages")
|
||||
if self.validate(notebook.get_current_page()) != True:
|
||||
if self.validate(notebook.get_current_page()) is not True:
|
||||
return
|
||||
|
||||
self.widget("create-forward").grab_focus()
|
||||
@ -368,7 +368,7 @@ class vmmCreateNetwork(vmmGObjectUI):
|
||||
return self.err.val_err(_("Invalid Network Name"),
|
||||
_("Network name must be non-blank and less than "
|
||||
"50 characters"))
|
||||
if re.match("^[a-zA-Z0-9_]*$", name) == None:
|
||||
if re.match("^[a-zA-Z0-9_]*$", name) is None:
|
||||
return self.err.val_err(_("Invalid Network Name"),
|
||||
_("Network name may contain alphanumeric and '_' "
|
||||
"characters only"))
|
||||
|
@ -363,7 +363,7 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
|
||||
def get_config_type(self):
|
||||
typ = self.widget("pool-type")
|
||||
if typ.get_active_iter() != None:
|
||||
if typ.get_active_iter() is not None:
|
||||
return typ.get_model().get_value(typ.get_active_iter(), 0)
|
||||
return None
|
||||
|
||||
@ -405,7 +405,7 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
def get_config_format(self):
|
||||
format_combo = self.widget("pool-format")
|
||||
model = format_combo.get_model()
|
||||
if format_combo.get_active_iter() != None:
|
||||
if format_combo.get_active_iter() is not None:
|
||||
model = format_combo.get_model()
|
||||
return model.get_value(format_combo.get_active_iter(), 0)
|
||||
return None
|
||||
@ -451,7 +451,7 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
def forward(self, ignore=None):
|
||||
notebook = self.widget("pool-pages")
|
||||
try:
|
||||
if(self.validate(notebook.get_current_page()) != True):
|
||||
if(self.validate(notebook.get_current_page()) is not True):
|
||||
return
|
||||
if notebook.get_current_page() == PAGE_FORMAT:
|
||||
self.finish()
|
||||
|
@ -163,7 +163,7 @@ class vmmCreateVolume(vmmGObjectUI):
|
||||
def get_config_format(self):
|
||||
format_combo = self.widget("vol-format")
|
||||
model = format_combo.get_model()
|
||||
if format_combo.get_active_iter() != None:
|
||||
if format_combo.get_active_iter() is not None:
|
||||
model = format_combo.get_model()
|
||||
return model.get_value(format_combo.get_active_iter(), 0)
|
||||
return None
|
||||
|
@ -106,7 +106,7 @@ class vmmDeleteDialog(vmmGObjectUI):
|
||||
def get_config_format(self):
|
||||
format_combo = self.widget("vol-format")
|
||||
model = format_combo.get_model()
|
||||
if format_combo.get_active_iter() != None:
|
||||
if format_combo.get_active_iter() is not None:
|
||||
model = format_combo.get_model()
|
||||
return model.get_value(format_combo.get_active_iter(), 0)
|
||||
return None
|
||||
|
@ -449,8 +449,8 @@ class vmmDetails(vmmGObjectUI):
|
||||
"on_config_memory_changed": self.config_memory_changed,
|
||||
"on_config_maxmem_changed": self.config_maxmem_changed,
|
||||
|
||||
"on_config_boot_moveup_clicked" : lambda *x: self.config_boot_move(True),
|
||||
"on_config_boot_movedown_clicked" : lambda *x: self.config_boot_move(False),
|
||||
"on_config_boot_moveup_clicked" : lambda *x: self.config_boot_move(x, True),
|
||||
"on_config_boot_movedown_clicked" : lambda *x: self.config_boot_move(x, False),
|
||||
"on_config_autostart_changed": lambda *x: self.enable_apply(x, x, EDIT_AUTOSTART),
|
||||
"on_boot_menu_changed": lambda *x: self.enable_apply(x, EDIT_BOOTMENU),
|
||||
"on_boot_kernel_changed": lambda *x: self.enable_apply(x, EDIT_KERNEL),
|
||||
@ -1183,7 +1183,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
dev = devs[0]
|
||||
item = Gtk.RadioMenuItem(group, _("Graphical Console %s") %
|
||||
dev.pretty_type_simple(dev.type))
|
||||
if group == None:
|
||||
if group is None:
|
||||
group = item
|
||||
|
||||
if showing_graphics:
|
||||
@ -1215,7 +1215,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
def get_selected_row(self, widget):
|
||||
selection = widget.get_selection()
|
||||
model, treepath = selection.get_selected()
|
||||
if treepath == None:
|
||||
if treepath is None:
|
||||
return None
|
||||
return model[treepath]
|
||||
|
||||
@ -1722,7 +1722,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
else:
|
||||
reason = self.config.CONFIG_DIR_IMAGE
|
||||
|
||||
if self.storage_browser == None:
|
||||
if self.storage_browser is None:
|
||||
self.storage_browser = vmmStorageBrowser(self.conn)
|
||||
|
||||
self.storage_browser.set_finish_cb(callback)
|
||||
@ -1875,7 +1875,8 @@ class vmmDetails(vmmGObjectUI):
|
||||
boot_row[BOOT_DEV_TYPE])
|
||||
self.enable_apply(EDIT_BOOTORDER)
|
||||
|
||||
def config_boot_move(self, src_ignore, move_up):
|
||||
def config_boot_move(self, src, move_up):
|
||||
ignore = src
|
||||
boot_row = self.get_boot_selection()
|
||||
if not boot_row:
|
||||
return
|
||||
@ -3633,7 +3634,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
old_order = map(lambda x: x[BOOT_DEV_TYPE], boot_model)
|
||||
boot_model.clear()
|
||||
|
||||
if bootdevs == None:
|
||||
if bootdevs is None:
|
||||
bootdevs = self.vm.get_boot_device()
|
||||
|
||||
boot_rows = {
|
||||
|
@ -133,16 +133,17 @@ class vmmInspectionData(object):
|
||||
self.applications = None
|
||||
|
||||
class vmmDomain(vmmLibvirtObject):
|
||||
"""
|
||||
Class wrapping virDomain libvirt objects. Is also extended to be
|
||||
backed by a virtinst.Guest object for new VM 'customize before install'
|
||||
"""
|
||||
|
||||
__gsignals__ = {
|
||||
"status-changed": (GObject.SignalFlags.RUN_FIRST, None, [int, int]),
|
||||
"resources-sampled": (GObject.SignalFlags.RUN_FIRST, None, []),
|
||||
"inspection-changed": (GObject.SignalFlags.RUN_FIRST, None, []),
|
||||
}
|
||||
|
||||
"""
|
||||
Class wrapping virDomain libvirt objects. Is also extended to be
|
||||
backed by a virtinst.Guest object for new VM 'customize before install'
|
||||
"""
|
||||
def __init__(self, conn, backend, uuid):
|
||||
vmmLibvirtObject.__init__(self, conn)
|
||||
|
||||
@ -251,12 +252,12 @@ class vmmDomain(vmmLibvirtObject):
|
||||
###########################
|
||||
|
||||
def get_name(self):
|
||||
if self._name == None:
|
||||
if self._name is None:
|
||||
self._name = self._backend.name()
|
||||
return self._name
|
||||
|
||||
def get_id(self):
|
||||
if self._id == None:
|
||||
if self._id is None:
|
||||
self._id = self._backend.ID()
|
||||
return self._id
|
||||
|
||||
@ -288,7 +289,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
return False
|
||||
|
||||
def is_management_domain(self):
|
||||
if self._is_management_domain == None:
|
||||
if self._is_management_domain is None:
|
||||
self._is_management_domain = (self.get_id() == 0)
|
||||
return self._is_management_domain
|
||||
|
||||
@ -962,7 +963,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
if has_xml_max or not self.is_active():
|
||||
return guest.maxvcpus
|
||||
|
||||
if self._startup_vcpus == None:
|
||||
if self._startup_vcpus is None:
|
||||
self._startup_vcpus = int(self.vcpu_count())
|
||||
return int(self._startup_vcpus)
|
||||
|
||||
@ -1096,7 +1097,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
# or GObject.props invoked in an idle callback
|
||||
|
||||
def _unregister_reboot_listener(self):
|
||||
if self.reboot_listener == None:
|
||||
if self.reboot_listener is None:
|
||||
return
|
||||
|
||||
try:
|
||||
|
@ -246,13 +246,11 @@ class vmmEngine(vmmGObject):
|
||||
def schedule_timer(self):
|
||||
interval = self.config.get_stats_update_interval() * 1000
|
||||
|
||||
if self.timer != None:
|
||||
GObject.source_remove(self.timer)
|
||||
if self.timer is not None:
|
||||
self.remove_gobject_timeout(self.timer)
|
||||
self.timer = None
|
||||
|
||||
# No need to use 'timeout_add', the tick should be
|
||||
# manually made thread safe
|
||||
self.timer = GObject.timeout_add(interval, self.tick)
|
||||
self.timer = self.timeout_add(interval, self.tick)
|
||||
|
||||
def tick(self):
|
||||
if not self.config.support_threading:
|
||||
@ -326,7 +324,7 @@ class vmmEngine(vmmGObject):
|
||||
self.inspection.cleanup()
|
||||
self.inspection = None
|
||||
|
||||
if self.timer != None:
|
||||
if self.timer is not None:
|
||||
GObject.source_remove(self.timer)
|
||||
|
||||
if self.systray:
|
||||
@ -495,7 +493,7 @@ class vmmEngine(vmmGObject):
|
||||
|
||||
def _do_show_about(self, src):
|
||||
try:
|
||||
if self.windowAbout == None:
|
||||
if self.windowAbout is None:
|
||||
self.windowAbout = vmmAbout()
|
||||
self.windowAbout.show()
|
||||
except Exception, e:
|
||||
@ -709,7 +707,7 @@ class vmmEngine(vmmGObject):
|
||||
clone_window = self.conns[uri]["windowClone"]
|
||||
|
||||
try:
|
||||
if clone_window == None:
|
||||
if clone_window is None:
|
||||
clone_window = vmmCloneVM(orig_vm)
|
||||
clone_window.connect("action-show-help", self._do_show_help)
|
||||
self.conns[uri]["windowClone"] = clone_window
|
||||
@ -895,8 +893,8 @@ class vmmEngine(vmmGObject):
|
||||
"The domain could not be restored. Would you like\n"
|
||||
"to remove the saved state and perform a regular\n"
|
||||
"start up?"),
|
||||
dialog_type=gtk.MESSAGE_WARNING,
|
||||
buttons=gtk.BUTTONS_YES_NO,
|
||||
dialog_type=Gtk.MessageType.WARNING,
|
||||
buttons=Gtk.ButtonsType.YES_NO,
|
||||
async=False)
|
||||
|
||||
if not res:
|
||||
|
@ -19,16 +19,14 @@ from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
import cairo
|
||||
|
||||
# For debugging
|
||||
def rect_print(name, rect):
|
||||
# For debugging
|
||||
print ("%s: height=%d, width=%d, x=%d, y=%d" %
|
||||
(name, rect.height, rect.width, rect.x, rect.y))
|
||||
|
||||
# For gproperties info, see:
|
||||
# http://www.pyGtk.org/docs/pyGtk.class-Gtk.ontainer.html#function-Gtk.-container-class-install-child-property
|
||||
|
||||
def _line_helper(cairo_ct, x, y, w, h, points, for_fill=False):
|
||||
|
||||
ignore = w
|
||||
bottom_baseline = y + h
|
||||
last_was_zero = False
|
||||
last_point = None
|
||||
@ -62,6 +60,7 @@ def _line_helper(cairo_ct, x, y, w, h, points, for_fill=False):
|
||||
|
||||
return last_point
|
||||
|
||||
|
||||
def draw_line(cairo_ct, x, y, w, h, points):
|
||||
if not len(points):
|
||||
return
|
||||
@ -74,15 +73,12 @@ def draw_line(cairo_ct, x, y, w, h, points):
|
||||
# Paint the line
|
||||
cairo_ct.stroke()
|
||||
|
||||
|
||||
def draw_fill(cairo_ct, x, y, w, h, points, taper=False):
|
||||
if not len(points):
|
||||
return
|
||||
|
||||
last_point = _line_helper(cairo_ct, x, y, w, h, points, for_fill=True)
|
||||
if not last_point:
|
||||
# Nothing to draw
|
||||
#return
|
||||
pass
|
||||
_line_helper(cairo_ct, x, y, w, h, points, for_fill=True)
|
||||
|
||||
baseline_y = h + y + 1
|
||||
if taper:
|
||||
@ -393,4 +389,3 @@ class Sparkline(Gtk.DrawingArea):
|
||||
def do_set_property(self, param_spec, value):
|
||||
name = self._sanitize_param_spec_name(param_spec.name)
|
||||
setattr(self, name, value)
|
||||
|
||||
|
@ -137,7 +137,7 @@ class vmmHost(vmmGObjectUI):
|
||||
"on_interface_apply_clicked" : self.interface_apply,
|
||||
|
||||
"on_config_autoconnect_toggled": self.toggle_autoconnect,
|
||||
})
|
||||
})
|
||||
|
||||
# XXX: Help docs useless/out of date
|
||||
self.widget("help_menuitem").hide()
|
||||
@ -483,7 +483,7 @@ class vmmHost(vmmGObjectUI):
|
||||
def current_network(self):
|
||||
sel = self.widget("net-list").get_selection()
|
||||
active = sel.get_selected()
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
curruuid = active[0].get_value(active[1], 0)
|
||||
return self.conn.get_net(curruuid)
|
||||
return None
|
||||
@ -497,7 +497,7 @@ class vmmHost(vmmGObjectUI):
|
||||
if row[0] == uuid:
|
||||
row[4] = self.conn.get_net(uuid).is_active()
|
||||
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
currname = active[0].get_value(active[1], 0)
|
||||
if currname == uuid:
|
||||
self.net_selected(sel)
|
||||
@ -509,8 +509,8 @@ class vmmHost(vmmGObjectUI):
|
||||
|
||||
def net_selected(self, src):
|
||||
selected = src.get_selected()
|
||||
if selected[1] == None or \
|
||||
selected[0].get_value(selected[1], 0) == None:
|
||||
if selected[1] is None or \
|
||||
selected[0].get_value(selected[1], 0) is None:
|
||||
self.set_net_error_page(_("No virtual network selected."))
|
||||
return
|
||||
|
||||
@ -726,7 +726,7 @@ class vmmHost(vmmGObjectUI):
|
||||
def current_pool(self):
|
||||
sel = self.widget("pool-list").get_selection()
|
||||
active = sel.get_selected()
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
curruuid = active[0].get_value(active[1], 0)
|
||||
return self.conn.get_pool(curruuid)
|
||||
return None
|
||||
@ -737,7 +737,7 @@ class vmmHost(vmmGObjectUI):
|
||||
return None
|
||||
sel = self.widget("vol-list").get_selection()
|
||||
active = sel.get_selected()
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
curruuid = active[0].get_value(active[1], 0)
|
||||
return pool.get_volume(curruuid)
|
||||
return None
|
||||
@ -988,7 +988,7 @@ class vmmHost(vmmGObjectUI):
|
||||
def current_interface(self):
|
||||
sel = self.widget("interface-list").get_selection()
|
||||
active = sel.get_selected()
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
currname = active[0].get_value(active[1], 0)
|
||||
return self.conn.get_interface(currname)
|
||||
|
||||
@ -1138,7 +1138,7 @@ class vmmHost(vmmGObjectUI):
|
||||
if row[0] == name:
|
||||
row[4] = self.conn.get_interface(name).is_active()
|
||||
|
||||
if active[1] != None:
|
||||
if active[1] is not None:
|
||||
currname = active[0].get_value(active[1], 0)
|
||||
if currname == name:
|
||||
self.interface_selected(sel)
|
||||
|
@ -78,7 +78,7 @@ class vmmInspection(vmmGObject):
|
||||
return 0
|
||||
|
||||
logging.debug("waiting")
|
||||
#self.add_gobject_timeout(GObject.timeout_add(self._wait, cb))
|
||||
self.timeout_add(self._wait, cb)
|
||||
|
||||
def _run(self):
|
||||
while True:
|
||||
|
@ -22,17 +22,14 @@ from virtManager.secret import vmmSecret
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
haveKeyring = False
|
||||
|
||||
try:
|
||||
# XXX
|
||||
#import gnomekeyring
|
||||
#haveKeyring = True
|
||||
pass
|
||||
import gnomekeyring
|
||||
haveKeyring = True
|
||||
except:
|
||||
logging.warning("gnomekeyring bindings not installed, no keyring support")
|
||||
|
||||
|
||||
class vmmKeyring(object):
|
||||
def __init__(self):
|
||||
self.keyring = None
|
||||
@ -41,7 +38,7 @@ class vmmKeyring(object):
|
||||
|
||||
try:
|
||||
self.keyring = gnomekeyring.get_default_keyring_sync()
|
||||
if self.keyring == None:
|
||||
if self.keyring is None:
|
||||
# Code borrowed from
|
||||
# http://trac.gajim.org/browser/src/common/passwords.py
|
||||
self.keyring = 'default'
|
||||
@ -54,7 +51,7 @@ class vmmKeyring(object):
|
||||
self.keyring = None
|
||||
|
||||
def is_available(self):
|
||||
return not (self.keyring == None)
|
||||
return not (self.keyring is None)
|
||||
|
||||
def add_secret(self, secret):
|
||||
_id = None
|
||||
|
@ -480,7 +480,7 @@ class vmmManager(vmmGObjectUI):
|
||||
active = selection.get_selected()
|
||||
|
||||
treestore, treeiter = active
|
||||
if treeiter != None:
|
||||
if treeiter is not None:
|
||||
return treestore[treeiter]
|
||||
return None
|
||||
|
||||
@ -986,7 +986,7 @@ class vmmManager(vmmGObjectUI):
|
||||
def get_inspection_icon_pixbuf(self, vm, w, h):
|
||||
# libguestfs gives us the PNG data as a string.
|
||||
png_data = vm.inspection.icon
|
||||
if png_data == None:
|
||||
if png_data is None:
|
||||
return None
|
||||
try:
|
||||
pb = GdkPixbuf.PixbufLoader(image_type="png")
|
||||
@ -1089,7 +1089,7 @@ class vmmManager(vmmGObjectUI):
|
||||
return False
|
||||
|
||||
tup = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||
if tup == None:
|
||||
if tup is None:
|
||||
return False
|
||||
path = tup[0]
|
||||
model = widget.get_model()
|
||||
@ -1099,7 +1099,7 @@ class vmmManager(vmmGObjectUI):
|
||||
return False
|
||||
|
||||
def popup_vm_menu(self, model, _iter, event):
|
||||
if model.iter_parent(_iter) != None:
|
||||
if model.iter_parent(_iter) is not None:
|
||||
# Popup the vm menu
|
||||
vm = model.get_value(_iter, ROW_HANDLE)
|
||||
|
||||
@ -1182,7 +1182,7 @@ class vmmManager(vmmGObjectUI):
|
||||
|
||||
tool_text = ""
|
||||
|
||||
if conf_entry and (conf_entry == True or
|
||||
if conf_entry and (conf_entry is True or
|
||||
conf_entry.get_value().get_bool()):
|
||||
widget.set_sensitive(True)
|
||||
else:
|
||||
|
@ -431,7 +431,7 @@ class vmmMigrateDialog(vmmGObjectUI):
|
||||
if self.get_config_max_downtime_enabled() and max_downtime == 0:
|
||||
return self.err.val_err(_("max downtime must be greater than 0."))
|
||||
|
||||
if self.get_config_interface_enabled() and interface == None:
|
||||
if self.get_config_interface_enabled() and interface is None:
|
||||
return self.err.val_err(_("An interface must be specified."))
|
||||
|
||||
if self.get_config_rate_enabled() and rate == 0:
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
from IPy import IP
|
||||
|
||||
from gi.repository import GObject
|
||||
|
||||
from virtManager import util
|
||||
from virtManager.libvirtobject import vmmLibvirtObject
|
||||
|
||||
|
@ -100,7 +100,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
"on_prefs_btn_keys_define_clicked": self.change_grab_keys,
|
||||
"on_prefs_graphics_type_changed": self.change_graphics_type,
|
||||
"on_prefs_storage_format_changed": self.change_storage_format,
|
||||
})
|
||||
})
|
||||
self.bind_escape_key_close()
|
||||
|
||||
# XXX: Help docs useless/out of date
|
||||
@ -144,7 +144,7 @@ class vmmPreferences(vmmGObjectUI):
|
||||
def refresh_console_scaling(self, ignore1=None, ignore2=None,
|
||||
ignore3=None, ignore4=None):
|
||||
val = self.config.get_console_scaling()
|
||||
if val == None:
|
||||
if val is None:
|
||||
val = 0
|
||||
self.widget("prefs-console-scaling").set_active(val)
|
||||
|
||||
@ -357,4 +357,3 @@ class vmmPreferences(vmmGObjectUI):
|
||||
# From the Preferences window, show the help document from
|
||||
# the Preferences page
|
||||
self.emit("action-show-help", "virt-manager-preferences-window")
|
||||
|
||||
|
@ -23,7 +23,7 @@ class vmmSecret(object):
|
||||
|
||||
self.name = name
|
||||
self.secret = secret
|
||||
if attributes == None:
|
||||
if attributes is None:
|
||||
attributes = {}
|
||||
self.attributes = attributes
|
||||
|
||||
|
@ -67,12 +67,12 @@ class LocalConsoleConnection(ConsoleConnection):
|
||||
self.origtermios = None
|
||||
|
||||
def open(self, dev, terminal):
|
||||
if self.fd != None:
|
||||
if self.fd is not None:
|
||||
self.close()
|
||||
|
||||
ipty = dev and dev.source_path or None
|
||||
logging.debug("Opening serial tty path: %s", ipty)
|
||||
if ipty == None:
|
||||
if ipty is None:
|
||||
return
|
||||
|
||||
self.fd = pty.slave_open(ipty)
|
||||
@ -86,7 +86,7 @@ class LocalConsoleConnection(ConsoleConnection):
|
||||
tty.setraw(self.fd, termios.TCSANOW)
|
||||
|
||||
def close(self):
|
||||
if self.fd == None:
|
||||
if self.fd is None:
|
||||
return
|
||||
|
||||
# Restore term settings
|
||||
|
@ -358,4 +358,3 @@ class vmmStorageBrowser(vmmGObjectUI):
|
||||
self.err.show_err(info,
|
||||
details=details,
|
||||
async=False)
|
||||
|
||||
|
@ -461,7 +461,7 @@ def net_list_changed(net_list, bridge_box,
|
||||
|
||||
row = net_list.get_model()[active]
|
||||
|
||||
if source_mode_box != None:
|
||||
if source_mode_box is not None:
|
||||
show_source_mode = (row[0] == VirtualNetworkInterface.TYPE_DIRECT)
|
||||
source_mode_box.set_property("visible", show_source_mode)
|
||||
source_mode_label.set_property("visible", show_source_mode)
|
||||
@ -613,7 +613,7 @@ def populate_network_list(net_list, conn, show_direct_interfaces=True):
|
||||
return_warn = is_inactive
|
||||
break
|
||||
else:
|
||||
if row[3] == True:
|
||||
if row[3] is True:
|
||||
default = idx
|
||||
return_warn = is_inactive
|
||||
break
|
||||
@ -781,7 +781,7 @@ def mediadev_added(ignore_helper, newobj, widget, devtype):
|
||||
if newobj.get_media_type() != devtype:
|
||||
return
|
||||
|
||||
if len(model) == 1 and model[0][OPTICAL_IS_VALID] == False:
|
||||
if len(model) == 1 and model[0][OPTICAL_IS_VALID] is False:
|
||||
# Only entry is the 'No device' entry
|
||||
model.clear()
|
||||
|
||||
@ -828,7 +828,7 @@ def mediadev_set_default_selection(widget):
|
||||
return
|
||||
|
||||
for row in model:
|
||||
if row[OPTICAL_IS_MEDIA_PRESENT] == True:
|
||||
if row[OPTICAL_IS_MEDIA_PRESENT] is True:
|
||||
widget.set_active(idx)
|
||||
return
|
||||
idx += 1
|
||||
|
@ -154,9 +154,9 @@ def xml_parse_wrapper(xml, parse_func, *args, **kwargs):
|
||||
ctx = doc.xpathNewContext()
|
||||
ret = parse_func(doc, ctx, *args, **kwargs)
|
||||
finally:
|
||||
if ctx != None:
|
||||
if ctx is not None:
|
||||
ctx.xpathFreeContext()
|
||||
if doc != None:
|
||||
if doc is not None:
|
||||
doc.freeDoc()
|
||||
return ret
|
||||
|
||||
@ -211,7 +211,7 @@ def browse_local(parent, dialog_name, conn, start_folder=None,
|
||||
fcdialog.set_do_overwrite_confirmation(overwrite_confirm)
|
||||
|
||||
# Set file match pattern (ex. *.png)
|
||||
if _type != None:
|
||||
if _type is not None:
|
||||
pattern = _type
|
||||
name = None
|
||||
if type(_type) is tuple:
|
||||
@ -229,7 +229,7 @@ def browse_local(parent, dialog_name, conn, start_folder=None,
|
||||
start_folder = running_config.get_default_directory(conn,
|
||||
browse_reason)
|
||||
|
||||
if start_folder != None:
|
||||
if start_folder is not None:
|
||||
if os.access(start_folder, os.R_OK):
|
||||
fcdialog.set_current_folder(start_folder)
|
||||
|
||||
@ -379,7 +379,7 @@ def get_list_selection(widget):
|
||||
active = selection.get_selected()
|
||||
|
||||
treestore, treeiter = active
|
||||
if treeiter != None:
|
||||
if treeiter is not None:
|
||||
return treestore[treeiter]
|
||||
return None
|
||||
|
||||
|
@ -21,7 +21,7 @@ import snack
|
||||
import os
|
||||
|
||||
from vmmconfigscreen import VmmTuiConfigScreen
|
||||
from createmeter import CreateMeter
|
||||
from createmeter import CreateMeter
|
||||
from domainconfig import DomainConfig
|
||||
|
||||
from virtinst import Guest
|
||||
@ -148,7 +148,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
||||
elif self.__install_source.getSelection() == DomainConfig.INSTALL_SOURCE_ISO:
|
||||
return True
|
||||
elif page is SELECT_CDROM_PAGE:
|
||||
if self.__install_media.getSelection() != None:
|
||||
if self.__install_media.getSelection() is not None:
|
||||
if len(self.get_libvirt().list_installable_volumes()) == 0:
|
||||
errors.append("No installable media detected.")
|
||||
else:
|
||||
@ -177,8 +177,10 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
||||
elif page is OS_VARIANT_PAGE:
|
||||
return True
|
||||
elif page is RAM_CPU_PAGE:
|
||||
if (len(self.__memory.value()) > 0 and len(self.__cpus.value()) > 0) \
|
||||
and (int(self.__memory.value()) > 0 and int(self.__cpus.value()) > 0):
|
||||
if (len(self.__memory.value()) > 0 and
|
||||
len(self.__cpus.value()) > 0 and
|
||||
int(self.__memory.value()) > 0 and
|
||||
int(self.__cpus.value()) > 0):
|
||||
return True
|
||||
else:
|
||||
if len(self.__memory.value()) == 0:
|
||||
@ -210,7 +212,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
||||
else:
|
||||
errors.append("Please select a storage volume.")
|
||||
elif page is BRIDGE_PAGE:
|
||||
if self.__network_bridges.getSelection() != None:
|
||||
if self.__network_bridges.getSelection() is not None:
|
||||
if len(self.__mac_address.value()) > 0:
|
||||
# TODO: regex check the format
|
||||
return True
|
||||
@ -219,7 +221,8 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
||||
else:
|
||||
errors.append("A network bridge must be selected.")
|
||||
elif page is VIRT_DETAILS_PAGE:
|
||||
if self.__virt_types.getSelection() != None and self.__architectures.getSelection() != None:
|
||||
if (self.__virt_types.getSelection() is not None and
|
||||
self.__architectures.getSelection() is not None):
|
||||
return True
|
||||
if self.__virt_types.getSelection() is None:
|
||||
errors.append("Please select a virtualization type.")
|
||||
@ -399,7 +402,7 @@ class DomainConfigScreen(VmmTuiConfigScreen):
|
||||
self.__has_install_media = True
|
||||
self.__install_media = snack.RadioBar(screen, (drives))
|
||||
fields.append((self.__install_media, None))
|
||||
if self.__has_install_media == False:
|
||||
if self.__has_install_media is False:
|
||||
fields.append(("No media detected.", None))
|
||||
return [snack.Label("Select the install media"),
|
||||
self.create_grid_from_fields(fields)]
|
||||
|
@ -19,7 +19,7 @@
|
||||
from newt_syrup.menuscreen import MenuScreen
|
||||
|
||||
from changehost import ChangeHost
|
||||
from addhost import AddHost
|
||||
from addhost import AddHost
|
||||
from removehost import RemoveHost
|
||||
|
||||
SELECT_HOST = 1
|
||||
|
@ -496,7 +496,8 @@ class LibvirtWorker:
|
||||
if config.get_os_variant() != "generic":
|
||||
self.__guest.os_variant = config.get_os_variant()
|
||||
|
||||
self.__guest._graphics_dev = virtinst.VirtualGraphics(type=virtinst.VirtualGraphics.TYPE_VNC)
|
||||
self.__guest.add_device(
|
||||
virtinst.VirtualGraphics(type=virtinst.VirtualGraphics.TYPE_VNC))
|
||||
self.__guest.sound_devs = []
|
||||
self.__guest.sound_devs.append(virtinst.VirtualAudio(model="es1370"))
|
||||
|
||||
|
@ -47,6 +47,10 @@ TEST_HACKS="protected member (_is_virtinst_test_uri|_open_test_uri)"
|
||||
STUBCLASS="Instance of 'stubclass'"
|
||||
DBUSINTERFACE="Instance of 'Interface'"
|
||||
|
||||
# Pylint can't tell sparkline has GtkWidget bits
|
||||
SPARKLINEWIDGET="Instance of '(CellRendererSparkline|Sparkline|AutoDrawer|OverBox|_errorDialog)' has no '(show|destroy|set_property|get_property|get_style_context|queue_draw|get_window|get_toplevel|set_child_packing|connect|get_realized|set_window|set_realized|get_parent_window|remove|add|queue_resize|get_events|get_visual|child_get_property|set_has_window|destroy|show_all|set_title|vbox|hide)'"
|
||||
|
||||
|
||||
DMSG=""
|
||||
skipmsg() {
|
||||
DMSG="${DMSG},$1"
|
||||
@ -69,6 +73,8 @@ skipmsg "C0111" # C0111: No docstring
|
||||
skipmsg "C0301" # C0301: Line too long
|
||||
skipmsg "C0302" # C0302: Too many lines in module
|
||||
skipmsg "R0201" # R0201: Method could be a function
|
||||
skipmsg "W1001" # W1001: Pylint can't tell that extending Gtk
|
||||
# classes allows use of 'property'
|
||||
skipmsg "W0141" # W0141: Complaining about 'map' and 'filter'
|
||||
skipmsg "W0142" # W0142: *Used * or ** magic*
|
||||
skipmsg "W0403" # W0403: Relative imports
|
||||
@ -89,12 +95,14 @@ SHOW_REPORT="n"
|
||||
AWK=awk
|
||||
[ `uname -s` = 'SunOS' ] && AWK=nawk
|
||||
|
||||
format="colorized"
|
||||
[ ! -t 1 ] && format="text"
|
||||
|
||||
echo "Running pylint"
|
||||
pylint --ignore=$IGNOREFILES $PYLINT_FILES \
|
||||
--additional-builtins=_ \
|
||||
--reports=$SHOW_REPORT \
|
||||
--output-format=colorized \
|
||||
--output-format=$format \
|
||||
--dummy-variables-rgx="dummy|ignore.*|.*_ignore" \
|
||||
--disable=${DMSG}\
|
||||
--disable=${DCHECKERS} 2>&1 | \
|
||||
@ -109,6 +117,7 @@ egrep -ve "$NO_PYL_CONFIG" \
|
||||
-ve "$STYLE_ATTACH" \
|
||||
-ve "$VBOX_PACK" \
|
||||
-ve "$GI_IMPORT" \
|
||||
-ve "$SPARKLINEWIDGET" \
|
||||
-ve "$INFER_ERRORS" | \
|
||||
$AWK '\
|
||||
# Strip out any "*** Module name" lines if we dont list any errors for them
|
||||
@ -144,11 +153,10 @@ skip_pep8() {
|
||||
|
||||
skip_pep8 "E121"
|
||||
skip_pep8 "E122"
|
||||
skip_pep8 "E123"
|
||||
skip_pep8 "E124"
|
||||
skip_pep8 "E125" # Continuation line indents
|
||||
skip_pep8 "E126"
|
||||
skip_pep8 "E127"
|
||||
skip_pep8 "E125"
|
||||
skip_pep8 "E126" # Continuation line indentation bits.
|
||||
skip_pep8 "E127" # doesn't work for function calls as parameters
|
||||
skip_pep8 "E128"
|
||||
|
||||
skip_pep8 "E203" # Space before : in dictionary defs
|
||||
@ -157,8 +165,7 @@ skip_pep8 "E221" # Multiple spaces before operator (warns
|
||||
skip_pep8 "E241" # Space after , column alignment nono
|
||||
skip_pep8 "E251" # No space around keyword
|
||||
skip_pep8 "E261" # 2 spaces before inline comment?
|
||||
skip_pep8 "E271" # Multiple spaces before keyword
|
||||
skip_pep8 "E272" # Multiple spaces before keyword
|
||||
skip_pep8 "E272" # Lining up 'from X import Y" statements
|
||||
|
||||
skip_pep8 "E301" # 1 blank line between methods
|
||||
skip_pep8 "E302" # 2 blank lines between function defs
|
||||
|
Loading…
Reference in New Issue
Block a user