def initializePage(self, identifier):
        """ Performs initialization actions for the wizard page with the given identifier. """

        if identifier == SOURCE_PAGE_ID:
            preSelectedSourceItems = self._wizard.preSelectedSourceItems
            if preSelectedSourceItems is None:
                preSelectedSourceItems = [
                    self._sourceRepositoryModel.activeIndex
                ]
            self._wizard.configureSourceItemPage(
                PropertyFilter(self._sourceRepositoryModel),
                preSelectedSourceItems, "", False, True,
                QtGui.QAbstractItemView.MultiSelection)
        elif identifier == TARGET_PAGE_ID:
            self._wizard.configureTargetItemPage(
                LeafFilter(self._targetRepositoryModel),
                [self._targetRepositoryModel.activeIndex],
                "",
                False,
                True,
                itemCheckFunction=lambda item: item.capabilities.canAddChildren
            )
        elif identifier == DATASTORE_PAGE_ID:
            self._wizard.configureDataStorePage(ONLINE_DATASTORE_MODE,
                                                self._targetRepositoryModel)
        else:
            self._wizard.configurePropertyPage(self._targetRepositoryModel,
                                               False)
Esempio n. 2
0
    def load(self, managedRepositoryController, scriptController):
        """
        Initializes the unmanaged repository controller.

        @param managedRepositoryController: The managed repository controller.
        @type managedRepositoryController: L{ManagedRepositoryController<datafinder.gui.user.controller.managed_repository.ManagedRepositoryController>}
        @param scriptController: The script controller component used to get access to registered script extensions.
        @type scriptController: L{ScriptController<datafinder.gui.user.controller.scripts.ScriptController>}
        """

        self._itemActionController = ItemActionController(
            self.mainWindow, self.model, managedRepositoryController.model,
            scriptController)

        configuration = self._repositoryManager.getRepositoryConfiguration()
        localRepository = self._repositoryManager.connectRepository(
            "file:///", configuration)
        self.model.load(localRepository)

        self._toolbarController.model = self.model
        self._pathController.model = self.model
        self._treeController.model = LeafFilter(self.model)
        self.collectionController.model = self.model

        self._toolbarController.setActivated(True)
        self.model.activePath = os.path.expanduser("~")
        self.model.updateSignal()
        self.collectionController.focus()
Esempio n. 3
0
    def _showSelectionClickedSlot(self):
        """ 
        Slot is called when the start selection button was clicked. 
        """

        leafFilterModel = LeafFilter(self.__model)
        self._collectionSearchDialog = ItemSelectionDialog(leafFilterModel, self)
        self._collectionSearchDialog.selectedIndex = self.__model.indexFromPath(unicode(self.startLineEdit.text()))
        if self._collectionSearchDialog.exec_() == QtGui.QDialog.Accepted:
            item = self.__model.nodeFromIndex(self._collectionSearchDialog.selectedIndex)
            self.startLineEdit.setText(item.path or "/")
    def initializePage(self, identifier):
        """ Performs initialization actions for the wizard page with the given identifier. """

        if identifier == constants.SOURCE_PAGE_ID:
            preSelectedSourceItems = self._wizard.preSelectedSourceItems
            if preSelectedSourceItems is None or len(
                    preSelectedSourceItems) == 0:
                preSelectedSourceItems = [self._repositoryModel.activeIndex]
            self._wizard.configureSourceItemPage(
                LeafFilter(self._repositoryModel),
                preSelectedSourceItems,
                disableItemNameSpecification=True,
                itemCheckFunction=lambda item: item.capabilities.canArchive)
        elif identifier == constants.TARGET_PAGE_ID:
            self._wizard.configureTargetItemPage(
                LeafFilter(self._repositoryModel),
                [self._wizard.sourceIndexes[0].parent()],
                disableItemNameSpecification=True,
                checkTargetDataTypesExistence=True,
                targetIndex=self._wizard.sourceIndexes[0])
        else:
            self._wizard.configureDataStorePage(
                constants.ARCHIVE_DATASTORE_MODE, self._repositoryModel)
    def initializePage(self, identifier):
        """ Performs initialization actions for the wizard page with the given identifier. """

        if identifier == SOURCE_PAGE_ID:
            self._wizard.configureSourceItemPage(
                LeafFilter(self._repositoryModel),
                [self._repositoryModel.activeIndex], self._ITEMNAME_LABEL_TEXT,
                self._repositoryModel.isManagedRepository)
        else:
            indexChanged = self._currentSourceIndex != self._wizard.sourceIndexes[
                0]
            self._currentSourceIndex = self._wizard.sourceIndexes[0]

            self._wizard.configurePropertyPage(self._repositoryModel, True,
                                               self._currentSourceIndex,
                                               indexChanged)
    def initializePage(self, identifier):
        """ Performs initialization actions for the wizard page with the given identifier. """

        if identifier == SOURCE_PAGE_ID:
            self._wizard.configureSourceItemPage(
                LeafFilter(self._repositoryModel),
                [self._repositoryModel.activeIndex], self._ITEMNAME_LABEL_TEXT)
        elif identifier == DATASTORE_PAGE_ID:
            self._wizard.configureDataStorePage(OFFLINE_DATASTORE_MODE,
                                                self._repositoryModel)
        else:
            initialProperties = self._determineInitialProperties()
            self._wizard.configurePropertyPage(
                self._repositoryModel,
                False,
                initialProperties=initialProperties)
 def initializePage(self, identifier):
     """ Performs initialization actions for the wizard page with the given identifier. """
     
     if identifier == SOURCE_PAGE_ID:
         preSelectedSourceItems = self._wizard.preSelectedSourceItems
         if preSelectedSourceItems is None:
             preSelectedSourceItems = [self._repositoryModel.activeIndex]
         self._wizard.configureSourceItemPage(PropertyFilter(self._repositoryModel, 
                                                             itemSelectionMode=PropertyFilter.ALL_SELECTION_MODE), 
                                              preSelectedSourceItems,
                                              disableItemNameSpecification=True,
                                              selectionMode=QtGui.QAbstractItemView.MultiSelection,
                                              itemCheckFunction=lambda _: True)
     elif identifier == TARGET_PAGE_ID:
         self._wizard.configureTargetItemPage(LeafFilter(self._repositoryModel), 
                                              [self._repositoryModel.activeIndex],
                                              disableItemNameSpecification=True)
