Commit 86ac2788 authored by Agrigor's avatar Agrigor

first raw version for reading zipfiles with textfiles inside

parent 77c883c7
......@@ -8,6 +8,7 @@ import sys
import threading
import socket
import time
import zipfile
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.uic import *
......@@ -337,9 +338,24 @@ class MainGUI(QMainWindow):
self.UI_Main.actionNew_Game.triggered.connect(self.newGame)
self.UI_Main.actionAbout.triggered.connect(self.about)
self.UI_Main.actionReconnect.triggered.connect(self.reconnect)
self.UI_Main.actionLoad.triggered.connect(self.LoadQuestionSet)
self.UI_Main.show()
self.UI_Main.actionNew_Game.trigger()
def LoadQuestionSet(self):
# TODO only show the pure filname as name of the category
# TODO only read when the question window pops up
# TODO support multiple types (textfiles, Images, soundfiles)
zipfilenames = QFileDialog.getOpenFileNames(self, "Load Question Set", '', "ZIP-Files (*.zip)")
questions = []
if zipfilenames:
for zipfilename in zipfilenames:
self.UI_Main.Cat_Name_1.setText(zipfilename[0:-3])
with zipfile.ZipFile(zipfilename) as z:
for filename in z.namelist():
questions.append(str(z.open(filename).read()))
print(questions)
def reconnect(self):
self.UI_Reconnect = ReconnectGUI(self.socket, self.UI_Main)
......
This is Question for 100 bucks in Category 1
This is Question for 200 bucks in Category 1
This is Question for 300 bucks in Category 1
This is Question for 400 bucks in Category 1
This is Question for 500 bucks in Category 1
This is Question for 100 bucks in Category 2
This is Question for 200 bucks in Category 2
This is Question for 300 bucks in Category 2
This is Question for 400 bucks in Category 2
This is Question for 500 bucks in Category 2
This is Question for 100 bucks in Category 3
This is Question for 200 bucks in Category 3
This is Question for 300 bucks in Category 3
This is Question for 400 bucks in Category 3
This is Question for 500 bucks in Category 3
This is Question for 100 bucks in Category 4
This is Question for 200 bucks in Category 4
This is Question for 300 bucks in Category 4
This is Question for 400 bucks in Category 4
This is Question for 500 bucks in Category 4
This is Question for 100 bucks in Category 5
This is Question for 200 bucks in Category 5
This is Question for 300 bucks in Category 5
This is Question for 400 bucks in Category 5
This is Question for 500 bucks in Category 5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment