]> git.plutz.net Git - viper/commitdiff
Bugfix: reset control panel when external view is reattached
authorpaul <paul@plutz.net>
Sat, 3 Dec 2011 19:03:04 +0000 (19:03 +0000)
committerpaul <paul@plutz.net>
Sat, 3 Dec 2011 19:03:04 +0000 (19:03 +0000)
svn path=/trunk/; revision=6

videoview.py

index 886d2f49c28cba64e4f17e90e594366e55953332..bd725bb8a488da44922ee56178a5eecd05c43334 100644 (file)
@@ -1,20 +1,20 @@
 #encoding: utf-8
 #Copyright 2009 - 2010 Paul Hänsch
 
 #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 <http://www.gnu.org/licenses/>
+# 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 <http://www.gnu.org/licenses/>
 
 from Tkinter import *
 from player import *
 
 from Tkinter import *
 from player import *
@@ -85,10 +85,16 @@ class VideoView(Frame):
         self.subgets['main_ctl'].params = params
 
     def prev_apply(self):
         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):
         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(
        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):
         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()
        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):
            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['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'],
         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):
         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()
         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'])
                                        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
         self.attached_view = True