def __init__(self, parent=None): QFrame.__init__(self, parent) self.parent = parent self.setStyleSheet(''' GameRoomMain{ border-image: url(:background); background-repeat: no-repeat; } ''') self.setGeometry(0, 67, 800, 533) self.chessBoardFrame = game_room_chess_board.ChessBoard(self) self.userInfoFrame = game_room_user_info.GameRoomUserInfo(self) self.btnsFrame = game_room_btns_frame.GameRoomBtnsFrame(self) self.chatTable = game_chat_view.GameChatView(self) self.chatToolBar = game_chat_tool_bar.GameChatToolBar(self) self.resultFrame = None self.chatTable.setGeometry(530, 200, 255, 260) self.chatToolBar.setGeometry(530, 480, 255, 30) self.chatToolBar.updateLayout() self.chatTable.connect( game_room_manager.GameRoomManager(), SIGNAL("showRoomTextWithRGB(QString,int,int,int)"), self.chatTable.showText) self.chatTable.connect( game_play_manager.GamePlayManager(), SIGNAL("showRoomTextWithRGB(QString,int,int,int)"), self.chatTable.showText) self.connect(game_play_manager.GamePlayManager(), SIGNAL("chessResult(int)"), self.showResult) self.connect(game_play_manager.GamePlayManager(), SIGNAL("redo(int)"), self.chessBoardFrame.redo)
def __init__(self, parent=None): QWidget.__init__(self, parent) # network manager self.client = network_client.TcpClient() self.loginManager = game_user_manager.GameUserManager() self.gameRoomManager = game_room_manager.GameRoomManager() self.connect(self.loginManager, SIGNAL("loginCallback(int, int)"), self.loginCallback) self.connect(self.gameRoomManager, SIGNAL("enterRoom"), self.enterRoom) self.connect(self.loginManager, SIGNAL("showLogin"), self.showLogin) # data source self.tableList = [] # ui self.resize(800, 600) self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint | Qt.WindowMinMaxButtonsHint) self.setAttribute(Qt.WA_TranslucentBackground) self.topbarFrame = game_topbar_frame.GameTopBar(self, self) self.mainFrame = game_hall_main_frame.GameHallMain(self) self.roomWindow = None #dialog self.loginDialog = login_dialog.LoginDialog(self) self.connect(self.loginDialog, SIGNAL("close"), self.loginDialogClose) self.connect(self.loginDialog, SIGNAL("login(QString,int,QString)"), self.login) self.loginDialog.open() self.resultDailog = QMessageBox(self)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.parent = parent self.gameRoomManager = game_room_manager.GameRoomManager() self.gamePlayManager = game_play_manager.GamePlayManager() self.setStyleSheet( "GameRoomBtnsFrame{background-color: rgba(0, 0, 0, 0)}") self.setGeometry(530, 65, 255, 115) self.setupBtns()
def closeEvent(self, event): if not self.canClose: ret = QMessageBox(self).information(None, u'确认退出', u'退出本局游戏将结束,' u'确认退出房间吗?', u'确定', u'取消') if ret == 0: self.canClose = True self.close() game_room_manager.GameRoomManager().leaveRoom() else: event.ignore()
def __init__(self, parent=None): QFrame.__init__(self, parent) self.parent = parent self.setStyleSheet("GameRoomUserInfo{background-color: rgba(0, 0, 0, 0)}") self.setGeometry(530, 20, 255, 50) self.roomManager = game_room_manager.GameRoomManager() self.loginManager = game_user_manager.GameUserManager() self.connect(self.roomManager, SIGNAL('refreshRoom'), self.refreshData) self.setup() self.refreshData()
def mousePressEvent(self, event): game_room_manager.GameRoomManager().enterRoom(self.room.roomId)
def sendText(self, s): game_room_manager.GameRoomManager().chat(s)
def closeEvent(self, event): game_room_manager.GameRoomManager().leaveRoom()