當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。