source: sasview/src/sas/sasgui/plottools/LabelDialog.py @ 24f6f4a

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 24f6f4a 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
RevLine 
[a9d5684]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
[2df0b74]9
[a9d5684]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
[2df0b74]14        # Font
[a9d5684]15        self.SetWindowVariant(variant=FONT_VARIANT)
16        mainbox = wx.BoxSizer(wx.VERTICAL)
17        vbox = wx.BoxSizer(wx.VERTICAL)
18        textbox = wx.BoxSizer(wx.HORIZONTAL)
[2df0b74]19
[a9d5684]20        text1 = "Enter a new title/label:"
[2df0b74]21        msg = wx.StaticText(self, -1, text1, (30, 15), style=wx.ALIGN_LEFT)
[a9d5684]22        msg.SetLabel(text1)
[2df0b74]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)
[a9d5684]27        vbox.Add(msg, flag=wx.ALL, border=10, proportion=1)
[2df0b74]28        vbox.Add(textbox, flag=wx.EXPAND | wx.TOP | wx.BOTTOM | wx.ADJUST_MINSIZE, border=5)
[a9d5684]29        hbox = wx.BoxSizer(wx.HORIZONTAL)
[2df0b74]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)
[a9d5684]34        hbox.Add((20, 20))
[2df0b74]35        hbox.Add(close_button, wx.LEFT, 10)
[a9d5684]36
37        mainbox.Add(vbox, flag=wx.LEFT, border=5)
[2df0b74]38        mainbox.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5)
39        mainbox.Add(hbox, flag=wx.CENTER, border=20)
[a9d5684]40        self.SetSizer(mainbox)
[2df0b74]41
[a9d5684]42    def getText(self):
[2df0b74]43        return self.label_ctrl.GetValue()
Note: See TracBrowser for help on using the repository browser.