revert some changes from commit 7f4043546e
as they broke the client + added cancel button on charlist
This commit is contained in:
parent
cf4b58b011
commit
ac75a9eeb1
@ -24,22 +24,31 @@ class charselect(QtGui.QWidget):
|
||||
def __init__(self, parent):
|
||||
super(charselect, self).__init__(parent)
|
||||
self.parent = parent
|
||||
# self.populated = 0
|
||||
self.populated = False
|
||||
self.dropdownloaded = False
|
||||
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.move(255, 7)
|
||||
self.charDropdown.resize(200, self.charDropdown.sizeHint().height())
|
||||
self.charDropdown.currentIndexChanged.connect(self.onDropdownSelect)
|
||||
self.charDropdown.setToolTip("Select a character from the list")
|
||||
|
||||
self.quittolobby = QtGui.QPushButton(self)
|
||||
self.quittolobby.setText("Disconnect")
|
||||
self.quittolobby.resize(self.quittolobby.sizeHint())
|
||||
self.quittolobby.clicked.connect(self.quitToLobby)
|
||||
self.quittolobby.move(714 - 25 - self.quittolobby.size().width(), 6)
|
||||
|
||||
self.cancelbtn = QtGui.QPushButton(self)
|
||||
self.cancelbtn.setText("Cancel")
|
||||
self.cancelbtn.resize(self.cancelbtn.sizeHint())
|
||||
self.cancelbtn.clicked.connect(self.onCancel)
|
||||
self.cancelbtn.move(25, self.quittolobby.y())
|
||||
|
||||
self.buttons = []
|
||||
self.chartaken = []
|
||||
@ -91,12 +100,12 @@ class charselect(QtGui.QWidget):
|
||||
self.charDropdown.clear()
|
||||
for char in self.charlist:
|
||||
self.charDropdown.addItem(char[0])
|
||||
# self.populated = 1
|
||||
self.populated = True
|
||||
|
||||
def setCharList(self, charlist):
|
||||
self.charlist = charlist
|
||||
self.showCharPage()
|
||||
# if self.populated == 0:
|
||||
if not self.populated:
|
||||
self.populateCharacterDropdown()
|
||||
|
||||
def nextPageButton(self):
|
||||
@ -145,19 +154,24 @@ class charselect(QtGui.QWidget):
|
||||
|
||||
def onCharClicked(self, ind):
|
||||
if self.parent.charname.lower() == self.charlist[ind + self.page * self.max_chars_on_page][0].lower():
|
||||
self.hide()
|
||||
self.parent.gamewindow.setFixedSize(self.parent.width, self.parent.height)
|
||||
self.parent.gamewindow.center()
|
||||
self.onCancel()
|
||||
return
|
||||
self.selectChar(ind+(self.page*self.max_chars_on_page))
|
||||
|
||||
def onDropdownSelect(self, index):
|
||||
if self.dropdownloaded == 1: self.selectChar(index)
|
||||
self.dropdownloaded = 1
|
||||
if self.dropdownloaded:
|
||||
self.selectChar(index)
|
||||
else:
|
||||
self.dropdownloaded = True
|
||||
|
||||
def selectChar(self, charIndex):
|
||||
self.parent.tcp.send("CC#0#"+str(charIndex)+"#ur mom gay#%")
|
||||
|
||||
def onCancel(self):
|
||||
self.hide()
|
||||
self.parent.gamewindow.setFixedSize(self.parent.width, self.parent.height)
|
||||
self.parent.gamewindow.center()
|
||||
|
||||
def show(self):
|
||||
super(charselect, self).show()
|
||||
self.parent.gamewindow.setFixedSize(714, 668)
|
||||
|
@ -1853,8 +1853,6 @@ class gui(QtGui.QWidget):
|
||||
self.gamewindow.returnToMenu()
|
||||
|
||||
def disconnectCommon(self):
|
||||
#negro donde mierda pongo esto
|
||||
self.charselect.populated = 0
|
||||
self.onSwitchInventory(True)
|
||||
self.selectedplayer = -1
|
||||
self.playerList.clear()
|
||||
@ -1863,6 +1861,7 @@ class gui(QtGui.QWidget):
|
||||
self.ooclogin.setText("Login")
|
||||
self.login = False
|
||||
self.privateinv = False
|
||||
self.charselect.populated = False
|
||||
self.tcp.close()
|
||||
self.stopMusic()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user