exceptValueError:# It gives error such as "ValueError: [True, 'system-monitoring-center-process-symbolic', 'python3', 2411, 'asush', 'Running', 1.6633495783351964, 98824192, 548507648, 45764608, 0, 16384, 0, 5461, 0, 4, 1727, 1000, 1000, '/usr/bin/python3.9'] is not in list" rarely. It is handled in this situation.
return
# Open Process Details window
if'ProcessesDetailsGUI'notinglobals():# Check if "ProcessesDetailsGUI" module is imported. Therefore it is not reimported for every double click on any process on the treeview if "ProcessesDetailsGUI" name is in globals().
if'ProcessesDetails'notinglobals():# Check if "ProcessesDetails" module is imported. Therefore it is not reimported for every double click on any process on the treeview if "ProcessesDetails" name is in globals().
# ----------------------------------- Processes - Processes Details Window GUI Import Function (contains import code of this module in order to avoid running them during module import) -----------------------------------
defprocesses_details_gui_import_function():
globalGtk,GLib,os
importgi
gi.require_version('Gtk','3.0')
fromgi.repositoryimportGtk,GLib
importos
globalProcessesDetails
importProcessesDetails
# ----------------------------------- Processes - Processes Details Window GUI Function (the code of this module in order to avoid running them during module import and defines "Processes Details" window GUI objects and functions/signals) -----------------------------------
# Process Details window "Summary" tab GUI objects
label2101w=builder2101w.get_object('label2101w')
label2102w=builder2101w.get_object('label2102w')
label2103w=builder2101w.get_object('label2103w')
label2104w=builder2101w.get_object('label2104w')
label2105w=builder2101w.get_object('label2105w')
label2106w=builder2101w.get_object('label2106w')
label2107w=builder2101w.get_object('label2107w')
label2108w=builder2101w.get_object('label2108w')
label2109w=builder2101w.get_object('label2109w')
label2110w=builder2101w.get_object('label2110w')
label2111w=builder2101w.get_object('label2111w')
label2112w=builder2101w.get_object('label2112w')
label2113w=builder2101w.get_object('label2113w')
label2114w=builder2101w.get_object('label2114w')
label2115w=builder2101w.get_object('label2115w')
# Process Details window "CPU and RAM" tab GUI objects
label2116w=builder2101w.get_object('label2116w')
label2117w=builder2101w.get_object('label2117w')
label2118w=builder2101w.get_object('label2118w')
label2119w=builder2101w.get_object('label2119w')
label2120w=builder2101w.get_object('label2120w')
label2121w=builder2101w.get_object('label2121w')
label2122w=builder2101w.get_object('label2122w')
label2123w=builder2101w.get_object('label2123w')
label2124w=builder2101w.get_object('label2124w')
label2125w=builder2101w.get_object('label2125w')
label2126w=builder2101w.get_object('label2126w')
label2127w=builder2101w.get_object('label2127w')
# Process Details window "Disk and Path" tab GUI objects
label2128w=builder2101w.get_object('label2128w')
label2129w=builder2101w.get_object('label2129w')
label2130w=builder2101w.get_object('label2130w')
label2131w=builder2101w.get_object('label2131w')
label2132w=builder2101w.get_object('label2132w')
label2133w=builder2101w.get_object('label2133w')
label2134w=builder2101w.get_object('label2134w')
label2135w=builder2101w.get_object('label2135w')
label2136w=builder2101w.get_object('label2136w')
label2137w=builder2101w.get_object('label2137w')
# Processes Details window GUI functions
defon_window2101w_delete_event(widget,event):
window2101w.hide()
returnTrue
defon_window2101w_show(widget):
processes_details_gui_reset_function()# Call this function in order to reset Processes Details window. Data from previous process remains visible (for a short time) until getting and showing new process data if window is closed and opened for an another process. Also last selected tab remains same because window is made hidden when close button is clicked.
notebook2101w.set_current_page(0)# Set fist page (Summary tab) of the notebook
label2101w.set_text("--")
label2102w.set_text("--")
label2103w.set_text("--")
label2104w.set_text("--")
label2105w.set_text("--")
label2106w.set_text("--")
label2107w.set_text("--")
label2108w.set_text("--")
label2109w.set_text("--")
label2110w.set_text("--")
label2111w.set_text("--")
label2112w.set_text("--")
label2113w.set_text("--")
label2114w.set_text("--")
label2115w.set_text("--")
label2116w.set_text("--")
label2117w.set_text("--")
label2118w.set_text("--")
label2119w.set_text("--")
label2120w.set_text("--")
label2121w.set_text("--")
label2122w.set_text("--")
label2123w.set_text("--")
label2124w.set_text("--")
label2125w.set_text("--")
label2126w.set_text("--")
label2127w.set_text("--")
label2128w.set_text("--")
label2129w.set_text("--")
label2130w.set_text("--")
label2131w.set_text("--")
label2132w.set_text("--")
label2133w.set_text("--")
label2134w.set_text("--")
label2135w.set_text("--")
label2136w.set_text("--")
label2137w.set_text("--")
# ----------------------------------- Processes - Processes Details Tab Switch Control Function (controls if tab is switched and updates data on the last opened tab immediately without waiting end of the update interval. Signals of notebook for tab switching is not useful because it performs the action and after that it switches the tab. Data updating function does not recognizes tab switch due to this reason.) -----------------------------------
defprocesses_details_tab_switch_control_func():
globalprevious_page
if'previous_page'notinglobals():# For avoiding errors in the first loop of the control
previous_page=None
current_page=None
current_page=notebook2101w.get_current_page()
ifcurrent_page!=previous_pageandprevious_page!=None:# Check if tab is switched
ProcessesDetails.process_details_foreground_func()# Update the data on the tab
previous_page=current_page
ifwindow2101w.get_visible()==True:
GLib.timeout_add(200,processes_details_tab_switch_control_func)# Check is performed in every 200 ms which is small enough for immediate update and not very frequent for avoiding high CPU usages.
defon_menuitem2108m_activate(widget):# "Details" item on the right click menu
if'ProcessesDetailsGUI'notinglobals():# Check if "ProcessesDetailsGUI" module is imported. Therefore it is not reimported for every click on "Details" menu item on the right click menu if "ProcessesDetailsGUI" name is in globals().
if'ProcessesDetails'notinglobals():# Check if "ProcessesDetails" module is imported. Therefore it is not reimported for every click on "Details" menu item on the right click menu if "ProcessesDetails" name is in globals().
selected_service_name=service_list[services_data_rows.index(model[treeiter][:])]# "[:]" is used in order to copy entire list to be able to use it for getting index in the "services_data_rows" list to use it getting name of the service.
# Open Service Details window
if'ServicesDetailsGUI'notinglobals():# Check if "ServicesDetailsGUI" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "ServicesDetailsGUI" name is in globals().
if'ServicesDetails'notinglobals():# Check if "ServicesDetails" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "ServicesDetails" name is in globals().
# ----------------------------------- Services - Services Details Window GUI Import Function (contains import code of this module in order to avoid running them during module import) -----------------------------------
defservices_details_gui_import_function():
globalGtk,os
importgi
gi.require_version('Gtk','3.0')
fromgi.repositoryimportGtk
importos
# ----------------------------------- Services - Services Details Window GUI Function (the code of this module in order to avoid running them during module import and defines "Services Details" window GUI objects and functions/signals) -----------------------------------
# Service Details window "General" tab GUI objects
label6101w=builder6101w.get_object('label6101w')
label6102w=builder6101w.get_object('label6102w')
label6103w=builder6101w.get_object('label6103w')
label6104w=builder6101w.get_object('label6104w')
label6105w=builder6101w.get_object('label6105w')
label6106w=builder6101w.get_object('label6106w')
label6107w=builder6101w.get_object('label6107w')
label6108w=builder6101w.get_object('label6108w')
label6109w=builder6101w.get_object('label6109w')
label6110w=builder6101w.get_object('label6110w')
label6111w=builder6101w.get_object('label6111w')
label6112w=builder6101w.get_object('label6112w')
label6113w=builder6101w.get_object('label6113w')
label6114w=builder6101w.get_object('label6114w')
label6115w=builder6101w.get_object('label6115w')
label6116w=builder6101w.get_object('label6116w')
label6117w=builder6101w.get_object('label6117w')
label6118w=builder6101w.get_object('label6118w')
# Service Details window "Dependencies" tab GUI objects
label6119w=builder6101w.get_object('label6119w')
label6120w=builder6101w.get_object('label6120w')
label6121w=builder6101w.get_object('label6121w')
label6122w=builder6101w.get_object('label6122w')
# Services Details window GUI functions
defon_window6101w_delete_event(widget,event):
window6101w.hide()
returnTrue
defon_window6101w_show(widget):
services_details_gui_reset_function()# Call this function in order to reset Services Details window. Data from previous service remains visible (for a short time) until getting and showing new service data if window is closed and opened for an another service. Also last selected tab remains same because window is made hidden when close button is clicked.
notebook6101w.set_current_page(0)# Set fist page (Summary tab) of the notebook
label6101w.set_text("--")
label6102w.set_text("--")
label6103w.set_text("--")
label6104w.set_text("--")
label6105w.set_text("--")
label6106w.set_text("--")
label6107w.set_text("--")
label6108w.set_text("--")
label6109w.set_text("--")
label6110w.set_text("--")
label6111w.set_text("--")
label6112w.set_text("--")
label6113w.set_text("--")
label6114w.set_text("--")
label6115w.set_text("--")
label6116w.set_text("--")
label6117w.set_text("--")
label6118w.set_text("--")
label6119w.set_text("--")
label6120w.set_text("--")
label6121w.set_text("--")
label6122w.set_text("--")
# # ----------------------------------- Services - Services Details Tab Switch Control Function (controls if tab is switched and updates data on the last opened tab immediately without waiting end of the update interval. Signals of notebook for tab switching is not useful because it performs the action and after that it switches the tab. Data updating function does not recognizes tab switch due to this reason.) -----------------------------------
# def services_details_tab_switch_control_func():
#
# global previous_page
# if 'previous_page' not in globals(): # For avoiding errors in the first loop of the control
# previous_page = None
# current_page = None
# current_page = notebook6101w.get_current_page()
# if current_page != previous_page and previous_page != None: # Check if tab is switched
# ServicesDetails.service_details_foreground_func() # Update the data on the tab
# previous_page = current_page
# if window6101w.get_visible() == True:
# GLib.timeout_add(200, services_details_tab_switch_control_func) # Check is performed in every 200 ms which is small enough for immediate update and not very frequent for avoiding high CPU usages.
clipboard.store()# Stores copied text in the clipboard. Therefore text stays in the clipboard after application has quit.
defon_menuitem6109m_activate(widget):# "Details" item on the right click menu
if'ServicesDetailsGUI'notinglobals():# Check if "ServicesDetailsGUI" module is imported. Therefore it is not reimported for every click on "Details" menu item on the right click menu if "ServicesDetailsGUI" name is in globals().
if'ServicesDetails'notinglobals():# Check if "ServicesDetails" module is imported. Therefore it is not reimported for every click on "Details" menu item on the right click menu if "ServicesDetails" name is in globals().
selected_storage_kernel_name=disk_list[storage_data_rows.index(model[treeiter][:])]# "[:]" is used in order to copy entire list to be able to use it for getting index in the "storage_data_rows" list to use it getting name of the disk.
# Open Storage Details window
if'StorageDetailsGUI'notinglobals():# Check if "StorageDetailsGUI" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "StorageDetailsGUI" name is in globals().
if'StorageDetails'notinglobals():# Check if "StorageDetails" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "StorageDetails" name is in globals().
# ----------------------------------- Storage - Storage Details Window GUI Import Function (contains import code of this module in order to avoid running them during module import) -----------------------------------
defstorage_details_gui_import_function():
globalGtk,os
importgi
gi.require_version('Gtk','3.0')
fromgi.repositoryimportGtk
importos
# ----------------------------------- Storage - Storage Details Window GUI Function (the code of this module in order to avoid running them during module import and defines "Storage Details" window GUI objects and functions/signals) -----------------------------------
storage_details_gui_reset_function()# Call this function in order to reset Storage Details window. Data from previous storage/disk remains visible (for a short time) until getting and showing new storage/disk data if window is closed and opened for an another storage/disk because window is made hidden when close button is clicked.
# # ----------------------------------- Storage - Storage Details Tab Switch Control Function (controls if tab is switched and updates data on the last opened tab immediately without waiting end of the update interval. Signals of notebook for tab switching is not useful because it performs the action and after that it switches the tab. Data updating function does not recognizes tab switch due to this reason.) -----------------------------------
# def storage_details_tab_switch_control_func():
#
# global previous_page
# if 'previous_page' not in globals(): # For avoiding errors in the first loop of the control
# previous_page = None
# current_page = None
# current_page = notebook4101w.get_current_page()
# if current_page != previous_page and previous_page != None: # Check if tab is switched
# StorageDetails.storage_details_foreground_func() # Update the data on the tab
# previous_page = current_page
# if window4101w.get_visible() == True:
# GLib.timeout_add(200, storage_details_tab_switch_control_func) # Check is performed in every 200 ms which is small enough for immediate update and not very frequent for avoiding high CPU usages.
defon_menuitem4108m_activate(widget):# "Details" item on the right click menu
if'StorageDetailsGUI'notinglobals():# Check if "StorageDetailsGUI" module is imported. Therefore it is not reimported for double click on "Details" menu item on the right click menu if "StorageDetailsGUI" name is in globals().
if'StorageDetails'notinglobals():# Check if "StorageDetails" module is imported. Therefore it is not reimported for double click on "Details" menu item on the right click menu if "StorageDetails" name is in globals().
selected_user_uid=uid_username_list[users_data_rows.index(model[treeiter][:])][0]# "[:]" is used in order to copy entire list to be able to use it for getting index in the "users_data_rows" list to use it getting UID of the user.
# Open Users Details window
if'UsersDetailsGUI'notinglobals():# Check if "UsersDetailsGUI" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "UsersDetailsGUI" name is in globals().
if'UsersDetails'notinglobals():# Check if "UsersDetails" module is imported. Therefore it is not reimported for every double click on any user on the treeview if "UsersDetails" name is in globals().
# Import locale and gettext modules for defining translation texts which will be recognized by gettext application (will be run by programmer externally) and exported into a ".pot" file.
# ----------------------------------- Users - Users Details Window GUI Function (the code of this module in order to avoid running them during module import and defines "Users Details" window GUI objects and functions/signals) -----------------------------------
users_details_gui_reset_function()# Call this function in order to reset Users Details window. Data from previous user remains visible (for a short time) until getting and showing new user data if window is closed and opened for an another user because window is made hidden when close button is clicked.
# # ----------------------------------- Users - Users Details Tab Switch Control Function (controls if tab is switched and updates data on the last opened tab immediately without waiting end of the update interval. Signals of notebook for tab switching is not useful because it performs the action and after that it switches the tab. Data updating function does not recognizes tab switch due to this reason.) -----------------------------------
# def users_details_tab_switch_control_func():
#
# global previous_page
# if 'previous_page' not in globals(): # For avoiding errors in the first loop of the control
# previous_page = None
# current_page = None
# current_page = notebook3101w.get_current_page()
# if current_page != previous_page and previous_page != None: # Check if tab is switched
# UsersDetails.user_details_foreground_func() # Update the data on the tab
# previous_page = current_page
# if window3101w.get_visible() == True:
# GLib.timeout_add(200, users_details_tab_switch_control_func) # Check is performed in every 200 ms which is small enough for immediate update and not very frequent for avoiding high CPU usages.
# ----------------------------------- Users - Users Details Function (the code of this module in order to avoid running them during module import and defines "Users" tab GUI objects and functions/signals) -----------------------------------
# ----------------------------------- Users - Users Details Loop Thread Function (runs the code in the function as threaded in order to avoid blocking/slowing down GUI operations and other operations) -----------------------------------
# ----------------------------------- Users - Users Details Window GUI Import Function (contains import code of this module in order to avoid running them during module import) -----------------------------------
defusers_details_gui_import_function():
globalGtk,os
importgi
gi.require_version('Gtk','3.0')
fromgi.repositoryimportGtk
importos
# Import locale and gettext modules for defining translation texts which will be recognized by gettext application (will be run by programmer externally) and exported into a ".pot" file.
global_tr# This arbitrary variable will be recognized by gettext application for extracting texts to be translated
importlocale
fromlocaleimportgettextas_tr
# Define contstants for language translation support
globalapplication_name
application_name="system-monitoring-center"
translation_files_path="/usr/share/locale"
system_current_language=os.environ.get("LANG")
# Define functions for language translation support
# ----------------------------------- Users - Users Details Window GUI Function (the code of this module in order to avoid running them during module import and defines "Users Details" window GUI objects and functions/signals) -----------------------------------
users_details_gui_reset_function()# Call this function in order to reset Users Details window. Data from previous user remains visible (for a short time) until getting and showing new user data if window is closed and opened for an another user because window is made hidden when close button is clicked.
# # ----------------------------------- Users - Users Details Tab Switch Control Function (controls if tab is switched and updates data on the last opened tab immediately without waiting end of the update interval. Signals of notebook for tab switching is not useful because it performs the action and after that it switches the tab. Data updating function does not recognizes tab switch due to this reason.) -----------------------------------
# def users_details_tab_switch_control_func():
#
# global previous_page
# if 'previous_page' not in globals(): # For avoiding errors in the first loop of the control
# previous_page = None
# current_page = None
# current_page = notebook3101w.get_current_page()
# if current_page != previous_page and previous_page != None: # Check if tab is switched
# UsersDetails.user_details_foreground_func() # Update the data on the tab
# previous_page = current_page
# if window3101w.get_visible() == True:
# GLib.timeout_add(200, users_details_tab_switch_control_func) # Check is performed in every 200 ms which is small enough for immediate update and not very frequent for avoiding high CPU usages.
# ********************** Define object functions for Users tab right click menu **********************
defon_menuitem3101m_activate(widget):# "Details" item on the right click menu
if'UsersDetailsGUI'notinglobals():# Check if "UsersDetailsGUI" module is imported. Therefore it is not reimported for every click on "Details" menu item on right click menu if "UsersDetailsGUI" name is in globals().
if'UsersDetails'notinglobals():# Check if "UsersDetails" module is imported. Therefore it is not reimported for every click on "Details" menu item on right click menu if "UsersDetails" name is in globals().