brunolojor / jbrout

Automatically exported from code.google.com/p/jbrout
0 stars 0 forks source link

Problem with selections. #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Go to the search form
2. Deselect (right click) 1 category (e.g. People)
3. Select one tag of the category (e.g. Brad Pitt)
4. Search! :)

What is the expected output? What do you see instead?
To have photos with only brad pitt on it (no photos with brad pitt AND
angelina Jolie)
Instead : Every photos with Brad Pitt alone, but also every photo with
nobody on it (landscapes, Objects)... 

What version of the product are you using? On what operating system?
0.3.131 Ubuntu 8.10

Please provide any additional information below.

Original issue reported on code.google.com by gautier....@gmail.com on 2 Jan 2009 at 4:02

GoogleCodeExporter commented 8 years ago

Original comment by manat...@gmail.com on 6 Jan 2009 at 8:52

GoogleCodeExporter commented 8 years ago
bingo ! you're right !
in the normal way, you can't (couldn't) select a tag in a disabled category !
you find a good bug !

Original comment by manat...@gmail.com on 6 Jan 2009 at 4:49

GoogleCodeExporter commented 8 years ago
corrected since rev 138

Original comment by manat...@gmail.com on 6 Jan 2009 at 5:03

GoogleCodeExporter commented 8 years ago
There is still a little problem. If you disable the category "Tags" (the main
category) to find all pictures without any tag, some tagged pictures appears.

But, I've just tried the new version and I find it really annoying not to be 
able to
select a tag in a disabled category. To find a picture with only "Brad Pitt", 
it is
very annoying to disable manually every people in the category.

Original comment by gautier....@gmail.com on 7 Jan 2009 at 5:16

GoogleCodeExporter commented 8 years ago
re-open the bug

Original comment by manat...@gmail.com on 7 Jan 2009 at 7:29

GoogleCodeExporter commented 8 years ago
Youhou!

I've made my first python 

here is a way to correct the problem, it replace the commands
switch_inc
switch_exc
__switchchildren
and add a function __switchParents

the function isSwitchDisabled has no utility so you have to remove both lines :
                        if not model.isSwitchDisabled(iterTo):

sorry comments are in french

the complete jbrout.py is attached

# 0 = rien
# 1 = vert
# 2 = rouge 
# 3 = gris (signfifie mix de rouge et de vert ou de rien) pour les childrens
    def switch_inc(self,it):
        if self.get_value(it,3) == 0:   # si ce n'est pas coché
            self.set_value(it,3,1)      # on coche en vert
        elif self.get_value(it,3) == 1: # si c'est vert    
            self.set_value(it,3,0)      # on décoche
        elif self.get_value(it,3) == 2: # si c'est rouge  
            self.set_value(it,3,1)      # on coche en vert
        else:               # si c'est grisé (cause sélections childrens)  
            self.set_value(it,3,0)  # on coche en vert
        self.__switchChilds(it)
        self.__switchParents(it)

    def switch_exc(self,it):
        if self.get_value(it,3) == 0:   # si ce n'est pas coché
            self.set_value(it,3,2)      # on coche en rouge
        elif self.get_value(it,3) == 1: # si c'est vert    
            self.set_value(it,3,2)      # on coche en rouge
        elif self.get_value(it,3) == 2: # si c'est rouge  
            self.set_value(it,3,0)      # on décoche
        else:               # si c'est grisé (cause sélections childrens)  
            self.set_value(it,3,2)  # on coche en rouge
        self.__switchChilds(it)
        self.__switchParents(it)

    def __switchChilds(self,it):
        node = self.get_value(it,1)
        if node.__class__.__name__ == "CatgNode":
            ii=self.iter_children(it)
            while ii:
                if self.get_value(it,3)==0:     # si on vient de décocher le parent
                    self.set_value(ii,3,0)  # on décoche l'enfant
                    self.__switchChilds(ii) # et ses enfants...
                elif self.get_value(it,3)==1:      #si on vient de cocher en vert le
parent
                    self.set_value(ii,3,1)      # on coche en vert l'enfant
                    self.__switchChilds(ii)     # et ses enfants
                else:               #si on vient de cocher en rouge le parent
                    self.set_value(ii,3,2)  # on coche en rouge l'enfant
                    self.__switchChilds(ii) # et ses enfants
                ii = self.iter_next(ii)

    def __switchParents(self,it):
        child_mixed_color=self.get_value(it,3)          #couleur en l'ensemble des
