[dots/remove-assistant: 24/38] table_editor: Fix add. Cosmetics changes



commit aef76e5dd46080a0ee93b27a96ae2f2cfb0655ea
Author: Fernando Herrera <fherrera onirica com>
Date:   Mon Jul 12 22:03:03 2010 +0200

    table_editor: Fix add. Cosmetics changes

 dots/table_editor.py |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/dots/table_editor.py b/dots/table_editor.py
index c11a089..b73e35c 100755
--- a/dots/table_editor.py
+++ b/dots/table_editor.py
@@ -18,8 +18,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # TODO:
-#	* Handle special length opcodes
-#	* operands validation
 #	* saving
 #	* translate non UTF-8 entries
 #	* check "=" in dots
@@ -91,7 +89,7 @@ opcodes = {
   "compbegcaps": [],
   "compendcaps": [],
   "endcomp": ["dots"],
-  "multind": ["dots" ,"opcode..."],
+  "multind": ["dots" ,"opcode"],
   "compdots": [],
   "comp6": ["character", "dots"],
   "class": ["name", "character"],
@@ -198,11 +196,6 @@ class EditDialog(gtk.Dialog):
 			#action
 		}
 		self.entries = []
-		if opcode is None:
-			d = OpDialog()
-			d.run()
-			opcode = d.get_opcode()
-			d.destroy()
 	
 		operands_list = []
 		if operands is not None:
@@ -212,16 +205,19 @@ class EditDialog(gtk.Dialog):
 				operands_list = [ operands ]
 		gtk.Dialog.__init__(self, "Edit op", None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
 				    (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
-		vbox = gtk.VBox (False, 6)
+		vbox = gtk.VBox (True, 6)
 
 		self.add_opcode_combo(vbox, opcode)
-		comments = self.add_entries_for_opcode(vbox, opcode, operands_list)
-		self.add_comments (vbox, comments)
+		if opcode:
+			comments = self.add_entries_for_opcode(vbox, opcode, operands_list)
+			self.add_comments (vbox, comments)
+		else:
+			self.add_comments (vbox, [])
 		self.get_content_area().add (vbox)
 		self.show_all()
 
 	def add_comments(self, vbox, comments):
-		hbox = gtk.HBox (False, 6)
+		hbox = gtk.HBox (True, 6)
 		label = gtk.Label ("Comments")
 		entry = gtk.Entry()
 		entry.set_data("opcode", "comments")
@@ -262,7 +258,7 @@ class EditDialog(gtk.Dialog):
 			iter = model.append ([k])
 			if k == opcode: combo.set_active_iter (iter)
 		combo.connect("changed", self.combo_changed)
-		hbox = gtk.HBox (False, 6)
+		hbox = gtk.HBox (True, 6)
 		hbox.pack_start (label)
 		hbox.pack_start (combo)
 		vbox.add (hbox)
@@ -277,7 +273,7 @@ class EditDialog(gtk.Dialog):
 				self.add_opcode_combo(vbox, newop)
 				self.add_entries_for_opcode(vbox, newop, operands_list)
 			else:
-				hbox = gtk.HBox (False, 6)
+				hbox = gtk.HBox (True, 6)
 				label = gtk.Label (s)
 				entry = gtk.Entry()
 				entry.set_data("opcode", s)
@@ -362,7 +358,7 @@ def remove_clicked(button, view):
 	
 
 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-window.set_title("Basic TreeView Example")
+window.set_title("Liblouis Table Editor")
 window.set_size_request(600, 600)
 liststore = gtk.ListStore(str, str)
 	
@@ -390,10 +386,12 @@ tvcolumn.add_attribute(cell, 'text', 1)
 treeview.connect("button-press-event", row_clicked)
 
 scrolledwindow = gtk.ScrolledWindow ()
+scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 scrolledwindow.add(treeview)
 
 vbox = gtk.VBox ()
 buttonbox = gtk.HButtonBox()
+buttonbox.set_layout(gtk.BUTTONBOX_START)
 button = gtk.Button("Add")
 button.connect("clicked", add_clicked, treeview)
 buttonbox.pack_start(button, False, False, 6)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]