Mercurial > traipse
changeset 10:5df1340bda13 grumpy-goblin
Big patch! Linux GUI, Fetching Dict., Init2, Streaming lining.
author | sirebral |
---|---|
date | Tue, 21 Jul 2009 17:19:53 -0500 |
parents | 80ab434efc87 |
children | dcb7d905debe |
files | orpg/dirpath/__init__.py orpg/dirpath/dirpath_tools.py orpg/main.py orpg/mapper/background_handler.py orpg/mapper/base_handler.py orpg/mapper/fog_handler.py orpg/mapper/grid_handler.py orpg/mapper/images.py orpg/mapper/map.py orpg/mapper/map_handler.py orpg/mapper/miniatures_handler.py orpg/orpg_version.py orpg/tools/orpg_log.py plugins/cherrypy/_cphttptools.py plugins/xxcherrypy.py plugins/xxinit2.py |
diffstat | 16 files changed, 128 insertions(+), 161 deletions(-) [+] |
line wrap: on
line diff
--- a/orpg/dirpath/__init__.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/dirpath/__init__.py Tue Jul 21 17:19:53 2009 -0500 @@ -10,7 +10,11 @@ # ----------------------------- # * Reworked path verification process to attempt to fall back on the # current working directory if approot fails to verify before -# asking the user to locate the root directory -- Snowdog 12-20-05 +# asking the user to locate the root directory -- Snowdog 12-20-05 +# ----------------------------- +# * Removed reference to approot. It was a superflous creation that carried an object +# that dirpath_tools already creates. It wasted system resources by creating a files +# and by referencing a file to fill an object that was already created. -- SirEbral 07-19-09 import sys import os @@ -18,16 +22,11 @@ root_dir = None -try: - import approot - root_dir = approot.basedir -except: - #attempt to load default path - t = __file__.split(os.sep) - if len(t) > 2: - root_dir = os.sep.join(t[:-3]) - else: - root_dir = os.getcwd() #default ORPG root dir +t = __file__.split(os.sep) +if len(t) > 2: + root_dir = os.sep.join(t[:-3]) +else: + root_dir = os.getcwd() #default ORPG root dir dir_struct = {} @@ -43,4 +42,4 @@ clean = str.replace(clean,'\\','/') print "Rooting OpenRPG at: " + clean -load_paths(dir_struct, root_dir) \ No newline at end of file +load_paths(dir_struct, root_dir)
--- a/orpg/dirpath/dirpath_tools.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/dirpath/dirpath_tools.py Tue Jul 21 17:19:53 2009 -0500 @@ -23,7 +23,6 @@ dir_struct["SWd20"] = dir_struct["data"] + "SWd20" + os.sep dir_struct["icon"] = dir_struct["home"] + "images" + os.sep dir_struct["template"] = dir_struct["core"] + "templates" + os.sep - dir_struct["plugins"] = dir_struct["home"] + "plugins" + os.sep dir_struct["nodes"] = dir_struct["template"] + "nodes" + os.sep dir_struct["rollers"] = dir_struct["core"] + "dieroller" + os.sep + "rollers" + os.sep @@ -77,7 +76,6 @@ return 0 #all files and directories exist. - write_approot(path) return 1 @@ -112,7 +110,7 @@ dir = None try: - msg = "OpenRPG cannot locate critical files.\nPlease locate the openrpg1 directory in the following window" + msg = "OpenRPG cannot locate critical files.\nPlease locate the /System/ directory in the following window" alert= wx.MessageDialog(None,msg,"Warning",wx.OK|wx.ICON_ERROR) alert.Show() if alert.ShowModal() == wx.OK: @@ -130,28 +128,4 @@ else: dir = raw_input("Enter the full path to your openrpg folder: ") return dir - - - -#------------------------------------------------------- -# void write_approot( orpg_root_path ) -# added by snowdog 3-10-05 -#------------------------------------------------------- - -def write_approot( orpg_root_path): - try: - #if a trailing path separator is on the path string remove it. - if (orpg_root_path[(len(orpg_root_path)-len(os.sep)):] == os.sep): - orpg_root_path = orpg_root_path[:(len(orpg_root_path)-len(os.sep))] - fn = orpg_root_path + os.sep + "orpg" + os.sep + "dirpath" + os.sep + "approot.py" - f = open(fn, "w") - #trim off the appended os.sep character(s) to avoid duplicating them on re-loading of path - code = 'basedir = "' + orpg_root_path + '"' + "\n" - #fix path string for windows boxes that lamely use an escape character for a path separator - code = str.replace(code,'\\','\\\\') - f.write(code) - f.close() - except IOError: - print "[WARNING] Could not create approot file." - print "[WARNING] Automatic directory resolution not configured." - return +
--- a/orpg/main.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/main.py Tue Jul 21 17:19:53 2009 -0500 @@ -27,7 +27,7 @@ # Description: This is the main entry point of the oprg application # -__version__ = "$Id: main.py,v 1.153 2008/01/24 03:52:03 digitalxero Exp $" +__version__ = "$Id: main.py,v 1.154 2009/07/19 03:52:03 madmathlabs Exp $" from orpg.orpg_wx import * from orpg.orpgCore import * @@ -232,7 +232,7 @@ self.mainmenu.SetMenuState("GameServerServerHeartbeat", True) tabtheme = self.settings.get_setting('TabTheme') - #This change is stable. TaS. + #This change is stable. TaS. self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedColorful", tabtheme == 'slanted&colorful') self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedBlackandWhite", tabtheme == 'slanted&bw') self.mainmenu.SetMenuState("OpenRPGTabStylesSlantedAqua", tabtheme == 'slanted&aqua') @@ -620,7 +620,7 @@ info.SetName('Traipse') info.SetVersion('OpenRPG ' + VERSION) info.SetDescription(description) - info.SetCopyright('(C) 2009 Mad Math Labs') + info.SetCopyright('(C) Copyright 2009 Mad Math Labs') info.SetWebSite('http://www.openrpg.com') info.SetLicence(license) orpg_devs = ['Thomas Baleno', 'Andrew Bennett', 'Lex Berezhny', 'Ted Berg', @@ -630,9 +630,6 @@ 'Brian Osman', 'Rome Reginelli', 'Christopher Rouse', 'Dave Sanders', 'Tyler Starke', 'Mark Tarrabain'] for dev in orpg_devs: info.AddDeveloper(dev) - #info.AddDocWriter('jan bodnar') - #info.AddArtist('The Tango crew') - #info.AddTranslator('jan bodnar') wx.AboutBox(info) def OnMB_HelpOnlineUserGuide(self): @@ -852,7 +849,7 @@ wndinfo.Layer(int(layer)) wndinfo.Caption(cap) -# Lambda here should work! (future dev) + # Lambda here should work! (future dev) if dir.lower() == 'top': wndinfo.Top() elif dir.lower() == 'bottom': @@ -1153,12 +1150,8 @@ self.map.canvas.zoom_display_timer.Stop() self.map.canvas.image_timer.Stop() 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 + 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) self._mgr.UnInit() @@ -1249,13 +1242,22 @@ wx.CallAfter(self.splash.Close) return True - def OnExit(self): - #Clean up approot files on exit. - self.log.log("Removing approot files\n", ORPG_DEBUG) + 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 + + def OnExit(self): + self.OnExit_CleanUp() #Exit self.log.log("Main Application Exit\n\n", ORPG_DEBUG)
--- a/orpg/mapper/background_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/background_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -45,18 +45,22 @@ self.lock = Lock() self.bg_type = wx.Choice(self, wx.ID_ANY, choices = ["Texture", "Image", "Color" ]) self.bg_type.SetSelection(2) - self.localBrowse = wx.Button(self, wx.ID_ANY, 'Browse') + self.localBrowse = wx.Button(self, wx.ID_ANY, 'Browse', style=wx.BU_EXACTFIT) self.localBrowse.Hide() self.url_path = wx.TextCtrl(self, wx.ID_ANY,"http://") self.color_button = wx.Button(self, wx.ID_ANY, "Color", style=wx.BU_EXACTFIT) 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) + self.sizer.Add((6, 0)) + self.sizer.Add(self.color_button, 0, wx.ALIGN_CENTER) + self.sizer.Add((6, 0)) + 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)
--- a/orpg/mapper/base_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/base_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -42,13 +42,9 @@ self.chat = open_rpg.get_component("chat") self.build_ctrls() self.build_menu() - self.Bind(wx.EVT_SIZE, self.on_size) + #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) @@ -59,21 +55,22 @@ 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.SetSizer(self.basesizer) - self.SetAutoLayout(True) - self.Fit() + 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.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."
--- a/orpg/mapper/fog_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/fog_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -48,12 +48,10 @@ 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() @@ -74,9 +72,6 @@ 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):
--- a/orpg/mapper/grid_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/grid_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -44,16 +44,21 @@ 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)) + self.sizer.Add(wx.StaticText(self, -1, "Ratio: "), 0, wx.ALIGN_CENTER) + self.sizer.Add(self.grid_ratio, 0, wx.ALIGN_CENTER) + self.sizer.Add((6,0)) + self.sizer.Add(self.line_type, 0, wx.ALIGN_CENTER) + self.sizer.Add((6,0)) + self.sizer.Add(self.grid_mode, 0, wx.ALIGN_CENTER) + self.sizer.Add((6,0)) + self.sizer.Add(self.grid_snap, 0, wx.ALIGN_CENTER) + self.sizer.Add((6,0)) + 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()
--- a/orpg/mapper/images.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/images.py Tue Jul 21 17:19:53 2009 -0500 @@ -118,9 +118,9 @@ 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) - self.__fetching[path] = False + del self.__fetching[path] except IOError: - self.__fetching[path] = False + 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) finally: self.__lock.release()
--- a/orpg/mapper/map.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/map.py Tue Jul 21 17:19:53 2009 -0500 @@ -892,15 +892,16 @@ self.layer_handlers.append(map_handler(self.layer_tabs,-1,self.canvas)) self.layer_tabs.AddPage(self.layer_handlers[5],"General") self.layer_tabs.SetSelection(2) + + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.sizer.Add(self.canvas, 1, wx.EXPAND) + self.sizer.Add(self.layer_tabs, 0, wx.EXPAND) + self.SetSizer(self.sizer) + self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.on_layer_change) - self.Bind(wx.EVT_SIZE, self.on_size) + #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): @@ -1122,10 +1123,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)
--- a/orpg/mapper/map_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/map_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -34,21 +34,19 @@ 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.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)) + self.sizer.Add(wx.StaticText(self, -1, "Height: "),0, wx.ALIGN_CENTER) + self.sizer.Add(self.height, 0, wx.ALIGN_CENTER) + self.sizer.Add((6, 0)) + 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()
--- a/orpg/mapper/miniatures_handler.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/mapper/miniatures_handler.py Tue Jul 21 17:19:53 2009 -0500 @@ -125,15 +125,18 @@ self.auto_label_cb = wx.CheckBox(self, wx.ID_ANY, ' Auto Label ', (-1,-1),(-1,-1)) self.auto_label_cb.SetValue(self.auto_label) self.min_url = wx.ComboBox(self, wx.ID_ANY, "http://", style=wx.CB_DROPDOWN | wx.CB_SORT) - self.localBrowse = wx.Button(self, wx.ID_ANY, 'Browse') + self.localBrowse = wx.Button(self, wx.ID_ANY, 'Browse', style=wx.BU_EXACTFIT) minilist = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'questionhead.gif', 'Edit miniature properties', wx.ID_ANY) miniadd = wx.Button(self, wx.ID_OK, "Add Miniature", style=wx.BU_EXACTFIT) self.sizer.Add(self.auto_label_cb,0,wx.ALIGN_CENTER) + self.sizer.Add((6, 0)) self.sizer.Add(self.min_url, 1, wx.ALIGN_CENTER) - self.sizer.Add(miniadd, 0, wx.EXPAND) - self.sizer.Add(self.localBrowse, 0, wx.EXPAND) - self.sizer.Add(wx.Size(20,25)) - self.sizer.Add(minilist, 0, wx.EXPAND ) + self.sizer.Add((6, 0)) + self.sizer.Add(miniadd, 0, wx.ALIGN_CENTER) + self.sizer.Add((6, 0)) + self.sizer.Add(self.localBrowse, 0, wx.ALIGN_CENTER) + self.sizer.Add((6, 0)) + self.sizer.Add(minilist, 0, wx.ALIGN_CENTER) self.Bind(wx.EVT_BUTTON, self.on_min_list, minilist) self.Bind(wx.EVT_BUTTON, self.on_miniature, miniadd) self.Bind(wx.EVT_BUTTON, self.on_browse, self.localBrowse) @@ -577,7 +580,7 @@ def on_left_down(self, evt): if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return - mini = self.find_mini(evt, evt.ControlDown() and self.role_is_gm()) + mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm()) if mini: deselecting_selected_mini = (mini == self.sel_min) #clicked on the selected mini self.deselectAndRefresh() @@ -603,7 +606,7 @@ if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return self.last_rclick_pos = self.getLogicalPosition(evt) - mini = self.find_mini(evt, evt.ControlDown() and self.role_is_gm()) + mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm()) if mini: self.sel_rmin = mini if self.sel_min: @@ -728,7 +731,7 @@ def on_left_dclick(self,evt): if not self.role_is_gm_or_player() or self.alreadyDealingWithMenu(): return - mini = self.find_mini(evt, evt.ControlDown() and self.role_is_gm()) + mini = self.find_mini(evt, evt.CmdDown() and self.role_is_gm()) if mini: self.on_mini_dclick(evt, mini) else:# pass it on
--- a/orpg/orpg_version.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/orpg_version.py Tue Jul 21 17:19:53 2009 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse" DIS_VER = "Grumpy Goblin" -BUILD = "090718-00" +BUILD = "090721-00" # This version is for network capability. PROTOCOL_VERSION = "1.2"
--- a/orpg/tools/orpg_log.py Sat Jul 18 11:41:05 2009 -0500 +++ b/orpg/tools/orpg_log.py Tue Jul 21 17:19:53 2009 -0500 @@ -38,8 +38,7 @@ if self.logToConsol or to_consol or type == ORPG_CRITICAL: print msg - if type & self.logLevel: - #if type & self.logLevel or to_consol: #Arbitrary removal TaS. + if type & self.logLevel or to_consol: logMsg = time.strftime( '[%x %X] ', time.localtime( time.time() ) ) + msg + "\n" logFile = open(self.logName, "a") logFile.write(logMsg)
--- a/plugins/cherrypy/_cphttptools.py Sat Jul 18 11:41:05 2009 -0500 +++ b/plugins/cherrypy/_cphttptools.py Tue Jul 21 17:19:53 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']),
--- a/plugins/xxcherrypy.py Sat Jul 18 11:41:05 2009 -0500 +++ b/plugins/xxcherrypy.py Tue Jul 21 17:19:53 2009 -0500 @@ -1,11 +1,13 @@ import os +import wx import orpg.plugindb # VEG import orpg.pluginhandler +from orpg.orpgCore import * +import urllib import thread -import cherrypy._cpserver as server import socket -import wx -from orpg.orpgCore import * +import cherrypy._cpserver as server +from xml.dom.minidom import parseString # VEG (march 21, 2007): Now remembers your last web server on/off setting @@ -19,9 +21,9 @@ # The Following code should be edited to contain the proper information self.name = 'CherryPy Web Server' - self.author = 'Dj Gilcrease' + self.author = 'Dj Gilcrease & Sir. Ebral' self.help = 'This plugin turns OpenRPG into a Web server\n' - self.help += 'allowing you to host your map and mini files localy' + self.help += 'allowing you to host your map and mini files locally.' #You can set variables below here. Always set them to a blank value in this section. Use plugin_enabled #to set their proper values. @@ -33,23 +35,22 @@ self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On') self.topframe.Bind(wx.EVT_MENU, self.cherrypy_toggle, self.toggle) - def cherrypy_toggle(self, evt): - if self.toggle.IsChecked() == True: self.on_cherrypy("on") + def cherrypy_toggle(self, evt): #TAS + if self.toggle.IsChecked() == True: self.on_cherrypy("on") if self.toggle.IsChecked() == False: self.on_cherrypy("off") def plugin_enabled(self): - cpport = 0 # Container object so we can call port instead of an assigned ## - self.port = 6775 if not int(self.plugindb.GetString("xxcherrypy", "port", cpport)) else int(self.plugindb.GetString("xxcherrypy", "port", cpport)); del cpport #Deletes port container. - self.plugin_addcommand('/cherrypy', self.on_cherrypy, '[on | off | port | status] - This controls the CherryPy Web Server') - import urllib - url = urllib.URLopener() - resp = url.open('http://www.knowledgearcana.com/vgt/ip_scrape.php') - html = resp.read(19+19) - ip = html[19:]; self.host = ip[1:len(ip)-1] - cpobj = 0 - if str(self.plugindb.GetString("xxcherrypy", "auto_start", cpobj)) == "on": # VEG - self.on_cherrypy("on") # VEG - del cpobj + self.host = parseString( + urllib.urlopen("http://orpgmeta.appspot.com/myip").read() + ).documentElement.getAttribute("ip") + + self.port = int(self.plugindb.GetString("xxcherrypy", "port", 8080)) or 6775 + + 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 + self.cherryhost = 'http://' + self.host + ':' + str(self.port) + '/webfiles/' open_rpg.add_component("cherrypy", self.cherryhost) @@ -69,7 +70,7 @@ if len(args) == 0 or args[0] == 'status': self.chat.InfoPost("CherryPy Web Server is currently: " + self.isServerRunning) - self.chat.InfoPost("CherryPy Web Server address is: http://" + str(self.host) + ':' + str(self.port) + '/webfiles/') + self.chat.InfoPost("CherryPy Web Server address is: " + self.cherryhost) elif args[0] == 'on' and self.isServerRunning == 'off': self.webserver = thread.start_new_thread(self.startServer, (self.port,)) @@ -81,10 +82,10 @@ server.stop() self.isServerRunning = 'off' self.toggle.Check(False) - self.chat.InfoPost("CherryPy Web Server is now disabled") + self.chat.InfoPost("CherryPy Web Server is currently: " + self.isServerRunning) self.plugindb.SetString("xxcherrypy", "auto_start", "off") # VEG - elif args[0] == 'port': + elif args[0] == 'port': #TAS if self.isServerRunning == 'on': self.chat.InfoPost('Please turn CherryPy off first!') return @@ -95,7 +96,6 @@ open_rpg.del_component("cherrypy"); open_rpg.add_component("cherrypy", self.cherryhost) self.chat.InfoPost('CherryPy Web Server address is: ' + self.cherryhost) - def startServer(self, port): try: if self.host == 0: @@ -104,10 +104,7 @@ self.chat.InfoPost("CherryPy Web Server is now running on http://" + str(self.host) + ':' + str(self.port) + '/webfiles/') server.start(configMap = {'staticContentList': [['', r''+orpg.dirpath.dir_struct["user"]+'webfiles/'], - ['webfiles', r''+orpg.dirpath.dir_struct["user"]+'webfiles/'], - ['Textures', r''+orpg.dirpath.dir_struct["user"]+'Textures/'], - ['Maps', r''+orpg.dirpath.dir_struct["user"]+'Maps/'], - ['Miniatures', r''+orpg.dirpath.dir_struct["user"]+'Miniatures']], + ['webfiles', r''+orpg.dirpath.dir_struct["user"]+'webfiles/']], 'socketPort': port, 'logToScreen': 0, 'logFile':orpg.dirpath.dir_struct["user"]+'webfiles/log.txt',