py::gui::models::manager Class Reference

List of all members.

Public Member Functions

def __init__
def register
def update_entity
def reload_covers
def register_albumcopy
def unregister_albumcopy
def move_albumcopy
def propagate_entity
def propagate_album_status
def update_colors

Public Attributes

 childs


Member Function Documentation

def py::gui::models::manager::__init__ (   self  ) 

00039                              :
00040                 QObject.__init__( self )
00041                 self.childs = []
00042                 self.connect(self, SIGNAL("entity_changed"), self.propagate_entity)
00043         
        def register( self, model ) :

def py::gui::models::manager::register (   self,
  model 
)

00044                                     :
00045                 self.childs.append(model)
00046 
        def update_entity( self, entity ) :

def py::gui::models::manager::update_entity (   self,
  entity 
)

00047                                           :
00048                 self.emit(SIGNAL("entity_changed"),entity)
00049 
        def reload_covers( self ) :

def py::gui::models::manager::reload_covers (   self  ) 

00050                                   :
00051                 for page in gui.main_window.instance.tabs.itervalues() :
00052                         if page.album_file :
00053                                 page.album_file.cover.reload()
00054 
        def register_albumcopy( self, albumcopy ) :

def py::gui::models::manager::register_albumcopy (   self,
  albumcopy 
)

00055                                                   :
00056                 libraries[albumcopy.library.id].register(albumcopy)
00057                 self.propagate_album_status(albumcopy.album)
00058 
        def unregister_albumcopy( self, library_id, albumcopy_id, album ) :

def py::gui::models::manager::unregister_albumcopy (   self,
  library_id,
  albumcopy_id,
  album 
)

00059                                                                           :
00060                 libraries[library_id].unregister(albumcopy_id, album)
00061                 self.propagate_album_status(album)
00062         
        def move_albumcopy( self, albumcopy, old_library_id, library_id ) :

def py::gui::models::manager::move_albumcopy (   self,
  albumcopy,
  old_library_id,
  library_id 
)

00063                                                                           :
00064                 libraries[old_library_id].unregister(albumcopy.id, albumcopy.album)
00065                 libraries[library_id].register(albumcopy)
00066                 self.propagate_album_status(albumcopy.album)
00067 
        def propagate_entity( self, entity ) :

def py::gui::models::manager::propagate_entity (   self,
  entity 
)

00068                                              :
00069                 print self, "propagate_entity", entity
00070 
00071                 def _update_series( series ) :
00072                         modified = True
00073                         if isinstance(entity, Series) and series == entity :
00074                                 series = entity
00075                         elif isinstance(entity, Collection) and series.collection == entity :
00076                                 series.collection = entity
00077                         elif isinstance(entity, Editor) and series.collection.editor == entity :
00078                                 series.collection.editor = entity
00079                         else :
00080                                 modified = False
00081                         return series, modified
00082 
00083                 def _update_album( album ) :
00084                         modified = True
00085                         if isinstance(entity, Album) and album == entity :
00086                                 return entity, modified
00087                         elif isinstance(entity, Author) :
00088                                 if entity.qoid in album.authors + album.drawers :
00089                                         modified = True
00090                                         album.rebuild_all_strs()
00091                                         album.save()
00092                         else :
00093                                 series, modified = _update_series(album.series)
00094                                 if modified :
00095                                         album.series = series
00096                         return album, modified
00097 
00098                 # 1. update panels
00099                 for page in gui.main_window.instance.tabs.itervalues() :
00100                         if page.album_file :
00101                                 album, modified = _update_album(page.album_file.album)
00102                                 if modified :
00103                                         page.album_file.reload()
00104 
00105                 if isinstance(entity, (Album, Series, Author)) :
00106                         # 2. update lists
00107                         items = set()
00108                         series_items = set()
00109                         for model in self.childs :
00110                                 if isinstance(entity, Album) :
00111                                         if 'by-album' in model and entity.qoid in model['by-album'] :
00112                                                 items.update(model['by-album'][entity.qoid])
00113                                         else :
00114                                                 model.register_if_matches(entity)
00115                                 if isinstance(entity, Series) :
00116                                         if 'by-series' in model and entity.qoid in model['by-series'] :
00117                                                 items.update(model['by-series'][entity.qoid])
00118                                         if 'toplevel-series' in model and entity.qoid in model['toplevel-series'] :
00119                                                 series_items.add(model['toplevel-series'][entity.qoid])
00120 
00121                         if isinstance(entity, Author) :
00122                                 for a in entity.albums :
00123                                         print a
00124                                         for model in self.childs :
00125                                                 if 'by-album' in model :
00126                                                         if a.qoid in model['by-album'] :
00127                                                                 items.update(model['by-album'][a.qoid])
00128                         for item in items :
00129                                 album, modified = _update_album(item.album)
00130                                 if modified :
00131                                         item.setup(album)
00132                         for item in series_items :
00133                                 series, modified = _update_series(item.series)
00134                                 if modified :
00135                                         item.setup(series)
00136         
        def propagate_album_status( self, album ) :

def py::gui::models::manager::propagate_album_status (   self,
  album 
)

propagate only album status to all lists
(mainly for updateing colors)
00137                                                   :
00138                 """
00139                 propagate only album status to all lists
00140                 (mainly for updateing colors)
00141                 """
00142                 for page in gui.main_window.instance.tabs.itervalues() :
00143                         if page.album_file and page.album_file.album == album :
00144                                 page.album_file.reload()
00145                 for model in self.childs :
00146                         if 'by-album' in model and album.qoid in model['by-album'] :
00147                                 for item in model['by-album'][album.qoid] :
00148                                         item.update_album_status(album)
00149 
00150 
        def update_colors( self ) :

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

00151                                   :
00152                 for model in self.childs :
00153                         model.update_colors()
00154 
00155 
manager = manager()


Member Data Documentation

py::gui::models::manager::childs


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