コード例 #1
0
ファイル: sysinfo_box.py プロジェクト: xnick/lutris
    def __init__(self):
        super().__init__(visible=True)
        self.set_margin_top(40)
        self.set_margin_right(30)
        self.set_margin_left(30)

        sysinfo_frame = Gtk.Frame(visible=True)
        sysinfo_frame.set_size_request(550, 455)
        scrolled_window = Gtk.ScrolledWindow(visible=True)
        scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
                                   Gtk.PolicyType.AUTOMATIC)

        sysinfo_view = LogTextView(autoscroll=False)
        sysinfo_view.set_cursor_visible(False)
        scrolled_window.add(sysinfo_view)
        sysinfo_frame.add(scrolled_window)
        sysinfo_str = gather_system_info_str()

        text_buffer = sysinfo_view.get_buffer()
        text_buffer.set_text(sysinfo_str)
        self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
        self._clipboard_buffer = sysinfo_str

        button_copy = Gtk.Button(_("Copy to clipboard"), visible=True)
        button_copy.connect("clicked", self._copy_text)
        sysinfo_label = Gtk.Label(visible=True)
        sysinfo_label.set_markup("<b>System information</b>")
        self.put(sysinfo_label, 60, 0)
        self.put(sysinfo_frame, 60, 24)
        self.put(button_copy, 60, 486)
コード例 #2
0
    def _build_sysinfo_tab(self):
        sysinfo_box = Gtk.VBox()
        sysinfo_view = LogTextView()
        sysinfo_view.set_cursor_visible(False)
        sysinfo_str = gather_system_info_str()

        text_buffer = sysinfo_view.get_buffer()
        text_buffer.set_text(sysinfo_str)
        self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
        self._clipboard_buffer = sysinfo_str

        button_copy = Gtk.Button(_("Copy System Info"))
        button_copy.connect("clicked", self._copy_text)

        sysinfo_box.add(sysinfo_view)
        sysinfo_box.add(button_copy)
        info_sw = self.build_scrolled_window(sysinfo_box)
        self._add_notebook_tab(info_sw, _("System Information"))