# HG changeset patch # User sirebral # Date 1248560680 18000 # Node ID 78407d627cba1e7503135f5e0f50036c790a84c1 # Parent 67b900deb35c90186c898262d574ea4fa9fd5389 Beginning of Code Clean-up. Some code untested, may break! diff -r 67b900deb35c -r 78407d627cba orpg/main.py --- a/orpg/main.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/main.py Sat Jul 25 17:24:40 2009 -0500 @@ -74,14 +74,10 @@ # Determine which icon format to use icon = None - if wx.Platform == '__WXMSW__': - icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) - else: - icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM) # create the object, then determine if it needs to be replaced. It calculates 2 less calculations. - - # Set it if we have it - if icon != None: - self.SetIcon( icon ) + if wx.Platform == '__WXMSW__': icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+'d20.ico', wx.BITMAP_TYPE_ICO) + else: icon = wx.Icon(orpg.dirpath.dir_struct["icon"]+"d20.xpm", wx.BITMAP_TYPE_XPM) + #if icon != None: self.SetIcon( icon ) worth 'less' now since it sets the icon either or. + self.SetIcon( icon ) # create session call_backs = {"on_receive":self.on_receive, @@ -137,25 +133,20 @@ def get_activeplugins(self): self.log.log("Enter orpgFrame->get_activeplugins(self)", ORPG_DEBUG) - try: - tmp = self.pluginsFrame.get_activeplugins() - except: - tmp = {} + try: tmp = self.pluginsFrame.get_activeplugins() + except: tmp = {} self.log.log("Exit orpgFrame->get_activeplugins(self)", ORPG_DEBUG) return tmp def get_startplugins(self): self.log.log("Enter orpgFrame->get_startplugins(self)", ORPG_DEBUG) - try: - tmp = self.pluginsFrame.get_startplugins() - except: - tmp = {} + try: tmp = self.pluginsFrame.get_startplugins() + except: tmp = {} self.log.log("Exit orpgFrame->get_startplugins(self)", ORPG_DEBUG) return tmp def on_password_signal(self,signal,type,id,data): self.log.log("Enter orpgFrame->on_password_signal(self,signal,type,id,data)", ORPG_DEBUG) - try: self.log.log("DEBUG: password response= "+str(signal)+" (T:"+str(type)+" #"+str(id)+")", ORPG_DEBUG) id = int(id) @@ -163,16 +154,11 @@ data = str(data) signal = str(signal) if signal == "fail": - if type == "server": - self.password_manager.ClearPassword("server", 0) - elif type == "admin": - self.password_manager.ClearPassword("admin", int(id)) - elif type == "room": - self.password_manager.ClearPassword("room", int(id)) - else: - pass - except: - traceback.print_exc() + if type == "server": self.password_manager.ClearPassword("server", 0) + elif type == "admin": self.password_manager.ClearPassword("admin", int(id)) + elif type == "room": self.password_manager.ClearPassword("room", int(id)) + else: pass + except: traceback.print_exc() self.log.log("Exit orpgFrame->on_password_signal(self,signal,type,id,data)", ORPG_DEBUG) def build_menu(self): @@ -242,14 +228,11 @@ self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", tabtheme == 'customflat') lvl = int(self.settings.get_setting('LoggingLevel')) - if lvl & ORPG_DEBUG: - self.mainmenu.SetMenuState("ToolsLoggingLevelDebug", True) - if lvl & ORPG_DEBUG: - self.mainmenu.SetMenuState("ToolsLoggingLevelNote", True) - if lvl & ORPG_INFO: - self.mainmenu.SetMenuState("ToolsLoggingLevelInfo", True) - if lvl & ORPG_GENERAL: - self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True) + if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelDebug", True) + if lvl & ORPG_DEBUG: self.mainmenu.SetMenuState("ToolsLoggingLevelNote", True) + if lvl & ORPG_INFO: self.mainmenu.SetMenuState("ToolsLoggingLevelInfo", True) + if lvl & ORPG_GENERAL: self.mainmenu.SetMenuState("ToolsLoggingLevelGeneral", True) + self.pluginMenu = wx.Menu() item = wx.MenuItem(self.pluginMenu, wx.ID_ANY, "Control Panel", "Control Panel") self.Bind(wx.EVT_MENU, self.OnMB_PluginControlPanel, item) @@ -264,34 +247,21 @@ #Tab Styles Menus def SetTabStyles(self, *args, **kwargs): self.log.log("Enter orpgFrame->SetTabStyles(self, *args, **kwargs)", ORPG_DEBUG) - if kwargs.has_key('style'): - newstyle = kwargs['style'] + if kwargs.has_key('style'): newstyle = kwargs['style'] else: - try: - newstyle = args[1] - except: - self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL) - return - if kwargs.has_key('menu'): - menu = kwargs['menu'] + try: newstyle = args[1] + except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return + if kwargs.has_key('menu'): menu = kwargs['menu'] else: - try: - menu = args[0] - except: - self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL) - return - if kwargs.has_key('graidentTo'): - graidentTo = kwargs['graidentTo'] - else: - graidentTo = None - if kwargs.has_key('graidentFrom'): - graidentFrom = kwargs['graidentFrom'] - else: - graidentFrom = None - if kwargs.has_key('textColor'): - textColor = kwargs['textColor'] - else: - textColor = None + try: menu = args[0] + except: self.log.log('Invalid Syntax for orpgFrame->SetTabStyles(self, *args, **kwargs)', ORPG_GENERAL); return + + if kwargs.has_key('graidentTo'): graidentTo = kwargs['graidentTo'] + else: graidentTo = None + if kwargs.has_key('graidentFrom'): graidentFrom = kwargs['graidentFrom'] + else: graidentFrom = None + if kwargs.has_key('textColor'): textColor = kwargs['textColor'] + else: textColor = None #Set all menu's to unchecked self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", False) @@ -310,11 +280,8 @@ rgbc = orpg.tools.rgbhex.RGBHex() new = [] for wnd in tabbedwindows: - try: - style = wnd.GetWindowStyleFlag() - new.append(wnd) - except: - pass + try: style = wnd.GetWindowStyleFlag(); new.append(wnd) + except: pass tabbedwindows = new open_rpg.add_component("tabbedWindows", tabbedwindows) @@ -331,12 +298,9 @@ style |= newstyle wnd.SetWindowStyleFlag(style) wnd.SetTabAreaColour(wx.Color(red, green, blue)) - if graidentTo != None: - wnd.SetGradientColourTo(graidentTo) - if graidentFrom != None: - wnd.SetGradientColourFrom(graidentFrom) - if textColor != None: - wnd.SetNonActiveTabTextColour(textColor) + if graidentTo != None: wnd.SetGradientColourTo(graidentTo) + if graidentFrom != None: wnd.SetGradientColourFrom(graidentFrom) + if textColor != None: wnd.SetNonActiveTabTextColour(textColor) wnd.Refresh() def OnMB_OpenRPGNewMap(self): @@ -348,8 +312,7 @@ if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedColorful"): self.settings.set_setting('TabTheme', 'slanted&colorful') self.SetTabStyles("OpenRPGTabStylesSlantedColorful", FNB.FNB_VC8|FNB.FNB_COLORFUL_TABS) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedColorful(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesSlantedBlackandWhite(self): @@ -357,8 +320,7 @@ if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedBlackandWhite"): self.settings.set_setting('TabTheme', 'slanted&bw') self.SetTabStyles("OpenRPGTabStylesSlantedBlackandWhite", FNB.FNB_VC8, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesSlantedAqua(self): @@ -366,8 +328,7 @@ if self.mainmenu.GetMenuState("OpenRPGTabStylesSlantedAqua"): self.settings.set_setting('TabTheme', 'slanted&aqua') self.SetTabStyles("OpenRPGTabStylesSlantedAqua", FNB.FNB_VC8, graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedBlackandWhite(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesSlantedCustom(self): @@ -384,27 +345,28 @@ (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext) tabbg = self.settings.get_setting('TabBackgroundGradient') (red, green, blue) = rgbc.rgb_tuple(tabbg) - self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), textColor=wx.Color(tred, tgreen, tblue)) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) + self.SetTabStyles("OpenRPGTabStylesSlantedCustom", FNB.FNB_VC8, + graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), + textColor=wx.Color(tred, tgreen, tblue)) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedCustom", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesSlantedCustom(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesFlatBlackandWhite(self): self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesFlatBlackandWhite(self)", ORPG_DEBUG) if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatBlackandWhite"): self.settings.set_setting('TabTheme', 'flat&bw') - self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) + self.SetTabStyles("OpenRPGTabStylesFlatBlackandWhite", FNB.FNB_FANCY_TABS, + graidentTo=wx.WHITE, graidentFrom=wx.WHITE, textColor=wx.BLACK) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatBlackandWhite", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatBlackandWhite(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesFlatAqua(self): self.log.log("Enter orpgFrame->OnMB_OpenRPGTabStylesFlatAqua(self)", ORPG_DEBUG) if self.mainmenu.GetMenuState("OpenRPGTabStylesFlatAqua"): self.settings.set_setting('TabTheme', 'flat&aqua') - self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) + self.SetTabStyles("OpenRPGTabStylesFlatAqua", FNB.FNB_FANCY_TABS, + graidentTo=wx.Color(0, 128, 255), graidentFrom=wx.WHITE, textColor=wx.BLACK) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatAqua", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatAqua(self)", ORPG_DEBUG) def OnMB_OpenRPGTabStylesFlatCustom(self): @@ -420,9 +382,10 @@ (tred, tgreen, tblue) = rgbc.rgb_tuple(tabtext) tabbg = self.settings.get_setting('TabBackgroundGradient') (red, green, blue) = rgbc.rgb_tuple(tabbg) - self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), textColor=wx.Color(tred, tgreen, tblue)) - else: - self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) + self.SetTabStyles("OpenRPGTabStylesFlatCustom", FNB.FNB_FANCY_TABS, + graidentTo=wx.Color(tored, togreen, toblue), graidentFrom=wx.Color(fred, fgreen, fblue), + textColor=wx.Color(tred, tgreen, tblue)) + else: self.mainmenu.SetMenuState("OpenRPGTabStylesFlatCustom", True) self.log.log("Exit orpgFrame->OnMB_OpenRPGTabStylesFlatCustom(self)", ORPG_DEBUG) #Window Menu @@ -431,15 +394,11 @@ menuid = event.GetId() name = self.mainwindows[menuid] if name == 'Alias Lib': - if self.aliaslib.IsShown() == True: - self.aliaslib.Hide() - else: - self.aliaslib.Show() + if self.aliaslib.IsShown() == True: self.aliaslib.Hide() + else: self.aliaslib.Show() else: - if self._mgr.GetPane(name).IsShown() == True: - self._mgr.GetPane(name).Hide() - else: - self._mgr.GetPane(name).Show() + if self._mgr.GetPane(name).IsShown() == True: self._mgr.GetPane(name).Hide() + else: self._mgr.GetPane(name).Show() self._mgr.Update() self.log.log("Exit orpgFrame->OnMB_WindowsMenu(self, event)", ORPG_DEBUG) @@ -457,19 +416,15 @@ #Game Server Menu def OnMB_GameServerBrowseServers(self): self.log.log("Enter orpgFrame->OnMB_GameServerBrowseServers(self)", ORPG_DEBUG) - if self._mgr.GetPane("Browse Server Window").IsShown() == True: - self._mgr.GetPane("Browse Server Window").Hide() - else: - self._mgr.GetPane("Browse Server Window").Show() + if self._mgr.GetPane("Browse Server Window").IsShown() == True: self._mgr.GetPane("Browse Server Window").Hide() + else: self._mgr.GetPane("Browse Server Window").Show() self._mgr.Update() self.log.log("Exit orpgFrame->OnMB_GameServerBrowseServers(self)", ORPG_DEBUG) def OnMB_GameServerServerHeartbeat(self): self.log.log("Enter orpgFrame->OnMB_GameServerServerHeartbeat(self)", ORPG_DEBUG) - if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): - self.settings.set_setting('Heartbeat', '1') - else: - self.settings.set_setting('Heartbeat', '0') + if self.mainmenu.GetMenuState("GameServerServerHeartbeat"): self.settings.set_setting('Heartbeat', '1') + else: self.settings.set_setting('Heartbeat', '0') self.log.log("Exit orpgFrame->OnMB_GameServerServerHeartbeat(self)", ORPG_DEBUG) def OnMB_GameServerStartServer(self): @@ -494,19 +449,15 @@ # Tools Menu def OnMB_PluginControlPanel(self, evt): self.log.log("Enter orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) - if self.pluginsFrame.IsShown() == True: - self.pluginsFrame.Hide() - else: - self.pluginsFrame.Show() + if self.pluginsFrame.IsShown() == True: self.pluginsFrame.Hide() + else: self.pluginsFrame.Show() self.log.log("Exit orpgFrame->OnMB_ToolsPlugins(self)", ORPG_DEBUG) def OnMB_ToolsLoggingLevelDebug(self): self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG) lvl = self.log.getLogLevel() - if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): - lvl |= ORPG_DEBUG - else: - lvl &= ~ORPG_DEBUG + if self.mainmenu.GetMenuState("ToolsLoggingLevelDebug"): lvl |= ORPG_DEBUG + else: lvl &= ~ORPG_DEBUG self.log.setLogLevel(lvl) self.settings.set_setting('LoggingLevel', lvl) self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelDebug(self)", ORPG_DEBUG) @@ -514,10 +465,8 @@ def OnMB_ToolsLoggingLevelNote(self): self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelNote(self)", ORPG_DEBUG) lvl = self.log.getLogLevel() - if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): - lvl |= ORPG_DEBUG - else: - lvl &= ~ORPG_DEBUG + if self.mainmenu.GetMenuState("ToolsLoggingLevelNote"): lvl |= ORPG_DEBUG + else: lvl &= ~ORPG_DEBUG self.log.setLogLevel(lvl) self.settings.set_setting('LoggingLevel', lvl) self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelNote(self)", ORPG_DEBUG) @@ -525,10 +474,8 @@ def OnMB_ToolsLoggingLevelInfo(self): self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelInfo(self)", ORPG_DEBUG) lvl = self.log.getLogLevel() - if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): - lvl |= ORPG_INFO - else: - lvl &= ~ORPG_INFO + if self.mainmenu.GetMenuState("ToolsLoggingLevelInfo"): lvl |= ORPG_INFO + else: lvl &= ~ORPG_INFO self.log.setLogLevel(lvl) self.settings.set_setting('LoggingLevel', lvl) self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelInfo(self)", ORPG_DEBUG) @@ -536,20 +483,16 @@ def OnMB_ToolsLoggingLevelGeneral(self): self.log.log("Enter orpgFrame->OnMB_ToolsLoggingLevelGeneral(self)", ORPG_DEBUG) lvl = self.log.getLogLevel() - if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): - lvl |= ORPG_GENERAL - else: - lvl &= ~ORPG_GENERAL + if self.mainmenu.GetMenuState("ToolsLoggingLevelGeneral"): lvl |= ORPG_GENERAL + else: lvl &= ~ORPG_GENERAL self.log.setLogLevel(lvl) self.settings.set_setting('LoggingLevel', lvl) self.log.log("Exit orpgFrame->OnMB_ToolsLoggingLevelGeneral(self)", ORPG_DEBUG) def OnMB_ToolsPasswordManager(self): self.log.log("Enter orpgFrame->OnMB_ToolsPasswordManager(self)", ORPG_DEBUG) - if self.mainmenu.GetMenuState("ToolsPasswordManager"): - self.password_manager.Enable() - else: - self.password_manager.Disable() + if self.mainmenu.GetMenuState("ToolsPasswordManager"): self.password_manager.Enable() + else: self.password_manager.Disable() self.log.log("Exit orpgFrame->OnMB_ToolsPasswordManager(self)", ORPG_DEBUG) def OnMB_ToolsStatusBar(self): @@ -760,8 +703,7 @@ try: textnode = self.xml.safe_get_text_node(layout[0]) self._mgr.LoadPerspective(textnode._get_nodeValue()) - except: - pass + except: pass xml_dom.unlink() self.log.log("Perspective Loaded", ORPG_DEBUG) self._mgr.GetPane("Browse Server Window").Hide() @@ -787,8 +729,7 @@ def build_window(self, xml_dom, parent_wnd): name = xml_dom._get_nodeName() self.log.log("Enter orpgFrame->build_window(" + name + ")", ORPG_DEBUG) - if name == "DockLayout" or name == "dock": - return + if name == "DockLayout" or name == "dock": return dir = xml_dom.getAttribute("direction") pos = xml_dom.getAttribute("pos") height = xml_dom.getAttribute("height") @@ -797,15 +738,10 @@ dockable = xml_dom.getAttribute("dockable") layer = xml_dom.getAttribute("layer") - try: - layer = int(layer) - dockable = int(dockable) - except: - layer = 0 - dockable = 1 + try: layer = int(layer); dockable = int(dockable) + except: layer = 0; dockable = 1 - if name == "tab": - temp_wnd = self.do_tab_window(xml_dom, parent_wnd) + if name == "tab": temp_wnd = self.do_tab_window(xml_dom, parent_wnd) elif name == "map": temp_wnd = orpg.mapper.map.map_wnd(parent_wnd, -1) self.map = temp_wnd @@ -833,9 +769,8 @@ else: self.players.SetBackgroundColour('white') self.players.SetForegroundColour('black') - if parent_wnd != self: - #We dont need this if the window are beeing tabed - return temp_wnd + + if parent_wnd != self: return temp_wnd menuid = wx.NewId() self.windowsmenu.Append(menuid, cap, kind=wx.ITEM_CHECK) self.windowsmenu.Check(menuid, True) @@ -850,17 +785,11 @@ wndinfo.Caption(cap) # Lambda here should work! (future dev) - if dir.lower() == 'top': - wndinfo.Top() - elif dir.lower() == 'bottom': - wndinfo.Bottom() - elif dir.lower() == 'left': - wndinfo.Left() - elif dir.lower() == 'right': - wndinfo.Right() - elif dir.lower() == 'center': - wndinfo.Center() - wndinfo.CaptionVisible(False) + if dir.lower() == 'top': wndinfo.Top() + elif dir.lower() == 'bottom': wndinfo.Bottom() + elif dir.lower() == 'left': wndinfo.Left() + elif dir.lower() == 'right': wndinfo.Right() + elif dir.lower() == 'center': wndinfo.Center(); wndinfo.CaptionVisible(False) if dockable != 1: wndinfo.Dockable(False) @@ -876,9 +805,7 @@ self.log.log("Enter orpgFrame->onPaneClose()", ORPG_DEBUG) pane = evt.GetPane() for wndid, wname in self.mainwindows.iteritems(): - if pane.name == wname: - self.windowsmenu.Check(wndid, False) - break + if pane.name == wname: self.windowsmenu.Check(wndid, False); break evt.Skip() self._mgr.Update() self.log.log("Exit orpgFrame->onPaneClose()", ORPG_DEBUG) @@ -892,10 +819,8 @@ temp_file.close() (x_size,y_size) = self.GetClientSize() (x_pos,y_pos) = self.GetPositionTuple() - if self.IsMaximized(): - max = 1 - else: - max = 0 + if self.IsMaximized(): max = 1 + else: max = 0 xml_dom.setAttribute("height", str(y_size)) xml_dom.setAttribute("width", str(x_size)) xml_dom.setAttribute("posx", str(x_pos)) @@ -950,8 +875,7 @@ self.log.log("Enter orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) id = evt.get_id() status = evt.get_data() - if id == orpg.networking.mplay_client.STATUS_SET_URL: - self.status.set_url(status) + if id == orpg.networking.mplay_client.STATUS_SET_URL: self.status.set_url(status) self.log.log("Exit orpgFrame->on_status_event(self, evt)", ORPG_DEBUG) def on_player_event(self, evt): @@ -976,13 +900,11 @@ id = evt.get_id() data = evt.get_data() - if id == orpg.networking.mplay_client.GROUP_NEW: - self.gs.add_room(data) + if id == orpg.networking.mplay_client.GROUP_NEW: self.gs.add_room(data) elif id == orpg.networking.mplay_client.GROUP_DEL: self.password_manager.RemoveGroupData(data) self.gs.del_room(data) - elif id == orpg.networking.mplay_client.GROUP_UPDATE: - self.gs.update_room(data) + elif id == orpg.networking.mplay_client.GROUP_UPDATE: self.gs.update_room(data) self.log.log("Exit orpgFrame->on_group_event(self, evt)", ORPG_DEBUG) def on_receive(self, data, player): @@ -991,25 +913,19 @@ # see if we are ignoring this user (ignore_id,ignore_name) = self.session.get_ignore_list() for m in ignore_id: - if m == player[2]: - # yes we are - self.log.log("ignoring message from player:" + player[0], ORPG_INFO, True) - return + if m == player[2]: self.log.log("ignoring message from player:" + player[0], ORPG_INFO, True); return # ok we are not ignoring this message #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below - if player: - display_name = self.chat.chat_display_name(player) - else: - display_name = "Server Administrator" + if player: display_name = self.chat.chat_display_name(player) + else: display_name = "Server Administrator" if data[:5] == ": " + data - else: - data = "" + display_name + "-> " + data + if player: data = "" + display_name + ": " + data + else: data = "" + display_name + "-> " + data self.chat.Post(data) self.log.log("Exit orpgFrame->on_receive(self, data, player)", ORPG_DEBUG) @@ -1076,10 +990,8 @@ settings = open_rpg.get_component('settings') custom_msg = settings.get_setting("dcmsg") custom_msg=custom_msg[:80] - if custom_msg[:3]=="/me": - self.chat.send_chat_message(custom_msg[3:], 3) - else: - self.chat.system_message(custom_msg) + if custom_msg[:3]=="/me": self.chat.send_chat_message(custom_msg[3:], 3) + else: self.chat.system_message(custom_msg) #####End Changes for Custom Exit Message by mDuo13 elif id== orpg.networking.mplay_client.MPLAY_GROUP_CHANGE: @@ -1108,40 +1020,32 @@ #########plugin_disabled()######### for plugin_fname in self.activeplugins.keys(): plugin = self.activeplugins[plugin_fname] - try: - plugin.plugin_disabled() + try: plugin.plugin_disabled() except Exception, e: if str(e) != "'module' object has no attribute 'plugin_disabled'": #print e traceback.print_exc() #end mDuo13 added code self.saveLayout() - try: - self.settings.save() - except: - self.log.log("[WARNING] Error saving 'settings' component", ORPG_GENERAL, True) + try: self.settings.save() + except: self.log.log("[WARNING] Error saving 'settings' component", ORPG_GENERAL, True) - try: - self.map.pre_exit_cleanup() - except: - self.log.log("[WARNING] Map error pre_exit_cleanup()", ORPG_GENERAL, True) + try: self.map.pre_exit_cleanup() + except: self.log.log("[WARNING] Map error pre_exit_cleanup()", ORPG_GENERAL, True) try: save_tree = string.upper(self.settings.get_setting("SaveGameTreeOnExit")) if (save_tree != "0") and (save_tree != "False") and (save_tree != "NO"): self.tree.save_tree(self.settings.get_setting("gametree")) - except: - self.log.log("[WARNING] Error saving gametree", ORPG_GENERAL, True) + except: self.log.log("[WARNING] Error saving gametree", ORPG_GENERAL, True) - if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: - self.kill_mplay_session() + if self.session.get_status() == orpg.networking.mplay_client.MPLAY_CONNECTED: self.kill_mplay_session() try: #Kill all the damn timers self.sound_player.timer.Stop() del self.sound_player.timer - except: - self.log.log("sound didn't die properly.",ORPG_GENERAL, True) + except: self.log.log("sound didn't die properly.",ORPG_GENERAL, True) try: self.poll_timer.Stop() @@ -1152,8 +1056,7 @@ self.status.timer.Stop() del self.ping_timer; del self.poll_timer; del self.chat.parent.chat_timer del self.map.canvas.zoom_display_timer; del self.map.canvas.image_timer; del self.status.timer - except: - self.log.log("some timer didn't die properly.",ORPG_GENERAL, True) + except: self.log.log("some timer didn't die properly.",ORPG_GENERAL, True) self._mgr.UnInit() mainapp = wx.GetApp() mainapp.ExitMainLoop() @@ -1173,8 +1076,7 @@ self.server_thread.exit() dlg.Destroy() self.log.log("Server killed:", ORPG_GENERAL, True) - except: - pass + except: pass self.log.log("Exit orpgFrame->closed_confirmed(self)", ORPG_DEBUG) @@ -1183,7 +1085,8 @@ ######################################## class orpgSplashScreen(wx.SplashScreen): def __init__(self, parent, bitmapfile, duration, callback): - wx.SplashScreen.__init__(self, wx.Bitmap(bitmapfile), wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, duration, None, -1) + wx.SplashScreen.__init__(self, wx.Bitmap(bitmapfile), + wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, duration, None, -1) self.callback = callback self.closing = False self.Bind(wx.EVT_CLOSE, self.callback) @@ -1214,10 +1117,8 @@ def OnKeyPress(self, evt): #Event handler - if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): - self.ShowShell() - else: - evt.Skip() + if evt.AltDown() and evt.CmdDown() and evt.KeyCode == ord('I'): self.ShowShell() + else: evt.Skip() def ShowShell(self): #Show the PyCrust window. @@ -1244,18 +1145,12 @@ def OnExit_CleanUp(self): self.log.log("Preforming cleanup\n", ORPG_DEBUG) - try: - del os.environ["OPENRPG_BASE"] - except: - pass - try: - os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') - except: - pass - try: - os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') - except: - pass + try: del os.environ["OPENRPG_BASE"] + except: pass + try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.py') + except: pass + try: os.remove(os.environ["OPENRPG_BASE"] + os.sep + 'orpg' + os.sep + 'dirpath' + os.sep + 'approot.pyc') + except: pass def OnExit(self): self.OnExit_CleanUp() diff -r 67b900deb35c -r 78407d627cba orpg/mapper/background_handler.py --- a/orpg/mapper/background_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/background_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -52,14 +52,6 @@ self.color_button.SetBackgroundColour(wx.BLACK) self.color_button.SetForegroundColour(wx.WHITE) self.apply_button = wx.Button(self, wx.ID_ANY, "Apply", style=wx.BU_EXACTFIT) - """ - self.sizer.Add(self.bg_type, 0, wx.EXPAND) - self.sizer.Add(self.url_path, 1, wx.EXPAND) - self.sizer.Add(self.color_button, 0, wx.EXPAND) - self.sizer.Add(self.localBrowse, 0, wx.EXPAND) - self.sizer.Add(self.apply_button, 0, wx.EXPAND) - """ - self.sizer.Add(self.bg_type, 0, wx.ALIGN_CENTER) self.sizer.Add((6, 0)) self.sizer.Add(self.url_path, 1, wx.ALIGN_CENTER) @@ -69,7 +61,6 @@ self.sizer.Add(self.localBrowse, 0, wx.ALIGN_CENTER) self.sizer.Add((6, 0)) self.sizer.Add(self.apply_button, 0, wx.ALIGN_CENTER) - self.Bind(wx.EVT_BUTTON, self.on_bg_color, self.color_button) self.Bind(wx.EVT_BUTTON, self.on_apply, self.apply_button) self.Bind(wx.EVT_BUTTON, self.on_browse, self.localBrowse) @@ -78,7 +69,9 @@ def on_browse(self, evt): if self.bg_type.GetStringSelection() == 'Texture' or self.bg_type.GetStringSelection() == 'Image': - dlg = wx.FileDialog(None, "Select a Miniature to load", orpg.dirpath.dir_struct["user"]+'webfiles/', wildcard="Image files (*.bmp, *.gif, *.jpg, *.png)|*.bmp;*.gif;*.jpg;*.png", style=wx.OPEN) + dlg = wx.FileDialog(None, "Select a Miniature to load", + orpg.dirpath.dir_struct["user"]+'webfiles/', + wildcard="Image files (*.bmp, *.gif, *.jpg, *.png)|*.bmp;*.gif;*.jpg;*.png", style=wx.OPEN) if not dlg.ShowModal() == wx.ID_OK: dlg.Destroy() return @@ -90,13 +83,15 @@ postdata = urllib.urlencode({'filename':filename, 'imgdata':imgdata, 'imgtype':imgtype}) if self.settings.get_setting('LocalorRemote') == 'Remote': - thread.start_new_thread(self.canvas.layers['bg'].upload, (postdata, dlg.GetPath(), self.bg_type.GetStringSelection())) + thread.start_new_thread(self.canvas.layers['bg'].upload, + (postdata, dlg.GetPath(), self.bg_type.GetStringSelection())) else: try: min_url = open_rpg.get_component("cherrypy") + filename except: return - min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, open_rpg.get_component("cherrypy")) + '/' + filename + min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, + open_rpg.get_component("cherrypy")) + '/' + filename if self.bg_type.GetStringSelection() == 'Texture': self.canvas.layers['bg'].set_texture(min_url) diff -r 67b900deb35c -r 78407d627cba orpg/mapper/base_handler.py --- a/orpg/mapper/base_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/base_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -45,64 +45,42 @@ #self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick) - """ - def on_size(self,evt): - s = self.GetClientSizeTuple() - self.basesizer.SetDimension(0,0,s[0],s[1]) - """ - def build_ctrls(self): self.basesizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) - self.zoom_in_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) - self.zoom_out_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) - props = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) - mapopen = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) - mapsave = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) - - """ - self.buttonsizer.Add(self.zoom_in_button, 0, wx.EXPAND ) - self.buttonsizer.Add(self.zoom_out_button, 0, wx.EXPAND ) - self.buttonsizer.Add(props, 0, wx.EXPAND ) - self.buttonsizer.Add(mapopen, 0, wx.EXPAND ) - self.buttonsizer.Add(mapsave, 0, wx.EXPAND ) - """ - + self.zoom_in_button = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) + self.zoom_out_button = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) + props = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) + mapopen = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) + mapsave = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) self.buttonsizer.Add(self.zoom_in_button, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(self.zoom_out_button, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(props, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(mapopen, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(mapsave, 0, wx.ALIGN_CENTER ) - - """ - self.SetSizer(self.basesizer) - self.SetAutoLayout(True) - self.Fit() - """ - self.basesizer.Add((3, 0)) self.basesizer.Add( self.sizer, 1, wx.EXPAND) - - #self.basesizer.Add( self.buttonsizer, 0, wx.ALIGN_RIGHT) - self.basesizer.Add((12, 0)) self.basesizer.Add( self.buttonsizer, 0, wx.EXPAND | wx.ALIGN_RIGHT) self.basesizer.Add((3, 0)) - self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_in, self.zoom_in_button) self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_out, self.zoom_out_button) self.Bind(wx.EVT_BUTTON, self.map_frame.on_open, mapopen) self.Bind(wx.EVT_BUTTON, self.map_frame.on_save, mapsave) self.Bind(wx.EVT_BUTTON, self.canvas.on_prop, props) - self.SetSizer(self.basesizer) def build_menu(self,label = "Map"): "Menu is built based on the type of grid (rectangle or hex) we have in use." # do main menu - main_menu = wx.Menu(label) # create a menu resource + main_menu = wx.Menu(label) #create a menu resource main_menu.SetTitle(label) item = wx.MenuItem(main_menu, wx.ID_ANY, "&Load Map", "Load Map") self.canvas.Bind(wx.EVT_MENU, self.map_frame.on_open, item) diff -r 67b900deb35c -r 78407d627cba orpg/mapper/base_msg.py --- a/orpg/mapper/base_msg.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/base_msg.py Sat Jul 25 17:24:40 2009 -0500 @@ -36,7 +36,8 @@ def __init__(self,reentrant_lock_object = None): if not hasattr(self,"tagname"): - raise Exception, "This is a virtual class that cannot be directly instantiated. Set self.tagname in derived class." + raise Exception, + "This is a virtual class that cannot be directly instantiated. Set self.tagname in derived class." self._props = {} # This is a dictionary that holds (value,changed) 2-tuples, indexed by attribute diff -r 67b900deb35c -r 78407d627cba orpg/mapper/fog.py --- a/orpg/mapper/fog.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/fog.py Sat Jul 25 17:24:40 2009 -0500 @@ -200,7 +200,8 @@ mdc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID)) mdc.DrawRectangle(0,0,size[0],size[1]) srct = [int(topleft[0]/(sc[0]*COURSE)), int(topleft[1]/(sc[1]*COURSE))] - srcsz = [int((int(size[0]/COURSE+1)*COURSE)/(sc[0]*COURSE))+2, int((int(size[1]/COURSE+1)*COURSE)/(sc[1]*COURSE))+2] + srcsz = [int((int(size[0]/COURSE+1)*COURSE)/(sc[0]*COURSE))+2, + int((int(size[1]/COURSE+1)*COURSE)/(sc[1]*COURSE))+2] if (srct[0]+srcsz[0] > self.width): srcsz[0] = self.width-srct[0] if (srct[1]+srcsz[1] > self.height): diff -r 67b900deb35c -r 78407d627cba orpg/mapper/fog_handler.py --- a/orpg/mapper/fog_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/fog_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -48,39 +48,26 @@ self.f_type_radio = {} self.fogshow = wx.RadioButton(self, wx.ID_ANY, "Show", style=wx.RB_GROUP) self.foghide = wx.RadioButton(self, wx.ID_ANY, "Hide") - - #self.sizer.Add(self.foghide) - #self.sizer.Add(self.fogshow) - self.sizer.Add(self.foghide, 0, wx.ALIGN_CENTER) self.sizer.Add(self.fogshow, 0, wx.ALIGN_CENTER) - self.sizer.Add(wx.Size(20,25),1) - def build_menu(self,label = "fog"): base_layer_handler.build_menu(self,label) self.main_menu.AppendSeparator() - item = wx.MenuItem(self.main_menu, wx.ID_ANY, "&Hide All", "Hide All") self.canvas.Bind(wx.EVT_MENU, self.on_hideall, item) self.main_menu.AppendItem(item) - item = wx.MenuItem(self.main_menu, wx.ID_ANY, "&Fog Mask", "Fog Mask") self.canvas.Bind(wx.EVT_MENU, self.on_color, item) self.main_menu.AppendItem(item) - item = wx.MenuItem(self.main_menu, wx.ID_ANY, "&Remove Fog Layer", "Remove Fog Layer") self.canvas.Bind(wx.EVT_MENU, self.on_remove, item) self.main_menu.AppendItem(item) - item = wx.MenuItem(self.main_menu, wx.ID_ANY, "&Pen Color", "Pen Color") self.canvas.Bind(wx.EVT_MENU, self.on_pen_color, item) self.main_menu.AppendItem(item) - - - def on_remove(self,evt): session=self.canvas.frame.session if (session.my_role() != session.ROLE_GM): @@ -141,7 +128,6 @@ foglayer = self.canvas.layers['fog'] pass - def on_motion(self, evt): scale = self.canvas.layers['grid'].mapscale dc = wx.ClientDC(self.canvas) @@ -175,7 +161,8 @@ if (session.my_role() != session.ROLE_GM): open_rpg.get_component("chat").InfoPost("You must be a GM to use this feature") else: - # This code sets the mode to either new or del depending on the action to function with the updated createregen code. + # This code sets the mode to either new or del + # depending on the action to function with the updated createregen code. if (self.fogshow.GetValue() == 1): showmode = 'new' else: @@ -187,10 +174,12 @@ pen= wx.Pen(self.pencolor) pen.SetWidth(COURSE/2+1) dc.SetPen(pen) - dc.DrawLine(self.last.x*scale*COURSE,self.last.y*scale*COURSE,self.line[0].X*scale*COURSE,self.line[0].Y*scale*COURSE) + dc.DrawLine(self.last.x*scale*COURSE,self.last.y*scale*COURSE, + self.line[0].X*scale*COURSE,self.line[0].Y*scale*COURSE) dc.SetPen(wx.NullPen) wx.BeginBusyCursor() - # This prevents the divide by zero error by not even sending the line to be proccessed if it contains less then 3 points + # This prevents the divide by zero error by not even + # sending the line to be proccessed if it contains less then 3 points if (len(self.line)>1): self.canvas.layers['fog'].createregn(self.line, showmode) else: diff -r 67b900deb35c -r 78407d627cba orpg/mapper/grid.py --- a/orpg/mapper/grid.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/grid.py Sat Jul 25 17:24:40 2009 -0500 @@ -54,7 +54,8 @@ self.mapscale = 1.0 self.unit_size = 100 self.unit_size_y = 100 - #unit_widest and unit_offset are for the Hex Grid only. these are mathmatics to figure out the exact center of the hex + #unit_widest and unit_offset are for the Hex Grid only. + #These are mathematics to figure out the exact center of the hex self.unit_widest = 100 self.unit_offset = 100 #size_ratio is the size ajustment for Hex and ISO to make them more accurate diff -r 67b900deb35c -r 78407d627cba orpg/mapper/grid_handler.py --- a/orpg/mapper/grid_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/grid_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -44,20 +44,6 @@ self.apply_button = wx.Button(self, wx.ID_OK, "Apply", style=wx.BU_EXACTFIT) self.color_button.SetBackgroundColour(wx.BLACK) self.color_button.SetForegroundColour(wx.WHITE) - - """ - self.sizer.Add(wx.StaticText(self, -1, "Size: "), 0, wx.ALIGN_CENTER|wx.ALL, 3) - self.sizer.Add(self.grid_size, 0, wx.EXPAND|wx.ALL, 2) - self.sizer.Add(wx.StaticText(self, -1, "Ratio: "), 0, wx.ALIGN_CENTER|wx.ALL, 3) - self.sizer.Add(self.grid_ratio, 0, wx.EXPAND|wx.ALL, 2) - self.sizer.Add(self.line_type, 0, wx.EXPAND|wx.ALL, 3) - self.sizer.Add(self.grid_mode, 0, wx.EXPAND|wx.ALL, 2) - self.sizer.Add(self.grid_snap, 0, wx.EXPAND|wx.ALL, 3) - self.sizer.Add(self.color_button, 0, wx.EXPAND|wx.ALL, 2) - self.sizer.Add(self.apply_button, 0, wx.EXPAND|wx.ALL, 3) - self.sizer.Add(wx.Size(20,25),1) - """ - self.sizer.Add(wx.StaticText(self, -1, "Size: "), 0, wx.ALIGN_CENTER) self.sizer.Add(self.grid_size, 0, wx.ALIGN_CENTER) self.sizer.Add((6,0)) @@ -73,7 +59,6 @@ self.sizer.Add(self.color_button, 0, wx.ALIGN_CENTER) self.sizer.Add((6,0)) self.sizer.Add(self.apply_button, 0, wx.ALIGN_CENTER) - self.Bind(wx.EVT_BUTTON, self.on_bg_color, self.color_button) self.Bind(wx.EVT_BUTTON, self.on_apply, self.apply_button) self.update_info() diff -r 67b900deb35c -r 78407d627cba orpg/mapper/images.py --- a/orpg/mapper/images.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/images.py Sat Jul 25 17:24:40 2009 -0500 @@ -75,10 +75,12 @@ self.__cache[path] = (path, d[0], d[1].gettype(), None) return wx.ImageFromMime(self.__cache[path][1], self.__cache[path][2]).ConvertToBitmap() else: - open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, ORPG_GENERAL, True) + open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, + ORPG_GENERAL, True) return None except IOError: - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) + open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, + ORPG_GENERAL, True) return None def cleanCache(self): @@ -117,11 +119,13 @@ if self.__fetching.has_key(path): del self.__fetching[path] else: - open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, ORPG_GENERAL, True) + open_rpg.get_component('log').log("Image refused to load or URI did not reference a valid image: " + path, + ORPG_GENERAL, True) del self.__fetching[path] except IOError: del self.__fetching[path] - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, ORPG_GENERAL, True) + open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT laoded: " + path, + ORPG_GENERAL, True) finally: self.__lock.release() @@ -135,7 +139,8 @@ break except: self.__fetching[path] = False - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) + open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, + ORPG_GENERAL, True) return self.__lock.acquire() try: diff -r 67b900deb35c -r 78407d627cba orpg/mapper/map.py --- a/orpg/mapper/map.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/map.py Sat Jul 25 17:24:40 2009 -0500 @@ -59,7 +59,8 @@ self.log.log("Enter MapCanvas", ORPG_DEBUG) self.settings = open_rpg.get_component("settings") self.session = open_rpg.get_component("session") - wx.ScrolledWindow.__init__(self, parent, ID, style=wx.HSCROLL | wx.VSCROLL | wx.FULL_REPAINT_ON_RESIZE | wx.SUNKEN_BORDER ) + wx.ScrolledWindow.__init__(self, parent, ID, + style=wx.HSCROLL | wx.VSCROLL | wx.FULL_REPAINT_ON_RESIZE | wx.SUNKEN_BORDER ) self.frame = parent self.MAP_MODE = 1 #Mode 1 = MINI, 2 = DRAW, 3 = TAPE MEASURE self.layers = {} @@ -164,7 +165,8 @@ self.cacheSize = int(cacheSize) else: self.log.log("Default cache size being used.", ORPG_GENERAL) - self.log.log("Current image cache size is set at " + str(self.cacheSize) + " images, using random purge.", ORPG_GENERAL) + self.log.log("Current image cache size is set at " + str(self.cacheSize) + " images, using random purge.", + ORPG_GENERAL) if not ImageHandler.Queue.empty(): (path, image_type, imageId) = ImageHandler.Queue.get() img = wx.ImageFromMime(path[1], path[2]).ConvertToBitmap() @@ -300,8 +302,10 @@ dc.SetDeviceOrigin(-topleft[0], -topleft[1]) dc.SetUserScale(scale, scale) self.layers['bg'].layerDraw(dc, scale, topleft, clientsize) - self.layers['grid'].layerDraw(dc, [topleft[0]/scale, topleft[1]/scale], [clientsize[0]/scale, clientsize[1]/scale]) - self.layers['miniatures'].layerDraw(dc, [topleft[0]/scale, topleft[1]/scale], [clientsize[0]/scale, clientsize[1]/scale]) + self.layers['grid'].layerDraw(dc, [topleft[0]/scale, topleft[1]/scale], + [clientsize[0]/scale, clientsize[1]/scale]) + self.layers['miniatures'].layerDraw(dc, [topleft[0]/scale, topleft[1]/scale], + [clientsize[0]/scale, clientsize[1]/scale]) self.layers['whiteboard'].layerDraw(dc) self.layers['fog'].layerDraw(dc, topleft, clientsize) dc.SetPen(wx.NullPen) @@ -902,15 +906,6 @@ #self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) self.load_default() - - """ - # size of tabs is diffrent on windows and linux :( - if wx.Platform == '__WXMSW__': - self.toolbar_height = 50 - else: - self.toolbar_height = 55 - """ - self.log.log("Exit map_wnd", ORPG_DEBUG) def OnLeave(self, evt): @@ -1132,12 +1127,3 @@ self.build_menu() self.log.log("Exit map_wnd->get_hot_keys(self)", ORPG_DEBUG) return [] - - """ - def on_size(self, evt): - self.log.log("Enter map_wnd->on_size(self, evt)", ORPG_DEBUG) - s = self.GetClientSizeTuple() - self.canvas.SetDimensions(0,0,s[0],s[1]-self.toolbar_height) - self.layer_tabs.SetDimensions(0,s[1]-self.toolbar_height,s[0],self.toolbar_height) - self.log.log("Exit map_wnd->on_size(self, evt)", ORPG_DEBUG) - """ diff -r 67b900deb35c -r 78407d627cba orpg/mapper/map_handler.py --- a/orpg/mapper/map_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/map_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -34,33 +34,10 @@ def build_ctrls(self): base_layer_handler.build_ctrls(self) - - """ - self.width = wx.TextCtrl(self, wx.ID_ANY, size=(75,25)) - self.height = wx.TextCtrl(self, wx.ID_ANY, size=(75,25)) - self.apply_button = wx.Button(self, wx.ID_OK, "Apply", style=wx.BU_EXACTFIT) - """ - self.width = wx.TextCtrl(self, wx.ID_ANY) self.height = wx.TextCtrl(self, wx.ID_ANY) self.apply_button = wx.Button(self, wx.ID_OK, "Apply", style=wx.BU_EXACTFIT) - self.load_default = wx.Button(self, wx.ID_ANY, "Default Map", style=wx.BU_EXACTFIT) - - """ - self.sizer.Prepend(wx.Size(20,25),1) - self.sizer.Prepend(self.load_default, 0, wx.EXPAND) - self.sizer.Prepend(wx.Size(20,25)) - self.sizer.Prepend(self.apply_button, 0, wx.EXPAND) - self.sizer.Prepend(wx.Size(20,25)) - self.sizer.Prepend(self.height, 0, wx.EXPAND) - self.sizer.Prepend(wx.StaticText(self, -1, "Height: "),0,wx.ALIGN_CENTER) - self.sizer.Prepend(wx.Size(10,25)) - self.sizer.Prepend(self.width, 0, wx.EXPAND) - self.sizer.Prepend(wx.StaticText(self, -1, "Width: "),0,wx.ALIGN_CENTER) - self.sizer.Prepend(wx.Size(10,25)) - """ - self.sizer.Add(wx.StaticText(self, -1, "Width: "),0, wx.ALIGN_CENTER) self.sizer.Add(self.width, 0, wx.ALIGN_CENTER) self.sizer.Add((6, 0)) @@ -70,7 +47,6 @@ self.sizer.Add(self.apply_button, 0, wx.ALIGN_CENTER) self.sizer.Add((6, 0)) self.sizer.Add(self.load_default, 0, wx.ALIGN_CENTER) - self.Bind(wx.EVT_BUTTON, self.on_apply, self.apply_button) self.Bind(wx.EVT_BUTTON, self.on_load_default, self.load_default) self.update_info() diff -r 67b900deb35c -r 78407d627cba orpg/mapper/map_msg.py --- a/orpg/mapper/map_msg.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/map_msg.py Sat Jul 25 17:24:40 2009 -0500 @@ -86,7 +86,8 @@ continue else: self.p_lock.release() - raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" + raise Exception, + "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" self.p_lock.release() def set_from_dom(self,xml_dom): @@ -123,7 +124,8 @@ continue else: self.p_lock.release() - raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map" + raise Exception, + "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map" self.p_lock.release() def get_all_xml(self, action="new", output_action=1): diff -r 67b900deb35c -r 78407d627cba orpg/mapper/map_prop_dialog.py --- a/orpg/mapper/map_prop_dialog.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/map_prop_dialog.py Sat Jul 25 17:24:40 2009 -0500 @@ -211,9 +211,9 @@ self.size = (int(self.ctrls[CTRL_WIDTH].GetValue()),int(self.ctrls[CTRL_HEIGHT].GetValue())) except: pass -# dlg = wx.MessageDialog(frame, 'Invalid Size',"Error") -# dlg.ShowModal() -# dlg.Destroy() + #dlg = wx.MessageDialog(frame, 'Invalid Size',"Error") + #dlg.ShowModal() + #dlg.Destroy() if self.ctrls[CTRL_BG_COLOR].GetValue() == True: self.bg_layer.set_color(self.ctrls[CTRL_BG_COLOR_VALUE].GetBackgroundColour()) elif self.ctrls[CTRL_TEXTURE].GetValue() == True: diff -r 67b900deb35c -r 78407d627cba orpg/mapper/min_dialogs.py --- a/orpg/mapper/min_dialogs.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/min_dialogs.py Sat Jul 25 17:24:40 2009 -0500 @@ -151,7 +151,7 @@ min_index.append(item-loop_count+1) if len(min_list) > 0: for sel_rmin in min_list: -############# + ############# min_xml = sel_rmin.toxml(action="new") node_begin = "' print "Sending this XML to insert_xml:" + node_xml gametree.insert_xml(node_xml) -########## + ############# self.listctrl.DeleteAllItems() self.refresh() event.Skip() @@ -244,22 +244,27 @@ listsizer.Add(wx.StaticText(self, -1, "Path:"), 0, wx.EXPAND) listsizer.Add(self.pathcombo, 0, wx.EXPAND) listsizer.Add(wx.Size(10,10)) - self.heading = wx.RadioBox(self, MIN_HEADING, "Heading", choices=["None","N","NE","E","SE","S","SW","W","NW","no change"], majorDimension=5, style=wx.RA_SPECIFY_COLS) + self.heading = wx.RadioBox(self, MIN_HEADING, "Heading", + choices=["None","N","NE","E","SE","S","SW","W","NW","no change"], majorDimension=5, style=wx.RA_SPECIFY_COLS) self.heading.SetSelection( 9 ) listsizer.Add( self.heading, 0, wx.EXPAND ) listsizer.Add(wx.Size(10,10)) - self.face = wx.RadioBox(self, MIN_FACE, "Facing", choices=["None","N","NE","E","SE","S","SW","W","NW","no change"], majorDimension=5, style=wx.RA_SPECIFY_COLS) + self.face = wx.RadioBox(self, MIN_FACE, "Facing", + choices=["None","N","NE","E","SE","S","SW","W","NW","no change"], majorDimension=5, style=wx.RA_SPECIFY_COLS) self.face.SetSelection(9) listsizer.Add(self.face, 0, wx.EXPAND) -### -### Group together locked, Hide, and snap radioboxes in group2 box -### + ### + ###Group together locked, Hide, and snap radioboxes in group2 box + ### group2 = wx.BoxSizer(wx.HORIZONTAL) - self.locked = wx.RadioBox(self, MIN_LOCK, "Lock", choices=["Don't lock","Lock","no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) + self.locked = wx.RadioBox(self, MIN_LOCK, "Lock", + choices=["Don't lock","Lock","no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) self.locked.SetSelection(2) - self.hide = wx.RadioBox(self, MIN_HIDE, "Hide", choices=["Don't hide", "Hide", "no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) + self.hide = wx.RadioBox(self, MIN_HIDE, "Hide", + choices=["Don't hide", "Hide", "no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) self.hide.SetSelection(2) - self.snap = wx.RadioBox(self,MIN_ALIGN,"Snap",choices=["Center","Top left","no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) + self.snap = wx.RadioBox(self,MIN_ALIGN,"Snap", + choices=["Center","Top left","no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) self.snap.SetSelection(2) group2.Add(self.locked, 0, wx.EXPAND) group2.Add(wx.Size(10,0)) @@ -268,9 +273,9 @@ group2.Add(self.snap, 0, wx.EXPAND) group2.Add(wx.Size(10,0)) listsizer.Add(group2,0,0) -### -### group together the postion radiobox and the and its selection elements -### + ### + ###Group together the postion radiobox and the and its selection elements + ### xpos = int(min_list[0].pos[0]) #xpos = int(`min_list[0].pos`[1:`min_list[0].pos`.index(',')]) ypos = int(min_list[0].pos[1]) @@ -283,7 +288,8 @@ self.scy.SetValue(1) self.scy.SetValue(ypos) positionbox = wx.BoxSizer(wx.HORIZONTAL) - self.poschoice = wx.RadioBox(self,MIN_POS,"Position",choices=["Manual", "Existing", "no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) + self.poschoice = wx.RadioBox(self,MIN_POS,"Position", + choices=["Manual", "Existing", "no change"],majorDimension=1,style=wx.RA_SPECIFY_COLS) self.poschoice.SetSelection(2) positionbox.Add(self.poschoice,0,0) ### @@ -303,9 +309,9 @@ spinbox.Add(self.scy, 0, 0) poschoicebox.Add(wx.Size(0,15)) poschoicebox.Add(spinbox,0,0) - ### - ### kludge is just a way to horizontaly position text. .Add doesn't seem to work. - ### + ### + ### kludge is just a way to horizontaly position text. .Add doesn't seem to work. + ### kluge = wx.BoxSizer(wx.HORIZONTAL) klugetext = wx.StaticText(self, -1, " ") kluge.Add(klugetext,0,0) @@ -356,7 +362,8 @@ image[-1] = -1 while image[1] == -1: image = 0 - self.dlg = wx.TextEntryDialog(self, 'You entered an invalid URL for the image path. Please Enter a valid URL or cancel to leave the old url unchanged') + self.dlg = wx.TextEntryDialog(self, + 'You entered an invalid URL for the image path. Please Enter a valid URL or cancel to leave the old url unchanged') if self.dlg.ShowModal() == wx.ID_OK: path = self.dlg.GetValue() image = self.evaluate(path) @@ -432,9 +439,11 @@ sizer.Add(wx.StaticText(self, -1, "Label:"), 0, wx.EXPAND) sizer.Add(self.label, 0, wx.EXPAND) sizer.Add(wx.Size(10,10)) - self.heading = wx.RadioBox(self, MIN_HEADING, "Heading", choices=["None","N","NE","E","SE","S","SW","W","NW"],majorDimension=5,style=wx.RA_SPECIFY_COLS) + self.heading = wx.RadioBox(self, MIN_HEADING, "Heading", + choices=["None","N","NE","E","SE","S","SW","W","NW"],majorDimension=5,style=wx.RA_SPECIFY_COLS) self.heading.SetSelection(min.heading) - self.face = wx.RadioBox(self, MIN_FACE, "Facing", choices=["None","N","NE","E","SE","S","SW","W","NW"],majorDimension=5,style=wx.RA_SPECIFY_COLS) + self.face = wx.RadioBox(self, MIN_FACE, "Facing", + choices=["None","N","NE","E","SE","S","SW","W","NW"],majorDimension=5,style=wx.RA_SPECIFY_COLS) self.face.SetSelection(min.face) self.locked = wx.CheckBox(self, MIN_LOCK, " Lock") self.locked.SetValue(min.locked) @@ -487,9 +496,9 @@ if self.min_scaling.GetValue() == False: return elif self.min_width.GetValue() and wxID_MIN_WIDTH == evt.GetId() and self.min_width.GetInsertionPoint(): - self.min_height.SetValue ( str(int((float(self.min_width.GetValue()) / float(self.min_width_old_value)) * float(self.min_height_old_value))) ) + self.min_height.SetValue(str(int((float(self.min_width.GetValue()) / float(self.min_width_old_value)) * float(self.min_height_old_value))) ) elif self.min_height.GetValue() and wxID_MIN_HEIGHT == evt.GetId() and self.min_height.GetInsertionPoint(): - self.min_width.SetValue ( str(int((float(self.min_height.GetValue()) / float(self.min_height_old_value)) * float(self.min_width_old_value))) ) + self.min_width.SetValue(str(int((float(self.min_height.GetValue()) / float(self.min_height_old_value)) * float(self.min_width_old_value))) ) def update_min(self): self.min.set_min_props(self.heading.GetSelection(), @@ -514,7 +523,7 @@ class min_edit_dialog(wx.Dialog): def __init__(self,parent,min): -#520,265 + #520,265 wx.Dialog.__init__(self,parent,-1,"Miniature",wx.DefaultPosition,wx.Size(520,350)) (w,h) = self.GetClientSizeTuple() mastersizer = wx.BoxSizer(wx.VERTICAL) diff -r 67b900deb35c -r 78407d627cba orpg/mapper/miniatures.py --- a/orpg/mapper/miniatures.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/miniatures.py Sat Jul 25 17:24:40 2009 -0500 @@ -69,7 +69,9 @@ return value class BmpMiniature: - def __init__(self, id,path, bmp, pos=cmpPoint(0,0), heading=FACE_NONE, face=FACE_NONE, label="", locked=False, hide=False, snap_to_align=SNAPTO_ALIGN_CENTER, zorder=0, width=0, height=0, log=None, local=False, localPath='', localTime=-1): + def __init__(self, id,path, bmp, pos=cmpPoint(0,0), heading=FACE_NONE, face=FACE_NONE, label="", + locked=False, hide=False, snap_to_align=SNAPTO_ALIGN_CENTER, zorder=0, width=0, height=0, + log=None, local=False, localPath='', localTime=-1): self.log = log self.log.log("Enter BmpMiniature", ORPG_DEBUG) self.heading = heading @@ -115,7 +117,8 @@ self.log.log("Exit BmpMiniature->set_bmp(self, bmp)", ORPG_DEBUG) def set_min_props(self, heading=FACE_NONE, face=FACE_NONE, label="", locked=False, hide=False, width=0, height=0): - self.log.log("Enter BmpMiniature->set_min_props(self, heading, face, label, locked, hide, width, height)", ORPG_DEBUG) + self.log.log("Enter BmpMiniature->set_min_props(self, heading, face, label, locked, hide, width, height)", + ORPG_DEBUG) self.heading = heading self.face = face self.label = label @@ -130,7 +133,8 @@ self.width = int(width) self.height = int(height) self.isUpdated = True - self.log.log("Exit BmpMiniature->set_min_props(self, heading, face, label, locked, hide, width, height)", ORPG_DEBUG) + self.log.log("Exit BmpMiniature->set_min_props(self, heading, face, label, locked, hide, width, height)", + ORPG_DEBUG) def hit_test(self, pt): self.log.log("Enter BmpMiniature->hit_test(self, pt)", ORPG_DEBUG) @@ -162,7 +166,8 @@ tmp_image.Rescale(int(self.width), int(self.height)) tmp_image.ConvertAlphaToMask() self.bmp = tmp_image.ConvertToBitmap() - mask = wx.Mask(self.bmp, wx.Colour(tmp_image.GetMaskRed(), tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) + mask = wx.Mask(self.bmp, wx.Colour(tmp_image.GetMaskRed(), + tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) self.bmp.SetMask(mask) del tmp_image del mask @@ -183,7 +188,9 @@ yoffset = 1 else: yoffset = 5 - dc.DrawRectangle(self.pos.x + xoffset, self.pos.y + yoffset, self.bmp.GetWidth() - (xoffset * 2), self.bmp.GetHeight() - (yoffset * 2)) + dc.DrawRectangle(self.pos.x + xoffset, + self.pos.y + yoffset, self.bmp.GetWidth() - (xoffset * 2), + self.bmp.GetHeight() - (yoffset * 2)) dc.SetBrush(wx.NullBrush) dc.SetPen(wx.NullPen) ## draw label in the center of the mini @@ -226,7 +233,8 @@ tmp_image.Rescale(int(self.width), int(self.height)) tmp_image.ConvertAlphaToMask() self.bmp = tmp_image.ConvertToBitmap() - mask = wx.Mask(self.bmp, wx.Colour(tmp_image.GetMaskRed(), tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) + mask = wx.Mask(self.bmp, wx.Colour(tmp_image.GetMaskRed(), + tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) self.bmp.SetMask(mask) if self.gray: tmp_image = tmp_image.ConvertToGreyscale() @@ -554,12 +562,16 @@ self.serial_number -= 1 self.log.log("Exit miniature_layer->rollback_serial(self)", ORPG_DEBUG) - def add_miniature(self, id, path, pos=cmpPoint(0,0), label="", heading=FACE_NONE, face=FACE_NONE, width=0, height=0, local=False, localPath='', localTime=-1): - self.log.log("Enter miniature_layer->add_miniature(self, id, path, pos, label, heading, face, width, height)", ORPG_DEBUG) + def add_miniature(self, id, path, pos=cmpPoint(0,0), label="", heading=FACE_NONE, + face=FACE_NONE, width=0, height=0, local=False, localPath='', localTime=-1): + self.log.log("Enter miniature_layer->add_miniature(self, id, path, pos, label, heading, face, width, height)", + ORPG_DEBUG) self.log.log("Before mini creation: " + str(self.get_next_highest_z()), ORPG_DEBUG) bmp = ImageHandler.load(path, 'miniature', id) if bmp: - mini = BmpMiniature(id, path, bmp, pos, heading, face, label, zorder=self. get_next_highest_z(), width=width, height=height, log=self.log, local=local, localPath=localPath, localTime=localTime) + mini = BmpMiniature(id, path, bmp, pos, heading, face, label, + zorder=self. get_next_highest_z(), width=width, + height=height, log=self.log, local=local, localPath=localPath, localTime=localTime) self.log.log("After mini creation:" + str(self.get_next_highest_z()), ORPG_DEBUG) self.miniatures.append(mini) self.log.log("After mini addition:" + str(self.get_next_highest_z()), ORPG_DEBUG) @@ -569,7 +581,8 @@ self.canvas.frame.session.send(xml_str) else: self.log.log("Invalid image " + path + " has been ignored!", ORPG_DEBUG) - self.log.log("Exit miniature_layer->add_miniature(self, id, path, pos, label, heading, face, width, height)", ORPG_DEBUG) + self.log.log("Exit miniature_layer->add_miniature(self, id, path, pos, label, heading, face, width, height)", + ORPG_DEBUG) def get_miniature_by_id(self, id): self.log.log("Enter miniature_layer->get_miniature_by_id(self, id)", ORPG_DEBUG) @@ -601,9 +614,7 @@ def layerDraw(self, dc, topleft, size): self.log.log("Enter miniature_layer->layerDraw(self, dc, topleft, size)", ORPG_DEBUG) - dc.SetFont(self.label_font) - sorted_miniatures = self.miniatures[:] sorted_miniatures.sort(cmp_zorder) for m in sorted_miniatures: @@ -691,7 +702,8 @@ snap_to_align = int(c.getAttribute('align')) if c.getAttribute('zorder'): zorder = int(c.getAttribute('zorder')) - min = BmpMiniature(id, path, ImageHandler.load(path, 'miniature', id), pos, heading, face, label, locked, hide, snap_to_align, zorder, width, height, self.log) + min = BmpMiniature(id, path, ImageHandler.load(path, 'miniature', id), pos, heading, + face, label, locked, hide, snap_to_align, zorder, width, height, self.log) self.miniatures.append(min) if c.hasAttribute('local') and c.getAttribute('local') == 'True' and os.path.exists(urllib.unquote(c.getAttribute('localPath'))): localPath = urllib.unquote(c.getAttribute('localPath')) @@ -735,7 +747,8 @@ else: min_label = "" id = 'mini-' + self.canvas.frame.session.get_next_id() - self.add_miniature(id, path, pos=pos, label=min_label, local=True, localPath=filename, localTime=time.time()) + self.add_miniature(id, path, pos=pos, label=min_label, local=True, + localPath=filename, localTime=time.time()) else: self.miniatures[len(self.miniatures)-1].local = True self.miniatures[len(self.miniatures)-1].localPath = filename diff -r 67b900deb35c -r 78407d627cba orpg/mapper/miniatures_handler.py --- a/orpg/mapper/miniatures_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/miniatures_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -168,7 +168,8 @@ min_url = open_rpg.get_component("cherrypy") + filename except: return - min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, open_rpg.get_component("cherrypy")) + '/' + filename + min_url = dlg.GetDirectory().replace(orpg.dirpath.dir_struct["user"]+'webfiles' + os.sep, + open_rpg.get_component("cherrypy")) + '/' + filename # build url if min_url == "" or min_url == "http://": return @@ -388,11 +389,17 @@ self.sel_min.selected = False self.sel_min.isUpdated = True self.sel_min = None - recycle_bin = {MIN_HEADING_NONE: FACE_NONE, MIN_HEADING_NORTH: FACE_NORTH, MIN_HEADING_NORTHWEST: FACE_NORTHWEST, MIN_HEADING_NORTHEAST: FACE_NORTHEAST, MIN_HEADING_EAST: FACE_EAST, MIN_HEADING_SOUTHEAST: FACE_SOUTHEAST, MIN_HEADING_SOUTHWEST: FACE_SOUTHWEST, MIN_HEADING_SOUTH: FACE_SOUTH, MIN_HEADING_WEST: FACE_WEST} + recycle_bin = {MIN_HEADING_NONE: FACE_NONE, MIN_HEADING_NORTH: FACE_NORTH, + MIN_HEADING_NORTHWEST: FACE_NORTHWEST, MIN_HEADING_NORTHEAST: FACE_NORTHEAST, + MIN_HEADING_EAST: FACE_EAST, MIN_HEADING_SOUTHEAST: FACE_SOUTHEAST, MIN_HEADING_SOUTHWEST: FACE_SOUTHWEST, + MIN_HEADING_SOUTH: FACE_SOUTH, MIN_HEADING_WEST: FACE_WEST} if recycle_bin.has_key(id): self.sel_rmin.heading = recycle_bin[id] recycle_bin = {} - recycle_bin = {MIN_FACING_NONE: FACE_NONE, MIN_FACING_NORTH: FACE_NORTH, MIN_FACING_NORTHWEST: FACE_NORTHWEST, MIN_FACING_NORTHEAST: FACE_NORTHEAST, MIN_FACING_EAST: FACE_EAST, MIN_FACING_SOUTHEAST: FACE_SOUTHEAST, MIN_FACING_SOUTHWEST: FACE_SOUTHWEST, MIN_FACING_SOUTH: FACE_SOUTH, MIN_FACING_WEST: FACE_WEST} + recycle_bin = {MIN_FACING_NONE: FACE_NONE, MIN_FACING_NORTH: FACE_NORTH, + MIN_FACING_NORTHWEST: FACE_NORTHWEST, MIN_FACING_NORTHEAST: FACE_NORTHEAST, + MIN_FACING_EAST: FACE_EAST, MIN_FACING_SOUTHEAST: FACE_SOUTHEAST, MIN_FACING_SOUTHWEST: FACE_SOUTHWEST, + MIN_FACING_SOUTH: FACE_SOUTH, MIN_FACING_WEST: FACE_WEST} if recycle_bin.has_key(id): self.sel_rmin.face = recycle_bin[id] recycle_bin = {} @@ -589,12 +596,6 @@ return self.sel_min = mini self.sel_min.selected = True - """ - dc = wx.ClientDC(self.canvas) - self.canvas.PrepareDC(dc) - dc.SetUserScale(self.canvas.layers['grid'].mapscale,self.canvas.layers['grid'].mapscale) - self.sel_min.draw(dc, self.canvas.layers['miniatures']) - """ self.canvas.Refresh() else: self.drag_mini = None @@ -636,7 +637,7 @@ filename = filepath[start1:] pos = filename.rfind('.') ext = filename[pos:].lower() - # ext = filename[-4:].lower() + #ext = filename[-4:].lower() if(ext != ".bmp" and ext != ".gif" and ext != ".jpg" and ext != ".jpeg" and ext != ".png"): self.infoPost("Supported file extensions are: *.bmp, *.gif, *.jpg, *.jpeg, *.png") return @@ -671,10 +672,12 @@ drag_bmp = self.drag_mini.bmp if self.drag_mini.width and self.drag_mini.height: tmp_image = drag_bmp.ConvertToImage() - tmp_image.Rescale(int(self.drag_mini.width * self.canvas.layers['grid'].mapscale), int(self.drag_mini.height * self.canvas.layers['grid'].mapscale)) + tmp_image.Rescale(int(self.drag_mini.width * self.canvas.layers['grid'].mapscale), + int(self.drag_mini.height * self.canvas.layers['grid'].mapscale)) tmp_image.ConvertAlphaToMask() drag_bmp = tmp_image.ConvertToBitmap() - mask = wx.Mask(drag_bmp, wx.Colour(tmp_image.GetMaskRed(), tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) + mask = wx.Mask(drag_bmp, wx.Colour(tmp_image.GetMaskRed(), + tmp_image.GetMaskGreen(), tmp_image.GetMaskBlue())) drag_bmp.SetMask(mask) tmp_image = tmp_image.ConvertToGreyscale() self.drag_mini.gray = True @@ -685,7 +688,8 @@ wx.CallAfter(refresh) self.canvas.drag = wx.DragImage(drag_bmp) self.drag_offset = self.getLogicalPosition(evt)- self.drag_mini.pos - self.canvas.drag.BeginDrag((int(self.drag_offset.x * self.canvas.layers['grid'].mapscale), int(self.drag_offset.y * self.canvas.layers['grid'].mapscale)), self.canvas, False) + self.canvas.drag.BeginDrag((int(self.drag_offset.x * self.canvas.layers['grid'].mapscale), + int(self.drag_offset.y * self.canvas.layers['grid'].mapscale)), self.canvas, False) elif self.canvas.drag is not None: self.canvas.drag.Move(evt.GetPosition()) self.canvas.drag.Show() diff -r 67b900deb35c -r 78407d627cba orpg/mapper/miniatures_msg.py --- a/orpg/mapper/miniatures_msg.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/miniatures_msg.py Sat Jul 25 17:24:40 2009 -0500 @@ -117,7 +117,8 @@ else: self.p_lock.release() - raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" + raise Exception, + "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element" self.p_lock.release() diff -r 67b900deb35c -r 78407d627cba orpg/mapper/whiteboard.py --- a/orpg/mapper/whiteboard.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/whiteboard.py Sat Jul 25 17:24:40 2009 -0500 @@ -209,7 +209,8 @@ self.highlighted = highlight self.log.log("Enter WhiteboardLine->highlight(self, highlight)", ORPG_DEBUG) - def set_line_props(self, line_string="", upperleftx=0, upperlefty=0, lowerrightx=0, lowerrighty=0, color="#000000", width=1): + def set_line_props(self, line_string="", upperleftx=0, upperlefty=0, + lowerrightx=0, lowerrighty=0, color="#000000", width=1): self.log.log("Enter WhiteboardLine->set_line_props(self, line_string, upperleftx, upperlefty, lowerrightx, lowerrighty, color, width)", ORPG_DEBUG) self.line_string = line_string self.upperleft.x = upperleftx @@ -655,7 +656,8 @@ #self.canvas.send_map_data() def add_temp_line(self, line_string): - line = WhiteboardLine(0, line_string, wx.Point(0,0), wx.Point(0,0), color=self.color, width=self.width, log=self.log) + line = WhiteboardLine(0, line_string, wx.Point(0,0), wx.Point(0,0), + color=self.color, width=self.width, log=self.log) self.lines.append(line) return line diff -r 67b900deb35c -r 78407d627cba orpg/mapper/whiteboard_handler.py --- a/orpg/mapper/whiteboard_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/whiteboard_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -67,7 +67,8 @@ self.radius.SetValue("15") self.live_refresh = wx.CheckBox(self, wx.ID_ANY, " Live Refresh") self.live_refresh.SetValue(True) - self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20), choices=['1','2','3','4','5','6','7','8','9','10']) + self.widthList= wx.Choice(self, wx.ID_ANY, size= wx.Size(40, 20), + choices=['1','2','3','4','5','6','7','8','9','10']) self.widthList.SetSelection(0) #always start showing "1" self.sizer.Add(wx.StaticText(self, wx.ID_ANY, "Line Width: "),0,wx.ALIGN_CENTER) self.sizer.Add(self.widthList, 0, wx.EXPAND) @@ -103,7 +104,8 @@ self.txt_boxer.Add(self.text_control,1,wx.EXPAND) self.point_boxer = wx.BoxSizer(wx.HORIZONTAL) self.point_static = wx.StaticText(self.text_properties_dialog, -1, "Text Size: ") - self.point_control = wx.SpinCtrl(self.text_properties_dialog, wx.ID_ANY, value = "12",min = 1, initial = 12, name = "Font Size: ") + self.point_control = wx.SpinCtrl(self.text_properties_dialog, wx.ID_ANY, value = "12", + min = 1, initial = 12, name = "Font Size: ") self.point_boxer.Add(self.point_static,1,wx.EXPAND) self.point_boxer.Add(wx.Size(10,10)) self.point_boxer.Add(self.point_control,0,wx.EXPAND) diff -r 67b900deb35c -r 78407d627cba orpg/mapper/whiteboard_msg.py --- a/orpg/mapper/whiteboard_msg.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/whiteboard_msg.py Sat Jul 25 17:24:40 2009 -0500 @@ -103,7 +103,8 @@ self.children[id].init_props(item.get_all_props()) else: self.p_lock.release() - raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard" + raise Exception, + "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element in whiteboard" self.p_lock.release() def set_from_dom(self,xml_dom): diff -r 67b900deb35c -r 78407d627cba orpg/orpg_version.py --- a/orpg/orpg_version.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/orpg_version.py Sat Jul 25 17:24:40 2009 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse Dev" DIS_VER = "Grumpy Goblin" -BUILD = "090721-02" +BUILD = "090725-00" # This version is for network capability. PROTOCOL_VERSION = "1.2" diff -r 67b900deb35c -r 78407d627cba orpg/player_list.py --- a/orpg/player_list.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/player_list.py Sat Jul 25 17:24:40 2009 -0500 @@ -78,8 +78,9 @@ class player_list(wx.ListCtrl): def __init__( self, parent): -## wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND ) - wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES ) + ##wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND ) + wx.ListCtrl.__init__( self, parent, -1, wx.DefaultPosition, wx.DefaultSize, + wx.LC_REPORT|wx.SUNKEN_BORDER|wx.EXPAND|wx.LC_HRULES ) self.session = open_rpg.get_component("session") self.settings = open_rpg.get_component('settings') self.chat = open_rpg.get_component('chat') @@ -198,7 +199,8 @@ self.chat = open_rpg.get_component("chat") boot_pwd = self.password_manager.GetPassword("admin",int(self.session.group_id)) if boot_pwd != None: - alter_pwd_dialog = wx.TextEntryDialog(self,"Enter new room password: (blank for no password)","Alter Room Password") + alter_pwd_dialog = wx.TextEntryDialog(self, + "Enter new room password: (blank for no password)","Alter Room Password") if alter_pwd_dialog.ShowModal() == wx.ID_OK: new_pass = alter_pwd_dialog.GetValue() self.chat.InfoPost( "Requesting password change on server..." ) @@ -257,8 +259,7 @@ WG_MENU_LIST[mid]["menu"].Destroy() except: self.wgMenu.UpdateUI() - if self.wgMenu.GetMenuItemCount() == 2: - WG_MENU_LIST.clear() + if self.wgMenu.GetMenuItemCount() == 2: WG_MENU_LIST.clear() return def on_menu_whispergroup( self, evt ): @@ -275,23 +276,13 @@ group_name = create_new_group_dialog.GetValue() WG_LIST[group_name] = {} return - elif id == PLAYER_WG_CLEAR_ALL: - WG_LIST.clear() - return + elif id == PLAYER_WG_CLEAR_ALL: WG_LIST.clear(); return #Check Sub Menus for mid in WG_MENU_LIST: - if id == WG_MENU_LIST[mid]["add"]: - WG_LIST[mid][int(item.GetText())] = int(item.GetText()) - return - elif id == WG_MENU_LIST[mid]["remove"]: - del WG_LIST[mid][int(item.GetText())] - return - elif id == WG_MENU_LIST[mid]["clear"]: - WG_LIST[mid].clear() - return - elif id == WG_MENU_LIST[mid]["whisper"]: - self.chat.set_chat_text("/gw " + mid + "=") - return + if id == WG_MENU_LIST[mid]["add"]: WG_LIST[mid][int(item.GetText())] = int(item.GetText()); return + elif id == WG_MENU_LIST[mid]["remove"]: del WG_LIST[mid][int(item.GetText())]; return + elif id == WG_MENU_LIST[mid]["clear"]: WG_LIST[mid].clear(); return + elif id == WG_MENU_LIST[mid]["whisper"]: self.chat.set_chat_text("/gw " + mid + "="); return return #--------------------------------------------------------- @@ -378,17 +369,15 @@ id = str(self.GetItemData(self.selected_item)) self.chat = open_rpg.get_component("chat") (result,id,name) = self.session.toggle_ignore(id) - if result == 0: - self.chat.Post(self.chat.colorize(self.chat.syscolor, "Player " + name + " with ID:" + id +" no longer ignored")) - else: - self.chat.Post(self.chat.colorize(self.chat.syscolor, "Player " + name + " with ID:" + id +" now being ignored")) + if result == 0: self.chat.Post(self.chat.colorize(self.chat.syscolor, + "Player " + name + " with ID:" + id +" no longer ignored")) + else: self.chat.Post(self.chat.colorize(self.chat.syscolor, + "Player " + name + " with ID:" + id +" now being ignored")) elif id == PLAYER_SHOW_VERSION: id = str(self.GetItemData(self.selected_item)) version_string = self.session.players[id][6] - if version_string: - wx.MessageBox("Running client version " + version_string,"Version") - else: - wx.MessageBox("No client version available for this player","Version") + if version_string: wx.MessageBox("Running client version " + version_string,"Version") + else: wx.MessageBox("No client version available for this player","Version") def on_menu(self, evt): pos = wx.Point(evt.GetX(),evt.GetY()) @@ -408,12 +397,9 @@ #--------------------------------------------------------- self.menu.Enable(PLAYER_WG_MENU, True) item = self.GetItem( self.selected_item ) - if len(WG_MENU_LIST) > len(WG_LIST): - self.clean_sub_menus() - if len(WG_LIST) == 0: - self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, False) - else: - self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, True) + if len(WG_MENU_LIST) > len(WG_LIST): self.clean_sub_menus() + if len(WG_LIST) == 0: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, False) + else: self.wgMenu.Enable(PLAYER_WG_CLEAR_ALL, True) for gid in WG_LIST: if not WG_MENU_LIST.has_key(gid): WG_MENU_LIST[gid] = {} @@ -542,26 +528,20 @@ self.DeleteAllItems() def strip_html(self,player): - ret_string = "" - x = 0 - in_tag = 0 + ret_string = ""; x = 0; in_tag = 0 for x in range(len(player[0])) : if player[0][x] == "<" or player[0][x] == ">" or in_tag == 1 : - if player[0][x] == "<" : - in_tag = 1 - elif player[0][x] == ">" : - in_tag = 0 - else : - pass - else : - ret_string = ret_string + player[0][x] + if player[0][x] == "<": in_tag = 1 + elif player[0][x] == ">": in_tag = 0 + else: pass + else: ret_string = ret_string + player[0][x] return ret_string def size_cols(self): -## # moved skip here to see if it breaks -## w,h = self.GetClientSizeTuple() -## w /= 8 -## self.SetColumnWidth( 0, w*2 ) -## self.SetColumnWidth( 1, w*2 ) -## self.SetColumnWidth( 2, w*3 ) + ##moved skip here to see if it breaks + ## w,h = self.GetClientSizeTuple() + ## w /= 8 + ## self.SetColumnWidth( 0, w*2 ) + ## self.SetColumnWidth( 1, w*2 ) + ## self.SetColumnWidth( 2, w*3 ) pass diff -r 67b900deb35c -r 78407d627cba plugins/cherrypy/_cphttptools.py --- a/plugins/cherrypy/_cphttptools.py Tue Jul 21 05:34:16 2009 -0500 +++ b/plugins/cherrypy/_cphttptools.py Sat Jul 25 17:24:40 2009 -0500 @@ -418,7 +418,7 @@ for i in range(50): s += random.choice(string.letters+string.digits) s += '%s'%time.time() - return hashlib.hashlib(s).hexdigest() + return hashlib.shal(s).hexdigest() def getObjFromPath(objPathList, objCache): """ For a given objectPathList (like ['root', 'a', 'b', 'index']), diff -r 67b900deb35c -r 78407d627cba plugins/xxcherrypy.py --- a/plugins/xxcherrypy.py Tue Jul 21 05:34:16 2009 -0500 +++ b/plugins/xxcherrypy.py Sat Jul 25 17:24:40 2009 -0500 @@ -49,7 +49,10 @@ self.plugin_addcommand('/cherrypy', self.on_cherrypy, '[on | off | port | status] - This controls the CherryPy Web Server') - self.on_cherrypy(self.plugindb.GetString("xxcherrypy", "auto_start", None)) # VEG + cherry_start = str(self.plugindb.GetString("xxcherrypy", "auto_start", None)) #VEG, DJG, TAS + if cherry_start == "on": self.on_cherrypy("on") + else: pass + del cherry_start self.cherryhost = 'http://' + self.host + ':' + str(self.port) + '/webfiles/' open_rpg.add_component("cherrypy", self.cherryhost)