[gedit-plugins] Replaced the GtkTable with GtkGrid



commit eb4f3af773b5c5f36065947576d1e66f9ece55d1
Author: ghugesagar <ghugesss gmail com>
Date:   Mon Jan 13 12:34:34 2014 +0530

    Replaced the GtkTable with GtkGrid

 plugins/multiedit/multiedit/documenthelper.py |  102 ++++++++-----------------
 1 files changed, 33 insertions(+), 69 deletions(-)
---
diff --git a/plugins/multiedit/multiedit/documenthelper.py b/plugins/multiedit/multiedit/documenthelper.py
index ccfda7b..efbe408 100644
--- a/plugins/multiedit/multiedit/documenthelper.py
+++ b/plugins/multiedit/multiedit/documenthelper.py
@@ -1217,7 +1217,7 @@ class DocumentHelper(Signals):
         self.remove_edit_points()
 
     def make_label(self, text, use_markup=True):
-        lbl = Gtk.Label(text)
+        lbl = Gtk.Label.new(text)
         lbl.set_use_markup(use_markup)
         lbl.set_alignment(0, 0.5)
         lbl.show()
@@ -1233,76 +1233,40 @@ class DocumentHelper(Signals):
         if x < geom[0] or x > geom[0] + geom[2] or y < geom[1] or y > geom[1] + geom[3]:
             return False
 
-        table = Gtk.Table(13, 2)
-        table.set_row_spacings(3)
-        table.set_col_spacings(12)
-
-        table.attach(self.make_label('<b>Selection</b>', True),
-                     0, 2, 0, 1,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Enter>', False),
-                     0, 1, 1, 2,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Enter>', False),
-                     0, 1, 2, 3,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Shift><Enter>', False),
-                     0, 1, 3, 4,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Alt><Shift><Enter>', False),
-                     0, 1, 4, 5,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-
-        sep = Gtk.HSeparator()
+        grid = Gtk.Grid()
+        grid.set_row_spacing(3)
+        grid.set_column_spacing(12)
+
+        grid.attach(self.make_label('<b>Selection</b>', True), 0, 0, 1, 1)
+        grid.attach(self.make_label('<Enter>', False), 0, 1, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Enter>', False), 0, 2, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Shift><Enter>', False), 0, 3, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Alt><Shift><Enter>', False), 0, 4, 1, 1)
+
+        sep = Gtk.Separator.new(Gtk.Orientation.HORIZONTAL)
         sep.show()
 
-        table.attach(sep,
-                     0, 2, 5, 6,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<b>Edit points</b>', True),
-                     0, 2, 6, 7,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl>+E', False),
-                     0, 1, 7, 8,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Home>', False),
-                     0, 1, 8, 9,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><End>', False),
-                     0, 1, 9, 10,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Shift><Enter>', False),
-                     0, 1, 10, 11,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-        table.attach(self.make_label('<Ctrl><Alt><Shift><Enter>', False),
-                     0, 1, 11, 12,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL,
-                     Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
-
-        table.attach(self.make_label(_('Enter column edit mode using selection')), 1, 2, 1, 2)
-        table.attach(self.make_label(_('Enter <b>smart</b> column edit mode using selection')), 1, 2, 2, 3)
-        table.attach(self.make_label(_('<b>Smart</b> column align mode using selection')), 1, 2, 3, 4)
-        table.attach(self.make_label(_('<b>Smart</b> column align mode with additional space using 
selection')), 1, 2, 4, 5)
-
-        table.attach(self.make_label(_('Toggle edit point')), 1, 2, 7, 8)
-        table.attach(self.make_label(_('Add edit point at beginning of line/selection')), 1, 2, 8, 9)
-        table.attach(self.make_label(_('Add edit point at end of line/selection')), 1, 2, 9, 10)
-        table.attach(self.make_label(_('Align edit points')), 1, 2, 10, 11)
-        table.attach(self.make_label(_('Align edit points with additional space')), 1, 2, 11, 12)
-
-        table.show_all()
-        tooltip.set_custom(table)
+        grid.attach(sep, 0, 5, 2, 1)
+        grid.attach(self.make_label('<b>Edit points</b>', True), 0, 6, 1, 1)
+        grid.attach(self.make_label('<Ctrl>+E', False), 0, 7, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Home>', False), 0, 8, 1, 1)
+        grid.attach(self.make_label('<Ctrl><End>', False), 0, 9, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Shift><Enter>', False), 0, 10, 1, 1)
+        grid.attach(self.make_label('<Ctrl><Alt><Shift><Enter>', False), 0, 11, 1, 1)
+
+        grid.attach(self.make_label(_('Enter column edit mode using selection')), 1, 1, 1, 1)
+        grid.attach(self.make_label(_('Enter <b>smart</b> column edit mode using selection')), 1, 2, 1, 1)
+        grid.attach(self.make_label(_('<b>Smart</b> column align mode using selection')), 1, 3, 1, 1)
+        grid.attach(self.make_label(_('<b>Smart</b> column align mode with additional space using 
selection')), 1, 4, 1, 1)
+
+        grid.attach(self.make_label(_('Toggle edit point')), 1, 7, 1, 1)
+        grid.attach(self.make_label(_('Add edit point at beginning of line/selection')), 1, 8, 1, 1)
+        grid.attach(self.make_label(_('Add edit point at end of line/selection')), 1, 9, 1, 1)
+        grid.attach(self.make_label(_('Align edit points')), 1, 10, 1, 1)
+        grid.attach(self.make_label(_('Align edit points with additional space')), 1, 11, 1, 1)
+
+        grid.show_all()
+        tooltip.set_custom(grid)
         return True
 
     def get_border_color(self):


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