Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit 7383dcd

Browse files
committed
Rename src folder to resources
1 parent c436260 commit 7383dcd

38 files changed

+34
-34
lines changed

EU4Bot.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -904,15 +904,15 @@ def invertColor(color: Tuple[int, int, int]) -> Tuple[int, int, int]:
904904
# Start Final Img Creation
905905
# Copy map into bottom of final image
906906
await updateProgress("Finalizing map section...", 4, 8)
907-
imgFinal: Image.Image = Image.open("src/finalTemplate.png")
907+
imgFinal: Image.Image = Image.open("resources/finalTemplate.png")
908908
imgFinal.paste(self.politicalImage,
909909
(0, imgFinal.size[1]-self.politicalImage.size[1]))
910910
del(self.politicalImage)
911911
# The top has 5632x1119
912912
# Getting fonts
913-
fontmini = ImageFont.truetype("src/GARA.TTF", 36)
914-
fontsmall = ImageFont.truetype("src/GARA.TTF", 50)
915-
font = ImageFont.truetype("src/GARA.TTF", 100)
913+
fontmini = ImageFont.truetype("resources/GARA.TTF", 36)
914+
fontsmall = ImageFont.truetype("resources/GARA.TTF", 50)
915+
font = ImageFont.truetype("resources/GARA.TTF", 100)
916916
imgDraw = ImageDraw.Draw(imgFinal)
917917
#================MULTIPLAYER================#
918918
if True: # mp == True:
@@ -950,21 +950,21 @@ def invertColor(color: Tuple[int, int, int]) -> Tuple[int, int, int]:
950950
playerName = playerName[:-1]
951951
imgDraw.text((x+128, y), playerName, (255, 255, 255), font)
952952
# x+760: Army size
953-
imgFinal.paste(Image.open("src/army.png"), (x+760, y))
953+
imgFinal.paste(Image.open("resources/army.png"), (x+760, y))
954954
imgDraw.text((x+760+128, y),
955955
armyDisplay(nat.army), (255, 255, 255), font)
956956
# x+1100: Navy size
957-
imgFinal.paste(Image.open("src/navy.png"), (x+1100, y))
957+
imgFinal.paste(Image.open("resources/navy.png"), (x+1100, y))
958958
imgDraw.text((x+1100+128, y), str(nat.navy),
959959
(255, 255, 255), font)
960960
# x+1440: Development
961961
imgFinal.paste(Image.open(
962-
"src/development.png"), (x+1440, y))
962+
"resources/development.png"), (x+1440, y))
963963
imgDraw.text((x+1440+128, y),
964964
str(nat.development), (255, 255, 255), font)
965965
# x+1780: Income/Expense
966966
monthlyProfit = nat.totalIncome-nat.totalExpense
967-
imgIncome = Image.open("src/income.png")
967+
imgIncome = Image.open("resources/income.png")
968968
if monthlyProfit < 0:
969969
imgIncome = imgIncome.crop((128, 0, 255, 127))
970970
imgFinal.paste(imgIncome, (x+1780, y))
@@ -1013,7 +1013,7 @@ def invertColor(color: Tuple[int, int, int]) -> Tuple[int, int, int]:
10131013
natnum % 4) * (64 + 12)), round(y + (natnum - natnum % 4) / 4 * (64 + 12) + 12)))
10141014
# Draw Attacker Casualties
10151015
attackerIcon = Image.open(
1016-
"src/bodycount_attacker_button.png")
1016+
"resources/bodycount_attacker_button.png")
10171017
imgFinal.paste(
10181018
attackerIcon, (x + 290 - 12 - 32, y + 156), attackerIcon)
10191019
imgDraw.text((x + 290 - 12 - 32 - imgDraw.textsize(f"Losses: {armyDisplay(playerWar.attackerLosses)}", fontmini)[
@@ -1039,7 +1039,7 @@ def invertColor(color: Tuple[int, int, int]) -> Tuple[int, int, int]:
10391039
x + (natnum % 4) * (64 + 12) + 585), round(y + (natnum - natnum % 4) / 4 * (64 + 12) + 12)))
10401040
# Draw Defender Casualties
10411041
defenderIcon = Image.open(
1042-
"src/bodycount_defender_button.png")
1042+
"resources/bodycount_defender_button.png")
10431043
imgFinal.paste(
10441044
defenderIcon, (x + 12 + 585, y + 156), defenderIcon)
10451045
imgDraw.text((x + 12 + 32 + 585, y + 152),
@@ -1069,14 +1069,14 @@ def invertColor(color: Tuple[int, int, int]) -> Tuple[int, int, int]:
10691069
[0]/2), y + 115), dateStr, (255, 255, 255), fontmini, align="center")
10701070
# Draw result
10711071
if playerWar.result == war.WHITEPEACE:
1072-
WPIcon = Image.open("src/icon_peace.png")
1072+
WPIcon = Image.open("resources/icon_peace.png")
10731073
imgFinal.paste(WPIcon, (x + 437 - 32, y + 140), WPIcon)
10741074
elif playerWar.result == war.ATTACKERWIN:
1075-
WinnerIcon = Image.open("src/star.png")
1075+
WinnerIcon = Image.open("resources/star.png")
10761076
imgFinal.paste(
10771077
WinnerIcon, (x + 290, y + 148), WinnerIcon)
10781078
elif playerWar.result == war.DEFENDERWIN:
1079-
WinnerIcon = Image.open("src/star.png")
1079+
WinnerIcon = Image.open("resources/star.png")
10801080
imgFinal.paste(
10811081
WinnerIcon, (x + 12 + 585 - 48, y + 148), WinnerIcon)
10821082
#================SINGLEPLAYER================#
@@ -1320,7 +1320,7 @@ async def process(self, message: discord.Message):
13201320
if tagCapitals.get(tag.upper()) is None:
13211321
tagCapitals[tag.upper()] = -1
13221322
# Get the actual capitals and add to tagCapitals.
1323-
srcFile = open("src/save_1444.eu4", "r", encoding="cp1252")
1323+
srcFile = open("resources/save_1444.eu4", "r", encoding="cp1252")
13241324
brackets: List[str] = []
13251325
linenum = 0
13261326
for line in srcFile:

