Skip to content

Commit

Permalink
Пересборка exe и фиксы багов
Browse files Browse the repository at this point in the history
Идея с ярлыком Game.lnk оказалась провальной, т.к. ярлык не способен в относительные пути.

database.sqlite3
⠀- Перепроверил вопросы и поправил оставшиеся многоточия
⠀- Очистил таблицу результатов

main.py
⠀- Отсортировал импорты
⠀- Поправил баг при выходе из игры с деньгами
⠀- Добавил жирности шрифту в окне ошибки

README.md
⠀- Добавил правила игры

ui.py
⠀- Отсортировал импорты
⠀- Добавил автообновление года

Пересобрал exe с учётом пофикшенных багов.
  • Loading branch information
snowlue committed May 13, 2021
1 parent 9c7c6dc commit a3cb529
Show file tree
Hide file tree
Showing 14 changed files with 2,913 additions and 25 deletions.
Binary file removed Game.lnk
Binary file not shown.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@

Popular TV show «Who Wants to Be a Millionaire?» is now available on your PC! 💙<br>Lifelines, questions, virtual rubles and all game feauters — all what you love in this game show is now in one app. 💰<br>You can beat your records and friend's records with table of records. 🏆<br>Become smarter and test your knowledge! 📚

## How to play:
## How to start:

1. Open your terminal in repo's folder
2. Type next commands:
```batch
pip install -r requirements.txt
python main.py
```
OR (only for Windows)
OR (only for Windows & if you don't have Python)
```batch
pip install -r requirements.txt
Game.lnk
cd bin
python main.exe
```
3. Have a fun ^_^

⠀(4.) Also you can download folder «bin» and open main.exe. The folder is self-contained and you can use it on any drive.
⠀(4.) In addition the folder «bin» is self-contained and you can use it on any drive on Windows even if you don't have Python.

## Rulebook:

- Answer the questions by mouse pressing on A-, B-, C-, D-answer or by keyboard pressing on Q, W, A, S:
- 5 000₽ on the 5th question and 100 000₽ on the 10th question are guaranteed, even if you lose the game, you'll get these sums
- Your main goal — get the top prize as 3 000 000₽.
- Use lifelines by mouse pressing on lifelines at the money tree or by keyboard pressing on 1, 2, 3, 4:
- Changer changes the question to another
- 50:50 removes two incorrect answers to make the question easier
- ×2 gives you a second chance to answer the question — if your answer will be incorrect you will can answer one more time.
- You can get your current prize and leave the game by pressing home icon at the money tree.
- You can watch the table of records and set new records when you play the game (also supports erasing).


## License Creative Commons «Attribution-NonCommercial-ShareAlike»
Expand Down
Binary file modified bin/database.sqlite3
Binary file not shown.
2,868 changes: 2,868 additions & 0 deletions bin/font_resources.py

Large diffs are not rendered by default.

File renamed without changes
Binary file added bin/images/background2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/images/background3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/images/background4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/images/background5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/images/background6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions bin/main.exe
Git LFS file not shown
Binary file modified database.sqlite3
Binary file not shown.
32 changes: 17 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import functools
import logging
import os
import random
import sqlite3
import sys

import logging
import traceback

from datetime import datetime
from typing import List

from PyQt5 import QtCore
from PyQt5.QtGui import QIcon, QKeyEvent, QPixmap, QMouseEvent
from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtGui import QIcon, QKeyEvent, QMouseEvent, QPixmap
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
from PyQt5.QtWidgets import (QApplication, QDialog, QHeaderView, QMainWindow,
QMessageBox, QTableWidget, QTableWidgetItem, QWidget)

from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtCore import QUrl, Qt
QMessageBox, QTableWidget, QTableWidgetItem,
QWidget)

from ui import (Ui_About, Ui_ConfirmAgain, Ui_ConfirmClearAll, Ui_ConfirmExit, Ui_ConfirmLeave, Ui_DeleteResult,
Ui_GameOver, Ui_MainWindow, Ui_ResultsTable, Ui_StartDialog, Ui_Win, Ui_WinLeave)
from ui import (Ui_About, Ui_ConfirmAgain, Ui_ConfirmClearAll, Ui_ConfirmExit,
Ui_ConfirmLeave, Ui_DeleteResult, Ui_GameOver, Ui_MainWindow,
Ui_ResultsTable, Ui_StartDialog, Ui_Win, Ui_WinLeave)