Esempio n. 8
0
    def initializePage(self, identifier):
        """ Performs initialization actions for the wizard page with the given identifier. """

        if identifier == SOURCE_PAGE_ID:
            preSelectedSourceItems = self._wizard.preSelectedSourceItems
            if preSelectedSourceItems is None:
                preSelectedSourceItems = [
                    self._sourceRepositoryModel.activeIndex
                ]
            self._wizard.configureSourceItemPage(PropertyFilter(self._sourceRepositoryModel,
                                                                itemSelectionMode=PropertyFilter.ALL_SELECTION_MODE),
                                                 preSelectedSourceItems, "",
                                                 False, True, QtGui.QAbstractItemView.MultiSelection,
                                                 itemCheckFunction=lambda item: item.capabilities.canRetrieveData \
                                                                                or item.isCollection and item.capabilities.canArchive)
        else:
            self._wizard.configureTargetItemPage(
                LeafFilter(self._targetRepositoryModel),
                [self._targetRepositoryModel.activeIndex], "", False, True)
    def load(self, unmanagedRepositoryController, scriptController):
        """
        Initializes the managed repository controller.

        @param unmanagedRepositoryModel: The unmanaged repository controller.
        @type unmanagedRepositoryModel: L{UnmanagedRepositoryController<datafinder.gui.user.controller.unmanaged_repository.UnmanagedRepositoryController>}
        @param scriptController: The script controller component used to get access to registered script extensions.
        @type scriptController: L{ScriptController<datafinder.gui.user.controller.scripts.ScriptController>}
        """

        self._unmanagedRepositoryController = unmanagedRepositoryController
        self._delegate = _ManagedRepositoryDelegate(self,
                                                    self._repositoryManager,
                                                    scriptController)
        self._itemActionController = ItemActionController(
            self.mainWindow, self.model, unmanagedRepositoryController.model,
            scriptController)

        self._toolbarController.model = self.model
        self._pathController.model = self.model
        self._treeController.model = LeafFilter(self.model)
        self.collectionController.model = self.model
        self._propertiesController.model = PropertiesModel(self.model)
Esempio n. 10
0
def getExistingCollection(repositoryDescription=None, helpText=""):
    """ 
    Shows a dialog allowing the selection of a collection and returns its path.
    When the dialog has been canceled by the user C{None} is returned.
    
    @param repositoryDescription: Identifies the target repository.
    @type repositoryDescription: L{RepositoryDescription<datafinder.script_api.repository.RepositoryDescription>}
    @param helpText: An optional information displayed in the dialog. Default: C{}
    @type helpText: C{unicode}
    """

    existingCollectionPath = None
    rm = _context.determineRepositoryModel(repositoryDescription)
    filteredRm = LeafFilter(rm)
    itemSelectionDialog = ItemSelectionDialog(filteredRm)
    itemSelectionDialog.selectedIndex = filteredRm.activeIndex
    itemSelectionDialog.helpText = helpText
    exitCode = itemSelectionDialog.exec_()

    if exitCode == QDialog.Accepted:
        existingCollectionPath = rm.nodeFromIndex(
            itemSelectionDialog.selectedIndex).path
    return existingCollectionPath