[82a54b8] | 1 | import wx |
---|
| 2 | import sys |
---|
| 3 | if sys.platform.count("win32") > 0: |
---|
| 4 | FONT_VARIANT = 0 |
---|
| 5 | PNL_WIDTH = 270 |
---|
| 6 | else: |
---|
| 7 | FONT_VARIANT = 1 |
---|
| 8 | PNL_WIDTH = 300 |
---|
| 9 | |
---|
| 10 | class LabelDialog(wx.Dialog): |
---|
| 11 | def __init__(self, parent, id, title, label): |
---|
| 12 | wx.Dialog.__init__(self, parent, id, title, size=(PNL_WIDTH, 150)) |
---|
| 13 | |
---|
| 14 | #panel = wx.Panel(self, -1) |
---|
| 15 | #Font |
---|
| 16 | self.SetWindowVariant(variant=FONT_VARIANT) |
---|
| 17 | mainbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 18 | vbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 19 | textbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 20 | |
---|
| 21 | text1 = "Enter a new title/label:" |
---|
| 22 | msg = wx.StaticText(self, -1, text1,(30,15), style=wx.ALIGN_LEFT) |
---|
| 23 | msg.SetLabel(text1) |
---|
| 24 | self.myTxtCtrl = wx.TextCtrl(self, -1, '', (200, 30)) |
---|
| 25 | self.myTxtCtrl.SetValue(str(label)) |
---|
| 26 | textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, |
---|
| 27 | border=10, proportion=2) |
---|
| 28 | vbox.Add(msg, flag=wx.ALL, border=10, proportion=1) |
---|
| 29 | vbox.Add(textbox, flag=wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, |
---|
| 30 | border=5) |
---|
| 31 | hbox = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 32 | okButton = wx.Button(self,wx.ID_OK, 'OK', size=(70, 25)) |
---|
| 33 | closeButton = wx.Button(self,wx.ID_CANCEL, 'Cancel', size=(70, 25)) |
---|
| 34 | |
---|
| 35 | hbox.Add(okButton, wx.LEFT, 10) |
---|
| 36 | hbox.Add((20, 20)) |
---|
| 37 | hbox.Add(closeButton, wx.LEFT, 10) |
---|
| 38 | |
---|
| 39 | mainbox.Add(vbox, flag=wx.LEFT, border=5) |
---|
| 40 | mainbox.Add(wx.StaticLine(self), 0, wx.ALL|wx.EXPAND, 5) |
---|
| 41 | mainbox.Add(hbox, flag=wx.CENTER, |
---|
| 42 | border=20) |
---|
| 43 | self.SetSizer(mainbox) |
---|
| 44 | |
---|
| 45 | def getText(self): |
---|
[10bfeb3] | 46 | return self.myTxtCtrl.GetValue() |
---|