Fix stutter when opening About dialogue

This commit is contained in:
Stephen Horvath
2025-09-17 21:12:35 +10:00
parent 4a8dfbad47
commit 973ff26fa7
7 changed files with 14 additions and 20 deletions

View File

@@ -18,9 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw, GLib
from gi.repository import Gtk
from gi.repository import GLib
import cros_ec_python.commands as ec_commands import cros_ec_python.commands as ec_commands
import cros_ec_python.exceptions as ec_exceptions import cros_ec_python.exceptions as ec_exceptions

View File

@@ -18,9 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw, GLib
from gi.repository import Gtk
from gi.repository import GLib
import cros_ec_python.commands as ec_commands import cros_ec_python.commands as ec_commands
import cros_ec_python.exceptions as ec_exceptions import cros_ec_python.exceptions as ec_exceptions

View File

@@ -18,9 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw, GLib
from gi.repository import Gtk
from gi.repository import GLib
import cros_ec_python.commands as ec_commands import cros_ec_python.commands as ec_commands
import cros_ec_python.exceptions as ec_exceptions import cros_ec_python.exceptions as ec_exceptions

View File

@@ -18,8 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw, GLib
from gi.repository import Gtk
import cros_ec_python.commands as ec_commands import cros_ec_python.commands as ec_commands
import cros_ec_python.exceptions as ec_exceptions import cros_ec_python.exceptions as ec_exceptions

View File

@@ -20,13 +20,13 @@
import sys import sys
import traceback import traceback
import threading
import gi import gi
from gi.repository import Gio
gi.require_version('Gtk', '4.0') gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1') gi.require_version('Adw', '1')
from gi.repository import Gtk, Gio, Adw from gi.repository import Gtk, Gio, Adw, GLib
from .window import YafiWindow from .window import YafiWindow
from .thermals import ThermalsPage from .thermals import ThermalsPage
from .leds import LedsPage from .leds import LedsPage
@@ -136,9 +136,8 @@ class YafiApplication(Adw.Application):
comments="YAFI is another GUI for the Framework Laptop Embedded Controller.\n" comments="YAFI is another GUI for the Framework Laptop Embedded Controller.\n"
+ "It is written in Python with a GTK3 theme, and uses the `CrOS_EC_Python` library to communicate with the EC.", + "It is written in Python with a GTK3 theme, and uses the `CrOS_EC_Python` library to communicate with the EC.",
copyright="© 2025 Stephen Horvath", copyright="© 2025 Stephen Horvath",
debug_info=self.generate_debug_info(),
developer_name="Stephen Horvath", developer_name="Stephen Horvath",
developers=["Stephen Horvath"], developers=["Stephen Horvath https://github.com/Steve-Tech"],
issue_url="https://github.com/Steve-Tech/YAFI/issues", issue_url="https://github.com/Steve-Tech/YAFI/issues",
license_type=Gtk.License.GPL_2_0, license_type=Gtk.License.GPL_2_0,
version="0.5", version="0.5",
@@ -147,6 +146,11 @@ class YafiApplication(Adw.Application):
about.add_acknowledgement_section(None, ["Framework Computer Inc. https://frame.work/"]) about.add_acknowledgement_section(None, ["Framework Computer Inc. https://frame.work/"])
about.present(self.props.active_window) about.present(self.props.active_window)
if hasattr(self, 'debug_info'):
about.set_debug_info(self.debug_info)
else:
threading.Thread(target=lambda: GLib.idle_add(about.set_debug_info, self.generate_debug_info())).start()
def show_error(self, heading, message): def show_error(self, heading, message):
dialog = Adw.AlertDialog(heading=heading, body=message) dialog = Adw.AlertDialog(heading=heading, body=message)
dialog.add_response("exit", "Exit") dialog.add_response("exit", "Exit")

View File

@@ -18,9 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw, GLib
from gi.repository import Gtk
from gi.repository import GLib
import cros_ec_python.commands as ec_commands import cros_ec_python.commands as ec_commands
import cros_ec_python.exceptions as ec_exceptions import cros_ec_python.exceptions as ec_exceptions

View File

@@ -18,8 +18,7 @@
# #
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
from gi.repository import Adw from gi.repository import Gtk, Adw
from gi.repository import Gtk
@Gtk.Template(resource_path='/au/stevetech/yafi/ui/yafi.ui') @Gtk.Template(resource_path='/au/stevetech/yafi/ui/yafi.ui')
class YafiWindow(Adw.ApplicationWindow): class YafiWindow(Adw.ApplicationWindow):