[dots/remove-assistant: 23/38] Hanlge recursive opcodes
- From: Fernando Herrera de las Heras <fherrera src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dots/remove-assistant: 23/38] Hanlge recursive opcodes
- Date: Thu, 15 Jul 2010 21:08:55 +0000 (UTC)
commit a26646985f487e31f84a1cab005bd37a07b13490
Author: Fernando Herrera <fherrera onirica com>
Date: Mon Jul 12 21:37:27 2010 +0200
Hanlge recursive opcodes
dots/table_editor.py | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/dots/table_editor.py b/dots/table_editor.py
index 8c87609..c11a089 100755
--- a/dots/table_editor.py
+++ b/dots/table_editor.py
@@ -166,12 +166,12 @@ class Parser():
for line in lines:
line = line.lstrip(" ")
line = line.replace("\t", " ")
- if line == '' or line[0] == '#' or line[0] == '<' or line[0] == '\n':
+ if line == '' or line[0] == '#' or line[0] == '<' or line[0] == '\n' or line[0] == '\r':
continue
sep = line.find(" ")
entry = {}
entry['opcode'] = line[:sep]
- entry['operands'] = line[sep+1:].rstrip(" \t\n")
+ entry['operands'] = line[sep+1:].rstrip(" \t\n\r")
entries.append (entry)
return entries
@@ -270,12 +270,12 @@ class EditDialog(gtk.Dialog):
def add_entries_for_opcode(self, vbox, opcode, operands_list):
- print opcode
schema = opcodes[opcode]
for s in schema:
if s == "opcode":
- self.add_opcode_combo(vbox, operands_list.pop())
- self.add_entries_for_opcode(vbox, operands_list)
+ newop = operands_list.pop()
+ self.add_opcode_combo(vbox, newop)
+ self.add_entries_for_opcode(vbox, newop, operands_list)
else:
hbox = gtk.HBox (False, 6)
label = gtk.Label (s)
@@ -283,7 +283,6 @@ class EditDialog(gtk.Dialog):
entry.set_data("opcode", s)
entry.connect("insert-text", self.validate_text)
self.entries.append(entry)
- print "Adding entry for " + s
if len(operands_list) > 0:
operand = ""
while operand == "": operand = operands_list.pop()
@@ -303,20 +302,17 @@ class EditDialog(gtk.Dialog):
iter = c.get_active_iter()
opcode = c.get_model().get_value(iter, 0)
for e in self.entries:
- print e
if isinstance(e, gtk.Entry):
- print e.get_text()
operands += e.get_text() + " "
elif isinstance(e, gtk.ComboBox):
iter = e.get_active_iter()
- operands += e.get_model().get_value(iter, 0)
+ operands += e.get_model().get_value(iter, 0) + " "
return opcode, operands
def validate_text(self, entry, string, len, position):
opcode = entry.get_data("opcode")
text = entry.get_text() + string
- print text
if opcode == "opcode":
for o in opcodes.keys():
if o.find(text):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]