Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try:
cur_parent_id = int(self.old_parent)
except ValueError:
cur_parent_id = -1
if not new_parent_id == cur_parent_id:
mem_id = int(dragged)
if not cur_parent_id == -1:
self.mht.stage(MOp_RemoveMemChild, mem_id, cur_parent_id)
if not new_parent_id == -1:
self.mht.stage(MOp_AddMemChild, mem_id, new_parent_id)
mem = self.iid2node[dragged]
self.mht.commit(sequence_description =
_("Moving of memory '%s' (%d).") % (
mem.name, mem.id
)
)
else:
old_placed = True
while self.highlighted_path:
p = self.highlighted_path.pop()
if self.exists(p + "-up-place"):
self.delete(p + "-up-place")
if self.exists(p + "-down-place"):
self.delete(p + "-down-place")
if self.exists("child-place"):
self.delete("child-place")
def _description(self):
if self.prev_layouts is None:
return _("Set layout for '%s' description representation.") % \
self.desc_name
elif self.new_layout is None:
return _("Remove layouts of '%s' description representation.") % \
self.desc_name
else:
return _("Replace layout of '%s' description representation.") % \
self.desc_name
def get_kind_str(self):
if "SystemBusDeviceNode" in self.nc:
return _("system bus device")
elif "PCIExpressDeviceNode" in self.nc:
return _("PCI(E) function")
elif "DeviceNode" in self.nc:
return _("generic device")
def __init__(self, root, *args, **kw):
GUIDialog.__init__(self, master = root, *args, **kw)
self.qom_type_var = root.qom_type_var
self.title(_("Device Tree"))
self.grid()
self.columnconfigure(0, weight = 1)
self.rowconfigure(0, weight = 1)
self.columnconfigure(2, minsize = 200)
geom = "+" + str(int(root.winfo_rootx())) \
+ "+" + str(int(root.winfo_rooty()))
self.geometry(geom)
self.focus()
self.device_tree = VarTreeview(self)
self.device_tree["columns"] = ("Macros")
def get_pci_id_kind_str(pci_id):
if type(pci_id) is PCIVendorId:
return _("vendor")
elif type(pci_id) is PCIDeviceId:
return _("device")
elif type(pci_id) is PCIClassId:
return _("class")
def on_generate(self):
try:
t = self._project_generation_task
except AttributeError:
pass
else:
if not t.finished:
showerror(
title = _("Generation is cancelled").get(),
message = _("At least one generation task is already \
in process.").get()
)
return
if not self.proj.build_path:
showerror(
title = _("Generation is impossible").get(),
message = _("No Qemu build path is set for the project.").get()
)
return
try:
qvd = qvd_get(self.proj.build_path,
version = self.proj.target_version
)
def _description(self):
mach = self.find_desc()
mem = mach.id2node[self.node_id]
return _("Redirect memory alias '%s' (%d) from %s to %s.\
") % (
mem.name,
self.node_id,
self.gen_id_str(self.old_val),
self.gen_id_str(self.new_val)
)
def update_qemu_build_path(self, bp):
if bp is None:
self.var_qemu_build_path.set(_("No QEMU build path selected").get())
else:
self.var_qemu_build_path.set("QEMU: " + bp)
self.var_slot = StringVar()
e = HKEntry(lf, textvariable = self.var_slot)
e.grid(row = 0, column = 1, sticky = "NEWS")
l = VarLabel(lf, text = _("Function number"))
l.grid(row = 1, column = 0, sticky = "NES")
self.var_function = StringVar()
e = HKEntry(lf, textvariable = self.var_function)
e.grid(row = 1, column = 1, sticky = "NEWS")
self.var_multifunction = BooleanVar()
chb = VarCheckbutton(lf,
variable = self.var_multifunction,
text = _("multifunction")
)
chb.grid(row = 2, column = 0, columnspan = 2, sticky = "NWS")
command = self.on_popup_node_alias_target
)
menu.add_separator()
menu.add_command(
label = _("Settings"),
command = self.on_popup_node_settings
)
""" All commands should follow consequent rule. If a command
does action immediately then it should be disabled in snapshot mode like this
command. If a command shows a dialog then either the dialog should support
snapshot mode or the command should be disabled too.
"""
menu.add_separator()
menu.add_command(
label = _("Delete"),
command = self.notify_popup_command if self.mht is None else \
self.on_popup_node_delete
)
p1.add_separator()
self.popup_not_leaf_node_submenu = c0 = VarMenu(p1, tearoff = 0)
self.popup_empty_submenu = c1 = VarMenu(p2, tearoff = 0)
self.alias_to = None
for memory_type in [
_("Container"),
_("RAM"),
_("ROM")
]:
c0.add_command(