UnityLobby - Page 21

UnityLobby

Discuss everything related to running Spring on your chosen distribution of Linux.

Moderator: Moderators

Locked

What would u like to see implentent next (after next release should be tomorrow or day after at most)???

Poll ended at 20 Jul 2006, 01:04

Direct IP Multiplayer Games
7
54%
Chatroom (chat only for the moment)
1
8%
More Options for Configure Section
2
15%
More Options for Skirmish Section i.e colors teams spectators etc
3
23%
 
Total votes: 13

hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Image

New version just commited with some minor GUI changes.
And also user settings to change text for usernames in UserList in Lobby. See screenshot above.
Also fixed up some minor GUI update bugs in CLIENTSTATUS.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Image

Another version commited to svn.
Added User Options to change Battle Font Color for Battle ( Normal Battle , Battle in Progress).
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Just to get a feel for things I added some code to GUI_Lobby.py to sort the userlist, although the GUI still displays users in the order they were added. Right now it only sorts the list by username, but could easily be extended to sort by rank, ping, or country (if you can think of suitable total order relation for that one :)). Next up is tying the code to the interface somehow.
Last edited by Kloot on 22 Oct 2006, 14:08, edited 3 times in total.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Nice one :-)

Could add UI Option for user to decide it in lobby preferences class in GUI_Lobby.py.
But even just username is better than current scenario.

Btw normally if i am online u can get me on irc @
irc.freenode.net
#taspring
reg nick = hollowsoul

If u feel any code u got is ready for svn. Send it along & i upload to svn.

updated:- I try and get around to commiting more of UnityLobbys when i get a chance.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Yeah, I was thinking I might add sorting options to the preferences window. :) I'll let you know as soon as I have those built in.
Word
Posts: 80
Joined: 12 Jun 2006, 09:59

Post by Word »

I think instead of overloading the preferences you could have columns and when you click the column label it sorts by that column in desecnding order..click again ascending order etc. if you don't know what i'm talking about i'll find an example.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Well, the 'problem' with that approach is, I need to fit the labels in somewhere, preferably without cluttering up the interface. Since there are at least four ways to sort, that means four labels, and that means things might get a bit messy unless I copy how tasclient does it. :)
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Adding it to Lobby Perfernces shouldnt be to hard.
Especially since most of the sub sections arent done. Just basicing basic design atm off x-chat2.

Or even a popup mouse menu in user list to show sort options wouldnt be to hard either. Although want to add admin commands to that if your a mod.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

I didn't have enough time today to implement a sorting menu yet, but I did find the cause of the clientstatus() failures that occur when you leave a non-empty channel. Basically the code tries to find an index into self.lobby_channel_names for the p-th channel in a user's channel_list, eg...:

Code: Select all

channel_list = self.userlist[o].listChannels()
...
index = self.lobby_channel_names.index(channel_list[p])
...which throws an exception because neither OnChannelChatTabClick() nor RemoveChannelChatBuffer() update the channels for any user in self.userlist, so this needs some restructuring.

Some other issues I noticed that might be worth looking into:

1) Joining the same channel twice results in everything you say in the second being treated as if you said it in the first (also, everything you say in the first doesn't show up in the second), and only the first actually shows your input and your name in the userlist. Leaving the first channel renders the second one dead, leaving the second channel renders the first one dead. It should be simple to add a check to the command parser that prevents this mess though. :)

2) After leaving a channel, all user images (country flags, rank icons, etc) are no longer displayed in the userlist of any channel you later join.

3) Each GUI window always opens at postage-stamp size (100x75), which gets very old very fast when you are debugging stuff online and you constantly have to make them bigger. :) I'd suggest using some larger values, like 640 by 480 for the main window.

Also, I'm not really sure about the redundancy between self.userlist and the various channel ListStores in self.lobby_channel_users. It just seems sensitive to all sorts of mismatches to me, but... I don't know. Call it a gut feeling :)
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

0 ) Is already fixed in svn.
Was just broken when i changed over from storing user info in a gtk.Liststore to abstracted user info in classes.

1) Is a 1 line fix. Was calling on wrong function when receiving joinedfailed from server. Commited to svn

