Beispiel #1
0
  def initUI(self):

    for i in range(0, self._size_barette):
      if i == 0 :
        self.element_tab.append(Element.Element(master = self.master, canvas = self._canvas, angle = self._angle, x_antecedent = self.antecedent_x, y_antecedent = self.antecedent_y))
      else :
        self.element_tab.append(Element.Element(master = self.master, canvas = self._canvas, angle = self._angle, x_antecedent = self.element_tab[i-1].getXYEndincart()[0], y_antecedent = self.element_tab[i-1].getXYEndincart()[1]))
    self.isStripInit = True
Beispiel #2
0
 def _parse_empty_element_match(empty_element_match):
     element_dict = empty_element_match.groupdict()
     if Element.is_empty(element_dict["tag"]):
         end_pos = empty_element_match.end()
         empty_element = Element.EmptyElement(element_dict["tag"],
                                              element_dict["attributes"])
         return empty_element, end_pos
     # invalid empty tag
     raise Exceptions.NonVoidSelfClosingTagError
def levelGen():
    rotPlatforms.append(
        Element.Entity((640, 1350), 'Mid B Lg.png', (0, -500), rotDir,
                       (776, 1005)))
    #rotPlatforms.append(Element.Entity((640,1450), 'Top Lg.png', (0, -660), rotDir, (1024,1327)))
    rotPlatforms[0].initialRot(0)
    linPlatforms.append(Element.linearEntity(0, 1, 1))
    ramps.append(Element.linearRamp(linPlatforms[0], 1))

    #TODO: Implement platforms of different height, using random to select which type to add

    rotPlatforms.append(
        Element.Entity((640, 1350), 'Mid B Lg.png', (0, -500), rotDir,
                       (776, 1005)))

    #Change this to increase or decrease rotation variance
    rotPlatforms[1].initialRot(45 + random.randint(1, 60))

    linPlatforms.append(Element.linearEntity(rotPlatforms[1].angle, 1, 1))
    ramps.append(Element.linearRamp(linPlatforms[1], 1))

    rotPlatforms.append(
        Element.Entity((640, 1350), 'Mid B Sm.png', (0, -500), rotDir,
                       (350, 1006)))
    #rotPlatforms.append(Element.Entity((640,1350), 'Mid B Lg.png', (0, -500), rotDir, (776,1005)))

    #Rotation variance
    rotPlatforms[2].initialRot(rotPlatforms[1].angle + random.randint(46, 90))

    linPlatforms.append(Element.linearEntity(rotPlatforms[2].angle, 1, 2))
    ramps.append(Element.linearRamp(linPlatforms[2], 2))

    rotPlatforms[0].add(allSprites)
    rotPlatforms[1].add(allSprites)
    rotPlatforms[2].add(allSprites)
Beispiel #4
0
def inputData():

    dividendString = input("Devidend: ")
    dividendElements = Element.splitElement(dividendString)

    divisorString = input("Divisor: ")
    divisorElements = Element.splitElement(divisorString)

    print()
    del dividendString, divisorString
    return dividendElements, divisorElements
Beispiel #5
0
def minusExponent(lastResult, dividendElements, divisorElements):
    # lastResult times divisor elements
    divisorElementsPosition = 1
    while divisorElementsPosition <= len(divisorElements) - 1:
        # init value for tempResult
        if lastResult.sign == divisorElements[divisorElementsPosition].sign:
            tempResultSign = '+'
        else:
            tempResultSign = '-'
        tempResultBase = lastResult.base * divisorElements[
            divisorElementsPosition].base
        if lastResult.unknow != '':
            tempResultUnknow = lastResult.unknow
        else:
            tempResultUnknow = divisorElements[divisorElementsPosition].unknow
        tempResultExponent = lastResult.exponent + divisorElements[
            divisorElementsPosition].exponent

        # create class for tempResult
        tempResult = Element.Element()
        tempResult.inputElement(sign=tempResultSign,
                                base=tempResultBase,
                                unknow=tempResultUnknow,
                                exponent=tempResultExponent)
        # print(f'Create minus exponent: {output(tempResult)}')

        # minus to dividend
        elementExist = False
        for eachDividendElement in dividendElements:
            if eachDividendElement.unknow == tempResult.unknow and eachDividendElement.exponent == tempResult.exponent:
                # print(f'Minus: {output(eachDividendElement)} and {output(tempResult)}')
                elementExist = True
                eachDividendElement.base = eachDividendElement.base - tempResult.base
                if eachDividendElement.base < 0:
                    eachDividendElement.sign = '-'
                else:
                    eachDividendElement.sign = '+'
        # if element not exist
        if not elementExist:
            tempResult.base *= -1
            if tempResult.base < 0:
                tempResult.sign = '-'
            else:
                tempResult.sign = '+'
            # add tempResult to dividendElements
            dividendElements.append(tempResult)
            # print(f'Add minus: {output(tempResult)}')
            # sort dividendElements
            dividendElements = Element.sortElement(dividendElements)

        divisorElementsPosition += 1

    return dividendElements
