source: sasview/guiframe/welcome_panel.py @ 6d07882a

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 6d07882a was 09d8c94, checked in by Gervaise Alina <gervyh@…>, 16 years ago

welcomed page moved back to guiframe

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[09d8c94]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    '''"About" Dialog
54   
55    Shows product name, current version, authors, and link to the product page.
56    Current version is taken from version.py
57    '''
58   
59    def __init__(self, *args, **kwds):
60
61        # begin wxGlade: DialogAbout.__init__
62        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
63       
64        wx.Panel.__init__(self, *args, **kwds)
65       
66        file_dir = os.path.dirname(__file__)
67       
68        # Mac doesn't display images with transparent background so well, keep it for Windows
69        image = file_dir+"/images/SVwelcome.png"
70       
71        if os.name == 'nt':
72            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
73        else:
74            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
75       
76        self.label_copyright = wx.StaticText(self, -1, config._copyright)
77       
78        self.static_line_1 = wx.StaticLine(self, -1)
79        self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement)
80     
81
82       
83
84        # end wxGlade
85   
86#     
87        # randomly shuffle authors' names
88        random.shuffle(config._authors)
89        strLabel = ", ".join(config._authors)
90       
91        # display version and svn revison numbers
92        verwords = config.__version__.split('.')
93        version = '.'.join(verwords[:-1])
94        revision = verwords[-1]
95        self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(version))
96        self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__))
97     
98     
99        # resize dialog window to fit version number nicely
100        if wx.VERSION >= (2,7,2,0):
101            size = [self.GetEffectiveMinSize()[0], self.GetSize()[1]]
102        else:
103            size = [self.GetBestFittingSize()[0], self.GetSize()[1]]
104        self.__do_layout()
105        self.Fit()
106
107
108
109    def __do_layout(self):
110        # begin wxGlade: DialogAbout.__do_layout
111        sizer_main = wx.BoxSizer(wx.VERTICAL)
112        sizer_header = wx.BoxSizer(wx.HORIZONTAL)
113        sizer_build = wx.GridBagSizer(0,0)
114       
115       
116        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
117       
118        ix = 0
119        iy = 0
120        sizer_build.Add((20,20),(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
121        iy +=1
122        sizer_build.Add(self.label_acknowledgement,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
123        iy +=1
124        sizer_build.Add(self.label_title ,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
125        ix = 0
126        iy +=1
127        sizer_build.Add(self.label_build,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
128        ix = 0
129        iy +=1
130        sizer_build.Add( self.label_copyright,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
131       
132        sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3)
133        sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0)
134        sizer_main.Add(sizer_build,0, wx.BOTTOM|wx.EXPAND, 3)
135     
136       
137        self.SetAutoLayout(True)
138        self.SetSizer(sizer_main)
139        self.Layout()
140        self.Centre()
141        # end wxGlade
142
143   
144
145# end of class DialogAbout
146
Note: See TracBrowser for help on using the repository browser.