source: sasview/src/sas/sasgui/guiframe/acknowledgebox.py @ f5f8553

Last change on this file since f5f8553 was b963b20, checked in by Paul Kienzle <pkienzle@…>, 7 years ago

pull config out of sas.sasgui so it can be used without reference to wx

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[f53cd30]1'''
2Created on Feb 18, 2015
3
4@author: jkrzywon
5'''
6
7__id__ = "$Id: acknoweldgebox.py 2015-18-02 jkrzywon $"
8__revision__ = "$Revision: 1193 $"
9
10import wx
[0ea31ca]11import wx.richtext
[f53cd30]12import wx.lib.hyperlink
[d8161f2]13from wx.lib.expando import ExpandoTextCtrl
[c8d22ec]14
[b963b20]15from sas import get_local_config
[efe730d]16config = get_local_config()
[f53cd30]17
18class DialogAcknowledge(wx.Dialog):
19    """
20    "Acknowledgement" Dialog Box
[c8d22ec]21
[f53cd30]22    Shows the current method for acknowledging SasView in
23    scholarly publications.
24    """
[c8d22ec]25
[f53cd30]26    def __init__(self, *args, **kwds):
[c8d22ec]27
[f53cd30]28        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
29        wx.Dialog.__init__(self, *args, **kwds)
[c8d22ec]30
[d8161f2]31        self.ack = ExpandoTextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL)
[f53cd30]32        self.ack.SetValue(config._acknowledgement_publications)
[d8161f2]33        #self.ack.SetMinSize((-1, 55))
34        self.citation = ExpandoTextCtrl(self, style=wx.TE_LEFT|wx.TE_MULTILINE|wx.TE_BESTWRAP|wx.TE_READONLY|wx.TE_NO_VSCROLL)
35        self.citation.SetValue(config._acknowledgement_citation)
[f53cd30]36        self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble)
[0ea31ca]37        items = [config._acknowledgement_preamble_bullet1,
38                 config._acknowledgement_preamble_bullet2,
[c8d22ec]39                 config._acknowledgement_preamble_bullet3,
40                 config._acknowledgement_preamble_bullet4]
[e11ee1d]41        self.list1 = wx.StaticText(self, -1, "(1) " + items[0])
42        self.list2 = wx.StaticText(self, -1, "(2) " + items[1])
43        self.list3 = wx.StaticText(self, -1, "(3) " + items[2])
44        self.list4 = wx.StaticText(self, -1, "(4) " + items[3])
[f53cd30]45        self.static_line = wx.StaticLine(self, 0)
46        self.__set_properties()
47        self.__do_layout()
[c8d22ec]48
[f53cd30]49    def __set_properties(self):
50        """
[c8d22ec]51        :TODO - add method documentation
[f53cd30]52        """
53        # begin wxGlade: DialogAbout.__set_properties
[0ea31ca]54        self.preamble.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
55        self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
[f53cd30]56        self.SetTitle("Acknowledging SasView")
[c1fdf84]57        #Increased size of box from (525, 225), SMK, 04/10/16
[74c8cd0]58        self.SetClientSize((600, 320))
[f53cd30]59        # end wxGlade
60
61    def __do_layout(self):
62        """
[c8d22ec]63        :TODO - add method documentation
[f53cd30]64        """
65        # begin wxGlade: DialogAbout.__do_layout
66        sizer_main = wx.BoxSizer(wx.VERTICAL)
67        sizer_titles = wx.BoxSizer(wx.VERTICAL)
[0ea31ca]68        sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5)
69        sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5)
[d8161f2]70        sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5)
[0ea31ca]71        sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5)
[d8161f2]72        sizer_titles.Add(self.citation, 0, wx.ALL|wx.EXPAND, 5)
[0ea31ca]73        sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5)
[d8161f2]74        #sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0)
[c8d22ec]75        sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5)
[f53cd30]76        sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5)
77        self.SetAutoLayout(True)
78        self.SetSizer(sizer_main)
79        self.Layout()
80        self.Centre()
[74c8cd0]81        #self.SetClientSize(sizer_main.GetSize())
[f53cd30]82        # end wxGlade
[c8d22ec]83
[f53cd30]84
85##### testing code ############################################################
86class MyApp(wx.App):
87    """
[c8d22ec]88    Class for running module as stand alone for testing
[f53cd30]89    """
90    def OnInit(self):
91        """
[c8d22ec]92        Defines an init when running as standalone
[f53cd30]93        """
94        wx.InitAllImageHandlers()
95        dialog = DialogAcknowledge(None, -1, "")
96        self.SetTopWindow(dialog)
97        dialog.ShowModal()
98        dialog.Destroy()
99        return 1
100
101# end of class MyApp
102
103if __name__ == "__main__":
104    app = MyApp(0)
[c8d22ec]105    app.MainLoop()
Note: See TracBrowser for help on using the repository browser.