Beispiel #6
0
    def create_page(cls, doc):
        page = Page()
        page.name = doc['page']['name']

        if "url" in doc['page']:
            page.url = doc['page']['url']

        # if "route" in doc['page']:
        #     page.route = doc['page']['route']

        if "url_paths" in doc['page']:
            for item in doc['page']['url_paths']:
                name = item['name']
                path = item['path']

                if not name in page.url_paths:
                    page.url_paths[name] = path
                else:
                    log.warning("Duplicate url path name!", {
                        'page': page.name,
                        'path': name
                    })

        if "elements" in doc:
            for item in doc['elements']:
                if not "name" in item:
                    log.warning("Found unnamed element!", {
                        'page': doc['page']['name']
                    })

                if not "xpath" in item:
                    log.warning("XPath not specified!", {
                        'page': doc['page']['name'],
                        'element': item['name']
                    })

                element = Element(item['name'], item['xpath'])
                element.driver = page.driver

                if not element.name in page.elements:
                    page.elements[element.name] = element
                else:
                    log.warning("Duplicate element name!", {
                        'page': page.name,
                        'element': element.name
                    })

        # if "site_url" in doc:
        #     page.site_config = doc['site_url']
        #     page.site_config['default'] = page.url

        return page
Beispiel #7
0
    def getElement(self, elename):
        """Create an element instance from the connectivity information
        (the Element class holds a list of nodes)
        |elem| is the name (i.e. the number) of the element
        (This used to be ElementFactory)
        """
        # test whether the element already exists, shortcut if exists
        try:
            return self.elementCache[elename]
        except:
            pass
        conn = self.Conn[elename]
        nodes = conn[1]
        try:
            sh = self.shapeCache[conn[0]]
        except:
            sh = ShapeFunctions.shapeFunctions[conn[0]]()
            self.shapeCache[conn[0]] = sh

        # collect the nodal coordinates
        nodcoord = N.array([self.Coord[n] for n in nodes])

        # invoke an instance of the element
        e = Element.Element(nodes, sh, nodcoord, elename)
        self.elementCache[elename] = e
        return e
Beispiel #8
0
def makeElements(EI, F, w0, l, N):
    elts = []
    for i in range(N):
        elts.append(Element(EI, F, w0, l, N))
    print(elts)
    #K1 = elt.makeKbCblist()
    return elts
Beispiel #9
0
 def test_integrate_arbitrary(self):
     el = Element.Linear_1D(1.0, 1.5)
     I = el.integrate(lambda x: 2)
     self.assertAlmostEqual(I, 1.0)
     I = el.integrate(lambda x: x**3)
     self.assertAlmostEqual(I, ((1.5)**4 - 1) / 4.0)
     return
Beispiel #10
0
 def test_integrate_master(self):
     el = Element.Linear_1D(-1, 1)
     I = el.integrate(lambda x: 1)
     self.assertAlmostEqual(I, 2.0)
     I = el.integrate(lambda x: x**2)
     self.assertAlmostEqual(I, 2.0 / 3.0)
     return
Beispiel #11
0
def parse_isrc(line, mycircuit):
    line_elements = line.split()
    dc_value = None
    ac_value = None
    n1 = mycircuit.add_node(line_elements[1])
    n2 = mycircuit.add_node(line_elements[2])

    pattern = re.match(
        r'(^I.) (.*) (.*) ([AD]C)?(=)?( ?)([0-9.]*[FPNUMKGT]?)A?(,?)( ?)([0-9.]*$)?',
        line, re.I)
    #     1     2 n1 3 n2 4       5   6   7                     8   9   10

    if pattern.group(4):
        if pattern.group(4).lower() == 'dc':
            dc_value = unit_transform(pattern.group(7))
        elif pattern.group(4).lower() == 'ac':
            ac_value = unit_transform(pattern.group(7))
    else:
        dc_value = unit_transform(pattern.group(7))

    element = Element.ISrc(name=line_elements[0],
                           n1=n1,
                           n2=n2,
                           dc_value=dc_value,
                           ac_value=ac_value)

    return [element]
Beispiel #12
0
def parse_v_pulse_src(line, mycircuit):

    pattern = re.match(
        r'(^V.*) (.*) (.*) PULSE (.*) (.*) (.*) (.*) (.*) (.*) (.*)', line,
        re.I)
    #    1      2    3          4    5    6      7      8      9      10

    name = pattern.group(1)
    n1 = mycircuit.add_node(pattern.group(2))
    n2 = mycircuit.add_node(pattern.group(3))
    voltage_low = unit_transform(pattern.group(4).lower().replace('v', ''))
    voltage_high = unit_transform(pattern.group(5).lower().replace('v', ''))
    delay = unit_transform(pattern.group(6).lower().replace('s', ''))
    rise = unit_transform(pattern.group(7).lower().replace('s', ''))
    fall = unit_transform(pattern.group(8).lower().replace('s', ''))
    width = unit_transform(pattern.group(9).lower().replace('s', ''))
    period = unit_transform(pattern.group(10).lower().replace('s', ''))

    element = Element.VPulseSrc(name=name,
                                n1=n1,
                                n2=n2,
                                voltage_low=voltage_low,
                                voltage_high=voltage_high,
                                delay=delay,
                                rise=rise,
                                fall=fall,
                                width=width,
                                period=period)

    return [element]
Beispiel #13
0
def parse_vsrc(line, mycircuit):
    line_elements = line.split()
    dc_value = None
    abs_ac = None
    arg_ac = None

    pattern = re.match(r'(^V.*) (.*) (.*) (.*)?', line, re.I)

    n1 = mycircuit.add_node(line_elements[1])
    n2 = mycircuit.add_node(line_elements[2])

    ac_pattern = re.search(r'([AD]C) ([0-9.]*[FPNUMKGT]?)V? ([0-9.]*)?',
                           line.replace('=', ' ').replace(',', ' '), re.I)

    if ac_pattern:
        if ac_pattern.group(1).lower() == 'ac':
            abs_ac = unit_transform(ac_pattern.group(2))
            arg_ac = unit_transform(ac_pattern.group(3))
        else:
            dc_value = pattern.group(4)

    element = Element.VSrc(name=line_elements[0],
                           n1=n1,
                           n2=n2,
                           dc_value=dc_value,
                           abs_ac=abs_ac,
                           arg_ac=arg_ac)

    return [element]
