added easy pair button to player list + fixed pairing offsets
This commit is contained in:
parent
8d88b150a9
commit
da19000d9f
@ -25,10 +25,12 @@ self.playerList.setGeometry(8, 8, 714 - 304 - 22, 180)
|
||||
self.removeQueue.resize(self.removeQueue.sizeHint())
|
||||
self.removeQueue.move(8, self.msgqueueList.size().height() + 16)
|
||||
|
||||
self.playerPair.resize(self.playerPair.sizeHint())
|
||||
self.playerPair.move(8, self.playerList.size().height() + 16)
|
||||
self.playerKick.resize(self.playerKick.sizeHint())
|
||||
self.playerKick.move(8, self.playerList.size().height() + 16)
|
||||
self.playerKick.move(16 + self.playerPair.size().width(), self.playerList.size().height() + 16)
|
||||
self.playerBan.resize(self.playerBan.sizeHint())
|
||||
self.playerBan.move(16 + self.playerKick.width(), self.playerList.size().height() + 16)
|
||||
self.playerBan.move(24 + self.playerPair.size().width() + self.playerKick.size().width(), self.playerList.size().height() + 16)
|
||||
|
||||
self.notmutedlabel.move(8, 8)
|
||||
self.unmutedlist.setGeometry(8, 24, 160, 192)
|
||||
|
59
gameview.py
59
gameview.py
@ -610,7 +610,9 @@ class WTCE_View(QtGui.QLabel):
|
||||
if self.movie.state() != QtGui.QMovie.Running:
|
||||
return
|
||||
img = self.movie.currentImage()
|
||||
self.setPixmap(QtGui.QPixmap.fromImage(img).scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
pixmap = QtGui.QPixmap.fromImage(img)
|
||||
if not pixmap.isNull():
|
||||
self.setPixmap(pixmap.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
if self.movie.currentFrameNumber() == self.movie.frameCount() - 1:
|
||||
self.finalframe_timer.start(self.movie.nextFrameDelay())
|
||||
|
||||
@ -714,8 +716,11 @@ class gui(QtGui.QWidget):
|
||||
self.bench = QtGui.QLabel(self.viewport)
|
||||
self.bench.resize(VIEWPORT_W, VIEWPORT_H)
|
||||
bench = QtGui.QPixmap(AOpath + 'background/default/defensedesk.png')
|
||||
self.court.setPixmap(QtGui.QPixmap(AOpath + 'background/default/defenseempty.png').scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
self.bench.setPixmap(bench.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
court = QtGui.QPixmap(AOpath + 'background/default/defenseempty.png')
|
||||
if not court.isNull():
|
||||
self.court.setPixmap(court.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
if not bench.isNull():
|
||||
self.bench.setPixmap(bench.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
|
||||
self.effectview = AOMovie(self.viewport)
|
||||
|
||||
@ -835,6 +840,9 @@ class gui(QtGui.QWidget):
|
||||
|
||||
self.playerList = QtGui.QListWidget(self.gametab_players)
|
||||
self.playerList.itemClicked.connect(self.onClicked_playerList)
|
||||
self.playerPair = QtGui.QPushButton(self.gametab_players)
|
||||
self.playerPair.setText('Pair')
|
||||
self.playerPair.clicked.connect(self.onClicked_playerPair)
|
||||
self.playerKick = QtGui.QPushButton(self.gametab_players)
|
||||
self.playerKick.setText('Kick')
|
||||
self.playerKick.clicked.connect(self.onClicked_playerKick)
|
||||
@ -1206,15 +1214,17 @@ class gui(QtGui.QWidget):
|
||||
|
||||
def setEvidenceImg(self, guiobj, image, scale=False):
|
||||
if exists(AOpath + 'evidence/' + image):
|
||||
if scale:
|
||||
guiobj.setPixmap(QtGui.QPixmap(AOpath + "evidence/%s" % image).scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
img = QtGui.QPixmap(AOpath + "evidence/%s" % image)
|
||||
if not img.isNull() and scale:
|
||||
guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
else:
|
||||
guiobj.setPixmap(QtGui.QPixmap(AOpath + "evidence/%s" % image))
|
||||
guiobj.setPixmap(img)
|
||||
else:
|
||||
if scale:
|
||||
guiobj.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png').scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
img = QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png')
|
||||
if not img.isNull() and scale:
|
||||
guiobj.setPixmap(img.scaled(140, 140, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
||||
else:
|
||||
guiobj.setPixmap(QtGui.QPixmap(AO2XPpath + 'themes/default/evidence_selected.png'))
|
||||
guiobj.setPixmap(img)
|
||||
|
||||
if ini.read_ini_bool("AO2XP.ini", "General", "download evidence", True):
|
||||
url = "base/evidence/"+image.lower()
|
||||
@ -1398,7 +1408,7 @@ class gui(QtGui.QWidget):
|
||||
else:
|
||||
image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png')
|
||||
|
||||
if image.width() > 40:
|
||||
if not image.isNull() and image.width() > 40:
|
||||
self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation))
|
||||
else:
|
||||
self.emotebuttons[n_emote].setPixmap(image)
|
||||
@ -1487,12 +1497,26 @@ class gui(QtGui.QWidget):
|
||||
return QtGui.QMessageBox.warning(self, "Can't remove", 'There are no messages in the message queue.\nEnter a message on the Game chat to add one.')
|
||||
self.msgqueueList.takeItem(self.selectedmsg)
|
||||
del self.msgqueue[self.selectedmsg]
|
||||
|
||||
|
||||
def onClicked_playerPair(self):
|
||||
if not self.selectedplayer == -1:
|
||||
self.gametabs.setCurrentWidget(self.gametab_pair)
|
||||
self.paircheckbox.setChecked(True)
|
||||
char = self.playerlist[str(self.selectedplayer)][1]
|
||||
if char == '':
|
||||
return QtGui.QMessageBox.warning(self, "Unable to pair", 'That player has no character selected.')
|
||||
else:
|
||||
self.pairdropdown.setCurrentIndex([c[0] for c in self.charlist].index(char))
|
||||
else:
|
||||
return QtGui.QMessageBox.warning(self, 'No player selected', 'Select a player from the list to attempt pairing.')
|
||||
|
||||
def onClicked_playerKick(self):
|
||||
if not self.selectedplayer == -1:
|
||||
reason, ok = QtGui.QInputDialog.getText(self, "Kick a player", "Please enter the reason.", text="Being annoying")
|
||||
if reason and ok:
|
||||
self.tcp.send("MA#%s#0#%s#%%" % (self.selectedplayer, reason))
|
||||
else:
|
||||
return QtGui.QMessageBox.warning(self, 'No player selected', 'Select a player from the list to kick.')
|
||||
|
||||
def onClicked_playerBan(self):
|
||||
if not self.selectedplayer == -1:
|
||||
@ -1501,6 +1525,8 @@ class gui(QtGui.QWidget):
|
||||
duration, ok = QtGui.QInputDialog.getInt(self, "Ban a player", "Please enter the ban length in minutes.", 60, 1)
|
||||
if duration and ok:
|
||||
self.tcp.send("MA#%s#%s#%s#%%" % (self.selectedplayer, duration, reason))
|
||||
else:
|
||||
return QtGui.QMessageBox.warning(self, 'No player selected', 'Select a player from the list to ban.')
|
||||
|
||||
def changeEvidence(self, ind):
|
||||
if ind < 0:
|
||||
@ -1523,7 +1549,7 @@ class gui(QtGui.QWidget):
|
||||
else:
|
||||
image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(button.emoteid + self.current_emote_page * self.max_emotes_on_page + 1) + '_off.png')
|
||||
|
||||
if image.width() > 40:
|
||||
if not image.isNull() and image.width() > 40:
|
||||
button.setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation))
|
||||
else:
|
||||
button.setPixmap(image)
|
||||
@ -1991,7 +2017,7 @@ class gui(QtGui.QWidget):
|
||||
if hor_offset < 0 and vert_offset == 0:
|
||||
vert_offset = -1 * hor_offset / 10
|
||||
|
||||
self.char.move(256 * hor_offset / 100, 192 * vert_offset / 100)
|
||||
self.char.move(VIEWPORT_W * hor_offset / 100, VIEWPORT_H * vert_offset / 100)
|
||||
|
||||
# check if paired
|
||||
if not self.m_chatmessage[OTHER_CHARID]:
|
||||
@ -2035,13 +2061,13 @@ class gui(QtGui.QWidget):
|
||||
self.char.raise_()
|
||||
self.sidechar.raise_()
|
||||
elif pair_order == 0: # front
|
||||
self.char.raise_()
|
||||
self.sidechar.raise_()
|
||||
self.char.raise_()
|
||||
elif pair_order == 1: # behind
|
||||
self.sidechar.raise_()
|
||||
self.char.raise_()
|
||||
self.sidechar.raise_()
|
||||
|
||||
self.sidechar.move(256 * hor2_offset / 100, 192 * vert2_offset / 100)
|
||||
self.sidechar.move(VIEWPORT_W * hor2_offset / 100, VIEWPORT_H * vert2_offset / 100)
|
||||
|
||||
self.bench.raise_()
|
||||
self.chatbox.raise_()
|
||||
@ -2953,6 +2979,7 @@ class TCP_Thread(QtCore.QThread):
|
||||
color.setHsv(rainbow, 255, 255)
|
||||
while True:
|
||||
if self.parent.disconnectnow:
|
||||
self.parent.selectedplayer = -1
|
||||
self.parent.playerList.clear()
|
||||
self.parent.stopMusic()
|
||||
self.parent.tcp.close()
|
||||
|
Loading…
Reference in New Issue
Block a user