source: sasview/sansview/perspectives/splashinfo/welcome_panel.py @ 4994051

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

add splash page at the top level

  • Property mode set to 100644
File size: 5.6 KB
Line 
1#!/usr/bin/env python
2########################################################################
3#
4# PDFgui            by DANSE Diffraction group
5#                   Simon J. L. Billinge
6#                   (c) 2006 trustees of the Michigan State University.
7#                   All rights reserved.
8#
9# File coded by:    Dmitriy Bryndin
10#
11# See AUTHORS.txt for a list of people who contributed.
12# See LICENSE.txt for license information.
13#
14# Modified by U. Tennessee for DANSE/SANS
15########################################################################
16
17# version
18__id__ = "$Id: aboutdialog.py 1193 2007-05-03 17:29:59Z dmitriy $"
19__revision__ = "$Revision: 1193 $"
20
21import wx
22import wx.lib.hyperlink
23import random
24import os.path
25import os
26try:
27    # Try to find a local config
28    import imp
29    path = os.getcwd()
30    if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \
31      (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))):
32            fObj, path, descr = imp.find_module('local_config', [path])
33            config = imp.load_module('local_config', fObj, path, descr) 
34    else:
35        # Try simply importing local_config
36        import local_config as config
37except:
38    # Didn't find local config, load the default
39    import config
40
41def launchBrowser(url):
42    '''Launches browser and opens specified url
43   
44    In some cases may require BROWSER environment variable to be set up.
45   
46    @param url: URL to open
47    '''
48    import webbrowser
49    webbrowser.open(url)
50
51
52class PanelAbout(wx.Panel):
53    """
54    Panel created like about box  as a welcome page
55    Shows product name, current version, authors, and link to the product page.
56    Current version is taken from version.py
57    """
58    ## Internal name for the AUI manager
59    window_name = "Welcome panel"
60    ## Title to appear on top of the window
61    window_caption = "Default Panel "
62    CENTER_PANE = True
63 
64    def __init__(self, *args, **kwds):
65
66        # begin wxGlade: DialogAbout.__init__
67        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
68       
69        wx.Panel.__init__(self, *args, **kwds)
70       
71        file_dir = os.path.dirname(__file__)
72       
73        # Mac doesn't display images with transparent background so well, keep it for Windows
74        image = file_dir+"\images\SVwelcome.png"
75       
76        if os.path.isfile(config._welcome_image):
77            image = config._welcome_image     
78               
79        if os.name == 'nt':
80            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
81        else:
82            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
83       
84        self.label_copyright = wx.StaticText(self, -1, config._copyright)
85       
86        self.static_line_1 = wx.StaticLine(self, -1)
87        self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement)
88       
89        self.hyperlink_license = wx.StaticText(self, -1, "Comments? Bugs? Requests?")
90        self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1,
91                                         "Send us a ticket",URL=config._license)
92        # end wxGlade
93       
94#     
95        # randomly shuffle authors' names
96        random.shuffle(config._authors)
97        strLabel = ", ".join(config._authors)
98       
99        # display version and svn revison numbers
100        verwords = config.__version__.split('.')
101        version = '.'.join(verwords[:-1])
102        revision = verwords[-1]
103        self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(config.__version__))#(version))
104        self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__))
105     
106     
107        # resize dialog window to fit version number nicely
108        if wx.VERSION >= (2,7,2,0):
109            size = [self.GetEffectiveMinSize()[0], self.GetSize()[1]]
110        else:
111            size = [self.GetBestFittingSize()[0], self.GetSize()[1]]
112        self.__do_layout()
113        self.Fit()
114
115
116
117    def __do_layout(self):
118        # begin wxGlade: DialogAbout.__do_layout
119        sizer_main = wx.BoxSizer(wx.VERTICAL)
120        sizer_header = wx.BoxSizer(wx.HORIZONTAL)
121        sizer_build = wx.BoxSizer(wx.VERTICAL)
122       
123       
124        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
125       
126       
127        sizer_build.Add(self.label_acknowledgement,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
128        sizer_build.Add((5,5))
129        sizer_build.Add(self.label_title ,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
130        sizer_build.Add(self.label_build,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
131        sizer_build.Add( self.label_copyright,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
132        sizer_build.Add((5,5))
133        sizer_build.Add( self.hyperlink_license,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
134        sizer_build.Add( self.hyperlink_paper,0,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       
141        self.SetAutoLayout(True)
142        self.SetSizer(sizer_main)
143        self.Layout()
144        self.Centre()
145        # end wxGlade
146
147   
148
149# end of class DialogAbout
150class HelpWindow(wx.Frame):
151    def __init__(self, parent, id, title):
152        wx.Frame.__init__(self, parent, id, title, size=(570, 400))
153       
154       
155        self.page = PanelAbout(self)
156       
157        self.Centre()
158        self.Show(True)
159
160
161   
162if __name__=="__main__":
163    app = wx.App()
164    HelpWindow(None, -1, 'HelpWindow')
165    app.MainLoop()
166       
Note: See TracBrowser for help on using the repository browser.