Okay It has been some days that I'm looking for modifying that (I've never used python in the past and I'm not a heavy coder. I'm rather doing that for fun, trying stuff, and help a bit maybe if I can).
So I've succeeded in making the list of users sorted by country(or even custom rating, but it can be whatever, it's just for test).
I've also added the "Sort users by country" when you right click on a user in the list of users . But uh, I've no clue on how to do more...
To add another choice/option when you right click on a user (for example ) :
In chatter.py
- Code: Select all
def pressed(self, item):
(..)
actionSortUsersByCountry = QtGui.QAction("Sort users by country", menu)
(..)
menu.addAction(actionSortUsersByCountry)
First problem (the blind one):
So yeah I'm happy, I've added this button but it's just "shown", it does nothing, if I wanted for example to add a message on the tab "Server" (the thing no one looks on it...) with self.serverLogArea.appendPlainText("You clicked on sort by country, gj") or Debug.message (I don't remember the exact name of the function, but it's not that hard to find the exact name, anyway it's not important), I don't even know where to add that line to make it happen when I click on "sort users by country". I must be blind...
Second one (the wtf one):
I can sort the users when you connect, but I don't see where the call for showing the list is made.
So to be able to sort by country I've just modified the __lt__ function in chatter.py .
So I look in all the files of the source code of the client where the "__lt__" is written, to find it and to see who is calling it to sort the users in the list of users of chat).
So __ge__ is calling it. and that's all. and no one is calling __ge__(did the same, looked in all the files of the source code of the client), what kind of sorcery is that?
Obviously, I'm wrong the __lt__ or/and __gt__ is called, it's not a useless code, and if it was the case it shouldn't have an impact on the lobby(the list of users shouldn't be sorted), but, uh, dunno what to think about that.