comparison orpg/main.py @ 36:d02e9197c066 ornery-orc

Traipse 'OpenRPG' {101220-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 (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Sun, 19 Dec 2010 22:44:36 -0600
parents ee890f424e16
children
comparison
equal deleted inserted replaced
35:ee890f424e16 36:d02e9197c066
61 from orpg.tools.metamenus import MenuBarEx 61 from orpg.tools.metamenus import MenuBarEx
62 from orpg.tools.InterParse import Parse 62 from orpg.tools.InterParse import Parse
63 63
64 from xml.etree.ElementTree import ElementTree, Element, parse 64 from xml.etree.ElementTree import ElementTree, Element, parse
65 from xml.etree.ElementTree import fromstring, tostring 65 from xml.etree.ElementTree import fromstring, tostring
66 from orpg.orpg_xml import xml #to be replaced by etree 66 #from orpg.orpg_xml import xml #to be replaced by etree
67 67
68 68
69 #################################### 69 ####################################
70 ## Main Frame 70 ## Main Frame
71 #################################### 71 ####################################
205 ['&OpenRPG'], 205 ['&OpenRPG'],
206 [' &Settings\tCtrl-S'], 206 [' &Settings\tCtrl-S'],
207 [' -'], 207 [' -'],
208 [' Tab Styles'], 208 [' Tab Styles'],
209 [' Slanted'], 209 [' Slanted'],
210 [' Colorful', "check"], 210 #[' Colorful', "check"],
211 [' Black and White', "check"], 211 [' Black and White', "check"],
212 [' Aqua', "check"], 212 [' Aqua', "check"],
213 [' Custom', "check"], 213 [' Custom', "check"],
214 [' Flat'], 214 [' Flat'],
215 [' Black and White', "check"], 215 [' Black and White', "check"],
255 if settings.get('Heartbeat') == '1': 255 if settings.get('Heartbeat') == '1':
256 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) 256 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
257 257
258 self.mainmenu.SetMenuState('ToolsPasswordManager', True if settings.get('PWMannager') == 'On' else False) 258 self.mainmenu.SetMenuState('ToolsPasswordManager', True if settings.get('PWMannager') == 'On' else False)
259 tabtheme = settings.get('TabTheme') #This change is stable. TaS. 259 tabtheme = settings.get('TabTheme') #This change is stable. TaS.
260 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 260 if tabtheme == 'slanted&colorful': tabtheme = 'customflat'; settings.change('TabTheme', 'customflat')
261 #self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
261 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 262 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
262 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 263 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
263 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 264 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
264 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 265 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
265 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') 266 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
321 ## All Menu Events 322 ## All Menu Events
322 ################################# 323 #################################
323 #Tab Styles Menus 324 #Tab Styles Menus
324 325
325 def SetTabStyles(self, *args, **kwargs): 326 def SetTabStyles(self, *args, **kwargs):
326
327 tabtheme = settings.get('TabTheme') #This change is stable. TaS. 327 tabtheme = settings.get('TabTheme') #This change is stable. TaS.
328 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 328 #self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
329 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 329 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
330 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 330 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
331 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 331 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
332 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 332 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
333 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') 333 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
339 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return 339 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return
340 if kwargs.has_key('menu'): menu = kwargs['menu'] 340 if kwargs.has_key('menu'): menu = kwargs['menu']
341 else: 341 else:
342 try: menu = args[0] 342 try: menu = args[0]
343 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return 343 except: logger.general('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)'); return
344
345 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] 344 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo']
346 else: graidentTo = None 345 else: graidentTo = None
347 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] 346 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom']
348 else: graidentFrom = None 347 else: graidentFrom = None
349 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] 348 if kwargs.has_key('textColor'): textColor = kwargs['textColor']
363 (red, green, blue) = self.rgb.rgb_tuple(tabbg) 362 (red, green, blue) = self.rgb.rgb_tuple(tabbg)
364 363
365 for wnd in tabbedwindows: 364 for wnd in tabbedwindows:
366 style = wnd.GetWindowStyleFlag() 365 style = wnd.GetWindowStyleFlag()
367 # remove old tabs style 366 # remove old tabs style
368 mirror = ~(FNB.FNB_VC71 | FNB.FNB_VC8 | FNB.FNB_FANCY_TABS | FNB.FNB_COLORFUL_TABS) 367 mirror = ~(FNB.FNB_VC71 | FNB.FNB_VC8 | FNB.FNB_FANCY_TABS )
369 style &= mirror 368 style &= mirror
370 style |= newstyle 369 style |= newstyle
371 wnd.SetWindowStyleFlag(style) 370 wnd.SetWindowStyleFlag(style)
372 wnd.SetTabAreaColour(wx.Color(red, green, blue)) 371 wnd.SetTabAreaColour(wx.Color(red, green, blue))
373 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) 372 if graidentTo != None: wnd.SetGradientColourTo(graidentTo)
750 logger.debug("GUI is all created") 749 logger.debug("GUI is all created")
751 self.Thaw() 750 self.Thaw()
752 751
753 def do_tab_window(self, xml_dom, parent_wnd): 752 def do_tab_window(self, xml_dom, parent_wnd):
754 # if container window loop through childern and do a recursive call 753 # if container window loop through childern and do a recursive call
755 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) 754 temp_wnd = orpgTabberWnd(parent_wnd)
756 755
757 children = xml_dom.getchildren() 756 children = xml_dom.getchildren()
758 for c in children: 757 for c in children:
759 wnd = self.build_window(c,temp_wnd) 758 wnd = self.build_window(c, temp_wnd)
760 name = c.get("name") 759 name = c.get("name")
761 temp_wnd.AddPage(wnd, name, False) 760 temp_wnd.AddPage(wnd, name, False)
762 return temp_wnd 761 return temp_wnd
763 762
764 def build_window(self, xml_dom, parent_wnd): 763 def build_window(self, xml_dom, parent_wnd):
934 etreeEl = Element('msg') 933 etreeEl = Element('msg')
935 try: etreeEl.append(fromstring(data)) 934 try: etreeEl.append(fromstring(data))
936 except: etreeEl.text = data 935 except: etreeEl.text = data
937 936
938 display_name = self.chat.chat_display_name(player) 937 display_name = self.chat.chat_display_name(player)
939 if etreeEl.text:self.chat.Post(display_name+etreeEl.text) 938 if etreeEl.text:
939 if "is creating room" in etreeEl.text: self.chat.Post(etreeEl.text)
940 else: self.chat.Post(display_name+etreeEl.text)
940 941
941 for child in etreeEl.getchildren(): 942 for child in etreeEl.getchildren():
942 if child.tag == 'tree': 943 if child.tag == 'tree':
943 dlg = wx.MessageDialog(None, component.strip_html(display_name) + ' is trying to send you a tree node. Accept?', 'Question', 944 dlg = wx.MessageDialog(None,
944 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) 945 component.strip_html(display_name) + ' is trying to send you a tree node. Accept?',
946 'Question', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
945 if dlg.ShowModal() == wx.ID_YES: 947 if dlg.ShowModal() == wx.ID_YES:
946 dlg.Destroy() 948 dlg.Destroy()
947 self.tree.on_receive_data(tostring(child)) 949 self.tree.on_receive_data(tostring(child))
948 self.chat.InfoPost(display_name + " has sent you a tree node...") 950 self.chat.InfoPost(display_name + " has sent you a tree node...")
949 elif child.tag == 'map': 951 elif child.tag == 'map':
1127 1129
1128 class orpgApp(wx.App): 1130 class orpgApp(wx.App):
1129 1131
1130 def OnInit(self): 1132 def OnInit(self):
1131 component.add('log', logger) 1133 component.add('log', logger)
1132 component.add('xml', xml) 1134 #component.add('xml', xml)
1133 component.add('settings', settings) 1135 component.add('settings', settings)
1134 component.add('validate', validate) 1136 component.add('validate', validate)
1135 component.add("tabbedWindows", []) 1137 component.add("tabbedWindows", [])
1136 1138
1137 self.called = False 1139 self.called = False