[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]) |
---|
[c8d22ec] | 23 | config = imp.load_module('local_config', fObj, path, descr) |
---|
[f53cd30] | 24 | else: |
---|
| 25 | # Try simply importing local_config |
---|
| 26 | import local_config as config |
---|
| 27 | except: |
---|
[c8d22ec] | 28 | # Didn't find local config, load the default |
---|
[f53cd30] | 29 | import config |
---|
[c8d22ec] | 30 | |
---|
[f53cd30] | 31 | |
---|
| 32 | class DialogAcknowledge(wx.Dialog): |
---|
| 33 | """ |
---|
| 34 | "Acknowledgement" Dialog Box |
---|
[c8d22ec] | 35 | |
---|
[f53cd30] | 36 | Shows the current method for acknowledging SasView in |
---|
| 37 | scholarly publications. |
---|
[c8d22ec] | 38 | |
---|
[f53cd30] | 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 | |
---|
[f53cd30] | 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) |
---|
[c8d22ec] | 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, |
---|
[c8d22ec] | 52 | config._acknowledgement_preamble_bullet3, |
---|
| 53 | config._acknowledgement_preamble_bullet4] |
---|
[0ea31ca] | 54 | self.list1 = wx.StaticText(self, -1, "\t(1) " + items[0]) |
---|
| 55 | self.list2 = wx.StaticText(self, -1, "\t(2) " + items[1]) |
---|
| 56 | self.list3 = wx.StaticText(self, -1, "\t(3) " + items[2]) |
---|
[c8d22ec] | 57 | self.list4 = wx.StaticText(self, -1, "\t(4) " + items[3]) |
---|
[f53cd30] | 58 | self.static_line = wx.StaticLine(self, 0) |
---|
| 59 | self.__set_properties() |
---|
| 60 | self.__do_layout() |
---|
[c8d22ec] | 61 | |
---|
[f53cd30] | 62 | def __set_properties(self): |
---|
| 63 | """ |
---|
[c8d22ec] | 64 | :TODO - add method documentation |
---|
[f53cd30] | 65 | """ |
---|
| 66 | # begin wxGlade: DialogAbout.__set_properties |
---|
[0ea31ca] | 67 | self.preamble.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
| 68 | self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) |
---|
[f53cd30] | 69 | self.SetTitle("Acknowledging SasView") |
---|
[c1fdf84] | 70 | #Increased size of box from (525, 225), SMK, 04/10/16 |
---|
| 71 | self.SetSize((600, 300)) |
---|
[f53cd30] | 72 | # end wxGlade |
---|
| 73 | |
---|
| 74 | def __do_layout(self): |
---|
| 75 | """ |
---|
[c8d22ec] | 76 | :TODO - add method documentation |
---|
[f53cd30] | 77 | """ |
---|
| 78 | # begin wxGlade: DialogAbout.__do_layout |
---|
| 79 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
| 80 | sizer_titles = wx.BoxSizer(wx.VERTICAL) |
---|
[0ea31ca] | 81 | sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 82 | sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 83 | sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5) |
---|
| 84 | sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5) |
---|
[c8d22ec] | 85 | sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5) |
---|
[0ea31ca] | 86 | sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0) |
---|
| 87 | sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5) |
---|
[f53cd30] | 88 | sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5) |
---|
| 89 | self.SetAutoLayout(True) |
---|
| 90 | self.SetSizer(sizer_main) |
---|
| 91 | self.Layout() |
---|
| 92 | self.Centre() |
---|
| 93 | # end wxGlade |
---|
[c8d22ec] | 94 | |
---|
[f53cd30] | 95 | |
---|
| 96 | ##### testing code ############################################################ |
---|
| 97 | class MyApp(wx.App): |
---|
| 98 | """ |
---|
[c8d22ec] | 99 | Class for running module as stand alone for testing |
---|
[f53cd30] | 100 | """ |
---|
| 101 | def OnInit(self): |
---|
| 102 | """ |
---|
[c8d22ec] | 103 | Defines an init when running as standalone |
---|
[f53cd30] | 104 | """ |
---|
| 105 | wx.InitAllImageHandlers() |
---|
| 106 | dialog = DialogAcknowledge(None, -1, "") |
---|
| 107 | self.SetTopWindow(dialog) |
---|
| 108 | dialog.ShowModal() |
---|
| 109 | dialog.Destroy() |
---|
| 110 | return 1 |
---|
| 111 | |
---|
| 112 | # end of class MyApp |
---|
| 113 | |
---|
| 114 | if __name__ == "__main__": |
---|
| 115 | app = MyApp(0) |
---|
[c8d22ec] | 116 | app.MainLoop() |
---|