1# vim: set fileencoding=utf-8 :
2
3# ***********************IMPORTANT NMAP LICENSE TERMS************************
4# *                                                                         *
5# * The Nmap Security Scanner is (C) 1996-2020 Insecure.Com LLC ("The Nmap  *
6# * Project"). Nmap is also a registered trademark of the Nmap Project.     *
7# *                                                                         *
8# * This program is distributed under the terms of the Nmap Public Source   *
9# * License (NPSL). The exact license text applying to a particular Nmap    *
10# * release or source code control revision is contained in the LICENSE     *
11# * file distributed with that version of Nmap or source code control       *
12# * revision. More Nmap copyright/legal information is available from       *
13# * https://nmap.org/book/man-legal.html, and further information on the    *
14# * NPSL license itself can be found at https://nmap.org/npsl. This header  *
15# * summarizes some key points from the Nmap license, but is no substitute  *
16# * for the actual license text.                                            *
17# *                                                                         *
18# * Nmap is generally free for end users to download and use themselves,    *
19# * including commercial use. It is available from https://nmap.org.        *
20# *                                                                         *
21# * The Nmap license generally prohibits companies from using and           *
22# * redistributing Nmap in commercial products, but we sell a special Nmap  *
23# * OEM Edition with a more permissive license and special features for     *
24# * this purpose. See https://nmap.org/oem                                  *
25# *                                                                         *
26# * If you have received a written Nmap license agreement or contract       *
27# * stating terms other than these (such as an Nmap OEM license), you may   *
28# * choose to use and redistribute Nmap under those terms instead.          *
29# *                                                                         *
30# * The official Nmap Windows builds include the Npcap software             *
31# * (https://npcap.org) for packet capture and transmission. It is under    *
32# * separate license terms which forbid redistribution without special      *
33# * permission. So the official Nmap Windows builds may not be              *
34# * redistributed without special permission (such as an Nmap OEM           *
35# * license).                                                               *
36# *                                                                         *
37# * Source is provided to this software because we believe users have a     *
38# * right to know exactly what a program is going to do before they run it. *
39# * This also allows you to audit the software for security holes.          *
40# *                                                                         *
41# * Source code also allows you to port Nmap to new platforms, fix bugs,    *
42# * and add new features.  You are highly encouraged to submit your         *
43# * changes as a Github PR or by email to the dev@nmap.org mailing list     *
44# * for possible incorporation into the main distribution. Unless you       *
45# * specify otherwise, it is understood that you are offering us very       *
46# * broad rights to use your submissions as described in the Nmap Public    *
47# * Source License Contributor Agreement. This is important because we      *
48# * fund the project by selling licenses with various terms, and also       *
49# * because the inability to relicense code has caused devastating          *
50# * problems for other Free Software projects (such as KDE and NASM).       *
51# *                                                                         *
52# * The free version of Nmap is distributed in the hope that it will be     *
53# * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  *
54# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Warranties,        *
55# * indemnification and commercial support are all available through the    *
56# * Npcap OEM program--see https://nmap.org/oem.                            *
57# *                                                                         *
58# ***************************************************************************/
59
60import gtk
61from radialnet.bestwidgets.labels import BWSectionLabel
62
63
64class BWExpander(gtk.Expander):
65    """
66    """
67    def __init__(self, label=''):
68        """
69        """
70        gtk.Expander.__init__(self)
71
72        self.__label = BWSectionLabel(label)
73        self.set_label_widget(self.__label)
74
75        self.__alignment = gtk.Alignment(0, 0, 1, 1)
76        self.__alignment.set_padding(12, 0, 24, 0)
77
78        self.add(self.__alignment)
79
80    def bw_set_label_text(self, text):
81        """
82        """
83        self.__label.bw_set_text(text)
84
85    def bw_add(self, widget):
86        """
87        """
88        if len(self.__alignment.get_children()) > 0:
89            self.__alignment.remove(self.__alignment.get_children()[0])
90
91        self.__alignment.add(widget)
92
93    def bw_no_padding(self):
94        """
95        """
96        self.__alignment.set_padding(0, 0, 0, 0)
97