def __init__(self,
                 parent=None,
                 channels=None,
                 active_channels=None,
                 conda_url=None,
                 flat=True):

        # Check arguments: active channels, must be within channels
        for channel in active_channels:
            if channel not in channels:
                raise Exception("'active_channels' must be also within "
                                "'channels'")

        super(DialogChannels, self).__init__(parent)
        self._parent = parent
        self._channels = channels
        self._active_channels = active_channels
        self._conda_url = conda_url
        self._edited_channel_text = ''
        self._temp_channels = channels
        self.api = ManagerAPI()

        # Widgets
        self.list = ListWidgetChannels(self)
        self.button_add = ButtonPackageChannelAdd('Add')
        self.button_delete = ButtonPackageChannelRemove('Remove')
        self.button_ok = ButtonPackageChannelUpdate(_('Update channels'))

        # Widget setup
        #        self.button_add.setIcon(qta.icon('fa.plus'))
        #        self.button_delete.setIcon(qta.icon('fa.minus'))
        self.setMinimumWidth(350)
        self.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
        self.setWindowOpacity(0.96)
        self.setModal(False)

        # Layout
        layout = QVBoxLayout()

        button_layout = QHBoxLayout()
        button_layout.addStretch()
        button_layout.addWidget(self.button_add)
        button_layout.addWidget(self.button_delete)

        ok_layout = QHBoxLayout()
        ok_layout.addStretch()
        ok_layout.addWidget(self.button_ok)

        layout.addLayout(button_layout)
        layout.addWidget(self.list)
        layout.addLayout(ok_layout)
        self.setLayout(layout)

        # Signals
        self.button_add.clicked.connect(self.add_channel)
        self.button_delete.clicked.connect(self.delete_channel)
        self.button_ok.clicked.connect(self.update_channels)

        self.setup()

        self.list.itemChanged.connect(self.edit_channel)
        self.button_add.setFocus()

        if flat:
            self.list.setFrameStyle(QFrame.NoFrame)
            self.list.setFrameShape(QFrame.NoFrame)