[6cfe703] | 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): |
---|
[572d4be] | 9 | wx.Dialog.__init__(self, parent, id, "Select the scale of the graph") |
---|
[6cfe703] | 10 | """ |
---|
| 11 | for the properties window |
---|
| 12 | """ |
---|
| 13 | self.parent = parent |
---|
| 14 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
[572d4be] | 15 | sizer = wx.GridBagSizer(5,5) |
---|
| 16 | |
---|
| 17 | x_size = 70 |
---|
[6a8adb0] | 18 | |
---|
[6cfe703] | 19 | ix = 1 |
---|
| 20 | iy = 1 |
---|
[572d4be] | 21 | sizer.Add(wx.StaticText(self, -1, 'X'),(iy, ix)) |
---|
[6cfe703] | 22 | ix += 2 |
---|
[572d4be] | 23 | sizer.Add(wx.StaticText(self, -1, 'Y'),(iy, ix)) |
---|
[6cfe703] | 24 | ix += 2 |
---|
[572d4be] | 25 | sizer.Add(wx.StaticText(self, -1, 'View'),(iy, ix)) |
---|
[6cfe703] | 26 | iy += 1 |
---|
| 27 | ix = 1 |
---|
[572d4be] | 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 | |
---|
[6cfe703] | 32 | ix +=2 |
---|
[572d4be] | 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 | |
---|
[6cfe703] | 37 | ix +=2 |
---|
[572d4be] | 38 | self.view =wx.ComboBox(self, -1) |
---|
| 39 | x_size += self.view.GetSize()[0] |
---|
[2509e86] | 40 | self.view.SetMinSize((160,30)) |
---|
| 41 | sizer.Add(self.view,(iy,ix), (1,1), wx.EXPAND|wx.RIGHT|wx.ADJUST_MINSIZE, 10) |
---|
[572d4be] | 42 | |
---|
| 43 | self.SetMinSize((x_size,50)) |
---|
[6a8adb0] | 44 | |
---|
[572d4be] | 45 | vbox.Add(sizer, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 46 | |
---|
[6a8adb0] | 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) |
---|
[572d4be] | 55 | vbox.Add(sizer_button, 0, wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 10) |
---|
[6a8adb0] | 56 | |
---|
[6cfe703] | 57 | |
---|
| 58 | # scale value for x |
---|
| 59 | self.xvalue.SetValue("x") |
---|
| 60 | self.xvalue.Insert("x",0) |
---|
[831149e] | 61 | self.xvalue.Insert("x^(2)",1) |
---|
| 62 | self.xvalue.Insert("log10(x)",2) |
---|
| 63 | |
---|
[6cfe703] | 64 | |
---|
| 65 | # scale value for y |
---|
[831149e] | 66 | self.yvalue.SetValue("log10(y)") |
---|
[6cfe703] | 67 | self.yvalue.Insert("y",0) |
---|
[831149e] | 68 | self.yvalue.Insert("1/y",1) |
---|
| 69 | self.yvalue.Insert("ln(y)",2) |
---|
| 70 | self.yvalue.Insert("y^(2)",3) |
---|
[5789654] | 71 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
[831149e] | 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) |
---|
[6cfe703] | 76 | |
---|
[88e7d08] | 77 | # type of view or model used |
---|
[dfca3de] | 78 | self.view.SetValue("--") |
---|
| 79 | self.view.Insert("--",0) |
---|
| 80 | self.view.Insert("Guinier lny vs x^(2)",1) |
---|
[572d4be] | 81 | |
---|
[6cfe703] | 82 | self.SetSizer(vbox) |
---|
[572d4be] | 83 | |
---|
| 84 | self.Fit() |
---|
[6cfe703] | 85 | self.Centre() |
---|
| 86 | |
---|
| 87 | |
---|
[dfca3de] | 88 | def setValues(self,x,y,view): |
---|
| 89 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y),self.view.SetValue(view) |
---|
[6cfe703] | 90 | |
---|
| 91 | def getValues(self): |
---|
[dfca3de] | 92 | return self.xvalue.GetValue(), self.yvalue.GetValue(),self.view.GetValue() |
---|
| 93 | |
---|
[6cfe703] | 94 | |
---|
| 95 | if __name__ == "__main__": |
---|
| 96 | app = wx.App() |
---|
| 97 | dialog = Properties(None, -1, 'Properties') |
---|
| 98 | dialog.ShowModal() |
---|
| 99 | app.MainLoop() |
---|
| 100 | |
---|
| 101 | |
---|