AssertionErrors

438 views
Skip to first unread message

BT

unread,
Sep 3, 2012, 3:23:47 PM9/3/12
to kivy-...@googlegroups.com
Hi all,

I often get AssertionErrors (assert(rule not in self.rulectx) in _apply_rule in lang.py) that interfere and I don't want why.
I have this problem in 1.4.0, but had the same experience in 1.3.0.

There is a widget called Vessel:
vessel.kv:
#:kivy 1.0

<Vessel>:
    canvas:
        Rectangle:
            source: [an image]
            pos: self.pos
            size: self.size

vessel.py:
from kivy.properties import StringProperty, NumericProperty, BooleanProperty, ObjectProperty
from kivy.lang import Builder

from kivy.uix.widget import Widget

Builder.load_file('widgets/vessel.kv')


class Vessel(Widget):
    maneuverindicator = NumericProperty(0, allownone=True)
    ....
    raimflag = BooleanProperty(False, allownone=True)

When the code breaks on assert(rule not in self.rulectx), then
rule is <ParserRule name='<Vessel>'>
and self.rulectx is {<ParserRule name='<Vessel>'>: {'hdl': [], 'set': [], 'ids': {'root': <widgets.vessel.Vessel object at 0x116900ba8>}}}

Is there anyone that knows what could be problem here? What could I verify to find more about this issue?

Thanks in advance,

Benny

B. Jack

unread,
Sep 4, 2012, 1:13:42 AM9/4/12
to Kivy Users
You might need to add:

from kivy.factory import Factory
Factory.register('Vessel',cls=Vessel)


Date: Mon, 3 Sep 2012 12:23:47 -0700
From: benny...@skynet.be
To: kivy-...@googlegroups.com
Subject: [kivy-users] AssertionErrors
--
 
 
 

BT

unread,
Sep 4, 2012, 6:33:07 PM9/4/12
to kivy-...@googlegroups.com
I was creating widgets on a background thread, which I added to a widget on the UI thread.
That was a bad idea.
I have changed my implementation and problems were solved.
Obviously ...
Reply all
Reply to author
Forward
0 new messages