示例#1
0
文件: init.py 项目: triselectif/pymt
def test_runpymt(*largs, **kwargs):
    from pymt import runTouchApp, curry, getClock, stopTouchApp
    kwargs.setdefault('frame', 1)

    class testinfo(object):
        frame = kwargs.get('frame') + 1

    def test_runpymt_stop(info, *largs):
        info.frame -= 1
        if info.frame == 0:
            stopTouchApp()

    getClock().schedule_interval(curry(test_runpymt_stop, testinfo), 0)
    runTouchApp(*largs)
示例#2
0
文件: init.py 项目: gavine199/pymt
def test_runpymt(*largs, **kwargs):
    from pymt import runTouchApp, curry, getClock, stopTouchApp
    kwargs.setdefault('frame', 1)

    class testinfo(object):
        frame = kwargs.get('frame') + 1

    def test_runpymt_stop(info, *largs):
        info.frame -= 1
        if info.frame == 0:
            stopTouchApp()

    getClock().schedule_interval(curry(test_runpymt_stop, testinfo), 0)
    runTouchApp(*largs)
示例#3
0
文件: radial.py 项目: Markitox/pymt
    def draw(self):
        # Background
        set_color(*self.style.get('bg-color'))
        drawCircle(self.pos, self.radius)

        # A good size for the hand, proportional to the size of the widget
        hd = self.radius / 10
        # Draw center of the hand
        set_color(*self.style.get('vector-color'))
        drawCircle(self.pos, hd)
        # Rotate the triangle so its not skewed
        l = prot((self.pos[0] - hd, self.pos[1]), self.angle-90, self.pos)
        h = prot((self.pos[0] + hd, self.pos[1]), self.angle-90, self.pos)
        # Draw triable of the hand
        with gx_begin(GL_POLYGON):
            glVertex2f(*l)
            glVertex2f(*h)
            glVertex2f(self.vector[0], self.vector[1])

if __name__ == '__main__':
    def on_vector_change(amp, ang):
        print amp, ang

    from pymt import MTWindow, runTouchApp
    w = MTWindow(fullscreen=False)
    mms = MTVectorSlider(pos=(200, 200))
    mms.push_handlers('on_vector_change', on_vector_change)
    w.add_widget(mms)
    runTouchApp()
示例#4
0
文件: start.py 项目: arasbm/pymt-apps
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
'''

if __name__ == '__main__':

    import sys
    from pymt import runTouchApp, getWindow

    if len(sys.argv) < 2:
        print
        print 'Usage: python start.py <filename_of_presentation.m>'
        print
        print 'To create a new presentation, just start application'
        print 'with a new filename.'
        print
        sys.exit(1)


    from app import Presemt

    dontrun = False
    m = Presemt(size=getWindow().size)
    m.load(sys.argv[1])
    if len(sys.argv) >= 3:
        if sys.argv[2] == '--pdf':
            m.export_to_pdf()
            dontrun = True
    if not dontrun:
        runTouchApp(m)

示例#5
0
                size=(self.width + self.padding * 2 + self.bordersize * 2,
                      self.height + self.padding * 2 + self.bordersize * 2),
                radius=self.radius,
                color=self.bordercolor)

            glEnable(GL_LINE_SMOOTH)
            glLineWidth(self.bordersize * 2)
            drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y),
                        style=GL_LINE_LOOP)

        # draw background
        drawRoundedRectangle(pos=(self.x - self.padding + rx,
                                  self.y - self.padding + ry),
                             size=(self.width + self.padding * 2,
                                   self.height + self.padding * 2),
                             radius=self.radius,
                             color=self.bgcolor)
        drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y))

        # hack to translate label position
        with gx_matrix:
            glTranslatef(rx, ry, 0)
            super(MTSpeechBubble, self).draw()


if __name__ == '__main__':
    from pymt import runTouchApp
    bl = MTSpeechBubble(color=(0, 0, 0, 1), label="Bubble")
    bl.pos = (100, 100)
    runTouchApp(bl)
示例#6
0
            )

            glEnable(GL_LINE_SMOOTH)
            glLineWidth(self.bordersize * 2)
            drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y), style=GL_LINE_LOOP)

        # draw background
        drawRoundedRectangle(
            pos=(self.x - self.padding + rx,
                 self.y - self.padding + ry),
            size=(self.width + self.padding * 2,
                  self.height + self.padding * 2),
            radius=self.radius,
            color=self.bgcolor
        )
        drawPolygon((self.x, self.y, v1.x, v1.y, v2.x, v2.y))

        # hack to translate label position
        with gx_matrix:
            glTranslatef(rx, ry, 0)
            super(MTSpeechBubble, self).draw()

if __name__ == '__main__':
    from pymt import runTouchApp
    bl = MTSpeechBubble(
        color=(0,0,0,1),
        label="Bubble"
    )
    bl.pos = (100, 100)
    runTouchApp(bl)
示例#7
0
        # Background
        set_color(*self.style.get('bg-color'))
        drawCircle(self.pos, self.radius)

        # A good size for the hand, proportional to the size of the widget
        hd = self.radius / 10
        # Draw center of the hand
        set_color(*self.style.get('vector-color'))
        drawCircle(self.pos, hd)
        # Rotate the triangle so its not skewed
        l = prot((self.pos[0] - hd, self.pos[1]), self.angle - 90, self.pos)
        h = prot((self.pos[0] + hd, self.pos[1]), self.angle - 90, self.pos)
        # Draw triable of the hand
        with gx_begin(GL_POLYGON):
            glVertex2f(*l)
            glVertex2f(*h)
            glVertex2f(self.vector[0], self.vector[1])


if __name__ == '__main__':

    def on_vector_change(amp, ang):
        print amp, ang

    from pymt import MTWindow, runTouchApp
    w = MTWindow(fullscreen=False)
    mms = MTVectorSlider(pos=(200, 200))
    mms.push_handlers('on_vector_change', on_vector_change)
    w.add_widget(mms)
    runTouchApp()