Skip to content

Commit 0bf9ba8

Browse files
Spontaneous changes
1 parent 0cc7f62 commit 0bf9ba8

5 files changed

Lines changed: 24 additions & 30 deletions

File tree

src/defaults/configuration.json5

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
// The order in which to display widgets.
1818
"layout":[
19-
"hello",
20-
"datetime",
21-
"credits"
19+
"os",
20+
"hostname",
21+
"architecture"
2222
],
2323

2424
////////////////////// ASCII ART CONFIGURATION //////////////////////
@@ -32,11 +32,13 @@
3232
// If you define the ascii here, you need to escape backslashes and single or double quotes by using a backslash before it.
3333
// Example: `\` should become `\\`, and `"` should become `\"`.
3434
"ascii":[
35-
" __ __ ____ _____ _ _ ____ ____ ____ ___ _ _ ",
36-
"( \\/ )( ___)( _ )( \\/\\/ )( ___)( ___)(_ _)/ __)( )_( )",
37-
" ) ( )__) )(_)( ) ( )__) )__) )( ( (__ ) _ ( ",
38-
"(_/\\/\\_)(____)(_____)(__/\\__)(__) (____) (__) \\___)(_) (_)",
39-
"Meowfetch - A terminal fetch utility for cats and humans alike!",
40-
""
35+
"{{bold}}{{purple}}______ __ _ _ ",
36+
"{{bold}}{{purple}}| ___| / _| | | | | ",
37+
"{{bold}}{{purple}}| |_ __ _ _ __ ___ _ _| |_ ___| |_ ___| |__ ",
38+
"{{bold}}{{purple}}| _/ _` | '_ \\ / __| | | | _/ _ \\ __/ __| '_ \\ ",
39+
"{{bold}}{{purple}}| || (_| | | | | (__| |_| | || __/ || (__| | | |",
40+
"{{bold}}{{purple}}\\_| \\__,_|_| |_|\\___|\\__, |_| \\___|\\__\\___|_| |_|",
41+
"{{bold}}{{purple}} __/ | ",
42+
"{{bold}}{{purple}} |___/ "
4143
],
4244
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Widget: # Must be named Widget.
22
def __init__(self):
33
# It is advised that you process your most intensive logic here.
4-
import time
5-
self.Value = "It is currently: "+time.ctime()
4+
import platform
5+
self.Value = "{{gold}}Architecture: {{white}}"+platform.machine()
66

77
def Get(self):return self.Value # Must be named Get, but may return anything that can be converted to a string.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class Widget: # Must be named Widget.
22
def __init__(self):
33
# It is advised that you process your most intensive logic here.
4-
self.Value = "Created by ItsThatOneJack!"
4+
import platform
5+
self.Value = "{{gold}}Hostname: {{white}}"+platform.node()
56

67
def Get(self):return self.Value # Must be named Get, but may return anything that can be converted to a string.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class Widget: # Must be named Widget.
22
def __init__(self):
33
# It is advised that you process your most intensive logic here.
4-
self.Value = "Hello, world!"
4+
import platform
5+
self.Value = "{{gold}}OS: {{white}}"+platform.uname().system+" "+platform.uname().version
56

67
def Get(self):return self.Value # Must be named Get, but may return anything that can be converted to a string.

src/formatting.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,10 @@ def ProcessMatch(Match):
9898
nonlocal ActiveTags, Result
9999
TagSpec = Match.group(1).strip().lower()
100100

101-
if TagSpec == "reset":
102-
# Close all active tags
103-
if ActiveTags:
104-
# Rich requires closing tags in reverse order or all at once
105-
ClosingTag = "[/" + " ".join(ActiveTags) + "]"
106-
Result.append(ClosingTag)
107-
ActiveTags.clear()
108-
return ""
109-
elif TagSpec == "normal":
110-
# Close all active tags (same as reset)
111-
if ActiveTags:
112-
ClosingTag = "[/" + " ".join(ActiveTags) + "]"
113-
Result.append(ClosingTag)
114-
ActiveTags.clear()
101+
if TagSpec == "reset" or TagSpec == "normal":
102+
# Close all active tags in reverse order, one by one
103+
while ActiveTags:
104+
Result.append(f"[/{ActiveTags.pop()}]")
115105
return ""
116106
else:
117107
# Handle regular tags (colors and styles)
@@ -139,9 +129,9 @@ def ProcessMatch(Match):
139129
# Join all parts
140130
FormattedText = "".join(Result)
141131

142-
# Auto-close any remaining tags at the end
143-
if ActiveTags:
144-
FormattedText += "[/" + " ".join(ActiveTags) + "]"
132+
# Auto-close any remaining tags at the end, in reverse order
133+
while ActiveTags:
134+
FormattedText += f"[/{ActiveTags.pop()}]"
145135

146136
return FormattedText
147137

0 commit comments

Comments
 (0)