def _delete_selected_collection(self):
     if not self.last_selected_collection:
         return
     
     # Confirmation message
     item_text = '%s:%s' % (self.last_selected_collection.collection.url,
                            self.last_selected_collection.collection.field)
     
     msg_box = ConfirmMessageBox(self)
     msg_box.setText('Are you sure you want to delete collection %s?' % 
                     item_text)
     result = msg_box.exec_()
     
     if result == QtGui.QMessageBox.Cancel:
         log.debug('Deletion of %s aborted' % item_text) #@UndefinedVariable
         return
     
     # Reference deletion
     log.debug('Deleting collection %s' % item_text) #@UndefinedVariable
     self._clear_wrappers()
     self.parent.wrapper_gw.delete(self.last_selected_collection.collection)
     self.ui.collections.setItemSelected(self.last_selected_collection,
                                         False)
     self.ui.collections.removeItemWidget(self.last_selected_collection, 0)
     
     item_parent = self.last_selected_collection.parent()
     if item_parent.childCount() == 1:
         log.debug('Removing top level item') #@UndefinedVariable
         self.ui.collections.removeItemWidget(item_parent, 0)
     self.last_selected_collection = None
Example #2
0
    def _delete_selected_collection(self):
        if not self.last_selected_collection:
            return

        # Confirmation message
        item_text = '%s:%s' % (self.last_selected_collection.collection.url,
                               self.last_selected_collection.collection.field)

        msg_box = ConfirmMessageBox(self)
        msg_box.setText('Are you sure you want to delete collection %s?' %
                        item_text)
        result = msg_box.exec_()

        if result == QtGui.QMessageBox.Cancel:
            log.debug('Deletion of %s aborted' %
                      item_text)  #@UndefinedVariable
            return

        # Reference deletion
        log.debug('Deleting collection %s' % item_text)  #@UndefinedVariable
        self._clear_wrappers()
        self.parent.wrapper_gw.delete(self.last_selected_collection.collection)
        self.ui.collections.setItemSelected(self.last_selected_collection,
                                            False)
        self.ui.collections.removeItemWidget(self.last_selected_collection, 0)

        item_parent = self.last_selected_collection.parent()
        if item_parent.childCount() == 1:
            log.debug('Removing top level item')  #@UndefinedVariable
            self.ui.collections.removeItemWidget(item_parent, 0)
        self.last_selected_collection = None
Example #3
0
 def _delete_all_references(self):
     self.ui.references
     msg_box = ConfirmMessageBox(self)
     msg_box.setText('Are you sure you want to delete all references?')
     result = msg_box.exec_()
     
     if result == QtGui.QMessageBox.Cancel:
         log.debug('Deletion aborted') #@UndefinedVariable
         return
     
     # Reference deletion
     count = self.ui.references.topLevelItemCount()
     for index in range(count):
         item = self.ui.references.takeTopLevelItem(0)
         log.debug('Deleting reference') #@UndefinedVariable
         self.parent.extraction_gw.delete(item.extraction)
         self.ui.references.setItemSelected(item, False)
     self.last_selected = None        
     self.editor.clear()
Example #4
0
 def _delete_selected_reference(self):
     if not self.last_selected:
         return
     
     # Confirmation message
     item_text = '"%s..."' % self.last_selected.text(0)[:20]
     msg_box = ConfirmMessageBox(self)
     msg_box.setText('Are you sure you want to delete reference %s?' % 
                     item_text)
     result = msg_box.exec_()
     
     if result == QtGui.QMessageBox.Cancel:
         log.debug('Deletion of %s aborted' % item_text) #@UndefinedVariable
         return
     
     # Reference deletion
     log.debug('Deleting reference %s' % item_text) #@UndefinedVariable
     self.parent.extraction_gw.delete(self.last_selected.extraction)
     self.ui.references.setItemSelected(self.last_selected, False)
     self.ui.references.removeItemWidget(self.last_selected, 0)
     self.last_selected = None
 def _delete_selected_wrapper(self):
     if not self.last_selected_wrapper:
         return
     
     # Confirmation message
     item_text = self.last_selected_wrapper.text(0)
     msg_box = ConfirmMessageBox(self)
     msg_box.setText('Are you sure you want to delete wrapper %s?' % 
                     item_text)
     result = msg_box.exec_()
     
     if result == QtGui.QMessageBox.Cancel:
         log.debug('Deletion of %s aborted' % item_text) #@UndefinedVariable
         return
     
     # Reference deletion
     log.debug('Deleting wrapper %s' % item_text) #@UndefinedVariable
     self._clear_wrapper_editor()
     self.parent.wrapper_gw.delete(self.last_selected_wrapper.wrapper)
     self.ui.wrappers.setItemSelected(self.last_selected_wrapper, False)
     self.ui.wrappers.removeItemWidget(self.last_selected_wrapper, 0)
     self.last_selected_wrapper = None
Example #6
0
    def _delete_selected_wrapper(self):
        if not self.last_selected_wrapper:
            return

        # Confirmation message
        item_text = self.last_selected_wrapper.text(0)
        msg_box = ConfirmMessageBox(self)
        msg_box.setText('Are you sure you want to delete wrapper %s?' %
                        item_text)
        result = msg_box.exec_()

        if result == QtGui.QMessageBox.Cancel:
            log.debug('Deletion of %s aborted' %
                      item_text)  #@UndefinedVariable
            return

        # Reference deletion
        log.debug('Deleting wrapper %s' % item_text)  #@UndefinedVariable
        self._clear_wrapper_editor()
        self.parent.wrapper_gw.delete(self.last_selected_wrapper.wrapper)
        self.ui.wrappers.setItemSelected(self.last_selected_wrapper, False)
        self.ui.wrappers.removeItemWidget(self.last_selected_wrapper, 0)
        self.last_selected_wrapper = None