• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python thumbnails.ThumbnailCache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vistrails.core.thumbnails.ThumbnailCache的典型用法代码示例。如果您正苦于以下问题:Python ThumbnailCache类的具体用法?Python ThumbnailCache怎么用?Python ThumbnailCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ThumbnailCache类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: destroy

 def destroy(self):
     """ destroy() -> None
     Finalize all packages to, such as, get rid of temp files
     
     """
     if hasattr(self, 'package_manager'):
         self.package_manager.finalize_packages()
     Collection.clearInstance()
     ThumbnailCache.clearInstance()
开发者ID:sameera2004,项目名称:VisTrails,代码行数:9,代码来源:application.py


示例2: save_as

 def save_as(self, save_bundle, version=None):
     save_bundle = _ZIPFileLocator.save(self, save_bundle, True, version)
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     # Need to update thumbnail cache since files have moved
     ThumbnailCache.getInstance().add_entries_from_files(save_bundle.thumbnails)
     return save_bundle
开发者ID:hjanime,项目名称:VisTrails,代码行数:9,代码来源:locator.py


示例3: clear_clicked

 def clear_clicked(self, checked=False):
     thumbnail_dir = system.get_vistrails_directory("thumbs.cacheDir")
     res = show_question('VisTrails',
                         ("All files in %s will be removed. "
                          "Are you sure? " % thumbnail_dir),
                         buttons = [YES_BUTTON,NO_BUTTON],
                         default = NO_BUTTON)
     if res == YES_BUTTON:
         ThumbnailCache.getInstance().clear()
开发者ID:hjanime,项目名称:VisTrails,代码行数:9,代码来源:configuration.py


示例4: setupVersion

    def setupVersion(self, node, action, tag, description):
        """ setupPort(node: DotNode,
                      action: DBAction,
                      tag: str,
                      description: str) -> None
        Update the version dimensions and id
        
        """
        # Lauro:
        # what was this hacking??? the coordinates inside
        # the input "node" should come to this point ready. This is
        # not the point to do layout calculations (e.g. -node.p.y/2)

        # Carlos:
        # This is not layout as much as dealing with the way Qt
        # specifies rectangles. Besides, moving this back here reduces
        # code duplication, and allows customized behavior for
        # subclasses.

        rect = QtCore.QRectF(node.p.x-node.width/2.0,
                             node.p.y-node.height/2.0,
                             node.width,
                             node.height)
        validLabel = True
        if tag is None:
            label = ''
            validLabel=False
        else:
            label = tag

        self.id = node.id
        self.label = label
        if description is None:
            self.descriptionLabel = ''
        else:
            self.descriptionLabel = description
        if validLabel:
            textToDraw=self.label
        else:
            textToDraw=self.descriptionLabel

        if (ThumbnailCache.getInstance().conf.mouseHover and
            action and action.thumbnail is not None):
            fname = ThumbnailCache.getInstance().get_abs_name_entry(action.thumbnail)
            self.setToolTip('<img src="%s" height="128" border="1"/>'%fname)
        else:
            self.setToolTip('')    
        self.text.changed(node.p.x, node.p.y, textToDraw, validLabel)
        self.setRect(rect)
开发者ID:hjanime,项目名称:VisTrails,代码行数:49,代码来源:version_view.py


示例5: add_mashup_entities_from_mashuptrail

 def add_mashup_entities_from_mashuptrail(self, mashuptrail):
     added_entry_keys = set()
     inv_tag_map = {}
     tagMap = mashuptrail.getTagMap()
     tags = tagMap.keys()
     if len(tags) > 0:
         tags.sort()
         for tag in tags:
             version_id = tagMap[tag]
             inv_tag_map[version_id] = tag
             action = mashuptrail.actionMap[version_id]
             mashup = mashuptrail.getMashup(version_id)
             mashup.name = tag
             #make sure we identify a mashup by its version
             mashup.id = action.id
             entity_key = (mashuptrail.id,version_id)
             self.mshp_entity_map[entity_key] = \
                self.create_mashup_entity(mashuptrail.id, mashup, action)
             added_entry_keys.add(entity_key)
             # get thumbnail for the workflow it points
             thumb_version = mashuptrail.vtVersion
             thumbnail = self.vistrail.get_thumbnail(thumb_version)
             if thumbnail is not None:
                 cache = ThumbnailCache.getInstance()
                 path = cache.get_abs_name_entry(thumbnail)
                 if path:
                     entity = ThumbnailEntity(path)
                     mshp_entity = self.mshp_entity_map[entity_key]
                     mshp_entity.children.append(entity)
                     entity.parent = mshp_entity
     return inv_tag_map
