source: sasview/src/sas/sasgui/plottools/LabelDialog.py @ 14d9c7b

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 14d9c7b was d7bb526, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago

Refactored plottools into sasgui

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import wx
2import sys
3if sys.platform.count("win32") > 0:
4    FONT_VARIANT = 0
5    PNL_WIDTH = 270
6else:
7    FONT_VARIANT = 1
8    PNL_WIDTH = 300
9
10class 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        # Font
15        self.SetWindowVariant(variant=FONT_VARIANT)
16        mainbox = wx.BoxSizer(wx.VERTICAL)
17        vbox = wx.BoxSizer(wx.VERTICAL)
18        textbox = wx.BoxSizer(wx.HORIZONTAL)
19
20        text1 = "Enter a new title/label:"
21        msg = wx.StaticText(self, -1, text1, (30, 15), style=wx.ALIGN_LEFT)
22        msg.SetLabel(text1)
23        self.label_ctrl = wx.TextCtrl(self, -1, '', (200, 30))
24        self.label_ctrl.SetValue(str(label))
25        textbox.Add(self.label_ctrl, flag=wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE,
26                    border=10, proportion=2)
27        vbox.Add(msg, flag=wx.ALL, border=10, proportion=1)
28        vbox.Add(textbox, flag=wx.EXPAND | wx.TOP | wx.BOTTOM | wx.ADJUST_MINSIZE, border=5)
29        hbox = wx.BoxSizer(wx.HORIZONTAL)
30        ok_button = wx.Button(self, wx.ID_OK, 'OK', size=(70, 25))
31        close_button = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25))
32
33        hbox.Add(ok_button, wx.LEFT, 10)
34        hbox.Add((20, 20))
35        hbox.Add(close_button, wx.LEFT, 10)
36
37        mainbox.Add(vbox, flag=wx.LEFT, border=5)
38        mainbox.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5)
39        mainbox.Add(hbox, flag=wx.CENTER, border=20)
40        self.SetSizer(mainbox)
41
42    def getText(self):
43        return self.label_ctrl.GetValue()
Note: See TracBrowser for help on using the repository browser.