py::gui::models::flat_catalog Class Reference

Inheritance diagram for py::gui::models::flat_catalog:

Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def reload
def invalidate_sort
def clear_indexes
def clear
def update_colors
def album_count_changed
def apply_filter
def queryset
def fill
def register_item
def count_albums
def register_album
def register_if_matches
def get_row_colors

Public Attributes

 view
 loaded

Static Public Attributes

int nb_col = 5
list header = [_("Series"),_("Volume"),_("Name"),_("Author"),_("Drawer")]
 filter = None
 raw_filter = None
string album_related = ""

Private Member Functions

def __fill
def _create_entry


Member Function Documentation

def py::gui::models::flat_catalog::__init__ (   self,
  view 
)

00206                                    :
00207                 UserDict.__init__(self)
00208                 manager.register(self)
00209                 self.view = view
00210                 self.view.setColumnCount(self.nb_col)
00211                 self.view.setHeaderLabels(self.header)
00212                 self.loaded = False
00213                 self.clear_indexes()
00214 
        def reload( self ) :

def py::gui::models::flat_catalog::reload (   self  ) 

00215                            :
00216                 self.clear()
00217                 self.__fill()
00218         
        def invalidate_sort( self ) :

def py::gui::models::flat_catalog::invalidate_sort (   self  ) 

00219                                     :
00220                 self.view.emit(SIGNAL("invalidate_sort"))
00221 
        def clear_indexes( self ) :

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

Reimplemented in py::gui::models::flat_library, and py::gui::models::series.

00222                                   :
00223                 UserDict.clear(self)
00224                 self['by-album'] = {}
00225                 self['by-series'] = {}
00226 
        def clear( self ) :

def py::gui::models::flat_catalog::clear (   self  ) 

00227                           :
00228                 self.loaded = False
00229                 self.clear_indexes()
00230                 self.view.clear()
00231         
        def update_colors( self ) :

def py::gui::models::flat_catalog::update_colors (   self  ) 

Reimplemented in py::gui::models::series.

00232                                   :
00233                 for idx in self['by-album'] :
00234                         for item in self['by-album'][idx] :
00235                                 item.setup_color()
00236         
        def album_count_changed( self ) :

def py::gui::models::flat_catalog::album_count_changed (   self  ) 

00237                                         :
00238                 self.view.emit(SIGNAL("album_count_changed"))
00239 
        def __fill( self ) :

def py::gui::models::flat_catalog::__fill (   self  )  [private]

00240                            :
00241                 self.fill()
00242                 self.album_count_changed()
00243                 self.loaded = True
00244                 self.view.sort()
00245         
        def apply_filter( self, filter ) :

def py::gui::models::flat_catalog::apply_filter (   self,
  filter 
)

00246                                          :
00247                 if self.raw_filter == filter :
00248                         return
00249                 self.raw_filter = filter
00250                 if self.raw_filter :
00251                         self.filter = qo.utils.build_matching_set(self.raw_filter)
00252                 else :
00253                         self.filter = None
00254                 self.reload()
00255         
        def queryset( self ) :

def py::gui::models::flat_catalog::queryset (   self  ) 

00256                              :
00257                 q = self._queryset()
00258                 if self.filter :
00259                         args = []
00260                         for w in self.filter :
00261                                 k1 = {self.album_related+"matching__contains":"%s"%w}
00262                                 k2 = {self.album_related+"series__matching__contains":"%s"%w}
00263                                 args.append(Q(**k1) | Q(**k2))
00264                         q = q.filter(*args)
00265                 if isinstance(q, QuerySet) :
00266                         q = q.select_related()
00267                 return q
00268 
        def fill( self ) :

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

Reimplemented in py::gui::models::flat_library, and py::gui::models::series.

00269                          :
00270                 for album in self.queryset() :
00271                         self.register_album(album)
00272 
        def register_item( self, album, item ) :

def py::gui::models::flat_catalog::register_item (   self,
  album,
  item 
)

Reimplemented in py::gui::models::flat_library.

00273                                                :
00274                 if album.qoid not in self['by-album'] :
00275                         self['by-album'][album.qoid] = set()
00276                 self['by-album'][album.qoid].add(item)
00277                 if album.series.qoid not in self['by-series'] :
00278                         self['by-series'][album.series.qoid] = set()
00279                 self['by-series'][album.series.qoid].add(item)
00280                 return item
00281 
        def count_albums( self ) :

def py::gui::models::flat_catalog::count_albums (   self  ) 

00282                                  :
00283                 if "by-album" in self :
00284                         return sum(map(len, self['by-album'].itervalues()))
00285                 else :
00286                         return 0
00287 
        def register_album( self, album ) :

def py::gui::models::flat_catalog::register_album (   self,
  album 
)

00288                                           :
00289                 return self.register_item(album, album_item(self, self.view, album))
00290         
        def _create_entry( self, album ) :

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

Reimplemented in py::gui::models::flat_library, and py::gui::models::series.

00291                                          :
00292                 self.register_album(album)
00293                 self.album_count_changed()
00294 
        def register_if_matches( self, album ) :

def py::gui::models::flat_catalog::register_if_matches (   self,
  album 
)

00295                                                :
00296                 if self.matches(album) :
00297                         self._create_entry(album)
00298 
        def get_row_colors( self, row, exclude_role = None ) :

def py::gui::models::flat_catalog::get_row_colors (   self,
  row,
  exclude_role = None 
)

00299                                                              :
00300                 if not exclude_role :
00301                         exclude_role = []
00302                 if libraries[qodb.cte.main_library_id].has_album(row.album) :
00303                         return qocfg.get_color("library%d"%qodb.cte.main_library_id)
00304                 elif "nextout" not in exclude_role and row.album.is_nextout() :
00305                         return qocfg.get_color("not_published")
00306                 elif libraries[qodb.cte.shopping_list_id].has_album(row.album) :
00307                         return qocfg.get_color("library%d"%qodb.cte.shopping_list_id)
00308                 elif libraries[qodb.cte.main_library_id].has_series(row.album.series) :
00309                         if libraries[qodb.cte.main_library_id].has_series_completed(row.album.series) :
00310                                 return qocfg.get_color("completed_series")
00311                         else :
00312                                 return qocfg.get_color("series")
00313                 return None, None
00314 
00315 
class flat_nextout( flat_catalog ) :


Member Data Documentation

int py::gui::models::flat_catalog::nb_col = 5 [static]

Reimplemented in py::gui::models::series.

list py::gui::models::flat_catalog::header = [_("Series"),_("Volume"),_("Name"),_("Author"),_("Drawer")] [static]

Reimplemented in py::gui::models::series.

py::gui::models::flat_catalog::filter = None [static]

py::gui::models::flat_catalog::raw_filter = None [static]

string py::gui::models::flat_catalog::album_related = "" [static]

Reimplemented in py::gui::models::flat_library.

py::gui::models::flat_catalog::view

py::gui::models::flat_catalog::loaded


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