source: sasview/sansview/welcome_panel.py @ 06aa26a5

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 06aa26a5 was 06aa26a5, checked in by Mathieu Doucet <doucetm@…>, 12 years ago

fix problem with import

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