comparison orpg/player_list.py @ 152:6081bdc2b8d5 beta

Traipse Beta 'OpenRPG' {091125-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Wed, 25 Nov 2009 06:16:35 -0600
parents c54768cffbd4
children dcae32e219f1
comparison
equal deleted inserted replaced
150:6c5f46a5924b 152:6081bdc2b8d5
53 PLAYER_MODERATE_GIVE_VOICE = wx.NewId() 53 PLAYER_MODERATE_GIVE_VOICE = wx.NewId()
54 PLAYER_MODERATE_TAKE_VOICE = wx.NewId() 54 PLAYER_MODERATE_TAKE_VOICE = wx.NewId()
55 PLAYER_SHOW_VERSION = wx.NewId() 55 PLAYER_SHOW_VERSION = wx.NewId()
56 WG_LIST = {} 56 WG_LIST = {}
57 57
58 #---------------------------------------------------------
59 # [START] Digitalxero Multi Whisper Group 1/1/05
60 #---------------------------------------------------------
61 PLAYER_WG_MENU = wx.NewId() 58 PLAYER_WG_MENU = wx.NewId()
62 PLAYER_WG_CREATE = wx.NewId() 59 PLAYER_WG_CREATE = wx.NewId()
63 PLAYER_WG_CLEAR_ALL = wx.NewId() 60 PLAYER_WG_CLEAR_ALL = wx.NewId()
64 WG_MENU_LIST = {} 61 WG_MENU_LIST = {}
65 #--------------------------------------------------------- 62
66 # [END] Digitalxero Multi Whisper Group 1/1/05
67 #---------------------------------------------------------
68
69 #---------------------------------------------------------
70 # [START] Snowdog Password/Room Name altering code 12/02
71 #---------------------------------------------------------
72 PLAYER_COMMAND_MENU = wx.NewId() 63 PLAYER_COMMAND_MENU = wx.NewId()
73 PLAYER_COMMAND_PASSWORD_ALTER = wx.NewId() 64 PLAYER_COMMAND_PASSWORD_ALTER = wx.NewId()
74 PLAYER_COMMAND_ROOM_RENAME = wx.NewId() 65 PLAYER_COMMAND_ROOM_RENAME = wx.NewId()
75 #--------------------------------------------------------- 66
76 # [END] Snowdog Password/Room Name altering code 12/02
77 #---------------------------------------------------------
78 67
79 class player_list(wx.ListCtrl): 68 class player_list(wx.ListCtrl):
80 def __init__( self, parent): 69 def __init__( self, parent):
81 wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, 70 wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize,
82 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES ) 71 wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES )
94 self.SetImageList( self._imageList, wx.IMAGE_LIST_SMALL ) 83 self.SetImageList( self._imageList, wx.IMAGE_LIST_SMALL )
95 # Create our column headers 84 # Create our column headers
96 self.InsertColumn( 0, "ID" ) 85 self.InsertColumn( 0, "ID" )
97 self.InsertColumn( 1, "Player") 86 self.InsertColumn( 1, "Player")
98 self.InsertColumn( 2, "Status" ) 87 self.InsertColumn( 2, "Status" )
99 #--------------------------------------------------------- 88
100 # [START] Digitalxero Multi Whisper Group 1/1/05
101 #---------------------------------------------------------
102 ##Main Menu 89 ##Main Menu
103 self.wgMenu = wx.Menu() 90 self.wgMenu = wx.Menu()
104 #Add the Base Menu items, so they are always at the bottom 91 #Add the Base Menu items, so they are always at the bottom
105 self.wgMenu.Append(PLAYER_WG_CREATE, "Create") 92 self.wgMenu.Append(PLAYER_WG_CREATE, "Create")
106 self.wgMenu.Append(PLAYER_WG_CLEAR_ALL, "Delete All Groups") 93 self.wgMenu.Append(PLAYER_WG_CLEAR_ALL, "Delete All Groups")
107 #--------------------------------------------------------- 94
108 # [END] Digitalxero Multi Whisper Group 1/1/05
109 #---------------------------------------------------------
110 # Create the role menu 95 # Create the role menu
111 self.roleMenu = wx.Menu() 96 self.roleMenu = wx.Menu()
112 self.roleMenu.SetTitle( "Assign Role" ) 97 self.roleMenu.SetTitle( "Assign Role" )
113 self.roleMenu.Append( PLAYER_ROLE_LURKER, "Lurker" ) 98 self.roleMenu.Append( PLAYER_ROLE_LURKER, "Lurker" )
114 self.roleMenu.Append( PLAYER_ROLE_PLAYER, "Player" ) 99 self.roleMenu.Append( PLAYER_ROLE_PLAYER, "Player" )
119 self.moderateMenu.Append( PLAYER_MODERATE_ROOM_ON, "Room Moderation ON" ) 104 self.moderateMenu.Append( PLAYER_MODERATE_ROOM_ON, "Room Moderation ON" )
120 self.moderateMenu.Append( PLAYER_MODERATE_ROOM_OFF, "Room Moderation OFF" ) 105 self.moderateMenu.Append( PLAYER_MODERATE_ROOM_OFF, "Room Moderation OFF" )
121 self.moderateMenu.AppendSeparator() 106 self.moderateMenu.AppendSeparator()
122 self.moderateMenu.Append( PLAYER_MODERATE_GIVE_VOICE, "Give Voice" ) 107 self.moderateMenu.Append( PLAYER_MODERATE_GIVE_VOICE, "Give Voice" )
123 self.moderateMenu.Append( PLAYER_MODERATE_TAKE_VOICE, "Take Voice" ) 108 self.moderateMenu.Append( PLAYER_MODERATE_TAKE_VOICE, "Take Voice" )
124 #--------------------------------------------------------- 109
125 # [START] Snowdog Password/Room Name altering code 12/02
126 #---------------------------------------------------------
127 # Create the room control menu 110 # Create the room control menu
128 self.commandMenu = wx.Menu() 111 self.commandMenu = wx.Menu()
129 self.commandMenu.SetTitle( "Room Controls" ) 112 self.commandMenu.SetTitle( "Room Controls" )
130 self.commandMenu.Append( PLAYER_COMMAND_PASSWORD_ALTER, "Password" ) 113 self.commandMenu.Append( PLAYER_COMMAND_PASSWORD_ALTER, "Password" )
131 self.commandMenu.Append( PLAYER_COMMAND_ROOM_RENAME, "Room Name" ) 114 self.commandMenu.Append( PLAYER_COMMAND_ROOM_RENAME, "Room Name" )
132 self.commandMenu.AppendSeparator() 115 self.commandMenu.AppendSeparator()
133 #--------------------------------------------------------- 116
134 # [END] Snowdog Password/Room Name altering code 12/02
135 #---------------------------------------------------------
136 # Create the pop up menu 117 # Create the pop up menu
137 self.menu = wx.Menu() 118 self.menu = wx.Menu()
138 self.menu.SetTitle( "Player Menu" ) 119 self.menu.SetTitle( "Player Menu" )
139 self.menu.Append( PLAYER_BOOT, "Boot" ) 120 self.menu.Append( PLAYER_BOOT, "Boot" )
140 self.menu.AppendSeparator() 121 self.menu.AppendSeparator()
141 self.menu.Append( PLAYER_IGNORE, "Toggle &Ignore" ) 122 self.menu.Append( PLAYER_IGNORE, "Toggle &Ignore" )
142 self.menu.AppendSeparator() 123 self.menu.AppendSeparator()
143 self.menu.Append( PLAYER_WHISPER, "Whisper" ) 124 self.menu.Append( PLAYER_WHISPER, "Whisper" )
144 #---------------------------------------------------------
145 # [START] Digitalxero Multi Whisper Group 1/1/05
146 #---------------------------------------------------------
147 self.menu.AppendMenu(PLAYER_WG_MENU, "Whisper Groups", self.wgMenu) 125 self.menu.AppendMenu(PLAYER_WG_MENU, "Whisper Groups", self.wgMenu)
148 #---------------------------------------------------------
149 # [END] Digitalxero Multi Whisper Group 1/1/05
150 #---------------------------------------------------------
151 self.menu.AppendSeparator() 126 self.menu.AppendSeparator()
152 self.menu.AppendMenu( PLAYER_MODERATE_MENU, "Moderate", self.moderateMenu ) 127 self.menu.AppendMenu( PLAYER_MODERATE_MENU, "Moderate", self.moderateMenu )
153 self.menu.AppendMenu( PLAYER_COMMAND_MENU, "Room Control", self.commandMenu ) 128 self.menu.AppendMenu( PLAYER_COMMAND_MENU, "Room Control", self.commandMenu )
154 self.menu.AppendSeparator() 129 self.menu.AppendSeparator()
155 self.menu.AppendMenu( PLAYER_ROLE_MENU, "Assign Role", self.roleMenu ) 130 self.menu.AppendMenu( PLAYER_ROLE_MENU, "Assign Role", self.roleMenu )
156 self.menu.AppendSeparator() 131 self.menu.AppendSeparator()
157 self.menu.Append( PLAYER_SHOW_VERSION, "Version" ) 132 self.menu.Append( PLAYER_SHOW_VERSION, "Version" )
133
158 # Event processing for our menu 134 # Event processing for our menu
159 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_BOOT) 135 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_BOOT)
160 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_IGNORE) 136 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_IGNORE)
161 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_WHISPER) 137 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_WHISPER)
162 self.Bind(wx.EVT_MENU, self.on_menu_moderate, id=PLAYER_MODERATE_ROOM_ON) 138 self.Bind(wx.EVT_MENU, self.on_menu_moderate, id=PLAYER_MODERATE_ROOM_ON)
165 self.Bind(wx.EVT_MENU, self.on_menu_moderate, id=PLAYER_MODERATE_TAKE_VOICE) 141 self.Bind(wx.EVT_MENU, self.on_menu_moderate, id=PLAYER_MODERATE_TAKE_VOICE)
166 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_LURKER) 142 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_LURKER)
167 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_PLAYER) 143 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_PLAYER)
168 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_GM) 144 self.Bind(wx.EVT_MENU, self.on_menu_role_change, id=PLAYER_ROLE_GM)
169 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_SHOW_VERSION) 145 self.Bind(wx.EVT_MENU, self.on_menu_item, id=PLAYER_SHOW_VERSION)
170 #---------------------------------------------------------
171 # [START] Digitalxero Multi Whisper Group 1/1/05
172 #---------------------------------------------------------
173 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=PLAYER_WG_CREATE) 146 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=PLAYER_WG_CREATE)
174 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=PLAYER_WG_CLEAR_ALL) 147 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=PLAYER_WG_CLEAR_ALL)
175 #---------------------------------------------------------
176 # [END] Digitalxero Multi Whisper Group 1/1/05
177 #---------------------------------------------------------
178 #---------------------------------------------------------
179 # [START] Snowdog Password/Room Name altering code 12/02
180 #---------------------------------------------------------
181 self.Bind(wx.EVT_MENU, self.on_menu_password, id=PLAYER_COMMAND_PASSWORD_ALTER) 148 self.Bind(wx.EVT_MENU, self.on_menu_password, id=PLAYER_COMMAND_PASSWORD_ALTER)
182 self.Bind(wx.EVT_MENU, self.on_menu_room_rename, id=PLAYER_COMMAND_ROOM_RENAME) 149 self.Bind(wx.EVT_MENU, self.on_menu_room_rename, id=PLAYER_COMMAND_ROOM_RENAME)
183 #---------------------------------------------------------
184 # [END] Snowdog Password/Room Name altering code 12/02
185 #---------------------------------------------------------
186 self.Bind(wx.EVT_LEFT_DCLICK, self.on_d_lclick) 150 self.Bind(wx.EVT_LEFT_DCLICK, self.on_d_lclick)
187 self.Bind(wx.EVT_RIGHT_DOWN, self.on_menu) 151 self.Bind(wx.EVT_RIGHT_DOWN, self.on_menu)
188 self.sized = 1 152 self.sized = 1
189 #---------------------------------------------------------
190 # [START] Snowdog Password/Room Name altering code 12/02
191 #
192 # Revised 8/03 to add support for password manager
193 #---------------------------------------------------------
194 153
195 def AutoAdjust(self): 154 def AutoAdjust(self):
196 self.SetColumnWidth(0, -1) 155 self.SetColumnWidth(0, -1)
197 if self.GetColumnWidth(1) < 75: self.SetColumnWidth(1, 75) 156 if self.GetColumnWidth(1) < 75: self.SetColumnWidth(1, 75)
198 if self.GetColumnWidth(2) < 75: self.SetColumnWidth(2, 75) 157 if self.GetColumnWidth(2) < 75: self.SetColumnWidth(2, 75)
249 b = new_name[:loc] 208 b = new_name[:loc]
250 e = new_name[loc+1:] 209 e = new_name[loc+1:]
251 new_name = b + "&quote" + e 210 new_name = b + "&quote" + e
252 oldloc = loc +1 211 oldloc = loc +1
253 self.session.set_room_name(new_name, boot_pwd) 212 self.session.set_room_name(new_name, boot_pwd)
254 #--------------------------------------------------------- 213
255 # [END] Snowdog Password/Room Name altering code 12/02
256 #---------------------------------------------------------
257
258 #---------------------------------------------------------
259 # [START] Digitalxero Multi Whisper Group 1/1/05
260 #---------------------------------------------------------
261 def clean_sub_menus(self): 214 def clean_sub_menus(self):
262 for mid in WG_MENU_LIST: 215 for mid in WG_MENU_LIST:
263 try: 216 try:
264 self.wgMenu.Remove(WG_MENU_LIST[mid]["menuid"]) 217 self.wgMenu.Remove(WG_MENU_LIST[mid]["menuid"])
265 WG_MENU_LIST[mid]["menu"].Destroy() 218 WG_MENU_LIST[mid]["menu"].Destroy()
287 if id == WG_MENU_LIST[mid]["add"]: WG_LIST[mid][int(item.GetText())] = int(item.GetText()); return 240 if id == WG_MENU_LIST[mid]["add"]: WG_LIST[mid][int(item.GetText())] = int(item.GetText()); return
288 elif id == WG_MENU_LIST[mid]["remove"]: del WG_LIST[mid][int(item.GetText())]; return 241 elif id == WG_MENU_LIST[mid]["remove"]: del WG_LIST[mid][int(item.GetText())]; return
289 elif id == WG_MENU_LIST[mid]["clear"]: WG_LIST[mid].clear(); return 242 elif id == WG_MENU_LIST[mid]["clear"]: WG_LIST[mid].clear(); return
290 elif id == WG_MENU_LIST[mid]["whisper"]: self.chat.set_chat_text("/gw " + mid + "="); return 243 elif id == WG_MENU_LIST[mid]["whisper"]: self.chat.set_chat_text("/gw " + mid + "="); return
291 return 244 return
292
293 #---------------------------------------------------------
294 # [END] Digitalxero Multi Whisper Group 1/1/05
295 #---------------------------------------------------------
296 245
297 def on_menu_moderate( self, evt ): 246 def on_menu_moderate( self, evt ):
298 "Change the moderated status of a room or player." 247 "Change the moderated status of a room or player."
299 id = evt.GetId() 248 id = evt.GetId()
300 self.chat = component.get( "chat" ) 249 self.chat = component.get( "chat" )
395 # self.menu.Enable(PLAYER_BOOT,0) 344 # self.menu.Enable(PLAYER_BOOT,0)
396 # self.menu.SetLabel(PLAYER_BOOT,"Can't boot from Lobby") 345 # self.menu.SetLabel(PLAYER_BOOT,"Can't boot from Lobby")
397 #else: 346 #else:
398 self.menu.Enable(PLAYER_BOOT,1) 347 self.menu.Enable(PLAYER_BOOT,1)
399 self.menu.SetLabel(PLAYER_BOOT,"Boot") 348 self.menu.SetLabel(PLAYER_BOOT,"Boot")
400 #---------------------------------------------------------
401 # [START] Digitalxero Multi Whisper Group 1/1/05
402 #---------------------------------------------------------
403 self.menu.Enable(PLAYER_WG_MENU, True) 349 self.menu.Enable(PLAYER_WG_MENU, True)
404 item = self.GetItem( self.selected_item ) 350 item = self.GetItem( self.selected_item )
405 if len(WG_MENU_LIST) > len(WG_LIST): self.clean_sub_menus() 351 if len(WG_MENU_LIST) > len(WG_LIST): self.clean_sub_menus()
406 if len(WG_LIST) == 0: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, False) 352 if len(WG_LIST) == 0: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, False)
407 else: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, True) 353 else: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, True)
436 #Event Stuff 382 #Event Stuff
437 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["whisper"] ) 383 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["whisper"] )
438 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["add"] ) 384 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["add"] )
439 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["remove"] ) 385 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["remove"] )
440 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["clear"] ) 386 self.Bind(wx.EVT_MENU, self.on_menu_whispergroup, id=WG_MENU_LIST[gid]["clear"] )
441 #---------------------------------------------------------
442 # [END] Digitalxero Multi Whisper Group 1/1/05
443 #---------------------------------------------------------
444 self.PopupMenu(self.menu,pos) 387 self.PopupMenu(self.menu,pos)
445 388
446 def add_player(self,player): 389 def add_player(self,player):
447 i = self.InsertImageStringItem(0,player[2],0) 390 i = self.InsertImageStringItem(0,player[2],0)
448 self.SetStringItem(i,1,self.strip_html(player)) 391 self.SetStringItem(i,1,self.strip_html(player))
459 self.AutoAdjust() 402 self.AutoAdjust()
460 403
461 def del_player(self,player): 404 def del_player(self,player):
462 i = self.FindItemData(-1,int(player[2])) 405 i = self.FindItemData(-1,int(player[2]))
463 self.DeleteItem(i) 406 self.DeleteItem(i)
464
465 #---------------------------------------------------------
466 # [START] Digitalxero Multi Whisper Group 1/1/05
467 #---------------------------------------------------------
468 for gid in WG_LIST: 407 for gid in WG_LIST:
469 if WG_LIST[gid].has_key(int(player[2])): del WG_LIST[gid][int(player[2])] 408 if WG_LIST[gid].has_key(int(player[2])): del WG_LIST[gid][int(player[2])]
470 #---------------------------------------------------------
471 # [END] Digitalxero Multi Whisper Group 1/1/05
472 #---------------------------------------------------------
473 409
474 # play sound 410 # play sound
475 setobj = component.get('settings') 411 setobj = component.get('settings')
476 sound_file = setobj.get_setting("DelSound") 412 sound_file = setobj.get_setting("DelSound")
477 if sound_file != '': 413 if sound_file != '':
518 if self.session.group_id != "0": item.SetTextColour(settings.get_setting(role + "RoleColor")) 454 if self.session.group_id != "0": item.SetTextColour(settings.get_setting(role + "RoleColor"))
519 self.SetItem(item) 455 self.SetItem(item)
520 456
521 def reset(self): 457 def reset(self):
522 self.whisperCount = 0 458 self.whisperCount = 0
523 #---------------------------------------------------------
524 # [START] Digitalxero Multi Whisper Group 1/1/05
525 #---------------------------------------------------------
526 WG_LIST.clear() 459 WG_LIST.clear()
527 #---------------------------------------------------------
528 # [END] Digitalxero Multi Whisper Group 1/1/05
529 #---------------------------------------------------------
530 self.DeleteAllItems() 460 self.DeleteAllItems()
531 461
532 def strip_html(self,player): 462 def strip_html(self,player):
533 ret_string = ""; x = 0; in_tag = 0 463 ret_string = ""; x = 0; in_tag = 0
534 for x in range(len(player[0])) : 464 for x in range(len(player[0])) :