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

Fix: Empty lists if old version of the application is run

üst 2eaf1474
......@@ -991,6 +991,27 @@ def set_label_spinner(label, spinner_label, label_data):
label.set_label(f'{label_data}')
def reset_tab_settings(TabObject):
"""
Reset tab columns if a version of the application with less number of columns than the previous
one (which has new columns) is run in order to prevent errors and empty tab list.
"""
if len(TabObject.row_data_list) < len(TabObject.data_column_order):
# Get treeview columns shown
if TabObject.name == "Sensors":
Config.config_default_performance_sensors_func()
elif TabObject.name == "Processes":
Config.config_default_processes_func()
elif TabObject.name == "Users":
Config.config_default_users_func()
elif TabObject.name == "Services":
Config.config_default_services_func()
save_tab_settings(TabObject)
def treeview_add_remove_columns(TabObject):
"""
Add/Remove treeview columns appropriate for user preferences.
......
......@@ -1312,6 +1312,10 @@ class Processes:
treeview_columns_shown = self.treeview_columns_shown
treeview_columns_shown = set(treeview_columns_shown)
# Prevent errors and empty tab list if a version of the application with less number of columns
# than the previous one is run.
Common.reset_tab_settings(self)
# Define lists for appending some performance data for calculating max values to determine cell background color.
# "0" values are added for preventing errors if the lists are empty.
cpu_usage_list = [0]
......
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