Fixed copy code block button
This commit is contained in:
parent
01b38fa37a
commit
ea0caf03d6
@ -100,14 +100,14 @@ class code_block(Gtk.Box):
|
|||||||
title_box = Gtk.Box(margin_start=12, margin_top=3, margin_bottom=3, margin_end=3)
|
title_box = Gtk.Box(margin_start=12, margin_top=3, margin_bottom=3, margin_end=3)
|
||||||
title_box.append(Gtk.Label(label=self.language.get_name() if self.language else _("Code Block"), hexpand=True, xalign=0))
|
title_box.append(Gtk.Label(label=self.language.get_name() if self.language else _("Code Block"), hexpand=True, xalign=0))
|
||||||
copy_button = Gtk.Button(icon_name="edit-copy-symbolic", css_classes=["flat", "circular"], tooltip_text=_("Copy Message"))
|
copy_button = Gtk.Button(icon_name="edit-copy-symbolic", css_classes=["flat", "circular"], tooltip_text=_("Copy Message"))
|
||||||
copy_button.connect("clicked", self.on_copy)
|
copy_button.connect("clicked", lambda *_: self.on_copy)
|
||||||
title_box.append(copy_button)
|
title_box.append(copy_button)
|
||||||
self.append(title_box)
|
self.append(title_box)
|
||||||
self.append(Gtk.Separator())
|
self.append(Gtk.Separator())
|
||||||
self.append(self.source_view)
|
self.append(self.source_view)
|
||||||
self.buffer.set_text(text)
|
self.buffer.set_text(text)
|
||||||
|
|
||||||
def on_copy(self, *_):
|
def on_copy(self):
|
||||||
logger.debug("Copying code")
|
logger.debug("Copying code")
|
||||||
clipboard = Gdk.Display().get_default().get_clipboard()
|
clipboard = Gdk.Display().get_default().get_clipboard()
|
||||||
start = self.buffer.get_start_iter()
|
start = self.buffer.get_start_iter()
|
||||||
@ -177,6 +177,7 @@ class image(Gtk.Button):
|
|||||||
__gtype_name__ = 'AlpacaImage'
|
__gtype_name__ = 'AlpacaImage'
|
||||||
|
|
||||||
def __init__(self, image_path:str):
|
def __init__(self, image_path:str):
|
||||||
|
print('aaa ', image_path)
|
||||||
self.image_path = image_path
|
self.image_path = image_path
|
||||||
self.image_name = os.path.basename(self.image_path)
|
self.image_name = os.path.basename(self.image_path)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user