Exemplo n.º 1
0
    def paintGL(self):
        """Called by QtGL when redrawing is needed.
            For every redraw, color & depth butter are cleared, view projection are reset, view location & orientation are also reset. 
        """
        if not self.initialised: return

        c = self.backgroundColor
        glClearColor(c[0], c[1], c[2], 0.0)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        self.aspect = (self.width + 0.0) / (self.height + 0.0)
        self.vdist = 6.0 * self.scale
        self._setup_projection()

        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        glTranslatef(0.0, 0.0, -self.vdist)

        #q = self.quat

        #glRotatef(q.angle*180.0/pi, q.x, q.y, q.z)
        glTranslatef(self.pov[0], self.pov[1], self.pov[2])

        #self.drawModel()
        foo.foo()
Exemplo n.º 2
0
 def __paintEvent(self, e):
     """Draw a colorful collection of lines and circles.
     """
     foo.foo()
     if False:
         print 'paintEvent',
         sys.stdout.flush()
     if False:
         # Here is how to draw stuff using PyQt
         p = QPainter()
         size = self.frame1.size()
         w, h = size.width(), size.height()
         p.begin(self.frame1)
         p.eraseRect(0, 0, w, h)
         for i in range(100):
             color = random.choice(self.COLOR_CHOICES)
             p.setPen(QPen(color))
             p.setBrush(QBrush(color))
             x1 = w * random.random()
             y1 = h * random.random()
             if random.random() < 0.5:
                 x2 = w * random.random()
                 y2 = h * random.random()
                 p.drawLine(x1, y1, x2, y2)
             else:
                 x2 = 0.05 * w * random.random()
                 y2 = x2
                 p.drawEllipse(x1, y1, x2, y2)
         p.flush()
         p.end()
Exemplo n.º 3
0
 def __paintEvent(self, e):
     """Draw a colorful collection of lines and circles.
     """
     foo.foo()
     if False:
         print 'paintEvent',
         sys.stdout.flush()
     if False:
         # Here is how to draw stuff using PyQt
         p = QPainter()
         size = self.frame1.size()
         w, h = size.width(), size.height()
         p.begin(self.frame1)
         p.eraseRect(0, 0, w, h)
         for i in range(100):
             color = random.choice(self.COLOR_CHOICES)
             p.setPen(QPen(color))
             p.setBrush(QBrush(color))
             x1 = w * random.random()
             y1 = h * random.random()
             if random.random() < 0.5:
                 x2 = w * random.random()
                 y2 = h * random.random()
                 p.drawLine(x1, y1, x2, y2)
             else:
                 x2 = 0.05 * w * random.random()
                 y2 = x2
                 p.drawEllipse(x1, y1, x2, y2)
         p.flush()
         p.end()
Exemplo n.º 4
0
    def paintGL(self):        
        """Called by QtGL when redrawing is needed.
            For every redraw, color & depth butter are cleared, view projection are reset, view location & orientation are also reset. 
        """
        if not self.initialised: return

        c = self.backgroundColor
        glClearColor(c[0], c[1], c[2], 0.0)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        
        self.aspect = (self.width + 0.0)/(self.height + 0.0)
        self.vdist = 6.0 * self.scale
        self._setup_projection()
        
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()    
        glTranslatef(0.0, 0.0, -self.vdist)
       
        #q = self.quat
        
        #glRotatef(q.angle*180.0/pi, q.x, q.y, q.z)
        glTranslatef(self.pov[0], self.pov[1], self.pov[2])
        
        #self.drawModel()
        foo.foo()
Exemplo n.º 5
0
def task_do():
    if request.method == 'POST':
        if request.form['submit'] == 'start_a_long_process':
            print 'long task running'
            foo.foo(1,1000000)
            # out=foo.foo(1,1000)
            # print out
   
    return render_template('task_complete.html')
Exemplo n.º 6
0
def test_foo():
    import sys
    from foo import foo
    from io import StringIO

    saved_stdout = sys.stdout
    try:
        out = StringIO()
        sys.stdout = out
        foo()
        output = out.getvalue().strip()
        assert output == 'hello world!'
    finally:
        sys.stdout = saved_stdout
