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") |
---|
10 | """ |
---|
11 | for the properties window |
---|
12 | """ |
---|
13 | self.parent = parent |
---|
14 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
15 | sizer = wx.GridBagSizer(5,5) |
---|
16 | |
---|
17 | x_size = 70 |
---|
18 | |
---|
19 | ix = 1 |
---|
20 | iy = 1 |
---|
21 | sizer.Add(wx.StaticText(self, -1, 'X'),(iy, ix)) |
---|
22 | ix += 2 |
---|
23 | sizer.Add(wx.StaticText(self, -1, 'Y'),(iy, ix)) |
---|
24 | ix += 2 |
---|
25 | sizer.Add(wx.StaticText(self, -1, 'View'),(iy, ix)) |
---|
26 | iy += 1 |
---|
27 | ix = 1 |
---|
28 | self.xvalue = wx.ComboBox(self, -1) |
---|
29 | x_size += self.xvalue.GetSize()[0] |
---|
30 | sizer.Add(self.xvalue,(iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
31 | |
---|
32 | ix +=2 |
---|
33 | self.yvalue = wx.ComboBox(self, -1) |
---|
34 | x_size += self.yvalue.GetSize()[0] |
---|
35 | sizer.Add( self.yvalue,(iy, ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
36 | |
---|
37 | ix +=2 |
---|
38 | self.view =wx.ComboBox(self, -1) |
---|
39 | x_size += self.view.GetSize()[0] |
---|
40 | self.view.SetMinSize((160,30)) |
---|
41 | sizer.Add(self.view,(iy,ix), (1,1), wx.EXPAND|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
42 | |
---|
43 | self.SetMinSize((x_size,50)) |
---|
44 | |
---|
45 | vbox.Add(sizer, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
46 | |
---|
47 | |
---|
48 | btCancel=wx.Button(self, wx.ID_CANCEL,'Cancel' ) |
---|
49 | btOk = wx.Button(self, wx.ID_OK, "OK") |
---|
50 | |
---|
51 | sizer_button = wx.BoxSizer(wx.HORIZONTAL) |
---|
52 | sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
53 | sizer_button.Add(btOk, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
54 | sizer_button.Add(btCancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
55 | vbox.Add(sizer_button, 0, wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 10) |
---|
56 | |
---|
57 | |
---|
58 | # scale value for x |
---|
59 | self.xvalue.SetValue("x") |
---|
60 | self.xvalue.Insert("x",0) |
---|
61 | self.xvalue.Insert("x^(2)",1) |
---|
62 | self.xvalue.Insert("log10(x)",2) |
---|
63 | |
---|
64 | |
---|
65 | # scale value for y |
---|
66 | self.yvalue.SetValue("log10(y)") |
---|
67 | self.yvalue.Insert("y",0) |
---|
68 | self.yvalue.Insert("1/y",1) |
---|
69 | self.yvalue.Insert("ln(y)",2) |
---|
70 | self.yvalue.Insert("y^(2)",3) |
---|
71 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
72 | self.yvalue.Insert("log10(y)",5) |
---|
73 | self.yvalue.Insert("ln(y*x)",6) |
---|
74 | self.yvalue.Insert("ln(y*x^(2))",7) |
---|
75 | self.yvalue.Insert("ln(y*x^(4))",8) |
---|
76 | |
---|
77 | # type of view or model used |
---|
78 | self.view.SetValue("--") |
---|
79 | self.view.Insert("--",0) |
---|
80 | self.view.Insert("Guinier lny vs x^(2)",1) |
---|
81 | |
---|
82 | self.SetSizer(vbox) |
---|
83 | |
---|
84 | self.Fit() |
---|
85 | self.Centre() |
---|
86 | |
---|
87 | |
---|
88 | def setValues(self,x,y,view): |
---|
89 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y),self.view.SetValue(view) |
---|
90 | |
---|
91 | def getValues(self): |
---|
92 | return self.xvalue.GetValue(), self.yvalue.GetValue(),self.view.GetValue() |
---|
93 | |
---|
94 | |
---|
95 | if __name__ == "__main__": |
---|
96 | app = wx.App() |
---|
97 | dialog = Properties(None, -1, 'Properties') |
---|
98 | dialog.ShowModal() |
---|
99 | app.MainLoop() |
---|
100 | |
---|
101 | |
---|