def __init__(self, parent=None): QDialog.__init__(self, parent) self.resize(290, 136) self.setWindowTitle("Runway Setup") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) verticalLayoutDlg = QVBoxLayout(self) verticalLayoutDlg.setObjectName(("verticalLayoutDlg")) self.basicFrame = Frame(self) verticalLayoutDlg.addWidget(self.basicFrame) self.groupBox = GroupBox(self.basicFrame) self.basicFrame.Add = self.groupBox self.pnlName = TextBoxPanel(self.groupBox) self.pnlName.Caption = "Name" self.pnlName.LabelWidth = 70 self.groupBox.Add = self.pnlName self.pnlDesignatorFrame = Frame(self.groupBox, "HL") self.groupBox.Add = self.pnlDesignatorFrame self.pnlDesignator = TextBoxPanel(self.groupBox) self.pnlDesignator.Caption = "Designator" self.pnlDesignator.LabelWidth = 70 self.pnlDesignator.Button = "Calculator.bmp" self.pnlDesignatorFrame.Add = self.pnlDesignator self.cmbDesignator = ComboBoxPanel(self.groupBox) self.cmbDesignator.Caption = "" self.cmbDesignator.LabelWidth = 0 self.cmbDesignator.Items = ["", "L", "C", "R"] self.pnlDesignatorFrame.Add = self.cmbDesignator self.gbPositions = GroupBox(self.groupBox) self.gbPositions.Caption = "Positions" self.groupBox.Add = self.gbPositions self.pnlPosition = PositionPanel(self.gbPositions) # self.pnlPosition.hideframe_Altitude() self.pnlPosition.btnCalculater.setVisible(False) self.gbPositions.Add = self.pnlPosition self.pnlTree = Frame(self.gbPositions) self.gbPositions.Add = self.pnlTree self.trvPositions = TreeView(self.pnlTree) self.pnlTree.Add = self.trvPositions self.pnlButtons = Frame(self.pnlTree, "HL") self.pnlTree.Add = self.pnlButtons self.btnPrevious = QPushButton(self.pnlButtons) self.btnPrevious.setObjectName("btnPrevious") self.btnPrevious.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Prev_32x32.png"), QIcon.Normal, QIcon.Off) self.btnPrevious.setIcon(icon) self.pnlButtons.Add = self.btnPrevious self.btnInsert = QPushButton(self.pnlButtons) self.btnInsert.setObjectName("btnInsert") self.btnInsert.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off) self.btnInsert.setIcon(icon) self.pnlButtons.Add = self.btnInsert self.btnRemove = QPushButton(self.pnlButtons) self.btnRemove.setObjectName("btnRemove") self.btnRemove.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon) self.pnlButtons.Add = self.btnRemove self.btnNext = QPushButton(self.pnlButtons) self.btnNext.setObjectName("btnNext") self.btnNext.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Next_32x32.png"), QIcon.Normal, QIcon.Off) self.btnNext.setIcon(icon) self.pnlButtons.Add = self.btnNext self.btnBoxOkCancel = QDialogButtonBox(self) self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel")) self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok) self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg) self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject) verticalLayoutDlg.addWidget(self.btnBoxOkCancel) self.btnOK.setText("Save") self.connect(self.pnlDesignator, SIGNAL("Event_1"), self.method_14) self.connect(self.pnlPosition, SIGNAL("captureFinished"), self.method_13) self.btnInsert.clicked.connect(self.btnInsert_Click) self.btnNext.clicked.connect(self.btnNext_Click) self.btnPrevious.clicked.connect(self.btnPrevious_Click) self.btnRemove.clicked.connect(self.btnRemove_Click) self.trvPositions.clicked.connect(self.trvPositions_clicked)
def setupUi(self, MainWindow): # MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(500, 500) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.frame.setObjectName(_fromUtf8("frame")) self.horizontalLayout_4 = QtGui.QHBoxLayout(self.frame) self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) self.tabControl = QtGui.QTabWidget(self.frame) self.tabControl.setObjectName(_fromUtf8("tabControl")) self.tabQA = QtGui.QWidget(self.tabControl) self.tabQA.setObjectName(_fromUtf8("tabQA")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.tabQA) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.treeView = TreeView(self.tabQA) #QtGui.QTreeWidget(self.tabQA) # self.treeView.setObjectName(_fromUtf8("treeView")) # self.treeView.headerItem().setText(0, _fromUtf8("1")) # self.horizontalLayout_2.addWidget(self.treeView) self.tabControl.addTab(self.tabQA, _fromUtf8("")) self.tabReport = QtGui.QWidget(self.tabControl) self.tabReport.setObjectName(_fromUtf8("tabReport")) self.horizontalLayout_3 = QtGui.QHBoxLayout(self.tabReport) self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) self.treeViewReport = TreeView( self.tabReport) #QtGui.QTreeWidget(self.tabReport) # self.treeViewReport.setObjectName(_fromUtf8("treeViewReport")) # self.treeViewReport.headerItem().setText(0, _fromUtf8("1")) # self.horizontalLayout_3.addWidget(self.treeViewReport) self.tabControl.addTab(self.tabReport, _fromUtf8("")) self.horizontalLayout_4.addWidget(self.tabControl) self.pnlEntry = QtGui.QFrame(self.frame) self.pnlEntry.setFrameShape(QtGui.QFrame.StyledPanel) self.pnlEntry.setFrameShadow(QtGui.QFrame.Raised) self.pnlEntry.setObjectName(_fromUtf8("pnlEntry")) self.verticalLayout = QtGui.QVBoxLayout(self.pnlEntry) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.richBox = QtGui.QPlainTextEdit(self.pnlEntry) self.richBox.setObjectName(_fromUtf8("richBox")) self.verticalLayout.addWidget(self.richBox) self.picSnapshot = QtGui.QFrame(self.pnlEntry) self.picSnapshot.setMinimumSize(QtCore.QSize(0, 200)) self.picSnapshot.setFrameShape(QtGui.QFrame.StyledPanel) self.picSnapshot.setFrameShadow(QtGui.QFrame.Raised) self.picSnapshot.setObjectName(_fromUtf8("picSnapshot")) self.verticalLayout.addWidget(self.picSnapshot) self.lblDateTime = QtGui.QLabel(self.pnlEntry) self.lblDateTime.setText(_fromUtf8("")) self.lblDateTime.setObjectName(_fromUtf8("lblDateTime")) self.verticalLayout.addWidget(self.lblDateTime) self.horizontalLayout_4.addWidget(self.pnlEntry) self.verticalLayout_2.addWidget(self.frame) self.frame_2 = QtGui.QFrame(self.centralwidget) self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_2.setFrameShadow(QtGui.QFrame.Raised) self.frame_2.setObjectName(_fromUtf8("frame_2")) self.verticalLayout_3 = QtGui.QVBoxLayout(self.frame_2) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.frame_3 = QtGui.QFrame(self.frame_2) self.frame_3.setFrameShape(QtGui.QFrame.StyledPanel) self.frame_3.setFrameShadow(QtGui.QFrame.Raised) self.frame_3.setObjectName(_fromUtf8("frame_3")) self.horizontalLayout = QtGui.QHBoxLayout(self.frame_3) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.lblHeading = QtGui.QLabel(self.frame_3) self.lblHeading.setObjectName(_fromUtf8("lblHeading")) self.horizontalLayout.addWidget(self.lblHeading) self.txtComment = QtGui.QLineEdit(self.frame_3) self.txtComment.setObjectName(_fromUtf8("txtComment")) self.horizontalLayout.addWidget(self.txtComment) self.verticalLayout_3.addWidget(self.frame_3) self.txtHeading = QtGui.QLineEdit(self.frame_2) self.txtHeading.setObjectName(_fromUtf8("txtHeading")) self.verticalLayout_3.addWidget(self.txtHeading) self.btnSubmit = QtGui.QPushButton(self.frame_2) self.btnSubmit.setObjectName(_fromUtf8("btnSubmit")) self.verticalLayout_3.addWidget(self.btnSubmit) self.verticalLayout_2.addWidget(self.frame_2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 799, 21)) self.menubar.setObjectName(_fromUtf8("menubar")) self.mniFile = QtGui.QMenu(self.menubar) self.mniFile.setObjectName(_fromUtf8("mniFile")) self.mniEdit = QtGui.QMenu(self.menubar) self.mniEdit.setObjectName(_fromUtf8("mniEdit")) MainWindow.setMenuBar(self.menubar) self.toolBar = QtGui.QToolBar(MainWindow) self.toolBar.setObjectName(_fromUtf8("toolBar")) MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.mniFileExportQA = QtGui.QAction(MainWindow) self.mniFileExportQA.setObjectName(_fromUtf8("mniFileExportQA")) self.mniFileExportReport = QtGui.QAction(MainWindow) self.mniFileExportReport.setObjectName( _fromUtf8("mniFileExportReport")) self.mniFileClose = QtGui.QAction(MainWindow) self.mniFileClose.setObjectName(_fromUtf8("mniFileClose")) self.mniEditCopy = QtGui.QAction(MainWindow) self.mniEditCopy.setObjectName(_fromUtf8("mniEditCopy")) self.mniEditDelete = QtGui.QAction(MainWindow) self.mniEditDelete.setObjectName(_fromUtf8("mniEditDelete")) self.mniEditExportWord = QtGui.QAction(MainWindow) self.mniEditExportWord.setObjectName(_fromUtf8("mniEditExportWord")) self.mniEditComment = QtGui.QAction(MainWindow) self.mniEditComment.setObjectName(_fromUtf8("mniEditComment")) self.mniEditExportSST = QtGui.QAction(MainWindow) self.mniEditExportSST.setObjectName(_fromUtf8("mniEditExportSST")) self.mniEditRestoreView = QtGui.QAction(MainWindow) self.mniEditRestoreView.setObjectName(_fromUtf8("mniEditRestoreView")) self.mniFile.addAction(self.mniFileExportQA) self.mniFile.addAction(self.mniFileExportReport) self.mniFile.addSeparator() self.mniFile.addAction(self.mniFileClose) self.mniEdit.addAction(self.mniEditCopy) self.mniEdit.addAction(self.mniEditDelete) self.mniEdit.addSeparator() self.mniEdit.addAction(self.mniEditExportWord) self.mniEdit.addAction(self.mniEditComment) self.mniEdit.addAction(self.mniEditExportSST) self.mniEdit.addAction(self.mniEditRestoreView) self.menubar.addAction(self.mniFile.menuAction()) self.menubar.addAction(self.mniEdit.menuAction()) self.retranslateUi(MainWindow) self.tabControl.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(MainWindow)
class DlgRunway(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.resize(290, 136) self.setWindowTitle("Runway Setup") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) verticalLayoutDlg = QVBoxLayout(self) verticalLayoutDlg.setObjectName(("verticalLayoutDlg")) self.basicFrame = Frame(self) verticalLayoutDlg.addWidget(self.basicFrame) self.groupBox = GroupBox(self.basicFrame) self.basicFrame.Add = self.groupBox self.pnlName = TextBoxPanel(self.groupBox) self.pnlName.Caption = "Name" self.pnlName.LabelWidth = 70 self.groupBox.Add = self.pnlName self.pnlDesignatorFrame = Frame(self.groupBox, "HL") self.groupBox.Add = self.pnlDesignatorFrame self.pnlDesignator = TextBoxPanel(self.groupBox) self.pnlDesignator.Caption = "Designator" self.pnlDesignator.LabelWidth = 70 self.pnlDesignator.Button = "Calculator.bmp" self.pnlDesignatorFrame.Add = self.pnlDesignator self.cmbDesignator = ComboBoxPanel(self.groupBox) self.cmbDesignator.Caption = "" self.cmbDesignator.LabelWidth = 0 self.cmbDesignator.Items = ["", "L", "C", "R"] self.pnlDesignatorFrame.Add = self.cmbDesignator self.gbPositions = GroupBox(self.groupBox) self.gbPositions.Caption = "Positions" self.groupBox.Add = self.gbPositions self.pnlPosition = PositionPanel(self.gbPositions) # self.pnlPosition.hideframe_Altitude() self.pnlPosition.btnCalculater.setVisible(False) self.gbPositions.Add = self.pnlPosition self.pnlTree = Frame(self.gbPositions) self.gbPositions.Add = self.pnlTree self.trvPositions = TreeView(self.pnlTree) self.pnlTree.Add = self.trvPositions self.pnlButtons = Frame(self.pnlTree, "HL") self.pnlTree.Add = self.pnlButtons self.btnPrevious = QPushButton(self.pnlButtons) self.btnPrevious.setObjectName("btnPrevious") self.btnPrevious.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Prev_32x32.png"), QIcon.Normal, QIcon.Off) self.btnPrevious.setIcon(icon) self.pnlButtons.Add = self.btnPrevious self.btnInsert = QPushButton(self.pnlButtons) self.btnInsert.setObjectName("btnInsert") self.btnInsert.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off) self.btnInsert.setIcon(icon) self.pnlButtons.Add = self.btnInsert self.btnRemove = QPushButton(self.pnlButtons) self.btnRemove.setObjectName("btnRemove") self.btnRemove.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon) self.pnlButtons.Add = self.btnRemove self.btnNext = QPushButton(self.pnlButtons) self.btnNext.setObjectName("btnNext") self.btnNext.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Next_32x32.png"), QIcon.Normal, QIcon.Off) self.btnNext.setIcon(icon) self.pnlButtons.Add = self.btnNext self.btnBoxOkCancel = QDialogButtonBox(self) self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel")) self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok) self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg) self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject) verticalLayoutDlg.addWidget(self.btnBoxOkCancel) self.btnOK.setText("Save") self.connect(self.pnlDesignator, SIGNAL("Event_1"), self.method_14) self.connect(self.pnlPosition, SIGNAL("captureFinished"), self.method_13) self.btnInsert.clicked.connect(self.btnInsert_Click) self.btnNext.clicked.connect(self.btnNext_Click) self.btnPrevious.clicked.connect(self.btnPrevious_Click) self.btnRemove.clicked.connect(self.btnRemove_Click) self.trvPositions.clicked.connect(self.trvPositions_clicked) # item = self.trvPositions.Add("Parent") # item.appendRow(TreeNode("Child0")) # # item00 = item0.appendRow(TreeNode("Child00")) def trvPositions_clicked(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return tag = selectedNode.Tag if (tag == None): return if not tag.IsEmpty and tag.IsValid: self.pnlPosition.Point3d = tag.Point3d else: self.pnlPosition.Point3d = None def get_Runway(self): return self.method_6() def set_Runway(self, runway): if (runway != None): self.pnlName.Value = runway.Name self.pnlDesignator.Value = runway.DesignatorHeading self.cmbDesignator.SelectedIndex = self.cmbDesignator.comboBox.findText( (runway.DesignatorCode)) self.method_5(runway) RunwayValue = property(get_Runway, set_Runway, None, None) def acceptDlg(self): current = None # self.errorProvider.method_1() # self.pnlName.method_0() for current in self.trvPositions.Nodes: # IEnumerator enumerator = self.trvPositions.Nodes.GetEnumerator() # try # { # while (true) # { # if (enumerator.MoveNext()) # { # current = (TreeNode)enumerator.Current tag = current.Tag if (not tag.IsValidIncludingAltitude): if (tag.Type == PositionType.THR): break if (tag.Type == PositionType.END): break elif (not tag.IsEmpty): self.trvPositions.SelectedNode = current self.emit(SIGNAL("DlgRunway_accept"), self.method_6()) # self.pnlPosition.method_6() return for treeNode in current.Nodes: # IEnumerator enumerator1 = current.Nodes.GetEnumerator() # try # { # while (enumerator1.MoveNext()) # { # TreeNode treeNode = (TreeNode)enumerator1.Current position = current.Tag if (position.IsValidIncludingAltitude or position.IsEmpty): continue self.trvPositions.SelectedNode = treeNode self.pnlPosition.method_6() self.emit(SIGNAL("DlgRunway_accept"), self.method_6()) return # } # } # finally # { # IDisposable disposable = enumerator1 as IDisposable # if (disposable != null) # { # disposable.Dispose() # } # } # } # else # { # goto Label0 # } # } self.trvPositions.SelectedNode = current # self.pnlPosition.method_6() self.emit(SIGNAL("DlgRunway_accept"), self.method_6()) # } # finally # { # IDisposable disposable1 = enumerator as IDisposable # if (disposable1 != null) # { # disposable1.Dispose() # } # } # return # Label0: # if (!self.errorProvider.HasErrors) # { # if (self.method_6().method_7(self)) # { # base.DialogResult = System.Windows.Forms.DialogResult.OK # } # return # } # else # { # return # } self.accept() def btnInsert_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return tag = selectedNode.Tag if (tag == None): return if (tag.Type == PositionType.THR): selectedNode = selectedNode.Insert( 0, PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) elif (tag.Type != PositionType.END): if (tag.Type != PositionType.Position): return if selectedNode.Parent == None: selectedNode = self.trvPositions.Insert( selectedNode.Index, PositionType.VariableNames[PositionType.Position - 1]) else: selectedNode = selectedNode.Parent.Insert( selectedNode.Index, PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) else: selectedNode = selectedNode.PrevNode.Add( PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) self.trvPositions.SelectedNode = selectedNode def btnNext_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.NextNode == None): self.trvPositions.SelectedNode = selectedNode.Parent.NextNode return self.trvPositions.SelectedNode = selectedNode.NextNode else: if (len(selectedNode.Nodes) > 0): self.trvPositions.SelectedNode = selectedNode.Nodes[0] return if (selectedNode.NextNode != None): self.trvPositions.SelectedNode = selectedNode.NextNode return def btnPrevious_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.Index == 0): self.trvPositions.SelectedNode = selectedNode.Parent return self.trvPositions.SelectedNode = selectedNode.PrevNode else: selectedNode = selectedNode.PrevNode if (selectedNode != None): if (len(selectedNode.Nodes) <= 0): self.trvPositions.SelectedNode = selectedNode return self.trvPositions.SelectedNode = selectedNode.LastNode return def btnRemove_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.NextNode != None): self.trvPositions.SelectedNode = selectedNode.NextNode elif (selectedNode.Parent.NextNode != None): self.trvPositions.SelectedNode = selectedNode.Parent.NextNode else: self.trvPositions.SelectedNode = selectedNode.Parent parentNode = selectedNode.Parent if parentNode == None: self.trvPositions.Remove(selectedNode) else: parentNode.Remove(selectedNode) else: self.trvPositions.Remove(selectedNode) def method_5(self, runway_0): self.trvPositions.treeNodeList = [] if (runway_0 != None): position = runway_0.method_1(PositionType.START) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = runway_0.method_1(PositionType.THR) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = runway_0.method_1(PositionType.END) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = runway_0.method_1(PositionType.SWY) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = runway_0.method_1(PositionType.CWY) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position item = self.trvPositions.Nodes[1] for position0 in runway_0: if (position0.Type != PositionType.Position): continue item.Add(PositionType.VariableNames[position0.Type - 1]).Tag = position0 # item.Expand() else: self.trvPositions.Add("START").Tag = Position(PositionType.START) self.trvPositions.Add("THR").Tag = Position(PositionType.THR) self.trvPositions.Add("END").Tag = Position(PositionType.END) self.trvPositions.Add("SWY").Tag = Position(PositionType.SWY) self.trvPositions.Add("CWY").Tag = Position(PositionType.CWY) self.trvPositions.SelectedNode = self.trvPositions.Nodes[0] self.method_10() def method_6(self): runway = Runway() runway.Name = self.pnlName.Value runway.DesignatorHeading = self.pnlDesignator.Value if (self.cmbDesignator.SelectedIndex > 0): runway.DesignatorCode = self.cmbDesignator.SelectedItem #.ToString() for node in self.trvPositions.Nodes: tag = node.Tag runway[node.Index] = tag if (tag.Type != PositionType.THR): continue for treeNode in node.Nodes: position = treeNode.Tag if position == None: continue if (not position.IsValidIncludingAltitude): continue runway.Add(position) return runway def method_7(self): selectedNode = self.trvPositions.SelectedNode flag = False if (selectedNode != None): flag = True if ( selectedNode.PrevNode != None) else selectedNode.Parent != None self.btnPrevious.setEnabled(flag) nextNode = False if (selectedNode != None): if (selectedNode.NextNode != None): nextNode = True elif (selectedNode.Parent != None): nextNode = selectedNode.Parent.NextNode != None self.btnNext.setEnabled(nextNode) flag1 = False if (selectedNode != None): tag = selectedNode.Tag if (tag != None): flag1 = True if (tag.Type == PositionType.THR or tag.Type == PositionType.Position ) else tag.Type == PositionType.END self.btnInsert.setEnabled(flag1) type = False if (selectedNode != None): position = selectedNode.Tag if (position != None): type = position.Type == PositionType.Position self.btnRemove.setEnabled(type) def method_8(self, treeNode_0, bool_0): if (treeNode_0 != None): text = treeNode_0.Text treeNode_0.Text = " " if (not bool_0): treeNode_0.NodeFont = QFont() else: font = QFont() font.setBold(True) treeNode_0.NodeFont = font treeNode_0.Text = text def method_9(self, treeNode_0): position = treeNode_0.Tag if not isinstance(position, Position): return num = 0 if (not position.IsValidIncludingAltitude): if (position.Type != PositionType.THR): if (position.Type == PositionType.END): num = 2 else: if (not position.IsEmpty): num = 2 # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for node in treeNode_0.Nodes: self.method_9(node) return else: # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for treeNode in treeNode_0.Nodes: self.method_9(treeNode) return num = 2 else: num = 1 # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for node1 in treeNode_0.Nodes: self.method_9(node1) def method_10(self): for node in self.trvPositions.Nodes: self.method_9(node) def method_11(self): point3d_0 = Point3D.get_Origin() selectedNode = self.trvPositions.SelectedNode if (selectedNode != None): selectedNode = selectedNode.PrevNode if (selectedNode != None): if (len(selectedNode.Nodes) > 0): selectedNode = selectedNode.LastNode point3d_0 = selectedNode.Tag.Point3d return True, point3d_0 return False, None def method_12(self): # Point3d point3d # Point3d point3d1 # if (AcadHelper.Ready) # { # AcadHelper.smethod_27(DrawingSpace.ModelSpace, true) # Position tag = self.trvPositions.SelectedNode.Tag as Position # string rUNWAYPOSITION = Captions.RUNWAY_POSITION # if (tag.Type != PositionType.Position) # { # rUNWAYPOSITION = string.Format(Captions.RUNWAY_X_POSITION, EnumHelper.smethod_0(tag.Type)) # } # if (self.method_11(out point3d1)) # { # if (!AcadHelper.smethod_82(this, rUNWAYPOSITION, point3d1, out point3d)) # { # return # } # } # else if (!AcadHelper.smethod_80(this, rUNWAYPOSITION, out point3d)) # { # return # } # self.pnlPosition.Point3d = point3d self.method_13() def method_13(self): if self.trvPositions.SelectedNode == None: return self.pnlPosition.posType = self.trvPositions.SelectedNode.Tag.Type self.trvPositions.SelectedNode.Tag = self.pnlPosition.PositionValue self.method_10() def method_14(self): runway = self.method_6() self.pnlDesignator.Value = runway.method_0() @staticmethod def smethod_0(iwin32Window_0, runway_0): flag = False dlgRunway = DlgRunway(iwin32Window_0) dlgRunway.RunwayValue = runway_0 dlgRunway.show() # if (dlgRunway.method_2(iwin32Window_0) != System.Windows.Forms.DialogResult.OK) # { # flag = false # } # else # { # runway_0 = dlgRunway.Runway # flag = true # } # } return dlgRunway
class DlgFato(QDialog): def __init__(self, parent=None): QDialog.__init__(self, parent) self.resize(290, 136) self.setWindowTitle("Runway Setup") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) verticalLayoutDlg = QVBoxLayout(self) verticalLayoutDlg.setObjectName(("verticalLayoutDlg")) self.basicFrame = Frame(self) verticalLayoutDlg.addWidget(self.basicFrame) self.groupBox = GroupBox(self.basicFrame) self.basicFrame.Add = self.groupBox self.pnlName = TextBoxPanel(self.groupBox) self.pnlName.Caption = "Name" self.pnlName.LabelWidth = 70 self.groupBox.Add = self.pnlName self.pnlDesignatorFrame = Frame(self.groupBox, "HL") self.groupBox.Add = self.pnlDesignatorFrame self.pnlDesignator = TextBoxPanel(self.groupBox) self.pnlDesignator.Caption = "Designator" self.pnlDesignator.LabelWidth = 70 self.pnlDesignator.Button = "Calculator.bmp" self.pnlDesignatorFrame.Add = self.pnlDesignator self.cmbDesignator = ComboBoxPanel(self.groupBox) self.cmbDesignator.Caption = "" self.cmbDesignator.LabelWidth = 0 self.cmbDesignator.Items = ["", "L", "C", "R"] self.pnlDesignatorFrame.Add = self.cmbDesignator self.gbPositions = GroupBox(self.groupBox) self.gbPositions.Caption = "Positions" self.groupBox.Add = self.gbPositions self.pnlPosition = PositionPanel(self.gbPositions) # self.pnlPosition.hideframe_Altitude() self.pnlPosition.btnCalculater.setVisible(False) self.gbPositions.Add = self.pnlPosition self.pnlTree = Frame(self.gbPositions) self.gbPositions.Add = self.pnlTree self.trvPositions = TreeView(self.pnlTree) self.pnlTree.Add = self.trvPositions self.pnlButtons = Frame(self.pnlTree, "HL") self.pnlTree.Add = self.pnlButtons self.btnPrevious = QPushButton(self.pnlButtons) self.btnPrevious.setObjectName("btnPrevious") self.btnPrevious.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Prev_32x32.png"), QIcon.Normal, QIcon.Off) self.btnPrevious.setIcon(icon) self.pnlButtons.Add = self.btnPrevious self.btnInsert = QPushButton(self.pnlButtons) self.btnInsert.setObjectName("btnInsert") self.btnInsert.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off) self.btnInsert.setIcon(icon) self.pnlButtons.Add = self.btnInsert self.btnRemove = QPushButton(self.pnlButtons) self.btnRemove.setObjectName("btnRemove") self.btnRemove.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off) self.btnRemove.setIcon(icon) self.pnlButtons.Add = self.btnRemove self.btnNext = QPushButton(self.pnlButtons) self.btnNext.setObjectName("btnNext") self.btnNext.setText("") icon = QIcon() icon.addPixmap(QPixmap("Resource/btnImage/Next_32x32.png"), QIcon.Normal, QIcon.Off) self.btnNext.setIcon(icon) self.pnlButtons.Add = self.btnNext self.pnlSafetyAreaWidth = DistanceBoxPanel(self.groupBox, DistanceUnits.M) self.pnlSafetyAreaWidth.Caption = "Safety Area Width" self.pnlSafetyAreaWidth.LabelWidth = 250 self.groupBox.Add = self.pnlSafetyAreaWidth self.pnlSafetyAreaStart = DistanceBoxPanel(self.groupBox, DistanceUnits.M) self.pnlSafetyAreaStart.Caption = "Safety Area Length [START -> boundary]" self.pnlSafetyAreaStart.LabelWidth = 250 self.groupBox.Add = self.pnlSafetyAreaStart self.pnlSafetyAreaEnd = DistanceBoxPanel(self.groupBox, DistanceUnits.M) self.pnlSafetyAreaEnd.Caption = "Safety Area Length [END -> boundary]" self.pnlSafetyAreaEnd.LabelWidth = 250 self.groupBox.Add = self.pnlSafetyAreaEnd self.btnBoxOkCancel = QDialogButtonBox(self) self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel")) self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok) self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg) self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject) verticalLayoutDlg.addWidget(self.btnBoxOkCancel) self.btnOK.setText("Save") self.connect(self.pnlDesignator, SIGNAL("Event_1"), self.method_15) self.connect(self.pnlPosition, SIGNAL("captureFinished"), self.method_14) self.btnInsert.clicked.connect(self.btnInsert_Click) self.btnNext.clicked.connect(self.btnNext_Click) self.btnPrevious.clicked.connect(self.btnPrevious_Click) self.btnRemove.clicked.connect(self.btnRemove_Click) self.trvPositions.clicked.connect(self.trvPositions_clicked) def trvPositions_clicked(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return tag = selectedNode.Tag if (tag == None): return self.pnlPosition.posType = tag.Type if not tag.IsEmpty and tag.IsValid: self.pnlPosition.Point3d = tag.Point3d else: self.pnlPosition.Point3d = None def get_Fato(self): return self.method_6() def set_Fato(self, fato): if (fato != None): self.pnlName.Value = fato.Name self.pnlDesignator.Value = fato.DesignatorHeading self.cmbDesignator.SelectedIndex = self.cmbDesignator.FindString( fato.DesignatorCode) self.pnlSafetyAreaWidth.Value = Distance(fato.SafetyAreaWidth) self.pnlSafetyAreaStart.Value = Distance(fato.SafetyAreaStart) self.pnlSafetyAreaEnd.Value = Distance(fato.SafetyAreaEnd) self.method_5(fato) Fato = property(get_Fato, set_Fato, None, None) def acceptDlg(self): current = None # self.errorProvider.method_1() # self.pnlName.method_0() for current in self.trvPositions.Nodes: # IEnumerator enumerator = self.trvPositions.Nodes.GetEnumerator() # try # { # while (true) # { # if (enumerator.MoveNext()) # { # current = (TreeNode)enumerator.Current tag = current.Tag if (not tag.IsValidIncludingAltitude): if (tag.Type == PositionType.START): break if (tag.Type == PositionType.END): break elif (not tag.IsEmpty): self.trvPositions.SelectedNode = current fato = self.method_6() self.emit(SIGNAL("DlgFato_accept"), fato) # self.pnlPosition.method_6() return for treeNode in current.Nodes: # IEnumerator enumerator1 = current.Nodes.GetEnumerator() # try # { # while (enumerator1.MoveNext()) # { # TreeNode treeNode = (TreeNode)enumerator1.Current position = current.Tag if (position.IsValidIncludingAltitude or position.IsEmpty): continue self.trvPositions.SelectedNode = treeNode self.pnlPosition.method_6() fato = self.method_6() self.emit(SIGNAL("DlgFato_accept"), fato) return # } # } # finally # { # IDisposable disposable = enumerator1 as IDisposable # if (disposable != null) # { # disposable.Dispose() # } # } # } # else # { # goto Label0 # } # } self.trvPositions.SelectedNode = current # self.pnlPosition.method_6() fato = self.method_6() self.emit(SIGNAL("DlgFato_accept"), fato) # } # finally # { # IDisposable disposable1 = enumerator as IDisposable # if (disposable1 != null) # { # disposable1.Dispose() # } # } # return # Label0: # if (!self.errorProvider.HasErrors) # { # if (self.method_6().method_7(self)) # { # base.DialogResult = System.Windows.Forms.DialogResult.OK # } # return # } # else # { # return # } self.accept() def btnInsert_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return tag = selectedNode.Tag if (tag == None): return if (tag.Type == PositionType.START): selectedNode = selectedNode.Insert( 0, PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) elif (tag.Type != PositionType.END): if (tag.Type != PositionType.Position): return if selectedNode.Parent == None: selectedNode = self.trvPositions.Insert( selectedNode.Index, PositionType.VariableNames[PositionType.Position - 1]) else: selectedNode = selectedNode.Parent.Insert( selectedNode.Index, PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) else: selectedNode = selectedNode.PrevNode.Add( PositionType.VariableNames[PositionType.Position - 1]) selectedNode.Tag = Position(PositionType.Position) self.trvPositions.SelectedNode = selectedNode def btnNext_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.NextNode == None): self.trvPositions.SelectedNode = selectedNode.Parent.NextNode return self.trvPositions.SelectedNode = selectedNode.NextNode else: if (len(selectedNode.Nodes) > 0): self.trvPositions.SelectedNode = selectedNode.Nodes[0] return if (selectedNode.NextNode != None): self.trvPositions.SelectedNode = selectedNode.NextNode return def btnPrevious_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.Index == 0): self.trvPositions.SelectedNode = selectedNode.Parent return self.trvPositions.SelectedNode = selectedNode.PrevNode else: selectedNode = selectedNode.PrevNode if (selectedNode != None): if (len(selectedNode.Nodes) <= 0): self.trvPositions.SelectedNode = selectedNode return self.trvPositions.SelectedNode = selectedNode.LastNode return def btnRemove_Click(self): selectedNode = self.trvPositions.SelectedNode if (selectedNode == None): return if (selectedNode.Parent != None): if (selectedNode.NextNode != None): self.trvPositions.SelectedNode = selectedNode.NextNode elif (selectedNode.Parent.NextNode != None): self.trvPositions.SelectedNode = selectedNode.Parent.NextNode else: self.trvPositions.SelectedNode = selectedNode.Parent parentNode = selectedNode.Parent if parentNode == None: self.trvPositions.Remove(selectedNode) else: parentNode.Remove(selectedNode) else: self.trvPositions.Remove(selectedNode) def method_5(self, fato_0): self.trvPositions.Clear() if (fato_0 != None): position = fato_0.method_1(PositionType.START) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = fato_0.method_1(PositionType.END) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position position = fato_0.method_1(PositionType.CWY) self.trvPositions.Add(PositionType.VariableNames[position.Type - 1]).Tag = position item = self.trvPositions.Nodes[0] for fato0 in fato_0: if (fato0.Type != PositionType.Position): continue item.Add(PositionType.VariableNames[fato0.Type - 1]).Tag = fato0 else: self.trvPositions.Nodes.Add("START").Tag = Position( PositionType.START) self.trvPositions.Nodes.Add("END").Tag = Position(PositionType.END) self.trvPositions.Nodes.Add("CWY").Tag = Position(PositionType.CWY) self.trvPositions.SelectedNode = self.trvPositions.Nodes[0] self.pnlPosition.posType = PositionType.START self.method_10() def method_6(self): fato = Fato() fato.Name = self.pnlName.Value fato.DesignatorHeading = self.pnlDesignator.Value if (self.cmbDesignator.SelectedIndex > 0): fato.DesignatorCode = self.cmbDesignator.SelectedItem fato.SafetyAreaWidth = self.pnlSafetyAreaWidth.Value.Metres fato.SafetyAreaStart = self.pnlSafetyAreaStart.Value.Metres fato.SafetyAreaEnd = self.pnlSafetyAreaEnd.Value.Metres for node in self.trvPositions.Nodes: tag = node.Tag # as Position fato[node.Index] = tag if (tag.Type != PositionType.START): continue for treeNode in node.Nodes: position = treeNode.Tag # as Position if (not position.IsValidIncludingAltitude): continue fato.Add(position) return fato def method_7(self): selectedNode = self.trvPositions.SelectedNode flag = False if (selectedNode != None): flag = True if ( selectedNode.PrevNode != None) else selectedNode.Parent != None self.btnPrevious.setEnabled(flag) nextNode = False if (selectedNode != None): if (selectedNode.NextNode != None): nextNode = True elif (selectedNode.Parent != None): nextNode = selectedNode.Parent.NextNode != None self.btnNext.setEnabled(nextNode) flag1 = False if (selectedNode != None): tag = selectedNode.Tag if (tag != None): flag1 = True if (tag.Type == PositionType.START or tag.Type == PositionType.Position ) else tag.Type == PositionType.END self.btnInsert.setEnabled(flag1) type = False if (selectedNode != None): position = selectedNode.Tag if (position != None): type = position.Type == PositionType.Position self.btnRemove.setEnabled(type) def method_8(self, treeNode_0, bool_0): if (treeNode_0 != None): text = treeNode_0.Text treeNode_0.Text = " " if (not bool_0): treeNode_0.NodeFont = QFont() else: font = QFont() font.setBold(True) treeNode_0.NodeFont = font treeNode_0.Text = text def method_9(self, treeNode_0): position = treeNode_0.Tag if not isinstance(position, Position): return num = 0 if (not position.IsValidIncludingAltitude): if (position.Type != PositionType.START): if (position.Type == PositionType.END): num = 2 else: if (not position.IsEmpty): num = 2 # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for node in treeNode_0.Nodes: self.method_9(node) return else: # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for treeNode in treeNode_0.Nodes: self.method_9(treeNode) return num = 2 else: num = 1 # treeNode_0.ImageIndex = num # treeNode_0.SelectedImageIndex = num for node1 in treeNode_0.Nodes: self.method_9(node1) def method_10(self): for node in self.trvPositions.Nodes: self.method_9(node) def method_11(self): point3d_0 = Point3D.get_Origin() selectedNode = self.trvPositions.SelectedNode if (selectedNode != None): selectedNode = selectedNode.PrevNode if (selectedNode != None): if (len(selectedNode.Nodes) > 0): selectedNode = selectedNode.LastNode point3d_0 = selectedNode.Tag.Point3d return True, point3d_0 return False, None def method_12(self, positionType_0): point3d_0 = Point3D.get_Origin() try: item = None if (positionType_0 == PositionType.START): item = self.trvPositions.Nodes[0] elif (positionType_0 == PositionType.END): item = self.trvPositions.Nodes[1] if (positionType_0 == PositionType.SWY): item = self.trvPositions.Nodes[2] if (item != None and item.Tag != None): point3d_0 = item.Tag.Point3d return True, point3d_0 except: pass return False, point3d_0 def method_14(self): self.trvPositions.SelectedNode.Tag = self.pnlPosition.PositionValue self.method_10() def method_15(self): fato = self.method_6() self.pnlDesignator.Value = fato.method_0() @staticmethod def smethod_0(iwin32Window_0, fato): flag = False dlgFato = DlgFato(iwin32Window_0) dlgFato.Fato = fato dlgFato.show() # if (dlgRunway.method_2(iwin32Window_0) != System.Windows.Forms.DialogResult.OK) # { # flag = false # } # else # { # runway_0 = dlgRunway.Runway # flag = true # } # } return dlgFato