Skip to content

Commit

Permalink
Add verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
deefrawley committed Apr 13, 2023
1 parent 4bb6443 commit 260a8d9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions plugin/general_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,19 @@ def query(self, query):
subtitle=_("Check documentation for accepted units"),
)
else:
c = do_convert["converted"]
p = smart_precision(locale.localeconv()["decimal_point"], c, 3)
converted = do_convert["converted"]
category = do_convert["category"]
to_long = do_convert["toplural"]
to_abb = do_convert["toabbrev"]
from_long = do_convert["fromplural"]
from_abb = do_convert["fromabbrev"]
converted_precision = smart_precision(
locale.localeconv()["decimal_point"], converted, 3
)
self.add_item(
title=(do_convert["category"]),
title=(category),
subtitle=(
f"{locale.format_string('%.10g', float(args[0]), grouping=True)} {args[1]} = {locale.format_string(f'%.{p}f', c, grouping=True)} {args[2]}"
f"{locale.format_string('%.10g', float(args[0]), grouping=True)} {from_long} ({from_abb}) = {locale.format_string(f'%.{converted_precision}f', converted, grouping=True)} {to_long} ({to_abb})"
),
icon=f"assets/{do_convert['category']}.ico",
)
Expand All @@ -94,7 +101,7 @@ def query(self, query):
)


def get_all_units(short=False):
def get_all_units(short: bool = False):
"""Returns all available units as a list of lists by category
:param short: if True only unit abbreviations are returned, default is False
Expand Down

0 comments on commit 260a8d9

Please sign in to comment.