2) Care to hunt down the bug. Pain to hunt down bugs inside threads in python.
Thus all the try: except: to try & catch the errors.

3) Is default window size with all the widgets in them.
Ideally code back solution i had before i add dockapp.
Basicly have app will save window sizes into config file. Either save windows when closing UnityLobby or when pressing X on windows.

4) Need self.userlist to store user data. Due to Lobby Protocol. When u join server it sends all users info on lobby server via ADDUSER.
Need to store this info somewhere. And this info will get updated via CLIENTSTATUS.

Also self.userlist stores Channel Names & PM user is displayed in UserLists for chat tabs. This way when client receives CLIENTSTATUS, it doesnt need to search every UserList to find the user & update his image in each chat tab.

As for mis-matches... Lobby Protocol -> self.userlist -> Battle List || User List
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Will go after 2 and 3 tomorrow.

BTW, I added a simple version check for GTK/PyGTK to Unity.py so it doesn't crash if a user doesn't have the right one of either, just import gtk_version and pygtk_version from gtk and do:

Code: Select all

if __name__ == "__main__":
    if (gtk_version >= (2, 10, 0) and pygtk_version >= (2, 10, 0)):
        (main stuff)
    else:
        print "error: UnityLobby requires at least GTK 2.10.0 and PyGTK 2.10.0, your versions of GTK and PyGTK are", gtk_version, " and ", pygtk_version
Last edited by Kloot on 23 Oct 2006, 11:25, edited 1 time in total.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Nice kloot gonna commit now. btw for future want your name added to header for files ?

Anyway working on Battle Layout atm
  • Added in gtk.CellRendererCombo ( team / ally / bonus) into gtk.TreeView
    Just got code in gtk.CellRendererCombo aswell.
    And Rename def foo: & add commits to Battle.py
    Then Commit
Then gonna to start @ Lobby Protocols for Battles for BATTLESTATUS etc...

Btw u can find the Lobby docs in trunk/Documenation/Lobby/LobbyProtocol.txt

Question, incase u know of answer & been bugging me awhile (for CLIENTSTATUS). Any nice way to see if user been AFK in X11 or app itself ?
So can automaticly turn user status to afk

Also like to change color selection to just clicking on Color Image, not sure how / if it can be done though.Add signal to it ?

updated
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

As for mentioning my name... maybe after I've made some actual contributions, right now I'm still just catching up so it'd be premature and not really justified anyway :)

Re: an AFK timer: you'd need to have a background thread that checked every X seconds whether (currentTime - lastActiveTime) > someThresholdVal and if so updated the user status (and currentTime no matter what obviously). I do know a way of getting the lastActiveTime from GTK using time.clock() by registering events (like key or mousebutton presses) with a window, eg...:

Code: Select all

import gtk
import time

def processEvent(widget, event):
        lastActiveTime = time.clock()

win = gtk.Window()
win.add_events(gtk.gdk.KEY_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.SCROLL_MASK)
win.connect("motion-notify-event", processEvent)
win.connect("key-press-event", processEvent)
win.connect("button-press-event", processEvent)
win.connect("scroll-event", processEvent)
win.show()

gtk.main()
...but the downside is that this only works when the window is active, not when it is minimized or another window has the focus. If you wanted Unity to be aware of stuff outside itself you'd have to poll the WM/OS probably.

No real ideas about the color selection thing yet, never tried something like that before.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Fixed the join/leave/join icon-disappearance bug. Replace RemoveChannelChatBuffer() by...

Code: Select all

