当前位置: 首页>>代码示例>>Python>>正文


Python Timeline.set_preview_manager方法代码示例

本文整理汇总了Python中timeline.Timeline.set_preview_manager方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.set_preview_manager方法的具体用法?Python Timeline.set_preview_manager怎么用?Python Timeline.set_preview_manager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在timeline.Timeline的用法示例。


在下文中一共展示了Timeline.set_preview_manager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: window_destroy

# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import set_preview_manager [as 别名]

#.........这里部分代码省略.........
        self.logplayer.set_frame(frame)

    def __init__(self):
        self.init = False
        self.gladefile = os.path.join(__location__, "gui/cave.glade")
        self.builder = Gtk.Builder()
        self.builder.add_from_file(self.gladefile)

        # Automatically connect signals to functions defined above
        self.builder.connect_signals(self)

        #Set up the video tree 
        self.video_tree = self.builder.get_object("videoTreeView")
        self.video_tree_manager = VideoTreeManager(self.video_tree, self)

        #Set up the filter box
        self.filter_box = self.builder.get_object("filterEntry")

        #Create & link video display widget
        self.video_box_container = self.builder.get_object("videoBox")
        self.video_box = VideoBox(self)
        self.video_box.show()
        self.video_box_container.pack_start(self.video_box, True, True, 0)
        
        #Create & Link timeline widget
        self.timeline_box = self.builder.get_object("timelineBox")
        self.timeline = Timeline(self)
        self.timeline.show()
        self.timeline_box.pack_start(self.timeline, True, True, 0)

        self.timeline.cursor_change = self._change_frame #Register listener

        self.video_box.length_listener = self.timeline.set_length #Register listener

        #Initialize shared memory blocks for all cameras
        CameraLink.preinit()

        #Log playback
        filter_file = os.path.expanduser(args.filter) if args.filter else ''
        self.logplayer = LogPlayer(filter=filter_file)

        # Get the main window
        self.window = self.builder.get_object("caveWindow")
        self.window.show()

        #Initialize gtk's thread engine; add any threads after these lines
        Gdk.threads_init()
        GLib.threads_init()

        #Start video player thread
        self.video_player = VideoPlayer(self)
        self.play_button = self.builder.get_object("playButton")

        self.enable_button = self.builder.get_object("enableButton")
        self.toggle_all_button = self.builder.get_object("toggleAllButton")

        #Start video rendering thread
        self.video_box.start_thread()

        #Start video preview manager
        self.video_preview_manager = VideoPreviewManager(self.video_box.vmt) #link w/ video manager thread
        self.video_preview_manager.register_callback(self.timeline.preview_callback)
        self.timeline.set_preview_manager(self.video_preview_manager)

        #Create statusbar display thread
        self.statusbar = StatusBarManager(self.builder.get_object("statusBar"))
        self.statusbar.display("Welcome to CAVE!", 2)

        self.db = None

        self.loop_button = self.builder.get_object("loopButton")

        #Load database file from arguments if present
        if args.database:
            self.load_db(args.database)
        elif os.path.exists(os.path.expanduser(self.config_file)):
            f = open(os.path.expanduser(self.config_file), "r")
            self.load_db(f.read())

        #Ctrl+C handling
        def handler(signum, frame):
            self.log.warning("INTERRUPT; stopping CAVE")
            self.window_destroy(None)
        signal.signal(signal.SIGTERM, handler)
        signal.signal(signal.SIGINT, handler)

        #This fairly pointless function is necessary to periodically wake up
        #the gtk main thread to detect system interrupts even when not focused
        #I believe this is due to a Gtk bug
        GLib.timeout_add(500, lambda : True)

        #Make the window more shrinkable
        self.window.set_size_request(400,400)

        #Fire up the main window 
        self.log.info("Launching GUI. Welcome to CAVE!")
        self.init = True
        Gdk.threads_enter()
        Gtk.main()
        Gdk.threads_leave()
开发者ID:athityakumar,项目名称:software,代码行数:104,代码来源:main.py


注:本文中的timeline.Timeline.set_preview_manager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。