]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
corrected logic for tree countingalways return a python list for the selection, even...
authormsw <msw>
Thu, 29 Jul 1999 17:03:59 +0000 (17:03 +0000)
committermsw <msw>
Thu, 29 Jul 1999 17:03:59 +0000 (17:03 +0000)
checkboxtree.c
snack.py
snackmodule.c

index e9a490a84400dc5e45094df55bc06b5f25e7f2cf..c698bcbdcc866e56dfb57503e7e12bfe9585e7a0 100644 (file)
@@ -54,7 +54,7 @@ static int countItems(struct items * item, enum countWhat what) {
     while (item) {
         if ((!item->branch) || (what == COUNT_EXPOSED))
            count++;
-       if (item->branch && (what == COUNT_EXPOSED && item->selected))
+       if (item->branch || (what == COUNT_EXPOSED && item->selected))
            count += countItems(item->branch, what);
        item = item->next;
     }
index 9e1751faa3d755a0937535cf2e93cad641b7b500..8af5557a044a958a09c75fdbc9b42e91251487ec 100644 (file)
--- a/snack.py
+++ b/snack.py
@@ -394,11 +394,9 @@ class CheckboxTree(Widget):
 
     def getSelection(self):
         selection = []
-        i = 0
         list = self.w.checkboxtreeGetSelection()
         for key in list:
             selection.append(self.key2item[key])
-            i = i + 1
        return selection
 
 
index e482b17929e7b80f13ff815b0b91de9fbc072d10..b2cecc83f38705b3b6934d338d862149ad64fdb5 100644 (file)
@@ -818,9 +818,10 @@ static PyObject * widgetCheckboxTreeGetSel(snackWidget * s,
 
     selection = newtCheckboxTreeGetSelection(s->co, &numselected);
 
+    sel = PyList_New(0);
+    
     if (!selection) {
-       Py_INCREF(Py_None);
-       return Py_None;
+       return sel;
     }
 
     sel = PyList_New(0);