Exemple #1
0
    def __init__( self, root, objectlist, screen_size, clear_color, visual, timeout = timeout_interval ):
        self.process_objectlist( objectlist )

        self.clear_color = clear_color
        self.root = root
        self.size = None
        self.idle_id = None

        self.preload_done = 0

        self.timeout_interval = timeout

        self.index = None
        self.object = None
        self.pdict = {}

        self.controls_shown = 1

        self.marklist = None
        self.markmode = 0
        self.markmenu = None
        self.current_mark = None

        self.savenum = 0
        self.savefilename = None
        
        self.labelfont = tkFont.Font( family='Helvetica', size=8 )

        self.read_callback = None

        mb = self.menubar = Pmw.MainMenuBar( root )
        mb.addmenu( 'File', '' )
        mb.addmenuitem( 'File', 'command', label='Save screen', command = self.save_screen )
        mb.addmenuitem( 'File', 'command', label='Quit', command = self.quit )

        mb.addmenu( 'Object', '' )
        self.build_object_menu()

        self.panes = panes = Pmw.PanedWidget( root, command = self.resize_panes,
                                 hull_width = screen_size[0], hull_height = int(screen_size[1] * 1.25)+5)
        pane0 = panes.add( 'soggy', size = 0.8 )
        pane1 = panes.add( 'coord', size = 0.2 )

        try:
            if visual:
                d = system.parse_visual_arg( visual )
            else:
                d = {}

            self.s = SlSoggy.Soggy( pane0, width = screen_size[0], height = screen_size[1],
                                    init = dobj.init, reshape = self.reshape, redraw = self.redraw,
                                    **d )
        except (Tk.TclError, ValueError), msg:
            print msg
            sys.exit(1)
Exemple #2
0
    def go( self, screen_size = (800,600), root = None, visual = None ):
        if not root:
            root = Tk.Tk()
        self.root = root
        root.wm_title( 'Slithy presentation' )

        root.wm_protocol( 'WM_DELETE_WINDOW', self.quit )

        self.size = None
        self.pause = 0
        self.idle_id = None
        self.segment_num = None
        self.keepalive = 0
        self.clicktimer = None
        self.cursor = 1
        self.grab_filename = None
        self.grab_next = 1
        self.advance_count = 0
        self.object = None

        if self.visual:
            visual = self.visual

        if(self.quicktime):
            if not os.path.exists("quicktime-frames"):
                os.mkdir("quicktime-frames")

        try:
            if visual:
                d = system.parse_visual_arg( visual )
            else:
                d = {}

            self.s = SlSoggy.Soggy( root, width = screen_size[0], height = screen_size[1],
                                    init = dobj.init, reshape = self.reshape, redraw = self.redraw,
                                    **d )
        except (Tk.TclError, ValueError), msg:
            print msg
            sys.exit(1)
Exemple #3
0
    def go(self, screen_size=(800, 600), root=None, visual=None):
        if not root:
            root = Tk.Tk()
        self.root = root
        root.wm_title('Slithy presentation')

        root.wm_protocol('WM_DELETE_WINDOW', self.quit)

        self.size = None
        self.pause = 0
        self.idle_id = None
        self.segment_num = None
        self.keepalive = 0
        self.clicktimer = None
        self.cursor = 1
        self.grab_filename = None
        self.grab_next = 1
        self.advance_count = 0
        self.object = None
        self.screen_size = screen_size

        if self.visual:
            visual = self.visual

        if (self.quicktime):
            if not os.path.exists("quicktime-frames"):
                os.mkdir("quicktime-frames")

        #try:
        if visual:
            d = system.parse_visual_arg(visual)
        else:
            d = {}

        self.s = SlSoggy.Soggy(root,
                               width=screen_size[0],
                               height=screen_size[1],
                               init=dobj.init,
                               reshape=self.reshape,
                               redraw=self.redraw,
                               **d)
        soggy_xid = self.s.winfo_id()
        # Force SDL to write on our drawing area
        print 'SDL_WINDOWID ', str(soggy_xid)
        #os.putenv('SDL_WINDOWID', str(soggy_xid))
        os.environ['SDL_WINDOWID'] = str(soggy_xid)
        print 'SDL_WINDOWID ', os.getenv('SDL_WINDOWID')

        # pygame needed for movie support
        pygame.init()
        pygame.display.set_mode(screen_size, 0, 0)

        #except (Tk.TclError, ValueError), msg:
        #    print msg
        #    sys.exit(1)

        self.show_soggy_visual()

        library._reader.set_doquery(self.eval_query)

        self.s.pack(expand=1, fill='both')
        system.globals.soggy = self.s

        self.create_video_objects()

        root.bind('<Motion>', self.mouse_motion)
        self.cursortimer = self.s.after(mousehide_delay, self.cursor_expire)

        root.bind('<ButtonPress-1>', self.mouse_down)
        root.bind('<ButtonPress-3>', self.jump_menu)
        root.bind('<Key>', self.handle_key)

        self.jmenu = Tk.Menu(self.s, tearoff=0)
        for name, pos in self.bookmarks:
            self.jmenu.add_command(
                label=name, command=lambda j=pos: self.jump_to_segment(j))

        if self.fullscreen:
            self.fullscreen = 0
            self.toggle_fullscreen()

#         j = 0
#         for i in self.segments:
#             print j, i
#             j += 1

        self.begin_segment(0)

        root.mainloop()