[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 |
---|
[d8161f2] | 13 | from wx.lib.expando import ExpandoTextCtrl |
---|
[f53cd30] | 14 | import random |
---|
| 15 | import os.path |
---|
| 16 | import os |
---|
| 17 | try: |
---|
| 18 | # Try to find a local config |
---|
| 19 | import imp |
---|
| 20 | path = os.getcwd() |
---|
| 21 | if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ |
---|
| 22 | (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): |
---|
| 23 | fObj, path, descr = imp.find_module('local_config', [path]) |
---|
[c8d22ec] | 24 | config = imp.load_module('local_config', fObj, path, descr) |
---|
[f53cd30] | 25 | else: |
---|
| 26 | # Try simply importing local_config |
---|
| 27 | import local_config as config |
---|
| 28 | except: |
---|
[c8d22ec] | 29 | # Didn't find local config, load the default |
---|
[f53cd30] | 30 | import config |
---|
[c8d22ec] | 31 | |
---|
[f53cd30] | 32 | |
---|
| 33 | class DialogAcknowledge(wx.Dialog): |
---|
| 34 | """ |
---|
| 35 | "Acknowledgement" Dialog Box |
---|
[c8d22ec] | 36 | |
---|
[f53cd30] | 37 | Shows the current method for acknowledging SasView in |
---|
| 38 | scholarly publications. |
---|
| 39 | """ |
---|
[c8d22ec] | 40 | |
---|
[f53cd30] | 41 | def __init__(self, *args, **kwds): |
---|
[c8d22ec] | 42 | |
---|
[f53cd30] | 43 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
---|
| 44 | wx.Dialog.__init__(self, *args, **kwds) |
---|
[c8d22ec] | 45 | |
---|
[d8161f2] | 46 | self.ack = ExpandoTextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL) |
---|
[f53cd30] | 47 | self.ack.SetValue(config._acknowledgement_publications) |
---|
[d8161f2] | 48 | #self.ack.SetMinSize((-1, 55)) |
---|
| 49 | self.citation = ExpandoTextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL) |
---|
| 50 | self.citation.SetValue(config._acknowledgement_citation) |
---|
[f53cd30] | 51 | self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble) |
---|
[0ea31ca] | 52 | items = [config._acknowledgement_preamble_bullet1, |
---|
| 53 | config._acknowledgement_preamble_bullet2, |
---|
[c8d22ec] | 54 | config._acknowledgement_preamble_bullet3, |
---|
| 55 | config._acknowledgement_preamble_bullet4] |
---|
[e11ee1d] | 56 | self.list1 = wx.StaticText(self, -1, "(1) " + items[0]) |
---|
| 57 | self.list2 = wx.StaticText(self, -1, "(2) " + items[1]) |
---|
| 58 | self.list3 = wx.StaticText(self, -1, "(3) " + items[2]) |
---|
| 59 | self.list4 = wx.StaticText(self, -1, "(4) " + items[3]) |
---|
[f53cd30] | 60 | self.static_line = wx.StaticLine(self, 0) |
---|
| 61 | self.__set_properties() |
---|
| 62 | self.__do_layout() |
---|
[c8d22ec] | 63 | |
---|
[f53cd30] | 64 | def __set_properties(self): |
---|
| 65 | """ |
---|
[c8d22ec] | 66 | :TODO - add method documentation |
---|
[f53cd30] | 67 | """ |
---|
| 68 | # begin wxGlade: DialogAbout.__set_properties |
---|
[0ea31ca] | 69 | self.preamble.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
| 70 | self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
[f53cd30] | 71 | self.SetTitle("Acknowledging SasView") |
---|
[c1fdf84] | 72 | #Increased size of box from (525, 225), SMK, 04/10/16 |
---|
[e11ee1d] | 73 | self.SetSize((600, 320)) |
---|
[f53cd30] | 74 | # end wxGlade |
---|
| 75 | |
---|
| 76 | def __do_layout(self): |
---|
| 77 | """ |
---|
[c8d22ec] | 78 | :TODO - add method documentation |
---|
[f53cd30] | 79 | """ |
---|
| 80 | # begin wxGlade: DialogAbout.__do_layout |
---|
| 81 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
| 82 | sizer_titles = wx.BoxSizer(wx.VERTICAL) |
---|
[0ea31ca] | 83 | sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 84 | sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5) |
---|
[d8161f2] | 85 | sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5) |
---|
[0ea31ca] | 86 | sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5) |
---|
[d8161f2] | 87 | sizer_titles.Add(self.citation, 0, wx.ALL|wx.EXPAND, 5) |
---|
[0ea31ca] | 88 | sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5) |
---|
[d8161f2] | 89 | #sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0) |
---|
[c8d22ec] | 90 | sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5) |
---|
[f53cd30] | 91 | sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5) |
---|
| 92 | self.SetAutoLayout(True) |
---|
| 93 | self.SetSizer(sizer_main) |
---|
| 94 | self.Layout() |
---|
| 95 | self.Centre() |
---|
| 96 | # end wxGlade |
---|
[c8d22ec] | 97 | |
---|
[f53cd30] | 98 | |
---|
| 99 | ##### testing code ############################################################ |
---|
| 100 | class MyApp(wx.App): |
---|
| 101 | """ |
---|
[c8d22ec] | 102 | Class for running module as stand alone for testing |
---|
[f53cd30] | 103 | """ |
---|
| 104 | def OnInit(self): |
---|
| 105 | """ |
---|
[c8d22ec] | 106 | Defines an init when running as standalone |
---|
[f53cd30] | 107 | """ |
---|
| 108 | wx.InitAllImageHandlers() |
---|
| 109 | dialog = DialogAcknowledge(None, -1, "") |
---|
| 110 | self.SetTopWindow(dialog) |
---|
| 111 | dialog.ShowModal() |
---|
| 112 | dialog.Destroy() |
---|
| 113 | return 1 |
---|
| 114 | |
---|
| 115 | # end of class MyApp |
---|
| 116 | |
---|
| 117 | if __name__ == "__main__": |
---|
| 118 | app = MyApp(0) |
---|
[c8d22ec] | 119 | app.MainLoop() |
---|