def __init__(self, parent, top, g_id, cover, nick): super().__init__(parent) self.top = top self.setProperty('class', 'the-room') self.setFixedSize(140, 150) self.g_id = g_id layer = CommonVBox() h_layer = CommonHBox() id_label = qt.QLabel(str(g_id), self) id_label.setAlignment(qt.Qt.AlignCenter) id_label.setProperty('class', 'id') cover_img = qt.QLabel(self) cover_img.setProperty('class', 'cover') cover_img.setFixedSize(66, 60) cover_img.setScaledContents(True) cover_img.setPixmap(qt.QPixmap(f'./static/avatar/{cover}.png')) join_btn = CommonBtn('加入', self) join_btn.clicked.connect(self.join_room) h_layer.addWidget(cover_img) nick_ = qt.QLabel(nick, self) nick_.setProperty('class', 'nick') nick_.setWordWrap(True) h_layer.addWidget(nick_) layer.addWidget(id_label, 0) layer.addLayout(h_layer, 2) layer.addWidget(join_btn, 0) self.setLayout(layer)
def __init__(self, player, top): super().__init__(parent=player) self.setProperty("class", "login") self.top = top self.dialog = None self.req_id = 0 layer = CommonVBox() toggle_layer = CommonHBox() self.toggle_frm = ToggleLogin(self, top) toggle_layer.addWidget(self.toggle_frm) layer.addLayout(toggle_layer) mid_frame = qt.QFrame(self) input_layer = qt.QVBoxLayout() self.nick_ipt = SuperInput(self, placeholder="昵称", ico=0xe007) self.nick_ipt.hide() self.act_ipt = SuperInput(self, placeholder="账号", ico=0xe006) self.pwd_ipt = SuperInput(self, placeholder="密码", ico=0xe008) input_layer.addWidget(self.nick_ipt) input_layer.addWidget(self.act_ipt) input_layer.addWidget(self.pwd_ipt) mid_frame.setLayout(input_layer) layer.addWidget(mid_frame, 1) self.submit = IcoButton(self.top, parent=self, text="登录", ico=0xe001) self.submit.clicked.connect(self.click_submit) layer.addWidget(self.submit, alignment=qt.Qt.AlignHCenter) self.setLayout(layer) self.submit_signal.connect(self.result) self.dialog_click.connect(self.dialog_btn_click)