diff --git a/library/scheduler.py b/library/scheduler.py index c36812f6..455742e6 100644 --- a/library/scheduler.py +++ b/library/scheduler.py @@ -69,6 +69,8 @@ def wrap( **kwargs ): """ Wrapper to create our schedule and run it at the appropriate time """ + if interval == 0: + return scheduler = sched.scheduler(time.time, time.sleep) periodic(scheduler, interval, func) scheduler.run() @@ -79,7 +81,7 @@ def wrap( @async_job("CPU_Percentage") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['PERCENTAGE'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['PERCENTAGE'].get("INTERVAL", 0)).total_seconds()) def CPUPercentage(): """ Refresh the CPU Percentage """ # logger.debug("Refresh CPU Percentage") @@ -87,7 +89,7 @@ def CPUPercentage(): @async_job("CPU_Frequency") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['FREQUENCY'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['FREQUENCY'].get("INTERVAL", 0)).total_seconds()) def CPUFrequency(): """ Refresh the CPU Frequency """ # logger.debug("Refresh CPU Frequency") @@ -95,7 +97,7 @@ def CPUFrequency(): @async_job("CPU_Load") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['LOAD'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['LOAD'].get("INTERVAL", 0)).total_seconds()) def CPULoad(): """ Refresh the CPU Load """ # logger.debug("Refresh CPU Load") @@ -103,7 +105,7 @@ def CPULoad(): @async_job("CPU_Load") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['TEMPERATURE'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['TEMPERATURE'].get("INTERVAL", 0)).total_seconds()) def CPUTemperature(): """ Refresh the CPU Temperature """ # logger.debug("Refresh CPU Temperature") @@ -111,7 +113,7 @@ def CPUTemperature(): @async_job("CPU_FanSpeed") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['FAN_SPEED'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CPU']['FAN_SPEED'].get("INTERVAL", 0)).total_seconds()) def CPUFanSpeed(): """ Refresh the CPU Fan Speed """ # logger.debug("Refresh CPU Fan Speed") @@ -119,7 +121,7 @@ def CPUFanSpeed(): @async_job("GPU_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['GPU'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['GPU'].get("INTERVAL", 0)).total_seconds()) def GpuStats(): """ Refresh the GPU Stats """ # logger.debug("Refresh GPU Stats") @@ -127,35 +129,35 @@ def GpuStats(): @async_job("Memory_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['MEMORY'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['MEMORY'].get("INTERVAL", 0)).total_seconds()) def MemoryStats(): # logger.debug("Refresh memory stats") stats.Memory.stats() @async_job("Disk_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['DISK'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['DISK'].get("INTERVAL", 0)).total_seconds()) def DiskStats(): # logger.debug("Refresh disk stats") stats.Disk.stats() @async_job("Net_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['NET'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['NET'].get("INTERVAL", 0)).total_seconds()) def NetStats(): # logger.debug("Refresh net stats") stats.Net.stats() @async_job("Date_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['DATE'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['DATE'].get("INTERVAL", 0)).total_seconds()) def DateStats(): # logger.debug("Refresh date stats") stats.Date.stats() @async_job("Custom_Stats") -@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CUSTOM'].get("INTERVAL", None)).total_seconds()) +@schedule(timedelta(seconds=config.THEME_DATA['STATS']['CUSTOM'].get("INTERVAL", 0)).total_seconds()) def CustomStats(): # print("Refresh custom stats") stats.Custom.stats() diff --git a/res/themes/Cyberdeck/theme.yaml b/res/themes/Cyberdeck/theme.yaml index bd57730a..31bb3ec1 100644 --- a/res/themes/Cyberdeck/theme.yaml +++ b/res/themes/Cyberdeck/theme.yaml @@ -57,6 +57,7 @@ STATS: # BACKGROUND_COLOR: 132, 154, 165 BACKGROUND_IMAGE: background.png FAN_SPEED: + INTERVAL: 5 RADIAL: SHOW: True X: 170 diff --git a/res/themes/default.yaml b/res/themes/default.yaml index 1e1d2d5f..28b1f186 100644 --- a/res/themes/default.yaml +++ b/res/themes/default.yaml @@ -3,7 +3,7 @@ STATS: CPU: PERCENTAGE: - INTERVAL: 100 + INTERVAL: 0 TEXT: SHOW: False GRAPH: @@ -13,7 +13,7 @@ STATS: LINE_GRAPH: SHOW: False FREQUENCY: - INTERVAL: 100 + INTERVAL: 0 TEXT: SHOW: False GRAPH: @@ -23,7 +23,7 @@ STATS: LINE_GRAPH: SHOW: False LOAD: - INTERVAL: 100 + INTERVAL: 0 ONE: TEXT: SHOW: False @@ -34,7 +34,7 @@ STATS: TEXT: SHOW: False TEMPERATURE: - INTERVAL: 100 + INTERVAL: 0 TEXT: SHOW: False GRAPH: @@ -44,7 +44,7 @@ STATS: LINE_GRAPH: SHOW: False FAN_SPEED: - INTERVAL: 100 + INTERVAL: 0 TEXT: SHOW: False GRAPH: @@ -54,7 +54,7 @@ STATS: LINE_GRAPH: SHOW: False GPU: - INTERVAL: 100 + INTERVAL: 0 PERCENTAGE: GRAPH: SHOW: False @@ -120,7 +120,7 @@ STATS: LINE_GRAPH: SHOW: False MEMORY: - INTERVAL: 100 + INTERVAL: 0 SWAP: GRAPH: SHOW: False @@ -144,7 +144,7 @@ STATS: PERCENT_TEXT: SHOW: False DISK: - INTERVAL: 100 + INTERVAL: 0 USED: GRAPH: SHOW: False @@ -163,7 +163,7 @@ STATS: TEXT: SHOW: False NET: - INTERVAL: 100 + INTERVAL: 0 WLO: UPLOAD: TEXT: @@ -199,7 +199,7 @@ STATS: TEXT: SHOW: False DATE: - INTERVAL: 100 + INTERVAL: 0 DAY: TEXT: SHOW: False @@ -207,4 +207,4 @@ STATS: TEXT: SHOW: False CUSTOM: - INTERVAL: 100 + INTERVAL: 0 diff --git a/res/themes/theme_example.yaml b/res/themes/theme_example.yaml index 2e298484..c9b14040 100644 --- a/res/themes/theme_example.yaml +++ b/res/themes/theme_example.yaml @@ -423,6 +423,7 @@ STATS: # In seconds. Longer intervals cause this to refresh more slowly. # Setting to lower values will display near real time data, # but may cause significant CPU usage or the display not to update properly + # Note: refresh interval is common to all GPU sensors INTERVAL: 1 PERCENTAGE: GRAPH: diff --git a/theme-editor.py b/theme-editor.py index 944ee4bc..3e6474a7 100755 --- a/theme-editor.py +++ b/theme-editor.py @@ -101,17 +101,28 @@ def refresh_theme(): # Display all data on screen once import library.stats as stats - stats.CPU.percentage() - stats.CPU.frequency() - stats.CPU.load() - stats.CPU.temperature() - stats.CPU.fan_speed() - stats.Gpu.stats() - stats.Memory.stats() - stats.Disk.stats() - stats.Net.stats() - stats.Date.stats() - stats.Custom.stats() + if config.THEME_DATA['STATS']['CPU']['PERCENTAGE'].get("INTERVAL", 0) > 0: + stats.CPU.percentage() + if config.THEME_DATA['STATS']['CPU']['FREQUENCY'].get("INTERVAL", 0) > 0: + stats.CPU.frequency() + if config.THEME_DATA['STATS']['CPU']['LOAD'].get("INTERVAL", 0) > 0: + stats.CPU.load() + if config.THEME_DATA['STATS']['CPU']['TEMPERATURE'].get("INTERVAL", 0) > 0: + stats.CPU.temperature() + if config.THEME_DATA['STATS']['CPU']['FAN_SPEED'].get("INTERVAL", 0) > 0: + stats.CPU.fan_speed() + if config.THEME_DATA['STATS']['GPU'].get("INTERVAL", 0) > 0: + stats.Gpu.stats() + if config.THEME_DATA['STATS']['MEMORY'].get("INTERVAL", 0) > 0: + stats.Memory.stats() + if config.THEME_DATA['STATS']['DISK'].get("INTERVAL", 0) > 0: + stats.Disk.stats() + if config.THEME_DATA['STATS']['NET'].get("INTERVAL", 0) > 0: + stats.Net.stats() + if config.THEME_DATA['STATS']['DATE'].get("INTERVAL", 0) > 0: + stats.Date.stats() + if config.THEME_DATA['STATS']['CUSTOM'].get("INTERVAL", 0) > 0: + stats.Custom.stats() if __name__ == "__main__":