コード例 #1
0
ファイル: utils.py プロジェクト: hforge/odf-i18n-tests
def get_tests():
    """Returns list of tuples:

        [(odf_path, po_handler), ...]
    """
    # We traverse all ODF documents
    for odf_uri in vfs.traverse('./documents/'):
        odf_handler = get_handler(odf_uri)
        if not isinstance(odf_handler, ODFFile):
            continue
        # We found a ODF Document, We search the corresponding PO file
        po_uri = resolve_uri(odf_uri, 'testDoc.po')
        yield get_uri_path(odf_uri), get_handler(po_uri)
コード例 #2
0
ファイル: vfs.py プロジェクト: Nabellaleen/itools
 def resolve(base, reference):
     return resolve_uri(base, reference)
コード例 #3
0
 def resolve(base, reference):
     return resolve_uri(base, reference)
コード例 #4
0
ファイル: issue_views.py プロジェクト: Ramel/tchacker
    def get_namespace(self, resource, context):
        # Set Style & JS
        context.styles.append('/ui/tchacker/tracker.css')
        context.scripts.append('/ui/tchacker/tracker.js')
        context.styles.append('/ui/thickbox/thickbox.css')
        context.scripts.append('/ui/thickbox/thickbox.js')
        #context.scripts.append('/ui/flowplayer/script.js')
        context.scripts.append('/ui/flowplayer/flowplayer-3.1.1.min.js')
        context.scripts.append('/ui/flowplayer/flowplayer-3.1.1.swf')
        #context.scripts.append('/ui/flowplayer/flowplayer.controls-3.1.1.swf')
        # Build namespace
        namespace = Issue_Edit.get_namespace(self, resource, context)
        #namespace['comments'].reverse()

        # Local variables
        users = resource.get_resource('/users')
        history = resource.get_history()
        record = history.get_record(-1)

        # Build the namespace

        for comment in namespace['comments']:
            if comment['file']:
                attachment = resource.get_resource(comment['file'])
                #print type(attachment), attachment
                comment['is_image'] = isinstance(attachment, Image)
                comment['is_video'] = isinstance(attachment, Video)
                comment['width'] = 200
                comment['height'] = 200
                if comment['is_video']:
                    """
                    #pprint("i = %s and length = %s" % (i, length))
                    if (i == length ):
                        last_video = True
                        #pprint("LastVideo = %s" % last_video)
                    """
                    video = attachment #resource.get_resource(file)
                    base = video.metadata.uri
                    name = video.name
                    #pprint("name = %s" % name)
                    name, ext, lang = FileName.decode(name)
                    if ext is None:
                        mimetype = video.get_content_type()
                        ext = guess_extension(mimetype)[1:]
                    
                    #thumbnail = ("thumb_%s" % name)
                    #pprint("ext = %s, sortie de is_video" % ext)
                    
                    uri = resolve_uri(base, name)
                    #pprint("name = %s" % name)
                    #pprint("base = %s" % base)
                    #pprint("uri = %s.%s" % (uri, ext))
                    comment['width'], height, ratio = VideoEncodingToFLV(
                       resource).get_size_and_ratio(
                            "%s.%s" % (uri, ext))
                    # Add the Flowplayer menu's height
                    comment['height'] = int(height) + 24
                    #pprint("width x height & ratio = %s x %s & %s" % (width, height, ratio))
            else:
                comment['file'] = False
                comment['is_video'] = False
            #comment = record.comment
            #file = record.file
            ##thumb_low = ''
            ##thumb_high = ''
            #if not comment and not file:
            #    continue
            #rdatetime = record.datetime
            ## solid in case the user has been removed
            #username = record.username
            #user = users.get_resource(username, soft=True)
            #user_title = user and user.get_title() or username
            ## In case of an Image joined as file, show it as a preview
            ## (width="256", for now).
            #width, height = None, None
            #thumbnail = None 
            #
            #if file:
            #    is_image = False
            #    is_video = False
            #    last_video = False
            #    #pprint("file = %s" % file)
            #    # If file is an image return True
            #    is_image = isinstance(resource.get_resource(file), Image)
            #    is_video = isinstance(resource.get_resource(file), Video)
            #    
            #    #pprint("is_image = %s" % is_image)
            #    #pprint("is_video = %s" % is_video)
            #    
            #    if is_video:
            #        """
            #        #pprint("i = %s and length = %s" % (i, length))
            #        if (i == length ):
            #            last_video = True
            #            #pprint("LastVideo = %s" % last_video)
            #        """
            #        video = resource.get_resource(file)
            #        base = video.metadata.uri
            #        name = video.name
            #        #pprint("name = %s" % name)
            #        name, ext, lang = FileName.decode(name)
            #        if ext is None:
            #            mimetype = video.get_content_type()
            #            ext = guess_extension(mimetype)[1:]
            #        
            #        #thumbnail = ("thumb_%s" % name)
            #        #pprint("ext = %s, sortie de is_video" % ext)
            #        
            #        uri = resolve_uri(base, name)
            #        #pprint("name = %s" % name)
            #        #pprint("base = %s" % base)
            #        #pprint("uri = %s.%s" % (uri, ext))
            #        width, height, ratio = VideoEncodingToFLV(resource).get_size_and_ratio("%s.%s" % (uri, ext))
            #        # Add the Flowplayer menu's height
            #        height = int(height) + 24
            #        #pprint("width x height & ratio = %s x %s & %s" % (width, height, ratio))
            #if comment and not file: 
            #    is_image = False
            #    is_video = False

        return namespace