Beispiel #1
0
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from likefile import LikeFile, schedulerThread
from Axon.Component import component
from Axon.Ipc import producerFinished, shutdownMicroprocess
import unittest, random, Axon, threading, time

scheduler = schedulerThread(slowmo=0.001)
scheduler.start()
randlist = [random.random() for x in xrange(0, 10)]

class DyingShunt(component):
    """A component which passes all data through itself, and terminates on receipt of 
    shutdownMicroprocess() or producerFinished()"""
    Inboxes = { "inbox"   : "Input data",
                "control" : "Control data",
                "extrain"   : "An additional nonstandard inbox",
              }
    Outboxes = { "outbox" : "Input data is echoed here",
                 "signal" : "Control data is echoed here",
                 "extraout"  : "Extra data is echoed here",
               }
    def main(self):
Beispiel #2
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Proper likefile control of a sprite handler
#

from likefile import LikeFile, schedulerThread
import time, Axon, os, random, pygame, math
from Sprites.BasicSprite import BasicSprite
from Sprites.SpriteScheduler import SpriteScheduler
from Kamaelia.UI.Pygame.EventHandler import EventHandler
from Simplegame import cat_location, screensize, border, background, screen_surface, randomFromRangeExcludingZero

bg = schedulerThread(slowmo=0.01).start()

global spritescheduler


class MyGamesEvents(EventHandler):
    def __init__(self, cat_args, trace=1, ):
        self.trace = 0
        self.cat_args = cat_args
    def keydown(self, unicode, key, mod, where):
        if key == 113: # "Q"
            raise "QUIT"

class CatSprite(BasicSprite):
    def main(self):
        spritescheduler.allsprites.add(self)
Beispiel #3
0
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Proper likefile control of a sprite handler
#

from likefile import LikeFile, schedulerThread
import time, Axon, os, random, pygame, math
from Sprites.BasicSprite import BasicSprite
from Sprites.SpriteScheduler import SpriteScheduler
from Kamaelia.UI.Pygame.EventHandler import EventHandler
from Simplegame import cat_location, screensize, border, background, screen_surface, randomFromRangeExcludingZero
import Axon

bg = schedulerThread(slowmo=0.01).start()

global spritescheduler


class MyGamesEvents(EventHandler):
    def __init__(
        self,
        cat_args,
        trace=1,
    ):
        self.trace = 0
        self.cat_args = cat_args

    def keydown(self, unicode, key, mod, where):
        if key == 113:  # "Q"
Beispiel #4
0
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from likefile import LikeFile, schedulerThread
from Axon.Component import component
from Axon.Ipc import producerFinished, shutdownMicroprocess
import unittest, random, Axon, threading, time

scheduler = schedulerThread(slowmo=0.001)
scheduler.start()
randlist = [random.random() for x in xrange(0, 10)]


class DyingShunt(component):
    """A component which passes all data through itself, and terminates on receipt of 
    shutdownMicroprocess() or producerFinished()"""
    Inboxes = {
        "inbox": "Input data",
        "control": "Control data",
        "extrain": "An additional nonstandard inbox",
    }
    Outboxes = {
        "outbox": "Input data is echoed here",
        "signal": "Control data is echoed here",