[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 |
---|
| 17 | import os |
---|
| 18 | |
---|
| 19 | import local_config as config |
---|
| 20 | |
---|
| 21 | class WelcomePanel(wx.Panel): |
---|
| 22 | """ |
---|
| 23 | Panel created like about box as a welcome page |
---|
| 24 | Shows product name, current version, authors, and link to the product page. |
---|
| 25 | """ |
---|
| 26 | ## Internal nickname for the window, used by the AUI manager |
---|
| 27 | window_name = "default" |
---|
| 28 | ## Name to appear on the window title bar |
---|
| 29 | window_caption = "Welcome panel" |
---|
| 30 | ## Flag to tell the AUI manager to put this panel in the center pane |
---|
| 31 | CENTER_PANE = True |
---|
| 32 | |
---|
| 33 | def __init__(self, *args, **kwds): |
---|
| 34 | |
---|
| 35 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
---|
| 36 | |
---|
| 37 | wx.Panel.__init__(self, *args, **kwds) |
---|
| 38 | |
---|
| 39 | image = "images\SVwelcome.png" |
---|
| 40 | |
---|
| 41 | self.bitmap_logo = wx.StaticBitmap(self, -1, wx.Bitmap(image)) |
---|
| 42 | |
---|
| 43 | self.label_copyright = wx.StaticText(self, -1, config._copyright) |
---|
| 44 | self.static_line_1 = wx.StaticLine(self, -1) |
---|
| 45 | self.label_acknowledgement = wx.StaticText(self, -1, config._acknowledgement) |
---|
| 46 | |
---|
| 47 | self.hyperlink_license = wx.StaticText(self, -1, "Comments? Bugs? Requests?") |
---|
| 48 | self.hyperlink_paper = wx.lib.hyperlink.HyperLinkCtrl(self, -1, |
---|
| 49 | "Send us a ticket",URL=config._license) |
---|
| 50 | |
---|
| 51 | verwords = config.__version__.split('.') |
---|
| 52 | version = '.'.join(verwords[:-1]) |
---|
| 53 | revision = verwords[-1] |
---|
| 54 | self.label_title = wx.StaticText(self, -1, config.__appname__+ " "+str(config.__version__))#(version)) |
---|
| 55 | self.label_build = wx.StaticText(self, -1, "Build: "+str(config.__version__)) |
---|
| 56 | |
---|
| 57 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
| 58 | sizer_header = wx.BoxSizer(wx.HORIZONTAL) |
---|
| 59 | sizer_build = wx.BoxSizer(wx.VERTICAL) |
---|
| 60 | |
---|
| 61 | sizer_header.Add(self.bitmap_logo, 0, wx.EXPAND|wx.LEFT, 5) |
---|
| 62 | |
---|
| 63 | sizer_build.Add(self.label_acknowledgement,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 64 | sizer_build.Add((5,5)) |
---|
| 65 | sizer_build.Add(self.label_title ,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 66 | sizer_build.Add(self.label_build,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 67 | sizer_build.Add( self.label_copyright,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 68 | sizer_build.Add((5,5)) |
---|
| 69 | sizer_build.Add( self.hyperlink_license,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 70 | sizer_build.Add( self.hyperlink_paper,0,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 71 | |
---|
| 72 | sizer_main.Add(sizer_header, 0, wx.TOP|wx.EXPAND, 3) |
---|
| 73 | sizer_main.Add(self.static_line_1, 0, wx.EXPAND, 0) |
---|
| 74 | sizer_main.Add(sizer_build,0, wx.BOTTOM|wx.EXPAND, 3) |
---|
| 75 | |
---|
| 76 | self.SetAutoLayout(True) |
---|
| 77 | self.SetSizer(sizer_main) |
---|
| 78 | self.Fit() |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | class ViewApp(wx.App): |
---|
| 82 | def OnInit(self): |
---|
| 83 | self.frame = WelcomeFrame(None, -1, "Test App") |
---|
| 84 | self.frame.Show(True) |
---|
| 85 | return True |
---|
| 86 | |
---|
| 87 | class WelcomeFrame(wx.Frame): |
---|
| 88 | def __init__(self, parent, id, title): |
---|
| 89 | wx.Frame.__init__(self, parent, id, title, size=(570, 400)) |
---|
| 90 | WelcomePanel(self) |
---|
| 91 | self.Centre() |
---|
| 92 | self.Show(True) |
---|
| 93 | |
---|
| 94 | if __name__ == "__main__": |
---|
| 95 | app = ViewApp(0) |
---|
| 96 | app.MainLoop() |
---|