def RemoveChannelChatBuffer(self, channel_name):
  try:
    for o in range(0, len(self.userlist)):
      if (self.userlist[o].name == self.username):
          self.userlist[o].leaveChannel(channel_name)

    for i in range(0, len(self.lobby_channel_names)):
      if (self.lobby_channel_names[i] == channel_name):
          self.lobby_channel_names.pop(i)                  ## remove i-th channel name
          self.lobby_channel_buffers.pop(i)                  ## remove i-th textbuffer
          self.lobby_channel_textview.pop(i)                ## remove i-th textview

          self.lobby_channel_users_columns.pop(i)    ## should always be idx of channel!
          self.lobby_channel_users_cells.pop(i)           ## should always be idx of channel!
          self.lobby_channel_users.pop(i)                     ## remove i-th liststore

          for notebookPageNum in range(0, self.lobby_notebook.get_n_pages()):
            vPane = self.lobby_channel_vpanes[i]
            notebookPage = self.lobby_notebook.get_nth_page(notebookPageNum)

            if (vPane == notebookPage):
              self.lobby_notebook.remove_page(notebookPageNum)
              self.lobby_channel_vpanes.pop(i)
              return

  except Exception, inst:
    print 'RemoveChannelChatBuffer failure'
    ...
... and that should be it. RemovePMChatBuffer() obviously requires the same fix.

If I may give you a piece of advice, though... as you said debugging threaded code isn't easy, but it's even more painful when half of the program consists of criticial sections and the other half doesn't. :) I Maybe it's an idea to centralize and abstract those out and have a dedicated class handling all critical tasks for each GUI element?

Edit: this might be old news since I haven't checked-out the latest SVN yet, but just FYI, UpdateBattleNat() and UpdateBattleFontColor() now produce TypeErrors on the lines

Code: Select all

cell.set_property('pixbuf', pixbuf)
and

Code: Select all

cell.set_property('foreground-gdk', color)
respectively.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

FYI: Ubuntu 6.10 (with pygtk 2.10) and FC6 (dunno which pygtk, I assume 2.10 though) shipped very recently. Time for a binary beta release ^^ If it allowed to start the game with wine, it'd be 100% pure win.
own3d
Posts: 129
Joined: 25 Aug 2006, 16:31

Post by own3d »

Well its open source I'm sure you could get it to execute a bash script which runs TAS in wine what I don't know is how you would get it go into games that you've joined. Probably better to not reinvent the wheel and wait for the next release.

Or just use wine in the first place.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

I do, but the lobby doesn't work very well. The rest I can cope with.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

As for UnityLobby starting up spring in wine.
That will envolve abit of work. It be alot easier just to write a patch for UnityLobby to read / set values in windows registry. Then UnityLobby will have windows support & just run it inside wine.

Update
Anyway commited Kloot's fix for user panels in chat.
Also minor fix for PMing (not sure if it was broken in my local copy or in svn).

@ Kloot
Cheers kloot for hunting that bug down. Been plaguing me for awhile & only recently became more noticeable for some damn reason :)

As for abstracting GUI out.
Sounds like alot of work imo and i barely got time as it is.
More than welcomed to code it if u want to & got the time.

Atm only Lobby.py & parts of GUI_Lobby are outside the gtk main thread. Rest of code if i recall right is inside the gtk main thread.
So only really Lobby code to worry about debugging.

As for UpdateBattleNat() and UpdateBattleFontColor() gonna take alot at them in abit & see whats wrong.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Another Commit

Added gtk.CellRendererSpin to Battle gtk.TreeView.
Basicly u can click on Army / Ally / Bonus Numbers and u will see a spinner box to change the values. Remove the entries in popup menu aswell.

Will remove the function ChangeValue() once i figure out gtk.CellRendererCombo. Since ChangeValue is only called when user changes a player / bot side now.

@ Kloot
As for errors in GUI_Lobby.py.
Not sure, havent the error today. Maybe i fixed them last week, not sure though.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

I'll probably have time this week to do some restructuring, and maybe to finish the sorting code as well... which I got a bit side-tracked on TBH because I couldn't figure out how to retrieve the active channel and was worried about concurrency issues between my code and anything else that touched the liststores, like clients(). :)

Oh before I forget, there's still one small thing I don't understand concerning RemoveChannelChatBuffer() that I'd like to ask you about... why do you tell everyone to leave the channel rather than just the user who closes it? eg.:

Code: Select all

for o in range(0, len(self.userlist)):
    self.userlist[o].leaveChannel(channel_name)
vs.

Code: Select all

for o in range(0, len(self.userlist)):
      if (self.userlist[o].name == self.username):
          self.userlist[o].leaveChannel(channel_name)
Locked

Return to “Linux”