Beispiel #14
0
    def _parse_opening_tag_match(self, opening_tag_match, text):
        tag_closed_count = 1
        end_pos = opening_tag_match.end()
        tag_dict = opening_tag_match.groupdict()
        tag, attributes = tag_dict["tag"], tag_dict["attributes"]

        opening_tag_p = Regex.OPENING_TAG_P_FORMAT.format(tag=tag)
        closing_tag_p = Regex.CLOSING_TAG_P_FORMAT.format(tag=tag)

        while tag_closed_count != 0:
            opening_tag = re.compile(opening_tag_p).search(text, end_pos)
            closing_tag = re.compile(closing_tag_p).search(text, end_pos)

            nearest_match_tag = Regex.nearest_match(opening_tag, closing_tag)
            if nearest_match_tag is None:
                raise Exceptions.NoMatchingClosingTagError(
                    tag_dict["opening_tag"])
            elif nearest_match_tag == opening_tag:
                tag_closed_count += 1
            elif nearest_match_tag == closing_tag:
                tag_closed_count -= 1

            end_pos = nearest_match_tag.end()

        content = self._create_content(
            text[opening_tag_match.end():closing_tag.start()])
        element = Element.Element(tag, content, attributes)
        return element, end_pos
def move_choice(c_num):
	if c_num == 1:
		rock = Element.Rock('Rock') 	
		return rock
	elif c_num == 2:
		paper = Element.Paper('Paper')
		return paper
	elif c_num == 3:
		scissors = Element.Scissors('Scissors')
		return scissors
	elif c_num == 4:
		lizard = Element.Lizard('Lizard')
		return lizard
	elif c_num == 5:
		spock = Element.Spock('Spock')
		return spock
Beispiel #16
0
    def AddToRig(self):
        sel = XSI.Selection
        self.list = 'GeometryList'
        self.chooser = 'GeometryChooser'

        sList = self.builder.Parameters(self.list).Value

        if sel.Count > 0:
            for s in sel:
                if s.Type == "polymsh" or s.Type == "crvlist":
                    sList = self.UpdateGeometryList(s)
                else:
                    XSI.LogMessage(
                        "[RigBuilder] Accepts only POLYMESH or CRVLIST ---> " +
                        str(s) + " : Skipped!!")

        else:
            objs = Utils.PickMultiElement(constants.siPolyMeshFilter,
                                          'Pick Geometries To Deform')
            for o in objs:
                sList = self.UpdateGeometryList(o)

        ui_items = Element.BuildListFromString(sList)
        layout = self.builder.PPGLayout
        cnt = layout.Count
        for i in range(cnt):
            if layout.Item(i).Name == self.chooser:
                layout.Item(i).UIItems = ui_items
Beispiel #17
0
    def init(self):
        print("initialising basic game")

        #create enemy1spawner at middle leftmost block
        elementSpawner1Pos = (0, int(self.board.y / 2))
        elementspawner1 = Element.Element(ElementState.element1Spawner,
                                          elementSpawner1Pos, Direction.right)
        #
        #		##create enemy2spawner at middle rightmost block
        elementSpawner2Pos = (int(self.board.x - 1), int(self.board.y / 2))
        elementspawner2 = Element.Element(ElementState.element2Spawner,
                                          elementSpawner2Pos, Direction.left)

        #print(id(elementspawner1))
        self.board[elementSpawner1Pos] += elementspawner1
        self.board[elementSpawner2Pos] += elementspawner2
Beispiel #18
0
def writeHeader(identifier, number, text):
    if number < 1 or number > 6:
        raise ValueError('Invalid header number: ' + str(number) + '\n')

    f.write('\t<h' + str(number) + ' id="' + identifier + '">' + text + '</h' +
            str(number) + '>\n')
    elements.append(Element(identifier, 'heading' + str(number), text))
    return
Beispiel #19
0
def writeHyperlink(identifier, link, text):
    if identifier is None:
        f.write('\t<a href="' + link + '";>' + text + '</a>\n')
    else:
        f.write('\t<a id="' + identifier + '" href="' + link + '";>' + text +
                '</a>\n')
    elements.append(Element(identifier, 'hyperlink', text))
    return
Beispiel #20
0
 def __init__(self,Z=42):
     self.element = Element(Z)
     self.path0 = '../data/XRayAttenuation/'
     self.fileName = str(Z)+'XRayAttenuation.txt'
     self.data = genfromtxt(self.Path0+self.fileName,skiprows=11)
     self.energy = self.data[:,0]*1e6
     self.mu = self.data[:,1] # cm^2/g
     self.muEnergy = self.data[:,2] # cm^2/g
     self.label= self.element.Symbol #'Z = '+ str(Z)