PRICES = [
'0', '500', '1 000', '2 000', '3 000', '5 000', '10 000',
'15 000', '25 000', '50 000', '100 000', '200 000',
'400 000', '800 000', '1 500 000', '3 000 000'
]
GUARANTEED_PRICES = ['0'] * 5 + ['5 000'] * 5 + ['100 000'] * 5
logging.basicConfig(filename='logs.txt', level=logging.DEBUG,
logging.basicConfig(filename=os.path.realpath('logs.txt'), level=logging.DEBUG,
format='%(levelname)s: %(message)s')


Expand Down Expand Up @@ -535,7 +535,7 @@ def openConfirmLeave(self):
self.control = False
num_to_let = {0: 'A', 1: 'B', 2: 'C', 3: 'D'}
letter = num_to_let[self.answers.index(self.correct_answer)]
self.confirm_wndw = ConfirmLeaveWindow(self, letter)
self.confirm_wndw = ConfirmLeaveWindow(self, letter, self.is_sound)
self.confirm_wndw.move(169 + self.x(), 210 + self.y())
self.confirm_wndw.show()

Expand Down Expand Up @@ -668,13 +668,14 @@ class ConfirmLeaveWindow(QDialog, Ui_ConfirmLeave):
• target: сonfirm leaving current round
'''

def __init__(self, parent: GameWindow, letter):
def __init__(self, parent: GameWindow, letter: str, is_sound: bool):
super().__init__()
self.setupUi(self)
self.setWindowIcon(QIcon('images/app_icon.ico'))

self.parent = parent
self.correct = letter
self.is_sound = is_sound
self.label.setText(self.label.text().replace('{}', self.parent.got_amount))
self.accepted.connect(self.leave)
self.rejected.connect(self.close_wndw)
Expand All @@ -684,7 +685,7 @@ def leave(self):
(name, result, date)
VALUES ("{}", "{}", "{}")
'''.format(self.parent.name, self.parent.got_amount, self.parent.date))
self.windialog = WinLeaveWindow(self.parent, [self.correct, self.parent.got_amount])
self.windialog = WinLeaveWindow(self.parent, [self.correct, self.parent.got_amount, self.is_sound])
self.windialog.move(169 + self.parent.x(), 210 + self.parent.y())
self.windialog.show()

Expand Down Expand Up @@ -832,6 +833,7 @@ def __init__(self):
def deleteAllData(self):
result = sql_request('DELETE FROM results')
self.results_table = ResultsTableWindow()
self.results_table.move(self.x(), self.y() - 117)
self.results_table.show()
logging.info('AllR delete')
self.close()
Expand Down Expand Up @@ -900,7 +902,7 @@ def excepthook(exc_type, exc_value, exc_tb):
msg.setIcon(QMessageBox.Critical)
msg.setText('<html><body><p>Кажется, мы споткнулись об какую-то ошибку.\n'
'Чтобы прокачать игру, отправьте файл logs.txt <a href="https://t.me/pavetranquil">'
'<span style="text-decoration: underline; color:#005ffe;">разработчику</span></a>.</p></body></html>')
'<span style="text-decoration: underline; color:#005ffe; font-weight:600;">разработчику</span></a>.</p></body></html>')

app.exec()
logging.info('Session finish\n\n')
13 changes: 9 additions & 4 deletions ui.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from datetime import datetime
from random import choice

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QEasingCurve, QPropertyAnimation, QVariant, QVariantAnimation, pyqtSlot
from PyQt5.QtGui import QColor, QPalette, QFontDatabase
from PyQt5.QtCore import (QEasingCurve, QPropertyAnimation, QVariant,
QVariantAnimation, pyqtSlot)
from PyQt5.QtGui import QColor, QFontDatabase, QPalette
from PyQt5.QtWidgets import QGraphicsOpacityEffect, QLabel

import font_resources


class AnimationLabel(QLabel):
def __init__(self, *args, **kwargs):
QLabel.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -1033,8 +1037,9 @@ def setupUi(self, Form):
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "О программе"))
self.ruText.setText(_translate("Form", "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">Игра «Кто хочет стать Миллионером?»</span></p><p align=\"center\">Игра, написанная на Python и основанная на популярном интеллектуальном телешоу <br/>«Who Wants to Be a Millionaire?»</p><p align=\"center\">© Павел Овчинников, 2020</p></body></html>"))
self.enText.setText(_translate("Form", "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">The Game «Who Want to Be a Millionaire?»</span></p><p align=\"center\">The game was written on Python and based on popular intellectual TV show <br/>«Who Wants to Be a Millionaire?»</p><p align=\"center\">© Pavel Ovchinnikov, 2020</p></body></html>"))
year = datetime.today().year
self.ruText.setText(_translate("Form", "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">Игра «Кто хочет стать Миллионером?»</span></p><p align=\"center\">Игра, написанная на Python и основанная на популярном интеллектуальном телешоу <br/>«Who Wants to Be a Millionaire?»</p><p align=\"center\">© Павел Овчинников, {}</p></body></html>".format(year)))
self.enText.setText(_translate("Form", "<html><head/><body><p align=\"center\"><span style=\" font-weight:600;\">The Game «Who Want to Be a Millionaire?»</span></p><p align=\"center\">The game was written on Python and based<br/>on popular intellectual TV show <br/>«Who Wants to Be a Millionaire?»</p><p align=\"center\">© Pavel Ovchinnikov, {}</p></body></html>".format(year)))
self.ruButton.setText(_translate("Form", "RU"))
self.enButton.setText(_translate("Form", "EN"))
self.okButton.setText(_translate("Form", "ОК"))

0 comments on commit a3cb529

Please sign in to comment.