forked from tidbyt/pixlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
humanize.star
43 lines (39 loc) · 1.19 KB
/
humanize.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
load("render.star", "render")
load("schema.star", "schema")
load("time.star", "time")
load("humanize.star", "humanize")
DEFAULT_COUNTER = "1337"
DEFAULT_APPS = "42"
DEFAULT_TIMEZONE = "America/New_York"
def main(config):
tz = config.get("$tz", DEFAULT_TIMEZONE)
num_apps = config.get("num_apps", DEFAULT_APPS)
now = time.now()
return render.Root(
child = render.Column(
children = [
render.Text(" %s rated" % humanize.plural(int(num_apps), "app")),
render.Text(" Comma: %s" % humanize.comma(int(config.get("count", "1337")))),
],
),
)
def get_schema():
return schema.Schema(
version = "1",
fields = [
schema.Text(
id = "count",
name = "Count",
desc = "A cool counter that has comma separators",
icon = "number",
default = DEFAULT_COUNTER,
),
schema.Text(
id = "num_apps",
name = "How many apps do you want?",
desc = "The number of apps",
icon = "number",
default = DEFAULT_APPS,
),
],
)