Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
System Monitoring Center
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Kayıtlar (commit)
Kenar çubuğunu aç
Hakan Dündar
System Monitoring Center
Commits
df4b0092
Kaydet (Commit)
df4b0092
authored
Eki 07, 2023
tarafından
Hakan Dündar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New: Temperature unit option (Sensors tab)
üst
855afcc6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
162 additions
and
7 deletions
+162
-7
POTFILES.in
po/POTFILES.in
+1
-0
Config.py
src/Config.py
+10
-0
Libsysmon.py
src/Libsysmon.py
+7
-4
MainWindow.py
src/MainWindow.py
+3
-2
Sensors.py
src/Sensors.py
+2
-1
SensorsMenu.py
src/SensorsMenu.py
+138
-0
meson.build
src/meson.build
+1
-0
No files found.
po/POTFILES.in
Dosyayı görüntüle @
df4b0092
...
...
@@ -22,6 +22,7 @@ src/ProcessesDetails.py
src/ProcessesMenu.py
src/run_from_source.py
src/Sensors.py
src/SensorsMenu.py
src/Services.py
src/ServicesDetails.py
src/ServicesMenu.py
...
...
src/Config.py
Dosyayı görüntüle @
df4b0092
...
...
@@ -189,6 +189,7 @@ class Config:
self
.
sensors_data_row_sorting_order
=
0
self
.
sensors_data_column_order
=
[
0
,
1
,
2
,
3
,
4
]
self
.
sensors_data_column_widths
=
[
-
1
,
-
1
,
-
1
,
-
1
,
-
1
]
self
.
temperature_unit
=
"celsius"
def
config_default_processes_func
(
self
):
...
...
@@ -321,6 +322,11 @@ class Config:
self
.
chart_line_color_fps
=
[
float
(
value
)
for
value
in
config_values
[
config_variables
.
index
(
"chart_line_color_fps"
)]
.
strip
(
"[]"
)
.
split
(
", "
)]
self
.
selected_gpu
=
config_values
[
config_variables
.
index
(
"selected_gpu"
)]
if
"temperature_unit"
in
config_variables
:
self
.
temperature_unit
=
config_values
[
config_variables
.
index
(
"temperature_unit"
)]
else
:
pass
self
.
show_processes_of_all_users
=
int
(
config_values
[
config_variables
.
index
(
"show_processes_of_all_users"
)])
self
.
show_processes_as_tree
=
int
(
config_values
[
config_variables
.
index
(
"show_processes_as_tree"
)])
self
.
show_tree_lines
=
int
(
config_values
[
config_variables
.
index
(
"show_tree_lines"
)])
...
...
@@ -446,6 +452,10 @@ class Config:
config_write_text
=
config_write_text
+
"selected_gpu = "
+
str
(
self
.
selected_gpu
)
+
"
\n
"
config_write_text
=
config_write_text
+
"
\n
"
config_write_text
=
config_write_text
+
"[Performance Tab - Sensors]"
+
"
\n
"
config_write_text
=
config_write_text
+
"temperature_unit = "
+
str
(
self
.
temperature_unit
)
+
"
\n
"
config_write_text
=
config_write_text
+
"
\n
"
config_write_text
=
config_write_text
+
"[Processes Tab]"
+
"
\n
"
config_write_text
=
config_write_text
+
"show_processes_of_all_users = "
+
str
(
self
.
show_processes_of_all_users
)
+
"
\n
"
config_write_text
=
config_write_text
+
"hide_kernel_threads = "
+
str
(
self
.
hide_kernel_threads
)
+
"
\n
"
...
...
src/Libsysmon.py
Dosyayı görüntüle @
df4b0092
...
...
@@ -3776,7 +3776,7 @@ def get_gpu_connections(gpu_device_path, selected_gpu):
# Sensors
# ***********************************************************************************************
def
get_sensors_information
():
def
get_sensors_information
(
temperature_unit
=
"celsius"
):
"""
Get sensor information.
"""
...
...
@@ -3837,13 +3837,16 @@ def get_sensors_information():
# Get sensor current value
try
:
# Units of data in this file are millidegree Cel
c
ius for temperature sensors, RPM for fan sensors,
# Units of data in this file are millidegree Cel
s
ius for temperature sensors, RPM for fan sensors,
# millivolt for voltage sensors and milliamper for current sensors.
with
open
(
"/sys/class/hwmon/"
+
sensor_group
+
"/"
+
attribute
+
string_sensor_number
+
"_input"
)
as
reader
:
current_value
=
int
(
reader
.
read
()
.
strip
())
if
attribute
==
"temp"
:
# Convert millidegree Celcius to degree Celcius
current_value
=
f
'{(current_value / 1000):.0f} °C'
if
temperature_unit
==
"celsius"
:
# Convert millidegree Celsius to degree Celsius
current_value
=
f
'{(current_value / 1000):.0f} °C'
elif
temperature_unit
==
"fahrenheit"
:
current_value
=
f
'{((current_value / 1000)*9/5)+32:.0f} °F'
if
attribute
==
"fan"
:
current_value
=
f
'{current_value} RPM'
if
attribute
==
"in"
:
...
...
src/MainWindow.py
Dosyayı görüntüle @
df4b0092
...
...
@@ -569,7 +569,8 @@ class MainWindow():
self
.
tab_menu_menubutton
.
set_popover
(
GpuMenu
.
menu_po
)
elif
Config
.
performance_tab_current_sub_tab
==
6
:
self
.
tab_menu_menubutton
.
set_popover
(
None
)
from
.SensorsMenu
import
SensorsMenu
self
.
tab_menu_menubutton
.
set_popover
(
SensorsMenu
.
menu_po
)
elif
Config
.
current_main_tab
==
1
:
from
.ProcessesMenu
import
ProcessesMenu
...
...
@@ -754,7 +755,7 @@ class MainWindow():
self
.
sensors_tab_main_grid
.
attach
(
Sensors
.
tab_grid
,
0
,
0
,
1
,
1
)
GLib
.
idle_add
(
Sensors
.
loop_func
)
self
.
main_gui_device_selection_list
()
self
.
tab_menu_menubutton
.
set_sensitive
(
Fals
e
)
self
.
tab_menu_menubutton
.
set_sensitive
(
Tru
e
)
return
# Switch to "Processes" tab
...
...
src/Sensors.py
Dosyayı görüntüle @
df4b0092
...
...
@@ -144,13 +144,14 @@ class Sensors:
self
.
data_row_sorting_order
=
Config
.
sensors_data_row_sorting_order
self
.
data_column_order
=
Config
.
sensors_data_column_order
self
.
data_column_widths
=
Config
.
sensors_data_column_widths
self
.
temperature_unit
=
Config
.
temperature_unit
# For obtaining lower CPU usage
treeview_columns_shown
=
self
.
treeview_columns_shown
treeview_columns_shown
=
set
(
treeview_columns_shown
)
Common
.
reset_tab_settings
(
self
)
rows_data_dict
=
Libsysmon
.
get_sensors_information
()
rows_data_dict
=
Libsysmon
.
get_sensors_information
(
self
.
temperature_unit
)
self
.
rows_data_dict_prev
=
dict
(
rows_data_dict
)
sensor_unique_id_list
=
rows_data_dict
[
"sensor_unique_id_list"
]
...
...
src/SensorsMenu.py
0 → 100644
Dosyayı görüntüle @
df4b0092
import
gi
gi
.
require_version
(
'Gtk'
,
'4.0'
)
from
gi.repository
import
Gtk
from
.Config
import
Config
from
.Sensors
import
Sensors
from
.
import
Common
_tr
=
Config
.
_tr
class
SensorsMenu
:
def
__init__
(
self
):
self
.
name
=
"SensorsMenu"
self
.
menu_gui
()
def
menu_gui
(
self
):
"""
Generate menu GUI.
"""
# Popover
self
.
menu_po
=
Gtk
.
Popover
()
# Grid (main)
main_grid
=
Common
.
menu_main_grid
()
self
.
menu_po
.
set_child
(
main_grid
)
# Label - menu title (Sensors)
label
=
Common
.
menu_title_label
(
_tr
(
"Sensors"
))
main_grid
.
attach
(
label
,
0
,
0
,
2
,
1
)
# Label (Data Unit)
label
=
Common
.
title_label
(
_tr
(
"Data Unit"
))
main_grid
.
attach
(
label
,
0
,
1
,
2
,
1
)
# Label (Temperature)
label
=
Gtk
.
Label
()
label
.
set_label
(
_tr
(
"Temperature"
))
label
.
set_halign
(
Gtk
.
Align
.
CENTER
)
main_grid
.
attach
(
label
,
0
,
2
,
1
,
1
)
# CheckButton (Celsius)
self
.
temperature_unit_celsius_cb
=
Common
.
checkbutton
(
_tr
(
"Celsius"
),
None
)
main_grid
.
attach
(
self
.
temperature_unit_celsius_cb
,
0
,
3
,
1
,
1
)
# CheckButton (Fahrenheit)
self
.
temperature_unit_fahrenheit_cb
=
Common
.
checkbutton
(
_tr
(
"Fahrenheit"
),
self
.
temperature_unit_celsius_cb
)
main_grid
.
attach
(
self
.
temperature_unit_fahrenheit_cb
,
0
,
4
,
1
,
1
)
# Separator
separator
=
Common
.
menu_separator
()
main_grid
.
attach
(
separator
,
0
,
5
,
2
,
1
)
# Button (Reset)
self
.
reset_button
=
Common
.
reset_button
()
main_grid
.
attach
(
self
.
reset_button
,
0
,
6
,
2
,
1
)
# Connect signals
self
.
reset_button
.
connect
(
"clicked"
,
self
.
on_reset_button_clicked
)
self
.
menu_po
.
connect
(
"show"
,
self
.
on_menu_po_show
)
def
connect_signals
(
self
):
"""
Connect some of the signals to be able to disconnect them for setting GUI.
"""
self
.
temperature_unit_celsius_cb
.
connect
(
"toggled"
,
self
.
on_temperature_unit_cb_toggled
)
self
.
temperature_unit_fahrenheit_cb
.
connect
(
"toggled"
,
self
.
on_temperature_unit_cb_toggled
)
def
disconnect_signals
(
self
):
"""
Disconnect some of the signals for setting GUI.
"""
self
.
temperature_unit_celsius_cb
.
disconnect_by_func
(
self
.
on_temperature_unit_cb_toggled
)
self
.
temperature_unit_fahrenheit_cb
.
disconnect_by_func
(
self
.
on_temperature_unit_cb_toggled
)
def
on_menu_po_show
(
self
,
widget
):
"""
Run code when menu is shown.
"""
try
:
self
.
disconnect_signals
()
except
TypeError
:
pass
self
.
set_gui
()
self
.
connect_signals
()
def
on_temperature_unit_cb_toggled
(
self
,
widget
):
"""
Set temperature units.
"""
if
widget
.
get_active
()
==
True
:
if
widget
==
self
.
temperature_unit_celsius_cb
:
Config
.
temperature_unit
=
"celsius"
if
widget
==
self
.
temperature_unit_fahrenheit_cb
:
Config
.
temperature_unit
=
"fahrenheit"
Common
.
save_tab_settings
(
Sensors
)
def
on_reset_button_clicked
(
self
,
widget
):
"""
Reset all tab settings.
"""
# Load default settings
Config
.
config_default_performance_sensors_func
()
Config
.
config_save_func
()
Common
.
update_tab_and_menu_gui
(
self
,
Sensors
)
def
set_gui
(
self
):
"""
Set menu GUI items.
"""
# Select checkbutton appropriate for temperature unit setting
if
Config
.
temperature_unit
==
"celsius"
:
self
.
temperature_unit_celsius_cb
.
set_active
(
True
)
if
Config
.
temperature_unit
==
"fahrenheit"
:
self
.
temperature_unit_fahrenheit_cb
.
set_active
(
False
)
SensorsMenu
=
SensorsMenu
()
src/meson.build
Dosyayı görüntüle @
df4b0092
...
...
@@ -47,6 +47,7 @@ system_monitoring_center_sources = [
'ProcessesMenu.py',
'run_from_source.py',
'Sensors.py',
'SensorsMenu.py',
'Services.py',
'ServicesDetails.py',
'ServicesMenu.py',
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment