예제 #1
0
    def _check_for_bundle(self, object_id):
        registry = bundleregistry.get_registry()

        metadata = model.get(object_id)
        if metadata.get('progress', '').isdigit():
            if int(metadata['progress']) < 100:
                return

        bundle = misc.get_bundle(metadata)
        if bundle is None:
            return

        if registry.is_installed(bundle):
            logging.debug('_check_for_bundle bundle already installed')
            return

        if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE:
            # JournalEntryBundle code takes over the datastore entry and
            # transforms it into the journal entry from the bundle -- we have
            # nothing more to do.
            try:
                registry.install(bundle, metadata['uid'])
            except (ZipExtractException, RegistrationException):
                logging.exception('Could not install bundle %s',
                                  bundle.get_path())
            return

        try:
            registry.install(bundle)
        except (ZipExtractException, RegistrationException):
            logging.exception('Could not install bundle %s', bundle.get_path())
            return

        metadata['bundle_id'] = bundle.get_bundle_id()
        model.write(metadata)
예제 #2
0
    def _check_for_bundle(self, object_id):
        registry = bundleregistry.get_registry()

        metadata = model.get(object_id)
        if metadata.get('progress', '').isdigit():
            if int(metadata['progress']) < 100:
                return

        bundle = misc.get_bundle(metadata)
        if bundle is None:
            return

        if registry.is_installed(bundle):
            logging.debug('_check_for_bundle bundle already installed')
            return

        if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE:
            # JournalEntryBundle code takes over the datastore entry and
            # transforms it into the journal entry from the bundle -- we have
            # nothing more to do.
            try:
                registry.install(bundle, metadata['uid'])
            except (ZipExtractException, RegistrationException):
                logging.exception('Could not install bundle %s',
                        bundle.get_path())
            return

        try:
            registry.install(bundle)
        except (ZipExtractException, RegistrationException):
            logging.exception('Could not install bundle %s', bundle.get_path())
            return

        metadata['bundle_id'] = bundle.get_bundle_id()
        model.write(metadata)
예제 #3
0
    def _erase_button_clicked_cb(self, button):
        registry = bundleregistry.get_registry()

        bundle = misc.get_bundle(self._metadata)
        if bundle is not None and registry.is_installed(bundle):
            registry.uninstall(bundle)
        model.delete(self._metadata['uid'])
예제 #4
0
    def _erase_button_clicked_cb(self, button):
        registry = bundleregistry.get_registry()

        bundle = misc.get_bundle(self._metadata)
        if bundle is not None and registry.is_installed(bundle):
            registry.uninstall(bundle)
        model.delete(self._metadata['uid'])
예제 #5
0
 def __erase_alert_response_cb(self, alert, response_id):
     journalwindow.get_journal_window().remove_alert(alert)
     if response_id is Gtk.ResponseType.OK:
         registry = bundleregistry.get_registry()
         bundle = misc.get_bundle(self._metadata)
         if bundle is not None and registry.is_installed(bundle):
             registry.uninstall(bundle)
         model.delete(self._metadata['uid'])
예제 #6
0
 def __erase_alert_response_cb(self, alert, response_id):
     journalwindow.get_journal_window().remove_alert(alert)
     if response_id is Gtk.ResponseType.OK:
         registry = bundleregistry.get_registry()
         bundle = misc.get_bundle(self._metadata)
         if bundle is not None and registry.is_installed(bundle):
             registry.uninstall(bundle)
         model.delete(self._metadata['uid'])