Exemplo n.º 1
0
def main(pipe, user_nickname):
    app = QtWidgets.QApplication(sys.argv)
    try:
        author = str(user_nickname)
        # TODO: отсюда и до window.show() почему-то очень долго думает
        blockchain = Blockchain(author)
        client = Client(blockchain, pipe)
        miner = Miner(blockchain, client)
        window = Game_Window(10,miner, client)
        setMoveWindow(window)
        window.show()
    except Exception:
        print(traceback.format_exc())
    app.exec_()
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        setMoveWindow(self)
        self.MainWindow = uic.loadUi(rel_materials_path + resources.Start_Menu_Resources.form, self)

        self.MainWindow.setWindowFlags(Qt.FramelessWindowHint)
        self.MainWindow.setAttribute(Qt.WA_NoSystemBackground, True)
        self.MainWindow.setAttribute(Qt.WA_TranslucentBackground, True)

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(rel_materials_path + resources.Start_Menu_Resources.close_icon),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon)

        self.main_btn.setPixmap(QtGui.QPixmap(rel_materials_path + resources.Start_Menu_Resources.start_menu_gif))
        self.m = QMovie(rel_materials_path + resources.Start_Menu_Resources.start_menu_gif)
        self.m.setSpeed(100)
        self.m.start()
        self.main_btn.setMovie(self.m)

        self.main_btn.mousePressEvent = self.mouse_pressed
        self.pushButton.clicked.connect(self.closeIt)
Exemplo n.º 3
0
    def __init__(self, block_cost, miner, client, username=None, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        setMoveWindow(self)
        self.parent = parent
        self.miner = miner
        self.client = client
        self.block_cost = block_cost
        self.cost_increment = 5

        self.MainWindow = uic.loadUi(rel_materials_path + resources.Game_Window_Resources.form, self)

        self.user_name.setStyleSheet("color: #fff;")
        self.user_name.setText(username)
        self.username = username

        self.MainWindow.setWindowFlags(Qt.FramelessWindowHint)
        self.MainWindow.setAttribute(Qt.WA_NoSystemBackground, True)
        self.MainWindow.setAttribute(Qt.WA_TranslucentBackground, True)

        self.label_2.setStyleSheet("color: rgb(255, 255, 255);")
        self.num_of_clicks.setStyleSheet("color: rgb(255, 255, 255);")
        self.num_of_clicks.setText("0")
        self.label_5.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_5.setText("")
        self.cost_of_boost.setStyleSheet("color: rgb(255, 255, 255);")
        self.cost_of_boost.setText("")
        self.pushButton.setStyleSheet("color: rgb(100, 100, 100);")
        self.pushButton.setEnabled(False)
        self.pushButton.setVisible(False)

        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(rel_materials_path + resources.Game_Window_Resources.return_icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.reset.setIcon(icon3)
        self.reset.clicked.connect(self.multiplayer_start)


        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(rel_materials_path + resources.Game_Window_Resources.statistic_icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.stat.setIcon(icon)

        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(rel_materials_path + resources.Game_Window_Resources.info_icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.info.setIcon(icon1)

        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(rel_materials_path + resources.Game_Window_Resources.close_icon), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.exit.setIcon(icon2)
        self.exit.setIconSize(QtCore.QSize(32, 32))

        self.label.setPixmap(QtGui.QPixmap(rel_materials_path + resources.Game_Window_Resources.game_menu_gif))
        self.m = QMovie(rel_materials_path + resources.Game_Window_Resources.game_menu_gif)
        self.m.setSpeed(990)
        self.m.start()
        self.m.setPaused(True)
        self.label.setMovie(self.m)
        self.label.mousePressEvent = self.mouse_pressed
        self.m.frameChanged.connect(self.finish)
        self.exit.clicked.connect(self.closeIt)

        self.pushButton.clicked.connect(self.boost)
        self.stat.clicked.connect(self.show_stat)

        self.game_window_start.emit()
        self.block_missed.connect(self.missed_block)
        self.block_missed_with_comment.connect(self.winner_comment_get)
Exemplo n.º 4
0
 def show_stat(self):
     window = Ui_Form(self, self.miner.blockchain.chain)  # отсюда вызываю функцию получения статистики по блокчейну
     setMoveWindow(window)  # в blockchain_stat в функции get_block_desc показано как я представляю структуру блока
     self.hide()
     window.show()
Exemplo n.º 5
0
    def start_thread(self):
        self.thread = MyThread(self.boost_increment)
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.thread.increment)
        self.thread.increment_signal.connect(self.increment_clicks)
        self.timer.start(1000)
        self.thread.start()

    def form_new_boost_cost(self):
        return round((self.boost_cost * 1.07**(self.boost_count+1)), 1)

    def multiplayer_start(self):
        self.hide()
        self.multiplayer_game_start.emit()
        self.show()

    def closeIt(self):
        self.close()
        self.game_window_closed.emit()


if __name__ == "__main__":
    import sys

    rel_materials_path = "..//"
    app = QtWidgets.QApplication(sys.argv)
    window = Game_Window(20)
    setMoveWindow(window)
    window.show()
    sys.exit(app.exec_())