1'''
2    Copyright (C) 2019 Tusooa Zhu <tusooa@vista.aero>
3
4    This file is part of Krita-docker-color-slider.
5
6    Krita-docker-color-slider is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    Krita-docker-color-slider is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Krita-docker-color-slider.  If not, see <https://www.gnu.org/licenses/>.
18'''
19from PyQt5.QtWidgets import QDialogButtonBox, QLabel, QVBoxLayout, QHBoxLayout, QSpinBox
20from PyQt5.QtGui import QIntValidator
21from PyQt5.QtCore import Qt
22import krita
23
24from .settings_dialog import SettingsDialog
25
26
27class UIMixerSliderDocker(object):
28    def __init__(self):
29        self.krita_instance = krita.Krita.instance()
30        self.main_dialog = SettingsDialog(self, self.krita_instance.activeWindow().qwindow())
31
32        self.button_box = QDialogButtonBox(self.main_dialog)
33        self.vbox = QVBoxLayout(self.main_dialog)
34        self.hbox = QHBoxLayout(self.main_dialog)
35        self.line_edit = None
36
37        self.button_box.accepted.connect(self.main_dialog.accept)
38        self.button_box.rejected.connect(self.main_dialog.reject)
39
40        self.button_box.setOrientation(Qt.Horizontal)
41        self.button_box.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
42
43    def initialize(self, docker):
44        self.docker = docker
45
46        self.vbox.addLayout(self.hbox)
47        self.hbox.addWidget(QLabel(i18n('Number of slider lines: ')))
48        self.line_edit = QSpinBox()
49        self.line_edit.setValue(len(docker.sliders))
50        self.hbox.addWidget(self.line_edit)
51
52        self.vbox.addWidget(self.button_box)
53
54        self.main_dialog.show()
55        self.main_dialog.activateWindow()
56        self.main_dialog.exec_()
57