Debian Codegraph @

Nagstamon/qui/widgets/layout.py

raw
1 # Nagstamon - Nagios status monitor for your desktop
2 # Copyright (C) 2008-2026 Henri Wahl <[email protected]> et al.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17
18 from Nagstamon.qui.qt import QHBoxLayout
19
20
21 class HBoxLayout(QHBoxLayout):
22 """
23 Custom QHBoxLayout with zero spacing and margins by default.
24
25 This layout is used to create a horizontal box.
26
27 Args:
28 spacing (int, optional): Space between child widgets. Defaults to 0.
29 parent (QWidget, optional): Parent widget.
30 """
31
32 def __init__(self, spacing=None, parent=None):
33 QHBoxLayout.__init__(self, parent)
34
35 if spacing is None:
36 self.setSpacing(0)
37 else:
38 self.setSpacing(spacing)
39 # no margin
40 self.setContentsMargins(0, 0, 0, 0)