Skip to content

Commit

Permalink
Update load.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackyBPG committed Jun 4, 2021
1 parent 050b51e commit a91154c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions load.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
except ImportError:
config = dict()

APP_VERSION = "20.07.04_b0938"
APP_VERSION = "21.01.02_b1344"

CFG_DISTANCE = "JumpSpeed_distance"
CFG_JUMPS = "JumpSpeed_jumps"
Expand Down Expand Up @@ -169,7 +169,7 @@ def rate(self):
"""
if self.alljumps() > 0:
return (self.saved_jumps + self.alljumps()) / (self.saved_time + self.sincetime())
elif self.saved_jumps > 0:
elif self.saved_jumps > 0 and self.saved_time > 0:
return self.saved_jumps / self.saved_time
else:
return 0
Expand All @@ -179,7 +179,7 @@ def ratenow(self):
Get the jump/hr rate
:return jump rate for trip per hour:
"""
if self.alljumps() > 0:
if self.alljumps() > 0 and self.sincetime() > 0:
return self.alljumps() / self.sincetime()
else:
return 0
Expand All @@ -191,7 +191,7 @@ def speed(self):
"""
if self.trip_distance() > 0 and self.alljumps() > 0:
return (self.saved_distance + self.trip_distance()) / (self.saved_time + self.sincetime())
elif self.saved_distance > 0:
elif self.saved_distance > 0 and self.saved_time > 0:
return self.saved_distance / self.saved_time
else:
return 0
Expand Down Expand Up @@ -274,17 +274,17 @@ def plugin_app(parent):
frame = tk.Frame(parent)

jumpspeed.rate_widget = tk.Label(frame, text="...", justify=tk.RIGHT)
rate_label = tk.Label(frame, text=_("Jumps/Hour:").encode('utf-8'), justify=tk.LEFT)
rate_label = tk.Label(frame, text=_("Jumps/Hour:").encode('iso-8859-1'), justify=tk.LEFT)
rate_label.grid(row=0, column=0, sticky=tk.W)
jumpspeed.rate_widget.grid(row=0, column=2, sticky=tk.E)
rateT_label = tk.Label(frame, text=_("Jumps").encode('utf-8'), justify=tk.LEFT)
rateT_label = tk.Label(frame, text=_("Jumps").encode('iso-8859-1'), justify=tk.LEFT)
rateT_label.grid(row=0, column=4, sticky=tk.W)

jumpspeed.ratenow_widget = tk.Label(frame, text="", justify=tk.RIGHT)
jumpspeed.ratenow_widget.grid(row=0, column=1, sticky=tk.E)

jumpspeed.speed_widget = tk.Label(frame, text="...", justify=tk.RIGHT)
speed_label = tk.Label(frame, text=_("Distance/Hour:").encode('utf-8'), justify=tk.LEFT)
speed_label = tk.Label(frame, text=_("Distance/Hour:").encode('iso-8859-1'), justify=tk.LEFT)
speed_label.grid(row=1, column=0, sticky=tk.W)
jumpspeed.speed_widget.grid(row=1, column=2, sticky=tk.E)
speedT_label = tk.Label(frame, text="Ly", justify=tk.LEFT)
Expand All @@ -294,7 +294,7 @@ def plugin_app(parent):
jumpspeed.speednow_widget.grid(row=1, column=1, sticky=tk.E)

jumpspeed.dist_widget = tk.Label(frame, text="...", justify=tk.RIGHT)
dist_label = tk.Label(frame, text=_("Overall dist.:").encode('utf-8'), justify=tk.LEFT)
dist_label = tk.Label(frame, text=_("Overall dist.:").encode('iso-8859-1'), justify=tk.LEFT)
dist_label.grid(row=2, column=0, sticky=tk.W)
jumpspeed.dist_widget.grid(row=2, column=2, sticky=tk.E)
distT_label = tk.Label(frame, text="Ly", justify=tk.LEFT)
Expand Down

0 comments on commit a91154c

Please sign in to comment.