开发者ID:cjh1,项目名称:VisTrails,代码行数:31,代码来源:vistrail.py


示例6: add_mashup_entity

 def add_mashup_entity(self, mashuptrail, version_id, tag=None):
     if not hasattr(self.vistrail, 'mashups'):
         return
     if mashuptrail not in self.vistrail.mashups:
         return
     action = mashuptrail.actionMap[version_id]
     mashup = mashuptrail.getMashup(version_id)
     if tag:
         mashup.name = tag
     mashup.id = action.id
     entity_key = (mashuptrail.id,version_id)
     self.mshp_entity_map[entity_key] = \
                self.create_mashup_entity(mashuptrail.id, mashup, action)
     # get thumbnail for the workflow it points
     thumb_version = mashuptrail.vtVersion
     thumbnail = self.vistrail.get_thumbnail(thumb_version)
     if thumbnail is not None:
         cache = ThumbnailCache.getInstance()
         path = cache.get_abs_name_entry(thumbnail)
         if path:
             entity = ThumbnailEntity(path)
             mshp_entity = self.mshp_entity_map[entity_key]
             mshp_entity.children.append(entity)
             entity.parent = mshp_entity
     return self.mshp_entity_map[entity_key]
开发者ID:cjh1,项目名称:VisTrails,代码行数:25,代码来源:vistrail.py


示例7: save_vistrail

    def save_vistrail(self, locator_class,
                      vistrailView=None,
                      force_choose_locator=False):
        """

        force_choose_locator=True triggers 'save as' behavior
        """
        global bobo

        if not vistrailView:
            vistrailView = self.currentWidget()
        vistrailView.flush_changes()
        if vistrailView:
            gui_get = locator_class.save_from_gui
            # get a locator to write to
            if force_choose_locator:
                locator = gui_get(self, Vistrail.vtType,
                                  vistrailView.controller.locator)
            else:
                locator = (vistrailView.controller.locator or
                           gui_get(self, Vistrail.vtType,
                                   vistrailView.controller.locator))
            if locator == untitled_locator():
                locator = gui_get(self, Vistrail.vtType,
                                  vistrailView.controller.locator)
            # if couldn't get one, ignore the request
            if not locator:
                return False
            # update collection
            vistrailView.controller.flush_delayed_actions()
            try:
                vistrailView.controller.write_vistrail(locator)
            except Exception, e:
                debug.critical('An error has occurred', str(e))
                raise
                return False
            try:
                thumb_cache = ThumbnailCache.getInstance()
                vistrailView.controller.vistrail.thumbnails = \
                    vistrailView.controller.find_thumbnails(
                        tags_only=thumb_cache.conf.tagsOnly)
                vistrailView.controller.vistrail.abstractions = \
                    vistrailView.controller.find_abstractions(
                        vistrailView.controller.vistrail, True)

                collection = Collection.getInstance()
                url = locator.to_url()
                # create index if not exist
                entity = collection.fromUrl(url)
                if entity:
                    # find parent vistrail
                    while entity.parent:
                        entity = entity.parent 
                else:
                    entity = collection.updateVistrail(url, vistrailView.controller.vistrail)
                # add to relevant workspace categories
                collection.add_to_workspace(entity)
                collection.commit()
            except Exception, e:
                debug.critical('Failed to index vistrail', str(e))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:60,代码来源:view_manager.py


示例8: add_workflow_entity

    def add_workflow_entity(self, version_id):
        if version_id not in self.vistrail.actionMap:
            return
        action = self.vistrail.actionMap[version_id]
        tag = None
        if self.vistrail.has_tag(version_id):
            tag = self.vistrail.get_tag(version_id)
        try:
            workflow = self.vistrail.getPipeline(version_id)
        except:
            import traceback
            debug.critical("Failed to construct pipeline '%s'" % 
                               (tag if tag else version_id),
                           traceback.format_exc())
            workflow = self.vistrail.getPipeline(0)
        if tag:
            workflow.name = tag
        # if workflow already exists, we want to update it...
        # spin through self.children and look for matching
        # workflow entity?
        # self.children.append(WorkflowEntity(workflow))
        self.wf_entity_map[version_id] = \
            self.create_workflow_entity(workflow, action)

        # get thumbnail
        thumbnail = self.vistrail.get_thumbnail(version_id)
        if thumbnail is not None:
            cache = ThumbnailCache.getInstance()
            path = cache.get_abs_name_entry(thumbnail)
            if path:
                entity = ThumbnailEntity(path)
                self.wf_entity_map[action.id].children.append(entity)
                entity.parent = self.wf_entity_map[action.id]
        return self.wf_entity_map[version_id]
