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

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 74c8cd0 was 74c8cd0, checked in by ajj, 7 years ago

Fettling sizes. Calling this done.

  • Property mode set to 100644
File size: 4.1 KB
Line 
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
11import wx.richtext
12import wx.lib.hyperlink
13from wx.lib.expando import ExpandoTextCtrl
14import random
15import os.path
16import os
17try:
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])
24        config = imp.load_module('local_config', fObj, path, descr)
25    else:
26        # Try simply importing local_config
27        import local_config as config
28except:
29    # Didn't find local config, load the default
30    import config
31
32
33class DialogAcknowledge(wx.Dialog):
34    """
35    "Acknowledgement" Dialog Box
36
37    Shows the current method for acknowledging SasView in
38    scholarly publications.
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 = ExpandoTextCtrl(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)
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)
51        self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble)
52        items = [config._acknowledgement_preamble_bullet1,
53                 config._acknowledgement_preamble_bullet2,
54                 config._acknowledgement_preamble_bullet3,
55                 config._acknowledgement_preamble_bullet4]
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])
60        self.static_line = wx.StaticLine(self, 0)
61        self.__set_properties()
62        self.__do_layout()
63
64    def __set_properties(self):
65        """
66        :TODO - add method documentation
67        """
68        # begin wxGlade: DialogAbout.__set_properties
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, ""))
71        self.SetTitle("Acknowledging SasView")
72        #Increased size of box from (525, 225), SMK, 04/10/16
73        self.SetClientSize((600, 320))
74        # end wxGlade
75
76    def __do_layout(self):
77        """
78        :TODO - add method documentation
79        """
80        # begin wxGlade: DialogAbout.__do_layout
81        sizer_main = wx.BoxSizer(wx.VERTICAL)
82        sizer_titles = wx.BoxSizer(wx.VERTICAL)
83        sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5)
84        sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5)
85        sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5)
86        sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5)
87        sizer_titles.Add(self.citation, 0, wx.ALL|wx.EXPAND, 5)
88        sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5)
89        #sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0)
90        sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5)
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        #self.SetClientSize(sizer_main.GetSize())
97        # end wxGlade
98
99
100##### testing code ############################################################
101class MyApp(wx.App):
102    """
103    Class for running module as stand alone for testing
104    """
105    def OnInit(self):
106        """
107        Defines an init when running as standalone
108        """
109        wx.InitAllImageHandlers()
110        dialog = DialogAcknowledge(None, -1, "")
111        self.SetTopWindow(dialog)
112        dialog.ShowModal()
113        dialog.Destroy()
114        return 1
115
116# end of class MyApp
117
118if __name__ == "__main__":
119    app = MyApp(0)
120    app.MainLoop()
Note: See TracBrowser for help on using the repository browser.