def __init__(self, points: List[VPoint], links: List[VLink], pos: bool = False, parent=None): super(EditPointDialog, self).__init__(parent) self.setupUi(self) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) icon = self.windowIcon() self.LinkIcon = QIcon(QPixmap(":/icons/link.png")) self.points = points self.links = links for i, e in enumerate(colorName): self.Color.insertItem(i, colorIcons(e), e) for vlink in links: self.noSelected.addItem(QListWidgetItem(self.LinkIcon, vlink.name)) if pos is False: self.Point.addItem(icon, 'Point{}'.format(len(points))) self.Point.setEnabled(False) self.Color.setCurrentIndex(self.Color.findText('Green')) else: for i in range(len(points)): self.Point.insertItem(i, icon, 'Point{}'.format(i)) self.Point.setCurrentIndex(pos)
def editArgs(self, row: int, name: str, color: str, points: str): """Edite a link.""" for i, e in enumerate((name, color, points)): item = QTableWidgetItem(e) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) if i == 1: item.setIcon(colorIcons(e)) self.setItem(row, i, item)
def editArgs(self, row: int, Links: str, Type: str, Color: str, x: float, y: float): """Edite a point.""" for i, e in enumerate([ 'Point{}'.format(row), Links, Type, Color, x, y, "({}, {})".format(x, y) ]): item = QTableWidgetItem(str(e)) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) if i == 3: item.setIcon(colorIcons(e)) self.setItem(row, i, item)
def __init__(self, Points, Links, pos=False, parent=None): super(edit_link_show, self).__init__(parent) self.setupUi(self) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.Points = Points self.Links = Links icon = self.windowIcon() self.PointIcon = QIcon(QPixmap(":/icons/bearing.png")) for i, e in enumerate(colorName()): self.Color.insertItem(i, colorIcons(e), e) for i in range(len(self.Points)): self.noSelected.addItem( QListWidgetItem(self.PointIcon, 'Point{}'.format(i))) if pos is False: self.Link.addItem(icon, "New link") self.Link.setEnabled(False) self.Color.setCurrentIndex(self.Color.findText('Blue')) else: for vlink in self.Links: self.Link.insertItem(i, icon, vlink.name) self.Link.setCurrentIndex(pos) self.name_edit.textChanged.connect(self.isOk) self.isOk()