[e2da832] | 1 | """ |
---|
| 2 | Welcome panel for SansView |
---|
| 3 | """ |
---|
| 4 | """ |
---|
| 5 | This software was developed by the University of Tennessee as part of the |
---|
| 6 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 7 | project funded by the US National Science Foundation. |
---|
| 8 | |
---|
| 9 | See the license text in license.txt |
---|
| 10 | |
---|
| 11 | copyright 2009, University of Tennessee |
---|
| 12 | """ |
---|
| 13 | |
---|
| 14 | import wx |
---|
| 15 | import wx.lib.hyperlink |
---|
| 16 | import os.path |
---|
[f1aa385] | 17 | import os, sys |
---|
[e2da832] | 18 | import local_config as config |
---|
| 19 | |
---|
[f1aa385] | 20 | #Font size width |
---|
| 21 | if sys.platform.count("win32")>0: |
---|
| 22 | FONT_VARIANT = 0 |
---|
| 23 | else: |
---|
| 24 | FONT_VARIANT = 1 |
---|
| 25 | |
---|
[e2da832] | 26 | class WelcomePanel(wx.Panel): |
---|
| 27 | """ |
---|
| 28 | Panel created like about box as a welcome page |
---|
| 29 | Shows product name, current version, authors, and link to the product page. |
---|
| 30 | """ |
---|
| 31 | ## Internal nickname for the window, used by the AUI manager |
---|
| 32 | window_name = "default" |
---|
| 33 | ## Name to appear on the window title bar |
---|
| 34 | window_caption = "Welcome panel" |
---|
| 35 | ## Flag to tell the AUI manager to put this panel in the center pane |
---|
| 36 | CENTER_PANE = True |
---|
[f1aa385] | 37 | |
---|
[e2da832] | 38 | |
---|
| 39 | def __init__(self, *args, **kwds): |
---|
| 40 | |
---|
| 41 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
---|
| 42 | |
---|
| 43 | wx.Panel.__init__(self, *args, **kwds) |
---|
| 44 | |
---|
[ea2aa224] | 45 | image = os.path.join("images","SVwelcome.png") |
---|
[e2da832] | 46 | |
---|
[f1aa385] | 47 | self.SetWindowVariant(variant = FONT_VARIANT) |
---|
[e2da832] | 48 | self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image)) |
---|
| 49 | |
---|
| 50 | self.label_copyright = wx.StaticText(self, -1, config._copyright) |
---|
| 51 | self.static_line_1 = wx.StaticLine(self, -1) |
---|
| 52 | self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement) |
---|
| 53 | |
---|
| 54 | self.hyperlink_license = wx.StaticText(self, -1, "Comments? Bugs? Requests?") |
---|
| 55 | self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1, |
---|
| 56 | "Send us a ticket",URL=config._license) |
---|
| 57 | |
---|
| 58 | verwords = config.__version__.split('.') |
---|
| 59 | version = '.'.join(verwords[:-1]) |
---|
| 60 | revision = verwords[-1] |
---|
| 61 | self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(config.__version__))#(version)) |
---|
| 62 | self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__)) |
---|
| 63 | |
---|
| 64 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
| 65 | sizer_header = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 66 | sizer_build = wx.BoxSizer(wx.VERTICAL) |
---|
| 67 | |
---|
| 68 | sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5) |
---|
| 69 | |
---|
| 70 | sizer_build.Add(self.label_acknowledgement,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 71 | sizer_build.Add((5,5)) |
---|
| 72 | sizer_build.Add(self.label_title ,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 73 | sizer_build.Add(self.label_build,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 74 | sizer_build.Add( self.label_copyright,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 75 | sizer_build.Add((5,5)) |
---|
| 76 | sizer_build.Add( self.hyperlink_license,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 77 | sizer_build.Add( self.hyperlink_paper,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 78 | |
---|
| 79 | sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3) |
---|
| 80 | sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0) |
---|
| 81 | sizer_main.Add(sizer_build,0, wx.BOTTOM|wx.EXPAND, 3) |
---|
| 82 | |
---|
| 83 | self.SetAutoLayout(True) |
---|
| 84 | self.SetSizer(sizer_main) |
---|
| 85 | self.Fit() |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | class ViewApp(wx.App): |
---|
| 89 | def OnInit(self): |
---|
| 90 | self.frame = WelcomeFrame(None, -1, "Test App") |
---|
| 91 | self.frame.Show(True) |
---|
| 92 | return True |
---|
| 93 | |
---|
| 94 | class WelcomeFrame(wx.Frame): |
---|
| 95 | def __init__(self, parent, id, title): |
---|
| 96 | wx.Frame.__init__(self, parent, id, title, size=(570, 400)) |
---|
| 97 | WelcomePanel(self) |
---|
| 98 | self.Centre() |
---|
| 99 | self.Show(True) |
---|
| 100 | |
---|
| 101 | if __name__ == "__main__": |
---|
| 102 | app = ViewApp(0) |
---|
| 103 | app.MainLoop() |
---|