Esempio n. 1
0
    def handle_noargs(self, **options):
        up = os.path.dirname
        appDir = up(up(up(os.path.abspath(__file__))))
        print 'appDir:', appDir
        builder = Builder()

        # render svg to png
        if settings.GEOCAM_LENS_RENDER_SVG_ICONS:
            svgGlob = '%s/media_src/icons/*.svg' % appDir
            svgOutput = '%s/build/media/geocamLens/icons/map/' % appDir
            logging.debug('svgIcons %s %s' % (svgGlob, svgOutput))
            for imPath in glob(svgGlob):
                svg.buildIcon(builder, imPath, outputDir=svgOutput)

        # link static stuff into build/media
        inst = Installer(builder)
        inst.installRecurseGlob('%s/static/*' % appDir,
                                '%s/build/media' % appDir)

        # rotate pngs
        rotGlob = '%s/build/media/geocamLens/icons/map/*Point.png' % appDir
        rotOutput = '%s/build/media/geocamLens/icons/mapr' % appDir
        logging.debug('rotateIcons %s %s' % (rotGlob, rotOutput))
        for imPath in glob(rotGlob):
            rotate.buildAllDirections(builder, imPath, outputDir=rotOutput)
Esempio n. 2
0
    def handle_noargs(self, **options):
        up = os.path.dirname
        appDir = up(up(up(os.path.abspath(__file__))))
        print 'appDir:', appDir
        builder = Builder()

        # render svg to png
        if settings.GEOCAM_LENS_RENDER_SVG_ICONS:
            svgGlob = '%s/media_src/icons/*.svg' % appDir
            svgOutput = '%s/build/media/geocamLens/icons/map/' % appDir
            logging.debug('svgIcons %s %s' % (svgGlob, svgOutput))
            for imPath in glob(svgGlob):
                svg.buildIcon(builder, imPath, outputDir=svgOutput)

        # link static stuff into build/media
        inst = Installer(builder)
        inst.installRecurseGlob('%s/static/*' % appDir,
                                '%s/build/media' % appDir)

        # rotate pngs
        rotGlob = '%s/build/media/geocamLens/icons/map/*Point.png' % appDir
        rotOutput = '%s/build/media/geocamLens/icons/mapr' % appDir
        logging.debug('rotateIcons %s %s' % (rotGlob, rotOutput))
        for imPath in glob(rotGlob):
            rotate.buildAllDirections(builder, imPath, outputDir=rotOutput)
Esempio n. 3
0
    def handle(self, *args, **options):
        up = os.path.dirname
        appDir = up(up(up(os.path.abspath(__file__))))
        print 'appDir:', appDir
        builder = Builder()

        # render svg to png
        svgOutput = '%s/build/static/geocamLens/icons/map/' % appDir
        if settings.GEOCAM_LENS_RENDER_SVG_ICONS:
            svgGlob = '%s/media_src/icons/*.svg' % appDir
            logging.debug('svgIcons %s %s', svgGlob, svgOutput)
            for imPath in glob(svgGlob):
                svg.buildIcon(builder, imPath, outputDir=svgOutput)

        # link static stuff into build/media
        inst = Installer(builder)
        inst.installRecurseGlob('%s/static/*' % appDir,
                                '%s/build/static' % appDir)

        # make highlighted versions of icons
        dstGlob = svgOutput + '*.png'
        logging.debug('highlightIcons %s', dstGlob)
        for dst in glob(dstGlob):
            if 'Highlighted' in dst:
                continue
            dstHighlighted = os.path.splitext(dst)[0] + 'Highlighted.png'
            halo.addHalo(builder, dst, dstHighlighted)

        # rotate pngs
        rotGlob = '%s/build/static/geocamLens/icons/map/*Point*.png' % appDir
        rotOutput = '%s/build/static/geocamLens/icons/mapr' % appDir
        logging.debug('rotateIcons %s %s', rotGlob, rotOutput)
        for imPath in glob(rotGlob):
            rotate.buildAllDirections(builder, imPath, outputDir=rotOutput)
Esempio n. 4
0
    def test_buildIcon(self):
        thisDir = os.path.dirname(os.path.abspath(__file__))
        srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir)

        builder = Builder()
        logging.debug('buildIcon srcImage=%s outDir=%s' % (srcImage, self.outDir))
        svg.buildIcon(builder, srcImage, outputDir=self.outDir)
        self.assertExists('%sexample.png' % self.outDir)
        self.assertExists('%sexamplePoint.png' % self.outDir)
Esempio n. 5
0
    def test_buildIcon(self):
        thisDir = os.path.dirname(os.path.abspath(__file__))
        srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir)

        builder = Builder()
        logging.debug('buildIcon srcImage=%s outDir=%s', srcImage, self.outDir)
        svg.buildIcon(builder, srcImage, outputDir=self.outDir)
        self.assertExists('%sexample.png' % self.outDir)
        self.assertExists('%sexamplePoint.png' % self.outDir)
Esempio n. 6
0
    def test_buildIcon(self):
        thisDir = os.path.dirname(os.path.abspath(__file__))
        srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir)

        builder = Builder()
        logging.debug('buildIcon srcImage=%s outDir=%s', srcImage, self.outDir)
        try:
            svg.buildIcon(builder, srcImage, outputDir=self.outDir)
        except svg.NoSvgBackendError:
            logging.warning('no svg rendering backend found')
            logging.warning('in order to run svg rendering tests, try installing ImageMagick or rsvg')
            logging.warning('note: this may be ok; svg rendering may not be needed for your site')
            return
        self.assertExists('%sexample.png' % self.outDir)
        self.assertExists('%sexamplePoint.png' % self.outDir)
Esempio n. 7
0
    def test_buildIcon(self):
        thisDir = os.path.dirname(os.path.abspath(__file__))
        srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir)

        builder = Builder()
        logging.debug('buildIcon srcImage=%s outDir=%s', srcImage, self.outDir)
        try:
            svg.buildIcon(builder, srcImage, outputDir=self.outDir)
        except svg.NoSvgBackendError:
            logging.warning('no svg rendering backend found')
            logging.warning(
                'in order to run svg rendering tests, try installing ImageMagick or rsvg'
            )
            logging.warning(
                'note: this may be ok; svg rendering may not be needed for your site'
            )
            return
        self.assertExists('%sexample.png' % self.outDir)
        self.assertExists('%sexamplePoint.png' % self.outDir)