fixed clipboard copy

parent b54e9451
Pipeline #234940 failed with stage
in 22 seconds
from gi.repository import Gdk
def clipboard_copy(txt):
Gdk.Display.get_default().get_clipboard().set(txt)
from gi.repository import Gtk, Gdk, Gio, GLib
from whatip.clipboard_helper import clipboard_copy
class LanListboxRow(Gtk.ListBoxRow):
......@@ -50,9 +51,7 @@ class LanListboxRow(Gtk.ListBoxRow):
self.set_child(self.mainbox)
def on_copy_btn_clicked(self, *args):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(self.address, -1)
clipboard.store()
clipboard_copy(self.address)
def on_go_http_btn_clicked(self, *args):
Gtk.show_uri_on_window(
......
from gi.repository import Gtk, Gdk
from whatip.network_interface import NetworkInterface
from gettext import gettext as _
from whatip.clipboard_helper import clipboard_copy
class NetworkInterfaceListboxRow(Gtk.ListBoxRow):
......@@ -87,19 +88,17 @@ class NetworkInterfaceListboxRow(Gtk.ListBoxRow):
self.location_label.set_visible(False)
self.copy_btn = self.builder.get_object('copy_btn')
self.copy_btn.connect('clicked', self.on_copy_btn_clicked)
self.copy_btn.connect(
'clicked', lambda *args: clipboard_copy(
self.net_iface.address
)
)
self.copy_ipv6_btn = self.builder.get_object('copy_ipv6_btn')
self.copy_ipv6_btn.connect('clicked', self.on_copy_ipv6_btn_clicked)
self.copy_ipv6_btn.connect(
'clicked', lambda *args: clipboard_copy(
self.net_iface.inet6_address
)
)
self.set_child(self.mainbox)
def on_copy_btn_clicked(self, *args):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(self.net_iface.address, -1)
clipboard.store()
def on_copy_ipv6_btn_clicked(self, *args):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(self.net_iface.inet6_address, -1)
clipboard.store()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment