Fix fan control, attempt to make compatible with pipx

This commit is contained in:
Stephen Horvath
2025-03-20 08:49:07 +10:00
parent dd31200082
commit f6fa632d69
3 changed files with 16 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ description = "Yet Another Framework Interface"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"
dependencies = [ dependencies = [
"cros_ec_python", "cros_ec_python >= 0.0.2",
"PyGObject" "PyGObject"
] ]
classifiers = [ classifiers = [
@@ -25,4 +25,7 @@ lpc = ["portio"]
[project.urls] [project.urls]
Repository = "https://github.com/Steve-Tech/YAFI" Repository = "https://github.com/Steve-Tech/YAFI"
Issues = "https://github.com/Steve-Tech/YAFI/issues" Issues = "https://github.com/Steve-Tech/YAFI/issues"
[project.gui-scripts]
yafi = "yafi:main"

View File

@@ -1 +1,2 @@
from . import yafi from . import yafi
yafi.main()

View File

@@ -93,7 +93,7 @@ class YAFI(Adw.Application):
fan_percent_scale = thermals_builder.get_object("fan-percent-scale") fan_percent_scale = thermals_builder.get_object("fan-percent-scale")
# Don't let the user change the fans if they can't get back to auto # Don't let the user change the fans if they can't get back to auto
if not ec_commands.general.get_cmd_versions( if ec_commands.general.get_cmd_versions(
self.cros_ec, ec_commands.thermal.EC_CMD_THERMAL_AUTO_FAN_CTRL self.cros_ec, ec_commands.thermal.EC_CMD_THERMAL_AUTO_FAN_CTRL
): ):
@@ -141,6 +141,8 @@ class YAFI(Adw.Application):
) )
else: else:
fan_set_rpm.set_sensitive(False) fan_set_rpm.set_sensitive(False)
else:
fan_mode.set_sensitive(False)
# Temperature sensors # Temperature sensors
temperatures = thermals_builder.get_object("temperatures") temperatures = thermals_builder.get_object("temperatures")
@@ -649,6 +651,9 @@ class YAFI(Adw.Application):
self.win.present() self.win.present()
def main():
app = YAFI(application_id="au.stevetech.yafi") app = YAFI(application_id="au.stevetech.yafi")
app.run(sys.argv) app.run(sys.argv)
if __name__ == "__main__":
main()