assorted improvements to charselect
This commit is contained in:
parent
57ec422712
commit
bfc5d0869a
@ -98,9 +98,14 @@ class charselect(QtGui.QWidget):
|
|||||||
def populateCharacterDropdown(self):
|
def populateCharacterDropdown(self):
|
||||||
self.charDropdown.clear()
|
self.charDropdown.clear()
|
||||||
self.charDropdown.addItem("")
|
self.charDropdown.addItem("")
|
||||||
for char in self.charlist:
|
model = self.charDropdown.model()
|
||||||
self.charDropdown.addItem(char[0])
|
|
||||||
self.populated = True
|
self.populated = True
|
||||||
|
|
||||||
|
# Disable characters not in filesystem
|
||||||
|
# for i, char in enumerate(self.charlist):
|
||||||
|
# self.charDropdown.addItem(char[0])
|
||||||
|
# if not char[3]:
|
||||||
|
# model.item(i + 1).setEnabled(False)
|
||||||
|
|
||||||
def setCharList(self, charlist):
|
def setCharList(self, charlist):
|
||||||
self.charlist = charlist
|
self.charlist = charlist
|
||||||
@ -115,6 +120,10 @@ class charselect(QtGui.QWidget):
|
|||||||
def prevPageButton(self):
|
def prevPageButton(self):
|
||||||
self.page -= 1
|
self.page -= 1
|
||||||
self.showCharPage()
|
self.showCharPage()
|
||||||
|
|
||||||
|
def showCharSelect(self, can_cancel = True):
|
||||||
|
self.show()
|
||||||
|
self.cancelbtn.setEnabled(can_cancel)
|
||||||
|
|
||||||
def showCharPage(self):
|
def showCharPage(self):
|
||||||
for ind in range(self.page * self.max_chars_on_page, self.max_chars_on_page * (self.page+1)):
|
for ind in range(self.page * self.max_chars_on_page, self.max_chars_on_page * (self.page+1)):
|
||||||
@ -133,8 +142,6 @@ class charselect(QtGui.QWidget):
|
|||||||
self.prevpage.hide()
|
self.prevpage.hide()
|
||||||
|
|
||||||
char = self.charlist[ind][0].lower()
|
char = self.charlist[ind][0].lower()
|
||||||
if not exists(AOpath+"characters/"+ char):
|
|
||||||
print char, "doesn't exist"
|
|
||||||
if exists(AOpath+"characters/"+ char +"/char_icon.png"): # AO2
|
if exists(AOpath+"characters/"+ char +"/char_icon.png"): # AO2
|
||||||
self.setBtnImage.emit(AOpath+"characters/"+ char +"/char_icon.png", i)
|
self.setBtnImage.emit(AOpath+"characters/"+ char +"/char_icon.png", i)
|
||||||
elif exists(AOpath+"misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8
|
elif exists(AOpath+"misc/demothings/"+ char +"_char_icon.png"): # AO 1.7.5/1.8
|
||||||
@ -155,13 +162,14 @@ class charselect(QtGui.QWidget):
|
|||||||
self.buttons[ind].setPixmap(QtGui.QPixmap(filename))
|
self.buttons[ind].setPixmap(QtGui.QPixmap(filename))
|
||||||
|
|
||||||
def onCharClicked(self, ind):
|
def onCharClicked(self, ind):
|
||||||
if self.parent.charname.lower() == self.charlist[ind + self.page * self.max_chars_on_page][0].lower():
|
char = self.charlist[ind + self.page * self.max_chars_on_page]
|
||||||
|
if self.parent.charname.lower() == char[0].lower():
|
||||||
self.onCancel()
|
self.onCancel()
|
||||||
return
|
return
|
||||||
self.selectChar(ind+(self.page*self.max_chars_on_page))
|
self.selectChar(ind+(self.page*self.max_chars_on_page))
|
||||||
|
|
||||||
def onDropdownSelect(self, index):
|
def onDropdownSelect(self, index):
|
||||||
if index == 0 or self.charDropdown.count() == 1:
|
if index < 1 or self.charDropdown.count() <= 1:
|
||||||
return
|
return
|
||||||
self.selectChar(index - 1)
|
self.selectChar(index - 1)
|
||||||
|
|
||||||
|
21
gameview.py
21
gameview.py
@ -1086,18 +1086,20 @@ class gui(QtGui.QWidget):
|
|||||||
self.prevemotepage.hide()
|
self.prevemotepage.hide()
|
||||||
self.nextemotepage = NextEmoteButton(self, 282 + 516, 253+190-28)
|
self.nextemotepage = NextEmoteButton(self, 282 + 516, 253+190-28)
|
||||||
self.nextemotepage.show()
|
self.nextemotepage.show()
|
||||||
|
|
||||||
self.realizationbtn = buttons.AOToggleButton(self, 265 + 164, 192 + 304, "realization")
|
self.realizationbtn = buttons.AOToggleButton(self, 265 + 164, 192 + 304, "realization")
|
||||||
self.realizationbtn.clicked.connect(self.onRealizationButton)
|
self.realizationbtn.clicked.connect(self.onRealizationButton)
|
||||||
self.realizationbtn.setToolTip('Show the next message with a realization effect')
|
self.realizationbtn.setToolTip('Show the next message with a realization effect')
|
||||||
self.realizationsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-realization.wav', 0, 0, 0)
|
self.realizationsnd = audio.loadhandle(False, AOpath + 'sounds/general/sfx-realization.wav', 0, 0, 0)
|
||||||
|
|
||||||
self.shakebtn = buttons.AOToggleButton(self, 265+42 + 164, 192 + 304, "screenshake") # AO 2.8
|
self.shakebtn = buttons.AOToggleButton(self, 265+42 + 164, 192 + 304, "screenshake") # AO 2.8
|
||||||
self.shakebtn.setToolTip('Show the next message with a shaking effect')
|
self.shakebtn.setToolTip('Show the next message with a shaking effect')
|
||||||
self.customobject = buttons.CustomObjection(self, 250 + 516 - 30, 312 + 40)
|
self.customobject = buttons.CustomObjection(self, 250 + 516 - 30, 312 + 40)
|
||||||
|
|
||||||
self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3)
|
self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3)
|
||||||
self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2)
|
self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2)
|
||||||
self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1)
|
self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1)
|
||||||
self.objectsnd = 0
|
self.objectsnd = 0
|
||||||
|
|
||||||
self.defensebar = buttons.PenaltyBars(self, 1)
|
self.defensebar = buttons.PenaltyBars(self, 1)
|
||||||
self.prosecutionbar = buttons.PenaltyBars(self, 2)
|
self.prosecutionbar = buttons.PenaltyBars(self, 2)
|
||||||
self.defensebar.minusClicked.connect(self.penaltyBarMinus)
|
self.defensebar.minusClicked.connect(self.penaltyBarMinus)
|
||||||
@ -1494,9 +1496,14 @@ class gui(QtGui.QWidget):
|
|||||||
self.prevemotepage.hide()
|
self.prevemotepage.hide()
|
||||||
self.nextemotepage.hide()
|
self.nextemotepage.hide()
|
||||||
|
|
||||||
total_emotes = ini.read_ini_int(AOpath+"characters/"+self.charname+"/char.ini", "emotions", "number", 1)
|
total_emotes = len(self.charemotes)
|
||||||
|
|
||||||
for button in self.emotebuttons:
|
for button in self.emotebuttons:
|
||||||
button.hide()
|
button.hide()
|
||||||
|
|
||||||
|
if not total_emotes:
|
||||||
|
print "[client] The selected character appears to have no emotions defined"
|
||||||
|
return
|
||||||
|
|
||||||
total_pages = total_emotes / self.max_emotes_on_page
|
total_pages = total_emotes / self.max_emotes_on_page
|
||||||
emotes_on_page = 0
|
emotes_on_page = 0
|
||||||
@ -1519,7 +1526,7 @@ class gui(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png')
|
image = QtGui.QPixmap(AOpath + 'characters/' + self.charname + '/emotions/button' + str(n_real_emote + 1) + '_off.png')
|
||||||
|
|
||||||
if not image.isNull() and image.width() > 40:
|
if not image.isNull() and not image.width() == 40:
|
||||||
self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation))
|
self.emotebuttons[n_emote].setPixmap(image.scaled(40, 40, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.FastTransformation))
|
||||||
else:
|
else:
|
||||||
self.emotebuttons[n_emote].setPixmap(image)
|
self.emotebuttons[n_emote].setPixmap(image)
|
||||||
@ -1726,7 +1733,7 @@ class gui(QtGui.QWidget):
|
|||||||
|
|
||||||
def onClick_changeChar(self):
|
def onClick_changeChar(self):
|
||||||
#self.tcp.send('RD#%')
|
#self.tcp.send('RD#%')
|
||||||
self.charselect.show()
|
self.charselect.showCharSelect()
|
||||||
|
|
||||||
def changeFlipCheck(self, on):
|
def changeFlipCheck(self, on):
|
||||||
if on == 2:
|
if on == 2:
|
||||||
@ -1861,7 +1868,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.ooclogin.setText("Login")
|
self.ooclogin.setText("Login")
|
||||||
self.login = False
|
self.login = False
|
||||||
self.privateinv = False
|
self.privateinv = False
|
||||||
self.charselect.populated = False
|
self.charselect.onDisconnect()
|
||||||
self.tcp.close()
|
self.tcp.close()
|
||||||
self.stopMusic()
|
self.stopMusic()
|
||||||
|
|
||||||
@ -2980,7 +2987,7 @@ class gui(QtGui.QWidget):
|
|||||||
if coincidence > -1:
|
if coincidence > -1:
|
||||||
self.charselect.selectChar(coincidence)
|
self.charselect.selectChar(coincidence)
|
||||||
else:
|
else:
|
||||||
self.charselect.show()
|
self.charselect.showCharSelect(False)
|
||||||
|
|
||||||
#putting it down here because some servers won't allow you to switch areas without picking a character first
|
#putting it down here because some servers won't allow you to switch areas without picking a character first
|
||||||
autojoinarea = get_option("General", "auto join area").decode('utf-8')
|
autojoinarea = get_option("General", "auto join area").decode('utf-8')
|
||||||
@ -3089,7 +3096,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.tcpthread.OOC_Log.connect(self.ooclog.append)
|
self.tcpthread.OOC_Log.connect(self.ooclog.append)
|
||||||
self.tcpthread.IC_Log.connect(self.icLog.append)
|
self.tcpthread.IC_Log.connect(self.icLog.append)
|
||||||
self.tcpthread.charSlots.connect(partial(self.charselect.setCharList, self.charlist))
|
self.tcpthread.charSlots.connect(partial(self.charselect.setCharList, self.charlist))
|
||||||
self.tcpthread.showCharSelect.connect(self.charselect.show)
|
self.tcpthread.showCharSelect.connect(self.charselect.showCharSelect)
|
||||||
self.tcpthread.allEvidence.connect(self.allEvidence)
|
self.tcpthread.allEvidence.connect(self.allEvidence)
|
||||||
self.tcpthread.updatePlayerList.connect(self.updatePlayerList)
|
self.tcpthread.updatePlayerList.connect(self.updatePlayerList)
|
||||||
self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
|
self.tcpthread.rainbowColor.connect(self.text.setStyleSheet)
|
||||||
|
@ -556,7 +556,12 @@ class AOServerInfo(QtCore.QThread):
|
|||||||
continue
|
continue
|
||||||
del network[0]
|
del network[0]
|
||||||
gotChars = True
|
gotChars = True
|
||||||
charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male"] for char in network ]
|
charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ]
|
||||||
|
|
||||||
|
# Disable characters not found in filesystem
|
||||||
|
for char in charlist:
|
||||||
|
if not exists(AOpath+"characters/" + char[0].lower()):
|
||||||
|
char[3] = False
|
||||||
|
|
||||||
self.setConnectProgress.emit('Requesting music list (%d)...' % maxmusic)
|
self.setConnectProgress.emit('Requesting music list (%d)...' % maxmusic)
|
||||||
self.tcp.send('RM#%')
|
self.tcp.send('RM#%')
|
||||||
|
Loading…
Reference in New Issue
Block a user