1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # myDialog.py |
---|
4 | |
---|
5 | import wx |
---|
6 | |
---|
7 | class Properties(wx.Dialog): |
---|
8 | def __init__(self, parent, id, title): |
---|
9 | wx.Dialog.__init__(self, parent, id, "Select the scale of the graph", size=(350, 190)) |
---|
10 | """ |
---|
11 | for the properties window |
---|
12 | """ |
---|
13 | self.parent = parent |
---|
14 | panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) |
---|
15 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
16 | sizer = wx.GridBagSizer(5,0) |
---|
17 | vbox.Add(panel, 1, wx.EXPAND | wx.ALL) |
---|
18 | |
---|
19 | ix = 1 |
---|
20 | iy = 1 |
---|
21 | sizer.Add(wx.StaticText(panel, -1, 'X'),(iy, ix)) |
---|
22 | ix += 2 |
---|
23 | sizer.Add(wx.StaticText(panel, -1, 'Y'),(iy, ix)) |
---|
24 | ix += 2 |
---|
25 | sizer.Add(wx.StaticText(panel, -1, 'View'),(iy, ix)) |
---|
26 | iy += 1 |
---|
27 | ix = 1 |
---|
28 | self.xvalue = wx.ComboBox(panel, -1) |
---|
29 | sizer.Add(self.xvalue,(iy,ix)) |
---|
30 | ix +=2 |
---|
31 | self.yvalue = wx.ComboBox(panel, -1) |
---|
32 | sizer.Add( self.yvalue,(iy, ix)) |
---|
33 | ix +=2 |
---|
34 | self.view =wx.ComboBox(panel, -1) |
---|
35 | sizer.Add(self.view,(iy,ix)) |
---|
36 | |
---|
37 | |
---|
38 | btCancel=wx.Button(self, wx.ID_CANCEL,'Cancel' ) |
---|
39 | btOk = wx.Button(self, wx.ID_OK, "OK") |
---|
40 | |
---|
41 | sizer_button = wx.BoxSizer(wx.HORIZONTAL) |
---|
42 | sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
43 | sizer_button.Add(btOk, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
44 | sizer_button.Add(btCancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
45 | vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10) |
---|
46 | |
---|
47 | |
---|
48 | # scale value for x |
---|
49 | self.xvalue.SetValue("x") |
---|
50 | self.xvalue.Insert("x",0) |
---|
51 | self.xvalue.Insert("x^(2)",1) |
---|
52 | self.xvalue.Insert("log10(x)",2) |
---|
53 | |
---|
54 | |
---|
55 | # scale value for y |
---|
56 | self.yvalue.SetValue("log10(y)") |
---|
57 | self.yvalue.Insert("y",0) |
---|
58 | self.yvalue.Insert("1/y",1) |
---|
59 | self.yvalue.Insert("ln(y)",2) |
---|
60 | self.yvalue.Insert("y^(2)",3) |
---|
61 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
62 | self.yvalue.Insert("log10(y)",5) |
---|
63 | self.yvalue.Insert("ln(y*x)",6) |
---|
64 | self.yvalue.Insert("ln(y*x^(2))",7) |
---|
65 | self.yvalue.Insert("ln(y*x^(4))",8) |
---|
66 | |
---|
67 | # type of view or model used |
---|
68 | self.view.SetValue("--") |
---|
69 | self.view.Insert("--",0) |
---|
70 | self.view.Insert("Guinier lny vs x^(2)",1) |
---|
71 | panel.SetSizer(sizer) |
---|
72 | self.SetSizer(vbox) |
---|
73 | self.Centre() |
---|
74 | |
---|
75 | |
---|
76 | def setValues(self,x,y,view): |
---|
77 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y),self.view.SetValue(view) |
---|
78 | |
---|
79 | def getValues(self): |
---|
80 | return self.xvalue.GetValue(), self.yvalue.GetValue(),self.view.GetValue() |
---|
81 | |
---|
82 | |
---|
83 | if __name__ == "__main__": |
---|
84 | app = wx.App() |
---|
85 | dialog = Properties(None, -1, 'Properties') |
---|
86 | dialog.ShowModal() |
---|
87 | app.MainLoop() |
---|
88 | |
---|
89 | |
---|