开发者ID:cjh1,项目名称:VisTrails,代码行数:34,代码来源:vistrail.py


示例9: __init__

    def __init__(self, parent, persistent_config, temp_config):
        """
        QThumbnailConfiguration(parent: QWidget, 
        configuration_object: ConfigurationObject) -> None

        """
        QtGui.QWidget.__init__(self, parent)
        self._configuration = None
        self._temp_configuration = None
        self._cache = ThumbnailCache.getInstance()
        self.create_widgets()
        self.update_state(persistent_config, temp_config)
        self.connect_signals()
开发者ID:cjh1,项目名称:VisTrails,代码行数:13,代码来源:configuration.py


示例10: update

 def update(self, thumbnail):
     self.thumbnail = thumbnail
     if self.thumbnail is not None:
         # store in cache if not already there
         cache = ThumbnailCache.getInstance()
         cache._copy_thumbnails([thumbnail])
         self.name = os.path.basename(thumbnail)
         statinfo = os.stat(self.thumbnail)
         self.user = statinfo[stat.ST_UID]
         self.size = statinfo[stat.ST_SIZE]
         time = datetime(*localtime(statinfo[stat.ST_MTIME])[:6])
         self.mod_time = time
         self.create_time = time
         self.description = ""
         self.url = "test"
         self.was_updated = True
开发者ID:hjanime,项目名称:VisTrails,代码行数:16,代码来源:thumbnail.py


示例11: add_parameter_exploration_entity

 def add_parameter_exploration_entity(self, pe):
     if not hasattr(self.vistrail, 'parameter_explorations'):
         return
     self.pe_entity_map[pe.name] = \
                self.create_parameter_exploration_entity(pe)
     # get thumbnail for the workflow it points
     thumbnail = self.vistrail.get_thumbnail(pe.action_id)
     if thumbnail is not None:
         cache = ThumbnailCache.getInstance()
         path = cache.get_abs_name_entry(thumbnail)
         if path:
             entity = ThumbnailEntity(path)
             pe_entity = self.pe_entity_map[pe.name]
             pe_entity.children.append(entity)
             entity.parent = self
     return self.pe_entity_map[pe.name]
开发者ID:cjh1,项目名称:VisTrails,代码行数:16,代码来源:vistrail.py


示例12: load

 def load(self, klass=None):
     from vistrails.core.vistrail.vistrail import Vistrail
     if klass is None:
         klass = Vistrail
     save_bundle = _DBLocator.load(self, klass.vtType, ThumbnailCache.getInstance().get_directory())
     if klass.vtType == DBWorkflow.vtType:
         wf = save_bundle
         klass = self.get_convert_klass(wf.vtType)
         klass.convert(wf)
         wf.locator = self
         return wf
     for obj in save_bundle.get_db_objs():
         klass = self.get_convert_klass(obj.vtType)
         klass.convert(obj)
         obj.locator = self
     return save_bundle
开发者ID:hjanime,项目名称:VisTrails,代码行数:16,代码来源:locator.py


示例13: open_vistrail

    def open_vistrail(self, locator=None, version=None, is_abstraction=False):
        if isinstance(locator, basestring):
            locator = BaseLocator.from_url(locator)
        elif locator is None:
            locator = UntitledLocator()

        controller = self.ensure_vistrail(locator)
        if controller is None:
            # vistrail is not already open
            try:
                loaded_objs = vistrails.core.db.io.load_vistrail(locator, is_abstraction)
                controller = self.add_vistrail(loaded_objs[0], locator, 
                                               *loaded_objs[1:])
                if locator.is_untitled():
                    return controller
                controller.is_abstraction = is_abstraction
                thumb_cache = ThumbnailCache.getInstance()
                controller.vistrail.thumbnails = controller.find_thumbnails(
                    tags_only=thumb_cache.conf.tagsOnly)
                controller.vistrail.abstractions = controller.find_abstractions(
                    controller.vistrail, True)
                controller.vistrail.mashups = controller._mashups
                collection = Collection.getInstance()
                url = locator.to_url()
                entity = collection.updateVistrail(url, controller.vistrail)
                # add to relevant workspace categories
                if not controller.is_abstraction:
                    collection.add_to_workspace(entity)
                collection.commit()
            except VistrailsDBException as e:
                debug.unexpected_exception(e)
                debug.critical("Exception from the database: %s" % e,
                               debug.format_exc())
                return None

        version = self.convert_version(version)
        if version is None:
            controller.select_latest_version()
            version = controller.current_version
        self.select_version(version)
        return controller
