comparison orpg/main.py @ 228:24769389a7ba alpha

Traipse Alpha 'OpenRPG' {100612-01} 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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order 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 metaservers.xml file not being created
author sirebral
date Sat, 12 Jun 2010 04:38:29 -0500
parents 29cf1a17ca16
children cc7629ab526d
comparison
equal deleted inserted replaced
225:2c6db2043764 228:24769389a7ba
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 ####################################
159 if setting == 'Tip of the Day': 159 if setting == 'Tip of the Day':
160 settings.add_tab('General', 'Tip of the Day', 'grid') 160 settings.add_tab('General', 'Tip of the Day', 'grid')
161 settings.add('Tip of the Day', 'tipotday_start', '0', 'int', 'Current Tip of the Day') 161 settings.add('Tip of the Day', 'tipotday_start', '0', 'int', 'Current Tip of the Day')
162 settings.add('Tip of the Day', 'tipotday_enabled', '1', '0|1', 'Show Tip of the Day on startup') 162 settings.add('Tip of the Day', 'tipotday_enabled', '1', '0|1', 'Show Tip of the Day on startup')
163 logger.info('New Settings added', True) 163 logger.info('New Settings added', True)
164 self.TraipseSuiteWarn('debug')
165 if setting == 'Meta Servers':
166 settings.add('Networking', 'MetaServers', 'metaservers.xml', '.xml file', 'Contains a list of Meta Servers')
167 logger.info('New Settings added', True)
168 self.validate.config_file("metaservers.xml","default_metaservers.xml")
164 self.TraipseSuiteWarn('debug') 169 self.TraipseSuiteWarn('debug')
165 170
166 def get_activeplugins(self): 171 def get_activeplugins(self):
167 try: tmp = self.pluginsFrame.get_activeplugins() 172 try: tmp = self.pluginsFrame.get_activeplugins()
168 except: tmp = {} 173 except: tmp = {}
200 ['&OpenRPG'], 205 ['&OpenRPG'],
201 [' &Settings\tCtrl-S'], 206 [' &Settings\tCtrl-S'],
202 [' -'], 207 [' -'],
203 [' Tab Styles'], 208 [' Tab Styles'],
204 [' Slanted'], 209 [' Slanted'],
205 [' Colorful', "check"], 210 #[' Colorful', "check"],
206 [' Black and White', "check"], 211 [' Black and White', "check"],
207 [' Aqua', "check"], 212 [' Aqua', "check"],
208 [' Custom', "check"], 213 [' Custom', "check"],
209 [' Flat'], 214 [' Flat'],
210 [' Black and White', "check"], 215 [' Black and White', "check"],
250 if settings.get('Heartbeat') == '1': 255 if settings.get('Heartbeat') == '1':
251 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) 256 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
252 257
253 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)
254 tabtheme = settings.get('TabTheme') #This change is stable. TaS. 259 tabtheme = settings.get('TabTheme') #This change is stable. TaS.
255 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')
256 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 262 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
257 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 263 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
258 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 264 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
259 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 265 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
260 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') 266 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
316 ## All Menu Events 322 ## All Menu Events
317 ################################# 323 #################################
318 #Tab Styles Menus 324 #Tab Styles Menus
319 325
320 def SetTabStyles(self, *args, **kwargs): 326 def SetTabStyles(self, *args, **kwargs):
321
322 tabtheme = settings.get('TabTheme') #This change is stable. TaS. 327 tabtheme = settings.get('TabTheme') #This change is stable. TaS.
323 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 328 #self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
324 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 329 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
325 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 330 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
326 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 331 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
327 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 332 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
328 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant') 333 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
334 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
335 if kwargs.has_key('menu'): menu = kwargs['menu'] 340 if kwargs.has_key('menu'): menu = kwargs['menu']
336 else: 341 else:
337 try: menu = args[0] 342 try: menu = args[0]
338 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
339
340 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] 344 if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo']
341 else: graidentTo = None 345 else: graidentTo = None
342 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] 346 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom']
343 else: graidentFrom = None 347 else: graidentFrom = None
344 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] 348 if kwargs.has_key('textColor'): textColor = kwargs['textColor']
358 (red, green, blue) = self.rgb.rgb_tuple(tabbg) 362 (red, green, blue) = self.rgb.rgb_tuple(tabbg)
359 363
360 for wnd in tabbedwindows: 364 for wnd in tabbedwindows:
361 style = wnd.GetWindowStyleFlag() 365 style = wnd.GetWindowStyleFlag()
362 # remove old tabs style 366 # remove old tabs style
363 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 )
364 style &= mirror 368 style &= mirror
365 style |= newstyle 369 style |= newstyle
366 wnd.SetWindowStyleFlag(style) 370 wnd.SetWindowStyleFlag(style)
367 wnd.SetTabAreaColour(wx.Color(red, green, blue)) 371 wnd.SetTabAreaColour(wx.Color(red, green, blue))
368 if graidentTo != None: wnd.SetGradientColourTo(graidentTo) 372 if graidentTo != None: wnd.SetGradientColourTo(graidentTo)
745 logger.debug("GUI is all created") 749 logger.debug("GUI is all created")
746 self.Thaw() 750 self.Thaw()
747 751
748 def do_tab_window(self, xml_dom, parent_wnd): 752 def do_tab_window(self, xml_dom, parent_wnd):
749 # if container window loop through childern and do a recursive call 753 # if container window loop through childern and do a recursive call
750 temp_wnd = orpgTabberWnd(parent_wnd, style=FNB.FNB_ALLOW_FOREIGN_DND) 754 temp_wnd = orpgTabberWnd(parent_wnd)
751 755
752 children = xml_dom.getchildren() 756 children = xml_dom.getchildren()
753 for c in children: 757 for c in children:
754 wnd = self.build_window(c,temp_wnd) 758 wnd = self.build_window(c, temp_wnd)
755 name = c.get("name") 759 name = c.get("name")
756 temp_wnd.AddPage(wnd, name, False) 760 temp_wnd.AddPage(wnd, name, False)
757 return temp_wnd 761 return temp_wnd
758 762
759 def build_window(self, xml_dom, parent_wnd): 763 def build_window(self, xml_dom, parent_wnd):
1122 1126
1123 class orpgApp(wx.App): 1127 class orpgApp(wx.App):
1124 1128
1125 def OnInit(self): 1129 def OnInit(self):
1126 component.add('log', logger) 1130 component.add('log', logger)
1127 component.add('xml', xml) 1131 #component.add('xml', xml)
1128 component.add('settings', settings) 1132 component.add('settings', settings)
1129 component.add('validate', validate) 1133 component.add('validate', validate)
1130 component.add("tabbedWindows", []) 1134 component.add("tabbedWindows", [])
1131 1135
1132 self.called = False 1136 self.called = False