mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Minor change.
This commit is contained in:
1 parent
90b8205f8e
commit
5b33093ed1
3 files changed
+23
-4
No files matched your search
+20
-1
@@ -10,7 +10,7 @@ from PyQt5.QtWidgets import (
|
||||
QPushButton, QLineEdit, QCheckBox,
|
||||
QTimeEdit, QSpinBox, QTextEdit,
|
||||
QRadioButton, QComboBox, QFileDialog,
|
||||
QMessageBox,
|
||||
QMessageBox, QTableView,
|
||||
)
|
||||
from PyQt5.QtCore import (
|
||||
QTime,
|
||||
@@ -91,6 +91,22 @@ class ASubWindow(QDialog, WindowToolKit):
|
||||
|
||||
# Commun use features
|
||||
|
||||
def _qtype_from_component_name(self, name):
|
||||
qtype = None
|
||||
|
||||
if "action" in name:
|
||||
qtype = QAction
|
||||
elif "lineEdit" in name:
|
||||
qtype = QLineEdit
|
||||
elif "pushButton" in name:
|
||||
qtype = QPushButton
|
||||
elif "radioButton" in name:
|
||||
qtype = QRadioButton
|
||||
elif "tableView" in name:
|
||||
qtype = QTableView
|
||||
|
||||
return qtype
|
||||
|
||||
def find(self, qtype, name):
|
||||
"""Find an ui component
|
||||
|
||||
@@ -101,6 +117,9 @@ class ASubWindow(QDialog, WindowToolKit):
|
||||
Returns:
|
||||
return the component
|
||||
"""
|
||||
if qtype is None:
|
||||
qtype = self._qtype_from_component_name(name)
|
||||
|
||||
return self.ui.findChild(qtype, name)
|
||||
|
||||
def set_line_edit_text(self, name:str, text:str):
|
||||
|
||||
@@ -59,6 +59,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
|
||||
|
||||
# Model
|
||||
self.model = None
|
||||
|
||||
# UI
|
||||
self.ui = loadUi(
|
||||
os.path.join(os.path.dirname(__file__), "ui", "MainWindow.ui"),
|
||||
|
||||
Reference in new issue
Block a user