source: sasview/sansview/perspectives/fitting/welcome_panel.py @ 7a4401e

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 7a4401e was 1328e03, checked in by Gervaise Alina <gervyh@…>, 16 years ago

removing all codes.and add highlight for textcrtl

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[823905f]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   
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.path.isfile(config._welcome_image):
72            image = config._welcome_image     
73               
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)
[1328e03]83       
84        self.hyperlink_license = wx.StaticText(self, -1, "Comments? Bugs? Requests?")
85        self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1,
86                                         "Send us a ticket",URL=config._license)
[823905f]87        # end wxGlade
[1328e03]88       
[823905f]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)
[1328e03]116        sizer_build = wx.BoxSizer(wx.VERTICAL)
[823905f]117       
118       
119        sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5)
120       
[1328e03]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) 
[823905f]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       
136        self.SetAutoLayout(True)
137        self.SetSizer(sizer_main)
138        self.Layout()
139        self.Centre()
140        # end wxGlade
141
142   
143
144# end of class DialogAbout
[1328e03]145class HelpWindow(wx.Frame):
146    def __init__(self, parent, id, title):
147        wx.Frame.__init__(self, parent, id, title, size=(570, 400))
148       
149       
150        self.page = PanelAbout(self)
151       
152        self.Centre()
153        self.Show(True)
154
[823905f]155
[1328e03]156   
157if __name__=="__main__":
158    app = wx.App()
159    HelpWindow(None, -1, 'HelpWindow')
160    app.MainLoop()
161       
Note: See TracBrowser for help on using the repository browser.