Beispiel #21
0
    def fixml_sell_eod(self, ticker, quantity,limit):
        """ Generates FIXML for a sell order"""

        fixml=Element("FIXML")
        fixml.set("xmlns",FIXML_NAMESPACE)
        order=SubElement(fixml,"Order")
        order.set("TmInForce","7") #Market on close
        order.set("Typ","2") #Limit
        order.set("Side","2") #Sell
        order.set("Px","%.2f"%limit) #Limit price
        order.set("Acct",TRADEKING_ACCOUNT_NUMBER)
        instrmt=SubElement(order,"Instrmt")
        instrmt.set("SecTyp","CS") #Common stock
        instrmt.set("Sym",ticker)
        ord_qty=SubElement(order,"OrdQty")
        ord_qty.set("Qty",str(quantity))

        return self.xml_tostring(fixml)
Beispiel #22
0
 def add_isrc(self, name, n1, n2, dc_value, ac_value=0):
     n1 = self.add_node(n1)
     n2 = self.add_node(n2)
     element = Element.ISrc(name=name,
                            n1=n1,
                            n2=n2,
                            dc_value=dc_value,
                            ac_value=ac_value)
     self.append(element)
Beispiel #23
0
 def add_capacitor(self, name, n1, n2, value, ic=None):
     n1 = self.add_node(n1)
     n2 = self.add_node(n2)
     element = Element.Capacitor(name=name,
                                 n1=n1,
                                 n2=n2,
                                 value=value,
                                 ic=ic)
     self.append(element)
Beispiel #24
0
 def add_ccvs(self, name, n1, n2, source_name, value):
     n1 = self.add_node(n1)
     n2 = self.add_node(n2)
     element = Element.HSrc(name=name,
                            n1=n1,
                            n2=n2,
                            source_name=source_name,
                            value=value)
     self.append(element)
Beispiel #25
0
 def add_vsrc(self, name, n1, n2, dc_value, abs_ac=0, arg_ac=0):
     n1 = self.add_node(n1)
     n2 = self.add_node(n2)
     element = Element.VSrc(name=name,
                            n1=n1,
                            n2=n2,
                            dc_value=dc_value,
                            abs_ac=abs_ac,
                            arg_ac=arg_ac)
     self.append(element)
Beispiel #26
0
 def addToHeap(self, key, item):
     if APQ.length(self) == 0: # if the length of the heap is zero
         index = 0 # initialise i to be zero
     else: # otherwise if the length is greater than 0
         index = APQ.length(self) # i is initialised to length of heap
     element = Element(key, item, index) # create the element
     self._binaryheap.append(element) # add this to the binary heap - append as it is a list
     if APQ.length(self) > 1: # if the size of the binary heap is greater than 1, run the bubble up heap sort
         self.bubbleUpHeap(element)
     return element
Beispiel #27
0
 def test_T_arbitrary(self):
     el = Element.Linear_1D(0.5, 0.7)
     self.assertAlmostEqual(el.T(0.5), -1)
     self.assertAlmostEqual(el.T(0.6), 0)
     self.assertAlmostEqual(el.T(0.7), 1)
     self.assertAlmostEqual(el.w[0], -0.5)
     self.assertAlmostEqual(el.w[1], 0.5)
     self.assertAlmostEqual(el.xipts[0], -1)
     self.assertAlmostEqual(el.xipts[1], 1)
     return
Beispiel #28
0
def writeImage(identifier, source, height, width, link):
    if link is None:
        f.write('\t<img id="' + identifier + '" src="' + source +
                '" height = "' + height + '" width = "' + width + '"/>\n')
        elements.append(Element(identifier, 'image', None))
    else:
        writeHyperlink(
            identifier, link, '<img id="' + identifier + '" src="' + source +
            '" height = "' + height + '" width = "' + width + '"/>')
    return
Beispiel #29
0
def insertModule():
    if len(connectEntry.get()) > 0:
        connectValue = connectEntry.get()
        ser = serial.Serial(connectValue, 19200)
        time.sleep(2)
        unit = ControlUnit(ser, protocol)
        s = 1
        number = str(len(elementen) + 1)
        name = '#%s' % number
        element = Element(rootframe, name, unit, s)
        elementen.append(element)
Beispiel #30
0
 def test_T_master(self):
     el = Element.Linear_1D(-1, 1)
     self.assertAlmostEqual(el.T(-1), -1)
     self.assertAlmostEqual(el.T(-0.5), -0.5)
     self.assertAlmostEqual(el.T(0), 0)
     self.assertAlmostEqual(el.T(0.5), 0.5)
     self.assertAlmostEqual(el.T(1), 1)
     self.assertAlmostEqual(el.w[0], -0.5)
     self.assertAlmostEqual(el.w[1], 0.5)
     self.assertAlmostEqual(el.xipts[0], -1)
     self.assertAlmostEqual(el.xipts[1], 1)
     return
Beispiel #31
0
 def add_vccs(self, name, n1, n2, sn1, sn2, value):
     n1 = self.add_node(n1)
     n2 = self.add_node(n2)
     sn1 = self.add_node(sn1)
     sn2 = self.add_node(sn2)
     element = Element.GSrc(name=name,
                            n1=n1,
                            n2=n2,
                            sn1=sn1,
                            sn2=sn2,
                            value=value)
     self.append(element)
