[kernel] r5692 - people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor

Bastian Blank waldi at costa.debian.org
Thu Feb 2 23:36:25 UTC 2006


Author: waldi
Date: Thu Feb  2 23:36:24 2006
New Revision: 5692

Modified:
   people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py
Log:
debian/lib/python/debian_linux/kconfigeditor/editor.py: Update.



Modified: people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py
==============================================================================
--- people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py	(original)
+++ people/waldi/linux-2.6/debian/lib/python/debian_linux/kconfigeditor/editor.py	Thu Feb  2 23:36:24 2006
@@ -177,8 +177,8 @@
         label.set_alignment(0, 0)
         table.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
-        table.attach(self.get_edit_label(key), 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
-        table.attach(self.get_edit_button(key), 2, 3, 0, 1, gtk.FILL, gtk.FILL)
+        table.attach(self.get_edit_label(), 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
+        table.attach(self.get_edit_button(), 2, 3, 0, 1, gtk.FILL, gtk.FILL)
 
         notebook.append_page(table, gtk.Label("global"))
 
@@ -198,8 +198,8 @@
             label.set_alignment(0, 0)
             table.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
-            table.attach(self.get_edit_label(key, arch), 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
-            table.attach(self.get_edit_button(key, arch), 2, 3, 0, 1, gtk.FILL, gtk.FILL)
+            table.attach(self.get_edit_label(arch), 1, 2, 0, 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
+            table.attach(self.get_edit_button(arch), 2, 3, 0, 1, gtk.FILL, gtk.FILL)
 
             for subarch, variant_subarch in variant_arch.iteritems():
                 text = ""
@@ -209,8 +209,8 @@
                     label.set_alignment(0, 0)
                     table.attach(label, 0, 1, item, item + 1, gtk.FILL, gtk.FILL)
 
-                    table.attach(self.get_edit_label(key, arch, subarch), 1, 2, item, item + 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
-                    table.attach(self.get_edit_button(key, arch, subarch), 2, 3, item, item + 1, gtk.FILL, gtk.FILL)
+                    table.attach(self.get_edit_label(arch, subarch), 1, 2, item, item + 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
+                    table.attach(self.get_edit_button(arch, subarch), 2, 3, item, item + 1, gtk.FILL, gtk.FILL)
                     item = +1
 
                 for flavour in variant_subarch.iterkeys():
@@ -218,30 +218,88 @@
                     label.set_alignment(0, 0)
                     table.attach(label, 0, 1, item, item + 1, gtk.FILL, gtk.FILL)
 
-                    table.attach(self.get_edit_label(key, arch, subarch, flavour), 1, 2, item, item + 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
-                    table.attach(self.get_edit_button(key, arch, subarch, flavour), 2, 3, item, item + 1, gtk.FILL, gtk.FILL)
+                    table.attach(self.get_edit_label(arch, subarch, flavour), 1, 2, item, item + 1, gtk.FILL|gtk.EXPAND, gtk.FILL)
+                    table.attach(self.get_edit_button(arch, subarch, flavour), 2, 3, item, item + 1, gtk.FILL, gtk.FILL)
 
                     item += 1
 
             notebook.append_page(table, gtk.Label(arch))
+ 
+        self.text()
 
         self.window.show_all()
 
-    def get_edit_button(self, name, arch = None, subarch = None, flavour = None):
+    def edit_button_clicked(self, button, key):
+        self.get_edit_menu(key).popup(None, None, None, 1, 0)
+        return True
+
+    def edit_menu_activate(self, button, key, command):
+        if command == "Set to Yes":
+            self.editor.items[key][self.key] = 'y'
+        elif command == "Set to Mod":
+            self.editor.items[key][self.key] = 'm'
+        elif command == "Set to No":
+            self.editor.items[key][self.key] = 'n'
+        elif command == "Remove":
+            del self.editor.items[key][self.key]
+        elif command == "Edit":
+            pass
+        else:
+            return False
+
+        self.text()
+        return True
+
+    def get_edit_button(self, arch = None, subarch = None, flavour = None):
         key = (arch, subarch, flavour)
         button = gtk.Button(stock = "gtk-edit")
+        button.connect("clicked", self.edit_button_clicked, key)
         return button
 
-    def get_edit_label(self, name, arch = None, subarch = None, flavour = None):
+    def get_edit_label(self, arch = None, subarch = None, flavour = None):
         key = (arch, subarch, flavour)
         label = gtk.Label()
-        text = self.editor.items[key].get(name, "-")
         label.set_alignment(0, 0)
         label.set_selectable(True)
-        label.set_text(text)
         self.items[key] = label
         return label
 
+    def get_edit_menu(self, key):
+        menu = gtk.Menu()
+        for i in ("Set to Yes", "Set to Mod", "Set to No", "Remove", "Edit"):
+            item = gtk.MenuItem(i)
+            item.connect("activate", self.edit_menu_activate, key, i)
+            item.show()
+            menu.append(item)
+        return menu
+
+    def text(self):
+        self.text_once()
+        for arch, variant_arch in self.editor.variants.iteritems():
+            self.text_once(arch)
+            for subarch, variant_subarch in variant_arch.iteritems():
+                if subarch != "none":
+                    self.text_once(arch, subarch)
+                for flavour in variant_subarch.iterkeys():
+                    self.text_once(arch, subarch, flavour)
+
+    def text_once(self, arch = None, subarch = None, flavour = None):
+        key = (arch, subarch, flavour)
+        value = self.editor.items[key].get(self.key, None)
+
+        if value is None:
+            text = "unset"
+        elif value == 'y':
+            text = "yes"
+        elif value == 'm':
+            text = "mod"
+        elif value == 'n':
+            text = "no"
+        else:
+            text = value
+
+        self.items[key].set_text(text)
+
 if __name__ == '__main__':
     e = editor()
     from file import kconfigfile



More information about the Kernel-svn-changes mailing list