Beispiel #1
0
def rotx():
	rotx=npython.new ('nipol','rotx')
	npython.sel ('rotx')
	rotx.connect('rx')
	rotx.addkey1f(0,0)
	rotx.addkey1f(5,360)
	npython.sel ('..')
	return ()
Beispiel #2
0
def rotz():
	rotz=npython.new ('nipol','rotz')
	npython.sel ('rotz')
	rotz.connect('rz')
	rotz.addkey1f(0,0)
	rotz.addkey1f(5,360)
	npython.sel ('..')
	return ()
Beispiel #3
0
def roty():
#	catch ('{','delete','roty','}','err')
#	catch ('{','delete','roty2','}','err')
	roty=npython.new ('nipol','roty')
	npython.sel ('roty')
	roty.connect('ry')
	roty.addkey1f(0,0)
	roty.addkey1f(3,360)
	npython.sel ('..')
	return ()
Beispiel #4
0
def roty2():
	catch ('{','delete','roty','}','err')
	catch ('{','delete','roty2','}','err')
	roty2=npython.new ('nipol','roty2')
	npython.sel ('roty2')
	roty2.connect('ry')
	roty2.addkey1f(0,360)
	roty2.addkey1f(3,0)
	npython.sel ('..')
	return ()
Beispiel #5
0
 def testSetCommand(self):
   # Returns an opaque 'Nebula Object'
   object = npython.new('n3dnode','four')
   # Select the object
   npython.sel('four')
   # Set a value on the object
   npython.set('txyz',0,30,0)
   # Clean up and delete object
   npython.sel('..')
   npython.delete('four')
Beispiel #6
0
  def testSameObjectReturn(self):
    root = npython.sel('/')
    ee = npython.new('nroot', '/ee')
    ee_same = npython.sel('/ee')
    ee_same2 = root['ee']

    assert ee is ee_same, "Returned diffrent objects. Must be same object"
    assert ee is ee_same2, "Returned diffrent objects. Must be same object"

    npython.sel('/')
    npython.delete('/ee')
Beispiel #7
0
 def testExceptionsInDictAccess(self):
   s = npython.sel('/sys')
   try:
       s['UnlikelyToExistObject']
   except KeyError:
   # all right
     pass
   else:
     assert 1 == 0, 'Key error not thrown'
   
   npython.sel('/')
Beispiel #8
0
def map_input():
    cwd = npython.psel()
    npython.sel("/sys/servers/input")
    npython.set("beginmap")
    npython.set("map", "keyb0:shift.pressed", "dolly")
    npython.set("map", "keyb0:ctrl.pressed", "orbit")
    npython.set("map", "mouse0:btn0.pressed", "pan")
    npython.set("map", "mouse0:btn1.pressed", "orbit")
    npython.set("map", "mouse0:btn2.pressed", "dolly")
    npython.set("map", "keyb0:space.down", "script:orig()")
    npython.set("map", "keyb0:j.down", "script:janaview()")
    npython.set("map", "keyb0:esc.down", "script:npython.set('/sys/servers/console.toggle')")
    npython.set("endmap")
    npython.sel(cwd)
Beispiel #9
0
  def testGetCwdObject(self):
    x = npython.new('nroot','/x')
    x3 = npython.sel('/x')
    x2 = npython.GetCwdObject()

    assert x is x2, "Error diff object returned, must be same"
    npython.delete('/x')
Beispiel #10
0
 def testFailedSelCommand(self):
   # Should throw an exception
   try:
     result = npython.sel('')
   except:
     # Exception thrown
     pass
   else:
     assert 1 == 0, 'No exception thrown'
Beispiel #11
0
    def loadScript(self, script, brightness):
        npython.sel('/')
        npython.delete('/usr/scene')
        npython.new('n3dnode', '/usr/scene')
        npython.set('/sys/servers/console.unwatch')
        npython.set('/sys/servers/time.starttime')
        npython.set('/sys/servers/shadow.setcastshadows', 0)
        
        if self.execNamespace.has_key('tl'):
            self.execNamespace['tl'].destroy()
            del self.execNamespace['tl']
        
        npython.set('/sys/servers/time.lockdeltat', 0.0)
        
        gfx = npython.sel('/sys/servers/gfx')
        apply(gfx.setclearcolor, ((brightness),) * 4)

        self.execNamespace['bg'] = brightness
        print 'Executing', script
        execfile(script, self.execNamespace)
        observerlib.orig()
Beispiel #12
0
  def testWekRefs(self):
    sysobj = npython.sel('/sys')
    try:
      ref = weakref.ref(sysobj)
    except:
      assert 1 == 0, "Can't create weakref"
    weakrefscount = weakref.getweakrefcount(sysobj)
    assert weakrefscount, "Something strange with weak refs"

    try:
      ref().getcmds()
    except:
      assert 1 == 0, "Can't access weakrefed object"
Beispiel #13
0
 def testEmptySelCommand(self):
   # Returns an opaque 'Nebula Object'
   result = npython.sel()
   pass
Beispiel #14
0
 def testDictLookup(self):
   root = npython.sel('/')
   testobj = root['sys']
   assert locals().has_key('testobj'), "Can't lookup object by [] syntax"
Beispiel #15
0
 def testLoopDictLookup(self):
   root = npython.sel('/')
   npython.new('nroot', '/ee')
   for obj in root:
     assert locals().has_key('obj'), "Can't lookup object by iterator"
   npython.delete('/ee')
Beispiel #16
0
def sc():
	npython.sel ('/usr/scene')
	return ()
Beispiel #17
0
def st():
	npython.sel ('/usr/scene/std')
	return ()
Beispiel #18
0
def l():
	npython.sel ('/')
	npython.sel ('usr')
	npython.sel ('scene')
	npython.sel ('dlight')
	return ()
Beispiel #19
0
def gfx():
	#connect ('localhost:gfxserv')
	npython.sel ('/')
	return ()
Beispiel #20
0
 def testUpSelCommand(self):
   # Returns an opaque 'Nebula Object'
   result = npython.sel('..')
   # TODO: Test result object itself
   path = npython.psel()
   assert path == '/'