开发者ID:anukat2015,项目名称:VisTrails,代码行数:41,代码来源:application.py


示例14: updateVersion

    def updateVersion(self, versionNumber):
        """ updateVersion(versionNumber: int) -> None

        """
        if self.controller:
            vistrail = self.controller.vistrail
            if versionNumber in vistrail.actionMap.keys():
                action = vistrail.actionMap[versionNumber]
                if action and vistrail.has_thumbnail(action.id):
                    cache = ThumbnailCache.getInstance()
                    fname = cache.get_abs_name_entry(
                        vistrail.get_thumbnail(action.id))
                    if fname is not None:
                        pixmap = QtGui.QPixmap(fname)
                        self.thumbs.setPixmap(pixmap)
                        self.thumbs.adjustSize()
                    self.thumbs.setFrameShape(QtGui.QFrame.StyledPanel)
                    return
                
        self.thumbs.setPixmap(QtGui.QPixmap())
        self.thumbs.setFrameShape(QtGui.QFrame.NoFrame)
开发者ID:cjh1,项目名称:VisTrails,代码行数:21,代码来源:version_prop.py


示例15: open_vistrail

    def open_vistrail(self, locator=None, version=None, is_abstraction=False):
        if isinstance(locator, basestring):
            locator = BaseLocator.from_url(locator)
        elif locator is None:
            locator = UntitledLocator()

        controller = self.ensure_vistrail(locator)
        if controller is None:
            # vistrail is not already open
            try:
                loaded_objs = vistrails.core.db.io.load_vistrail(locator, False)
                controller = self.add_vistrail(loaded_objs[0], locator, 
                                               *loaded_objs[1:])
                if locator.is_untitled():
                    return True
                controller.is_abstraction = is_abstraction
                thumb_cache = ThumbnailCache.getInstance()
                controller.vistrail.thumbnails = controller.find_thumbnails(
                    tags_only=thumb_cache.conf.tagsOnly)
                controller.vistrail.abstractions = controller.find_abstractions(
                    controller.vistrail, True)
                controller.vistrail.mashups = controller._mashups
                collection = Collection.getInstance()
                url = locator.to_url()
                entity = collection.updateVistrail(url, controller.vistrail)
                # add to relevant workspace categories
                if not controller.is_abstraction:
                    collection.add_to_workspace(entity)
                collection.commit()
            except VistrailsDBException, e:
                import traceback
                debug.critical("Exception from the database",
                               traceback.format_exc())
                return None
            except Exception, e:
                #debug.critical('An error has occurred', e)
                #print "An error has occurred", str(e)
                raise
开发者ID:tacaswell,项目名称:VisTrails,代码行数:38,代码来源:application.py


示例16:

        old_locator = controller.locator

        controller.flush_delayed_actions()
        try:
            controller.write_vistrail(locator, export=export)
        except Exception, e:
            debug.unexpected_exception(e)
            debug.critical("Failed to save vistrail", traceback.format_exc())
            raise
        if export:
            return controller.locator

        self.update_locator(old_locator, controller.locator)
        # update collection
        try:
            thumb_cache = ThumbnailCache.getInstance()
            controller.vistrail.thumbnails = controller.find_thumbnails(
                tags_only=thumb_cache.conf.tagsOnly)
            controller.vistrail.abstractions = controller.find_abstractions(
                controller.vistrail, True)
            controller.vistrail.mashups = controller._mashups

            collection = Collection.getInstance()
            url = locator.to_url()
            entity = collection.updateVistrail(url, controller.vistrail)
            # add to relevant workspace categories
            collection.add_to_workspace(entity)
            collection.commit()
        except Exception, e:
            debug.critical('Failed to index vistrail', traceback.format_exc())
        return controller.locator
开发者ID:sameera2004,项目名称:VisTrails,代码行数:31,代码来源:application.py



注:本文中的vistrails.core.thumbnails.ThumbnailCache类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python upgradeworkflow.UpgradeWorkflowHandler类代码示例发布时间:2022-05-26
下一篇:
Python system.vistrails_root_directory函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap