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 |
---|
11 | import wx.lib.hyperlink |
---|
12 | import random |
---|
13 | import os.path |
---|
14 | import os |
---|
15 | try: |
---|
16 | # Try to find a local config |
---|
17 | import imp |
---|
18 | path = os.getcwd() |
---|
19 | if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ |
---|
20 | (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): |
---|
21 | fObj, path, descr = imp.find_module('local_config', [path]) |
---|
22 | config = imp.load_module('local_config', fObj, path, descr) |
---|
23 | else: |
---|
24 | # Try simply importing local_config |
---|
25 | import local_config as config |
---|
26 | except: |
---|
27 | # Didn't find local config, load the default |
---|
28 | import config |
---|
29 | |
---|
30 | |
---|
31 | class DialogAcknowledge(wx.Dialog): |
---|
32 | """ |
---|
33 | "Acknowledgement" Dialog Box |
---|
34 | |
---|
35 | Shows the current method for acknowledging SasView in |
---|
36 | scholarly publications. |
---|
37 | |
---|
38 | """ |
---|
39 | |
---|
40 | def __init__(self, *args, **kwds): |
---|
41 | |
---|
42 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE |
---|
43 | wx.Dialog.__init__(self, *args, **kwds) |
---|
44 | |
---|
45 | self.ack = wx.TextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL) |
---|
46 | self.ack.SetBackgroundColour(wx.NullColour) |
---|
47 | self.ack.SetValue(config._acknowledgement_publications) |
---|
48 | self.ack.SetMinSize((-1,60)) |
---|
49 | self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble) |
---|
50 | self.static_line = wx.StaticLine(self, 0) |
---|
51 | |
---|
52 | self.__set_properties() |
---|
53 | self.__do_layout() |
---|
54 | |
---|
55 | def __set_properties(self): |
---|
56 | """ |
---|
57 | """ |
---|
58 | # begin wxGlade: DialogAbout.__set_properties |
---|
59 | self.SetTitle("Acknowledging SasView") |
---|
60 | self.SetSize((500, 225)) |
---|
61 | # end wxGlade |
---|
62 | |
---|
63 | def __do_layout(self): |
---|
64 | """ |
---|
65 | """ |
---|
66 | # begin wxGlade: DialogAbout.__do_layout |
---|
67 | sizer_main = wx.BoxSizer(wx.VERTICAL) |
---|
68 | sizer_titles = wx.BoxSizer(wx.VERTICAL) |
---|
69 | sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 0) |
---|
70 | sizer_titles.Add(self.static_line, 0, wx.EXPAND, 0) |
---|
71 | sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 0) |
---|
72 | sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5) |
---|
73 | self.SetAutoLayout(True) |
---|
74 | self.SetSizer(sizer_main) |
---|
75 | self.Layout() |
---|
76 | self.Centre() |
---|
77 | # end wxGlade |
---|
78 | |
---|
79 | |
---|
80 | ##### testing code ############################################################ |
---|
81 | class MyApp(wx.App): |
---|
82 | """ |
---|
83 | """ |
---|
84 | def OnInit(self): |
---|
85 | """ |
---|
86 | """ |
---|
87 | wx.InitAllImageHandlers() |
---|
88 | dialog = DialogAcknowledge(None, -1, "") |
---|
89 | self.SetTopWindow(dialog) |
---|
90 | dialog.ShowModal() |
---|
91 | dialog.Destroy() |
---|
92 | return 1 |
---|
93 | |
---|
94 | # end of class MyApp |
---|
95 | |
---|
96 | if __name__ == "__main__": |
---|
97 | app = MyApp(0) |
---|
98 | app.MainLoop() |
---|