py::gui::models::flat_library Class Reference

Inheritance diagram for py::gui::models::flat_library:

Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def clear_indexes
def register_model
def register
def unregister
def register_item
def matches
def fill
def has_album
def get_series
def has_series
def has_series_completed
def get_row_colors

Public Attributes

 library_id
 childs

Static Public Attributes

string album_related = "album__"

Private Member Functions

def _create_entry
def _queryset


Member Function Documentation

def py::gui::models::flat_library::__init__ (   self,
  id,
  view 
)

00362                                        :
00363                 flat_catalog.__init__(self, view)
00364                 self.library_id = id
00365                 libraries[id] = self
00366                 self.childs = []
00367         
        def clear_indexes( self ) :

def py::gui::models::flat_library::clear_indexes (   self  ) 

Reimplemented from py::gui::models::flat_catalog.

00368                                   :
00369                 flat_catalog.clear_indexes(self)
00370                 self['by-copy'] = {}
00371         
        def register_model( self, model ) :

def py::gui::models::flat_library::register_model (   self,
  model 
)

register child model
00372                                           :
00373                 """
00374                 register child model
00375                 """
00376                 self.childs.append(model)
00377         
        def register( self, albumcopy ) :

def py::gui::models::flat_library::register (   self,
  albumcopy 
)

register a new albumcopy
00378                                         :
00379                 """
00380                 register a new albumcopy
00381                 """
00382                 assert albumcopy.library.id == self.library_id
00383                 self.register_item(albumcopy, albumcopy_item(self, self.view, albumcopy))
00384                 self.invalidate_sort()
00385                 self.album_count_changed()
00386                 # notify childs
00387                 for model in self.childs :
00388                         model.parent_registered(albumcopy)
00389         
        def unregister( self, albumcopy_id, album ) :

def py::gui::models::flat_library::unregister (   self,
  albumcopy_id,
  album 
)

00390                                                     :
00391                 if albumcopy_id in self['by-copy'] :
00392                         for item in self['by-copy'][albumcopy_id] :
00393                                 self.view.remove_item(item)
00394                                 self['by-album'][album.qoid].remove(item)
00395                                 self['by-series'][album.series.qoid].remove(item)
00396                                 del item
00397                         if len(self['by-album'][album.qoid]) == 0 :
00398                                 del self['by-album'][album.qoid]
00399                         if len(self['by-series'][album.series.qoid]) == 0 :
00400                                 del self['by-series'][album.series.qoid]
00401                         del self['by-copy'][albumcopy_id]
00402                         self.album_count_changed()
00403                         # notify childs
00404                         for model in self.childs :
00405                                 model.parent_unregistered(albumcopy_id, album)
00406 
        def register_item( self, albumcopy, item ) :

def py::gui::models::flat_library::register_item (   self,
  albumcopy,
  item 
)

internal

Reimplemented from py::gui::models::flat_catalog.

00407                                                    :
00408                 """
00409                 internal
00410                 """
00411                 if albumcopy.id not in self['by-copy'] :
00412                         self['by-copy'][albumcopy.id] = set()
00413                 self['by-copy'][albumcopy.id].add(item)
00414                 return flat_catalog.register_item(self, albumcopy.album, item)
00415 
        def matches( self, album ) :

def py::gui::models::flat_library::matches (   self,
  album 
)

00416                                    :
00417                 return album.albumcopy_set.filter(library=self.library_id).count() > 0
00418 
        def _create_entry( self, album ) :

def py::gui::models::flat_library::_create_entry (   self,
  album 
) [private]

Reimplemented from py::gui::models::flat_catalog.

00419                                          :
00420                 for copy in album.albumcopy_set.all() :
00421                         self.register_item(copy, albumcopy_item(self, self.view, copy))
00422                 self.album_count_changed()
00423         
        def _queryset( self ) :

def py::gui::models::flat_library::_queryset (   self  )  [private]

00424                               :
00425                 return AlbumCopy.objects.filter(library=self.library_id)
00426 
        def fill( self ) :

def py::gui::models::flat_library::fill (   self  ) 

Reimplemented from py::gui::models::flat_catalog.

00427                          :
00428                 for copy in self.queryset() :
00429                         self.register_item(copy, albumcopy_item(self, self.view, copy))
00430 
        def has_album( self, album ) :

def py::gui::models::flat_library::has_album (   self,
  album 
)

00431                                      :
00432                 ret = album.qoid in self['by-album']
00433                 if not ret and not self.loaded :
00434                         album.belongs_to_library(self.library_id)
00435                 return ret
00436         
        def get_series( self ) :

def py::gui::models::flat_library::get_series (   self  ) 

00437                                :
00438                 if len(self['by-series']) :
00439                         return Series.objects.filter(qoid__in=self['by-series'].keys())
00440                 return []
00441 
        def has_series( self, series ) :

def py::gui::models::flat_library::has_series (   self,
  series 
)

00442                                        :
00443                 if series.is_oneshot() :
00444                         return False
00445                 ret = series.qoid in self['by-series']
00446                 if not ret and not self.loaded :
00447                         ret = series.belongs_to_library(self.library_id)
00448                 return ret
00449         
        def has_series_completed( self, series ) :

def py::gui::models::flat_library::has_series_completed (   self,
  series 
)

00450                                                  :
00451                 ret = False
00452                 if series.is_oneshot() :
00453                         pass
00454                 elif series.qoid in self['by-series'] :
00455                         ret = len(self['by-series'][series.qoid]) == series.album_set.count()
00456                 elif not self.loaded :
00457                         ret = series.has_library_complete(self.library_id)
00458                 return ret
00459 
        def get_row_colors( self, row ) :

def py::gui::models::flat_library::get_row_colors (   self,
  row 
)

00460                                         :
00461                 if self.library_id == qodb.cte.main_library_id :
00462                         return qocfg.get_color("library%d"%qodb.cte.main_library_id)
00463                 else :
00464                         return flat_catalog.get_row_colors(self, row)
00465 
00466 
class series_item( album_item ) :


Member Data Documentation

string py::gui::models::flat_library::album_related = "album__" [static]

Reimplemented from py::gui::models::flat_catalog.

py::gui::models::flat_library::library_id

py::gui::models::flat_library::childs


The documentation for this class was generated from the following file:
Generated on Tue Oct 9 20:40:29 2007 for Qomics by  doxygen 1.5.3