character search + stay on page + refactor
This commit is contained in:
parent
43074f567c
commit
d821440a49
@ -24,11 +24,18 @@ class charselect(QtGui.QWidget):
|
||||
def __init__(self, parent):
|
||||
super(charselect, self).__init__(parent)
|
||||
self.parent = parent
|
||||
self.populated = 0
|
||||
self.page = 0
|
||||
self.dropdownloaded = 0
|
||||
self.image = QtGui.QLabel(self)
|
||||
self.image.setPixmap(QtGui.QPixmap(AO2XPpath+"themes/default/charselect_background.png"))
|
||||
self.image.show()
|
||||
|
||||
self.charDropdown = QtGui.QComboBox(self)
|
||||
self.charDropdown.setEditable(True)
|
||||
self.charDropdown.setGeometry(255, 5, 200, 30) # Position and size of the dropdown
|
||||
self.charDropdown.currentIndexChanged.connect(self.onDropdownSelect)
|
||||
|
||||
self.quittolobby = QtGui.QPushButton(self)
|
||||
self.quittolobby.setText("Disconnect")
|
||||
self.quittolobby.resize(self.quittolobby.sizeHint())
|
||||
@ -80,10 +87,16 @@ class charselect(QtGui.QWidget):
|
||||
def setPic(self, pixmap, ind):
|
||||
self.buttons[ind].setPixmap(QtGui.QPixmap(pixmap))
|
||||
|
||||
def populateCharacterDropdown(self):
|
||||
for char in self.charlist:
|
||||
self.charDropdown.addItem(char[0])
|
||||
self.populated = 1
|
||||
|
||||
def setCharList(self, charlist):
|
||||
self.charlist = charlist
|
||||
self.page = 0
|
||||
self.showCharPage()
|
||||
if self.populated == 0:
|
||||
self.populateCharacterDropdown()
|
||||
|
||||
def nextPageButton(self):
|
||||
self.page += 1
|
||||
@ -135,7 +148,14 @@ class charselect(QtGui.QWidget):
|
||||
self.parent.gamewindow.setFixedSize(self.parent.width, self.parent.height)
|
||||
self.parent.gamewindow.center()
|
||||
return
|
||||
self.parent.tcp.send("CC#0#"+str(ind+(self.page*self.max_chars_on_page))+"#ur mom gay#%")
|
||||
self.selectChar(ind+(self.page*self.max_chars_on_page))
|
||||
|
||||
def onDropdownSelect(self, index):
|
||||
if self.dropdownloaded == 1: self.selectChar(index)
|
||||
self.dropdownloaded = 1
|
||||
|
||||
def selectChar(self, charIndex):
|
||||
self.parent.tcp.send("CC#0#"+str(charIndex)+"#ur mom gay#%")
|
||||
|
||||
def show(self):
|
||||
super(charselect, self).show()
|
||||
|
@ -2973,7 +2973,7 @@ class gui(QtGui.QWidget):
|
||||
break
|
||||
|
||||
if coincidence > -1:
|
||||
self.tcp.send("CC#0#"+str(coincidence)+"#ur mom gay#%")
|
||||
self.charselect.selectChar(coincidence)
|
||||
else:
|
||||
self.charselect.show()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user