| 1 |
ninoborges |
8 |
##Stella
|
| 2 |
|
|
## v.00000000000001
|
| 3 |
|
|
##This program will become the main frontend to Stella. The Home Arcade Machine.
|
| 4 |
|
|
#7.6.02
|
| 5 |
|
|
|
| 6 |
|
|
import string, os
|
| 7 |
|
|
from Tkinter import *
|
| 8 |
|
|
|
| 9 |
|
|
def GUI():
|
| 10 |
|
|
global List
|
| 11 |
|
|
MainList = LoadData()
|
| 12 |
|
|
MainWin = Frame()
|
| 13 |
|
|
List = Listbox(MainWin)
|
| 14 |
|
|
List.config(selectmode=SINGLE, setgrid=1)
|
| 15 |
|
|
for x in MainList:
|
| 16 |
|
|
List.insert(END,x)
|
| 17 |
|
|
List.pack(side=LEFT, expand = 1, fill = BOTH)
|
| 18 |
|
|
Sbar = Scrollbar(MainWin, orient = VERTICAL)
|
| 19 |
|
|
Sbar.pack(side=LEFT, fill=Y)
|
| 20 |
|
|
List.bind('<Double-1>',handleList)
|
| 21 |
|
|
List.bind('<Return>',handleList)
|
| 22 |
|
|
Sbar['command'] = List.yview
|
| 23 |
|
|
List['yscrollcommand'] = Sbar.set
|
| 24 |
|
|
List.focus()
|
| 25 |
|
|
MainWin.pack()
|
| 26 |
|
|
MainWin.mainloop()
|
| 27 |
|
|
def handleList(text):
|
| 28 |
|
|
index = List.curselection()
|
| 29 |
|
|
lable = List.get(index)
|
| 30 |
|
|
RunGame(lable)
|
| 31 |
|
|
def RunGame(game):
|
| 32 |
|
|
f=open('c:\\Stella.dat','r')
|
| 33 |
|
|
Data = f.readlines()
|
| 34 |
|
|
f.close()
|
| 35 |
|
|
GameLine = 0
|
| 36 |
|
|
check = -1
|
| 37 |
|
|
for x in Data:
|
| 38 |
|
|
try:
|
| 39 |
|
|
check = x.index(game)
|
| 40 |
|
|
#print GameLine
|
| 41 |
|
|
except:
|
| 42 |
|
|
pass
|
| 43 |
|
|
#print
|
| 44 |
|
|
if check == 0:
|
| 45 |
|
|
TheGame = Data[GameLine]
|
| 46 |
|
|
break
|
| 47 |
|
|
else:
|
| 48 |
|
|
GameLine = GameLine + 1
|
| 49 |
|
|
TheGame = TheGame.split(',')
|
| 50 |
|
|
print "Now runing",TheGame[1]
|
| 51 |
|
|
os.system('xmame.x11 %s'%TheGame[1])
|
| 52 |
|
|
|
| 53 |
|
|
def LoadData():
|
| 54 |
|
|
MainList = []
|
| 55 |
|
|
f=open('c:\\Stella.dat','r')
|
| 56 |
|
|
Data = f.readlines()
|
| 57 |
|
|
f.close()
|
| 58 |
|
|
for line in Data:
|
| 59 |
|
|
NewData = string.split(line,',')
|
| 60 |
|
|
entry = NewData[0]
|
| 61 |
|
|
MainList.append(entry)
|
| 62 |
|
|
return MainList
|
| 63 |
|
|
#game = raw_input("select game ")
|
| 64 |
|
|
#RunGame(game)
|
| 65 |
|
|
|
| 66 |
|
|
if __name__ == "__main__":
|
| 67 |
|
|
GUI()
|
| 68 |
|
|
#LoadData() |