1
# -*- coding:iso8859-1 -*-
2
#-----------------------------------------------------------------------------
3
# Name: wxMiniFrame1.py
6
# Author: <Fl�vio Code�o Coelho>
9
# RCS-ID: $Id: wxMiniFrame1.py,v 1.3 2004/01/13 10:51:44 fccoelho Exp $
10
# Copyright: (c) 2003 Fl�vio Code�o Coelho <fccoelho@uerj.br>
11
# Licence: This program is free software; you can redistribute it and/or
12
# modify it under the terms of the GNU General Public License
13
# as published by the Free Software Foundation; either version 2
14
# of the License, or (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program; if not, write to the Free Software
23
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
#-----------------------------------------------------------------------------
26
#Boa:MiniFrame:wxMiniFrame1
30
from scipy import gplt
34
return wxMiniFrame1(parent)
36
[wxID_WXMINIFRAME1, wxID_WXMINIFRAME1BUTTON1, wxID_WXMINIFRAME1BUTTON2,
37
wxID_WXMINIFRAME1BUTTON3, wxID_WXMINIFRAME1BUTTON4, wxID_WXMINIFRAME1BUTTON5,
38
wxID_WXMINIFRAME1BUTTON6, wxID_WXMINIFRAME1BUTTON7,
39
wxID_WXMINIFRAME1GENTOGGLEBUTTON1, wxID_WXMINIFRAME1PANEL1,
40
] = [wx.NewId() for _init_ctrls in range(10)]
42
class wxMiniFrame1(wx.MiniFrame):
43
def _init_ctrls(self, prnt):
44
# generated method, don't edit
45
wx.MiniFrame.__init__(self, id=wxID_WXMINIFRAME1, name='', parent=prnt,
46
pos= wx.Point(258, 166), size= wx.Size(200, 170),
47
style=wx.DEFAULT_FRAME_STYLE, title='Plot Properties')
48
self.SetClientSize(wx.Size(200, 170))
49
self.SetToolTipString('Edit plot properties')
51
self.panel1 = wx.Panel(id=wxID_WXMINIFRAME1PANEL1, name='panel1',
52
parent=self, pos= wx.Point(0, 0), size= wx.Size(200, 170),
53
style=wx.TAB_TRAVERSAL)
54
self.panel1.SetToolTipString('')
55
self.panel1.SetLabel('Plot Properties')
57
self.button1 = wx.Button(id=wxID_WXMINIFRAME1BUTTON1, label='Title',
58
name='button1', parent=self.panel1, pos= wx.Point(14, 14),
59
size= wx.Size(80, 22), style=0)
60
self.button1.SetToolTipString('Set the title.')
61
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_WXMINIFRAME1BUTTON1)
63
self.button2 = wx.Button(id=wxID_WXMINIFRAME1BUTTON2, label='X title',
64
name='button2', parent=self.panel1, pos= wx.Point(14, 44),
65
size= wx.Size(80, 22), style=0)
66
self.button2.SetToolTipString('Set title of X axis')
67
self.button2.SetHelpText('Set X-axis title')
68
self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button, id=wxID_WXMINIFRAME1BUTTON2)
70
self.button3 = wx.Button(id=wxID_WXMINIFRAME1BUTTON3, label='Y title',
71
name='button3', parent=self.panel1, pos= wx.Point(14, 74),
72
size= wx.Size(80, 22), style=0)
73
self.button3.SetToolTipString('Set title of Y axis')
74
self.button3.SetHelpText('Set Y-axis title')
75
self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button, id=wxID_WXMINIFRAME1BUTTON3)
77
self.genToggleButton1 = wx.GenToggleButton(ID=wxID_WXMINIFRAME1GENTOGGLEBUTTON1,
78
label='Grid', name='genToggleButton1', parent=self.panel1,
79
pos= wx.Point(14, 104), size= wx.Size(80, 22), style=0)
80
self.genToggleButton1.SetToggle(1)
81
self.genToggleButton1.SetToolTipString('Toggle gridlines')
82
self.genToggleButton1.Bind(wx.EVT_BUTTON, self.OnGentogglebutton1Button, id=wxID_WXMINIFRAME1GENTOGGLEBUTTON1)
84
self.button4 = wx.Button(id=wxID_WXMINIFRAME1BUTTON4, label='Log Scale',
85
name='button4', parent=self.panel1, pos= wx.Point(14, 134),
86
size= wx.Size(80, 22), style=0)
87
self.button4.SetToolTipString('Set logarithm scale for axes, individually.')
88
self.button4.Bind(wx.EVT_BUTTON, self.OnButton4Button, id=wxID_WXMINIFRAME1BUTTON4)
90
self.button5 = wx.Button(id=wxID_WXMINIFRAME1BUTTON5, label='X limits',
91
name='button5', parent=self.panel1, pos= wx.Point(104, 44),
92
size= wx.Size(80, 22), style=0)
93
self.button5.Bind(wx.EVT_BUTTON, self.OnButton5Button, id=wxID_WXMINIFRAME1BUTTON5)
95
self.button6 = wx.Button(id=wxID_WXMINIFRAME1BUTTON6, label='Y limits',
96
name='button6', parent=self.panel1, pos= wx.Point(104, 74),
97
size= wx.Size(80, 22), style=0)
98
self.button6.Bind(wx.EVT_BUTTON, self.OnButton6Button, id=wxID_WXMINIFRAME1BUTTON6)
100
self.button7 = wx.Button(id=wxID_WXMINIFRAME1BUTTON7, label='Autoscale',
101
name='button7', parent=self.panel1, pos= wx.Point(104, 14),
102
size= wx.Size(80, 22), style=0)
103
self.button7.Bind(wx.EVT_BUTTON, self.OnButton7Button, id=wxID_WXMINIFRAME1BUTTON7)
105
def __init__(self, parent):
106
self._init_ctrls(parent)
108
def OnButton1Button(self, event):
110
sets the title of the plot on the event
112
dlg = wx.TextEntryDialog(self, 'Enter a title for this plot:', 'Plot Title', 'Time Series')
114
if dlg.ShowModal() == wx.ID_OK:
115
answer = dlg.GetValue()
121
def OnButton2Button(self, event):
123
sets the X axis title of the plot on the event
125
dlg = wx.TextEntryDialog(self, 'Enter the X-axis title:', 'X-axis Title', 'Time')
127
if dlg.ShowModal() == wx.ID_OK:
128
answer = dlg.GetValue()
136
def OnButton3Button(self, event):
138
sets the Y axis title of the plot on the event
140
dlg = wx.TextEntryDialog(self, 'Enter the Y-axis title:', 'Y-axis Title', 'Y[i]')
142
if dlg.ShowModal() == wx.ID_OK:
143
answer = dlg.GetValue()
148
def OnGentogglebutton1Button(self, event):
152
t = self.genToggleButton1.GetValue()
158
def OnButton4Button(self, event):
160
log scale on chosen axis
162
dlg = wx.SingleChoiceDialog(self, 'Choose Axis', 'Caption', ['X-axis','Y-axis', 'None'])
164
if dlg.ShowModal() == wx.ID_OK:
165
selected = dlg.GetStringSelection()
166
if selected == 'X-axis':
168
elif selected == 'Y-axis':
170
elif selected == 'None':
176
def OnButton5Button(self, event):
177
dlg = wx.TextEntryDialog(self, 'Enter two numbers separated by a space:', 'Define X-Axis Limits', '')
179
if dlg.ShowModal() == wx.ID_OK:
180
answer = dlg.GetValue()
181
lims = [i for i in strip(answer).split(' ') if i!= '']
182
gplt.xaxis((float(lims[0]),float(lims[1])))
189
def OnButton6Button(self, event):
190
dlg = wx.TextEntryDialog(self, 'Enter two numbers separated by a space:', 'Define Y-Axis Limits', '')
192
if dlg.ShowModal() == wx.ID_OK:
193
answer = dlg.GetValue()
194
answer = dlg.GetValue()
195
lims = [i for i in strip(answer).split(' ') if i!= '']
196
gplt.yaxis((float(lims[0]),float(lims[1])))
204
def OnButton7Button(self, event):