-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpvg.py
executable file
·209 lines (163 loc) · 6.21 KB
/
pvg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pvg.py pysolovideogui
#
#
# Copyright 2011 Giorgio Gilestro <[email protected]>
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
import wx, os
from pvg_options import optionsFrame
from pvg_acquire import pvg_AcquirePanel as panelOne
from pvg_panel_two import panelLiveView
from pvg_common import options, DEFAULT_CONFIG
from pysolovideo import pySoloVideoVersion
class mainNotebook(wx.Notebook):
"""
The main notebook containing all the panels for data displaying and analysis
"""
def __init__(self, *args, **kwds):
# begin wxGlade: propertiesNotebook.__init__
kwds["style"] = wx.NB_LEFT
wx.Notebook.__init__(self, *args, **kwds)
self.panelOne = panelOne(self)
self.AddPage(self.panelOne, "Monitors sheet")
self.panelTwo = panelLiveView(self)
self.AddPage(self.panelTwo, "Live View")
self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
self.Layout()
def OnPageChanging(self, event):
"""
"""
#self.panelOne.StopPlaying()
self.panelTwo.StopPlaying()
class mainFrame(wx.Frame):
"""
The main frame of the application
"""
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.__menubar__()
self.__set_properties()
self.__do_layout()
def __do_layout(self):
#Add Notebook
self.videoNotebook = mainNotebook(self, -1)
mainSizer = wx.BoxSizer(wx.HORIZONTAL)
mainSizer.Add(self.videoNotebook, 1, wx.EXPAND, 0)
self.SetSizer(mainSizer)
def __set_properties(self):
# begin wxGlade: mainFrame.__set_properties
self.SetTitle("pySoloVideo")
x,y = options.GetOption("Resolution")
self.SetSize((x*1.8,y*1.4))
def __menubar__(self):
#Gives new IDs to the menu voices in the menubar
ID_FILE_OPEN = wx.NewId()
ID_FILE_SAVE = wx.NewId()
ID_FILE_SAVE_AS = wx.NewId()
#ID_FILE_CLOSE = wx.NewId()
ID_FILE_EXIT = wx.NewId()
ID_HELP_ABOUT = wx.NewId()
ID_OPTIONS_SET = wx.NewId()
filemenu = wx.Menu()
filemenu. Append(ID_FILE_OPEN, '&Open File', 'Open a file')
#filemenu. Append(ID_FILE_SAVE, '&Save File', 'Save current file')
filemenu. Append(ID_FILE_SAVE_AS, '&Save as...', 'Save current data in a new file')
#filemenu. Append(ID_FILE_CLOSE, '&Close File', 'Close')
filemenu. AppendSeparator()
filemenu. Append(ID_FILE_EXIT, 'E&xit Program', 'Exit')
optmenu = wx.Menu()
optmenu. Append(ID_OPTIONS_SET, 'Confi&gure', 'View and change settings')
helpmenu = wx.Menu()
helpmenu. Append(ID_HELP_ABOUT, 'Abou&t')
#Create the MenuBar
menubar = wx.MenuBar(style = wx.SIMPLE_BORDER)
#Populate the MenuBar
menubar. Append(filemenu, '&File')
menubar. Append(optmenu, '&Options')
menubar. Append(helpmenu, '&Help')
#and create the menubar
self.SetMenuBar(menubar)
wx.EVT_MENU(self, ID_FILE_OPEN, self.onFileOpen)
wx.EVT_MENU(self, ID_FILE_SAVE, self.onFileSave)
wx.EVT_MENU(self, ID_FILE_SAVE_AS, self.onFileSaveAs)
#wx.EVT_MENU(self, ID_FILE_CLOSE, self.onFileClose)
wx.EVT_MENU(self, ID_FILE_EXIT, self.onFileExit)
wx.EVT_MENU(self, ID_OPTIONS_SET, self.onConfigure)
wx.EVT_MENU(self, ID_HELP_ABOUT, self.onAbout)
def onAbout(self, event):
"""
Shows the about dialog
"""
about = 'pySolo-Video - v %s\n' % pySoloVideoVersion
about += 'by Giorgio F. Gilestro\n'
about += 'Visit http://www.pysolo.net for more information'
dlg = wx.MessageDialog(self, about, 'About', wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
def onFileSave(self, event):
"""
"""
options.Save()
def onFileSaveAs(self, event):
"""
"""
filename = DEFAULT_CONFIG
wildcard = "pySolo Video config file (*.cfg)|*.cfg"
dlg = wx.FileDialog(
self, message="Save file as ...", defaultDir=os.getcwd(),
defaultFile=filename, wildcard=wildcard, style=wx.SAVE
)
#dlg.SetFilterIndex(2)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
options.Save(filename=path)
dlg.Destroy()
def onFileOpen(self, event):
"""
"""
wildcard = "pySolo Video config file (*.cfg)|*.cfg"
dlg = wx.FileDialog(
self, message="Choose a file",
defaultDir=os.getcwd(),
defaultFile="",
wildcard=wildcard,
style=wx.OPEN | wx.CHANGE_DIR
)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
options.New(path)
dlg.Destroy()
def onFileExit(self, event):
"""
"""
self.Close()
def onConfigure(self, event):
"""
"""
frame_opt = optionsFrame(self, -1, '')
frame_opt.Show()
if __name__ == "__main__":
app = wx.App(False)
frame_1 = mainFrame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
app.MainLoop()