Mercurial > traipse_dev
comparison orpg/tools/orpg_settings.py @ 65:4840657c23c5 ornery-dev
Traipse Dev 'OpenRPG' {090817-02}
Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc''s main goal is to offer more advanced features and enhance the productivity of the user.
Update Summary:
Update to Settings Menu. When user changes font or font size the chat window will now update without needing a restart. Change to dirpath/dir_struct file. No longer creates OPENRPG_BASE environment key.
author | sirebral |
---|---|
date | Mon, 17 Aug 2009 06:56:31 -0500 |
parents | 65c5cb9be59c |
children | c54768cffbd4 |
comparison
equal
deleted
inserted
replaced
64:5a3f8d9181eb | 65:4840657c23c5 |
---|---|
76 self.xml_dom.getElementsByTagName(name)[0].setAttribute("value", value) | 76 self.xml_dom.getElementsByTagName(name)[0].setAttribute("value", value) |
77 | 77 |
78 def add_setting(self, tab, setting, value, options, help): | 78 def add_setting(self, tab, setting, value, options, help): |
79 if len(self.xml_dom.getElementsByTagName(setting)) > 0: return False | 79 if len(self.xml_dom.getElementsByTagName(setting)) > 0: return False |
80 tabs = self.xml_dom.getElementsByTagName("tab") | 80 tabs = self.xml_dom.getElementsByTagName("tab") |
81 newsetting = self.xml.parseXml('<' + setting + ' value="' + value + '" options="' + options + '" help="' + help + '" />')._get_documentElement() | 81 newsetting = self.xml.parseXml('<' + setting + ' value="' + value + '" options="' + |
82 options + '" help="' + help + '" />')._get_documentElement() | |
82 for i in xrange(0, len(tabs)): | 83 for i in xrange(0, len(tabs)): |
83 if tabs[i].getAttribute("name") == tab and tabs[i].getAttribute("type") == 'grid': | 84 if tabs[i].getAttribute("name") == tab and tabs[i].getAttribute("type") == 'grid': |
84 tabs[i].appendChild(newsetting) | 85 tabs[i].appendChild(newsetting) |
85 return True | 86 return True |
86 return False | 87 return False |
123 | 124 |
124 for child in dom.getChildren(): | 125 for child in dom.getChildren(): |
125 if child._get_tagName() == 'tab' and child.hasChildNodes(): | 126 if child._get_tagName() == 'tab' and child.hasChildNodes(): |
126 self.proccessChildren(child, dom.getAttribute("name")) | 127 self.proccessChildren(child, dom.getAttribute("name")) |
127 else: | 128 else: |
128 self.add_setting(dom.getAttribute("name"), child._get_tagName(), child.getAttribute("value"), child.getAttribute("options"), child.getAttribute("help")) | 129 self.add_setting(dom.getAttribute("name"), child._get_tagName(), |
130 child.getAttribute("value"), child.getAttribute("options"), | |
131 child.getAttribute("help")) | |
129 | 132 |
130 def save(self): | 133 def save(self): |
131 temp_file = open(self.filename, "w") | 134 temp_file = open(self.filename, "w") |
132 temp_file.write(self.xml.toxml(self.xml_dom,1)) | 135 temp_file.write(self.xml.toxml(self.xml_dom,1)) |
133 temp_file.close() | 136 temp_file.close() |
134 | 137 |
135 class orpgSettingsWnd(wx.Dialog): | 138 class orpgSettingsWnd(wx.Dialog): |
136 def __init__(self, parent): | 139 def __init__(self, parent): |
137 wx.Dialog.__init__(self,parent,-1,"OpenRPG Preferences",wx.DefaultPosition,size = wx.Size(-1,-1), style=wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION) | 140 wx.Dialog.__init__(self,parent,-1,"OpenRPG Preferences", |
141 wx.DefaultPosition,size = wx.Size(-1,-1), | |
142 style=wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION) | |
138 self.Freeze() | 143 self.Freeze() |
139 self.validate = open_rpg.get_component("validate") | 144 self.validate = open_rpg.get_component("validate") |
140 self.settings = open_rpg.get_component("settings") | 145 self.settings = open_rpg.get_component("settings") |
141 self.chat = open_rpg.get_component("chat") | 146 self.chat = open_rpg.get_component("chat") |
142 self.changes = [] | 147 self.changes = [] |
224 | 229 |
225 for i in xrange(0,len(self.changes)): | 230 for i in xrange(0,len(self.changes)): |
226 self.settings.set_setting(self.changes[i][0], self.changes[i][1]) | 231 self.settings.set_setting(self.changes[i][0], self.changes[i][1]) |
227 top_frame = open_rpg.get_component('frame') | 232 top_frame = open_rpg.get_component('frame') |
228 | 233 |
234 if self.changes[i][0] == 'defaultfontsize' or self.changes[i][0] == 'defaultfont': | |
235 self.chat.chatwnd.SetDefaultFontAndSize(self.settings.get_setting('defaultfont'), | |
236 self.settings.get_setting('defaultfontsize')) | |
237 self.chat.InfoPost("Font is now " + | |
238 self.settings.get_setting('defaultfont') + " point size " + | |
239 self.settings.get_setting('defaultfontsize')) | |
240 self.chat.chatwnd.scroll_down() | |
241 | |
229 if self.changes[i][0] == 'bgcolor' or self.changes[i][0] == 'textcolor': | 242 if self.changes[i][0] == 'bgcolor' or self.changes[i][0] == 'textcolor': |
230 self.chat.chatwnd.SetPage(self.chat.ResetPage()) | 243 self.chat.chatwnd.SetPage(self.chat.ResetPage()) |
231 self.chat.chatwnd.scroll_down() | 244 self.chat.chatwnd.scroll_down() |
232 if self.settings.get_setting('ColorTree') == '1': | 245 if self.settings.get_setting('ColorTree') == '1': |
233 top_frame.tree.SetBackgroundColour(self.settings.get_setting('bgcolor')) | 246 top_frame.tree.SetBackgroundColour(self.settings.get_setting('bgcolor')) |