1
2
3
4 """
5
6 Defines widget that helps you keep a log of what you're experimenting.
7
8 """
9
10 import wx
11 from wx.py.crust import SessionListing
12
13
15 """
16 A facade for the SessionListing widget defined in wx.py
17 """
18
20 """
21 Create a SessionListing widget and wrap it among nice buttons.
22 """
23 wx.Panel.__init__(self,parent,id)
24
25 sizer = wx.BoxSizer(wx.VERTICAL)
26 self.listing = SessionListing(self)
27 sizer.Add(self.listing, proportion=1, flag=wx.EXPAND)
28
29 button = wx.Button(self, label="Get into a script")
30 self.Bind(wx.EVT_BUTTON, self.OnCreateScript, button)
31 sizer.Add(button, proportion=0, border=3, flag= wx.TOP | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER)
32 self.SetSizer(sizer)
33
35 """
36 Put the content of the log into a new script.
37 """
38 self.log_sink(self.listing.GetString(0,-1))
39
41 """
42 Print the text on standard output.
43
44 This method here to be overwrittent by external classes that
45 want for instance to transform the log into a new file.
46 """
47 print txt
48
49 - def loadHistory(self, history):
50 self.listing.loadHistory(history)
51
52 - def addHistory(self, command):
53 self.listing.addHistory(command)
54
55 - def clearHistory(self):
56 self.listing.clearHistory()
57