Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Fixed a bug for RAM hardware information window
Browse files Browse the repository at this point in the history
  • Loading branch information
hakandundar34coding committed Nov 6, 2021
1 parent cdfb11c commit a0dd7e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Ram.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def on_eventbox1201_button_click_event(widget, event):
import RamHardwareInformation
RamHardwareInformation.ram_hardware_information_import_func()
RamHardwareInformation.ram_hardware_information_gui_func()
RamHardwareInformation.window1201w.show()
RamHardwareInformation.ram_hardware_information_get_func()
if RamHardwareInformation.memory_hardware_information_text != "": # This statement is used in order to avoid errors if user closes polkit window without entering password.
RamHardwareInformation.window1201w.show()

def on_eventbox1201_enter_notify_event(widget, event): # Eventbox is used for defining signals for the widget ("Query..." label) placed on it.
changed_cursor = Gdk.Cursor(Gdk.CursorType.QUESTION_ARROW) # Define cursor type (when mouse cursor is entered area of the widget) to inform user this GUI object is clickable.
Expand Down
3 changes: 1 addition & 2 deletions src/RamHardwareInformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def on_window1201w_delete_event(widget, event):

def on_window1201w_show(widget):
label1201w.set_text("-") # Reset label text when window is shown.
ram_hardware_information_get_func() # There are problems on Gnome desktop environment installed systems if this function is called from another module.
global memory_hardware_information_text
try: # "try-except" is used in order to avoid errors if user closed polkit dialog without entering password. Because "memory_hardware_information_text" string will not be defined and will not be get in this situation.
label1201w.set_text(memory_hardware_information_text) # Set label text for showing RAM hardware information.
Expand All @@ -82,7 +81,7 @@ def ram_hardware_information_get_func():
memory_hardware_information_text = "" # Set initial value of "memory_hardware_information_text". Hardware information will be appended to this string.

try:
dmidecode_output = (subprocess.check_output(["pkexec", "sudo", "dmidecode", "-t", "16,17"], stderr=subprocess.STDOUT, shell=False)).decode().strip() # "sudo" has to be used for using "pkexec" to run "dmidecode" with root privileges.
dmidecode_output = (subprocess.check_output(["pkexec", "pkexec", "dmidecode", "-t", "16,17"], stderr=subprocess.STDOUT, shell=False)).decode().strip() # "sudo" has to be used for using "pkexec" to run "dmidecode" with root privileges.
except:
window1201w.hide()
ram_hardware_information_root_privileges_warning_dialog()
Expand Down

0 comments on commit a0dd7e6

Please sign in to comment.