comparison orpg/main.py @ 26:65c5cb9be59c traipse_dev

This patch fixes the known issue with users not being able to set their name in the settings menu. This version also cleans up the themes settings in main.py and preps for Ornery Orc. Some cleaning was done with orpg_settings.py also
author sirebral
date Fri, 31 Jul 2009 00:44:10 -0500
parents 78407d627cba
children b41ea7d28a9e
comparison
equal deleted inserted replaced
25:69149263026d 26:65c5cb9be59c
214 ]] 214 ]]
215 215
216 self.mainmenu = MenuBarEx(self, menu) 216 self.mainmenu = MenuBarEx(self, menu)
217 if self.settings.get_setting('Heartbeat') == '1': 217 if self.settings.get_setting('Heartbeat') == '1':
218 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) 218 self.mainmenu.SetMenuState("GameServerServerHeartbeat", True)
219 tabtheme = self.settings.get_setting('TabTheme') 219
220 220 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS.
221 #This change is stable. TaS.
222 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') 221 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
223 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') 222 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
224 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') 223 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
225 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw') 224 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
226 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua') 225 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
237 item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel") 236 item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel")
238 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item) 237 self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item)
239 self.pluginMenu.AppendItem(item) 238 self.pluginMenu.AppendItem(item)
240 self.pluginMenu.AppendSeparator() 239 self.pluginMenu.AppendSeparator()
241 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins") 240 self.mainmenu.Insert(2, self.pluginMenu, "&Plugins")
242 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG) 241 self.log.log("Exit orpgFrame->build_menu()", ORPG_DEBUG)
243 242
244 ################################# 243 #################################
245 ## All Menu Events 244 ## All Menu Events
246 ################################# 245 #################################
247 #Tab Styles Menus 246 #Tab Styles Menus
248 def SetTabStyles(self, *args, **kwargs): 247 def SetTabStyles(self, *args, **kwargs):
249 self.log.log("Enter orpgFrame->SetTabStyles(self, *args, **kwargs)", ORPG_DEBUG) 248 self.log.log("Enter orpgFrame->SetTabStyles(self, *args, **kwargs)", ORPG_DEBUG)
249
250 tabtheme = self.settings.get_setting('TabTheme') #This change is stable. TaS.
251 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful')
252 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw')
253 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua')
254 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", tabtheme == 'flat&bw')
255 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", tabtheme == 'flat&aqua')
256 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", tabtheme == 'customslant')
257 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat')
258
250 if kwargs.has_key('style'): newstyle = kwargs['style'] 259 if kwargs.has_key('style'): newstyle = kwargs['style']
251 else: 260 else:
252 try: newstyle = args[1] 261 try: newstyle = args[1]
253 except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return 262 except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return
254 if kwargs.has_key('menu'): menu = kwargs['menu'] 263 if kwargs.has_key('menu'): menu = kwargs['menu']
260 else: graidentTo = None 269 else: graidentTo = None
261 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] 270 if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom']
262 else: graidentFrom = None 271 else: graidentFrom = None
263 if kwargs.has_key('textColor'): textColor = kwargs['textColor'] 272 if kwargs.has_key('textColor'): textColor = kwargs['textColor']
264 else: textColor = None 273 else: textColor = None
265
266 #Set all menu's to unchecked
267 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", False)
268 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", False)
269 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", False)
270 self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", False)
271 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", False)
272 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", False)
273 self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", False)
274
275 #check the proper menu
276 self.mainmenu.SetMenuState(menu, True)
277 274
278 #Run though the current tabbed window list and remove those that have been closed 275 #Run though the current tabbed window list and remove those that have been closed
279 tabbedwindows = open_rpg.get_component("tabbedWindows") 276 tabbedwindows = open_rpg.get_component("tabbedWindows")
280 rgbc = orpg.tools.rgbhex.RGBHex() 277 rgbc = orpg.tools.rgbhex.RGBHex()
281 new = [] 278 new = []
331 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) 328 else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True)
332 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) 329 self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG)
333 330
334 def OnMB_OpenRPGTabStylesSlantedCustom(self): 331 def OnMB_OpenRPGTabStylesSlantedCustom(self):
335 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedCustom(self)", ORPG_DEBUG) 332 self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesSlantedCustom(self)", ORPG_DEBUG)
336
337 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"): 333 if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedCustom"):
338 self.settings.set_setting('TabTheme', 'customslant') 334 self.settings.set_setting('TabTheme', 'customslant')
339 rgbc = orpg.tools.rgbhex.RGBHex() 335 rgbc = orpg.tools.rgbhex.RGBHex()
340 gfrom = self.settings.get_setting('TabGradientFrom') 336 gfrom = self.settings.get_setting('TabGradientFrom')
341 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom) 337 (fred, fgreen, fblue) = rgbc.rgb_tuple(gfrom)