Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KISS #25

Merged
merged 1 commit into from
May 30, 2015
Merged

KISS #25

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,14 @@ def get_results(self):
res = {}
from preferences import Preferences

global cpu_load
cpu_checked = False
cpus = re.compile("\Acpu\d*\Z")
# We call this only once per update
global cpu_load = ps.cpu_percent(interval = 0, percpu = True)

#print (self.settings["custom_text"]) custom_text is the full visible string seen in Preferences edit field
for sensor in Preferences.sensors_regex.findall(
self.settings["custom_text"]):

sensor = sensor[1:-1]
if cpus.match(sensor) and cpu_checked == False:
cpu_load = ps.cpu_percent(interval = 0, percpu = True) # We call this only once per update
cpu_checked = True

instance = self.get(sensor)

if instance:
Expand Down Expand Up @@ -537,4 +532,5 @@ def run(self):
while self._parent.alive.isSet():
data = self.fetch()
self._parent.update(data)
time.sleep(self.mgr.get_interval())
time.sleep(self.mgr.get_interval())