check if icon picker available

This commit is contained in:
piotr
2022-05-22 01:52:17 +02:00
parent 522392e6de
commit 2cbbc6e6f8

View File

@@ -2353,6 +2353,11 @@ class EditorWrapper(object):
self.scrolled_window.add(custom_items_grid)
def on_pick_btn(btn, entry):
s = cmd2string("nwg-icon-picker")
entry.set_text(s)
class ControlsCustomItems(Gtk.Frame):
def __init__(self, panel, config, file):
check_key(panel, "controls-settings", {})
@@ -2399,10 +2404,11 @@ class ControlsCustomItems(Gtk.Frame):
entry.connect("changed", self.update_icon, self.icons, i, "icon")
hbox.pack_start(entry, False, False, 0)
btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
btn.set_tooltip_text("Pick an icon")
btn.connect("clicked", self.on_pick_btn, entry)
hbox.pack_start(btn, False, False, 0)
if is_command("nwg-icon-picker"):
btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
btn.set_tooltip_text("Pick an icon")
btn.connect("clicked", on_pick_btn, entry)
hbox.pack_start(btn, False, False, 0)
entry = Gtk.Entry()
entry.set_width_chars(15)
@@ -2448,10 +2454,11 @@ class ControlsCustomItems(Gtk.Frame):
self.new_icon.connect("changed", update_icon, self.icons)
hbox.pack_start(self.new_icon, False, False, 0)
btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
btn.set_tooltip_text("Pick an icon")
btn.connect("clicked", self.on_pick_btn, self.new_icon)
hbox.pack_start(btn, False, False, 0)
if is_command("nwg-icon-picker"):
btn = Gtk.Button.new_from_icon_name("nwg-icon-picker", Gtk.IconSize.MENU)
btn.set_tooltip_text("Pick an icon")
btn.connect("clicked", on_pick_btn, self.new_icon)
hbox.pack_start(btn, False, False, 0)
self.new_command = Gtk.Entry()
self.new_command.set_width_chars(15)
@@ -2472,10 +2479,6 @@ class ControlsCustomItems(Gtk.Frame):
self.show_all()
def on_pick_btn(self, btn, entry):
s = cmd2string("nwg-icon-picker")
entry.set_text(s)
def update_value_from_entry(self, gtk_entry, i, key):
self.items[i][key] = gtk_entry.get_text()