Skip to content

Commit

Permalink
Add ability to rename systems apart from SDE
Browse files Browse the repository at this point in the history
  • Loading branch information
secondfry committed Dec 18, 2023
1 parent 368a221 commit b4865cd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/database/renames.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
solarSystemID,name
31000001,J055520 [Sentinel]
31000002,J110145 [Barbican]
31000003,J164710 [Vidette]
31000004,J200727 [Conflux]
31000006,J174618 [Redoubt]
4 changes: 4 additions & 0 deletions src/shortcircuit/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def additional_gui_setup(self):

# Auto-completion
system_list = self.nav.eve_db.system_name_list()
system_list.sort(key=str.lower)
for line_edit_field in [
self.lineEdit_source,
self.lineEdit_destination,
Expand All @@ -204,6 +205,9 @@ def additional_gui_setup(self):
]:
completer = QtWidgets.QCompleter(system_list, self)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
completer.setModelSorting(
QtWidgets.QCompleter.CaseInsensitivelySortedModel
)
line_edit_field.setCompleter(completer)

# Signals
Expand Down
8 changes: 8 additions & 0 deletions src/shortcircuit/model/evedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ class EveDb(metaclass=Singleton):

def __init__(self):
filename_statics = 'statics.csv'
filaname_renames = 'renames.csv'

# NOTE(secondfry): thank you, Steve Ronuken.
# @see https://www.fuzzwork.co.uk/dump/
Expand All @@ -363,6 +364,7 @@ def __init__(self):

self._init_gates(get_csv_reader(filename_gates))
self._init_system_descriptions(get_csv_reader(filename_descriptions))
self._init_renames(get_csv_reader(filaname_renames))

self.wh_codes: Dict[str, WormholeSize] = {
rows[0]: WormholeSize(int(rows[1]))
Expand Down Expand Up @@ -396,6 +398,12 @@ def _init_system_descriptions(self, reader):
'security': system.security
}

def _init_renames(self, reader):
for row in reader:
id = int(row[0])
name = row[1]
self.system_desc[id]['name'] = name

def get_whsize_by_code(self, code: str) -> WormholeSize:
return self.wh_codes.get(code.upper(), WormholeSize.UNKNOWN)

Expand Down
5 changes: 5 additions & 0 deletions src/shortcircuit/model/test_evedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ def test_jita():
def test_tama():
eve_db = EveDb()
assert eve_db.name2id("Tama") == 30002813


def test_sentinel():
eve_db = EveDb()
assert eve_db.name2id("J055520 [Sentinel]") == 31000001
14 changes: 5 additions & 9 deletions src/shortcircuit/model/test_solarmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_dodixie_jita_but_avoid_hs():
map = SolarMap(eve_db)
path = map.shortest_path(
eve_db.name2id("Dodixie"),
eve_db.name2id("Ikuchi"),
eve_db.name2id("Sujarento"),
{
"avoidance_list": [],
"security_prio": {
Expand All @@ -102,14 +102,10 @@ def test_dodixie_jita_but_avoid_hs():
'Villore',
'Old Man Star',
'Heydieles',
'Abune',
'Oinasiken',
'Nisuwa',
'Kedama',
'Tama',
'Nourvukaiken',
'Tunttaras',
'Ikuchi',
'Fliet',
'Deven',
'Nagamanen',
'Sujarento',
]


Expand Down

0 comments on commit b4865cd

Please sign in to comment.