# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/qobjects/common/widgets.py
# def get_logo_widget(child_widget, title, exitapp=False):
#     """
#     Return LogoQWidget with alignak logo
# 
#     :param child_widget: widget child of LogoQWidget, needed for action button and layout
#     :type child_widget: QWidget
#     :param title: title of widget
#     :type title: str
#     :param exitapp: define if close button close application or just child QWidget
#     :type exitapp: bool
#     :return: Logo QWidget with buttons and child QWidget
#     :rtype: QWidget
#     """
# 
#     logo_widget = LogoQWidget()
#     logo_widget.initialize(child_widget, title, exitapp)
# 
#     return logo_widget
# 
# def center_widget(widget):
#     """
#     Center QWidget
# 
#     :param widget: widget to center
#     :type widget: QWidget
#     """
# 
#     screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
#     center = QApplication.desktop().screenGeometry(screen).center()
#     widget.move(center.x() - (widget.width() / 2), center.y() - (widget.height() / 2))
# 
# Path: alignak_app/qobjects/common/dialogs.py
# class MessageQDialog(QDialog):
#     """
#         Class who create a Message QDialog to display texts in Alignak-app
#     """
# 
#     def __init__(self, parent=None):
#         super(MessageQDialog, self).__init__(parent)
#         self.setWindowFlags(Qt.FramelessWindowHint)
#         self.setStyleSheet(settings.css_style)
#         self.setWindowIcon(QIcon(settings.get_image('icon')))
#         self.setFixedSize(500, 200)
#         self.setObjectName('dialog')
# 
#     def initialize(self, widgettitle, dialog, title, text):
#         """
#         Initialize QDialog for PasswordDialog
# 
#         :param widgettitle: title of the QDialog
#         :type widgettitle: str
#         :param dialog: type of dialog ('text' or 'error')
#         :type dialog: str
#         :param title: title of text to display
#         :type title: str
#         :param text: text to display
#         :type text: str
#         """
# 
#         center_widget(self)
# 
#         # Main status_layout
#         main_layout = QVBoxLayout(self)
#         main_layout.setContentsMargins(0, 0, 0, 0)
#         self.setLayout(main_layout)
# 
#         main_layout.addWidget(get_logo_widget(self, widgettitle))
#         main_layout.addWidget(self.get_message_widget(dialog, title, text))
# 
#     def get_message_widget(self, dialog, title, text):
#         """
#         Return colored message QWidget
# 
#         :param dialog: type of dialog ('text' or 'error')
#         :type dialog: str
#         :param title: title of text to display
#         :type title: str
#         :param text: text to display
#         :type text: str
#         :return: message QWidget
#         :rtype: QWidget
#         """
# 
#         # Token QWidget
#         token_widget = QWidget()
#         token_widget.setObjectName('dialog')
#         token_layout = QVBoxLayout()
#         token_widget.setLayout(token_layout)
# 
#         token_title = QLabel(title)
#         token_title.setObjectName('itemtitle')
#         token_layout.addWidget(token_title)
#         token_layout.setAlignment(token_title, Qt.AlignCenter)
# 
#         token_label = QLabel(text)
#         token_label.setObjectName(dialog)
#         token_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
#         token_label.setWordWrap(True)
#         token_layout.addWidget(token_label)
# 
#         # Login button
#         accept_btn = QPushButton('OK', self)
#         accept_btn.clicked.connect(self.accept)
#         accept_btn.setObjectName('ok')
#         accept_btn.setMinimumHeight(30)
#         token_layout.addWidget(accept_btn)
# 
#         return token_widget


from logging import getLogger
from PyQt5.Qt import QLineEdit, Qt, QIcon, QLabel, QVBoxLayout, QWidget, QDialog, QPushButton
from alignak_app.utils.config import settings
from alignak_app.qobjects.common.widgets import get_logo_widget, center_widget
from alignak_app.qobjects.common.dialogs import MessageQDialog
        proxy_widget.setObjectName('dialog')
        proxy_layout = QVBoxLayout(proxy_widget)

        # Title
        title_lbl = QLabel(_('Proxy Settings'))
        title_lbl.setObjectName('itemtitle')
        proxy_layout.addWidget(title_lbl)
        proxy_layout.setAlignment(title_lbl, Qt.AlignTop)

        # Description
        desc_label = QLabel(
            _('Here you can define your proxy. Be sure to enter a valid address.')
        )
        desc_label.setWordWrap(True)
        proxy_layout.addWidget(desc_label)

        # Proxy Settings
        proxy_lbl = QLabel(_('Proxy Address with Port'))
        proxy_layout.addWidget(proxy_lbl)

        proxy = settings.get_config('Alignak', 'proxy')
        self.proxy_address.setText(proxy)
        self.proxy_address.setPlaceholderText(_('proxy adress:port...'))
        self.proxy_address.setFixedHeight(25)
        proxy_layout.addWidget(self.proxy_address)

        # Proxy User
        proxy_user_lbl = QLabel(_('Proxy User (Optional)'))
        proxy_layout.addWidget(proxy_user_lbl)


