mirror of
https://github.com/aclist/dztui.git
synced 2026-10-29 22:22:52 +01:00
chore: simplify controller logic
This commit is contained in:
1 parent
7a9f0dc096
commit
eb4ee41742
3 files changed
+23
-22
No files matched your search
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
from dzgui.util.ip import get_coords
|
||||
from dzgui.util.localize import number
|
||||
|
||||
import gi
|
||||
|
||||
@@ -40,6 +41,18 @@ class Haversine:
|
||||
def as_miles(self) -> float:
|
||||
return self.dist / 1609.344
|
||||
|
||||
def get_rounded(self, use_miles: bool) -> str:
|
||||
if self is None:
|
||||
return "Unknown"
|
||||
if use_miles:
|
||||
raw = round(self.as_miles())
|
||||
separated = number(raw)
|
||||
return str(separated) + " mi"
|
||||
else:
|
||||
raw = round(self.as_kilometers())
|
||||
separated = number(raw)
|
||||
return str(separated) + " km"
|
||||
|
||||
|
||||
class CalcDist:
|
||||
def __init__(
|
||||
|
||||
Reference in new issue
Block a user