add name to nodes

This commit is contained in:
sqlcoder 2009-12-12 12:09:58 +00:00
parent c7e11a8cc3
commit 4cc1c4cfe6

View File

@ -91,10 +91,15 @@ class GuiPrefs:
#iter = self.configStore.append( parent, [node.nodeValue, None] ) #iter = self.configStore.append( parent, [node.nodeValue, None] )
iter = None iter = None
if node.nodeType != node.TEXT_NODE and node.nodeType != node.COMMENT_NODE: if node.nodeType != node.TEXT_NODE and node.nodeType != node.COMMENT_NODE:
name = ""
iter = self.configStore.append( parent, [node, setting, value] ) iter = self.configStore.append( parent, [node, setting, value] )
if node.hasAttributes(): if node.hasAttributes():
for i in xrange(node.attributes.length): for i in xrange(node.attributes.length):
self.configStore.append( iter, [node, node.attributes.item(i).localName, node.attributes.item(i).value] ) self.configStore.append( iter, [node, node.attributes.item(i).localName, node.attributes.item(i).value] )
if node.attributes.item(i).localName in ('site_name', 'game_name', 'stat_name', 'name', 'db_server', 'site'):
name = " " + node.attributes.item(i).value
if name != "":
self.configStore.set_value(iter, 1, setting+name)
if node.hasChildNodes(): if node.hasChildNodes():
for elem in node.childNodes: for elem in node.childNodes:
self.addTreeRows(iter, elem) self.addTreeRows(iter, elem)
@ -156,7 +161,7 @@ if __name__=="__main__":
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)) gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT))
dia.set_default_size(500, 500) dia.set_default_size(700, 500)
prefs = GuiPrefs(config, win, dia.vbox) prefs = GuiPrefs(config, win, dia.vbox)
response = dia.run() response = dia.run()
if response == gtk.RESPONSE_ACCEPT: if response == gtk.RESPONSE_ACCEPT: