示例#1
0
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.app = QtGui.QApplication(["Passant"])
        self.app.setWindowIcon(QtGui.QIcon(''))
        self.validator = validator.MoveValidator()
        self.view = QtDeclarative.QDeclarativeView()
        self.view.closeEvent = self.close_main_window_callback
        self.context = self.view.rootContext()
        self.context.setContextProperty('main', self)
        self.active_square = ""
        self.current_player = "w"
        self.engine_player = ""
        self.valid_move = False
        self.game_info = {"event": "", "site": "", "date": "", "round": "", "white": "", "black": "", "result": ""}
        self.pause = False
        self.create_actions()
        self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)

        self.timer_white = QtCore.QTimer()
        self.timer_white.setInterval(500)
        self.timer_white.timeout.connect(self.timer_white_callback)
        self.timer_black = QtCore.QTimer()
        self.timer_black.setInterval(500)
        self.timer_black.timeout.connect(self.timer_black_callback)
        self.time_white = ""
        self.time_black = ""

        self.engine = engine_cecp.EngineCECP(self.engine_callback)
        self.on_engine_move.connect(self.make_engine_move)
        
        self.view.setAttribute(QtCore.Qt.WA_LockLandscapeOrientation)
        if platform.HARMATTAN:
            self.view.setSource(util.find_data_file("qml/main_harmattan.qml"))
            self.view.showFullScreen()
        else:
            self.view.setSource(util.find_data_file("qml/main_default.qml"))
            self.view.show()
        self.app.exec_()
示例#2
0
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.app = QtWidgets.QApplication(["Passant"])
        #self.app.setWindowIcon(QtGui.QIcon(''))
        self.validator = validator.MoveValidator()
        self.view = QtQuick.QQuickView()
        self.view.setResizeMode(QtQuick.QQuickView.SizeRootObjectToView)
        self.view.setDefaultAlphaBuffer(True)
        self.view.closeEvent = self.close_main_window_callback
        self.context = self.view.rootContext()
        self.context.setContextProperty('main', self)
        self.active_square = ""
        self.current_player = "w"
        self.engine_player = ""
        self.valid_move = False
        self.game_info = {"event": "", "site": "", "date": "", "round": "", "white": "", "black": "", "result": ""}
        self.pause = False
        self.create_actions()

        self.timer_white = QtCore.QTimer()
        self.timer_white.setInterval(500)
        self.timer_white.timeout.connect(self.timer_white_callback)
        self.timer_black = QtCore.QTimer()
        self.timer_black.setInterval(500)
        self.timer_black.timeout.connect(self.timer_black_callback)
        self.time_white = ""
        self.time_black = ""

        self.engine = engine_cecp.EngineCECP(self.engine_callback)
        self.on_engine_move.connect(self.make_engine_move)
        
        if platform.SAILFISH:
            self.view.setSource(QtCore.QUrl(util.find_data_file("qml2/main_sailfish.qml")))
            self.view.showFullScreen()
        else:
            self.view.setSource(QtCore.QUrl(util.find_data_file("qml2/main_default.qml")))
            self.view.show()
        self.app.exec_()