Beispiel #32
0
def kenburns(config, params, ifile, frames, progress):
    src_img = SlideShow.Img.read(ifile, SlideShow.Img.YUV)
    dest_img = SlideShow.Img.Image(config["dvd_width"], config["dvd_height"], SlideShow.Img.RGB)

    dest_height = config["dvd_height"]
    dest_width = dest_height * config["aspect_ratio_float"]

    src_ratio = src_img.width / float(src_img.height)
    if src_ratio > config["aspect_ratio_float"]:
        src_width = src_img.width
        src_height = src_width / config["aspect_ratio_float"]
    else:
        src_height = src_img.height
        src_width = src_height * config["aspect_ratio_float"]

    field = map(str.strip, params.split(";"))
    img0 = parse_params(field[0], field[1], config, src_img, src_width, src_height, dest_width, dest_height)
    img1 = parse_params(field[2], field[3], config, src_img, src_width, src_height, dest_width, dest_height)

    ## adjust step size: ##############################
    if config["low_quality"]:
        stepsize = 3
    else:
        stepsize = 1

    imgs = []
    progress.task_start(frames, "Ken Burns")
    for frame in range(0, frames, stepsize):
        progress.task_update(frame)
        a = accelerate(frame, frames, 15)
        # print frame, a
        xy = [(xy1 - xy0) / float(frames - 1) * a + xy0 for xy1, xy0 in zip(img1, img0)]
        src_img.scale_and_crop(xy[0], xy[1], xy[2], xy[3], dest_img)
        ofile = config["workdir"] + "/" + os.path.basename(ifile) + "_" + Element.get_unique() + ".ppm"
        dest_img.write(ofile)
        imgs.append((ofile, stepsize))

    progress.task_done()
    return imgs
Beispiel #33
0
def parse_annotate_params(self, element, params, duration=0):
    # valid params:
    #  text= ;
    #  halign=<left|center|right>
    #  valign=<top|bottom|baseline>
    #  size=X%;                     (as percent of total image)
    #  color=color;                 ('black', 'white', 'orange','0x556633')
    #  font=font;                   
    #  fontstyle=fontstle (space separated list of varient, weight, stretch, or gravity;                   
    #  vertical=<0|1>               (display text vertically)
    #  justification=<0-left|1-right|2-center>

    props = dict(text = "Fill me in", 
                 shaded_background=False,
                 duration=0, # 0 means the duration of the entire slide
                 start=0,    # start time to turn on the annotation
                 )

    # first initialize props based on config dictionary (global defaults)
    for key in [ "annotate_size", "annotate_font", "annotate_color", "annotate_halign", "annotate_valign", "annotate_vertical", "annotate_justification", "annotate_fontstyle" ]:
        props[key.replace("annotate_","")] = self.config[key]

    params = map(str.strip, params.strip().split(";"))
    for param in params:
        if param:
            key,val = param.split("=",1)
            props[key] = val

    if props.has_key("size"):
        if props["size"].endswith("%"):
            props["size"] = round(self.config["height"] * eval(props["size"].replace("%","")) / 10.)/10.
        else:
            props["size"] = eval(props["size"])


    font = "%s %s %gpx" % (props["font"], props["fontstyle"], props["size"],)
    props["text"] = props["text"].replace("\\n", "\n")

    def set_prop(element, prop, value):
        try:
            element.set_property(prop, value)
        except TypeError:
            log.warn("Annotation: Cannot set property %s to %s because gstreamer-plugins-base is too old. Update to enable this feature." % (prop, value))

    set_prop(element, "text",              props["text"])
    set_prop(element, "shaded-background", int(props["shaded_background"]))
    set_prop(element, "halignment", props["halign"])
    set_prop(element, "valignment", props["valign"])
    set_prop(element, "color",      Element.get_color(props["color"]))
    try:
        ctlr = gst.Controller(element, "silent", "xpos", "ypos", "color")
    except RuntimeError:
        log.warn("Annotation: Your gstreamer-plugins-base library is too old to support dynamic annotation such as xpos2, ypos2, start, duration. Update your gstreamer library to enable this feature.")
        ctlr = None

        
    if props.has_key("xpos") or props.has_key("ypos"):
        supported_props = [x.name for x in gobject.list_properties(element)]
        if "xpos" not in supported_props:
            log.warn("Annotation: you selected xpos and ypos in your annimation, but your version of gstreamer-plugins-base does not support it.")
        else:
            set_prop(element, "xpos", float(props.get("xpos", 0.5)))
            set_prop(element, "ypos", float(props.get("ypos", 0.5)))
            set_prop(element, "halignment", "position")
            set_prop(element, "valignment", "position")
            
            def create_pos_controller(cont, prop, start, stop, dur):
                if not(cont): return
                cont.set_interpolation_mode(prop, gst.INTERPOLATE_LINEAR)
                cont.set(prop, 0,   start)
                cont.set(prop, dur, stop)

            if props.has_key("xpos2"):
                create_pos_controller(ctlr, "xpos", element.props.xpos, float(props["xpos2"]), duration)
            if props.has_key("ypos2"):
                create_pos_controller(ctlr, "ypos", element.props.ypos, float(props["ypos2"]), duration)

    set_prop(element, "vertical-render", int(props["vertical"]))
    set_prop(element, "font-desc",       font)
    set_prop(element, "auto-resize",     False)
    set_prop(element, "line-alignment",  props["justification"])

    if (props["duration"] or props["start"]) and ctlr:
        dur   = int(round(float(props["duration"]) * gst.SECOND))
        start = int(round(float(props["start"]) * gst.SECOND))
    
        ctlr.set_interpolation_mode("silent", gst.INTERPOLATE_NONE)
        
        if start > 0:
            ctlr.set("silent", 0,     1)
            ctlr.set("silent", start, 0)
        else:
            ctlr.set("silent", 0,     0)
        if dur > 0:
            ctlr.set("silent", start+dur,   1)

    # save off a reference to the controller so that it does not pop
    # off the the stack and dissapear.
    self.controllers.append(ctlr)
