source: sasview/guiframe/welcome_panel.py @ 18a3ee9

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 18a3ee9 was 25c8653, checked in by Jae Cho <jhjcho@…>, 16 years ago

fixed loading welcome image

  • Property mode set to 100644
File size: 4.8 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
[25c8653]69        image = file_dir+"\images\SVwelcome.png"
[09d8c94]70       
[895e04d7]71        if os.path.isfile(config._welcome_image):
72            image = config._welcome_image     
73               
[09d8c94]74        if os.name == 'nt':
75            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
76        else:
77            self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image))
78       
79        self.label_copyright = wx.StaticText(self, -1, config._copyright)
80       
81        self.static_line_1 = wx.StaticLine(self, -1)
82        self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement)
83     
84
85       
86
87        # end wxGlade
88   
89#     
90        # randomly shuffle authors' names
91        random.shuffle(config._authors)
92        strLabel = ", ".join(config._authors)
93       
94        # display version and svn revison numbers
95        verwords = config.__version__.split('.')
96        version = '.'.join(verwords[:-1])
97        revision = verwords[-1]
98        self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(version))
99        self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__))
100     
101     
102        # resize dialog window to fit version number nicely
103        if wx.VERSION >= (2,7,2,0):
104            size = [self.GetEffectiveMinSize()[0], self.GetSize()[1]]
105        else:
106            size = [self.GetBestFittingSize()[0], self.GetSize()[1]]
107        self.__do_layout()
108        self.Fit()
109
110
111
112    def __do_layout(self):
113        # begin wxGlade: DialogAbout.__do_layout
114        sizer_main = wx.BoxSizer(wx.VERTICAL)
115        sizer_header = wx.BoxSizer(wx.HORIZONTAL)
116        sizer_build = wx.GridBagSizer(0,0)
117       
118       
119        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
120       
121        ix = 0
122        iy = 0
123        sizer_build.Add((20,20),(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
124        iy +=1
125        sizer_build.Add(self.label_acknowledgement,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
126        iy +=1
127        sizer_build.Add(self.label_title ,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
128        ix = 0
129        iy +=1
130        sizer_build.Add(self.label_build,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
131        ix = 0
132        iy +=1
133        sizer_build.Add( self.label_copyright,(iy,ix),(1,1),wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
134       
135        sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3)
136        sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0)
137        sizer_main.Add(sizer_build,0, wx.BOTTOM|wx.EXPAND, 3)
138     
139       
140        self.SetAutoLayout(True)
141        self.SetSizer(sizer_main)
142        self.Layout()
143        self.Centre()
144        # end wxGlade
145
146   
147
148# end of class DialogAbout
149
Note: See TracBrowser for help on using the repository browser.