mirror of https://gitlab.com/pamhyr/pamhyr2
Network: Make checkable add and del button.
parent
30c930d451
commit
dc7c7446ff
|
|
@ -167,13 +167,36 @@ class ASubWindow(QDialog):
|
|||
"""
|
||||
return self.find(QSpinBox, name).value()
|
||||
|
||||
def set_radio_button(self, name:str, checked:bool):
|
||||
"""Set value of spinbox component
|
||||
def set_push_button_checkable(self, name:str, checked:bool):
|
||||
"""Set value of push button component
|
||||
|
||||
Args:
|
||||
name: The spinbox component name
|
||||
name: The push button component name
|
||||
value: The new value
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
self.find(QPushButton, name).setChecked(checked)
|
||||
|
||||
def get_push_button_checkable(self, name:str):
|
||||
"""Get status of push button
|
||||
|
||||
Args:
|
||||
name: The push button component name
|
||||
|
||||
Returns:
|
||||
The status of push button
|
||||
"""
|
||||
return self.find(QPushButton, name).isChecked()
|
||||
|
||||
def set_radio_button(self, name:str, checked:bool):
|
||||
"""Set value of radio button component
|
||||
|
||||
Args:
|
||||
name: The radio button component name
|
||||
checked: Checked
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from PyQt5.QtCore import (
|
|||
|
||||
from PyQt5.QtWidgets import (
|
||||
QTableView, QItemDelegate, QComboBox, QLineEdit, QHBoxLayout, QSlider,
|
||||
QPushButton,
|
||||
)
|
||||
|
||||
class LineEditDelegate(QItemDelegate):
|
||||
|
|
@ -172,3 +173,20 @@ class NetworkWindow(ASubWindow):
|
|||
|
||||
self.nodes_model.dataChanged.connect(self.reachs_model.update)
|
||||
self.reachs_model.dataChanged.connect(self.nodes_model.update)
|
||||
|
||||
self.find(QPushButton, "pushButton_add").clicked.connect(
|
||||
self.clicked_add
|
||||
)
|
||||
|
||||
self.find(QPushButton, "pushButton_del").clicked.connect(
|
||||
self.clicked_del
|
||||
)
|
||||
|
||||
|
||||
def clicked_add(self):
|
||||
if self.get_push_button_checkable("pushButton_add"):
|
||||
self.set_push_button_checkable("pushButton_del", False)
|
||||
|
||||
def clicked_del(self):
|
||||
if self.get_push_button_checkable("pushButton_del"):
|
||||
self.set_push_button_checkable("pushButton_add", False)
|
||||
|
|
|
|||
|
|
@ -75,9 +75,6 @@ class NodeItem(QGraphicsItem):
|
|||
# painter.setPen(QPen(Qt.black, 0))
|
||||
painter.drawEllipse(-10, -10, 20, 20)
|
||||
|
||||
painter.setFont(QFont("Arial", 20))
|
||||
painter.drawText(QPoint(-10, -10), self.node.name)
|
||||
|
||||
def itemChange(self, change, value):
|
||||
if change == QGraphicsItem.ItemPositionHasChanged:
|
||||
self.graph.itemMoved()
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_19">
|
||||
<widget class="QPushButton" name="pushButton_add">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_20">
|
||||
<widget class="QPushButton" name="pushButton_del">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
|
|
|||
Loading…
Reference in New Issue