source: sasview/sansview/welcome_panel.py @ f5bdb4a

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 f5bdb4a was 60642b4, checked in by Gervaise Alina <gervyh@…>, 14 years ago

remove unused log message

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