本文整理汇总了Python中ilastik.shell.projectManager.ProjectManager.importProject方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectManager.importProject方法的具体用法?Python ProjectManager.importProject怎么用?Python ProjectManager.importProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilastik.shell.projectManager.ProjectManager
的用法示例。
在下文中一共展示了ProjectManager.importProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HeadlessShell
# 需要导入模块: from ilastik.shell.projectManager import ProjectManager [as 别名]
# 或者: from ilastik.shell.projectManager.ProjectManager import importProject [as 别名]
class HeadlessShell(object):
"""
For now, this class is just a stand-in for the GUI shell (used when running from the command line).
"""
def __init__(self):
self._applets = []
self.projectManager = ProjectManager()
self.currentImageIndex = -1
def addApplet(self, aplt):
self._applets.append(aplt)
self.projectManager.addApplet(aplt)
def changeCurrentInputImageIndex(self, newImageIndex):
if newImageIndex != self.currentImageIndex:
# Alert each central widget and viewer control widget that the image selection changed
for i in range(len(self._applets)):
self._applets[i].gui.setImageIndex(newImageIndex)
self.currentImageIndex = newImageIndex
def openProjectPath(self, projectFilePath):
try:
hdf5File, readOnly = self.projectManager.openProjectFile(projectFilePath)
self.projectManager.loadProject(hdf5File, projectFilePath, readOnly)
except ProjectManager.ProjectVersionError:
# Couldn't open project. Try importing it.
oldProjectFilePath = projectFilePath
name, ext = os.path.splitext(oldProjectFilePath)
projectFilePath = name + "_imported" + ext
logger.info("Importing project as '" + projectFilePath + "'")
projectFile = self.projectManager.createBlankProjectFile(projectFilePath)
self.projectManager.importProject(oldProjectFilePath, projectFile, projectFilePath)
示例2: IlastikShell
# 需要导入模块: from ilastik.shell.projectManager import ProjectManager [as 别名]
# 或者: from ilastik.shell.projectManager.ProjectManager import importProject [as 别名]
class IlastikShell( QMainWindow ):
"""
The GUI's main window. Simply a standard 'container' GUI for one or more applets.
"""
def __init__( self, workflow = [], parent = None, flags = QtCore.Qt.WindowFlags(0), sideSplitterSizePolicy=SideSplitterSizePolicy.Manual ):
QMainWindow.__init__(self, parent = parent, flags = flags )
# Register for thunk events (easy UI calls from non-GUI threads)
self.thunkEventHandler = ThunkEventHandler(self)
self._sideSplitterSizePolicy = sideSplitterSizePolicy
self.projectManager = ProjectManager()
import inspect, os
ilastikShellFilePath = os.path.dirname(inspect.getfile(inspect.currentframe()))
uic.loadUi( ilastikShellFilePath + "/ui/ilastikShell.ui", self )
self._applets = []
self.appletBarMapping = {}
self.setAttribute(Qt.WA_AlwaysShowToolTips)
if 'Ubuntu' in platform.platform():
# Native menus are prettier, but aren't working on Ubuntu at this time (Qt 4.7, Ubuntu 11)
self.menuBar().setNativeMenuBar(False)
(self._projectMenu, self._shellActions) = self._createProjectMenu()
self._settingsMenu = self._createSettingsMenu()
self.menuBar().addMenu( self._projectMenu )
self.menuBar().addMenu( self._settingsMenu )
self.updateShellProjectDisplay()
self.progressDisplayManager = ProgressDisplayManager(self.statusBar)
for applet in workflow:
self.addApplet(applet)
self.appletBar.expanded.connect(self.handleAppleBarItemExpanded)
self.appletBar.clicked.connect(self.handleAppletBarClick)
self.appletBar.setVerticalScrollMode( QAbstractItemView.ScrollPerPixel )
# By default, make the splitter control expose a reasonable width of the applet bar
self.mainSplitter.setSizes([300,1])
self.currentAppletIndex = 0
self.currentImageIndex = -1
self.populatingImageSelectionCombo = False
self.imageSelectionCombo.currentIndexChanged.connect( self.changeCurrentInputImageIndex )
self.enableWorkflow = False # Global mask applied to all applets
self._controlCmds = [] # Track the control commands that have been issued by each applet so they can be popped.
self._disableCounts = [] # Controls for each applet can be disabled by his peers.
# No applet can be enabled unless his disableCount == 0
def _createProjectMenu(self):
# Create a menu for "General" (non-applet) actions
menu = QMenu("&Project", self)
shellActions = ShellActions()
# Menu item: New Project
shellActions.newProjectAction = menu.addAction("&New Project...")
shellActions.newProjectAction.setShortcuts( QKeySequence.New )
shellActions.newProjectAction.triggered.connect(self.onNewProjectActionTriggered)
# Menu item: Open Project
shellActions.openProjectAction = menu.addAction("&Open Project...")
shellActions.openProjectAction.setShortcuts( QKeySequence.Open )
shellActions.openProjectAction.triggered.connect(self.onOpenProjectActionTriggered)
# Menu item: Save Project
shellActions.saveProjectAction = menu.addAction("&Save Project")
shellActions.saveProjectAction.setShortcuts( QKeySequence.Save )
shellActions.saveProjectAction.triggered.connect(self.onSaveProjectActionTriggered)
# Menu item: Save Project As
shellActions.saveProjectAsAction = menu.addAction("&Save Project As...")
shellActions.saveProjectAsAction.setShortcuts( QKeySequence.SaveAs )
shellActions.saveProjectAsAction.triggered.connect(self.onSaveProjectAsActionTriggered)
# Menu item: Save Project Snapshot
shellActions.saveProjectSnapshotAction = menu.addAction("&Take Snapshot...")
shellActions.saveProjectSnapshotAction.triggered.connect(self.onSaveProjectSnapshotActionTriggered)
# Menu item: Import Project
shellActions.importProjectAction = menu.addAction("&Import Project...")
shellActions.importProjectAction.triggered.connect(self.onImportProjectActionTriggered)
# Menu item: Quit
shellActions.quitAction = menu.addAction("&Quit")
shellActions.quitAction.setShortcuts( QKeySequence.Quit )
shellActions.quitAction.triggered.connect(self.onQuitActionTriggered)
shellActions.quitAction.setShortcut( QKeySequence.Quit )
return (menu, shellActions)
#.........这里部分代码省略.........