[f53cd30] | 1 | ''' |
---|
| 2 | Created on Feb 18, 2015 |
---|
| 3 | |
---|
| 4 | @author: jkrzywon |
---|
| 5 | ''' |
---|
| 6 | |
---|
| 7 | __id__ = "$Id: acknoweldgebox.py 2015-18-02 jkrzywon $" |
---|
| 8 | __revision__ = "$Revision: 1193 $" |
---|
| 9 | |
---|
| 10 | import wx |
---|
[0ea31ca] | 11 | import wx.richtext |
---|
[f53cd30] | 12 | import wx.lib.hyperlink |
---|
| 13 | import random |
---|
| 14 | import os.path |
---|
| 15 | import os |
---|
| 16 | try: |
---|
| 17 | # Try to find a local config |
---|
| 18 | import imp |
---|
| 19 | path = os.getcwd() |
---|
| 20 | if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ |
---|
| 21 | (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): |
---|
| 22 | fObj, path, descr = imp.find_module('local_config', [path]) |
---|
| 23 | config = imp.load_module('local_config', fObj, path, descr) |
---|
| 24 | else: |
---|
| 25 | # Try simply importing local_config |
---|
| 26 | import local_config as config |
---|
| 27 | except: |
---|
| 28 | # Didn't find local config, load the default |
---|
| 29 | import config |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | class DialogAcknowledge(wx.Dialog): |
---|
| 33 | """ |
---|
| 34 | "Acknowledgement" Dialog Box |
---|
| 35 | |
---|
| 36 | Shows the current method for acknowledging SasView in |
---|
| 37 | scholarly publications. |
---|
| 38 | |
---|
| 39 | """ |
---|
| 40 | |
---|
| 41 | def __init__(self, *args, **kwds): |
---|
| 42 | |
---|
| 43 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
---|
| 44 | wx.Dialog.__init__(self, *args, **kwds) |
---|
| 45 | |
---|
| 46 | self.ack = wx.TextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL) |
---|
| 47 | self.ack.SetValue(config._acknowledgement_publications) |
---|
[0ea31ca] | 48 | self.ack.SetMinSize((-1,55)) |
---|
[f53cd30] | 49 | self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble) |
---|
[0ea31ca] | 50 | items = [config._acknowledgement_preamble_bullet1, |
---|
| 51 | config._acknowledgement_preamble_bullet2, |
---|
| 52 | config._acknowledgement_preamble_bullet3] |
---|
| 53 | self.list1 = wx.StaticText(self, -1, "\t(1) " + items[0]) |
---|
| 54 | self.list2 = wx.StaticText(self, -1, "\t(2) " + items[1]) |
---|
| 55 | self.list3 = wx.StaticText(self, -1, "\t(3) " + items[2]) |
---|
[f53cd30] | 56 | self.static_line = wx.StaticLine(self, 0) |
---|
| 57 | self.__set_properties() |
---|
| 58 | self.__do_layout() |
---|
| 59 | |
---|
| 60 | def __set_properties(self): |
---|
| 61 | """ |
---|
| 62 | """ |
---|
| 63 | # begin wxGlade: DialogAbout.__set_properties |
---|
[0ea31ca] | 64 | self.preamble.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
| 65 | self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
[f53cd30] | 66 | self.SetTitle("Acknowledging SasView") |
---|
[0ea31ca] | 67 | self.SetSize((525, 225)) |
---|
[f53cd30] | 68 | # end wxGlade |
---|
| 69 | |
---|
| 70 | def __do_layout(self): |
---|
| 71 | """ |
---|
| 72 | """ |
---|
| 73 | # begin wxGlade: DialogAbout.__do_layout |
---|
| 74 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
| 75 | sizer_titles = wx.BoxSizer(wx.VERTICAL) |
---|
[0ea31ca] | 76 | sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 77 | sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 78 | sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 79 | sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 80 | sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0) |
---|
| 81 | sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5) |
---|
[f53cd30] | 82 | sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5) |
---|
| 83 | self.SetAutoLayout(True) |
---|
| 84 | self.SetSizer(sizer_main) |
---|
| 85 | self.Layout() |
---|
| 86 | self.Centre() |
---|
| 87 | # end wxGlade |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | ##### testing code ############################################################ |
---|
| 91 | class MyApp(wx.App): |
---|
| 92 | """ |
---|
| 93 | """ |
---|
| 94 | def OnInit(self): |
---|
| 95 | """ |
---|
| 96 | """ |
---|
| 97 | wx.InitAllImageHandlers() |
---|
| 98 | dialog = DialogAcknowledge(None, -1, "") |
---|
| 99 | self.SetTopWindow(dialog) |
---|
| 100 | dialog.ShowModal() |
---|
| 101 | dialog.Destroy() |
---|
| 102 | return 1 |
---|
| 103 | |
---|
| 104 | # end of class MyApp |
---|
| 105 | |
---|
| 106 | if __name__ == "__main__": |
---|
| 107 | app = MyApp(0) |
---|
| 108 | app.MainLoop() |
---|