-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,49 @@ | ||
from textual.widgets import Label | ||
from rich.text import Text | ||
from models.user import User | ||
from textual.containers import VerticalScroll | ||
from models.guilds import Guilds | ||
|
||
class Display(VerticalScroll): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
def add_prompt(self, path: str): | ||
renderable = Text() | ||
renderable.append(User.get_username() + '@TerminallyOnline', style='bold green') | ||
renderable.append(':', style='bold') | ||
renderable.append(path, style='bold blue') | ||
renderable.append('$ ', style='bold') | ||
self.mount(Label(renderable)) | ||
self.scroll_end() | ||
|
||
def remove_prompt(self): | ||
self.remove_child(self.children[0]) | ||
|
||
def add_command(self, path: str, text: str): | ||
renderable = Text() | ||
renderable.append(User.get_username() + '@TerminallyOnline', style='bold green') | ||
renderable.append(':', style='bold') | ||
renderable.append(path, style='bold blue') | ||
renderable.append('$ ', style='bold') | ||
renderable.append(text) | ||
self.mount(Label(renderable)) | ||
self.scroll_end() | ||
|
||
def add_info(self, renderable): | ||
self.mount(Label(renderable)) | ||
self.scroll_end() | ||
|
||
def add_err(self, text: str): | ||
renderable = Text() | ||
renderable.append('TerminallyOnline: ') | ||
renderable.append(text) | ||
self.scroll_end() | ||
|
||
def clear(self): | ||
self.remove_children() | ||
|
||
def on_mount(self): | ||
self.add_prompt('/') | ||
self.scroll_end() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters