source: sasview/sansview/welcome_panel.py @ 9714ff5

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.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 9714ff5 was 657e52c, checked in by Jae Cho <jhjcho@…>, 12 years ago

merging from the release 2.2.0

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[fa597990]1"""
[4851fe9e]2    Welcome page
3   
[fa597990]4"""
5import wx
6import wx.aui
7import wx.lib.hyperlink
8import os.path
9import os, sys
10import local_config as config
11from wx.lib.scrolledpanel import ScrolledPanel
12from sans.guiframe.panel_base import PanelBase
13#Font size width
14if sys.platform.count("win32")>0:
15    FONT_VARIANT = 0
16else:
17    FONT_VARIANT = 1 
18 
19class WelcomePanel(wx.aui.AuiNotebook, PanelBase):
20    """
21        Panel created like about box  as a welcome page
22        Shows product name, current version, authors, and link to the product page.
23    """
24    ## Internal nickname for the window, used by the AUI manager
25    window_name = "default"
26    ## Name to appear on the window title bar
27    window_caption = "Welcome panel"
28    ## Flag to tell the AUI manager to put this panel in the center pane
29    CENTER_PANE = True
30   
31   
[2dda7ae1]32    def __init__(self, parent, *args, **kwds):
[fa597990]33       
34        kwds["style"] = wx.aui.AUI_NB_DEFAULT_STYLE
35       
36        wx.aui.AuiNotebook.__init__(self, parent, *args, **kwds)
37        PanelBase.__init__(self)
[c329f4d]38        #For sasview the parent is guiframe
[fa597990]39        self.parent = parent
40       
41        welcome_page = WelcomePage(self)
42        self.AddPage(page=welcome_page, caption="Welcome")
43       
44        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_page)
45        self.Center()
46   
47    def set_manager(self, manager):
48        """
49            the manager of the panel in this case the application itself
50        """
51        self.manager = manager
52       
53    def on_close_page(self, event):
54        """
55           
56        """
57        if self.parent is not None:
58            self.parent.on_close_welcome_panel()
59        event.Veto() 
60       
[2dda7ae1]61    def set_data(self, list=None):
[fa597990]62        """
63        """
64        pass
65   
66   
67class WelcomePage(ScrolledPanel):
68    """
69        Panel created like about box  as a welcome page
70        Shows product name, current version, authors, and link to the product page.
71    """
72    ## Internal nickname for the window, used by the AUI manager
73    window_name = "default"
74    ## Name to appear on the window title bar
75    window_caption = "Welcome panel"
76    ## Flag to tell the AUI manager to put this panel in the center pane
77    CENTER_PANE = True
78   
79   
80    def __init__(self, parent, *args, **kwds):
[06aa26a5]81        import local_config
[fa597990]82        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
83       
84        ScrolledPanel.__init__(self, parent, **kwds)
85        self.SetupScrolling()
[d4c19e5]86        image = os.path.join(local_config._welcome_image)
[fa597990]87        self.SetWindowVariant(variant = FONT_VARIANT)
88        self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
89       
90        self.label_copyright = wx.StaticText(self, -1, config._copyright)
91        self.static_line_1 = wx.StaticLine(self, -1)
92        self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement)
93       
[2dda7ae1]94        self.hyperlink_license = wx.StaticText(self, -1, 
95                                               "Comments? Bugs? Requests?")
[0b96d74]96        send_ticket = "Send us a ticket at: "
[657e52c]97        send_ticket += "help@sasview.org"
[fa597990]98        self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1,
[0b96d74]99            send_ticket, URL=config._license)
[fa597990]100       
[2dda7ae1]101        self.label_title = wx.StaticText(self, -1, 
102            config.__appname__+ " "+str(config.__version__))
[3bc6090]103        try:
104            build_num = str(config.__build__)
105        except:
106            build_num = str(config.__version__)
107        self.label_build = wx.StaticText(self, -1, "Build: " + build_num)
[fa597990]108     
109        sizer_main = wx.BoxSizer(wx.VERTICAL)
110        sizer_header = wx.BoxSizer(wx.HORIZONTAL)
111        sizer_build = wx.BoxSizer(wx.VERTICAL)
112       
113        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
114       
[2dda7ae1]115        sizer_build.Add(self.label_acknowledgement, 0,
116                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
[fa597990]117        sizer_build.Add((5,5))
[2dda7ae1]118        sizer_build.Add(self.label_title, 0,
119                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
120        sizer_build.Add(self.label_build, 0, 
121                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
122        sizer_build.Add(self.label_copyright, 0,
123                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
124        sizer_build.Add((5, 5))
125        sizer_build.Add(self.hyperlink_license, 0,
126                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
127        sizer_build.Add(self.hyperlink_paper, 0,
128                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
[fa597990]129       
130        sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3)
131        sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0)
[2dda7ae1]132        sizer_main.Add(sizer_build,0 , wx.BOTTOM|wx.EXPAND, 3)
[fa597990]133       
134        self.SetAutoLayout(True)
135        self.SetSizer(sizer_main)
136        self.Fit()
137       
[2dda7ae1]138    def set_data(self, list=None):
[fa597990]139        """
140        """
141        pass
142
143class ViewApp(wx.App):
[2dda7ae1]144    """
145        Test application
146    """
[fa597990]147    def OnInit(self):
148        self.frame = WelcomeFrame(None, -1, "Test App")   
149        self.frame.Show(True)
150        return True
151
152class WelcomeFrame(wx.Frame):
[2dda7ae1]153    """
154        Test frame
155    """
[fa597990]156    def __init__(self, parent, id, title):
157        wx.Frame.__init__(self, parent, id, title, size=(570, 400))
158        WelcomePanel(self)
159        self.Centre()
160        self.Show(True)
161   
162if __name__ == "__main__": 
163    app = ViewApp(0)
164    app.MainLoop()
Note: See TracBrowser for help on using the repository browser.