updated test file structure, fixed submit bug
This commit is contained in:
parent
21b72f2fad
commit
c3fdcb93b0
4 changed files with 44 additions and 41 deletions
|
@ -2,6 +2,7 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="51fbe63a-b9a4-4568-8b8d-3351f51944b9" name="Default Changelist" comment="">
|
<list default="true" id="51fbe63a-b9a4-4568-8b8d-3351f51944b9" name="Default Changelist" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/programfiles/default.tst" beforeDir="false" afterPath="$PROJECT_DIR$/programfiles/default.tst" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/example angtest.tst" beforeDir="false" afterPath="$PROJECT_DIR$/tests/example angtest.tst" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/example angtest.tst" beforeDir="false" afterPath="$PROJECT_DIR$/tests/example angtest.tst" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/vyzkousejme.pyw" beforeDir="false" afterPath="$PROJECT_DIR$/vyzkousejme.pyw" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/vyzkousejme.pyw" beforeDir="false" afterPath="$PROJECT_DIR$/vyzkousejme.pyw" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
|
@ -12,12 +13,12 @@
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf>
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/vyzkousejme.pyw">
|
<entry file="file://$PROJECT_DIR$/vyzkousejme.pyw">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="204">
|
<state relative-caret-position="170">
|
||||||
<caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
|
<caret line="10" column="19" selection-start-line="10" selection-start-column="19" selection-end-line="10" selection-end-column="19" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#21#0" expanded="true" />
|
<element signature="e#0#21#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -27,6 +28,14 @@
|
||||||
</file>
|
</file>
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="FindInProjectRecents">
|
||||||
|
<findStrings>
|
||||||
|
<find>test[1]</find>
|
||||||
|
</findStrings>
|
||||||
|
<replaceStrings>
|
||||||
|
<replace>test[0]</replace>
|
||||||
|
</replaceStrings>
|
||||||
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -47,6 +56,7 @@
|
||||||
<foldersAlwaysOnTop value="true" />
|
<foldersAlwaysOnTop value="true" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<expand>
|
<expand>
|
||||||
|
@ -58,7 +68,6 @@
|
||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scope" />
|
|
||||||
</panes>
|
</panes>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunDashboard">
|
<component name="RunDashboard">
|
||||||
|
@ -117,13 +126,9 @@
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="-7" y="0" width="974" height="1047" extended-state="0" />
|
<frame x="-7" y="0" width="974" height="1047" extended-state="0" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info id="Favorites" side_tool="true" />
|
|
||||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.33653846" />
|
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.33653846" />
|
||||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Version Control" />
|
<window_info id="Favorites" order="2" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Python Console" />
|
|
||||||
<window_info anchor="bottom" id="Terminal" />
|
|
||||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" />
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
<window_info anchor="bottom" id="Run" order="2" weight="0.32932165" />
|
<window_info anchor="bottom" id="Run" order="2" weight="0.32932165" />
|
||||||
|
@ -131,6 +136,10 @@
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="TODO" order="6" />
|
<window_info anchor="bottom" id="TODO" order="6" />
|
||||||
|
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||||
|
<window_info anchor="bottom" id="Terminal" order="8" />
|
||||||
|
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
|
||||||
|
<window_info anchor="bottom" id="Python Console" order="10" />
|
||||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||||
|
@ -139,8 +148,8 @@
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/vyzkousejme.pyw">
|
<entry file="file://$PROJECT_DIR$/vyzkousejme.pyw">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="204">
|
<state relative-caret-position="170">
|
||||||
<caret line="72" lean-forward="true" selection-start-line="72" selection-end-line="72" />
|
<caret line="10" column="19" selection-start-line="10" selection-start-column="19" selection-end-line="10" selection-end-column="19" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#21#0" expanded="true" />
|
<element signature="e#0#21#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
EXAMPLE TEST SUBJECT 1/EXAMPLE TEST SUBJECT 2
|
|
||||||
0
|
0
|
||||||
question will appear here/question will appear here
|
question will appear here/question will appear here
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
ČEŠTINA/ENGLISH
|
0
|
||||||
5
|
|
||||||
apple/jablko
|
apple/jablko
|
||||||
car,automobile/auto,automobil
|
car,automobile/auto,automobil
|
||||||
chopper,helicopter/vrtulník,helikoptéra
|
chopper,helicopter/vrtulník,helikoptéra
|
||||||
|
|
|
@ -7,9 +7,9 @@ import random
|
||||||
def swapSides():
|
def swapSides():
|
||||||
global test
|
global test
|
||||||
|
|
||||||
temp = test[2]
|
temp = test[0]
|
||||||
test[2] = test[3]
|
test[0] = test[1]
|
||||||
test[3] = temp
|
test[1] = temp
|
||||||
|
|
||||||
newQuestion()
|
newQuestion()
|
||||||
|
|
||||||
|
@ -17,25 +17,24 @@ def swapSides():
|
||||||
def saveTest():
|
def saveTest():
|
||||||
print(test)
|
print(test)
|
||||||
with open(filepath, mode='w', encoding = "UTF-8") as file:
|
with open(filepath, mode='w', encoding = "UTF-8") as file:
|
||||||
file.write(test[0]+'/'+test[1])
|
file.write(str(test[2])+'\n')
|
||||||
file.write(str(test[4])+'\n')
|
for i in range(len(test[0])):
|
||||||
for i in range(len(test[2])):
|
for j in range(len(test[0][i])):
|
||||||
for j in range(len(test[2][i])):
|
file.write(test[0][i][j])
|
||||||
file.write(test[2][i][j])
|
if j < len(test[0][i])-1:
|
||||||
if j < len(test[2][i])-1:
|
|
||||||
file.write(',')
|
file.write(',')
|
||||||
file.write('/')
|
file.write('/')
|
||||||
for j in range(len(test[3][i])):
|
for j in range(len(test[1][i])):
|
||||||
file.write(test[3][i][j])
|
file.write(test[1][i][j])
|
||||||
if j < len(test[3][i])-1:
|
if j < len(test[1][i])-1:
|
||||||
file.write(',')
|
file.write(',')
|
||||||
file.write('\n')
|
file.write('\n')
|
||||||
|
|
||||||
|
|
||||||
def newQuestion():
|
def newQuestion():
|
||||||
global questionPlace
|
global questionPlace
|
||||||
questionPlace = random.randint(0, len(test[2])-1)
|
questionPlace = random.randint(0, len(test[0])-1)
|
||||||
newQuestion = test[2][questionPlace][0]
|
newQuestion = test[0][questionPlace][0]
|
||||||
question.set(newQuestion)
|
question.set(newQuestion)
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,15 +46,15 @@ def on_closing():
|
||||||
|
|
||||||
def submitAnswer(uselessArgument):
|
def submitAnswer(uselessArgument):
|
||||||
global score
|
global score
|
||||||
if answerEntry.get().lower() in test[3] [questionPlace]:
|
if answerEntry.get().lower() in test[1] [questionPlace]:
|
||||||
score += 1
|
score += 1
|
||||||
currentScore.set('Score: %s' % (score))
|
currentScore.set('Score: %s' % (score))
|
||||||
else:
|
else:
|
||||||
score = 0
|
score = 0
|
||||||
currentScore.set('Score: %s' % (score))
|
currentScore.set('Score: %s' % (score))
|
||||||
if score > test[4]:
|
if score > test[2]:
|
||||||
test[4] = score
|
test[2] = score
|
||||||
highScore.set('High score: %d' % (test[4]))
|
highScore.set('High score: %d' % (test[2]))
|
||||||
answerEntry.delete(0, 'end')
|
answerEntry.delete(0, 'end')
|
||||||
newQuestion()
|
newQuestion()
|
||||||
|
|
||||||
|
@ -65,22 +64,19 @@ def formatTest(filepath):
|
||||||
with open(filepath, encoding = "UTF-8") as file:
|
with open(filepath, encoding = "UTF-8") as file:
|
||||||
file = file.readlines()
|
file = file.readlines()
|
||||||
|
|
||||||
nazev1 = file[0].split('/')[0]
|
|
||||||
nazev2 = file[0].split('/')[1]
|
|
||||||
|
|
||||||
sloupec1 = []
|
sloupec1 = []
|
||||||
sloupec2 = []
|
sloupec2 = []
|
||||||
|
|
||||||
highScore = int(file[1].strip('\n'))
|
highScore = int(file[0].strip('\n'))
|
||||||
score = 0
|
score = 0
|
||||||
|
|
||||||
for line in file[2:]:
|
for line in file[1:]:
|
||||||
currentline = line.strip('\n')
|
currentline = line.strip('\n')
|
||||||
currentline = currentline.split('/')
|
currentline = currentline.split('/')
|
||||||
sloupec1.append(currentline[0].split(','))
|
sloupec1.append(currentline[0].split(','))
|
||||||
sloupec2.append(currentline[1].split(','))
|
sloupec2.append(currentline[1].split(','))
|
||||||
|
|
||||||
return nazev1, nazev2, sloupec1, sloupec2, highScore
|
return sloupec1, sloupec2, highScore
|
||||||
|
|
||||||
|
|
||||||
def getExtension(filename): # returns the last four characters in a filename as a string
|
def getExtension(filename): # returns the last four characters in a filename as a string
|
||||||
|
@ -102,7 +98,7 @@ def openTest():
|
||||||
test = list(formatTest(filepath))
|
test = list(formatTest(filepath))
|
||||||
newQuestion()
|
newQuestion()
|
||||||
currentScore.set('Score: %s' % score)
|
currentScore.set('Score: %s' % score)
|
||||||
highScore.set('High score: %d' % test[4])
|
highScore.set('High score: %d' % test[2])
|
||||||
|
|
||||||
|
|
||||||
def makeMenu(root):
|
def makeMenu(root):
|
||||||
|
@ -141,7 +137,7 @@ highScoreLabel = Label(root, textvariable=highScore, bg='gray')
|
||||||
questionLabel = Label(root, textvariable=question, width=30)
|
questionLabel = Label(root, textvariable=question, width=30)
|
||||||
spacingLabel = Label(bg='gray', padx=10)
|
spacingLabel = Label(bg='gray', padx=10)
|
||||||
answerEntry = Entry(root, width=30)
|
answerEntry = Entry(root, width=30)
|
||||||
answerButton = Button(root, text='submit', command=submitAnswer)
|
answerButton = Button(root, text='submit', command=lambda: submitAnswer(0))
|
||||||
timeMultiplierLabel = Label(root, textvariable=timeMultiplier, bg='gray')
|
timeMultiplierLabel = Label(root, textvariable=timeMultiplier, bg='gray')
|
||||||
|
|
||||||
anotherSpacingLabel.grid(row=0, column=0)
|
anotherSpacingLabel.grid(row=0, column=0)
|
||||||
|
@ -154,7 +150,7 @@ answerButton.grid(row=1, column=5, sticky=W)
|
||||||
#timeMultiplierLabel.grid(row=2, column=1, columnspan=5)
|
#timeMultiplierLabel.grid(row=2, column=1, columnspan=5)
|
||||||
|
|
||||||
currentScore.set('Score: %s' %(score))
|
currentScore.set('Score: %s' %(score))
|
||||||
highScore.set('High score: %d' %(test[4]))
|
highScore.set('High score: %d' %(test[2]))
|
||||||
question.set('question will appear here')
|
question.set('question will appear here')
|
||||||
timeMultiplier.set('Time multiplier is: 0')
|
timeMultiplier.set('Time multiplier is: 0')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue