[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): |
---|
[88e7d08] | 9 | wx.Dialog.__init__(self, parent, id, title, size=(350, 200)) |
---|
[6cfe703] | 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 |
---|
[5789654] | 28 | self.xvalue = wx.ComboBox(panel, -1) |
---|
[6cfe703] | 29 | sizer.Add(self.xvalue,(iy,ix)) |
---|
| 30 | ix +=2 |
---|
[5789654] | 31 | self.yvalue = wx.ComboBox(panel, -1) |
---|
[6cfe703] | 32 | sizer.Add( self.yvalue,(iy, ix)) |
---|
| 33 | ix +=2 |
---|
[88e7d08] | 34 | self.view =wx.ComboBox(panel, -1) |
---|
| 35 | sizer.Add(self.view,(iy,ix)) |
---|
[6cfe703] | 36 | ix =3 |
---|
| 37 | iy +=3 |
---|
| 38 | btCancel=wx.Button(panel, wx.ID_CANCEL,'Cancel' ) |
---|
| 39 | sizer.Add(btCancel,(iy,ix)) |
---|
| 40 | ix +=2 |
---|
| 41 | btOk = wx.Button(panel, wx.ID_OK, "Ok") |
---|
| 42 | sizer.Add(btOk,(iy, ix)) |
---|
| 43 | |
---|
| 44 | # scale value for x |
---|
| 45 | self.xvalue.SetValue("x") |
---|
| 46 | self.xvalue.Insert("x",0) |
---|
[831149e] | 47 | self.xvalue.Insert("x^(2)",1) |
---|
| 48 | self.xvalue.Insert("log10(x)",2) |
---|
| 49 | |
---|
[6cfe703] | 50 | |
---|
| 51 | # scale value for y |
---|
[831149e] | 52 | self.yvalue.SetValue("log10(y)") |
---|
[6cfe703] | 53 | self.yvalue.Insert("y",0) |
---|
[831149e] | 54 | self.yvalue.Insert("1/y",1) |
---|
| 55 | self.yvalue.Insert("ln(y)",2) |
---|
| 56 | self.yvalue.Insert("y^(2)",3) |
---|
[5789654] | 57 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
[831149e] | 58 | self.yvalue.Insert("log10(y)",5) |
---|
| 59 | self.yvalue.Insert("ln(y*x)",6) |
---|
| 60 | self.yvalue.Insert("ln(y*x^(2))",7) |
---|
| 61 | self.yvalue.Insert("ln(y*x^(4))",8) |
---|
[6cfe703] | 62 | |
---|
[88e7d08] | 63 | # type of view or model used |
---|
[dfca3de] | 64 | self.view.SetValue("--") |
---|
| 65 | self.view.Insert("--",0) |
---|
| 66 | self.view.Insert("Guinier lny vs x^(2)",1) |
---|
[6cfe703] | 67 | panel.SetSizer(sizer) |
---|
| 68 | self.SetSizer(vbox) |
---|
| 69 | self.Centre() |
---|
| 70 | |
---|
| 71 | |
---|
[dfca3de] | 72 | def setValues(self,x,y,view): |
---|
| 73 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y),self.view.SetValue(view) |
---|
[6cfe703] | 74 | |
---|
| 75 | def getValues(self): |
---|
[dfca3de] | 76 | return self.xvalue.GetValue(), self.yvalue.GetValue(),self.view.GetValue() |
---|
| 77 | |
---|
[6cfe703] | 78 | |
---|
| 79 | if __name__ == "__main__": |
---|
| 80 | app = wx.App() |
---|
| 81 | dialog = Properties(None, -1, 'Properties') |
---|
| 82 | dialog.ShowModal() |
---|
| 83 | app.MainLoop() |
---|
| 84 | |
---|
| 85 | |
---|