EU4Lib.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def country(text: str) -> Optional[str]:
1212
If the nation is not recognized, returns None.
1313
"""
1414
# Read out the countries file
15-
srcFile = open("src/countries_l_english.yml", encoding="cp1252")
15+
srcFile = open("resources/countries_l_english.yml", encoding="cp1252")
1616
# If it could be a tag, check for that.
1717
if len(text) == 3:
1818
if text[1:].isdigit():
@@ -58,7 +58,7 @@ def tagToName(tag: str) -> Optional[str]:
5858
return f"Trading City T{tag[1:]}"
5959
# Then search for it and return the first thing in quotes on that line
6060
# Read out the countries file
61-
srcFile = open("src/countries_l_english.yml", encoding="cp1252")
61+
srcFile = open("resources/countries_l_english.yml", encoding="cp1252")
6262
for line in srcFile:
6363
if line[1:4] == tag.upper():
6464
return line[8:].split("\"", 1)[0].strip("\" \t\n")
@@ -73,7 +73,7 @@ def province(id: Union[str, int]) -> Optional[Tuple[float, float]]:
7373
Returns a tuple of floats, (x, y).
7474
"""
7575
# Read file
76-
srcFile = open("src/positions.txt", "r", encoding="cp1252")
76+
srcFile = open("resources/positions.txt", "r", encoding="cp1252")
7777
"""
7878
Format of the file:
7979
1={
@@ -112,7 +112,7 @@ def provinces(ids: List[Union[str, int]]) -> Dict[int, Tuple[float, float]]:
112112
"""
113113
out: Dict[int, Optional[Tuple[float, float]]] = {}
114114
idsprocessed = [int(x) for x in ids]
115-
srcFile = open("src/positions.txt", "r", encoding="cp1252")
115+
srcFile = open("resources/positions.txt", "r", encoding="cp1252")
116116
currentID = None
117117
beyond = 0
118118
for line in srcFile:
@@ -142,14 +142,14 @@ def flag(tag: str) -> Image.Image:
142142
Returns Image of size (128, 128).
143143
"""
144144
# Read file
145-
srcFile = open("src/flagfiles.txt", "r", encoding="cp1252")
145+
srcFile = open("resources/flagfiles.txt", "r", encoding="cp1252")
146146
line = srcFile.read()
147147
srcFile.close()
148148
# Get the number for the order of the flag; starts at 0
149149
a = line.partition(tag) # Separate into a 3-tuple around tag
150150
flagnum = a[0].count(".tga") # Get image number starting at 0
151151
# Get the file based on 256 flags per
152-
flagfile = Image.open(f"src/flagfiles_{int(flagnum/256)}.tga")
152+
flagfile = Image.open(f"resources/flagfiles_{int(flagnum/256)}.tga")
153153
# Get the location of the flag within the file
154154
x = 128*((flagnum % 256) % 16)
155155
y = 128*int((flagnum % 256)/16)
@@ -166,7 +166,7 @@ def provinceArea(provinceID: Union[str, int]) -> str:
166166
Raises an error if the province is not found.
167167
"""
168168
# Read file
169-
srcFile = open("src/area.txt", "r", encoding="cp1252")
169+
srcFile = open("resources/area.txt", "r", encoding="cp1252")
170170
# Search file
171171
currentArea = None
172172
for line in srcFile:
@@ -189,7 +189,7 @@ def region(areaName: str) -> str:
189189
Raises an error if the area is not found.
190190
"""
191191
# Read file
192-
srcFile = open("src/region.txt", "r", encoding="cp1252")
192+
srcFile = open("resources/region.txt", "r", encoding="cp1252")
193193
# Search File
194194
currentRegion = None
195195
for line in srcFile:
@@ -212,7 +212,7 @@ def superregion(regionName: str) -> str:
212212
Raises an error if the region is not found.
213213
"""
214214
# Read file
215-
srcFile = open("src/superregion.txt", "r", encoding="cp1252")
215+
srcFile = open("resources/superregion.txt", "r", encoding="cp1252")
216216
# Search file
217217
currentSuperregion = None
218218
for line in srcFile:
@@ -234,7 +234,7 @@ def continent(provinceID: Union[str, int]) -> str:
234234
Raises an error if the province is not found.
235235
"""
236236
# Read file
237-
srcFile = open("src/continent.txt", "r", encoding="cp1252")
237+
srcFile = open("resources/continent.txt", "r", encoding="cp1252")
238238
# Search file
239239
currentContinent = None
240240
for line in srcFile:
@@ -276,7 +276,7 @@ def colonialRegion(provinceID: Union[str, int]) -> str:
276276
Raises an error if the province is not found in a colonial region.
277277
"""
278278
# Read file
279-
srcFile = open("src/00_colonial_regions.txt", "r", encoding="cp1252")
279+
srcFile = open("resources/00_colonial_regions.txt", "r", encoding="cp1252")
280280
# Search file
281281
currentColReg: Optional[str] = None
282282
provsOpen = False
@@ -303,7 +303,7 @@ def colonialFlag(overlordTag: str, colReg: str) -> Image.Image:
303303
# First find the correct colonial region color
304304
color: Tuple[int, int, int] = None
305305
# Read file
306-
srcFile = open("src/00_colonial_regions.txt", "r", encoding="cp1252")
306+
srcFile = open("resources/00_colonial_regions.txt", "r", encoding="cp1252")
307307
# Search file
308308
currentColReg: Optional[str] = None
309309
for line in srcFile:
@@ -371,7 +371,7 @@ def respond(self, r):
371371