enfants (ici initialisation) 
        node = self.get_value(it,1)
        ii=self.iter_parent(it)
        if ii != None:
            childrens_of_parent=self.iter_children(ii)  #liste tous les enfants du parents
            while childrens_of_parent:
                if self.get_value(childrens_of_parent,3)!=child_mixed_color:    #si
c'est différent des autre enfants
                    child_mixed_color=3                                         #on
grisera le parent
                childrens_of_parent = self.iter_next(childrens_of_parent)
            self.set_value(ii,3,child_mixed_color)                              #on
met la couleur "mixée"
            self.__switchParents(ii)                                            #on
continue pour le parent du parent

Original comment by gautier....@gmail.com on 7 Jan 2009 at 2:02

Attachments:

GoogleCodeExporter commented 8 years ago
oui, mais non ;-)

Ce n'est pas pk maintenant tu peux cocher des cases vert/rouge dans des sous
catégories grisées que ça va marcher après ...
Le problème est fonctionnel, pas technique !. Comprendre : que si on ne peut 
pas
cocher de cases rouge/vert dans une sous catégorie grisée : c'est fait 
exprès !
Car après, le "moteur de recherche" ne pourra rien trouver de cohérent !
il faudrait assu adapter le "moteur de recherche" pour ce genre de recherche. 
Et,
dans mes souvenirs, ce serait assez complexe à faire que de laisser dispo ce 
genre de
recherche ...
C'est une limitation volontaire de l'outil ! ça ne sert à rien de rendre celà
cochable ...

désolé

Original comment by manat...@gmail.com on 7 Jan 2009 at 2:08

GoogleCodeExporter commented 8 years ago
-Non- mais si... parceque ça marche vraiment bien! ;) Le moteur de recherche 
s'en
tire très bien...

Enfin pour ce que je veux faire, c'est parfait...

Imaginons 
[TAGS]
  [Personnes]
     [People]
        *Angelina Jolie
        *Brad Pitt
        *Pamela Anderson
  [Animaux]
     * Chiens
     * Chats

Si je veux une photo avec Brat pitt sans autre personnage, j'ai juste a faire 
un clic
doit sur people, puis un clic gauche sur brad pitt
si je veux une photo de brad pitt et rien d'autre (pas de chien ni de chat), 
j'ai
juste a faire un clic droit sur [tags] et un clic gauche sur brad pitt, c'est 
très
logique et ça marche parfaitement

Si on veut une photo avec brad pitt & angelina jolie, il faut cliquer sur ces 
deux
personnes, ça marche toujours...

Si on veut toutes les photos avec au moins 1 people, on clique sur People, ça 
marche
aussi...

Le seul vrai souci, c'est lorsque l'on rempli l'ensemble de la catégorie 
(p.ex. brad
 & angelina & pamela)
 > ça valide automatiquement la catégorie people
 > ça sort toutes les photos avec brad OU angelina OU pamela...

Pareil si on fait un clic gauche sur people et qu'on désellectionne brad pitt, 
ce qui
pourrait vouloir signifier qu'on veut toutes les photos de people sans brad 
pitt,
alors qu'en fait on aura toutes les photos avec Angelina & Pamela sans Brad...

Mais en étant un peu logique, lorsque l'on a, comme moi, beaucoup de photos et
beaucoup de tags, ça n'a aucun sens de chercher tout le monde SAUF 
quelqu'un... En
revanche, ça a beaucoup de sens de chercher toutes les photos où il y a 1 ou 2
personnes et personne d'autre...

Après, j'y connais rien, ça induit peut être d'autres problèmes... mais 
vraiment,
chez moi, ça marche a la perfection!

Original comment by gautier....@gmail.com on 7 Jan 2009 at 2:51

GoogleCodeExporter commented 8 years ago
comme tu l'as fait remarquer, ça complexifie trop la recherche ... et je doute 
encore
que ça soit aussi simple (comprendre sans effets de bords autres)...
peut être dans le futur !

Original comment by manat...@gmail.com on 8 Jan 2009 at 9:21