Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
WombatFromHell committed Mar 2, 2015
2 parents 4840c15 + cf43255 commit 5c6dca8
Show file tree
Hide file tree
Showing 7 changed files with 327 additions and 153 deletions.
11 changes: 11 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.12.3 Mar 01 2015
. (kfsone) Improved how we handle some edge cases with --from and --to,
. (kfsone) Improved feedback when requesting an unreachable journey,
e.g. --from selianciens --to eravate --ly 9.23 --hops 2 --jumps 2
(the journey requires at least 9 jumps but the options only allow 4),
. (kfsone) Fixed #185 --from and --to giving a "set" error,
. (kfsone) Fixed #188 Allow multiple ships per "shipvendor",
. (kfsone) Fixed #190 "station -r" wasn't updated the .csv file,
. (kfsone) Cleaned up the output of "local" command when showing stations,
+ DRy411S : ShipVendors

v6.12.2 Feb 26 2015
. (kfsone) "run" command:
- added "--direct" option:
Expand Down
27 changes: 19 additions & 8 deletions commands/local_cmd.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
from commands.commandenv import ResultRow
from commands.parsing import MutuallyExclusiveGroup, ParseArgument
from formatting import RowFormat, ColumnFormat
from formatting import RowFormat, ColumnFormat, max_len
from itertools import chain
from tradedb import TradeDB
from tradeexcept import TradeException

import itertools
import math

######################################################################
Expand Down Expand Up @@ -108,12 +108,10 @@ def render(results, cmdenv, tdb):
))

# Compare system names so we can tell
longestNamed = max(results.rows,
key=lambda row: len(row.system.name()))
longestNameLen = max(len(longestNamed.system.name()), 16)
maxSysLen = max_len(results.rows, key=lambda row: row.system.name())

sysRowFmt = RowFormat().append(
ColumnFormat("System", '<', longestNameLen,
ColumnFormat("System", '<', maxSysLen,
key=lambda row: row.system.name())
).append(
ColumnFormat("Dist", '>', '7', '.2f',
Expand All @@ -122,11 +120,24 @@ def render(results, cmdenv, tdb):

showStations = cmdenv.detail
if showStations:
maxStnLen = max_len(
chain.from_iterable(
row.system.stations for row in results.rows
),
key=lambda row: row.dbname
)
maxLsLen = max_len(
chain.from_iterable(
row.system.stations for row in results.rows
),
key=lambda row: row.distFromStar()
)
maxLsLen = max(maxLsLen, 5)
stnRowFmt = RowFormat(prefix=' / ').append(
ColumnFormat("Station", '<', 32,
ColumnFormat("Station", '<', maxStnLen + 1,
key=lambda row: row.station.str())
).append(
ColumnFormat("StnLs", '>', '10',
ColumnFormat("StnLs", '>', maxLsLen,
key=lambda row: row.station.distFromStar())
).append(
ColumnFormat("Age/days", '>', 7,
Expand Down
Loading

0 comments on commit 5c6dca8

Please sign in to comment.