This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
forked from gilestrolab/pySolo-Video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpvg_reloadable.py
65 lines (54 loc) · 1.9 KB
/
pvg_reloadable.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
import pvg
import wx
########################################################################
class ReloaderPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
self.testFrame = None
showAppBtn = wx.Button(self, label="Show App")
showAppBtn.Bind(wx.EVT_BUTTON, self.onShowApp)
reloadBtn = wx.Button(self, label="Reload")
reloadBtn.Bind(wx.EVT_BUTTON, self.onReload)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(showAppBtn, 0, wx.ALL|wx.CENTER, 5)
mainSizer.Add(reloadBtn, 0, wx.ALL|wx.CENTER, 5)
self.SetSizer(mainSizer)
#----------------------------------------------------------------------
def onReload(self, event):
"""
Reload the code!
"""
if self.testFrame:
self.testFrame.Close()
reload(pvg)
self.showApp()
else:
self.testFrame = None
#----------------------------------------------------------------------
def onShowApp(self, event):
"""
Call the showApp() method
"""
self.showApp()
#----------------------------------------------------------------------
def showApp(self):
"""
Show the application we want to edit dynamically
"""
self.testFrame = pvg.mainFrame(self)
########################################################################
class ReloaderFrame(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Reloader")
panel = ReloaderPanel(self)
self.Show()
if __name__ == "__main__":
app = wx.App(False)
frame = ReloaderFrame()
app.MainLoop()