372372
def provinceData(*requests: dataReq) -> List[dataReq]:
373373
data = requests
374-
srcFile = open("src/save_1444.eu4", encoding="cp1252")
374+
srcFile = open("resources/save_1444.eu4", encoding="cp1252")
375375
brackets: List[str] = []
376376

377377
# Reading save file...

EU4Parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def formatFix(text: str) -> str:
161161

162162

163163
starttime = time.time()
164-
file = open("src/save_1444.eu4", "r", encoding="cp1252")
164+
file = open("resources/save_1444.eu4", "r", encoding="cp1252")
165165
text = formatFix(file.read())
166166
file.close()
167167
totaltime = time.time() - starttime

EU4Reserve.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ def createMap(reserve: Reserve) -> Image.Image:
882882
countries: List[reservePick] = reserve.players
883883
capitalLocs: Dict[str, Tuple[float, float]] = {}
884884

885-
srcFile = open("src/tagCapitals.txt", "r", encoding="cp1252")
885+
srcFile = open("resources/tagCapitals.txt", "r", encoding="cp1252")
886886
lines = srcFile.readlines()
887887
srcFile.close()
888888
for line in lines:
@@ -896,8 +896,8 @@ def createMap(reserve: Reserve) -> Image.Image:
896896
break
897897
del(lines)
898898

899-
mapFinal: Image.Image = Image.open("src/map_1444.png")
900-
imgX: Image.Image = Image.open("src/xIcon.png")
899+
mapFinal: Image.Image = Image.open("resources/map_1444.png")
900+
imgX: Image.Image = Image.open("resources/xIcon.png")
901901
for x in capitalLocs:
902902
mapFinal.paste(
903903
imgX, (int(capitalLocs[x][0]-imgX.size[0]/2), int(capitalLocs[x][1]-imgX.size[1]/2)), imgX)
File renamed without changes.
File renamed without changes.

src/Date.png resources/Date.png

File renamed without changes.

src/GARA.TTF resources/GARA.TTF

File renamed without changes.

src/area.txt resources/area.txt

File renamed without changes.

src/army.png resources/army.png

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/hre.png resources/hre.png

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/navy.png resources/navy.png

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/star.png resources/star.png

File renamed without changes.
File renamed without changes.
File renamed without changes.

src/xIcon.png resources/xIcon.png

File renamed without changes.

tools/CapitalLocations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
start = time.time()
99
tagCapitals: Dict[str, int] = {}
1010

11-
saveFile = open("src/save_1444.eu4", "r", encoding="cp1252")
11+
saveFile = open("resources/save_1444.eu4", "r", encoding="cp1252")
1212

1313
brackets: List[str] = []
1414
linenum = 0
@@ -53,7 +53,7 @@
5353
capitalLocs[x] = locations[tagCapitals[x]]
5454
print("Found all capital locations.")
5555

56-
writeFile = open("src/tagCapitals.txt", "w", encoding="cp1252")
56+
writeFile = open("resources/tagCapitals.txt", "w", encoding="cp1252")
5757
writeString = ""
5858
for x in capitalLocs:
5959
try:

tools/TagLocalizations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ def deaccent(string: str) -> str:
5252
line += f' "{deaccent(name)[4:]}"'
5353
writeString += f"{line}\n"
5454

55-
open("src/countries_l_english.yml", "w", encoding="cp1252").write(writeString)
55+
open("resources/countries_l_english.yml", "w", encoding="cp1252").write(writeString)
5656
print("Written to file.")

0 commit comments

Comments
 (0)