[UPDATE] check default img

This commit is contained in:
Guillaume Astier Ruiz 2022-12-04 14:53:19 +01:00
parent 5792f214a7
commit 7325dfa122
4 changed files with 53 additions and 16 deletions

BIN
data/emu/media/mame_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
media/nobg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
media/noemu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -15,21 +15,68 @@ from modules.arrow import *
from modules.emulateur_display import *
import time
import os
sys.path.append( './modules/')
from arrow import *
#sys.path.append( './modules/')
#from arrow import *
EmuMod = 1
RomMod = 0
#def EmuMod():
def BackgroundRom(Emu):
BgFile = "./data/emu/media/" + str(Emu) +"_bg.png"
BgFile = IsImgExist(BgFile,"bg")
BgEmu = PhotoImage(file = BgFile)
LabelBgEmu = Label(arkadeus,image=BgEmu)
LabelBgEmu.BgEmu = BgEmu
Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw")
def IsImgExist(AbsPathFile,TypeMedia):
if not os.path.exists(AbsPathFile):
match TypeMedia:
case "emu":
return "./media/noemu.png"
case "bg":
return "./media/nobg.png"
else:
return AbsPathFile
def BackgroundEmu():
BackgroundEmu = Media["background"]
BgEmu = PhotoImage(file = Background)
LabelBgEmu = Label(arkadeus,image=BgEmu)
LabelBgEmu.BgEmu = BgEmu
Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw")
def EnterEmu():
EmuMod=0
RomMod=1
global cpt
runMcpt = cpt + 1
if runMcpt > EmuCpt:
runMcpt = 0
print("Emu : " + str(res[runMcpt]))
#Cnv.delete("all")
BackgroundRom(str(res[runMcpt]))
#def ParseEmu():
def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
NfL="./data/emu/media/" + res[cL] + ".png"
NfL = IsImgExist(NfL,"emu")
NfM="./data/emu/media/" + res[cM] + ".png"
NfM = IsImgExist(NfM,"emu")
NfR="./data/emu/media/" + res[cR] + ".png"
NfR = IsImgExist(NfR,"emu")
PNfL = PhotoImage(file = NfL)
LabelPNfL = Label(arkadeus, image=PNfL)
@ -53,12 +100,6 @@ def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
Cnv.create_image(xR, yR, image=PNfR)
print("Curent Emu : " + str(res[cM]))
#
#Cnv.pack(fill = "both", expand = True)
def leftKey():
global cpt
cpt = cpt - 1
@ -148,14 +189,6 @@ else:
print("res : " + str(Xsize) + ":" + str(Ysize) )
bg = PhotoImage(file = Background)
Cnv = Canvas( arkadeus, width = Ysize , height = Xsize)
Cnv.pack(fill = "both", expand = True)
Cnv.create_image( 0, 0, image = bg, anchor = "nw")
MiddleSquareX=(Xsize/2)
@ -175,6 +208,10 @@ RightSquareY=(Ysize/3)
RightSquareX2=RightSquareX + Square
RightSquareY2=RightSquareY + Square
Cnv = Canvas( arkadeus, width = Ysize , height = Xsize)
Cnv.pack(fill = "both", expand = True)
BackgroundEmu()
ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY)
arkadeus.bind("<Left>", lambda event: leftKey())