main.py 1.06 KB
Newer Older
Antoine Lima's avatar
Base UI  
Antoine Lima committed
1
2
3
4
5
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 18 18:34:40 2018

Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
6
@author: Antoine Lima, Leo Reynaert, Domitille Jehenne
Antoine Lima's avatar
Base UI  
Antoine Lima committed
7
8
"""

Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
9
10
import sys
import logging
Antoine Lima's avatar
Base UI  
Antoine Lima committed
11
12

from PyQt5 import QtWidgets
Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
13
from PyQt5.QtCore import QTime
Antoine Lima's avatar
Antoine Lima committed
14

15
16
from ui.main_ui import Ui_MainWindow
from modules import *
Antoine Lima's avatar
Base UI  
Antoine Lima committed
17
18
19
20
21
22

class MainWin(QtWidgets.QMainWindow):
	def __init__(self, parent=None):
		QtWidgets.QWidget.__init__(self, parent)
		self.ui = Ui_MainWindow()
		self.ui.setupUi(self)
23
		
Antoine Lima's avatar
Antoine Lima committed
24
		self.modules = [MenuModule, GameModule, OptionsModule, AuthModule, LeaderboardModule]
25
26
27
28
		
		for mod in self.modules:
			self.ui.panels.addWidget(mod(self))
			
Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
29
30
31
		self.ui.panels.setCurrentIndex(0)
		self.displaySystemTime()
		self.startTimer(1000)
Antoine Lima's avatar
Antoine Lima committed
32

Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
33
34
	def timerEvent(self, e):
		self.displaySystemTime()
Antoine Lima's avatar
Antoine Lima committed
35

Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
36
37
	def displaySystemTime(self):
		self.ui.lcdTime.display(QTime.currentTime().toString("hh:mm:ss"))
Antoine Lima's avatar
Base UI  
Antoine Lima committed
38
39
40

if __name__=='__main__':
	app = QtWidgets.QApplication(sys.argv)
Antoine Lima's avatar
UI v0.3  
Antoine Lima committed
41
42
	#logging.basicConfig(filename='babyfoot.log', level=logging.DEBUG)
	logging.basicConfig(level=logging.DEBUG)
Antoine Lima's avatar
Base UI  
Antoine Lima committed
43
44
	myapp = MainWin()
	myapp.show()
45
	app.exec_()