Kaydet (Commit) ed37bf13 authored tarafından Hakan Dündar's avatar Hakan Dündar

Fix: CPU usage of user for Flatpak

üst 14f920be
......@@ -70,4 +70,4 @@ modules:
sources:
- type: git
url: https://github.com/hakandundar34coding/system-monitoring-center.git
commit: 334b5ec14bfb7abc4997cc3d93ae7c553451257d
commit: 4d940bb09d7647b8fb3a32c8d383d23b4fbf57b4
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -491,10 +491,7 @@ def users_loop_func():
# ----------------------------------- Users - Treeview Cell Functions (defines functions for treeview cell for setting data precisions and/or data units) -----------------------------------
def cell_data_function_cpu_usage_percent(tree_column, cell, tree_model, iter, data):
if Config.environment_type == "flatpak":
cell.set_property('text', "[" + "!Flatpak" + "]")
else:
cell.set_property('text', f'{tree_model.get(iter, data)[0]:.{users_cpu_precision}f} %')
cell.set_property('text', f'{tree_model.get(iter, data)[0]:.{users_cpu_precision}f} %')
def cell_data_function_started(tree_column, cell, tree_model, iter, data):
cell_data = tree_model.get(iter, data)[0]
......
......@@ -234,13 +234,10 @@ class UsersDetails:
selected_user_process_start_time = time.time() - max(curent_user_process_start_time_list)
# Get user processes CPU usage percentages
if Config.environment_type == "flatpak":
selected_user_cpu_percent = 0
else:
selected_user_cpu_percent = 0
for pid in pid_list:
if logged_in_users_list[pid_list.index(pid)] == username:
selected_user_cpu_percent = selected_user_cpu_percent + all_process_cpu_usages[pid_list.index(pid)]
selected_user_cpu_percent = 0
for pid in pid_list:
if logged_in_users_list[pid_list.index(pid)] == username:
selected_user_cpu_percent = selected_user_cpu_percent + all_process_cpu_usages[pid_list.index(pid)]
# For using values in the next loop
self.pid_list_prev = pid_list
......@@ -268,10 +265,7 @@ class UsersDetails:
self.label3110w.set_text(datetime.fromtimestamp(selected_user_process_start_time).strftime("%H:%M:%S %d.%m.%Y"))
if selected_user_process_start_time == 0:
self.label3110w.set_text("-")
if Config.environment_type == "flatpak":
self.label3111w.set_text(f'{"[" + "!Flatpak" + "]"}')
else:
self.label3111w.set_text(f'{selected_user_cpu_percent:.{users_cpu_precision}f}')
self.label3111w.set_text(f'{selected_user_cpu_percent:.{users_cpu_precision}f}')
# ----------------------------------- Users Details - Run Function -----------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment