Skip to content

Commit

Permalink
Better layout of the mfd - not wasting an entire line on the step/hop…
Browse files Browse the repository at this point in the history
… no.
  • Loading branch information
kfsone committed Aug 23, 2014
1 parent 0e6c71c commit a45b2d6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,10 @@ def parse_command_line():
######################################################################
# Processing functions

def doStep(stepNo, action, detail=""):
def doStep(stepNo, action, detail=None, extra=None):
stepNo += 1
mfd.display("Step %d. Hop %d" % (stepNo, mfd.hopNo), action, detail)
if detail:
input(" %3d: %s %s: " % (stepNo, action, detail))
else:
input(" %3d: %s: " % (stepNo, action))
mfd.display("#%d %s" % (stepNo, action), detail or "", extra or "")
input(" %3d: %s: " % (stepNo, " ".join([item for item in [action, detail, extra] if item])))
return stepNo

def note(str, addBreak=True):
Expand Down Expand Up @@ -308,8 +305,7 @@ def doChecklist(route, credits):

note("Buy at %s" % cur)
for (item, qty) in sorted(hop[0], key=lambda item: item[1] * item[0].gainCr, reverse=True):
itemDesc = "%s @ %dcr" % (item.item, item.costCr)
stepNo = doStep(stepNo, 'Buy %d x' % qty, itemDesc)
stepNo = doStep(stepNo, 'Buy %d x' % qty, item.item, '@ %scr' % localedNo(item.costCr))
if args.detail:
stepNo = doStep(stepNo, 'Refuel')
print()
Expand All @@ -325,8 +321,7 @@ def doChecklist(route, credits):

note("Sell at %s" % nxt)
for (item, qty) in sorted(hop[0], key=lambda item: item[1] * item[0].gainCr, reverse=True):
itemDesc = "%s @ %dcr" % (item.item, item.costCr + item.gainCr)
stepNo = doStep(stepNo, 'Sell %s x' % localedNo(qty), itemDesc)
stepNo = doStep(stepNo, 'Sell %s x' % localedNo(qty), item.item, '@ %scr' % localedNo(item.costCr + item.gainCr))
print()

gainCr += hop[1]
Expand All @@ -339,7 +334,9 @@ def doChecklist(route, credits):
print()

mfd.hopNo = None
mfd.display('FINISHED', "+%scr" % localedNo(gainCr), "=%scr" % localedNo(credits + gainCr), delay=3)
mfd.display('FINISHED', "+%scr" % localedNo(gainCr), "=%scr" % localedNo(credits + gainCr))
mfd.attention(3)
time.sleep(1.5)

def main():
global tdb
Expand Down

0 comments on commit a45b2d6

Please sign in to comment.