Debian Codegraph @

Nagstamon/qui/dialogs/server_missing.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.helpers import check_servers
19 from Nagstamon.qui.qt import Slot
20 from Nagstamon.qui.dialogs.dialog import Dialog
21
22
23 class DialogServerMissing(Dialog):
24 """
25 small dialog to ask about disabled ot not configured servers
26 """
27
28 def __init__(self):
29 Dialog.__init__(self, 'dialog_server_missing')
30
31 # hide dialog when server is to be created or enabled
32 self.window.button_create_server.clicked.connect(self.window.hide)
33 self.window.button_enable_server.clicked.connect(self.window.hide)
34 self.window.button_ignore.clicked.connect(self.ok)
35 # simply hide the window if ignore button chosen
36 self.window.button_ignore.clicked.connect(self.window.hide)
37 self.window.button_ignore.clicked.connect(self.cancel)
38 # bye bye if exit button was pressed - exit is connected in qui/__init__.py
39 self.window.button_exit.clicked.connect(self.window.hide)
40 # check if servers are configured or enabled and show dialog if not
41 check_servers.checked.connect(self.show)
42 check_servers.checked.connect(self.initialize)
43
44 @Slot(str)
45 def initialize(self, mode='no_server'):
46 """
47 use dialog for missing and not enabled servers, depending on mode
48 """
49 if mode == 'no_server':
50 self.window.label_no_server_configured.show()
51 self.window.label_no_server_enabled.hide()
52 self.window.button_enable_server.hide()
53 self.window.button_create_server.show()
54 else:
55 self.window.label_no_server_configured.hide()
56 self.window.label_no_server_enabled.show()
57 self.window.button_enable_server.show()
58 self.window.button_create_server.hide()