mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-28 16:14:14 +02:00
fix bug with radio buttons and pkexec
This commit is contained in:
parent
864d0c3b25
commit
60bacfe15b
@ -51,6 +51,8 @@ def get_version():
|
|||||||
class RadioButtonView(Gtk.Box):
|
class RadioButtonView(Gtk.Box):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
|
super().__init__(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
# this keeps track of whether or not the button was toggled by the app or the user to prompt for authorization
|
||||||
|
self.set_by_app = True
|
||||||
|
|
||||||
self.set_hexpand(True)
|
self.set_hexpand(True)
|
||||||
self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
@ -79,9 +81,13 @@ class RadioButtonView(Gtk.Box):
|
|||||||
|
|
||||||
def on_button_toggled(self, button, override):
|
def on_button_toggled(self, button, override):
|
||||||
if button.get_active():
|
if button.get_active():
|
||||||
result = run(f"pkexec auto-cpufreq --force={override}", shell=True, stdout=PIPE, stderr=PIPE)
|
if not self.set_by_app:
|
||||||
if result.stderr.decode() == PKEXEC_ERROR:
|
result = run(f"pkexec auto-cpufreq --force={override}", shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
self.set_selected()
|
if result.stderr.decode() == PKEXEC_ERROR:
|
||||||
|
self.set_selected()
|
||||||
|
else:
|
||||||
|
self.set_by_app = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_selected(self):
|
def set_selected(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user