main.py 1.06 KB
Newer Older
Antoine Lima's avatar
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
Antoine Lima committed
6
@author: Antoine Lima, Leo Reynaert, Domitille Jehenne
Antoine Lima's avatar
Antoine Lima committed
7 8
"""

Antoine Lima's avatar
Antoine Lima committed
9 10
import sys
import logging
Antoine Lima's avatar
Antoine Lima committed
11 12

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

Antoine Lima's avatar
Antoine Lima committed
15
from main_ui import Ui_MainWindow
Antoine Lima's avatar
Antoine Lima committed
16
from panels import MenuPanel, GamePanel, OptionsPanel
Antoine Lima's avatar
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)
Antoine Lima's avatar
Antoine Lima committed
23

Antoine Lima's avatar
Antoine Lima committed
24 25 26 27
		self.ui.panels.addWidget(MenuPanel(self))
		self.ui.panels.addWidget(GamePanel(self))
		self.ui.panels.addWidget(OptionsPanel(self))
		self.ui.panels.setCurrentIndex(0)
Antoine Lima's avatar
Antoine Lima committed
28

Antoine Lima's avatar
Antoine Lima committed
29 30
		self.displaySystemTime()
		self.startTimer(1000)
Antoine Lima's avatar
Antoine Lima committed
31

Antoine Lima's avatar
Antoine Lima committed
32 33
	def timerEvent(self, e):
		self.displaySystemTime()
Antoine Lima's avatar
Antoine Lima committed
34

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

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