tradedangerous 10.17.0__py3-none-any.whl → 11.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tradedangerous might be problematic. Click here for more details.
- tradedangerous/__init__.py +4 -4
- tradedangerous/cache.py +178 -142
- tradedangerous/cli.py +2 -7
- tradedangerous/commands/TEMPLATE.py +1 -2
- tradedangerous/commands/__init__.py +2 -4
- tradedangerous/commands/buildcache_cmd.py +6 -11
- tradedangerous/commands/buy_cmd.py +11 -12
- tradedangerous/commands/commandenv.py +16 -15
- tradedangerous/commands/exceptions.py +6 -4
- tradedangerous/commands/export_cmd.py +2 -4
- tradedangerous/commands/import_cmd.py +3 -5
- tradedangerous/commands/local_cmd.py +16 -25
- tradedangerous/commands/market_cmd.py +9 -8
- tradedangerous/commands/nav_cmd.py +17 -25
- tradedangerous/commands/olddata_cmd.py +9 -15
- tradedangerous/commands/parsing.py +9 -6
- tradedangerous/commands/rares_cmd.py +9 -10
- tradedangerous/commands/run_cmd.py +25 -26
- tradedangerous/commands/sell_cmd.py +9 -9
- tradedangerous/commands/shipvendor_cmd.py +4 -7
- tradedangerous/commands/station_cmd.py +8 -14
- tradedangerous/commands/trade_cmd.py +5 -10
- tradedangerous/commands/update_cmd.py +10 -7
- tradedangerous/commands/update_gui.py +1 -3
- tradedangerous/corrections.py +1 -3
- tradedangerous/csvexport.py +8 -8
- tradedangerous/edscupdate.py +4 -6
- tradedangerous/edsmupdate.py +4 -4
- tradedangerous/formatting.py +53 -40
- tradedangerous/fs.py +6 -6
- tradedangerous/gui.py +53 -62
- tradedangerous/jsonprices.py +8 -16
- tradedangerous/mapping.py +4 -3
- tradedangerous/mfd/__init__.py +2 -4
- tradedangerous/mfd/saitek/__init__.py +0 -1
- tradedangerous/mfd/saitek/directoutput.py +8 -11
- tradedangerous/mfd/saitek/x52pro.py +5 -7
- tradedangerous/misc/checkpricebounds.py +2 -3
- tradedangerous/misc/clipboard.py +2 -3
- tradedangerous/misc/coord64.py +2 -1
- tradedangerous/misc/derp-sentinel.py +1 -1
- tradedangerous/misc/diff-system-csvs.py +3 -0
- tradedangerous/misc/eddb.py +1 -3
- tradedangerous/misc/eddn.py +2 -2
- tradedangerous/misc/edsc.py +7 -14
- tradedangerous/misc/edsm.py +1 -8
- tradedangerous/misc/importeddbstats.py +2 -1
- tradedangerous/misc/prices-json-exp.py +7 -5
- tradedangerous/misc/progress.py +2 -2
- tradedangerous/plugins/__init__.py +2 -2
- tradedangerous/plugins/edapi_plug.py +13 -19
- tradedangerous/plugins/edcd_plug.py +4 -5
- tradedangerous/plugins/eddblink_plug.py +11 -15
- tradedangerous/plugins/edmc_batch_plug.py +3 -5
- tradedangerous/plugins/journal_plug.py +2 -1
- tradedangerous/plugins/netlog_plug.py +5 -5
- tradedangerous/plugins/spansh_plug.py +394 -170
- tradedangerous/prices.py +19 -20
- tradedangerous/submit-distances.py +3 -8
- tradedangerous/templates/TradeDangerous.sql +305 -306
- tradedangerous/trade.py +12 -5
- tradedangerous/tradecalc.py +30 -34
- tradedangerous/tradedb.py +140 -206
- tradedangerous/tradeenv.py +143 -69
- tradedangerous/tradegui.py +4 -2
- tradedangerous/transfers.py +23 -20
- tradedangerous/version.py +1 -1
- {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.1.dist-info}/METADATA +2 -2
- tradedangerous-11.0.1.dist-info/RECORD +79 -0
- tradedangerous-10.17.0.dist-info/RECORD +0 -79
- {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.1.dist-info}/LICENSE +0 -0
- {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.1.dist-info}/WHEEL +0 -0
- {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.1.dist-info}/entry_points.txt +0 -0
- {tradedangerous-10.17.0.dist-info → tradedangerous-11.0.1.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
from .commandenv import ResultRow
|
|
2
|
-
from .exceptions import
|
|
3
|
-
from .parsing import
|
|
2
|
+
from .exceptions import CommandLineError, NoDataError
|
|
3
|
+
from .parsing import (
|
|
4
|
+
BlackMarketSwitch, FleetCarrierArgument, MutuallyExclusiveGroup,
|
|
5
|
+
NoPlanetSwitch, OdysseyArgument, PadSizeArgument, ParseArgument,
|
|
6
|
+
PlanetaryArgument,
|
|
7
|
+
)
|
|
4
8
|
from itertools import chain
|
|
5
|
-
from ..formatting import RowFormat, ColumnFormat
|
|
6
9
|
from ..tradedb import TradeDB, System, Station, describeAge
|
|
7
10
|
from ..tradecalc import TradeCalc, Route, NoHopsError
|
|
8
11
|
|
|
9
12
|
import math
|
|
13
|
+
import sys
|
|
14
|
+
|
|
10
15
|
|
|
11
16
|
######################################################################
|
|
12
17
|
# Parser config
|
|
@@ -220,8 +225,7 @@ switches = [
|
|
|
220
225
|
dest = 'x52pro',
|
|
221
226
|
),
|
|
222
227
|
ParseArgument('--prune-score',
|
|
223
|
-
help = 'From the 3rd hop on, only consider routes which have '
|
|
224
|
-
'at least this percentage of the current best route''s score.',
|
|
228
|
+
help = 'From the 3rd hop on, only consider routes which have at least this percentage of the current best route''s score.',
|
|
225
229
|
dest = 'pruneScores',
|
|
226
230
|
type = float,
|
|
227
231
|
default = 0,
|
|
@@ -261,7 +265,7 @@ switches = [
|
|
|
261
265
|
# Helpers
|
|
262
266
|
|
|
263
267
|
|
|
264
|
-
class Checklist
|
|
268
|
+
class Checklist:
|
|
265
269
|
"""
|
|
266
270
|
Class for encapsulating display of a route as a series of
|
|
267
271
|
steps to be 'checked off' as the user passes through them.
|
|
@@ -294,13 +298,13 @@ class Checklist(object):
|
|
|
294
298
|
print("(i) {} (i){}".format(str, "\n" if addBreak else ""))
|
|
295
299
|
|
|
296
300
|
def run(self, route, cr):
|
|
297
|
-
|
|
301
|
+
mfd = self.mfd
|
|
298
302
|
stations, hops, jumps = route.route, route.hops, route.jumps
|
|
299
303
|
lastHopIdx = len(stations) - 1
|
|
300
304
|
gainCr = 0
|
|
301
305
|
self.stepNo = 0
|
|
302
306
|
|
|
303
|
-
heading = "(i) BEGINNING CHECKLIST FOR {} (i)".format(route.
|
|
307
|
+
heading = "(i) BEGINNING CHECKLIST FOR {} (i)".format(route.text(lambda x, y: y))
|
|
304
308
|
print(heading, "\n", '-' * len(heading), "\n\n", sep = '')
|
|
305
309
|
|
|
306
310
|
cmdenv = self.cmdenv
|
|
@@ -313,8 +317,8 @@ class Checklist(object):
|
|
|
313
317
|
cur, nxt, hop = stations[idx], stations[idx + 1], hops[idx]
|
|
314
318
|
sortedTradeOptions = sorted(
|
|
315
319
|
hop[0],
|
|
316
|
-
key
|
|
317
|
-
|
|
320
|
+
key=lambda tradeOption: tradeOption[1] * tradeOption[0].gainCr,
|
|
321
|
+
reverse=True
|
|
318
322
|
)
|
|
319
323
|
|
|
320
324
|
# Tell them what they need to buy.
|
|
@@ -345,7 +349,7 @@ class Checklist(object):
|
|
|
345
349
|
for jump in jumps[idx][1:]:
|
|
346
350
|
self.doStep('Jump to', jump.name())
|
|
347
351
|
if cmdenv.detail:
|
|
348
|
-
self.doStep('Dock at', nxt.
|
|
352
|
+
self.doStep('Dock at', nxt.text())
|
|
349
353
|
print()
|
|
350
354
|
|
|
351
355
|
self.note("Sell at {}".format(nxt.name()))
|
|
@@ -413,9 +417,9 @@ def expandForJumps(tdb, cmdenv, calc, origin, jumps, srcName, purpose):
|
|
|
413
417
|
[sys.dbname for sys in origins]
|
|
414
418
|
)
|
|
415
419
|
thisJump, origins = origins, set()
|
|
416
|
-
for
|
|
417
|
-
avoid.add(
|
|
418
|
-
for stn in
|
|
420
|
+
for system in thisJump:
|
|
421
|
+
avoid.add(system)
|
|
422
|
+
for stn in system.stations or ():
|
|
419
423
|
if stn.ID not in tradingList:
|
|
420
424
|
cmdenv.DEBUG2(
|
|
421
425
|
"X {}/{} not in trading list",
|
|
@@ -433,7 +437,7 @@ def expandForJumps(tdb, cmdenv, calc, origin, jumps, srcName, purpose):
|
|
|
433
437
|
stn.system.dbname, stn.dbname,
|
|
434
438
|
)
|
|
435
439
|
stations.add(stn)
|
|
436
|
-
for dest, dist in tdb.genSystemsInRange(
|
|
440
|
+
for dest, dist in tdb.genSystemsInRange(system, maxLyPer):
|
|
437
441
|
if dest not in avoid:
|
|
438
442
|
origins.add(dest)
|
|
439
443
|
|
|
@@ -463,7 +467,7 @@ def expandForJumps(tdb, cmdenv, calc, origin, jumps, srcName, purpose):
|
|
|
463
467
|
)
|
|
464
468
|
|
|
465
469
|
stations = list(stations)
|
|
466
|
-
stations.sort(key
|
|
470
|
+
stations.sort(key=lambda stn: stn.ID)
|
|
467
471
|
|
|
468
472
|
return stations
|
|
469
473
|
|
|
@@ -666,16 +670,12 @@ def filterStationSet(src, cmdenv, calc, stnList):
|
|
|
666
670
|
src,
|
|
667
671
|
",".join(station.name() for station in stnList),
|
|
668
672
|
)
|
|
669
|
-
|
|
673
|
+
stnList = tuple(
|
|
670
674
|
place for place in stnList
|
|
671
|
-
if isinstance(place, System) or
|
|
672
|
-
checkStationSuitability(cmdenv, calc, place, src)
|
|
675
|
+
if isinstance(place, System) or checkStationSuitability(cmdenv, calc, place, src)
|
|
673
676
|
)
|
|
674
677
|
if not stnList:
|
|
675
|
-
raise CommandLineError(
|
|
676
|
-
"No {} station met your criteria.".format(
|
|
677
|
-
src
|
|
678
|
-
))
|
|
678
|
+
raise CommandLineError("No {src} station met your criteria.")
|
|
679
679
|
return stnList
|
|
680
680
|
|
|
681
681
|
|
|
@@ -969,9 +969,9 @@ def validateRunArguments(tdb, cmdenv, calc):
|
|
|
969
969
|
raise CommandLineError("Can't have same from/to with --unique")
|
|
970
970
|
if viaSet:
|
|
971
971
|
if len(origins) == 1 and origins[0] in viaSet:
|
|
972
|
-
raise("Can't have --from station in --via list with --unique")
|
|
972
|
+
raise CommandLineError("Can't have --from station in --via list with --unique")
|
|
973
973
|
if len(destns) == 1 and destns[0] in viaSet:
|
|
974
|
-
raise("Can't have --to station in --via list with --unique")
|
|
974
|
+
raise CommandLineError("Can't have --to station in --via list with --unique")
|
|
975
975
|
|
|
976
976
|
if cmdenv.mfd:
|
|
977
977
|
cmdenv.mfd.display("Loading Trades")
|
|
@@ -1147,7 +1147,6 @@ def run(results, cmdenv, tdb):
|
|
|
1147
1147
|
validateRunArguments(tdb, cmdenv, calc)
|
|
1148
1148
|
|
|
1149
1149
|
origPlace, viaSet = cmdenv.origPlace, cmdenv.viaSet
|
|
1150
|
-
avoidPlaces = cmdenv.avoidPlaces
|
|
1151
1150
|
stopStations = cmdenv.destinations
|
|
1152
1151
|
goalSystem = cmdenv.goalSystem
|
|
1153
1152
|
maxLs = cmdenv.maxLs
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
from
|
|
2
|
-
from .exceptions import
|
|
3
|
-
from .parsing import
|
|
1
|
+
from .commandenv import ResultRow
|
|
2
|
+
from .exceptions import CommandLineError, NoDataError
|
|
3
|
+
from .parsing import (
|
|
4
|
+
AvoidPlacesArgument, BlackMarketSwitch, FleetCarrierArgument,
|
|
5
|
+
MutuallyExclusiveGroup, NoPlanetSwitch, OdysseyArgument,
|
|
6
|
+
PadSizeArgument, ParseArgument, PlanetaryArgument,
|
|
7
|
+
)
|
|
4
8
|
from ..tradedb import TradeDB, System, Station
|
|
9
|
+
from ..formatting import RowFormat
|
|
5
10
|
|
|
6
|
-
import math
|
|
7
11
|
|
|
8
12
|
######################################################################
|
|
9
13
|
# Parser config
|
|
@@ -70,9 +74,7 @@ switches = [
|
|
|
70
74
|
######################################################################
|
|
71
75
|
# Perform query and populate result set
|
|
72
76
|
|
|
73
|
-
def run(results, cmdenv, tdb:TradeDB):
|
|
74
|
-
from .commandenv import ResultRow
|
|
75
|
-
|
|
77
|
+
def run(results, cmdenv, tdb: TradeDB):
|
|
76
78
|
if cmdenv.lt and cmdenv.gt:
|
|
77
79
|
if cmdenv.lt <= cmdenv.gt:
|
|
78
80
|
raise CommandLineError("--gt must be lower than --lt")
|
|
@@ -199,8 +201,6 @@ def run(results, cmdenv, tdb:TradeDB):
|
|
|
199
201
|
## Transform result set into output
|
|
200
202
|
|
|
201
203
|
def render(results, cmdenv, tdb):
|
|
202
|
-
from ..formatting import RowFormat, ColumnFormat
|
|
203
|
-
|
|
204
204
|
longestNamed = max(results.rows, key=lambda result: len(result.station.name()))
|
|
205
205
|
longestNameLen = len(longestNamed.station.name())
|
|
206
206
|
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
|
|
2
1
|
from .commandenv import ResultRow
|
|
3
2
|
from .exceptions import CommandLineError
|
|
4
|
-
from .parsing import
|
|
3
|
+
from .parsing import MutuallyExclusiveGroup, ParseArgument
|
|
5
4
|
from ..formatting import RowFormat, ColumnFormat, max_len
|
|
6
5
|
from itertools import chain
|
|
7
|
-
from ..tradedb import
|
|
8
|
-
from ..tradedb import System, Station
|
|
9
|
-
from ..tradedb import TradeDB
|
|
6
|
+
from ..tradedb import Station
|
|
10
7
|
|
|
11
8
|
# Original by Dirk Wilhelm
|
|
12
9
|
|
|
13
10
|
from .. import csvexport
|
|
14
|
-
import re
|
|
15
|
-
import sys
|
|
16
11
|
|
|
17
12
|
######################################################################
|
|
18
13
|
# Parser config
|
|
@@ -211,6 +206,8 @@ def run(results, cmdenv, tdb):
|
|
|
211
206
|
for ship in ships.values():
|
|
212
207
|
if action(tdb, cmdenv, station, ship):
|
|
213
208
|
dataToExport = True
|
|
209
|
+
|
|
210
|
+
cmdenv.DEBUG0("dataToExport = {}", dataToExport)
|
|
214
211
|
|
|
215
212
|
maybeExportToCSV(tdb, cmdenv)
|
|
216
213
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
|
|
2
1
|
from .commandenv import ResultRow
|
|
3
2
|
from .exceptions import CommandLineError
|
|
4
|
-
from .parsing import
|
|
3
|
+
from .parsing import MutuallyExclusiveGroup, ParseArgument
|
|
5
4
|
from ..tradedb import AmbiguityError
|
|
6
|
-
from ..tradedb import
|
|
5
|
+
from ..tradedb import Station
|
|
7
6
|
from ..tradedb import TradeDB
|
|
8
7
|
from .. import utils
|
|
9
8
|
from ..formatting import max_len
|
|
@@ -12,7 +11,7 @@ from .. import cache
|
|
|
12
11
|
from .. import csvexport
|
|
13
12
|
import difflib
|
|
14
13
|
import re
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
|
|
17
16
|
######################################################################
|
|
18
17
|
# Parser config
|
|
@@ -244,9 +243,7 @@ def checkSystemAndStation(tdb, cmdenv):
|
|
|
244
243
|
sysName = None
|
|
245
244
|
|
|
246
245
|
if not stnName:
|
|
247
|
-
raise CommandLineError("Invalid station name: {}"
|
|
248
|
-
envStnName
|
|
249
|
-
))
|
|
246
|
+
raise CommandLineError("Invalid station name: {stnName}")
|
|
250
247
|
|
|
251
248
|
if not sysName:
|
|
252
249
|
raise CommandLineError("No system name specified")
|
|
@@ -346,7 +343,6 @@ def run(results, cmdenv, tdb):
|
|
|
346
343
|
|
|
347
344
|
system, station = checkSystemAndStation(tdb, cmdenv)
|
|
348
345
|
|
|
349
|
-
systemName = cmdenv.system
|
|
350
346
|
stationName = cmdenv.station
|
|
351
347
|
|
|
352
348
|
if cmdenv.add:
|
|
@@ -367,7 +363,7 @@ def run(results, cmdenv, tdb):
|
|
|
367
363
|
avgSell = results.summary.avgSelling = tdb.getAverageSelling()
|
|
368
364
|
avgBuy = results.summary.avgBuying = tdb.getAverageBuying()
|
|
369
365
|
|
|
370
|
-
class ItemTrade
|
|
366
|
+
class ItemTrade:
|
|
371
367
|
def __init__(self, ID, price, avgAgainst):
|
|
372
368
|
self.ID, self.item = ID, tdb.itemByID[ID]
|
|
373
369
|
self.price = int(price)
|
|
@@ -492,11 +488,9 @@ def render(results, cmdenv, tdb):
|
|
|
492
488
|
)
|
|
493
489
|
print("Best Buy..:", makeBest(
|
|
494
490
|
results.summary.selling, "Buy from this station", "Sell", longestNameLen,
|
|
495
|
-
starFn=lambda price, avgCr:
|
|
496
|
-
price <= (avgCr * 0.9),
|
|
491
|
+
starFn=lambda price, avgCr: price <= (avgCr * 0.9),
|
|
497
492
|
))
|
|
498
493
|
print("Best Sale.:", makeBest(
|
|
499
494
|
results.summary.buying, "Sell to this station", "Cost", longestNameLen,
|
|
500
|
-
starFn=lambda price, avgCr:
|
|
501
|
-
|
|
502
|
-
))
|
|
495
|
+
starFn=lambda price, avgCr: price >= (avgCr * 1.1),
|
|
496
|
+
))
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
from
|
|
2
|
-
from .
|
|
3
|
-
from
|
|
4
|
-
from ..
|
|
5
|
-
from ..tradecalc import TradeCalc, Route
|
|
6
|
-
|
|
7
|
-
import math
|
|
1
|
+
from .exceptions import CommandLineError
|
|
2
|
+
from .parsing import ParseArgument
|
|
3
|
+
from ..tradecalc import TradeCalc
|
|
4
|
+
from ..formatting import RowFormat, max_len
|
|
8
5
|
|
|
9
6
|
######################################################################
|
|
10
7
|
# Parser config
|
|
@@ -65,8 +62,6 @@ def run(results, cmdenv, tdb):
|
|
|
65
62
|
## Transform result set into output
|
|
66
63
|
|
|
67
64
|
def render(results, cmdenv, tdb):
|
|
68
|
-
from ..formatting import RowFormat, ColumnFormat, max_len
|
|
69
|
-
|
|
70
65
|
longestNameLen = max_len(results.rows, key=lambda row: row.item.name(cmdenv.detail))
|
|
71
66
|
|
|
72
67
|
rowFmt = RowFormat()
|
|
@@ -102,4 +97,4 @@ def render(results, cmdenv, tdb):
|
|
|
102
97
|
print(heading, underline, sep='\n')
|
|
103
98
|
|
|
104
99
|
for row in results.rows:
|
|
105
|
-
print(rowFmt.format(row))
|
|
100
|
+
print(rowFmt.format(row))
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
from
|
|
2
|
-
from .parsing import *
|
|
1
|
+
from .parsing import MutuallyExclusiveGroup, ParseArgument
|
|
3
2
|
from ..tradeexcept import TradeException
|
|
4
3
|
from .exceptions import CommandLineError
|
|
5
|
-
from ..tradedb import System
|
|
4
|
+
from ..tradedb import System
|
|
6
5
|
from .. import prices, cache
|
|
7
6
|
import subprocess
|
|
8
7
|
import os
|
|
@@ -167,7 +166,8 @@ def getEditorPaths(cmdenv, editorName, envVar, windowsFolders, winExe, nixExe):
|
|
|
167
166
|
cmdenv.DEBUG0("Locating {} editor", editorName)
|
|
168
167
|
try:
|
|
169
168
|
return os.environ[envVar]
|
|
170
|
-
except KeyError:
|
|
169
|
+
except KeyError:
|
|
170
|
+
pass
|
|
171
171
|
|
|
172
172
|
paths = []
|
|
173
173
|
|
|
@@ -183,7 +183,8 @@ def getEditorPaths(cmdenv, editorName, envVar, windowsFolders, winExe, nixExe):
|
|
|
183
183
|
|
|
184
184
|
try:
|
|
185
185
|
paths += os.environ['PATH'].split(os.pathsep)
|
|
186
|
-
except KeyError:
|
|
186
|
+
except KeyError:
|
|
187
|
+
pass
|
|
187
188
|
|
|
188
189
|
for path in paths:
|
|
189
190
|
candidate = os.path.join(path, binary)
|
|
@@ -271,8 +272,10 @@ def editUpdate(tdb, cmdenv, stationID):
|
|
|
271
272
|
dbFilename = tdb.dbFilename
|
|
272
273
|
try:
|
|
273
274
|
elementMask = prices.Element.basic | prices.Element.supply
|
|
274
|
-
if cmdenv.timestamps:
|
|
275
|
-
|
|
275
|
+
if cmdenv.timestamps:
|
|
276
|
+
elementMask |= prices.Element.timestamp
|
|
277
|
+
if cmdenv.all:
|
|
278
|
+
elementMask |= prices.Element.blanks
|
|
276
279
|
# Open the file and dump data to it.
|
|
277
280
|
with tmpPath.open("w", encoding = 'utf-8') as tmpFile:
|
|
278
281
|
# Remember the filename so we know we need to delete it.
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import tkinter as tk
|
|
2
2
|
import tkinter.messagebox as mbox
|
|
3
|
-
import tkinter.ttk as ttk
|
|
4
3
|
import sqlite3
|
|
5
4
|
import re
|
|
6
|
-
from pathlib import Path
|
|
7
5
|
|
|
8
6
|
"""
|
|
9
7
|
This is a crude attempt at a GUI for updating trade prices.
|
|
@@ -44,7 +42,7 @@ updateUiHelp = (
|
|
|
44
42
|
"- Use Tab, Shift-Tab, Up/Down Arrow and Enter to navigate.\n"
|
|
45
43
|
)
|
|
46
44
|
|
|
47
|
-
class Item
|
|
45
|
+
class Item:
|
|
48
46
|
""" Describe a listed, tradeable item """
|
|
49
47
|
|
|
50
48
|
def __init__(self, ID, catID, name, displayNo):
|
tradedangerous/corrections.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Provides an interface for correcting names that
|
|
2
2
|
# have changed in recent versions.
|
|
3
3
|
|
|
4
|
-
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
|
|
5
|
-
|
|
6
4
|
# Arbitrary, negative value to denote something that's been removed.
|
|
7
5
|
DELETED = -111
|
|
8
6
|
|
|
@@ -26,7 +24,7 @@ items = {
|
|
|
26
24
|
'COOLING HOSES': 'Micro-weave Cooling Hoses',
|
|
27
25
|
'METHANOL MONOHYDRATE': 'Methanol Monohydrate Crystals',
|
|
28
26
|
'OCCUPIED CRYOPOD': 'Occupied Escape Pod',
|
|
29
|
-
'SALVAGEABLE WRECKAGE': 'Wreckage Components',
|
|
27
|
+
'SALVAGEABLE WRECKAGE': 'Wreckage Components',
|
|
30
28
|
'POLITICAL PRISONER': 'Political Prisoners',
|
|
31
29
|
'HOSTAGE': 'Hostages',
|
|
32
30
|
"VOID OPAL": "Void Opals",
|
tradedangerous/csvexport.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
|
|
2
|
-
|
|
3
1
|
from pathlib import Path
|
|
4
2
|
from .tradeexcept import TradeException
|
|
5
3
|
|
|
@@ -34,9 +32,10 @@ reverseList = []
|
|
|
34
32
|
# Helpers
|
|
35
33
|
######################################################################
|
|
36
34
|
|
|
37
|
-
def search_keyList(
|
|
38
|
-
for row in
|
|
39
|
-
if row['from'] == row['to'] == val:
|
|
35
|
+
def search_keyList(items, val):
|
|
36
|
+
for row in items:
|
|
37
|
+
if row['from'] == row['to'] == val:
|
|
38
|
+
return row
|
|
40
39
|
|
|
41
40
|
def getUniqueIndex(conn, tableName):
|
|
42
41
|
""" return all unique columns """
|
|
@@ -134,13 +133,14 @@ def exportTableToFile(tdb, tdenv, tableName, csvPath=None):
|
|
|
134
133
|
pkCount = 0
|
|
135
134
|
for columnRow in cur.execute("PRAGMA table_info('%s')" % tableName):
|
|
136
135
|
# count the columns of the primary key
|
|
137
|
-
if columnRow['pk'] > 0:
|
|
136
|
+
if columnRow['pk'] > 0:
|
|
137
|
+
pkCount += 1
|
|
138
138
|
|
|
139
139
|
# build column list
|
|
140
140
|
columnList = []
|
|
141
141
|
for columnRow in cur.execute("PRAGMA table_info('%s')" % tableName):
|
|
142
142
|
# if there is only one PK column, ignore it
|
|
143
|
-
#if columnRow['pk'] > 0 and pkCount == 1: continue
|
|
143
|
+
# if columnRow['pk'] > 0 and pkCount == 1: continue
|
|
144
144
|
columnList.append(columnRow)
|
|
145
145
|
|
|
146
146
|
if len(columnList) == 0:
|
|
@@ -199,7 +199,7 @@ def exportTableToFile(tdb, tdenv, tableName, csvPath=None):
|
|
|
199
199
|
stmtColumn += [ "{}.{}".format(tableName, col['name']) ]
|
|
200
200
|
|
|
201
201
|
# build the SQL statement
|
|
202
|
-
sqlStmt = "SELECT {} FROM {}".format(",".join(stmtColumn)," ".join(stmtTable))
|
|
202
|
+
sqlStmt = "SELECT {} FROM {}".format(",".join(stmtColumn), " ".join(stmtTable))
|
|
203
203
|
if len(stmtOrder) > 0:
|
|
204
204
|
sqlStmt += " ORDER BY {}".format(",".join(stmtOrder))
|
|
205
205
|
tdenv.DEBUG1("SQL: %s" % sqlStmt)
|
tradedangerous/edscupdate.py
CHANGED
|
@@ -25,7 +25,6 @@ or "q" to stop recording.
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
import argparse
|
|
28
|
-
import math
|
|
29
28
|
import misc.clipboard
|
|
30
29
|
import misc.edsc
|
|
31
30
|
import os
|
|
@@ -158,7 +157,7 @@ def parse_arguments():
|
|
|
158
157
|
default=2,
|
|
159
158
|
)
|
|
160
159
|
grp = parser.add_mutually_exclusive_group()
|
|
161
|
-
if grp:
|
|
160
|
+
if grp: # for indentation
|
|
162
161
|
grp.add_argument(
|
|
163
162
|
'--random',
|
|
164
163
|
action='store_true',
|
|
@@ -297,7 +296,7 @@ def check_database(tdb, name, x, y, z):
|
|
|
297
296
|
WHERE pos_x BETWEEN ? and ?
|
|
298
297
|
AND pos_y BETWEEN ? and ?
|
|
299
298
|
AND pos_z BETWEEN ? and ?
|
|
300
|
-
""", [
|
|
299
|
+
""", [
|
|
301
300
|
x - 0.5, x + 0.5,
|
|
302
301
|
y - 0.5, y + 0.5,
|
|
303
302
|
z - 0.5, z + 0.5,
|
|
@@ -391,9 +390,7 @@ def main():
|
|
|
391
390
|
edsq.status['statusnum'],
|
|
392
391
|
))
|
|
393
392
|
|
|
394
|
-
date = data['date']
|
|
395
393
|
systems = data['systems']
|
|
396
|
-
|
|
397
394
|
print("{} results".format(len(systems)))
|
|
398
395
|
# Filter out systems we already know that match the EDSC data.
|
|
399
396
|
systems = [
|
|
@@ -534,7 +531,7 @@ def main():
|
|
|
534
531
|
continue
|
|
535
532
|
if ok.startswith('='):
|
|
536
533
|
name = ok[1:].strip().upper()
|
|
537
|
-
if not
|
|
534
|
+
if name not in extras:
|
|
538
535
|
add_to_extras(argv, name)
|
|
539
536
|
ok = 'y'
|
|
540
537
|
if ok.lower() != 'y':
|
|
@@ -555,6 +552,7 @@ def main():
|
|
|
555
552
|
|
|
556
553
|
submit_distance(argv, name, distance)
|
|
557
554
|
|
|
555
|
+
|
|
558
556
|
if __name__ == "__main__":
|
|
559
557
|
try:
|
|
560
558
|
main()
|
tradedangerous/edsmupdate.py
CHANGED
|
@@ -27,7 +27,6 @@ or "q" to stop recording.
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
import argparse
|
|
30
|
-
import math
|
|
31
30
|
import misc.clipboard
|
|
32
31
|
import misc.edsm
|
|
33
32
|
import os
|
|
@@ -67,7 +66,7 @@ def parse_arguments():
|
|
|
67
66
|
default=os.environ.get('CMDR', None),
|
|
68
67
|
)
|
|
69
68
|
grp = parser.add_mutually_exclusive_group()
|
|
70
|
-
if grp:
|
|
69
|
+
if grp: # for indentation
|
|
71
70
|
grp.add_argument(
|
|
72
71
|
'--random',
|
|
73
72
|
action='store_true',
|
|
@@ -271,7 +270,7 @@ def main():
|
|
|
271
270
|
)
|
|
272
271
|
|
|
273
272
|
if not argv.date:
|
|
274
|
-
|
|
273
|
+
argv.date = tdb.query("SELECT MAX(modified) FROM System").fetchone()[0]
|
|
275
274
|
dateRe = re.compile(r'^20\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0123]):[0-5]\d:[0-5]\d$')
|
|
276
275
|
if not dateRe.match(argv.date):
|
|
277
276
|
raise UsageError(
|
|
@@ -440,7 +439,7 @@ def main():
|
|
|
440
439
|
break
|
|
441
440
|
if ok.startswith('='):
|
|
442
441
|
name = ok[1:].strip().upper()
|
|
443
|
-
if not
|
|
442
|
+
if name not in extras:
|
|
444
443
|
add_to_extras(argv, name)
|
|
445
444
|
ok = 'y'
|
|
446
445
|
if ok.lower() != 'y':
|
|
@@ -462,6 +461,7 @@ def main():
|
|
|
462
461
|
if argv.add and not commit:
|
|
463
462
|
tdb.getDB().commit()
|
|
464
463
|
|
|
464
|
+
|
|
465
465
|
if __name__ == "__main__":
|
|
466
466
|
try:
|
|
467
467
|
main()
|