From: paul Date: Sat, 3 Dec 2011 19:03:04 +0000 (+0000) Subject: Bugfix: reset control panel when external view is reattached X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=f61e63c7a981c2d50d6a83c3d1e5a63f5cb439e6;p=viper Bugfix: reset control panel when external view is reattached svn path=/trunk/; revision=6 --- diff --git a/videoview.py b/videoview.py index 886d2f4..bd725bb 100644 --- a/videoview.py +++ b/videoview.py @@ -1,20 +1,20 @@ #encoding: utf-8 #Copyright 2009 - 2010 Paul Hänsch -#This file is part of Viper. - -#Viper is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. - -#Viper is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. - -#You should have received a copy of the GNU General Public License -#along with Viper. If not, see +# This file is part of Viper. +# +# Viper is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Viper is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Viper. If not, see from Tkinter import * from player import * @@ -85,10 +85,16 @@ class VideoView(Frame): self.subgets['main_ctl'].params = params def prev_apply(self): + """ + Put video from preview to main display + """ self.subgets['ext_player'].stop_video() self.after(100, self.subgets['ext_ctl'].play) def c_ext_fullscreen(self): + """ + Toggle fullscreen mode of main displaye + """ if self.ext_fullscreen.get(): #self.subgets['view'].overrideredirect(1) self.subgets['ext_view'].geometry( @@ -101,6 +107,9 @@ class VideoView(Frame): self.subgets['prev_player'].stop_video() def b_ext_display(self): + """ + Button handler. Move External video window to X11 display given in entry box. + """ try: Tk(screenName=self.subgets['e_display'].get()).destroy() print self.subgets['e_display'].get() @@ -113,13 +122,17 @@ class VideoView(Frame): self.subgets['e_display'].configure(bg='#FF4444') def detach_view(self): + """ + Spawn a detached video display, replacing the display area with a preview tab + and a control tab. A currently playing video continues to run as preview. + """ self.subgets['main_ctl'].forget() self.subgets['prev_surf'].forget() self.subgets['ext_view'] = Tk() self.subgets['ext_view'].title('Viper Display') self.subgets['ext_view'].config(width = 320, height = 240, bg = '#000000') - self.subgets['ext_view'].protocol('WM_DELETE_WINDOW', self.attach_view) + self.subgets['ext_view'].protocol('WM_DELETE_WINDOW', self.attach_view) #Callback to attach_view when window is closed self.subgets['ext_player'].configure(surface = self.subgets['ext_view']) self.subgets['prev_surf'].pack(in_ = self.subgets['preview'], @@ -133,6 +146,9 @@ class VideoView(Frame): self.attached_view = False def attach_view(self): + """ + Reembed detached view into the main interface, stopping the playing video. + """ self.subgets['ext_player'].stop_video() self.subgets['prev_player'].stop_video() self.subgets['ext_view'].destroy() @@ -144,4 +160,5 @@ class VideoView(Frame): fill = BOTH, expand = True) self.subgets['main_ctl'].pack(side = BOTTOM, anchor = W, fill = X) self.subgets['main_ctl'].configure(self.subgets['prev_player']) + self.subgets['main_ctl'].status('stopped') self.attached_view = True