コード例 #1
0
 def __init__(self, parent=None):
     super(Service, self).__init__(parent)
     self.setObjectName('service_widget')
     self.setStyleSheet(get_css())
     # Fields
     self.acknowledge_btn = None
     self.downtime_btn = None
コード例 #2
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     # General settings
     self.setToolTip('About')
     # Fields
     self.setStyleSheet(get_css())
     self.app_widget = AppQWidget()
コード例 #3
0
 def __init__(self, parent=None):
     super(DashboardFactory, self).__init__(parent)
     self.row = 0
     self.setMaximumWidth(parent.width())
     self.state_data = {}
     self.main_layout = QGridLayout()
     self.setLayout(self.main_layout)
     self.setStyleSheet(get_css())
コード例 #4
0
ファイル: synthesis.py プロジェクト: nemanjapb/alignak-app
 def __init__(self, parent=None):
     super(Synthesis, self).__init__(parent)
     self.setStyleSheet(get_css())
     # Fields
     self.line_search = QLineEdit()
     self.app_backend = None
     self.action_manager = None
     self.host_synthesis = None
     self.app_widget = AppQWidget()
     self.old_checkbox_states = {}
コード例 #5
0
 def __init__(self, parent=None):
     super(Acknowledge, self).__init__(parent)
     self.setWindowTitle('Request an Acknowledge')
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.setStyleSheet(get_css())
     self.setWindowIcon(QIcon(get_image_path('icon')))
     self.setMinimumSize(360, 460)
     # Fields
     self.sticky = True
     self.notify = False
     self.ack_comment_edit = None
コード例 #6
0
ファイル: login.py プロジェクト: nemanjapb/alignak-app
 def __init__(self, parent=None):
     super(AppLogin, self).__init__(parent)
     self.setWindowTitle('Login to Alignak')
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.setStyleSheet(get_css())
     self.setWindowIcon(QIcon(get_image_path('icon')))
     self.setFixedSize(300, 330)
     # Fields
     self.app_backend = AppBackend()
     self.backend_url = None
     self.username_line = None
     self.password_line = None
     self.offset = None
コード例 #7
0
 def __init__(self, parent=None):
     super(Dashboard, self).__init__(parent)
     # General settings
     self.setWindowTitle(__application__)
     self.setMaximumWidth(455)
     self.setStyleSheet(get_css())
     # Fields
     self.main_layout = QVBoxLayout(self)
     self.dashboard_type = None
     self.dashboard_factory = DashboardFactory(self)
     self.button = None
     self.timer = QTimer(self)
     self.app_widget = AppQWidget()
コード例 #8
0
 def __init__(self, parent=None):
     super(Downtime, self).__init__(parent)
     self.setWindowTitle('Request a Downtime')
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.setStyleSheet(get_css())
     self.setWindowIcon(QIcon(get_image_path('icon')))
     self.setMinimumSize(360, 460)
     # Fields
     self.fixed = True
     self.duration = QTimeEdit()
     self.start_time = QDateTimeEdit()
     self.end_time = QDateTimeEdit()
     self.comment_edit = QTextEdit()
コード例 #9
0
 def __init__(self, parent=None):
     super(AlignakStatus, self).__init__(parent)
     # General settings
     self.setWindowTitle(__application__)
     self.setToolTip('Alignak Status')
     self.setStyleSheet(get_css())
     # Fields
     self.app_backend = None
     self.daemons_labels = {}
     self.info = None
     self.old_bad_daemons = 0
     self.app_widget = AppQWidget()
     self.first_start = True
