diff options
author | Cole Robinson <crobinso@redhat.com> | 2022-02-19 12:01:55 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2022-02-19 15:33:42 -0500 |
commit | 382391eadb3508241ef333d81cc09688fa572811 (patch) | |
tree | 75df8dddf37c970ab155bcb9ab8232981a700fa3 /virtManager | |
parent | cfc438c024e6044cb85a1a1882cb095ddc894184 (diff) | |
download | virt-manager-382391eadb3508241ef333d81cc09688fa572811.tar.gz |
Clean up gtk STOCK and various image usage
- Remove most use of deprecated stock icons. Without it the UI will
be a lot more ugly in Fedora 36
- Remove deprecated ImageMenuItem usage, convert to regular MenuItem
- Remove most embedded button images
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'virtManager')
-rw-r--r-- | virtManager/addhardware.py | 14 | ||||
-rw-r--r-- | virtManager/clone.py | 6 | ||||
-rw-r--r-- | virtManager/delete.py | 6 | ||||
-rw-r--r-- | virtManager/details/console.py | 4 | ||||
-rw-r--r-- | virtManager/details/details.py | 12 | ||||
-rw-r--r-- | virtManager/details/serialcon.py | 6 | ||||
-rw-r--r-- | virtManager/details/snapshots.py | 14 | ||||
-rw-r--r-- | virtManager/hostnets.py | 7 | ||||
-rw-r--r-- | virtManager/hoststorage.py | 5 | ||||
-rw-r--r-- | virtManager/manager.py | 16 | ||||
-rw-r--r-- | virtManager/object/network.py | 2 | ||||
-rw-r--r-- | virtManager/vmmenu.py | 40 |
12 files changed, 40 insertions, 92 deletions
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index bcf44bd4..d77f89b2 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -224,21 +224,21 @@ class vmmAddHardware(vmmGObjectUI): add_hw_option(_("Sound"), "audio-card", PAGE_SOUND, self.vm.is_hvm(), _("Not supported for this guest type.")) - add_hw_option(_("Serial"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Serial"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "serial") - add_hw_option(_("Parallel"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Parallel"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "parallel") - add_hw_option(_("Console"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Console"), "device_serial", PAGE_CHAR, True, None, "console") - add_hw_option(_("Channel"), Gtk.STOCK_CONNECT, PAGE_CHAR, + add_hw_option(_("Channel"), "device_serial", PAGE_CHAR, self.vm.is_hvm(), _("Not supported for this guest type."), "channel") - add_hw_option(_("USB Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("USB Host Device"), "device_usb", PAGE_HOSTDEV, self.conn.support.conn_nodedev(), _("Connection does not support host device enumeration"), "usb") @@ -249,10 +249,10 @@ class vmmAddHardware(vmmGObjectUI): if self.vm.is_container(): nodedev_enabled = False nodedev_errstr = _("Not supported for containers") - add_hw_option(_("PCI Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("PCI Host Device"), "device_pci", PAGE_HOSTDEV, nodedev_enabled, nodedev_errstr, "pci") - add_hw_option(_("MDEV Host Device"), "system-run", PAGE_HOSTDEV, + add_hw_option(_("MDEV Host Device"), "device_pci", PAGE_HOSTDEV, self.conn.support.conn_nodedev(), _("Connection does not support host device enumeration"), "mdev") diff --git a/virtManager/clone.py b/virtManager/clone.py index 442d572a..7cb8ed67 100644 --- a/virtManager/clone.py +++ b/virtManager/clone.py @@ -304,10 +304,10 @@ class vmmCloneVM(vmmGObjectUI): _chkbox.set_property('active', active) _chkbox.set_property('visible', visible) _chkimg.set_property('visible', not visible) - icon = Gtk.STOCK_INFO + icon = "dialog-information" if sinfo.warn_about_sharing(): - icon = Gtk.STOCK_DIALOG_WARNING - _chkimg.set_property('stock-id', icon) + icon = "dialog-warning" + _chkimg.set_property('icon-name', icon) tooltip = sinfo.get_tooltip() if tooltip != model[_iter][1]: model[_iter][1] = tooltip diff --git a/virtManager/delete.py b/virtManager/delete.py index 9ee60b5d..f050534b 100644 --- a/virtManager/delete.py +++ b/virtManager/delete.py @@ -487,7 +487,7 @@ def _populate_storage_list(storage_list, vm, conn, diskdatas): elif not default: info = definfo - icon = Gtk.STOCK_DIALOG_WARNING + icon = "dialog-warning" icon_size = Gtk.IconSize.LARGE_TOOLBAR row = [default, not can_del, diskdata.path, diskdata.label, @@ -496,7 +496,7 @@ def _populate_storage_list(storage_list, vm, conn, diskdatas): def _prepare_storage_list(storage_list): - # Checkbox, deleteable?, storage path, target (hda), icon stock, + # Checkbox, deleteable?, storage path, target (hda), icon name, # icon size, tooltip model = Gtk.ListStore(bool, bool, str, str, bool, str, int, str) storage_list.set_model(model) @@ -544,7 +544,7 @@ def _prepare_storage_list(storage_list): info_img = Gtk.CellRendererPixbuf() infoCol.pack_start(info_img, False) infoCol.add_attribute(info_img, 'visible', STORAGE_ROW_ICON_SHOW) - infoCol.add_attribute(info_img, 'stock-id', STORAGE_ROW_ICON) + infoCol.add_attribute(info_img, 'icon-name', STORAGE_ROW_ICON) infoCol.add_attribute(info_img, 'stock-size', STORAGE_ROW_ICON_SIZE) infoCol.set_sort_column_id(STORAGE_ROW_ICON) diff --git a/virtManager/details/console.py b/virtManager/details/console.py index f19dc95c..600cb43b 100644 --- a/virtManager/details/console.py +++ b/virtManager/details/console.py @@ -149,7 +149,9 @@ class vmmOverlayToolbar: self._toolbar.get_accessible().set_name("Fullscreen Toolbar") # Exit button - button = Gtk.ToolButton.new_from_stock(Gtk.STOCK_LEAVE_FULLSCREEN) + button = Gtk.ToolButton() + button.set_label(_("Leave Fullscreen")) + button.set_icon_name("view-restore") button.set_tooltip_text(_("Leave fullscreen")) button.show() button.get_accessible().set_name("Fullscreen Exit") diff --git a/virtManager/details/details.py b/virtManager/details/details.py index 2b483409..8f344c7d 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -534,21 +534,13 @@ class vmmDetails(vmmGObjectUI): # Add HW popup menu self._popupmenu = Gtk.Menu() - addHW = Gtk.ImageMenuItem.new_with_label(_("_Add Hardware")) - addHW.set_use_underline(True) - addHWImg = Gtk.Image() - addHWImg.set_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.MENU) - addHW.set_image(addHWImg) + addHW = Gtk.MenuItem.new_with_mnemonic(_("_Add Hardware")) addHW.show() def _addhw_clicked_cb(*args, **kwargs): self._show_addhw() addHW.connect("activate", _addhw_clicked_cb) - rmHW = Gtk.ImageMenuItem.new_with_label(_("_Remove Hardware")) - rmHW.set_use_underline(True) - rmHWImg = Gtk.Image() - rmHWImg.set_from_stock(Gtk.STOCK_REMOVE, Gtk.IconSize.MENU) - rmHW.set_image(rmHWImg) + rmHW = Gtk.MenuItem.new_with_mnemonic(_("_Remove Hardware")) rmHW.show() def _remove_clicked_cb(*args, **kwargs): self._config_remove() diff --git a/virtManager/details/serialcon.py b/virtManager/details/serialcon.py index fbd0ff4f..42dbc78d 100644 --- a/virtManager/details/serialcon.py +++ b/virtManager/details/serialcon.py @@ -248,13 +248,11 @@ class vmmSerialConsole(vmmGObject): self._serial_popup = Gtk.Menu() self._serial_popup.get_accessible().set_name("serial-popup-menu") - self._serial_copy = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_COPY, - None) + self._serial_copy = Gtk.MenuItem.new_with_mnemonic(_("_Copy")) self._serial_copy.connect("activate", self._serial_copy_text) self._serial_popup.add(self._serial_copy) - self._serial_paste = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PASTE, - None) + self._serial_paste = Gtk.MenuItem.new_with_mnemonic(_("_Paste")) self._serial_paste.connect("activate", self._serial_paste_text) self._serial_popup.add(self._serial_paste) diff --git a/virtManager/details/snapshots.py b/virtManager/details/snapshots.py index 83c06768..2665b4b5 100644 --- a/virtManager/details/snapshots.py +++ b/virtManager/details/snapshots.py @@ -358,7 +358,7 @@ class vmmSnapshotPage(vmmGObjectUI): img = Gtk.CellRendererPixbuf() img.set_property("stock-size", Gtk.IconSize.MENU) - img.set_property("icon-name", Gtk.STOCK_APPLY) + img.set_property("icon-name", "emblem-default") img.set_property("xalign", 0.0) col.pack_start(img, False) col.add_attribute(img, "visible", 5) @@ -375,20 +375,12 @@ class vmmSnapshotPage(vmmGObjectUI): # Snapshot popup menu menu = Gtk.Menu() - item = Gtk.ImageMenuItem.new_with_label(_("_Start snapshot")) - item.set_use_underline(True) - img = Gtk.Image() - img.set_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.MENU) - item.set_image(img) + item = Gtk.MenuItem.new_with_mnemonic(_("_Start snapshot")) item.show() item.connect("activate", self._on_start_clicked) menu.add(item) - item = Gtk.ImageMenuItem.new_with_label(_("_Delete snapshot")) - item.set_use_underline(True) - img = Gtk.Image() - img.set_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.MENU) - item.set_image(img) + item = Gtk.MenuItem.new_with_mnemonic(_("_Delete snapshot")) item.show() item.connect("activate", self._on_delete_clicked) menu.add(item) diff --git a/virtManager/hostnets.py b/virtManager/hostnets.py index c12a2983..21c22169 100644 --- a/virtManager/hostnets.py +++ b/virtManager/hostnets.py @@ -201,10 +201,6 @@ class vmmHostNets(vmmGObjectUI): if not netstr: return - forward = net.get_ipv4_forward_mode() - self.widget("net-ipv4-forwarding-icon").set_from_stock( - forward and Gtk.STOCK_CONNECT or Gtk.STOCK_DISCONNECT, - Gtk.IconSize.MENU) self.widget("net-ipv4-forwarding").set_text(net.pretty_forward_mode()) dhcpstr = _("Disabled") @@ -217,9 +213,6 @@ class vmmHostNets(vmmGObjectUI): (netstr, (dhcpstart, dhcpend)) = net.get_ipv6_network() self.widget("net-ipv6-expander").set_visible(bool(netstr)) - self.widget("net-ipv6-forwarding-icon").set_from_stock( - netstr and Gtk.STOCK_CONNECT or Gtk.STOCK_DISCONNECT, - Gtk.IconSize.MENU) if netstr: prettymode = _("Routed network") diff --git a/virtManager/hoststorage.py b/virtManager/hoststorage.py index b1b7cf6b..594c6587 100644 --- a/virtManager/hoststorage.py +++ b/virtManager/hoststorage.py @@ -175,10 +175,7 @@ class vmmHostStorage(vmmGObjectUI): # Volume list popup menu self._volmenu = Gtk.Menu() - volCopyPath = Gtk.ImageMenuItem.new_with_label(_("Copy Volume Path")) - volCopyImage = Gtk.Image() - volCopyImage.set_from_stock(Gtk.STOCK_COPY, Gtk.IconSize.MENU) - volCopyPath.set_image(volCopyImage) + volCopyPath = Gtk.MenuItem.new_with_mnemonic(_("Copy Volume Path")) volCopyPath.show() volCopyPath.connect("activate", self._vol_copy_path_cb) self._volmenu.add(volCopyPath) diff --git a/virtManager/manager.py b/virtManager/manager.py index c683f2bb..aa3d6023 100644 --- a/virtManager/manager.py +++ b/virtManager/manager.py @@ -281,10 +281,7 @@ class vmmManager(vmmGObjectUI): def init_context_menus(self): def add_to_menu(idx, text, cb): - if text[0:3] == 'gtk': - item = Gtk.ImageMenuItem.new_from_stock(text, None) - else: - item = Gtk.ImageMenuItem.new_with_mnemonic(text) + item = Gtk.MenuItem.new_with_mnemonic(text) if cb: item.connect("activate", cb) item.get_accessible().set_name("conn-%s" % idx) @@ -292,14 +289,13 @@ class vmmManager(vmmGObjectUI): self.connmenu_items[idx] = item # Build connection context menu - add_to_menu("create", Gtk.STOCK_NEW, self.new_vm) - add_to_menu("connect", Gtk.STOCK_CONNECT, self.open_conn) - add_to_menu("disconnect", Gtk.STOCK_DISCONNECT, - self.close_conn) + add_to_menu("create", _("_New"), self.new_vm) + add_to_menu("connect", _("_Connect"), self.open_conn) + add_to_menu("disconnect", _("Dis_connect"), self.close_conn) self.connmenu.add(Gtk.SeparatorMenuItem()) - add_to_menu("delete", Gtk.STOCK_DELETE, self.do_delete) + add_to_menu("delete", _("De_lete"), self.do_delete) self.connmenu.add(Gtk.SeparatorMenuItem()) - add_to_menu("details", _("D_etails"), self.show_host) + add_to_menu("details", _("_Details"), self.show_host) self.connmenu.show_all() def init_vmlist(self): diff --git a/virtManager/object/network.py b/virtManager/object/network.py index da31c00a..d9fb91a1 100644 --- a/virtManager/object/network.py +++ b/virtManager/object/network.py @@ -109,8 +109,6 @@ class vmmNetwork(vmmLibvirtObject): return self.get_xmlobj().domain_name def get_ipv6_enabled(self): return self.get_xmlobj().ipv6 - def get_ipv4_forward_mode(self): - return self.get_xmlobj().forward.mode def _get_network(self, family): dhcpstart = None diff --git a/virtManager/vmmenu.py b/virtManager/vmmenu.py index e239b7d8..5a99985f 100644 --- a/virtManager/vmmenu.py +++ b/virtManager/vmmenu.py @@ -24,20 +24,8 @@ class _VMMenu(Gtk.Menu): self._init_state() - def _add_action(self, label, widgetname, cb, - iconname="system-shutdown"): - if label.startswith("gtk-"): - item = Gtk.ImageMenuItem.new_from_stock(label, None) - else: - item = Gtk.ImageMenuItem.new_with_mnemonic(label) - - if iconname: - if iconname.startswith("gtk-"): - icon = Gtk.Image.new_from_stock(iconname, Gtk.IconSize.MENU) - else: - icon = Gtk.Image.new_from_icon_name(iconname, - Gtk.IconSize.MENU) - item.set_image(icon) + def _add_action(self, label, widgetname, cb): + item = Gtk.MenuItem.new_with_mnemonic(label) item.vmm_widget_name = widgetname if cb: @@ -66,8 +54,7 @@ class VMShutdownMenu(_VMMenu): self._add_action(_("F_orce Reset"), "reset", VMActionUI.reset) self._add_action(_("_Force Off"), "destroy", VMActionUI.destroy) self.add(Gtk.SeparatorMenuItem()) - self._add_action(_("Sa_ve"), "save", VMActionUI.save, - iconname=Gtk.STOCK_SAVE) + self._add_action(_("Sa_ve"), "save", VMActionUI.save) self.get_accessible().set_name("vmm-shutdown-menu") self.show_all() @@ -92,27 +79,20 @@ class VMActionMenu(_VMMenu): VM submenu for run, pause, shutdown, clone, etc """ def _init_state(self): - self._add_action(_("_Run"), "run", VMActionUI.run, - iconname=Gtk.STOCK_MEDIA_PLAY) - self._add_action(_("_Pause"), "suspend", VMActionUI.suspend, - Gtk.STOCK_MEDIA_PAUSE) - self._add_action(_("R_esume"), "resume", VMActionUI.resume, - Gtk.STOCK_MEDIA_PAUSE) + self._add_action(_("_Run"), "run", VMActionUI.run) + self._add_action(_("_Pause"), "suspend", VMActionUI.suspend) + self._add_action(_("R_esume"), "resume", VMActionUI.resume) s = self._add_action(_("_Shut Down"), "shutdown", None) s.set_submenu(VMShutdownMenu(self._parent, self._current_vm_cb)) self.add(Gtk.SeparatorMenuItem()) - self._add_action(_("Clone..."), "clone", - VMActionUI.clone, iconname=None) - self._add_action(_("Migrate..."), "migrate", - VMActionUI.migrate, iconname=None) - self._add_action(_("_Delete"), "delete", - VMActionUI.delete, iconname=Gtk.STOCK_DELETE) + self._add_action(_("Clone..."), "clone", VMActionUI.clone) + self._add_action(_("Migrate..."), "migrate", VMActionUI.migrate) + self._add_action(_("_Delete"), "delete", VMActionUI.delete) if self._show_open: self.add(Gtk.SeparatorMenuItem()) - self._add_action(Gtk.STOCK_OPEN, "show", - VMActionUI.show, iconname=None) + self._add_action(_("_Open"), "show", VMActionUI.show) self.get_accessible().set_name("vm-action-menu") self.show_all() |