Create, Use a Labelled Text Field for the Conversation Input Field

- This fixes the field expanding when configure screen is expanded
- Allows for reusability of the labelled text field
- Simplifies the logic to save settings for conversation processor
This commit is contained in:
Debanjum Singh Solanky
2022-08-12 16:59:15 +03:00
parent fa7e36cada
commit a1c58a9470
2 changed files with 39 additions and 30 deletions

View File

@@ -0,0 +1,25 @@
# External Packages
from PyQt6 import QtWidgets
# Internal Packages
from src.utils.config import ProcessorType
class LabelledTextField(QtWidgets.QWidget):
def __init__(self, title, processor_type: ProcessorType=None, default_value: str=None):
QtWidgets.QWidget.__init__(self)
layout = QtWidgets.QHBoxLayout()
self.setLayout(layout)
self.processor_type = processor_type
self.label = QtWidgets.QLabel()
self.label.setText(title)
self.label.setFixedWidth(95)
layout.addWidget(self.label)
self.input_field = QtWidgets.QLineEdit(self)
self.input_field.setFixedWidth(250)
self.input_field.setText(default_value)
layout.addWidget(self.input_field)
layout.addStretch()