[dia] group_props.py: don't create a table with 0 rows



commit 95b7584339ec99d1b5ce755ce0c2aa8af4086b69
Author: Hans Breuer <hans breuer org>
Date:   Sat Nov 15 17:28:14 2014 +0100

    group_props.py: don't create a table with 0 rows
    
    in case of no properties to show

 plug-ins/python/group_props.py |   48 +++++++++++++++++++++------------------
 1 files changed, 26 insertions(+), 22 deletions(-)
---
diff --git a/plug-ins/python/group_props.py b/plug-ins/python/group_props.py
index 28bc180..189d4ce 100644
--- a/plug-ins/python/group_props.py
+++ b/plug-ins/python/group_props.py
@@ -52,31 +52,35 @@ class CPropsDialog :
 
                self.checkboxes = []
                self.optionmenues = []
-               table = gtk.Table(2, len(props), 0)
+               if len(props) :
+                       table = gtk.Table(2, len(props), 0)
+               else :
+                       table = gtk.Table(2, 1, 0)
                table.set_row_spacings(2)
                table.set_col_spacings(5)
                table.set_border_width(5)
-               y = 0
-               for s in props.keys() :
-                       w = gtk.CheckButton(s)
-                       self.checkboxes.append(w)
-                       table.attach(w, 0, 1, y, y+1)
-                       w.show()
-                       menu = gtk.Menu()
-                       milist = None
-                       for opt in props[s].opts :
-                               #print opt
-                               menuitem = gtk.RadioMenuItem (milist, str(opt.value))
-                               milist = menuitem # GSlist
-                               menu.append(menuitem)
-                               menuitem.show()
-                       menu.show ()
-                       w = gtk.OptionMenu()
-                       w.set_menu(menu)
-                       self.optionmenues.append(w)
-                       table.attach(w, 1, 2, y, y+1)
-                       w.show()
-                       y = y + 1
+               if len(props) :
+                       y = 0
+                       for s in props.keys() :
+                               w = gtk.CheckButton(s)
+                               self.checkboxes.append(w)
+                               table.attach(w, 0, 1, y, y+1)
+                               w.show()
+                               menu = gtk.Menu()
+                               milist = None
+                               for opt in props[s].opts :
+                                       #print opt
+                                       menuitem = gtk.RadioMenuItem (milist, str(opt.value))
+                                       milist = menuitem # GSlist
+                                       menu.append(menuitem)
+                                       menuitem.show()
+                               menu.show ()
+                               w = gtk.OptionMenu()
+                               w.set_menu(menu)
+                               self.optionmenues.append(w)
+                               table.attach(w, 1, 2, y, y+1)
+                               w.show()
+                               y = y + 1
                else :
                        w = gtk.Label("The selected objects don't share any\n properties to change at once.") 
                        table.attach(w, 0, 1, y, y+1)


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