Beispiel #34
0
def init():
  Ur.init()
  AbInitio.init()
  Particle.init()
  AttributeGroup.init()
  GroupInit()
  FSM.init()
  lfInit()
  Element.init()
  Component.init()
  List.init()
  elts.Init.init()
  validate.veInit()
  # Could this be computed from the reflectedName property of the types -- does
  # Python give access to the class hierarchy top-down?
  psviIndMap.update({'schema':DumpedSchema,
            'atomic':(SimpleType,AbInitio.AbInitio),
            'list':(SimpleType,List.List),
            'union':(SimpleType,Union),
            'complexTypeDefinition':ComplexType,
            'attributeUse':AttributeUse,
            'attributeDeclaration':Attribute,
            'particle':Particle.Particle,
            'modelGroupDefinition':(Group,ModelGroup),
            'modelGroup':Group,
            'elementDeclaration':Element.Element,
            'wildcard':Wildcard,
            'annotation':None,
            'enumeration':Enumeration,
            'whiteSpace':Whitespace,
            'pattern':Pattern,
            'maxInclusive':MaxInclusive,
            'minInclusive':MinInclusive,
            'fractionDigits':FractionDigits,
            'precision':Precision,
            'lexicalMappings':LexicalMappings,
            'attributeGroupDefinition':AttributeGroup.AttributeGroup,
            'key':Key,
            'keyref':Keyref,
            'unique':Unique,
            'xpath':xpathTemp})
  auxComponentMap.update({'namespaceSchemaInformation':namespaceSchemaInformation,
                          'valueConstraint':valueConstraint,
                          'namespaceConstraint':namespaceConstraint,
                          'contentType':contentType,
                          'schemaDocument':schemaDocument})
  _Nmtoken=("1.0",u'[-.:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u0131\u0134-\u013e\u0141-\u0148\u014a-\u017e\u0180-\u01c3\u01cd-\u01f0\u01f4-\u01f5\u01fa-\u0217\u0250-\u02a8\u02bb-\u02c1\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03d6\u03da\u03dc\u03de\u03e0\u03e2-\u03f3\u0401-\u040c\u040e-\u044f\u0451-\u045c\u045e-\u0481\u0490-\u04c4\u04c7-\u04c8\u04cb-\u04cc\u04d0-\u04eb\u04ee-\u04f5\u04f8-\u04f9\u0531-\u0556\u0559\u0561-\u0586\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0641-\u064a\u0671-\u06b7\u06ba-\u06be\u06c0-\u06ce\u06d0-\u06d3\u06d5\u06e5-\u06e6\u0905-\u0939\u093d\u0958-\u0961\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8b\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ae0\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b36-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb5\u0bb7-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60-\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cde\u0ce0-\u0ce1\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60-\u0d61\u0e01-\u0e2e\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eae\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0f40-\u0f47\u0f49-\u0f69\u10a0-\u10c5\u10d0-\u10f6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110b-\u110c\u110e-\u1112\u113c\u113e\u1140\u114c\u114e\u1150\u1154-\u1155\u1159\u115f-\u1161\u1163\u1165\u1167\u1169\u116d-\u116e\u1172-\u1173\u1175\u119e\u11a8\u11ab\u11ae-\u11af\u11b7-\u11b8\u11ba\u11bc-\u11c2\u11eb\u11f0\u11f9\u1e00-\u1e9b\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2126\u212a-\u212b\u212e\u2180-\u2182\u3041-\u3094\u30a1-\u30fa\u3105-\u312c\uac00-\ud7a3\u4e00-\u9fa5\u3007\u3021-\u30290-9\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be7-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05a1\u05a3-\u05b9\u05bb-\u05bd\u05bf\u05c1-\u05c2\u05c4\u064b-\u0652\u0670\u06d6-\u06dc\u06dd-\u06df\u06e0-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0901-\u0903\u093c\u093e-\u094c\u094d\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09bc\u09be\u09bf\u09c0-\u09c4\u09c7-\u09c8\u09cb-\u09cd\u09d7\u09e2-\u09e3\u0a02\u0a3c\u0a3e\u0a3f\u0a40-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a70-\u0a71\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0b01-\u0b03\u0b3c\u0b3e-\u0b43\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b82-\u0b83\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c82-\u0c83\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d43\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86-\u0f8b\u0f90-\u0f95\u0f97\u0f99-\u0fad\u0fb1-\u0fb7\u0fb9\u20d0-\u20dc\u20e1\u302a-\u302f\u3099\u309a\xb7\u02d0\u02d1\u0387\u0640\u0e46\u0ec6\u3005\u3031-\u3035\u309d-\u309e\u30fc-\u30fe]+')
  _Nmtoken11=("1.1",u'[-.0-9:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0300-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+')
  _Name=("1.0",u'[_:A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u0131\u0134-\u013e\u0141-\u0148\u014a-\u017e\u0180-\u01c3\u01cd-\u01f0\u01f4-\u01f5\u01fa-\u0217\u0250-\u02a8\u02bb-\u02c1\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03d6\u03da\u03dc\u03de\u03e0\u03e2-\u03f3\u0401-\u040c\u040e-\u044f\u0451-\u045c\u045e-\u0481\u0490-\u04c4\u04c7-\u04c8\u04cb-\u04cc\u04d0-\u04eb\u04ee-\u04f5\u04f8-\u04f9\u0531-\u0556\u0559\u0561-\u0586\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0641-\u064a\u0671-\u06b7\u06ba-\u06be\u06c0-\u06ce\u06d0-\u06d3\u06d5\u06e5-\u06e6\u0905-\u0939\u093d\u0958-\u0961\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8b\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ae0\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b36-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb5\u0bb7-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60-\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cde\u0ce0-\u0ce1\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60-\u0d61\u0e01-\u0e2e\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eae\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0f40-\u0f47\u0f49-\u0f69\u10a0-\u10c5\u10d0-\u10f6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110b-\u110c\u110e-\u1112\u113c\u113e\u1140\u114c\u114e\u1150\u1154-\u1155\u1159\u115f-\u1161\u1163\u1165\u1167\u1169\u116d-\u116e\u1172-\u1173\u1175\u119e\u11a8\u11ab\u11ae-\u11af\u11b7-\u11b8\u11ba\u11bc-\u11c2\u11eb\u11f0\u11f9\u1e00-\u1e9b\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2126\u212a-\u212b\u212e\u2180-\u2182\u3041-\u3094\u30a1-\u30fa\u3105-\u312c\uac00-\ud7a3\u4e00-\u9fa5\u3007\u3021-\u3029][-._:A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u0131\u0134-\u013e\u0141-\u0148\u014a-\u017e\u0180-\u01c3\u01cd-\u01f0\u01f4-\u01f5\u01fa-\u0217\u0250-\u02a8\u02bb-\u02c1\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03ce\u03d0-\u03d6\u03da\u03dc\u03de\u03e0\u03e2-\u03f3\u0401-\u040c\u040e-\u044f\u0451-\u045c\u045e-\u0481\u0490-\u04c4\u04c7-\u04c8\u04cb-\u04cc\u04d0-\u04eb\u04ee-\u04f5\u04f8-\u04f9\u0531-\u0556\u0559\u0561-\u0586\u05d0-\u05ea\u05f0-\u05f2\u0621-\u063a\u0641-\u064a\u0671-\u06b7\u06ba-\u06be\u06c0-\u06ce\u06d0-\u06d3\u06d5\u06e5-\u06e6\u0905-\u0939\u093d\u0958-\u0961\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8b\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ae0\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b36-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb5\u0bb7-\u0bb9\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c60-\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cde\u0ce0-\u0ce1\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d28\u0d2a-\u0d39\u0d60-\u0d61\u0e01-\u0e2e\u0e30\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0e82\u0e84\u0e87-\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa-\u0eab\u0ead-\u0eae\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0f40-\u0f47\u0f49-\u0f69\u10a0-\u10c5\u10d0-\u10f6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110b-\u110c\u110e-\u1112\u113c\u113e\u1140\u114c\u114e\u1150\u1154-\u1155\u1159\u115f-\u1161\u1163\u1165\u1167\u1169\u116d-\u116e\u1172-\u1173\u1175\u119e\u11a8\u11ab\u11ae-\u11af\u11b7-\u11b8\u11ba\u11bc-\u11c2\u11eb\u11f0\u11f9\u1e00-\u1e9b\u1ea0-\u1ef9\u1f00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2126\u212a-\u212b\u212e\u2180-\u2182\u3041-\u3094\u30a1-\u30fa\u3105-\u312c\uac00-\ud7a3\u4e00-\u9fa5\u3007\u3021-\u30290-9\u0660-\u0669\u06f0-\u06f9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be7-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05a1\u05a3-\u05b9\u05bb-\u05bd\u05bf\u05c1-\u05c2\u05c4\u064b-\u0652\u0670\u06d6-\u06dc\u06dd-\u06df\u06e0-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0901-\u0903\u093c\u093e-\u094c\u094d\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09bc\u09be\u09bf\u09c0-\u09c4\u09c7-\u09c8\u09cb-\u09cd\u09d7\u09e2-\u09e3\u0a02\u0a3c\u0a3e\u0a3f\u0a40-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a70-\u0a71\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0b01-\u0b03\u0b3c\u0b3e-\u0b43\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b82-\u0b83\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c82-\u0c83\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0d02-\u0d03\u0d3e-\u0d43\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86-\u0f8b\u0f90-\u0f95\u0f97\u0f99-\u0fad\u0fb1-\u0fb7\u0fb9\u20d0-\u20dc\u20e1\u302a-\u302f\u3099\u309a\xb7\u02d0\u02d1\u0387\u0640\u0e46\u0ec6\u3005\u3031-\u3035\u309d-\u309e\u30fc-\u30fe]*')
  _Name11=("1.1",u'[:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd][-.0-9:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0300-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]*')
  _language="([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]+)(-[a-zA-Z]{1,8})*"
  _NCName="[^:]*"
  builtinPats.extend([_Name,_Name11,_Nmtoken,_Nmtoken11,_language,_NCName])
  builtinTypeNames.extend([
    ('normalizedString','string',((Whitespace,"replace"),),0),
    ('token','normalizedString',((Whitespace,"collapse"),),0),
    ('language','token',
    ((Pattern,[_language]),),0),
    ('NMTOKEN','token',((Pattern,[_Nmtoken,_Nmtoken11]),),0),
    ('Name','token',((Pattern,[_Name,_Name11]),),0),
    ('NCName','Name',((Pattern,[_NCName]),),0),
    ('ID','NCName',(),1), ('IDREF','NCName',(),2), ('ENTITY','NCName',(),0),
    ('aPDecimal','pDecimal',((LexicalMappings,['nodecimal', 'decimal']),
                             (Precision,0)),0),
    ('integer','decimal',((FractionDigits,0),),0),
    ('nonPositiveInteger','integer',((MaxInclusive,0),),0),
    ('negativeInteger','nonPositiveInteger', ((MaxInclusive,-1),),0),
    ('long','integer',((MinInclusive,-9223372036854775808L),
    (MaxInclusive,9223372036854775807L)),0),
    ('int','long',((MinInclusive,-2147483648L),(MaxInclusive,2147483647)),0),
    ('short','int',((MinInclusive,-32768),(MaxInclusive,32767)),0),
    ('byte','short',((MinInclusive,-128),(MaxInclusive,127)),0),
    ('nonNegativeInteger','integer',((MinInclusive,0),),0),
    ('unsignedLong','nonNegativeInteger',((MaxInclusive,18446744073709551615L),),0),
    ('unsignedInt','unsignedLong',((MaxInclusive,4294967295L),),0),
    ('unsignedShort','unsignedInt',((MaxInclusive,65535),),0),
    ('unsignedByte','unsignedShort',((MaxInclusive,255),),0),
    ('positiveInteger','nonNegativeInteger',((MinInclusive,1),),0)])

  XSV.NCNamePat = re.compile("(%s)$"%_Name[1]);
  XSV.NCNamePat11 = re.compile("(%s)$"%_Name11[1]);
