本文整理汇总了Python中ilastik.shell.projectManager.ProjectManager.closeCurrentProject方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectManager.closeCurrentProject方法的具体用法?Python ProjectManager.closeCurrentProject怎么用?Python ProjectManager.closeCurrentProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilastik.shell.projectManager.ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.closeCurrentProject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IlastikShell
# 需要导入模块: from ilastik.shell.projectManager import ProjectManager [as 别名]
# 或者: from ilastik.shell.projectManager.ProjectManager import closeCurrentProject [as 别名]
#.........这里部分代码省略.........
"""
An applet is asking us to do something. Handle the request.
"""
with Tracer(traceLogger):
if requestAction == ShellRequest.RequestSave:
# Call the handler directly to ensure this is a synchronous call (not queued to the GUI thread)
self.projectManager.saveProject()
def __len__( self ):
return self.appletBar.count()
def __getitem__( self, index ):
return self._applets[index]
def ensureNoCurrentProject(self, assertClean=False):
"""
Close the current project. If it's dirty, we ask the user for confirmation.
The assertClean parameter is for tests. Setting it to True will raise an assertion if the project was dirty.
"""
closeProject = True
if self.projectManager.isProjectDataDirty():
# Testing assertion
assert not assertClean, "Expected a clean project but found it to be dirty!"
message = "Your current project is about to be closed, but it has unsaved changes which will be lost.\n"
message += "Are you sure you want to proceed?"
buttons = QMessageBox.Yes | QMessageBox.Cancel
response = QMessageBox.warning(self, "Discard unsaved changes?", message, buttons, defaultButton=QMessageBox.Cancel)
closeProject = (response == QMessageBox.Yes)
if closeProject:
self.closeCurrentProject()
return closeProject
def closeCurrentProject(self):
for applet in self._applets:
applet.gui.reset()
self.projectManager.closeCurrentProject()
self.enableWorkflow = False
self.updateAppletControlStates()
self.updateShellProjectDisplay()
def onNewProjectActionTriggered(self):
logger.debug("New Project action triggered")
# Make sure the user is finished with the currently open project
if not self.ensureNoCurrentProject():
return
newProjectFilePath = self.getProjectPathToCreate()
if newProjectFilePath is not None:
self.createAndLoadNewProject(newProjectFilePath)
def createAndLoadNewProject(self, newProjectFilePath):
newProjectFile = self.projectManager.createBlankProjectFile(newProjectFilePath)
self.loadProject(newProjectFile, newProjectFilePath, False)
def getProjectPathToCreate(self, defaultPath=None, caption="Create Ilastik Project"):
"""
Ask the user where he would like to create a project file.
"""
if defaultPath is None: