Project

General

Profile

TODO #375

possibilité de masquer des albums

Added by Loïc P. over 12 years ago. Updated over 11 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
global
Target version:
Start date:
10/01/2008
Due date:
% Done:

0%

Estimated time:

Description

possibilité de masquer des albums

History

#1

Updated by Frédéric Ribadeau Dumas over 11 years ago

Loïc a commencé le développement :
- Couleur des "Ignorés" dans la configuration
- Champ Ignore dans la table Album

Intégré chez moi via :

J'ajoute un bouton sur la page Album permettant d'ignorer/d'accepter un album :

--- py/gui/album.py     2008-01-20 01:18:09 +0000
+++ py/gui/album.py     2009-09-11 12:11:00 +0000
@@ -318,6 +318,16 @@
                        copy.save()
                        gui.models.manager.move_albumcopy(copy, old_library_id, library_id)

+       def action_ignore(self,  library_id):
+               self.album.ignore = True
+               self.album.save()
+               gui.models.manager.propagate_album_status(self.album)
+
+       def action_accept(self,  library_id):
+               self.album.ignore = False
+               self.album.save()
+               gui.models.manager.propagate_album_status(self.album)
+
        def link_slot( self, slotname, arg ) :
                cslotname = "%s_%s"%(slotname,arg)
                if not hasattr(self, cslotname) :
@@ -358,9 +368,13 @@
                                self.actions.add(_("Remove from %s")%_("Shopping list"), self.link_slot("action_remove_from_library",
                                                                        qodb.cte.shopping_list_id))
                        else :
-                               if may_add :
-                                       self.actions.add(_("Add to %s")%_("My comics"), self.link_slot("action_add_to_library", qodb.cte.main_library_id))
-                               self.actions.add(_("Add to %s")%_("Shopping list"), self.link_slot("action_add_to_library", qodb.cte.shopping_list_id))
+                               if self.album.ignore :
+                                       self.actions.add(_("Accept"), self.link_slot("action_accept", qodb.cte.main_library_id))
+                               else :
+                                       if may_add :
+                                               self.actions.add(_("Add to %s")%_("My comics"), self.link_slot("action_add_to_library", qodb.cte.main_library_id))
+                                       self.actions.add(_("Add to %s")%_("Shopping list"), self.link_slot("action_add_to_library", qodb.cte.shopping_list_id))
+                                       self.actions.add(_("Ignore"), self.link_slot("action_ignore", qodb.cte.main_library_id))

                self.button_delete.setEnabled(self.album.created_by_user or self.album.modified_by_user)

Je mets à jour la couleur des albums ignorés et j'exclue ceux-ci pour déterminer si une série est complète :

=== modified file 'py/gui/models.py'
--- py/gui/models.py    2009-03-30 19:33:33 +0000
+++ py/gui/models.py    2009-09-11 14:03:06 +0000
@@ -507,10 +510,12 @@
                ret = False
                if series.is_oneshot() :
                        pass
-               elif series.qoid in self['by-series'] :
-                       ret = len(self['by-series'][series.qoid]) == series.album_set.count()
-               elif not self.loaded :
                # To know whether a serie is complete, I need to exclude Ignored albums.
                # I so can't simply check the amount of albums we have.
                # For that reason, in any case, I use a specific query on the DB. 
+               else :
                        ret = series.has_library_complete(self.library_id)
+#              elif series.qoid in self['by-series'] :
+#                      ret = len(self['by-series'][series.qoid]) == series.album_set.count()
+#              elif not self.loaded :
+#                      ret = series.has_library_complete(self.library_id)
                return ret

        def get_row_colors( self, row ) :
@@ -670,6 +675,8 @@
                else :
                        if self.parent.has_album(row.album) :
                                return row.parent().backgroundColor(0).name(), row.parent().textColor(0).name()
+                       elif row.album.ignore:
+                               return qocfg.get_color("ignored")
                        elif row.album.is_nextout() :
                                return qocfg.get_color("not_published")
                        elif libraries[qodb.cte.shopping_list_id].has_album(row.album) :

Il manque la traduction du libellé "Accept" pour le bouton, suite sur un prochain post.

#2

Updated by Frédéric Ribadeau Dumas over 11 years ago

Oups, j'en ai oublié un p'tit bout...

Je change la requête qui détermine si une série est complète :

=== modified file 'py/qodb/models.py'
--- py/qodb/models.py   2008-02-10 14:06:49 +0000
+++ py/qodb/models.py   2009-09-11 14:17:29 +0000
@@ -321,7 +321,7 @@
        def has_library_complete( self, library_id ) :
                copies = list(AlbumCopy.objects.filter(library=library_id, album__series=self))
                if copies :
-                       return self.album_set.exclude(id__in=[copy.album_id for copy in copies]).count() == 0
+                       return self.album_set.exclude(id__in=[copy.album_id for copy in copies]).exclude(ignore=True).count() == 0
                return False

        def is_oneshot( self ) :

Also available in: Atom PDF