コード例 #10
0
ファイル: login.py プロジェクト: nemanjapb/alignak-app
    def handle_server(self):
        """
        Handle for server button

        """

        server_dialog = QDialog()
        server_dialog.setWindowTitle('Server Configuration')
        server_dialog.setWindowFlags(Qt.FramelessWindowHint)
        server_dialog.setStyleSheet(get_css())
        server_dialog.setFixedSize(300, 300)

        main_layout = QVBoxLayout(server_dialog)
        main_layout.setContentsMargins(0, 0, 0, 0)
        main_layout.addWidget(self.get_logo_widget(server_dialog))

        server_widget = QWidget(self)
        server_widget.setObjectName('login')
        server_layout = QGridLayout(server_widget)

        # Description
        desc_label = QLabel(
            '<h3>Alignak Backend</h3><p>Here you can define alignak settings.</p>'
            '<b>Be sure to enter a valid address</b>')
        desc_label.setWordWrap(True)
        server_layout.addWidget(desc_label, 0, 0, 1, 3)

        # Server URL
        server_layout.addWidget(QLabel('Server'), 1, 0, 1, 1)

        server_url = QLineEdit()
        server_url.setPlaceholderText('alignak backend url')
        server_url.setText(get_app_config('Alignak', 'url'))
        server_layout.addWidget(server_url, 1, 1, 1, 2)

        # Server Port
        server_layout.addWidget(QLabel('Port'), 2, 0, 1, 1)

        server_port = QLineEdit()
        server_port.setPlaceholderText('alignak backend port')
        cur_port = get_app_config('Alignak', 'backend').split(':')[2]
        server_port.setText(cur_port)
        server_layout.addWidget(server_port, 2, 1, 1, 2)

        # Server Processes
        server_layout.addWidget(QLabel('Processes'), 3, 0, 1, 1)

        server_proc = QLineEdit()
        if 'win32' in sys.platform:
            server_proc.setEnabled(False)
        server_proc.setPlaceholderText('alignak backend processes')
        cur_proc = get_app_config('Alignak', 'processes')
        server_proc.setText(cur_proc)
        server_layout.addWidget(server_proc, 3, 1, 1, 2)

        # Valid Button
        valid_btn = QPushButton('Valid')
        valid_btn.clicked.connect(server_dialog.accept)
        server_layout.addWidget(valid_btn, 4, 0, 1, 3)

        main_layout.addWidget(server_widget)

        self.center(server_widget)

        if server_dialog.exec_() == QDialog.Accepted:
            backend_url = '%(url)s:' + str(server_port.text()).rstrip()
            set_app_config('Alignak', 'backend', backend_url)
            set_app_config('Alignak', 'url', str(server_url.text()).rstrip())
            set_app_config('Alignak', 'processes',
                           str(server_proc.text()).rstrip())
コード例 #11
0
ファイル: app_widget.py プロジェクト: nemanjapb/alignak-app
 def __init__(self, parent=None):
     super(AppQWidget, self).__init__(parent)
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.setWindowIcon(QIcon(get_image_path('icon')))
     self.setStyleSheet(get_css())
     self.offset = None
コード例 #12
0
    def create_banner(self, banner_type, message):
        """
        Create banner QWidget and its QPropertyAnimation

        :param banner_type: defines type of banner: OK, INFO, WARN, or ALERT
        :type banner_type: str
        :param message: message to display in banner
        :type message: str
        """

        layout = QHBoxLayout()
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        event_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        self.setToolTip(event_date)

        if banner_type not in self.banner_type:
            banner_type = 'ERROR'

        self.setStyleSheet(get_css())
        self.setObjectName('banner%s' % banner_type)

        valid_btn = QPushButton()
        valid_btn.setMaximumSize(self.banner_height, self.banner_height)
        valid_btn.setObjectName('banner')
        valid_btn.clicked.connect(self.close_banner)
        valid_btn.setIcon(QIcon(get_image_path(banner_type.lower())))

        layout.addWidget(valid_btn)

        if len(message) > 170:
            message = message[:170] + '...'

        if get_app_config('Banners', 'title', boolean=True):
            banner_qlabel = QLabel('<b>%s</b>: %s' % (banner_type, message))
        else:
            banner_qlabel = QLabel('%s' % message)

        banner_qlabel.setWordWrap(True)
        banner_qlabel.setObjectName('banner')
        layout.addWidget(banner_qlabel)

        # Animation
        banner_duration = int(get_app_config('Banners', 'animation'))
        if banner_duration < 0:
            logger.debug('Banner animation: %sms', str(banner_duration))
            logger.error(
                '"animation" option must be equal or greater than 0. Replace by default: 1000ms'
            )
            banner_duration = 1000
        self.animation.setDuration(banner_duration)

        start_value = QPoint(0, 0)
        self.animation.setStartValue(start_value)

        screen = QApplication.desktop().screenNumber(
            QApplication.desktop().cursor().pos())
        end_position = QApplication.desktop().screenGeometry(screen).topRight()
        end_value = QPoint(end_position.x() - self.width(), end_position.y())
        self.animation.setEndValue(end_value)