# Path: alignak_app/utils/config.py
# class Settings(object):
#     def __init__(self):
#     def init_config(self):
#     def get_config(self, section, option, boolean=False):
#     def set_config(self, section, option, new_value):
#     def get_image(self, name):
#     def init_css(self):
# def open_url(endpoint='login'):  # pragma: no cover
# def get_url_endpoint_from_icon_name(icon_name):
# 
# Path: alignak_app/qobjects/common/widgets.py
# def get_logo_widget(child_widget, title, exitapp=False):
#     """
#     Return LogoQWidget with alignak logo
# 
#     :param child_widget: widget child of LogoQWidget, needed for action button and layout
#     :type child_widget: QWidget
#     :param title: title of widget
#     :type title: str
#     :param exitapp: define if close button close application or just child QWidget
#     :type exitapp: bool
#     :return: Logo QWidget with buttons and child QWidget
#     :rtype: QWidget
#     """
# 
#     logo_widget = LogoQWidget()
#     logo_widget.initialize(child_widget, title, exitapp)
# 
#     return logo_widget
# 
# def center_widget(widget):
#     """
#     Center QWidget
# 
#     :param widget: widget to center
#     :type widget: QWidget
#     """
# 
#     screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
#     center = QApplication.desktop().screenGeometry(screen).center()
#     widget.move(center.x() - (widget.width() / 2), center.y() - (widget.height() / 2))
# 
# Path: alignak_app/qobjects/common/dialogs.py
# class MessageQDialog(QDialog):
#     """
#         Class who create a Message QDialog to display texts in Alignak-app
#     """
# 
#     def __init__(self, parent=None):
#         super(MessageQDialog, self).__init__(parent)
#         self.setWindowFlags(Qt.FramelessWindowHint)
#         self.setStyleSheet(settings.css_style)
#         self.setWindowIcon(QIcon(settings.get_image('icon')))
#         self.setFixedSize(500, 200)
#         self.setObjectName('dialog')
# 
#     def initialize(self, widgettitle, dialog, title, text):
#         """
#         Initialize QDialog for PasswordDialog
# 
#         :param widgettitle: title of the QDialog
#         :type widgettitle: str
#         :param dialog: type of dialog ('text' or 'error')
#         :type dialog: str
#         :param title: title of text to display
#         :type title: str
#         :param text: text to display
#         :type text: str
#         """
# 
#         center_widget(self)
# 
#         # Main status_layout
#         main_layout = QVBoxLayout(self)
#         main_layout.setContentsMargins(0, 0, 0, 0)
#         self.setLayout(main_layout)
# 
#         main_layout.addWidget(get_logo_widget(self, widgettitle))
#         main_layout.addWidget(self.get_message_widget(dialog, title, text))
# 
#     def get_message_widget(self, dialog, title, text):
#         """
#         Return colored message QWidget
# 
#         :param dialog: type of dialog ('text' or 'error')
#         :type dialog: str
#         :param title: title of text to display
#         :type title: str
#         :param text: text to display
#         :type text: str
#         :return: message QWidget
#         :rtype: QWidget
#         """
# 
#         # Token QWidget
#         token_widget = QWidget()
#         token_widget.setObjectName('dialog')
#         token_layout = QVBoxLayout()
#         token_widget.setLayout(token_layout)
# 
#         token_title = QLabel(title)
#         token_title.setObjectName('itemtitle')
#         token_layout.addWidget(token_title)
#         token_layout.setAlignment(token_title, Qt.AlignCenter)
# 
#         token_label = QLabel(text)
#         token_label.setObjectName(dialog)
#         token_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
#         token_label.setWordWrap(True)
#         token_layout.addWidget(token_label)
# 
#         # Login button
#         accept_btn = QPushButton('OK', self)
#         accept_btn.clicked.connect(self.accept)
#         accept_btn.setObjectName('ok')
#         accept_btn.setMinimumHeight(30)
#         token_layout.addWidget(accept_btn)
# 
#         return token_widget


# Path: alignak_app/qobjects/login/proxy.py
from logging import getLogger
from PyQt5.Qt import QLineEdit, Qt, QIcon, QLabel, QVBoxLayout, QWidget, QDialog, QPushButton
from alignak_app.utils.config import settings
from alignak_app.qobjects.common.widgets import get_logo_widget, center_widget
from alignak_app.qobjects.common.dialogs import MessageQDialog

        proxy_widget.setObjectName('dialog')
        proxy_layout = QVBoxLayout(proxy_widget)

        # Title
        title_lbl = QLabel(_('Proxy Settings'))
        title_lbl.setObjectName('itemtitle')
        proxy_layout.addWidget(title_lbl)
        proxy_layout.setAlignment(title_lbl, Qt.AlignTop)

        # Description
        desc_label = QLabel(
            _('Here you can define your proxy. Be sure to enter a valid address.')
        )
        desc_label.setWordWrap(True)
        proxy_layout.addWidget(desc_label)

        # Proxy Settings
        proxy_lbl = QLabel(_('Proxy Address with Port'))
        proxy_layout.addWidget(proxy_lbl)

        proxy = settings.get_config('Alignak', 'proxy')
        self.proxy_address.setText(proxy)
        self.proxy_address.setPlaceholderText(_('proxy adress:port...'))
        self.proxy_address.setFixedHeight(25)
        proxy_layout.addWidget(self.proxy_address)

        # Proxy User
        proxy_user_lbl = QLabel(_('Proxy User (Optional)'))
        proxy_layout.addWidget(proxy_user_lbl)


        proxy_user = settings.get_config('Alignak', 'proxy_user')