[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): |
---|
[6a8adb0] | 9 | wx.Dialog.__init__(self, parent, id, "Select the scale of the graph", size=(350, 190)) |
---|
[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) |
---|
[6a8adb0] | 18 | |
---|
[6cfe703] | 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)) |
---|
[6a8adb0] | 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 | |
---|
[6cfe703] | 47 | |
---|
| 48 | # scale value for x |
---|
| 49 | self.xvalue.SetValue("x") |
---|
| 50 | self.xvalue.Insert("x",0) |
---|
[831149e] | 51 | self.xvalue.Insert("x^(2)",1) |
---|
| 52 | self.xvalue.Insert("log10(x)",2) |
---|
| 53 | |
---|
[6cfe703] | 54 | |
---|
| 55 | # scale value for y |
---|
[831149e] | 56 | self.yvalue.SetValue("log10(y)") |
---|
[6cfe703] | 57 | self.yvalue.Insert("y",0) |
---|
[831149e] | 58 | self.yvalue.Insert("1/y",1) |
---|
| 59 | self.yvalue.Insert("ln(y)",2) |
---|
| 60 | self.yvalue.Insert("y^(2)",3) |
---|
[5789654] | 61 | self.yvalue.Insert("1/sqrt(y)",4) |
---|
[831149e] | 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) |
---|
[6cfe703] | 66 | |
---|
[88e7d08] | 67 | # type of view or model used |
---|
[dfca3de] | 68 | self.view.SetValue("--") |
---|
| 69 | self.view.Insert("--",0) |
---|
| 70 | self.view.Insert("Guinier lny vs x^(2)",1) |
---|
[6cfe703] | 71 | panel.SetSizer(sizer) |
---|
| 72 | self.SetSizer(vbox) |
---|
| 73 | self.Centre() |
---|
| 74 | |
---|
| 75 | |
---|
[dfca3de] | 76 | def setValues(self,x,y,view): |
---|
| 77 | return self.xvalue.SetValue(x), self.yvalue.SetValue(y),self.view.SetValue(view) |
---|
[6cfe703] | 78 | |
---|
| 79 | def getValues(self): |
---|
[dfca3de] | 80 | return self.xvalue.GetValue(), self.yvalue.GetValue(),self.view.GetValue() |
---|
| 81 | |
---|
[6cfe703] | 82 | |
---|
| 83 | if __name__ == "__main__": |
---|
| 84 | app = wx.App() |
---|
| 85 | dialog = Properties(None, -1, 'Properties') |
---|
| 86 | dialog.ShowModal() |
---|
| 87 | app.MainLoop() |
---|
| 88 | |
---|
| 89 | |
---|