Skip to content

Commit

Permalink
update 0205
Browse files Browse the repository at this point in the history
  • Loading branch information
Puiching-Memory committed Feb 5, 2022
1 parent 5897337 commit 76cf97a
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 56 deletions.
249 changes: 230 additions & 19 deletions GUI_Manager.fbp

Large diffs are not rendered by default.

50 changes: 41 additions & 9 deletions GUI_Manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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( 600,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,350 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) )
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__( self, parent ):

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 )
self.filePicker = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"mp4 文件 (*.mp4)|*.mp4|mov 文件 (*.mov)|*.mov|html 文件 (*.html)|*.html", 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 )
Expand Down Expand Up @@ -111,19 +111,39 @@ def __init__( self, parent ):
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 )
wSizer3 = wx.WrapSizer( wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS )

bSizer32 = wx.BoxSizer( wx.VERTICAL )

self.S_Rate = wx.Slider( self, wx.ID_ANY, 100, 0, 200, wx.DefaultPosition, wx.Size( -1,40 ), wx.SL_HORIZONTAL|wx.SL_VALUE_LABEL )
bSizer32.Add( self.S_Rate, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )

self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, u"Rate", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText21.Wrap( -1 )

bSizer32.Add( self.m_staticText21, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )


wSizer3.Add( bSizer32, 1, wx.EXPAND, 5 )


bSizer2.Add( wSizer3, 1, wx.EXPAND, 5 )

self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
bSizer2.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )

self.GUIDE = wx.Slider( self, wx.ID_ANY, 0, 0, 100, wx.DefaultPosition, wx.Size( 600,-1 ), wx.SL_AUTOTICKS|wx.SL_BOTH )
bSizer2.Add( self.GUIDE, 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 )
self.m_button1 = wx.Button( self, wx.ID_ANY, u"", 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.Control_M = wx.Button( self, wx.ID_ANY, u"Pause", wx.DefaultPosition, wx.DefaultSize, 0 )
wSizer2.Add( self.Control_M, 0, wx.ALL, 5 )

self.m_button3 = wx.Button( self, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_button3 = wx.Button( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 )
wSizer2.Add( self.m_button3, 0, wx.ALL, 5 )


Expand All @@ -143,6 +163,9 @@ def __init__( self, parent ):
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.S_Rate.Bind( wx.EVT_SCROLL, self.Change_Rate )
self.GUIDE.Bind( wx.EVT_SCROLL, self.GUIDEOnScroll )
self.Control_M.Bind( wx.EVT_BUTTON, self.Control_MOnButtonClick )
self.Bind( wx.EVT_TIMER, self.TimerOnTimer, id=wx.ID_ANY )

def __del__( self ):
Expand All @@ -159,6 +182,15 @@ def Change_Volume( self, event ):
def OnFileChanged( self, event ):
event.Skip()

def Change_Rate( self, event ):
event.Skip()

def GUIDEOnScroll( self, event ):
event.Skip()

def Control_MOnButtonClick( self, event ):
event.Skip()

def TimerOnTimer( self, event ):
event.Skip()

Expand Down
12 changes: 1 addition & 11 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@ def __init__(self, parent):

print(screen_Size_X,screen_Size_Y) # 获取GUI大小

#self.Vedio.SetSize(screen_Size_X, screen_Size_Y)
self.SetSize(screen_Size_X, screen_Size_Y)
#self.Vedio.Play()

##self.Vedio.ShowPlayerControls() # 播放控件

self.Vedio.Load( u"test_vedio.mp4" ) # 加载视频
self.Vedio.Bind(wx.media.EVT_MEDIA_STOP, self.Restart)

self.Vedio.Play()


def Restart(self, event):
self.Vedio.Play()
print('Replay')
#self.Vedio.Load("test_vedio.mp4" ) # 加载视频


def Close(self, event):
Expand Down
62 changes: 48 additions & 14 deletions Manager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
##############################
# import
##############################
import wx
import wx,wx.media

import GUI_Manager
import Main

import windows_API
import win32gui
import webview

##############################
# GUI的函数桥接
Expand All @@ -21,6 +22,10 @@ def __init__(self, parent):

self.T_BestSize.SetLabel(str(Frame_Main.Vedio.GetBestSize()))

Frame_Main.Vedio.Bind(wx.media.EVT_MEDIA_FINISHED, self.Restart)
Frame_Main.Vedio.Bind(wx.media.EVT_MEDIA_LOADED, self.Loaded)
Frame_Main.Vedio.Bind(wx.media.EVT_MEDIA_STOP, self.stop)

def Close(self, event):
self.Timer.Stop()
self.Destroy()
Expand All @@ -30,25 +35,51 @@ def Change_Volume(self, event):
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()))
if '.html' in self.filePicker.GetPath():
Frame_Main.Vedio.Stop()
Frame_Main.Destroy()
self.Timer.Stop()
self.Hide()

window = webview.create_window('RBS_WALP_HTML', self.filePicker.GetPath())
webview.start(html_boost, window)
else:
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())
self.T_Length.SetLabel(str(Frame_Main.Vedio.Length() / 1000) + 's')
self.T_Tell.SetLabel(str(Frame_Main.Vedio.Tell() / 1000) + 's')
if Frame_Main.Vedio.Length() != 0:
self.gauge.SetValue(int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100))
self.GUIDE.SetValue(int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100))

def Control_MOnButtonClick(self, event):
print(Frame_Main.Vedio.GetState())
if Frame_Main.Vedio.GetState() == 2:
self.Control_M.SetLabel('start')
Frame_Main.Vedio.Pause()
else:
self.Control_M.SetLabel('pause')
Frame_Main.Vedio.Play()

def Change_Rate(self, event):
rate = self.S_Rate.GetValue() / 100
Frame_Main.Vedio.SetPlaybackRate(rate)

def Restart(self, event):
Frame_Main.Vedio.Play()
print('Replay')

if int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100) > 99:
Frame_Main.Vedio.Pause()
Frame_Main.Vedio.Stop()
def Loaded(self, event):
print('loading complete')
Frame_Main.Vedio.Play()

print(int(Frame_Main.Vedio.Tell() / Frame_Main.Vedio.Length() * 100))
##print('Timer RUN')
def stop(self, event):
print(1)


##############################
Expand All @@ -72,6 +103,9 @@ def main():

app.MainLoop()

def html_boost(window):
window.toggle_fullscreen()
windows_API.RUN(player_window_handel=win32gui.FindWindow(None, "RBS_WALP_HTML"))

if __name__ == "__main__":
main()
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Desktop wallpaper engine based on wxPython Library
* [X] 可循环播放
* [X] 控制面版
* [X] 音量调节
* [X] 播放速率调节
* [X] 自定义播放路径
* [X] 支持.mov文件夹
* [ ] 无缝循环播放
* [ ] 列表式播放

# 所需库:

Expand Down
3 changes: 0 additions & 3 deletions windows_API.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#from win32gui import FindWindow, FindWindowEx, ShowWindow, SendMessageTimeout, SetParent, EnumWindows, GetWindowText
#from win32con import SW_HIDE, SMTO_ABORTIFHUNG

import win32gui
import win32con

Expand Down
1 change: 1 addition & 0 deletions 打包命令.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyinstaller -D Manager.py -w -y

0 comments on commit 76cf97a

Please sign in to comment.