本文整理汇总了Python中Tribler.Main.vwxGUI.GuiUtility.GUIUtility.delInstance方法的典型用法代码示例。如果您正苦于以下问题:Python GUIUtility.delInstance方法的具体用法?Python GUIUtility.delInstance怎么用?Python GUIUtility.delInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribler.Main.vwxGUI.GuiUtility.GUIUtility
的用法示例。
在下文中一共展示了GUIUtility.delInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnExit
# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import delInstance [as 别名]
def OnExit(self):
bm = self.gui_image_manager.getImage(u'closescreen.png')
self.closewindow = GaugeSplash(bm, "Closing...", 6)
self.closewindow.Show()
self._logger.info("main: ONEXIT")
self.ready = False
self.done = True
# write all persistent data to disk
self.closewindow.tick('Write all persistent data to disk')
if self.torrentfeed:
self.torrentfeed.shutdown()
self.torrentfeed.delInstance()
if self.webUI:
self.webUI.stop()
self.webUI.delInstance()
if self.frame:
self.frame.Destroy()
self.frame = None
# Don't checkpoint, interferes with current way of saving Preferences,
# see Tribler/Main/Dialogs/abcoption.py
if self.utility:
# Niels: lets add a max waiting time for this session shutdown.
session_shutdown_start = time()
try:
self._logger.info("ONEXIT cleaning database")
self.closewindow.tick('Cleaning database')
torrent_db = self.utility.session.open_dbhandler(NTFY_TORRENTS)
torrent_db._db.clean_db(randint(0, 24) == 0, exiting=True)
except:
print_exc()
self.closewindow.tick('Shutdown session')
self.utility.session.shutdown(hacksessconfcheckpoint=False)
# Arno, 2012-07-12: Shutdown should be quick
# Niels, 2013-03-21: However, setting it too low will prevent checkpoints from being written to disk
waittime = 60
while not self.utility.session.has_shutdown():
diff = time() - session_shutdown_start
if diff > waittime:
self._logger.info("main: ONEXIT NOT Waiting for Session to shutdown, took too long")
break
self._logger.info(
"ONEXIT Waiting for Session to shutdown, will wait for an additional %d seconds",
waittime - diff)
sleep(3)
self._logger.info("ONEXIT Session is shutdown")
self.closewindow.tick('Deleting instances')
self._logger.debug("ONEXIT deleting instances")
Session.del_instance()
GUIUtility.delInstance()
GUIDBProducer.delInstance()
DefaultDownloadStartupConfig.delInstance()
GuiImageManager.delInstance()
self.closewindow.tick('Exiting now')
self.closewindow.Destroy()
return 0
示例2: OnExit
# 需要导入模块: from Tribler.Main.vwxGUI.GuiUtility import GUIUtility [as 别名]
# 或者: from Tribler.Main.vwxGUI.GuiUtility.GUIUtility import delInstance [as 别名]
def OnExit(self):
print >> sys.stderr, "main: ONEXIT"
self.ready = False
self.done = True
# write all persistent data to disk
if self.i2is:
self.i2is.shutdown()
if self.torrentfeed:
self.torrentfeed.shutdown()
self.torrentfeed.delInstance()
if self.webUI:
self.webUI.stop()
if self.guiserver:
self.guiserver.shutdown(True)
self.guiserver.delInstance()
if self.videoplayer:
self.videoplayer.shutdown()
self.videoplayer.delInstance()
delete_status_holders()
if self.frame:
self.frame.Destroy()
del self.frame
# Don't checkpoint, interferes with current way of saving Preferences,
# see Tribler/Main/Dialogs/abcoption.py
if self.utility:
# Niels: lets add a max waiting time for this session shutdown.
session_shutdown_start = time()
self.utility.session.shutdown(hacksessconfcheckpoint=False)
# Arno, 2012-07-12: Shutdown should be quick
# Niels, 2013-03-21: However, setting it too low will prevent checkpoints from being written to disk
waittime = 60
while not self.utility.session.has_shutdown():
diff = time() - session_shutdown_start
if diff > waittime:
print >> sys.stderr, "main: ONEXIT NOT Waiting for Session to shutdown, took too long"
break
print >> sys.stderr, "main: ONEXIT Waiting for Session to shutdown, will wait for an additional %d seconds" % (waittime - diff)
sleep(3)
print >> sys.stderr, "main: ONEXIT Session is shutdown"
try:
print >> sys.stderr, "main: ONEXIT cleaning database"
peerdb = self.utility.session.open_dbhandler(NTFY_PEERS)
peerdb._db.clean_db(randint(0, 24) == 0, exiting=True)
except:
print_exc()
print >> sys.stderr, "main: ONEXIT deleting instances"
Session.del_instance()
GUIUtility.delInstance()
GUIDBProducer.delInstance()
DefaultDownloadStartupConfig.delInstance()
if SQLiteCacheDB.hasInstance():
SQLiteCacheDB.getInstance().close_all()
SQLiteCacheDB.delInstance()
if not ALLOW_MULTIPLE:
del self.single_instance_checker
return 0