diff --git a/GUI_Main.fbp b/GUI_Main.fbp index 46193c3..5d4aa5d 100644 --- a/GUI_Main.fbp +++ b/GUI_Main.fbp @@ -58,7 +58,7 @@ wxTAB_TRAVERSAL 1 Close - + bSizer2 wxVERTICAL @@ -126,15 +126,6 @@ - - 1 - wxID_ANY - T_Check - 0 - 500 - protected - Check - diff --git a/GUI_Main.py b/GUI_Main.py index d094273..a0438e7 100644 --- a/GUI_Main.py +++ b/GUI_Main.py @@ -33,16 +33,11 @@ def __init__( self, parent ): self.SetSizer( bSizer2 ) self.Layout() - self.T_Check = wx.Timer() - self.T_Check.SetOwner( self, wx.ID_ANY ) - self.T_Check.Start( 500 ) - self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_CLOSE, self.Close ) - self.Bind( wx.EVT_TIMER, self.Check, id=wx.ID_ANY ) def __del__( self ): pass @@ -52,7 +47,4 @@ def __del__( self ): def Close( self, event ): event.Skip() - def Check( self, event ): - event.Skip() - diff --git a/GUI_Manager.fbp b/GUI_Manager.fbp index cd951c6..e72e5c4 100644 --- a/GUI_Manager.fbp +++ b/GUI_Manager.fbp @@ -47,7 +47,7 @@ Main - 500,300 + 600,300 wxDEFAULT_FRAME_STYLE ; ; forward_declare RBS_WALP_Manager @@ -124,20 +124,888 @@ -1 + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + 5 0 - + + wxWRAPSIZER_DEFAULT_FLAGS + + wSizer1 + wxHORIZONTAL + none + + 5 + + 0 + + + bSizer3 + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 100 + + 0 + + 0 + + 0 + + 1 + S_Volume + 1 + + + protected + 1 + + Resizable + 1 + -1,40 + wxSL_HORIZONTAL|wxSL_VALUE_LABEL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 50 + + + + Change_Volume + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Volume + 0 + + 0 + + + 0 + + 1 + m_staticText2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 1 + + + bSizer31 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + Select a file + + 0 + + 1 + filePicker + 1 + + + protected + 1 + + Resizable + 1 + -1,40 + wxFLP_DEFAULT_STYLE + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + mp4 文件 (*.mp4)|*.mp4|mov 文件 (*.mov)|*.mov + + + + OnFileChanged + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Locate + 0 + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 1 + + + bSizer4 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 000 X 000 + 0 + + 0 + + + 0 + + 1 + T_BestSize + 1 + + + protected + 1 + + Resizable + 1 + 80,40 + wxALIGN_CENTER_HORIZONTAL + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Best size + 0 + + 0 + + + 0 + + 1 + m_staticText5 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 1 + + + bSizer41 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 00:00 + 0 + + 0 + + + 0 + + 1 + T_Length + 1 + + + protected + 1 + + Resizable + 1 + 80,40 + wxALIGN_CENTER_HORIZONTAL + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Length + 0 + + 0 + + + 0 + + 1 + m_staticText51 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 1 + + + bSizer411 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 00:00 + 0 + + 0 + + + 0 + + 1 + T_Tell + 1 + + + protected + 1 + + Resizable + 1 + 80,40 + wxALIGN_CENTER_HORIZONTAL + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Tell + 0 + + 0 + + + 0 + + 1 + m_staticText511 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + gauge + 1 + + + protected + 1 + + 100 + Resizable + 1 + 600,-1 + wxGA_HORIZONTAL + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 0 + + + + + + + 5 + wxEXPAND + 1 + + wxWRAPSIZER_DEFAULT_FLAGS - bSizer3 - wxVERTICAL + wSizer2 + wxHORIZONTAL none 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxALL 0 - + 1 1 1 @@ -146,45 +1014,54 @@ + 0 + 1 0 1 1 + + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_ANY - 100 + MyButton + + 0 0 - 0 0 1 - S_Volume + m_button1 1 protected 1 + + Resizable 1 - wxSL_HORIZONTAL|wxSL_VALUE_LABEL + ; ; forward_declare 0 @@ -192,18 +1069,16 @@ wxFILTER_NONE wxDefaultValidator - 50 - Change_Volume 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + wxALL 0 - + 1 1 1 @@ -212,26 +1087,33 @@ + 0 + 1 0 1 1 + + 0 0 + Dock 0 Left 1 1 + 0 0 wxID_ANY - Volume + MyButton + 0 0 @@ -240,13 +1122,15 @@ 0 1 - m_staticText2 + m_button2 1 protected 1 + + Resizable 1 @@ -254,15 +1138,100 @@ ; ; forward_declare 0 + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + MyButton + + 0 + + 0 + + + 0 + + 1 + m_button3 + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + - -1 + + 1 + wxID_ANY + Timer + 0 + 100 + protected + TimerOnTimer + diff --git a/GUI_Manager.py b/GUI_Manager.py index 43b3588..6bd7866 100644 --- a/GUI_Manager.py +++ b/GUI_Manager.py @@ -17,7 +17,7 @@ class Main ( wx.Frame ): def __init__( self, parent ): - wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"RBS_WALP_Manager", pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) + wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"RBS_WALP_Manager", pos = wx.DefaultPosition, size = wx.Size( 600,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) @@ -29,9 +29,14 @@ def __init__( self, parent ): bSizer2.Add( self.m_staticText1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) + self.m_staticline2 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + bSizer2.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 ) + + wSizer1 = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) + bSizer3 = wx.BoxSizer( wx.VERTICAL ) - self.S_Volume = wx.Slider( self, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.DefaultSize, wx.SL_HORIZONTAL|wx.SL_VALUE_LABEL ) + self.S_Volume = wx.Slider( self, wx.ID_ANY, 50, 0, 100, wx.DefaultPosition, wx.Size( -1,40 ), wx.SL_HORIZONTAL|wx.SL_VALUE_LABEL ) bSizer3.Add( self.S_Volume, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Volume", wx.DefaultPosition, wx.DefaultSize, 0 ) @@ -40,17 +45,105 @@ def __init__( self, parent ): bSizer3.Add( self.m_staticText2, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) - bSizer2.Add( bSizer3, 0, 0, 5 ) + wSizer1.Add( bSizer3, 0, 0, 5 ) + + bSizer31 = wx.BoxSizer( wx.VERTICAL ) + + self.filePicker = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"mp4 文件 (*.mp4)|*.mp4|mov 文件 (*.mov)|*.mov", wx.DefaultPosition, wx.Size( -1,40 ), wx.FLP_DEFAULT_STYLE ) + bSizer31.Add( self.filePicker, 0, wx.ALL, 5 ) + + self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Locate", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText3.Wrap( -1 ) + + bSizer31.Add( self.m_staticText3, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) + + + wSizer1.Add( bSizer31, 1, wx.EXPAND, 5 ) + + bSizer4 = wx.BoxSizer( wx.VERTICAL ) + + self.T_BestSize = wx.StaticText( self, wx.ID_ANY, u"000 X 000", wx.DefaultPosition, wx.Size( 80,40 ), wx.ALIGN_CENTER_HORIZONTAL ) + self.T_BestSize.Wrap( -1 ) + + bSizer4.Add( self.T_BestSize, 0, wx.ALL, 5 ) + + self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Best size", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText5.Wrap( -1 ) + + bSizer4.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) + + + wSizer1.Add( bSizer4, 1, wx.EXPAND, 5 ) + + bSizer41 = wx.BoxSizer( wx.VERTICAL ) + + self.T_Length = wx.StaticText( self, wx.ID_ANY, u"00:00", wx.DefaultPosition, wx.Size( 80,40 ), wx.ALIGN_CENTER_HORIZONTAL ) + self.T_Length.Wrap( -1 ) + + bSizer41.Add( self.T_Length, 0, wx.ALL, 5 ) + + self.m_staticText51 = wx.StaticText( self, wx.ID_ANY, u"Length", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText51.Wrap( -1 ) + + bSizer41.Add( self.m_staticText51, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) + + + wSizer1.Add( bSizer41, 1, wx.EXPAND, 5 ) + + bSizer411 = wx.BoxSizer( wx.VERTICAL ) + + self.T_Tell = wx.StaticText( self, wx.ID_ANY, u"00:00", wx.DefaultPosition, wx.Size( 80,40 ), wx.ALIGN_CENTER_HORIZONTAL ) + self.T_Tell.Wrap( -1 ) + + bSizer411.Add( self.T_Tell, 0, wx.ALL, 5 ) + + self.m_staticText511 = wx.StaticText( self, wx.ID_ANY, u"Tell", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText511.Wrap( -1 ) + + bSizer411.Add( self.m_staticText511, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 ) + + + wSizer1.Add( bSizer411, 1, wx.EXPAND, 5 ) + + + bSizer2.Add( wSizer1, 0, 0, 5 ) + + self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + bSizer2.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 ) + + self.gauge = wx.Gauge( self, wx.ID_ANY, 100, wx.DefaultPosition, wx.Size( 600,-1 ), wx.GA_HORIZONTAL ) + self.gauge.SetValue( 0 ) + bSizer2.Add( self.gauge, 0, wx.ALL, 5 ) + + wSizer2 = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS ) + + self.m_button1 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) + wSizer2.Add( self.m_button1, 0, wx.ALL, 5 ) + + self.m_button2 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) + wSizer2.Add( self.m_button2, 0, wx.ALL, 5 ) + + self.m_button3 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) + wSizer2.Add( self.m_button3, 0, wx.ALL, 5 ) + + + bSizer2.Add( wSizer2, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer2 ) self.Layout() + self.Timer = wx.Timer() + self.Timer.SetOwner( self, wx.ID_ANY ) + self.Timer.Start( 100 ) + self.Centre( wx.BOTH ) # Connect Events self.Bind( wx.EVT_CLOSE, self.Close ) self.S_Volume.Bind( wx.EVT_SCROLL, self.Change_Volume ) + self.filePicker.Bind( wx.EVT_FILEPICKER_CHANGED, self.OnFileChanged ) + self.Bind( wx.EVT_TIMER, self.TimerOnTimer, id=wx.ID_ANY ) def __del__( self ): pass @@ -63,4 +156,10 @@ def Close( self, event ): def Change_Volume( self, event ): event.Skip() + def OnFileChanged( self, event ): + event.Skip() + + def TimerOnTimer( self, event ): + event.Skip() + diff --git a/Main.py b/Main.py index 8ea13b7..74e3edc 100644 --- a/Main.py +++ b/Main.py @@ -1,7 +1,7 @@ ############################## # import ############################## -import wx +import wx,wx.media import GUI_Main import win32api,win32con @@ -36,13 +36,17 @@ def __init__(self, parent): ##self.Vedio.ShowPlayerControls() # 播放控件 self.Vedio.Load( u"test_vedio.mp4" ) # 加载视频 + self.Vedio.Bind(wx.media.EVT_MEDIA_STOP, self.Restart) - def Check(self, event): - if self.Vedio.GetState() == wx.media.MEDIASTATE_STOPPED: - self.Vedio.Play() + self.Vedio.Play() + + + def Restart(self, event): + self.Vedio.Play() + print('Replay') + def Close(self, event): - self.T_Check.Stop() self.Destroy() diff --git a/Manager.py b/Manager.py index 685c220..9f34140 100644 --- a/Manager.py +++ b/Manager.py @@ -19,14 +19,36 @@ def __init__(self, parent): # 定义主函数 GUI_Manager.Main.__init__(self, parent) + self.T_BestSize.SetLabel(str(Frame_Main.Vedio.GetBestSize())) + def Close(self, event): + self.Timer.Stop() self.Destroy() - Frame_Main.T_Check.Stop() Frame_Main.Destroy() def Change_Volume(self, event): - Frame_Main.Vedio.SetVolume(self.S_Volume.GetValue()) - print("Volume",self.S_Volume.GetValue()) + Frame_Main.Vedio.SetVolume(self.S_Volume.GetValue() / 100) + print("Volume",self.S_Volume.GetValue(), '%') + + def OnFileChanged(self, event): + Frame_Main.Vedio.Stop() + Frame_Main.Vedio.Load(self.filePicker.GetPath()) + self.T_BestSize.SetLabel(str(Frame_Main.Vedio.GetBestSize())) + self.T_Length.SetLabel(str(Frame_Main.Vedio.Length())) + + def TimerOnTimer(self, event): + self.T_Length.SetLabel(str(Frame_Main.Vedio.Length())) + self.T_Tell.SetLabel(str(Frame_Main.Vedio.Tell())) + ##print(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length()) + if Frame_Main.Vedio.Length() != 0: + self.gauge.SetValue(int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100)) + + if int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100) > 99: + Frame_Main.Vedio.Pause() + Frame_Main.Vedio.Stop() + + print(int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100)) + ##print('Timer RUN') ############################## @@ -36,13 +58,13 @@ def Change_Volume(self, event): def main(): global app - + global Frame_Main + app = wx.App(False) + Frame_Main = Main.CalcFrame(None) frame = CalcFrame(None) frame.Show(True) - global Frame_Main - Frame_Main = Main.CalcFrame(None) Frame_Main.Show() # windows api creature