Beispiel #35
0
def cleanup(config, ifile):
    import Element

    ofile = config["workdir"] + "/" + os.path.basename(ifile) + "*.ppm"
    Element.cmd("rm -f " + ofile)
Beispiel #36
0
   def __init__(self, parent):
      GGrule.__init__(self,1)                   		# this is the first rule to be executed
      # create the pattern...
      self.LHS = ASG_LinkedListMM()             		# create LHS

      self.LHSnode1 = Top(parent)                  		# List head
      self.LHSnode1.graphObject_ = graph_Top(10,10,self.LHSnode1) # graphical representation...
      self.LHSnode1.setGGLabel(1)				# Set Graph Grammar Label...

      self.LHSnode2 = LLink(parent)                		# Link to 1st. element
      self.LHSnode2.graphObject_ = graph_LLink(30,60,self.LHSnode2) # graphical representation...
      self.LHSnode2.setGGLabel(2)				# Set Graph Grammar Label...

      self.LHSnode3 = Element(parent)              		# Any value
      self.LHSnode3.graphObject_ = graph_Element(10,150,self.LHSnode3) # graphical representation...
      self.LHSnode3.Label.setNone()
      self.LHSnode3.setGGLabel(3)				# Set Graph Grammar Label...

      self.LHSnode1.out_connections_.append(self.LHSnode2)    	# n1 -> n2
      self.LHSnode2.in_connections_.append(self.LHSnode1)

      self.LHSnode2.out_connections_.append(self.LHSnode3)    	# n2 -> n3
      self.LHSnode3.in_connections_.append(self.LHSnode2)

      self.LHS.addNode(self.LHSnode1)
      self.LHS.addNode(self.LHSnode2)
      self.LHS.addNode(self.LHSnode3)

      # create RHS...

      self.RHS = ASG_LinkedListMM()				# Also a Linked List...

      self.RHSnode1 = Top(parent)				# List head
      self.RHSnode1.graphObject_ = graph_Top(10,10, self.RHSnode1) # graphical representation...
      self.RHSnode1.setGGLabel(1)				# Set Graph Grammar Label...

      self.RHSnode2 = LLink(parent)				# Link to inserted element
      self.RHSnode2.graphObject_ = graph_LLink(30,60, self.RHSnode2) # graphical representation...
      self.RHSnode2.setGGLabel(2)				# Set Graph Grammar Label...

      self.RHSnode3 = Element(parent)				# NEW ELEMENT
      self.RHSnode3.Label.setValue('NEW ELEMENT')
      self.RHSnode3.graphObject_ = graph_Element(10,150, self.RHSnode3) # graphical representation...
      self.RHSnode3.setGGLabel(4)				# Set Graph Grammar Label (NEW LABEL)

      self.RHSnode4 = LLink(parent)				# Link to inserted element
      self.RHSnode4.graphObject_ = graph_LLink(30,220,self.RHSnode4) # graphical representation...
      self.RHSnode4.setGGLabel(5)				# Set Graph Grammar Label...

      self.RHSnode5 = Element(parent)              		# Any value
      self.RHSnode5.Label.setNone()
      self.RHSnode5.graphObject_ = graph_Element(10,280, self.RHSnode5) # graphical representation...
      self.RHSnode5.setGGLabel(3)				# Set Graph Grammar Label...

      self.RHSnode1.out_connections_.append(self.RHSnode2)    	# n1 -> n2
      self.RHSnode2.in_connections_.append(self.RHSnode1)

      self.RHSnode2.out_connections_.append(self.RHSnode3)    	# n2 -> n3
      self.RHSnode3.in_connections_.append(self.RHSnode2)

      self.RHSnode3.out_connections_.append(self.RHSnode4)    	# n3 -> n4
      self.RHSnode4.in_connections_.append(self.RHSnode3)

      self.RHSnode4.out_connections_.append(self.RHSnode5)    	# n4 -> n5
      self.RHSnode5.in_connections_.append(self.RHSnode4)

      self.RHS.addNode(self.RHSnode1)
      self.RHS.addNode(self.RHSnode2)
      self.RHS.addNode(self.RHSnode3)
      self.RHS.addNode(self.RHSnode4)
      self.RHS.addNode(self.RHSnode5)