source: sasview/sansview/welcome_panel.py @ 4851fe9e

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 4851fe9e was 4851fe9e, checked in by Jae Cho <jhjcho@…>, 12 years ago

trying to find pylint violation on this line

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