Compare commits
No commits in common. "5b09cc5af31a662e14a26bd4cf92fda305a052a6" and "e2f0ace30a15ca748a670621e1594f47515aa8a5" have entirely different histories.
5b09cc5af3
...
e2f0ace30a
2 changed files with 8 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "amdgpu-stats"
|
name = "amdgpu-stats"
|
||||||
version = "0.1.22"
|
version = "0.1.21"
|
||||||
description = "A module/TUI for AMD GPU statistics"
|
description = "A module/TUI for AMD GPU statistics"
|
||||||
authors = ["Josh Lay <pypi@jlay.io>"]
|
authors = ["Josh Lay <pypi@jlay.io>"]
|
||||||
repository = "https://git.init3.us/BraveTraveler/amdgpu_stats"
|
repository = "https://git.init3.us/BraveTraveler/amdgpu_stats"
|
||||||
|
|
|
@ -250,28 +250,14 @@ class app(App): # pylint: disable=invalid-name
|
||||||
yield Container(self.stats_widget)
|
yield Container(self.stats_widget)
|
||||||
yield Footer()
|
yield Footer()
|
||||||
|
|
||||||
def update_log(self, message: str, show_ts: bool = True) -> None:
|
|
||||||
"""Update the TextLog widget with a new message.
|
|
||||||
Highest Textual version-requiring widget; >=0.32.0
|
|
||||||
Should be more performant than the old TextLog widget
|
|
||||||
|
|
||||||
Args:
|
|
||||||
message (str): The message to be added to the logging widget on the 'Logs' tab.
|
|
||||||
show_ts (bool, optional): If True (default), appends a timestamp to the message.
|
|
||||||
"""
|
|
||||||
if show_ts:
|
|
||||||
message = f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {message}"
|
|
||||||
self.stats_widget.text_log.write_line(message)
|
|
||||||
|
|
||||||
@work(exclusive=True)
|
@work(exclusive=True)
|
||||||
async def action_custom_dark(self) -> None:
|
async def action_custom_dark(self) -> None:
|
||||||
"""An action to toggle dark mode.
|
"""An action to toggle dark mode.
|
||||||
|
|
||||||
Wraps 'action_toggle_dark' with our logging"""
|
Wraps 'action_toggle_dark' with our logging"""
|
||||||
self.app.dark = not self.app.dark
|
self.app.dark = not self.app.dark
|
||||||
# with new log widget... styling doesn't get rendered, disabling. makes notifications look nice
|
# inline conditional due to how Textual doesn't pretty notifs. for us like TextLog
|
||||||
# message = f"[bold]Dark side: [italic][{'green' if self.app.dark else 'red'}]{self.app.dark}"
|
message = f"[bold]Dark side: [italic][{'green' if self.app.dark else 'red'}]{self.app.dark}"
|
||||||
message = f"Dark side: {self.app.dark}"
|
|
||||||
self.notify(message)
|
self.notify(message)
|
||||||
self.update_log(message)
|
self.update_log(message)
|
||||||
|
|
||||||
|
@ -298,10 +284,14 @@ class app(App): # pylint: disable=invalid-name
|
||||||
# take the screenshot, recording the path for logging/notification
|
# take the screenshot, recording the path for logging/notification
|
||||||
outpath = self.save_screenshot(path=screen_dir, filename=screen_name)
|
outpath = self.save_screenshot(path=screen_dir, filename=screen_name)
|
||||||
# construct the log/notification message, then show it
|
# construct the log/notification message, then show it
|
||||||
message = f"Path: '{outpath}'"
|
message = f"[bold]Path: [/]'[green]{outpath}[/]'"
|
||||||
self.notify(message, title='Screenshot captured', timeout=3.0)
|
self.notify(message, title='Screenshot captured', timeout=3.0)
|
||||||
self.update_log(message)
|
self.update_log(message)
|
||||||
|
|
||||||
|
def update_log(self, message: str) -> None:
|
||||||
|
"""Update the TextLog widget with a new message."""
|
||||||
|
self.stats_widget.text_log.write(message)
|
||||||
|
|
||||||
def action_custom_tab(self) -> None:
|
def action_custom_tab(self) -> None:
|
||||||
"""Toggle between the 'Stats' and 'Logs' tabs"""
|
"""Toggle between the 'Stats' and 'Logs' tabs"""
|
||||||
# walk/cycle the tabs
|
# walk/cycle the tabs
|
||||||
|
|
Reference in a new issue