Commits

Iñigo Serna committed 152bab9

Fix bug: stop loading covers if creating new library

  • Participants
  • Parent commits 0c29549

Comments (0)

Files changed (3)

 ============================================================================
-Last update:	Time-stamp: <2012-05-27 21:58:18 inigo>
+Last update:	Time-stamp: <2012-05-28 00:52:53 inigo>
 ============================================================================
 
 
 . add books: check folder to import must be located inside library base path
 . store imported folders in library database. Don't allow to import a folder twice
 . new library: check for not repeated name
+. fix bug: stop loading covers if creating new library
 
 
 v0.6
-. fix bug: stop loading covers if creating new lib
+. fix bug: importing ebooks => covers are not shown after program restart
 . before add, delete, bulkedit => thaw
 . bulkedit: tag => add, not replace
+. db: refactor lib functions into a class
 . refresh library:
   "Found 13 new books. 7 missing files, do you want to review and delete their entries in library?"
 . copy book(s) to path => preference: default path (f.e. "/media/DR800/Books"), filename format
 
 
     def ui_disable_all(self):
+        self.cover_factory.stop = True
         if self.cfg.active_lib is not None:
             self.save_config()
         self.listview.set_model(None)
     # ----- LIBS Actions ----------------------------------------------
     def on_create_lib(self, menuitem):
         w = NewLibrary(self, self.cfg.libs_name)
+        self.cover_factory.stop = True
         while not w.res['finished']:
             process_events()
             time.sleep(.33)
             process_events()
         dlg.elliminate()
         if num == -1:
-            time.sleep(1) # to avoid blocking of the app!
+            time.sleep(1) # to avoid blocking app!
             dlg_error(self, 'Error with pattern', '"%s" is not a valid pattern' % pattern)
         else:
             # if new pattern add to list

File ui/ui_common.py

         self.__books_generator = None
         self.__idle_fn_id = None
         self.get = self.get_cover_temp
+        self.stop = False
 
 
     def initialize(self):
         self.__books_generator = db.book_generator_id_path_hascover()
         self.__idle_fn_id = gobject.idle_add(self.idle_load_covers)
         self.get = self.get_cover_temp
+        self.stop = False
 
 
     def clear(self):
         self.cache.clear()
         self.default_cache.clear()
         if self.__idle_fn_id is not None:
+            self.stop = True
+
+
+    def idle_load_covers(self):
+        if self.stop:
             log.debug('END load covers as a stop command has been issued')
             gobject.source_remove(self.__idle_fn_id)
             self.__idle_fn_id = None
-
-
-    def idle_load_covers(self):
+            self.stop = False
+            return False
         try:
             book_id, book_path, has_cover = self.__books_generator.next()
         except StopIteration:
             log.debug('END load covers in background')
             self.__idle_fn_id = None
+            self.stop = False
             self.get = self.get_cover_ok
             return False
         else: