mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
9392aa40e4
commit
36566458bc
@ -22,7 +22,7 @@ from calibre.gui2 import (gprefs, warning_dialog, Dispatcher, error_dialog,
|
|||||||
from calibre.library.database2 import LibraryDatabase2
|
from calibre.library.database2 import LibraryDatabase2
|
||||||
from calibre.gui2.actions import InterfaceAction
|
from calibre.gui2.actions import InterfaceAction
|
||||||
|
|
||||||
class LibraryUsageStats(object): # {{{
|
class LibraryUsageStats(object): # {{{
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.stats = {}
|
self.stats = {}
|
||||||
@ -92,7 +92,7 @@ class LibraryUsageStats(object): # {{{
|
|||||||
self.write_stats()
|
self.write_stats()
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class MovedDialog(QDialog): # {{{
|
class MovedDialog(QDialog): # {{{
|
||||||
|
|
||||||
def __init__(self, stats, location, parent=None):
|
def __init__(self, stats, location, parent=None):
|
||||||
QDialog.__init__(self, parent)
|
QDialog.__init__(self, parent)
|
||||||
@ -200,7 +200,6 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
type=Qt.QueuedConnection)
|
type=Qt.QueuedConnection)
|
||||||
self.choose_menu.addAction(ac)
|
self.choose_menu.addAction(ac)
|
||||||
|
|
||||||
|
|
||||||
self.rename_separator = self.choose_menu.addSeparator()
|
self.rename_separator = self.choose_menu.addSeparator()
|
||||||
|
|
||||||
self.maintenance_menu = QMenu(_('Library Maintenance'))
|
self.maintenance_menu = QMenu(_('Library Maintenance'))
|
||||||
@ -477,19 +476,20 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
#from calibre.utils.mem import memory
|
# from calibre.utils.mem import memory
|
||||||
#import weakref
|
# import weakref
|
||||||
#from PyQt4.Qt import QTimer
|
# from PyQt4.Qt import QTimer
|
||||||
#self.dbref = weakref.ref(self.gui.library_view.model().db)
|
# self.dbref = weakref.ref(self.gui.library_view.model().db)
|
||||||
#self.before_mem = memory()/1024**2
|
# self.before_mem = memory()/1024**2
|
||||||
self.gui.library_moved(loc, allow_rebuild=True)
|
self.gui.library_moved(loc, allow_rebuild=True)
|
||||||
#QTimer.singleShot(5000, self.debug_leak)
|
# QTimer.singleShot(5000, self.debug_leak)
|
||||||
|
|
||||||
def debug_leak(self):
|
def debug_leak(self):
|
||||||
import gc
|
import gc
|
||||||
from calibre.utils.mem import memory
|
from calibre.utils.mem import memory
|
||||||
ref = self.dbref
|
ref = self.dbref
|
||||||
for i in xrange(3): gc.collect()
|
for i in xrange(3):
|
||||||
|
gc.collect()
|
||||||
if ref() is not None:
|
if ref() is not None:
|
||||||
print 'DB object alive:', ref()
|
print 'DB object alive:', ref()
|
||||||
for r in gc.get_referrers(ref())[:10]:
|
for r in gc.get_referrers(ref())[:10]:
|
||||||
@ -500,7 +500,6 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
print
|
print
|
||||||
self.dbref = self.before_mem = None
|
self.dbref = self.before_mem = None
|
||||||
|
|
||||||
|
|
||||||
def qs_requested(self, idx, *args):
|
def qs_requested(self, idx, *args):
|
||||||
self.switch_requested(self.qs_locations[idx])
|
self.switch_requested(self.qs_locations[idx])
|
||||||
|
|
||||||
@ -546,3 +545,4 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user