Exemplo n.º 7
0
def fn():
    foo()
    print('im bar')
Exemplo n.º 8
0
def main1():
  foo()
Exemplo n.º 9
0
import os

import boto3
from bar import bar
from bar.baz import baz
from foo import foo

_ = boto3

if __name__ == "__main__":
    INIT_FILENAME = "__init__.py"
    dirname = os.path.dirname(os.path.abspath(__file__))
    assert bar() == os.path.join(dirname, "bar", INIT_FILENAME)
    assert baz() == os.path.join(dirname, "bar", "baz", INIT_FILENAME)
    assert foo() == os.path.join(dirname, "foo", INIT_FILENAME)
Exemplo n.º 10
0
#!/usr/bin/env python

import foo
import foo.bar

foo.foo()
foo.bar.bar()
Exemplo n.º 11
0
def bar():
    global a
    print(a)
    foo()
    print(a)
    test()
Exemplo n.º 12
0
import foo

x = foo.foo(10, 2)

print(x)
Exemplo n.º 13
0
def test_foo_str():
    '''Test foo string output.'''
    assert foo('dummy') == 'foo'
Exemplo n.º 14
0
 def test_foo(self):
     self.assertEqual(1, foo.foo())
 def foo2(self):
     def bar_stub(): return 'baz'
     foo.bar = bar_stub
     eq_(foo.foo(), 'foobaz')
Exemplo n.º 16
0
# this file is for unit testing relative imports
from foo import foo
x = foo()
Exemplo n.º 17
0
import foo

print foo.foo(3)
print foo.bar(3)
Exemplo n.º 18
0
import foo
foo.foo("foo", 20)
Exemplo n.º 19
0
def test_foo():
    assert foo() == 'foo'
Exemplo n.º 20
0
def main(argv=None):
	print "in main function"
	print __name__
	foo.foo()
Exemplo n.º 21
0
 def testFoo(self):
     self.assertEquals(foo.foo(), 6, 'foo() == 6')
Exemplo n.º 22
0
 def testFoo(self):
     self.assertEquals(foo.foo(), 6, 'foo() == 6')
Exemplo n.º 23
0
#/usr/bin/python3
#
#module
import foo
import sys

print("=" * 100)
print("6.1.1 Module")
print("=" * 100)

if __name__ == "__main__":
    foo.foo(sys.argv[1])

#python .\lesson\6\6.1\6.1.1.py "This is argument"
#This is  foo foo function, input value n= This is argument
Exemplo n.º 24
0
def hello_world():
    foo()
    print "hello world!"
Exemplo n.º 25
0
def goo():
    """ call foo """
    a = foo.foo(b=1)
    return a
def test_foo():
    assert foo(5) == 6
Exemplo n.º 27
0

from foo import foo

print(foo())
Exemplo n.º 28
0
def test_bar_is_called_in_foo(mock):
    assert foo() == 42
    assert mock.called is True
 def foo(self):
     with patch('foo.bar') as mock:
         mock.return_value = "baz"
         eq_(foo.foo(), 'foobaz')
Exemplo n.º 30
0
def bar():
    return foo()
Exemplo n.º 31
0
def test_foo():
    assert foo() == "foo"
Exemplo n.º 32
0
#/usr/bin/python3
#
#module

print("=" * 100)
print("6.1 Module")
print("=" * 100)
import foo
foo.foo(200)
print(foo.__name__)

#import other way
#or from foo import * will import all functions except the function which name start with _
#from foo import foo
from foo import *
foo(50)
#can't access _xxx function
#_test()
#foo._test()

#or rename
from foo import foo as foo1
foo1('This is foo1')

#if using interative mode, the module only import once, or use importlib.reload(modulename)。
Exemplo n.º 33
0
import foo
foo.foo("foo", "20")
Exemplo n.º 34
0
 def test_foo(self):
     doc = foo()
     self.assertRegex(doc, 'Widgets')
Exemplo n.º 35
0
import foo
myfoo = foo.foo()
myfoo.hello()
Exemplo n.º 36
0
	def test_1_pawn(self):
		bar = []
		self.assertEquals(foo(bar), 0)