2 Copyright (C) 1997-2017 JDERobot Developers Team 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. 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 Library General Public License for more details. 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <http://www.gnu.org/licenses/>. 17 Authors : Okan Asik (asik.okan@gmail.com) 22 from PyQt5.QtWidgets
import QWidget, QHBoxLayout, QLineEdit, QPushButton, QLabel, \
24 from PyQt5.QtCore
import pyqtSignal
29 removed = pyqtSignal(str)
30 updated = pyqtSignal(str, str)
35 self.setLayout(self.
layout)
38 self.label.setMinimumWidth(200)
39 self.layout.addWidget(self.
label)
42 self.lineEdit.setMinimumWidth(200)
44 self.lineEdit.setVisible(
False)
47 self.editButton.setMaximumWidth(80)
48 self.editButton.setMinimumWidth(80)
52 self.removeButton.setMaximumWidth(80)
53 self.removeButton.setMinimumWidth(80)
59 self.saveButton.setMinimumWidth(80)
60 self.saveButton.setMaximumWidth(80)
63 self.saveButton.setVisible(
False)
67 self.cancelButton.setMinimumWidth(80)
68 self.cancelButton.setMaximumWidth(80)
71 self.cancelButton.setVisible(
False)
73 self.label.setStyleSheet(
'QLabel { border: 1px solid black; }')
74 self.setContentsMargins(0, 0, 0, 0)
75 self.layout.setContentsMargins(0, 0, 0, 0)
78 self.removeButton.setVisible(
False)
79 self.editButton.setVisible(
False)
80 self.label.setVisible(
False)
82 self.lineEdit.setVisible(
True)
83 self.saveButton.setVisible(
True)
84 self.cancelButton.setVisible(
True)
87 self.removed.emit(self.label.text())
90 self.updated.emit(self.label.text(), self.lineEdit.text())
91 self.label.setText(self.lineEdit.text())
92 self.label.setVisible(
True)
93 self.editButton.setVisible(
True)
94 self.removeButton.setVisible(
True)
96 self.lineEdit.setVisible(
False)
97 self.cancelButton.setVisible(
False)
98 self.saveButton.setVisible(
False)
101 self.cancelButton.setVisible(
False)
102 self.saveButton.setVisible(
False)
103 self.lineEdit.setVisible(
False)
105 self.label.setVisible(
True)
106 self.removeButton.setVisible(
True)
107 self.editButton.setVisible(
True)
110 if __name__ ==
'__main__':
111 app = QApplication(sys.argv)