本文整理汇总了Python中sessions.sessioncontroller.SessionController.restore方法的典型用法代码示例。如果您正苦于以下问题:Python SessionController.restore方法的具体用法?Python SessionController.restore怎么用?Python SessionController.restore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sessions.sessioncontroller.SessionController
的用法示例。
在下文中一共展示了SessionController.restore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRestoreReadonly_02
# 需要导入模块: from sessions.sessioncontroller import SessionController [as 别名]
# 或者: from sessions.sessioncontroller.SessionController import restore [as 别名]
def testRestoreReadonly_02(self):
from sessions.sessioncontroller import SessionController
wiki = WikiDocument.load(self.wikiroot.path, readonly=True)
self.application.wikiroot = wiki
self.application.selectedPage = wiki["Страница 1"]
tabsController = self.application.mainWindow.tabsController
tabsController.openInTab(wiki["Страница 2"], True)
tabsController.openInTab(wiki["Страница 1/Страница 3/Страница 4"],
True)
tabsController.openInTab(wiki["Страница 1/Страница 3"], False)
controller = SessionController(self.application)
session = controller.getCurrentSession()
tabsController.closeTab(1)
tabsController.closeTab(1)
tabsController.closeTab(1)
controller.restore(session)
self.assertEqual(os.path.abspath(self.application.wikiroot.path),
os.path.abspath(self.wikiroot.path))
self.assertTrue(self.application.wikiroot.readonly)
self.assertEqual(os.path.abspath(self.application.wikiroot.path),
os.path.abspath(self.wikiroot.path))
self.assertEqual(tabsController.getTabsCount(), 4)
self.assertEqual(tabsController.getSelection(), 2)
self.assertEqual(tabsController.getPage(0).title, "Страница 1")
self.assertEqual(tabsController.getPage(1).title, "Страница 2")
self.assertEqual(tabsController.getPage(2).title, "Страница 4")
self.assertEqual(tabsController.getPage(3).title, "Страница 3")
示例2: testRestore_05
# 需要导入模块: from sessions.sessioncontroller import SessionController [as 别名]
# 或者: from sessions.sessioncontroller.SessionController import restore [as 别名]
def testRestore_05(self):
from sessions.sessioncontroller import SessionController
self.__createWiki2()
wiki2 = WikiDocument.load(self.path2, True)
self.application.wikiroot = self.wikiroot
self.application.selectedPage = self.wikiroot["Страница 1"]
tabsController = self.application.mainWindow.tabsController
tabsController.openInTab(self.wikiroot["Страница 2"], True)
controller = SessionController(self.application)
session = controller.getCurrentSession()
uid1 = self._getPageLink(self.wikiroot["Страница 1"])
uid2 = self._getPageLink(self.wikiroot["Страница 2"])
self.application.wikiroot = wiki2
self.assertEqual(tabsController.getTabsCount(), 1)
controller.restore(session)
self.assertEqual(os.path.abspath(self.application.wikiroot.path),
os.path.abspath(self.wikiroot.path))
self.assertEqual(tabsController.getTabsCount(), 2)
self.assertEqual(tabsController.getSelection(), 1)
newsession = controller.getCurrentSession()
self.assertEqual(newsession.pages[0], uid1)
self.assertEqual(newsession.pages[1], uid2)
示例3: testRestore_01
# 需要导入模块: from sessions.sessioncontroller import SessionController [as 别名]
# 或者: from sessions.sessioncontroller.SessionController import restore [as 别名]
def testRestore_01 (self):
from sessions.sessioncontroller import SessionController
Application.wikiroot = self.wikiroot
Application.selectedPage = self.wikiroot[u"Страница 1"]
tabsController = Application.mainWindow.tabsController
tabsController.openInTab (self.wikiroot[u"Страница 2"], True)
controller = SessionController(Application)
session = controller.getCurrentSession()
uid1 = self._getPageLink (self.wikiroot[u"Страница 1"])
uid2 = self._getPageLink (self.wikiroot[u"Страница 2"])
Application.wikiroot = None
self.assertEqual (tabsController.getTabsCount(), 0)
controller.restore (session)
self.assertEqual (os.path.abspath (Application.wikiroot.path), os.path.abspath (self.path))
self.assertEqual (tabsController.getTabsCount(), 2)
self.assertEqual (tabsController.getSelection(), 1)
newsession = controller.getCurrentSession()
self.assertEqual (newsession.pages[0], uid1)
self.assertEqual (newsession.pages[1], uid2)
示例4: testRestore_02
# 需要导入模块: from sessions.sessioncontroller import SessionController [as 别名]
# 或者: from sessions.sessioncontroller.SessionController import restore [as 别名]
def testRestore_02(self):
from sessions.sessioncontroller import SessionController
self.application.wikiroot = self.wikiroot
self.application.selectedPage = self.wikiroot["Страница 1"]
tabsController = self.application.mainWindow.tabsController
tabsController.openInTab(self.wikiroot["Страница 2"], True)
tabsController.openInTab(
self.wikiroot["Страница 1/Страница 3/Страница 4"], True)
tabsController.openInTab(self.wikiroot["Страница 1/Страница 3"], False)
controller = SessionController(self.application)
session = controller.getCurrentSession()
uid1 = self._getPageLink(self.wikiroot["Страница 1"])
uid2 = self._getPageLink(self.wikiroot["Страница 2"])
uid3 = self._getPageLink(
self.wikiroot["Страница 1/Страница 3/Страница 4"])
uid4 = self._getPageLink(self.wikiroot["Страница 1/Страница 3"])
self.application.wikiroot = None
self.assertEqual(tabsController.getTabsCount(), 0)
controller.restore(session)
self.assertEqual(os.path.abspath(self.application.wikiroot.path),
os.path.abspath(self.wikiroot.path))
self.assertEqual(tabsController.getTabsCount(), 4)
self.assertEqual(tabsController.getSelection(), 2)
newsession = controller.getCurrentSession()
self.assertEqual(newsession.pages[0], uid1)
self.assertEqual(newsession.pages[1], uid2)
self.assertEqual(newsession.pages[2], uid3)
self.assertEqual(newsession.pages[3], uid4)
self.assertEqual(tabsController.getPage(0).title, "Страница 1")
self.assertEqual(tabsController.getPage(1).title, "Страница 2")
self.assertEqual(tabsController.getPage(2).title, "Страница 4")
self.assertEqual(tabsController.getPage(3).title, "Страница 3")