示例#1
0
    def output(self):
        Effect.output(self)

        if self.recording == True and Conf()['enableRecording'] == True:
            testsCreator = TestsCreator()
            # create out svg file
            testsCreator.addOutSvg(self.document)

            testsCreator.writeTestValues()

            # increment test number
            conf = Conf()
            conf['currentTest'] += 1
            conf.write()
示例#2
0
    def parse(self):
        file = self.args[-1]
        Effect.parse(self, file)

        # we don't want to record the output of the enableTrace extension
        self.recording = False
        if Conf()['enableRecording'] == True:
            # create in svg file
            TestsCreator().addInSvg(file)
            TestsCreator().addTestArgvModule(self.options, self)
            self.recording = True
示例#3
0
    def __init__(self, options, rootLayer, document):
        self.options = options
        self.rootLayer = rootLayer
        self.elements = []
        self.layersType = []
        self.layerBlock2Level = []
        self.content = []

        self.svg = SvgDoc(document)

        # the xmoto width of the level is the width of svg in pixel
        # divided by 20.0
        ratio = Conf()['SVG2LVL_RATIO']
        lvlWidth = self.options['svg']['width'] * ratio
        lvlHeight = self.options['svg']['height'] * ratio

        createIfAbsent(self.options, 'lvl')
        self.options['lvl']['width'] = lvlWidth
        self.options['lvl']['height'] = lvlHeight
        self.options['lvl']['ratio'] = ratio

        self.limits = {}
        self.limits['left'] = -lvlWidth / 2.0
        self.limits['right'] = lvlWidth / 2.0
        self.limits['top'] = lvlHeight / 2.0
        self.limits['bottom'] = -lvlHeight / 2.0

        smooth = float(getValue(self.options, 'level', 'smooth', default='9'))
        # now, smooth is from 1 to 10 in the tkinter window,
        # but it is still from 1 to 100 in svg2lvl
        smooth += 90
        self.options['lvl']['smooth'] = smooth

        numLayers = len(self.rootLayer.children)
        self.createLayerInfos(numLayers)

        numLayers = 0
        self.rootLayer.elements = []
        for child in self.rootLayer.children:
            if (len(self.layersType) > 0
                    and self.layersType[numLayers] != 'unused'):
                self.createEntitiesAndBlocksFromSvg(child, numLayers)
            else:
                child.unused = True
            numLayers += 1

        self.options['lvl']['rversion'] = self.getRequiredXmotoVersion()
示例#4
0
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""

import log, logging
import sys, random
from inkex import Effect, NSS, addNS
from parsers import LabelParser, StyleParser
from xmotoTools import createIfAbsent, applyOnElements, getBoolValue
from xmotoTools import getValue, dec2hex, hex2dec, updateInfos, color2Hex
from svgnode import XmNode, convertToXmNode
from factory import Factory
from svgDoc import SvgDoc
from testsCreator import TestsCreator

from confGenerator import Conf
ENTITY_RADIUS = Conf()['ENTITY_RADIUS']
SVG2LVL_RATIO = Conf()['SVG2LVL_RATIO']

from availableElements import AvailableElements
TEXTURES = AvailableElements()['TEXTURES']
SPRITES = AvailableElements()['SPRITES']
PARTICLESOURCES = AvailableElements()['PARTICLESOURCES']


class XmExt(Effect):
    def __init__(self):
        Effect.__init__(self)
        NSS[u'xmoto'] = u'http://xmoto.tuxfamily.org/'
        # in the svgs created by inkscape 0.46, in the cc:Work node,
        # the cc refers to the creativecommons namespace, not the
        # web.resource one put in inkex
示例#5
0
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""

from factory import Factory
from elements import Element
from xmotoTools import createIfAbsent, getValue
from availableElements import AvailableElements
from confGenerator import Conf
ENTITY_RADIUS = Conf()['ENTITY_RADIUS']


class Entity(Element):
    def __init__(self, _id, infos, vertex, matrix):
        Element.__init__(self,
                         _id=_id,
                         infos=infos,
                         vertex=vertex,
                         matrix=matrix)
        self.typeid = infos['typeid']
        self.radius = ENTITY_RADIUS[self.typeid]
        self.level = None

    def writeContent(self, options, level):
        """
示例#6
0
 def __init__(self):
     self.conf = Conf()
     relTestsDir = join('cur_tests', self.conf['recordingSession'])
     self.testsDir = join(getHomeDir(), relTestsDir)
     self.testValues = {'gtkCmds': []}