source: sasview/sansview/welcome_panel.py @ 629e8b9

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 629e8b9 was 9455d77, checked in by Gervaise Alina <gervyh@…>, 15 years ago

working on the close welcome page

  • Property mode set to 100644
File size: 5.3 KB
Line 
1"""
2    Welcome panel for SansView
3"""
4"""
5This software was developed by the University of Tennessee as part of the
6Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
7project funded by the US National Science Foundation.
8
9See the license text in license.txt
10
11copyright 2009, University of Tennessee
12"""
13
14import wx
15import wx.aui
16import wx.lib.hyperlink
17import os.path
18import os, sys
19import local_config as config
20
21#Font size width
22if sys.platform.count("win32")>0:
23    FONT_VARIANT = 0
24else:
25    FONT_VARIANT = 1 
26 
27class WelcomePanel(wx.aui.AuiNotebook):
28    """
29        Panel created like about box  as a welcome page
30        Shows product name, current version, authors, and link to the product page.
31    """
32    ## Internal nickname for the window, used by the AUI manager
33    window_name = "default"
34    ## Name to appear on the window title bar
35    window_caption = "Welcome panel"
36    ## Flag to tell the AUI manager to put this panel in the center pane
37    CENTER_PANE = True
38   
39   
40    def __init__(self,parent,manager=None, *args, **kwds):
41       
42        kwds["style"] = wx.aui.AUI_NB_DEFAULT_STYLE
43       
44        wx.aui.AuiNotebook.__init__(self, parent, *args, **kwds)
45        #For sansview the parent is guiframe
46        self.parent = parent
47        #For sansview the manager is sansview application
48        self.manager = manager
49        welcome_page = WelcomePage(self)
50        self.AddPage(page=welcome_page, caption="Welcome")
51       
52        pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE
53        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_page)
54        self.Center()
55   
56    def set_manager(self, manager):
57        """
58            the manager of the panel in this case the application itself
59        """
60        self.manager = manager
61       
62    def on_close_page(self, event):
63        """
64           
65        """
66        if self.parent is not None:
67            self.parent.on_close_welcome_panel()
68        if self.manager is not None:
69            self.manager.on_close_welcome_panel()
70        event.Veto() 
71   
72class WelcomePage(wx.Panel):
73    """
74        Panel created like about box  as a welcome page
75        Shows product name, current version, authors, and link to the product page.
76    """
77    ## Internal nickname for the window, used by the AUI manager
78    window_name = "default"
79    ## Name to appear on the window title bar
80    window_caption = "Welcome panel"
81    ## Flag to tell the AUI manager to put this panel in the center pane
82    CENTER_PANE = True
83   
84   
85    def __init__(self, *args, **kwds):
86
87        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
88       
89        wx.Panel.__init__(self, *args, **kwds)
90       
91        image = os.path.join("images","SVwelcome.png")
92       
93        self.SetWindowVariant(variant = FONT_VARIANT)
94        self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
95       
96        self.label_copyright = wx.StaticText(self, -1, config._copyright)
97        self.static_line_1 = wx.StaticLine(self, -1)
98        self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement)
99       
100        self.hyperlink_license = wx.StaticText(self, -1, "Comments? Bugs? Requests?")
101        self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1,
102                                         "Send us a ticket",URL=config._license)
103       
104        verwords = config.__version__.split('.')
105        version = '.'.join(verwords[:-1])
106        revision = verwords[-1]
107        self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(config.__version__))#(version))
108        self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__))
109     
110        sizer_main = wx.BoxSizer(wx.VERTICAL)
111        sizer_header = wx.BoxSizer(wx.HORIZONTAL)
112        sizer_build = wx.BoxSizer(wx.VERTICAL)
113       
114        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
115       
116        sizer_build.Add(self.label_acknowledgement,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
117        sizer_build.Add((5,5))
118        sizer_build.Add(self.label_title ,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
119        sizer_build.Add(self.label_build,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
120        sizer_build.Add( self.label_copyright,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
121        sizer_build.Add((5,5))
122        sizer_build.Add( self.hyperlink_license,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
123        sizer_build.Add( self.hyperlink_paper,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
124       
125        sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3)
126        sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0)
127        sizer_main.Add(sizer_build,0, wx.BOTTOM|wx.EXPAND, 3)
128       
129        self.SetAutoLayout(True)
130        self.SetSizer(sizer_main)
131        self.Fit()
132
133
134class ViewApp(wx.App):
135    def OnInit(self):
136        self.frame = WelcomeFrame(None, -1, "Test App")   
137        self.frame.Show(True)
138        return True
139
140class WelcomeFrame(wx.Frame):
141    def __init__(self, parent, id, title):
142        wx.Frame.__init__(self, parent, id, title, size=(570, 400))
143        WelcomePanel(self)
144        self.Centre()
145        self.Show(True)
146   
147if __name__ == "__main__": 
148    app = ViewApp(0)
149    app.MainLoop()
Note: See TracBrowser for help on using the repository browser.