Exemplo n.º 1
0
class DlgAixmIap(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(290, 136)
        self.setWindowTitle("Instrument Approach Procedure (IAP)")
        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.groupBox = GroupBox(self)
        verticalLayoutDlg.addWidget(self.groupBox)

        self.pnlAerodrome = ComboBoxPanel(self.groupBox)
        self.pnlAerodrome.Caption = "Aerodrome"
        self.groupBox.Add = self.pnlAerodrome

        self.pnlDesignator = TextBoxPanel(self.groupBox)
        self.pnlDesignator.Caption = "Designator"
        self.groupBox.Add = self.pnlDesignator

        self.pnlAcCategory = ComboBoxPanel(self.groupBox)
        self.pnlAcCategory.Caption = "Ac. Category"
        self.groupBox.Add = self.pnlAcCategory

        self.pnlTransID = TextBoxPanel(self.groupBox)
        self.pnlTransID.Caption = "ransitional Identifier"
        self.groupBox.Add = self.pnlTransID

        self.pnlType = ComboBoxPanel(self.groupBox)
        self.pnlType.Caption = "Type"
        self.groupBox.Add = self.pnlType

        self.pnlRunway = ComboBoxPanel(self.groupBox)
        self.pnlRunway.Caption = "Runway Direction"
        self.groupBox.Add = self.pnlRunway

        self.pnlMSA = ComboBoxPanel(self.groupBox)
        self.pnlMSA.Caption = "MSA Group"
        self.groupBox.Add = self.pnlMSA

        self.pnlRNP = NumberBoxPanel(self.groupBox)
        self.pnlRNP.Caption = "RNP"
        self.groupBox.Add = self.pnlRNP

        self.tableLayoutPanel = Frame(self.groupBox)
        self.groupBox.Add = self.tableLayoutPanel

        self.txtDescription = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtDescription.Caption = "Description"
        self.tableLayoutPanel.Add = self.txtDescription

        self.txtDescrComFail = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtDescrComFail.Caption = "Communication Failure"
        self.tableLayoutPanel.Add = self.txtDescrComFail

        self.txtRemarks = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtRemarks.Caption = "Remarks"
        self.tableLayoutPanel.Add = self.txtRemarks

        self.gbOcaOch = GroupBox(self.groupBox, "HL")
        self.gbOcaOch.Caption = "Minimum OCA/OCH"
        self.groupBox.Add = self.gbOcaOch

        self.gridOcah = QTableView(self.gbOcaOch)
        self.gridOcahModel = StandardItemModel(None, [
            "Ac. Category", "Approach Type", "OCA", "OCH", "OCH Ref.",
            "Remarks"
        ])
        self.gridOcah.setModel(self.gridOcahModel)
        self.gbOcaOch.Add = self.gridOcah

        self.pnlProcButtons = Frame(self.gbOcaOch)
        self.gbOcaOch.Add = self.pnlProcButtons

        self.btnAdd = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.pnlProcButtons.Add = self.btnAdd

        self.btnEdit = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/mIconEditableEdits.png"),
                       QIcon.Normal, QIcon.Off)
        self.btnEdit.setIcon(icon)
        self.pnlProcButtons.Add = self.btnEdit

        self.btnRemove = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.pnlProcButtons.Add = self.btnRemove

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel
                                               | QDialogButtonBox.Ok)
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnEdit.clicked.connect(self.btnEdit_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        self.gridOcah.pressed.connect(self.gridOcah_pressed)

        self.data = None
        self.table = None
        self.selected = None
        self.minimums = None

    def gridOcah_pressed(self):
        self.method_7()

    def btnAdd_Click(self):
        dataBaseIapOcaOch = DataBaseIapOcaOch()
        if (not DlgAixmOcaOch.smethod_0(dataBaseIapOcaOch)):
            return
        self.minimums.Add(dataBaseIapOcaOch)
        self.gridOcahModel.Refresh(self.minimums)
        self.method_7()

    def btnEdit_Click(self):
        selectedIndexes = self.gridOcah.selectedIndexes()
        selectedRow = selectedIndexes[0].row()
        if (DlgAixmOcaOch.smethod_0(self.minimums[selectedRow])):
            self.gridOcahModel.Refresh(self.minimums)
            self.method_7()

    def btnRemove_Click(self):
        selectedIndexes = self.gridOcah.selectedIndexes()
        selectedRow = selectedIndexes[0].row()
        self.minimums.pop(selectedRow)
        self.gridOcahModel.Refresh(self.minimums)
        self.method_7()

    def acceptDlg(self):
        strS = None
        selectedItem = self.pnlAerodrome.SelectedItem
        num = (self.pnlAcCategory.SelectedIndex >=
               0) and self.pnlAcCategory.SelectedIndex or -1
        for row in self.table:
            flag = True
            if (self.selected != None and row == self.selected):
                flag = False
            if (row["ahpEnt"] != selectedItem):
                flag = False
            if (not self.pnlDesignator.Value == row["txtDesig"]):
                flag = False
            if (num != (row["codeCatAcft"] == None) and -1
                    or int(row["codeCatAcft"])):
                flag = False
            strS = (row["codeTransId"] == None) and "" or row["codeTransId"]
            if (not self.pnlTransID.Value == strS):
                flag = False
            if (not flag):
                continue
            str1 = "Cannot create a duplicate procedure entry.\n\nAerodrome = {0}\nDesignator = {1}".format(
                self.pnlAerodrome.SelectedItem, self.pnlDesignator.Value)
            if (self.pnlAcCategory.SelectedIndex >= 0):
                str1 = String.Concat([
                    str1, "\nAc. Category = {0}".format(
                        self.pnlAcCategory.SelectedItem)
                ])
            if (not String.IsNullOrEmpty(self.pnlTransID.Value)):
                str1 = String.Concat([
                    str1, "\nTransition Identifier = {0}".format(
                        self.pnlTransID.Value)
                ])
            QMessageBox.warning(self, "Error", str1)
            return
        self.accept()

    def method_5(self):
        self.data.method_35(self.pnlRunway.Items,
                            self.pnlAerodrome.SelectedItem)
        # self.pnlRunway.comboBox.insertItem(0, "");

    def method_6(self):
        self.btnEdit_Click()

    def method_7(self):
        self.btnEdit.setEnabled(len(self.gridOcah.selectedIndexes()) == 1)
        self.btnRemove.setEnabled(len(self.gridOcah.selectedIndexes()) == 1)

    @staticmethod
    def smethod_0(dataBaseIAPs_0, dataBaseProcedureData_0, dataRow_0):
        flag = False
        dlgAixmIap = DlgAixmIap()
        dlgAixmIap.data = dataBaseProcedureData_0
        dlgAixmIap.table = dataBaseIAPs_0
        dlgAixmIap.selected = dataRow_0
        dataBaseProcedureData_0.method_51(dlgAixmIap.pnlAerodrome)
        dataBaseProcedureData_0.method_47(dlgAixmIap.pnlMSA)
        dlgAixmIap.pnlAcCategory.Items = CodeCatAcftAixm.Items
        dlgAixmIap.pnlType.Items = CodeTypeIapAixm.Items
        # dlgAixmIap.pnlAcCategory.Insert(0, "");
        # dlgAixmIap.pnlMSA.Items.Insert(0, "");
        if (dataRow_0 != None and len(dataRow_0) != 0):
            dlgAixmIap.pnlAerodrome.SelectedIndex = dlgAixmIap.pnlAerodrome.IndexOf(
                dataRow_0["ahpEnt"])
            if (dlgAixmIap.pnlAerodrome.SelectedIndex >= 0):
                dataBaseProcedureData_0.method_35(
                    dlgAixmIap.pnlRunway, dlgAixmIap.pnlAerodrome.SelectedItem)
                # dlgAixmIap.pnlRunway.Insert(0, "");
            dlgAixmIap.pnlDesignator.Value = dataRow_0["txtDesig"]
            if (dataRow_0["codeCatAcft"] != None):
                dlgAixmIap.pnlAcCategory.SelectedIndex = dlgAixmIap.pnlAcCategory.method_3(
                    dataRow_0["codeCatAcft"])
            if (dataRow_0["codeTransId"] != None):
                dlgAixmIap.pnlTransID.Value = dataRow_0["codeTransId"]
            if (dataRow_0["rdnEnt"] != None):
                dlgAixmIap.pnlRunway.SelectedIndex = dlgAixmIap.pnlRunway.IndexOf(
                    dataRow_0["rdnEnt"])
            if (dataRow_0["mgpEnt"] != None):
                dlgAixmIap.pnlMSA.SelectedIndex = dlgAixmIap.pnlMSA.IndexOf(
                    dataRow_0["mgpEnt"])
            if (dataRow_0["codeRnp"] != None):
                dlgAixmIap.pnlRNP.Value = dataRow_0["codeRnp"]
            if (dataRow_0["txtDescrComFail"] != None):
                dlgAixmIap.txtDescrComFail.Value = dataRow_0["txtDescrComFail"]
            dlgAixmIap.pnlType.SelectedIndex = dlgAixmIap.pnlType.method_3(
                dataRow_0["codeTypeRte"])
            if (dataRow_0["txtDescrMiss"] != None):
                dlgAixmIap.txtDescription.Value = dataRow_0["txtDescrMiss"]
            if (dataRow_0["txtRmk"] != None):
                dlgAixmIap.txtRemarks.Value = dataRow_0["txtRmk"]
            dlgAixmIap.minimums = dataRow_0["ocah"]
        if (dlgAixmIap.minimums == None):
            dlgAixmIap.minimums = DataBaseIapOcaOchs()
        dlgAixmIap.gridOcahModel.DataSource = dlgAixmIap.minimums
        resultDlg = dlgAixmIap.exec_()
        if resultDlg == 1:
            dataRow0 = dataRow_0 == None or len(dataRow_0) == 0
            strS = []
            if (not dataRow0):
                for i in range(len(dataBaseIAPs_0.nameList)):
                    strS.append(None)
                # strS = new string[dataBaseIAPs_0.Columns.Count];
                i = 0
                for name in dataBaseIAPs_0.nameList:
                    strS[i] = dataRow_0[name]
                    i += 1
            else:
                dataRow_0 = dataBaseIAPs_0.NewRow()
            dataRow_0["ahpEnt"] = dlgAixmIap.pnlAerodrome.SelectedItem
            if (dataRow0):
                dataRow_0["oldAhpEnt"] = dataRow_0["ahpEnt"]
            dataRow_0["txtDesig"] = dlgAixmIap.pnlDesignator.Value
            if (dataRow0):
                dataRow_0["oldTxtDesig"] = dataRow_0["txtDesig"]
            if (dlgAixmIap.pnlAcCategory.SelectedIndex >= 0):
                dataRow_0[
                    "codeCatAcft"] = dlgAixmIap.pnlAcCategory.SelectedItem
            else:
                dataRow_0["codeCatAcft"] = None
            if (dataRow0):
                dataRow_0["oldCodeCatAcft"] = dataRow_0["codeCatAcft"]
            if (not String.IsNullOrEmpty(dlgAixmIap.pnlTransID.Value)):
                dataRow_0["codeTransId"] = dlgAixmIap.pnlTransID.Value
            else:
                dataRow_0["codeTransId"] = None
            if (dataRow0):
                dataRow_0["oldCodeTransId"] = dataRow_0["codeTransId"]
            if (dlgAixmIap.pnlRunway.SelectedIndex >= 0):
                dataRow_0["rdnEnt"] = dlgAixmIap.pnlRunway.SelectedItem
            else:
                dataRow_0["rdnEnt"] = None
            if (dlgAixmIap.pnlMSA.SelectedIndex >= 0):
                dataRow_0["mgpEnt"] = dlgAixmIap.pnlMSA.SelectedItem
            else:
                dataRow_0["mgpEnt"] = None
            if (not math.isnan(dlgAixmIap.pnlRNP.Value)
                    and not math.isinf(dlgAixmIap.pnlRNP.Value)):
                dataRow_0["codeRnp"] = dlgAixmIap.pnlRNP.Value
            else:
                dataRow_0["codeRnp"] = None
            dataRow_0["codeTypeRte"] = dlgAixmIap.pnlType.SelectedItem
            if (not String.IsNullOrEmpty(dlgAixmIap.txtDescrComFail.Value)):
                dataRow_0["txtDescrComFail"] = dlgAixmIap.txtDescrComFail.Value
            else:
                dataRow_0["txtDescrComFail"] = None
            if (not String.IsNullOrEmpty(dlgAixmIap.txtDescription.Value)):
                dataRow_0["txtDescrMiss"] = dlgAixmIap.txtDescription.Value
            else:
                dataRow_0["txtDescrMiss"] = None
            if (not String.IsNullOrEmpty(dlgAixmIap.txtRemarks.Value)):
                dataRow_0["txtRmk"] = dlgAixmIap.txtRemarks.Value
            else:
                dataRow_0["txtRmk"] = None
            dataRow_0["ocah"] = dlgAixmIap.minimums
            if (dataRow0):
                dataRow_0["procLegs"] = DataBaseProcedureLegs()
                dataRow_0["procLegsEx"] = DataBaseProcedureLegsEx()
            if (not dataRow0):
                num = 1
                while (num < len(strS)):
                    if (not strS[num] == dataRow_0[dataRow_0.nameList[num]]):
                        dataRow_0["changed"] = "True"
                        if (dataRow0):
                            dataBaseIAPs_0.RowsAdd(dataRow_0)
                        flag = True
                        return flag
                    else:
                        num += 1
            else:
                dataRow_0["new"] = "True"
            if (dataRow0):
                dataBaseIAPs_0.RowsAdd(dataRow_0)
            flag = True
            return flag
        return flag
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(290, 136)
        self.setWindowTitle("Instrument Approach Procedure (IAP)")
        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.groupBox = GroupBox(self)
        verticalLayoutDlg.addWidget(self.groupBox)

        self.pnlAerodrome = ComboBoxPanel(self.groupBox)
        self.pnlAerodrome.Caption = "Aerodrome"
        self.groupBox.Add = self.pnlAerodrome

        self.pnlDesignator = TextBoxPanel(self.groupBox)
        self.pnlDesignator.Caption = "Designator"
        self.groupBox.Add = self.pnlDesignator

        self.pnlAcCategory = ComboBoxPanel(self.groupBox)
        self.pnlAcCategory.Caption = "Ac. Category"
        self.groupBox.Add = self.pnlAcCategory

        self.pnlTransID = TextBoxPanel(self.groupBox)
        self.pnlTransID.Caption = "ransitional Identifier"
        self.groupBox.Add = self.pnlTransID

        self.pnlType = ComboBoxPanel(self.groupBox)
        self.pnlType.Caption = "Type"
        self.groupBox.Add = self.pnlType

        self.pnlRunway = ComboBoxPanel(self.groupBox)
        self.pnlRunway.Caption = "Runway Direction"
        self.groupBox.Add = self.pnlRunway

        self.pnlMSA = ComboBoxPanel(self.groupBox)
        self.pnlMSA.Caption = "MSA Group"
        self.groupBox.Add = self.pnlMSA

        self.pnlRNP = NumberBoxPanel(self.groupBox)
        self.pnlRNP.Caption = "RNP"
        self.groupBox.Add = self.pnlRNP

        self.tableLayoutPanel = Frame(self.groupBox)
        self.groupBox.Add = self.tableLayoutPanel

        self.txtDescription = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtDescription.Caption = "Description"
        self.tableLayoutPanel.Add = self.txtDescription

        self.txtDescrComFail = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtDescrComFail.Caption = "Communication Failure"
        self.tableLayoutPanel.Add = self.txtDescrComFail

        self.txtRemarks = TextBoxPanel(self.tableLayoutPanel, True)
        self.txtRemarks.Caption = "Remarks"
        self.tableLayoutPanel.Add = self.txtRemarks

        self.gbOcaOch = GroupBox(self.groupBox, "HL")
        self.gbOcaOch.Caption = "Minimum OCA/OCH"
        self.groupBox.Add = self.gbOcaOch

        self.gridOcah = QTableView(self.gbOcaOch)
        self.gridOcahModel = StandardItemModel(None, [
            "Ac. Category", "Approach Type", "OCA", "OCH", "OCH Ref.",
            "Remarks"
        ])
        self.gridOcah.setModel(self.gridOcahModel)
        self.gbOcaOch.Add = self.gridOcah

        self.pnlProcButtons = Frame(self.gbOcaOch)
        self.gbOcaOch.Add = self.pnlProcButtons

        self.btnAdd = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.pnlProcButtons.Add = self.btnAdd

        self.btnEdit = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/mIconEditableEdits.png"),
                       QIcon.Normal, QIcon.Off)
        self.btnEdit.setIcon(icon)
        self.pnlProcButtons.Add = self.btnEdit

        self.btnRemove = QPushButton(self.pnlProcButtons)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.pnlProcButtons.Add = self.btnRemove

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel
                                               | QDialogButtonBox.Ok)
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnEdit.clicked.connect(self.btnEdit_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        self.gridOcah.pressed.connect(self.gridOcah_pressed)

        self.data = None
        self.table = None
        self.selected = None
        self.minimums = None
Exemplo n.º 3
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(290, 136)
        self.setWindowTitle("Procedure Legs (AIXM 4.5+)")
        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.gbAll = GroupBox(self, "HL")
        self.gbAll.Caption = "Legs"
        verticalLayoutDlg.addWidget(self.gbAll)

        self.trvLegs = QTreeView(self.gbAll)
        self.trvLegsStdModel = StandardItemModel()
        self.trvLegs.setModel(self.trvLegsStdModel)
        self.gbAll.Add = self.trvLegs

        self.flowLayoutPanel1 = Frame(self.gbAll)
        self.gbAll.Add = self.flowLayoutPanel1

        self.btnAdd = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnAdd

        self.btnRemove = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnRemove

        self.btnMoveUp = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/up.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveUp.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveUp

        self.btnMoveDown = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/down.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveDown.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveDown

        self.scrollBox = Frame(self.gbAll)
        self.gbAll.Add = self.scrollBox

        self.gbPosition = GroupBox(self.scrollBox)
        self.gbPosition.Caption = "Fix"
        self.scrollBox.Add = self.gbPosition

        self.cmbPosUid = ComboBoxPanel(self.gbPosition)
        self.cmbPosUid.Caption = "Position"
        self.cmbPosUid.Button = "coordinate_capture.png"
        self.gbPosition.Add = self.cmbPosUid

        self.gbAttributes = GroupBox(self.scrollBox)
        self.gbAttributes.Caption = "Attributes"
        self.scrollBox.Add = self.gbAttributes

        self.pnlPathType = ComboBoxPanel(self.gbAttributes)
        self.pnlPathType.Caption = "Path Type"
        self.gbAttributes.Add = self.pnlPathType

        self.pnlLegType = ComboBoxPanel(self.gbAttributes)
        self.pnlLegType.Caption = "Leg Type"
        self.gbAttributes.Add = self.pnlLegType

        self.cmbCenUid = ComboBoxPanel(self.gbAttributes)
        self.cmbCenUid.Caption = "Center"
        self.cmbCenUid.Button = "coordinate_capture.png"
        self.gbAttributes.Add = self.cmbCenUid

        self.pnlFlyBy = ComboBoxPanel(self.gbAttributes)
        self.pnlFlyBy.Caption = "Fly-By"
        self.gbAttributes.Add = self.pnlFlyBy

        self.pnlMinAlt = AltitudeBoxPanel(self.gbAttributes)
        self.pnlMinAlt.CaptionUnits = "ft"
        self.pnlMinAlt.Caption = "Minimum Altitude"
        self.gbAttributes.Add = self.pnlMinAlt

        self.pnlSegLength = DistanceBoxPanel(self.gbAttributes,
                                             DistanceUnits.NM)
        self.pnlSegLength.Caption = "Segment Length"
        self.gbAttributes.Add = self.pnlSegLength

        self.pnlCourse = TrackRadialBoxPanel(self.gbAttributes)
        self.pnlCourse.Caption = "Course"
        self.gbAttributes.Add = self.pnlCourse

        self.pnlLegVOR = Frame(self.gbAttributes)
        self.gbAttributes.Add = self.pnlLegVOR

        f1 = Frame(self.pnlLegVOR, "HL")
        self.pnlLegVOR.Add = f1

        self.cmbLegVor = ComboBoxPanel(f1)
        self.cmbLegVor.Caption = "VOR / Radial (" + define._degreeStr + ")"
        f1.Add = self.cmbLegVor

        self.txtLegRadial = TrackRadialBoxPanel(f1)
        self.txtLegRadial.Caption = ""
        self.txtLegRadial.LabelWidth = 0
        f1.Add = self.txtLegRadial

        f2 = Frame(self.pnlLegVOR, "HL")
        self.pnlLegVOR.Add = f2

        self.cmbLegBackVor = ComboBoxPanel(f2)
        self.cmbLegBackVor.Caption = "Reverse VOR / Radial (" + define._degreeStr + ")"
        f2.Add = self.cmbLegBackVor

        self.txtLegBackRadial = TrackRadialBoxPanel(f2)
        self.txtLegBackRadial.Caption = ""
        self.txtLegBackRadial.LabelWidth = 0
        f2.Add = self.txtLegBackRadial

        self.pnlPointType = ComboBoxPanel(self.gbAttributes)
        self.pnlPointType.Caption = "Point Type"
        self.gbAttributes.Add = self.pnlPointType

        self.pnlRepPointType = ComboBoxPanel(self.gbAttributes)
        self.pnlRepPointType.Caption = "Reporting Point Type"
        self.gbAttributes.Add = self.pnlRepPointType

        self.pnlPointVor = Frame(self.gbAttributes)
        self.gbAttributes.Add = self.pnlPointVor

        frame1 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame1

        self.cmbPointVor = ComboBoxPanel(frame1)
        self.cmbPointVor.Caption = "Point VOR / Radial (" + define._degreeStr + ")"
        frame1.Add = self.cmbPointVor

        self.txtPointRadial = TrackRadialBoxPanel(frame1)
        self.txtPointRadial.Caption = ""
        self.txtPointRadial.LabelWidth = 0
        frame1.Add = self.txtPointRadial

        frame2 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame2

        self.cmbPointDme1 = ComboBoxPanel(frame2)
        self.cmbPointDme1.Caption = "Point 1. DME / Distance (nm)"
        frame2.Add = self.cmbPointDme1

        self.txtPointDme1 = DistanceBoxPanel(frame2, DistanceUnits.NM)
        self.txtPointDme1.Caption = ""
        self.txtPointDme1.LabelWidth = 0
        frame2.Add = self.txtPointDme1

        frame3 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame3

        self.cmbPointDme2 = ComboBoxPanel(frame3)
        self.cmbPointDme2.Caption = "Point 2. DME / Distance (nm)"
        frame3.Add = self.cmbPointDme2

        self.txtPointDme2 = DistanceBoxPanel(frame3, DistanceUnits.NM)
        self.txtPointDme2.Caption = ""
        self.txtPointDme2.LabelWidth = 0
        frame3.Add = self.txtPointDme2

        self.txtFlyDuration = TextBoxPanel(self.pnlPointVor, True)
        self.txtFlyDuration.Caption = "Flying Time Duration"
        self.pnlPointVor.Add = self.txtFlyDuration

        self.txtRemarks = TextBoxPanel(self.pnlPointVor, True)
        self.txtRemarks.Caption = "Remarks"
        self.pnlPointVor.Add = self.txtRemarks

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel
                                               | QDialogButtonBox.Ok)
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnMoveDown.clicked.connect(self.btnMoveDown_Click)
        self.btnMoveUp.clicked.connect(self.btnMoveUp_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.trvLegs.pressed.connect(self.trvLegs_pressed)

        self.data = None
        self.legs = None
        self.aerodrome = None
        self.magnVar = 0.0

        self.trvLegs.setHeaderHidden(True)

        self.pnlPointType.Items = ["IAF", "IF", "FAF", "FAP", "MAPt", "TP"]

        for value in CodeLegTypeAixm.Items:
            self.pnlLegType.Add(value)

        for value in CodePathTypeAixm.Items:
            self.pnlPathType.Add(value)

        for value in CodeRepAtcAixm.Items:
            self.pnlRepPointType.Add(value)

        for value in CodeTypeFlyByAixm.Items:
            self.pnlFlyBy.Add(value)
        self.method_6()

        self.connect(self.txtRemarks, SIGNAL("Event_0"),
                     self.txtRemarks_Event_0)
        self.connect(self.txtPointDme2, SIGNAL("Event_0"),
                     self.txtPointDme2_Event_0)
        self.connect(self.cmbPointDme2, SIGNAL("Event_0"),
                     self.cmbPointDme2_Event_0)
        self.connect(self.txtPointDme1, SIGNAL("Event_0"),
                     self.txtPointDme1_Event_0)
        self.connect(self.cmbPointDme1, SIGNAL("Event_0"),
                     self.cmbPointDme1_Event_0)
        self.connect(self.cmbPointVor, SIGNAL("Event_0"),
                     self.cmbPointVor_Event_0)
        self.connect(self.txtPointRadial, SIGNAL("Event_0"),
                     self.txtPointRadial_Event_0)
        self.connect(self.txtFlyDuration, SIGNAL("Event_0"),
                     self.txtFlyDuration_Event_0)
        self.connect(self.pnlRepPointType, SIGNAL("Event_0"),
                     self.pnlRepPointType_Event_0)

        self.connect(self.pnlPointType, SIGNAL("Event_0"),
                     self.pnlPointType_Event_0)

        self.connect(self.txtLegBackRadial, SIGNAL("Event_0"),
                     self.txtLegBackRadial_Event_0)

        self.connect(self.cmbLegBackVor, SIGNAL("Event_0"),
                     self.cmbLegBackVor_Event_0)

        self.connect(self.cmbLegVor, SIGNAL("Event_0"), self.cmbLegVor_Event_0)

        self.connect(self.txtLegRadial, SIGNAL("Event_0"),
                     self.txtLegRadial_Event_0)

        self.connect(self.pnlCourse, SIGNAL("Event_0"), self.pnlCourse_Event_0)

        self.connect(self.pnlSegLength, SIGNAL("Event_0"),
                     self.pnlSegLength_Event_0)

        self.connect(self.pnlMinAlt, SIGNAL("Event_0"), self.pnlMinAlt_Event_0)

        self.connect(self.pnlFlyBy, SIGNAL("Event_0"), self.pnlFlyBy_Event_0)

        self.connect(self.cmbCenUid, SIGNAL("Event_0"), self.cmbCenUid_Event_0)

        self.connect(self.pnlLegType, SIGNAL("Event_0"),
                     self.pnlLegType_Event_0)

        self.connect(self.pnlPathType, SIGNAL("Event_0"),
                     self.pnlPathType_Event_0)

        self.connect(self.cmbPosUid, SIGNAL("Event_0"), self.cmbPosUid_Event_0)
        self.connect(self.cmbCenUid, SIGNAL("Event_3"), self.method_14)
        self.connect(self.cmbPosUid, SIGNAL("Event_3"), self.method_13)
Exemplo n.º 4
0
class DlgAixmProcLegsEx(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(290, 136)
        self.setWindowTitle("Procedure Legs (AIXM 4.5+)")
        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.gbAll = GroupBox(self, "HL")
        self.gbAll.Caption = "Legs"
        verticalLayoutDlg.addWidget(self.gbAll)

        self.trvLegs = QTreeView(self.gbAll)
        self.trvLegsStdModel = StandardItemModel()
        self.trvLegs.setModel(self.trvLegsStdModel)
        self.gbAll.Add = self.trvLegs

        self.flowLayoutPanel1 = Frame(self.gbAll)
        self.gbAll.Add = self.flowLayoutPanel1

        self.btnAdd = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnAdd

        self.btnRemove = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnRemove

        self.btnMoveUp = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/up.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveUp.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveUp

        self.btnMoveDown = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/down.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveDown.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveDown

        self.scrollBox = Frame(self.gbAll)
        self.gbAll.Add = self.scrollBox

        self.gbPosition = GroupBox(self.scrollBox)
        self.gbPosition.Caption = "Fix"
        self.scrollBox.Add = self.gbPosition

        self.cmbPosUid = ComboBoxPanel(self.gbPosition)
        self.cmbPosUid.Caption = "Position"
        self.cmbPosUid.Button = "coordinate_capture.png"
        self.gbPosition.Add = self.cmbPosUid

        self.gbAttributes = GroupBox(self.scrollBox)
        self.gbAttributes.Caption = "Attributes"
        self.scrollBox.Add = self.gbAttributes

        self.pnlPathType = ComboBoxPanel(self.gbAttributes)
        self.pnlPathType.Caption = "Path Type"
        self.gbAttributes.Add = self.pnlPathType

        self.pnlLegType = ComboBoxPanel(self.gbAttributes)
        self.pnlLegType.Caption = "Leg Type"
        self.gbAttributes.Add = self.pnlLegType

        self.cmbCenUid = ComboBoxPanel(self.gbAttributes)
        self.cmbCenUid.Caption = "Center"
        self.cmbCenUid.Button = "coordinate_capture.png"
        self.gbAttributes.Add = self.cmbCenUid

        self.pnlFlyBy = ComboBoxPanel(self.gbAttributes)
        self.pnlFlyBy.Caption = "Fly-By"
        self.gbAttributes.Add = self.pnlFlyBy

        self.pnlMinAlt = AltitudeBoxPanel(self.gbAttributes)
        self.pnlMinAlt.CaptionUnits = "ft"
        self.pnlMinAlt.Caption = "Minimum Altitude"
        self.gbAttributes.Add = self.pnlMinAlt

        self.pnlSegLength = DistanceBoxPanel(self.gbAttributes,
                                             DistanceUnits.NM)
        self.pnlSegLength.Caption = "Segment Length"
        self.gbAttributes.Add = self.pnlSegLength

        self.pnlCourse = TrackRadialBoxPanel(self.gbAttributes)
        self.pnlCourse.Caption = "Course"
        self.gbAttributes.Add = self.pnlCourse

        self.pnlLegVOR = Frame(self.gbAttributes)
        self.gbAttributes.Add = self.pnlLegVOR

        f1 = Frame(self.pnlLegVOR, "HL")
        self.pnlLegVOR.Add = f1

        self.cmbLegVor = ComboBoxPanel(f1)
        self.cmbLegVor.Caption = "VOR / Radial (" + define._degreeStr + ")"
        f1.Add = self.cmbLegVor

        self.txtLegRadial = TrackRadialBoxPanel(f1)
        self.txtLegRadial.Caption = ""
        self.txtLegRadial.LabelWidth = 0
        f1.Add = self.txtLegRadial

        f2 = Frame(self.pnlLegVOR, "HL")
        self.pnlLegVOR.Add = f2

        self.cmbLegBackVor = ComboBoxPanel(f2)
        self.cmbLegBackVor.Caption = "Reverse VOR / Radial (" + define._degreeStr + ")"
        f2.Add = self.cmbLegBackVor

        self.txtLegBackRadial = TrackRadialBoxPanel(f2)
        self.txtLegBackRadial.Caption = ""
        self.txtLegBackRadial.LabelWidth = 0
        f2.Add = self.txtLegBackRadial

        self.pnlPointType = ComboBoxPanel(self.gbAttributes)
        self.pnlPointType.Caption = "Point Type"
        self.gbAttributes.Add = self.pnlPointType

        self.pnlRepPointType = ComboBoxPanel(self.gbAttributes)
        self.pnlRepPointType.Caption = "Reporting Point Type"
        self.gbAttributes.Add = self.pnlRepPointType

        self.pnlPointVor = Frame(self.gbAttributes)
        self.gbAttributes.Add = self.pnlPointVor

        frame1 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame1

        self.cmbPointVor = ComboBoxPanel(frame1)
        self.cmbPointVor.Caption = "Point VOR / Radial (" + define._degreeStr + ")"
        frame1.Add = self.cmbPointVor

        self.txtPointRadial = TrackRadialBoxPanel(frame1)
        self.txtPointRadial.Caption = ""
        self.txtPointRadial.LabelWidth = 0
        frame1.Add = self.txtPointRadial

        frame2 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame2

        self.cmbPointDme1 = ComboBoxPanel(frame2)
        self.cmbPointDme1.Caption = "Point 1. DME / Distance (nm)"
        frame2.Add = self.cmbPointDme1

        self.txtPointDme1 = DistanceBoxPanel(frame2, DistanceUnits.NM)
        self.txtPointDme1.Caption = ""
        self.txtPointDme1.LabelWidth = 0
        frame2.Add = self.txtPointDme1

        frame3 = Frame(self.pnlPointVor, "HL")
        self.pnlPointVor.Add = frame3

        self.cmbPointDme2 = ComboBoxPanel(frame3)
        self.cmbPointDme2.Caption = "Point 2. DME / Distance (nm)"
        frame3.Add = self.cmbPointDme2

        self.txtPointDme2 = DistanceBoxPanel(frame3, DistanceUnits.NM)
        self.txtPointDme2.Caption = ""
        self.txtPointDme2.LabelWidth = 0
        frame3.Add = self.txtPointDme2

        self.txtFlyDuration = TextBoxPanel(self.pnlPointVor, True)
        self.txtFlyDuration.Caption = "Flying Time Duration"
        self.pnlPointVor.Add = self.txtFlyDuration

        self.txtRemarks = TextBoxPanel(self.pnlPointVor, True)
        self.txtRemarks.Caption = "Remarks"
        self.pnlPointVor.Add = self.txtRemarks

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel
                                               | QDialogButtonBox.Ok)
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnMoveDown.clicked.connect(self.btnMoveDown_Click)
        self.btnMoveUp.clicked.connect(self.btnMoveUp_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.trvLegs.pressed.connect(self.trvLegs_pressed)

        self.data = None
        self.legs = None
        self.aerodrome = None
        self.magnVar = 0.0

        self.trvLegs.setHeaderHidden(True)

        self.pnlPointType.Items = ["IAF", "IF", "FAF", "FAP", "MAPt", "TP"]

        for value in CodeLegTypeAixm.Items:
            self.pnlLegType.Add(value)

        for value in CodePathTypeAixm.Items:
            self.pnlPathType.Add(value)

        for value in CodeRepAtcAixm.Items:
            self.pnlRepPointType.Add(value)

        for value in CodeTypeFlyByAixm.Items:
            self.pnlFlyBy.Add(value)
        self.method_6()

        self.connect(self.txtRemarks, SIGNAL("Event_0"),
                     self.txtRemarks_Event_0)
        self.connect(self.txtPointDme2, SIGNAL("Event_0"),
                     self.txtPointDme2_Event_0)
        self.connect(self.cmbPointDme2, SIGNAL("Event_0"),
                     self.cmbPointDme2_Event_0)
        self.connect(self.txtPointDme1, SIGNAL("Event_0"),
                     self.txtPointDme1_Event_0)
        self.connect(self.cmbPointDme1, SIGNAL("Event_0"),
                     self.cmbPointDme1_Event_0)
        self.connect(self.cmbPointVor, SIGNAL("Event_0"),
                     self.cmbPointVor_Event_0)
        self.connect(self.txtPointRadial, SIGNAL("Event_0"),
                     self.txtPointRadial_Event_0)
        self.connect(self.txtFlyDuration, SIGNAL("Event_0"),
                     self.txtFlyDuration_Event_0)
        self.connect(self.pnlRepPointType, SIGNAL("Event_0"),
                     self.pnlRepPointType_Event_0)

        self.connect(self.pnlPointType, SIGNAL("Event_0"),
                     self.pnlPointType_Event_0)

        self.connect(self.txtLegBackRadial, SIGNAL("Event_0"),
                     self.txtLegBackRadial_Event_0)

        self.connect(self.cmbLegBackVor, SIGNAL("Event_0"),
                     self.cmbLegBackVor_Event_0)

        self.connect(self.cmbLegVor, SIGNAL("Event_0"), self.cmbLegVor_Event_0)

        self.connect(self.txtLegRadial, SIGNAL("Event_0"),
                     self.txtLegRadial_Event_0)

        self.connect(self.pnlCourse, SIGNAL("Event_0"), self.pnlCourse_Event_0)

        self.connect(self.pnlSegLength, SIGNAL("Event_0"),
                     self.pnlSegLength_Event_0)

        self.connect(self.pnlMinAlt, SIGNAL("Event_0"), self.pnlMinAlt_Event_0)

        self.connect(self.pnlFlyBy, SIGNAL("Event_0"), self.pnlFlyBy_Event_0)

        self.connect(self.cmbCenUid, SIGNAL("Event_0"), self.cmbCenUid_Event_0)

        self.connect(self.pnlLegType, SIGNAL("Event_0"),
                     self.pnlLegType_Event_0)

        self.connect(self.pnlPathType, SIGNAL("Event_0"),
                     self.pnlPathType_Event_0)

        self.connect(self.cmbPosUid, SIGNAL("Event_0"), self.cmbPosUid_Event_0)
        self.connect(self.cmbCenUid, SIGNAL("Event_3"), self.method_14)
        self.connect(self.cmbPosUid, SIGNAL("Event_3"), self.method_13)

        # self.cmbCenter.imageButton.clicked.connect(self.method_14)
        # self.cmbFixPos.imageButton.clicked.connect(self.method_13)
    def btnAdd_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0 and not self.method_5()):
            return
        listInsertPosition = ListInsertPosition.Append
        resultDlg, listInsertPosition = DlgAixmInsertLeg.smethod_0(
            listInsertPosition)
        if (self.trvLegsStdModel.rowCount() > 0 and not resultDlg):
            return
        count = self.trvLegsStdModel.rowCount()
        if (listInsertPosition == ListInsertPosition.Before):
            count = self.trvLegs.selectedIndexes()[0].row()
        elif (listInsertPosition == ListInsertPosition.After):
            count = self.trvLegs.selectedIndexes()[0].row() + 1
        self.trvLegsStdModel.setItem(
            self.trvLegsStdModel.rowCount(),
            QStandardItem(str(self.trvLegsStdModel.rowCount() + 1)))
        self.legs.insert(count, DataBaseProcedureLegEx())
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(count, 0))
        self.trvLegs_pressed()

    def btnMoveDown_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return
        index = self.trvLegs.selectedIndexes()[0].row()
        item = self.legs[index]
        self.legs.pop(index)
        self.legs.insert(index + 1, item)
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index + 1, 0))
        self.trvLegs_pressed()

    def btnMoveUp_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return
        index = self.trvLegs.selectedIndexes()[0].row()
        item = self.legs[index]
        self.legs.pop(index)
        self.legs.insert(index - 1, item)
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index - 1, 0))
        self.trvLegs_pressed()

    def btnRemove_Click(self):
        item = None
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return
        if (QMessageBox.question(
                self, "Question",
                "Are you sure you want to delete the selected procedure leg?",
                QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes):
            index = self.trvLegs.selectedIndexes()[0].row()
            self.legs.pop(index)
            self.trvLegsStdModel.takeRow(self.trvLegsStdModel.rowCount() - 1)
            if (index >= self.trvLegsStdModel.rowCount() - 1):
                index -= 1
            # treeView = self.trvLegs;
            # if (index >= 0):
            if self.trvLegsStdModel.rowCount() > 0 and index < 0:
                index = 0
            self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index, 0))

            self.trvLegs_pressed()

    def cmbPosUid_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbPosUid)

    def txtRemarks_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtRemarks)

    def txtPointDme2_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtPointDme2)

    def cmbPointDme2_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbPointDme2)

    def txtPointDme1_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtPointDme1)

    def cmbPointDme1_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbPointDme1)

    def cmbPointVor_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbPointVor)

    def txtPointRadial_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtPointRadial)

    def txtFlyDuration_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtFlyDuration)

    def pnlRepPointType_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlRepPointType)

    def pnlPointType_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlPointType)

    def txtLegBackRadial_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtLegBackRadial)

    def cmbLegBackVor_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbLegBackVor)

    def cmbLegVor_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbLegVor)

    def txtLegRadial_Event_0(self):
        self.txtFlyDuration_TextChanged(self.txtLegRadial)

    def pnlCourse_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlCourse)

    def pnlSegLength_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlSegLength)

    def pnlMinAlt_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlMinAlt)

    def pnlFlyBy_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlFlyBy)

    def cmbCenUid_Event_0(self):
        self.txtFlyDuration_TextChanged(self.cmbCenUid)

    def pnlLegType_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlLegType)

    def pnlPathType_Event_0(self):
        self.txtFlyDuration_TextChanged(self.pnlPathType)

    def trvLegs_pressed(self):
        self.method_6()
        self.method_8()

    def acceptDlg(self):
        self.legs.refresh()
        QObject.emit(self, SIGNAL("DlgAixmProcLegs_Smethod_0_Event"),
                     self.legs, self.data)
        self.accept()

    def method_6(self):
        self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok)
        self.btnOK.setEnabled(len(self.trvLegs.selectedIndexes()) > 0)
        self.btnRemove.setEnabled(len(self.trvLegs.selectedIndexes()) > 0)
        self.btnMoveUp.setEnabled(
            (len(self.trvLegs.selectedIndexes()) > 0
             and self.trvLegs.selectedIndexes()[0].row() != 0) and True
            or False)
        self.btnMoveDown.setEnabled(
            (len(self.trvLegs.selectedIndexes()) <= 0
             or self.trvLegsStdModel.rowCount() <= 0) and False
            or ((len(self.trvLegs.selectedIndexes()) > 0)
                and self.trvLegs.selectedIndexes()[0].row() <
                self.trvLegsStdModel.rowCount() - 1))

    def method_7(self):
        for i in range(self.legs.Count):
            num = i + 1
            self.trvLegsStdModel.setItem(i, QStandardItem(str(num)))
        self.method_6()

    def method_8(self):
        if (self.trvLegs.selectedIndexes() == None
                or len(self.trvLegs.selectedIndexes()) == 0):
            self.scrollBox.Enabled = False
            self.cmbPosUid.SelectedIndex = -1
            self.pnlPathType.SelectedIndex = -1
            self.pnlLegType.SelectedIndex = -1
            self.cmbCenUid.SelectedIndex = -1
            self.pnlFlyBy.SelectedIndex = -1
            self.pnlMinAlt.Value = None
            self.pnlSegLength.Value = None
            self.pnlCourse.Value = None
            self.cmbLegVor.SelectedIndex = -1
            self.txtLegRadial.Value = 0
            self.cmbLegBackVor.SelectedIndex = -1
            self.txtLegBackRadial.Value = 0
            self.pnlPointType.Value = ""
            self.pnlRepPointType.SelectedIndex = -1
            self.cmbPointVor.SelectedIndex = -1
            self.txtPointRadial.Value = 0
            self.cmbPointDme1.SelectedIndex = -1
            self.txtPointDme1.Value = None
            self.cmbPointDme2.SelectedIndex = -1
            self.txtPointDme2.Value = None
            self.txtFlyDuration.Value = ""
            self.txtRemarks.Value = ""
            return
        self.scrollBox.Enabled = True
        item = self.legs[self.trvLegs.selectedIndexes()[0].row()]
        if (item.PointEnt == None):
            self.cmbPosUid.SelectedIndex = -1
        else:
            self.cmbPosUid.SelectedIndex = self.cmbPosUid.IndexOf(
                item.PointEnt)
        self.pnlPathType.SelectedIndex = self.method_10(
            self.pnlPathType.Items, item.CodePathType)
        self.pnlLegType.SelectedIndex = self.method_10(self.pnlLegType.Items,
                                                       item.CodeLegType)
        if (item.CodeLegType != CodeLegTypeAixm.CCA):
            if (item.CodeLegType == CodeLegTypeAixm.CWA):
                if (item.CenterEnt == None):
                    self.cmbCenUid.SelectedIndex = -1
                else:
                    self.cmbCenUid.SelectedIndex = self.cmbCenUid.IndexOf(
                        item.CenterEnt)
                self.cmbCenUid.Visible = True
            else:
                self.cmbCenUid.SelectedIndex = -1
                self.cmbCenUid.Visible = False
                # goto Label0;
        else:
            # Label2:
            if (item.CenterEnt == None):
                self.cmbCenUid.SelectedIndex = -1
            else:
                self.cmbCenUid.SelectedIndex = self.cmbCenUid.IndexOf(
                    item.CenterEnt)
            self.cmbCenUid.Visible = True

    # Label0:
        self.pnlFlyBy.SelectedIndex = self.method_10(self.pnlFlyBy.Items,
                                                     item.CodeFlyBy)
        self.pnlMinAlt.Value = item.ValMinAlt
        self.pnlSegLength.Value = item.ValDist
        self.pnlCourse.Value = item.ValCourse
        if (item.VorUidLeg == None):
            self.cmbLegVor.SelectedIndex = -1
        else:
            self.cmbLegVor.SelectedIndex = self.cmbLegVor.IndexOf(
                item.VorUidLeg)
        self.txtLegRadial.Value = item.ValLegRadial
        if (item.VorUidLegBack == None):
            self.cmbLegBackVor.SelectedIndex = -1
        else:
            self.cmbLegBackVor.SelectedIndex = self.cmbLegBackVor.IndexOf(
                item.VorUidLegBack)
        self.txtLegBackRadial.Value = item.ValLegRadialBack
        self.pnlPointType.Value = item.CodePointType
        self.pnlRepPointType.SelectedIndex = self.method_10(
            self.pnlRepPointType.Items, item.CodeRepAtc)
        if (item.VorUidPoint == None):
            self.cmbPointVor.SelectedIndex = -1
        else:
            self.cmbPointVor.SelectedIndex = self.cmbPointVor.IndexOf(
                item.VorUidPoint)
        self.txtPointRadial.Value = item.ValPointRadial
        if (item.UidPointDist1 == None):
            self.cmbPointDme1.SelectedIndex = -1
        else:
            self.cmbPointDme1.SelectedIndex = self.cmbPointDme1.IndexOf(
                item.UidPointDist1)
        self.txtPointDme1.Value = item.ValPointDist1
        if (item.UidPointDist2 == None):
            self.cmbPointDme2.SelectedIndex = -1
        else:
            self.cmbPointDme2.SelectedIndex = self.cmbPointDme2.IndexOf(
                item.UidPointDist2)
        self.txtPointDme2.Value = item.ValPointDist2
        self.txtFlyDuration.Value = item.ValDur
        self.txtRemarks.Value = item.TxtRmk

    def method_9(self, ilist_0, string_0):
        for i in range(len(ilist_0)):
            if (String.StartsWith(ilist_0[i], string_0)):
                return i
        return -1

    def method_10(self, ilist_0, string_0):
        for i in range(len(ilist_0)):
            if (String.Equals(ilist_0[i], string_0)):
                return i
        return -1

    def txtFlyDuration_TextChanged(self, sender):
        if (self.trvLegs.selectedIndexes() == None
                or len(self.trvLegs.selectedIndexes()) == 0):
            return
        item = self.legs[self.trvLegs.selectedIndexes()[0].row()]
        if (sender == self.cmbPosUid):
            item.PointEnt = self.cmbPosUid.SelectedItem
            return
        if (sender == self.pnlPathType):
            item.CodePathType = self.pnlPathType.SelectedItem
            return
        if (sender == self.pnlLegType):
            item.CodeLegType = self.pnlLegType.SelectedItem
            self.cmbCenUid.Visible = (
                item.CodeLegType == CodeLegTypeAixm.CCA
            ) and True or item.CodeLegType == CodeLegTypeAixm.CWA
            return
        if (sender == self.cmbCenUid):
            item.CenterEnt = self.cmbCenUid.SelectedItem
            return
        if (sender == self.pnlFlyBy):
            item.CodeFlyBy = self.pnlFlyBy.SelectedItem
            return
        if (sender == self.pnlMinAlt):
            item.ValMinAlt = self.pnlMinAlt.Value
            return
        if (sender == self.pnlSegLength):
            item.ValDist = self.pnlSegLength.Value
            return
        if (sender == self.pnlCourse):
            item.ValCourse = self.pnlCourse.Value
            return
        if (sender == self.cmbLegVor):
            item.VorUidLeg = self.cmbLegVor.SelectedItem
            return
        if (sender == self.txtLegRadial):
            item.ValLegRadial = self.txtLegRadial.Value
            return
        if (sender == self.cmbLegBackVor):
            item.VorUidLegBack = self.cmbLegBackVor.SelectedItem
            return
        if (sender == self.txtLegBackRadial):
            item.ValLegRadialBack = self.txtLegBackRadial.Value
            return
        if (sender == self.pnlPointType):
            item.CodePointType = self.pnlPointType.SelectedItem
            return
        if (sender == self.pnlRepPointType):
            item.CodeRepAtc = self.pnlRepPointType.SelectedItem
            return
        if (sender == self.cmbPointVor):
            item.VorUidPoint = self.cmbPointVor.SelectedItem
            return
        if (sender == self.txtPointRadial):
            item.ValPointRadial = self.txtPointRadial.Value
            return
        if (sender == self.cmbPointDme1):
            item.UidPointDist1 = self.cmbPointDme1.SelectedItem
            return
        if (sender == self.txtPointDme1):
            item.ValPointDist1 = self.txtPointDme1.Value
            return
        if (sender == self.cmbPointDme2):
            item.UidPointDist2 = self.cmbPointDme2.SelectedItem
            return
        if (sender == self.txtPointDme2):
            item.ValPointDist2 = self.txtPointDme2.Value
            return
        if (sender == self.txtFlyDuration):
            item.ValDur = self.txtFlyDuration.Value
            return
        if (sender == self.txtRemarks):
            item.TxtRmk = self.txtRemarks.Value

    def method_13(self):
        point3d = None
        procEntityBase = None
        selectTool = DlgAixmSelectPosition.smethod_0(
            self.data, point3d, ProcEntityListType.FixesEx)
        QObject.connect(selectTool,
                        SIGNAL("DlgAixmSelectPosition_Smethod_0_Event"),
                        self.method_13_Event)

    def method_13_Event(self, flag, procEntityBase):
        # flag, procEntityBase = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Fixes)
        if (flag and procEntityBase != None):
            if (not self.cmbPosUid.Contains(procEntityBase)):
                self.cmbPosUid.Add(procEntityBase)
            self.cmbPosUid.SelectedIndex = self.cmbPosUid.IndexOf(
                procEntityBase)
            self.txtFlyDuration_TextChanged(self.cmbPosUid)

    def method_14(self):
        point3d = None
        procEntityBase = None
        selectTool = DlgAixmSelectPosition.smethod_0(
            self.data, point3d, ProcEntityListType.CentersEx)
        QObject.connect(selectTool,
                        SIGNAL("DlgAixmSelectPosition_Smethod_0_Event"),
                        self.method_14_Event)

    def method_14_Event(self, flag, procEntityBase):
        # flag, procEntityBase = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Centers)
        if (flag and procEntityBase != None):
            if (not self.cmbCenUid.Contains(procEntityBase)):
                self.cmbCenUid.Add(procEntityBase)
            self.cmbCenUid.SelectedIndex = self.cmbCenUid.IndexOf(
                procEntityBase)
            self.txtFlyDuration_TextChanged(self.cmbCenUid)

    @staticmethod
    def smethod_0(parent, dataBaseProcedureLegsEx_0, dataBaseProcedureData_0,
                  procEntityAHP_0):
        flag = False
        dlgAixmProcLegsEx = DlgAixmProcLegsEx(parent)
        dlgAixmProcLegsEx.legs = dataBaseProcedureLegsEx_0
        dlgAixmProcLegsEx.data = dataBaseProcedureData_0
        if (procEntityAHP_0 != None):
            dlgAixmProcLegsEx.aerodrome = procEntityAHP_0
            dlgAixmProcLegsEx.magnVar = procEntityAHP_0.ValMagVar
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbPosUid,
                                          ProcEntityListType.FixesEx)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbCenUid,
                                          ProcEntityListType.CentersEx)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbLegVor,
                                          ProcEntityListType.VORs)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbLegBackVor,
                                          ProcEntityListType.VORs)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbPointVor,
                                          ProcEntityListType.VORs)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbPointDme1,
                                          ProcEntityListType.DMEs)
        dataBaseProcedureData_0.method_59(dlgAixmProcLegsEx.cmbPointDme2,
                                          ProcEntityListType.DMEs)
        if (len(dlgAixmProcLegsEx.legs) == 0):
            dlgAixmProcLegsEx.legs.append(DataBaseProcedureLegEx())

        dlgAixmProcLegsEx.method_7()
        if dlgAixmProcLegsEx.trvLegsStdModel.rowCount() > 0:
            dlgAixmProcLegsEx.trvLegs.setCurrentIndex(
                dlgAixmProcLegsEx.trvLegsStdModel.index(0, 0))
            dlgAixmProcLegsEx.method_6()
        dlgAixmProcLegsEx.method_8()
        dlgAixmProcLegsEx.show()
        return dlgAixmProcLegsEx
    def __init__(self, parent = None):
        QDialog.__init__(self, parent)
        
        self.resize(290, 136);
        self.setWindowTitle("Procedure Legs (AIXM 4.5)")
        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.gbAll = GroupBox(self, "HL")
        self.gbAll.Caption = "Legs"
        verticalLayoutDlg.addWidget(self.gbAll)

        self.trvLegs = QTreeView(self.gbAll)
        self.trvLegsStdModel = StandardItemModel()
        self.trvLegs.setModel(self.trvLegsStdModel)
        self.gbAll.Add = self.trvLegs

        self.flowLayoutPanel1 = Frame(self.gbAll)
        self.gbAll.Add = self.flowLayoutPanel1

        self.btnAdd = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnAdd

        self.btnRemove = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnRemove

        self.btnMoveUp = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/up.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveUp.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveUp

        self.btnMoveDown = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/down.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveDown.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveDown

        self.scrollBox = Frame(self.gbAll)
        self.gbAll.Add = self.scrollBox

        self.gbFix = GroupBox(self.scrollBox)
        self.gbFix.Caption = "Fix"
        self.scrollBox.Add = self.gbFix

        self.cmbFixPos = ComboBoxPanel(self.gbFix)
        self.cmbFixPos.Caption = "Position"
        self.cmbFixPos.Button = "coordinate_capture.png"
        self.gbFix.Add = self.cmbFixPos

        self.pnlCodeRoleFix = ComboBoxPanel(self.gbFix)
        self.pnlCodeRoleFix.Caption = "Type"
        self.gbFix.Add = self.pnlCodeRoleFix

        self.gbAttributes = GroupBox(self.scrollBox)
        self.gbAttributes.Caption = "Attributes"
        self.scrollBox.Add = self.gbAttributes

        self.cmbRecommendedEnt = ComboBoxPanel(self.gbAttributes)
        self.cmbRecommendedEnt.Caption = "Recommended Navigational Aid"
        self.gbAttributes.Add = self.cmbRecommendedEnt

        self.pnlCodePhase = ComboBoxPanel(self.gbAttributes)
        self.pnlCodePhase.Caption = "Fligh Phase"
        self.gbAttributes.Add = self.pnlCodePhase

        self.pnlCodeType = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeType.Caption = "Leg Type"
        self.gbAttributes.Add = self.pnlCodeType

        self.pnlLegVOR = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlLegVOR

        self.cmbCodeTypeCourse = ComboBoxPanel(self.pnlLegVOR)
        self.cmbCodeTypeCourse.Caption = "Course Angle (" + define._degreeStr + ")"
        self.pnlLegVOR.Add = self.cmbCodeTypeCourse

        self.txtValCourse = TrackRadialBoxPanel(self.pnlLegVOR)
        self.txtValCourse.LabelWidth = 0
        self.pnlLegVOR.Add = self.txtValCourse

        self.pnlCodeDirTurn = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeDirTurn.Caption = "Turn Direction"
        self.gbAttributes.Add = self.pnlCodeDirTurn

        self.pnlTurnValid = ComboBoxPanel(self.gbAttributes)
        self.pnlTurnValid.Caption = "Fly-By"
        self.gbAttributes.Add = self.pnlTurnValid

        self.cmbCenter = ComboBoxPanel(self.gbAttributes)
        self.cmbCenter.Caption = "Center"
        self.cmbCenter.Button = "coordinate_capture.png"
        self.gbAttributes.Add = self.cmbCenter

        self.pnlValBankAngle = NumberBoxPanel(self.gbAttributes)
        self.pnlValBankAngle.Caption = "Bank Angle (" + define._degreeStr + ")"
        self.gbAttributes.Add = self.pnlValBankAngle

        self.pnlCodeDescrDistVer = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeDescrDistVer.Caption = "Altitude Interpretation"
        self.gbAttributes.Add = self.pnlCodeDescrDistVer

        self.pnlVerDistLower = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlVerDistLower

        self.cmbDistVerLower = ComboBoxPanel(self.pnlVerDistLower)
        self.cmbDistVerLower.CaptionUnits = "ft"
        self.cmbDistVerLower.Caption = "Lower Altitude Limit"
        self.pnlVerDistLower.Add = self.cmbDistVerLower

        self.txtDistVerLower = AltitudeBoxPanel(self.pnlVerDistLower)
        self.txtDistVerLower.CaptionUnits = "ft"
        self.txtDistVerLower.LabelWidth = 0
        self.pnlVerDistLower.Add = self.txtDistVerLower

        self.pnlDistVerUpper = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlDistVerUpper

        self.cmbDistVerUpper = ComboBoxPanel(self.pnlDistVerUpper)
        self.cmbDistVerUpper.CaptionUnits = "ft"
        self.cmbDistVerUpper.Caption = "Upper Altitude Limit"
        self.pnlDistVerUpper.Add = self.cmbDistVerUpper

        self.txtDistVerUpper = AltitudeBoxPanel(self.pnlDistVerUpper)
        self.txtDistVerUpper.CaptionUnits = "ft"
        self.txtDistVerUpper.LabelWidth = 0
        self.pnlDistVerUpper.Add = self.txtDistVerUpper

        self.pnlValVerAngle = NumberBoxPanel(self.gbAttributes)
        self.pnlValVerAngle.Caption = "Climb / Descent Angle [+/-] (" + define._degreeStr + ")"
        self.gbAttributes.Add = self.pnlValVerAngle

        self.tableLayoutPanel2 = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.tableLayoutPanel2

        self.cmbCodeSpeedRef = ComboBoxPanel(self.tableLayoutPanel2)
        self.cmbCodeSpeedRef.CaptionUnits = "kts"
        self.cmbCodeSpeedRef.Caption = "Speed Restriction"
        self.tableLayoutPanel2.Add = self.cmbCodeSpeedRef

        self.txtValSpeed = SpeedBoxPanel(self.tableLayoutPanel2)
        self.txtValSpeed.LabelWidth = 0
        self.tableLayoutPanel2.Add = self.txtValSpeed

        self.pnlValDist = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM)
        self.pnlValDist.Caption = "Segment Length"
        self.pnlValDist.Button = None
        self.gbAttributes.Add = self.pnlValDist

        self.pnlValDur = NumberBoxPanel(self.gbAttributes)
        self.pnlValDur.CaptionUnits = "min"
        self.pnlValDur.Caption = "Duration"
        self.gbAttributes.Add = self.pnlValDur

        self.pnlCodeRepAtc = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeRepAtc.Caption = "ATC Reporting"
        self.gbAttributes.Add = self.pnlCodeRepAtc

        self.pnlValTheta = TrackRadialBoxPanel(self.gbAttributes)
        self.pnlValTheta.Caption = "Magnetic Bearing / Radial from Recommended Nav. Aid"
        self.pnlValTheta.LabelWidth = 350
        self.gbAttributes.Add = self.pnlValTheta

        self.pnlValRho = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM)
        self.pnlValRho.Caption = "Distance from Recommended Nav. Aid"
        self.pnlValRho.LabelWidth = 350
        self.gbAttributes.Add = self.pnlValRho

        self.txtRemarks = TextBoxPanel(self.gbAttributes, True)
        self.txtRemarks.Caption = "Remarks"
        self.gbAttributes.Add = self.txtRemarks

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"));
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok);
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)



        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.trvLegs.pressed.connect(self.trvLegs_pressed)

        self.data = None
        self.legs = None
        self.aerodrome = None;
        self.magnVar = 0.0



        for value in CodeIapFixAixm.Items:
            self.pnlCodeRoleFix.Add(value);
        for codeTypeProcPathAixm in CodeTypeProcPathAixm.Items:
            self.pnlCodeType.Add(codeTypeProcPathAixm);
        for codePhaseProcAixm in CodePhaseProcAixm.Items:
            self.pnlCodePhase.Add(codePhaseProcAixm);
        for codeTypeCourseAixm in CodeTypeCourseAixm.Items:
            self.cmbCodeTypeCourse.Add(codeTypeCourseAixm);
        for codeDirTurnAixm in CodeDirTurnAixm.Items:
            self.pnlCodeDirTurn.Add(codeDirTurnAixm);
        for codeDescrDistVerAixm in CodeDescrDistVerAixm.Items:
            self.pnlCodeDescrDistVer.Add(codeDescrDistVerAixm);
        for codeDistVerAixm in CodeDistVerAixm.Items:
            self.cmbDistVerLower.Add(codeDistVerAixm);
        for value1 in CodeDistVerAixm.Items:
            self.cmbDistVerUpper.Add(value1);
        for codeSpeedRefAixm in CodeSpeedRefAixm.Items:
            self.cmbCodeSpeedRef.Add(codeSpeedRefAixm);
        for codeTypeFlyByAixm in CodeTypeFlyByAixm.Items:
            self.pnlTurnValid.Add(codeTypeFlyByAixm);
        for codeRepAtcAixm in CodeRepAtcAixm.Items:
            self.pnlCodeRepAtc.Add(codeRepAtcAixm);
        self.method_6()

        self.connect(self.pnlValRho, SIGNAL("Event_0"), self.pnlValRho_Event_0)
        self.connect(self.pnlValTheta, SIGNAL("Event_0"), self.pnlValTheta_Event_0)
        self.connect(self.pnlCodeRepAtc, SIGNAL("Event_0"), self.pnlCodeRepAtc_Event_0)
        self.connect(self.pnlValDur, SIGNAL("Event_0"), self.pnlValDur_Event_0)
        self.connect(self.pnlValDist, SIGNAL("Event_0"), self.pnlValDist_Event_0)
        self.connect(self.cmbCodeSpeedRef, SIGNAL("Event_0"), self.cmbCodeSpeedRef_Event_0)
        self.connect(self.txtValSpeed, SIGNAL("Event_0"), self.txtValSpeed_Event_0)
        self.connect(self.txtDistVerUpper, SIGNAL("Event_0"), self.txtDistVerUpper_Event_0)
        self.connect(self.cmbDistVerUpper, SIGNAL("Event_0"), self.cmbDistVerUpper_Event_0)
        self.connect(self.txtDistVerLower, SIGNAL("Event_0"), self.txtDistVerLower_Event_0)

        self.connect(self.cmbDistVerLower, SIGNAL("Event_0"), self.cmbDistVerLower_Event_0)
        self.connect(self.pnlValBankAngle, SIGNAL("Event_0"), self.pnlValBankAngle_Event_0)
        self.connect(self.cmbCenter, SIGNAL("Event_0"), self.cmbCenter_Event_0)
        self.connect(self.pnlTurnValid, SIGNAL("Event_0"), self.pnlTurnValid_Event_0)
        self.connect(self.pnlCodeDirTurn, SIGNAL("Event_0"), self.pnlCodeDirTurn_Event_0)
        self.connect(self.cmbCodeTypeCourse, SIGNAL("Event_0"), self.cmbCodeTypeCourse_Event_0)
        self.connect(self.txtValCourse, SIGNAL("Event_0"), self.txtValCourse_Event_0)
        self.connect(self.pnlCodeType, SIGNAL("Event_0"), self.pnlCodeType_Event_0)
        self.connect(self.pnlCodePhase, SIGNAL("Event_0"), self.pnlCodePhase_Event_0)
        self.connect(self.pnlCodeRoleFix, SIGNAL("Event_0"), self.pnlCodeRoleFix_Event_0)
        self.connect(self.txtRemarks, SIGNAL("Event_0"), self.txtRemarks_Event_0)
        self.connect(self.cmbRecommendedEnt, SIGNAL("Event_0"), self.cmbRecommendedEnt_Event_0)

        self.connect(self.cmbFixPos, SIGNAL("Event_0"), self.cmbFixPos_Event_0)
        self.connect(self.cmbCenter, SIGNAL("Event_3"), self.method_14)
        self.connect(self.cmbFixPos, SIGNAL("Event_3"), self.method_13)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnMoveDown.clicked.connect(self.btnMoveDown_Click)
        self.btnMoveUp.clicked.connect(self.btnMoveUp_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        self.trvLegs.setHeaderHidden(True)

        if self.trvLegsStdModel.rowCount() > 0:
            self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(0,0))
            self.method_8()
class DlgAixmProcLegs(QDialog):
    def __init__(self, parent = None):
        QDialog.__init__(self, parent)
        
        self.resize(290, 136);
        self.setWindowTitle("Procedure Legs (AIXM 4.5)")
        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.gbAll = GroupBox(self, "HL")
        self.gbAll.Caption = "Legs"
        verticalLayoutDlg.addWidget(self.gbAll)

        self.trvLegs = QTreeView(self.gbAll)
        self.trvLegsStdModel = StandardItemModel()
        self.trvLegs.setModel(self.trvLegsStdModel)
        self.gbAll.Add = self.trvLegs

        self.flowLayoutPanel1 = Frame(self.gbAll)
        self.gbAll.Add = self.flowLayoutPanel1

        self.btnAdd = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnAdd

        self.btnRemove = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnRemove

        self.btnMoveUp = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/up.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveUp.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveUp

        self.btnMoveDown = QPushButton(self.flowLayoutPanel1)
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/down.png"), QIcon.Normal, QIcon.Off)
        self.btnMoveDown.setIcon(icon)
        self.flowLayoutPanel1.Add = self.btnMoveDown

        self.scrollBox = Frame(self.gbAll)
        self.gbAll.Add = self.scrollBox

        self.gbFix = GroupBox(self.scrollBox)
        self.gbFix.Caption = "Fix"
        self.scrollBox.Add = self.gbFix

        self.cmbFixPos = ComboBoxPanel(self.gbFix)
        self.cmbFixPos.Caption = "Position"
        self.cmbFixPos.Button = "coordinate_capture.png"
        self.gbFix.Add = self.cmbFixPos

        self.pnlCodeRoleFix = ComboBoxPanel(self.gbFix)
        self.pnlCodeRoleFix.Caption = "Type"
        self.gbFix.Add = self.pnlCodeRoleFix

        self.gbAttributes = GroupBox(self.scrollBox)
        self.gbAttributes.Caption = "Attributes"
        self.scrollBox.Add = self.gbAttributes

        self.cmbRecommendedEnt = ComboBoxPanel(self.gbAttributes)
        self.cmbRecommendedEnt.Caption = "Recommended Navigational Aid"
        self.gbAttributes.Add = self.cmbRecommendedEnt

        self.pnlCodePhase = ComboBoxPanel(self.gbAttributes)
        self.pnlCodePhase.Caption = "Fligh Phase"
        self.gbAttributes.Add = self.pnlCodePhase

        self.pnlCodeType = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeType.Caption = "Leg Type"
        self.gbAttributes.Add = self.pnlCodeType

        self.pnlLegVOR = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlLegVOR

        self.cmbCodeTypeCourse = ComboBoxPanel(self.pnlLegVOR)
        self.cmbCodeTypeCourse.Caption = "Course Angle (" + define._degreeStr + ")"
        self.pnlLegVOR.Add = self.cmbCodeTypeCourse

        self.txtValCourse = TrackRadialBoxPanel(self.pnlLegVOR)
        self.txtValCourse.LabelWidth = 0
        self.pnlLegVOR.Add = self.txtValCourse

        self.pnlCodeDirTurn = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeDirTurn.Caption = "Turn Direction"
        self.gbAttributes.Add = self.pnlCodeDirTurn

        self.pnlTurnValid = ComboBoxPanel(self.gbAttributes)
        self.pnlTurnValid.Caption = "Fly-By"
        self.gbAttributes.Add = self.pnlTurnValid

        self.cmbCenter = ComboBoxPanel(self.gbAttributes)
        self.cmbCenter.Caption = "Center"
        self.cmbCenter.Button = "coordinate_capture.png"
        self.gbAttributes.Add = self.cmbCenter

        self.pnlValBankAngle = NumberBoxPanel(self.gbAttributes)
        self.pnlValBankAngle.Caption = "Bank Angle (" + define._degreeStr + ")"
        self.gbAttributes.Add = self.pnlValBankAngle

        self.pnlCodeDescrDistVer = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeDescrDistVer.Caption = "Altitude Interpretation"
        self.gbAttributes.Add = self.pnlCodeDescrDistVer

        self.pnlVerDistLower = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlVerDistLower

        self.cmbDistVerLower = ComboBoxPanel(self.pnlVerDistLower)
        self.cmbDistVerLower.CaptionUnits = "ft"
        self.cmbDistVerLower.Caption = "Lower Altitude Limit"
        self.pnlVerDistLower.Add = self.cmbDistVerLower

        self.txtDistVerLower = AltitudeBoxPanel(self.pnlVerDistLower)
        self.txtDistVerLower.CaptionUnits = "ft"
        self.txtDistVerLower.LabelWidth = 0
        self.pnlVerDistLower.Add = self.txtDistVerLower

        self.pnlDistVerUpper = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.pnlDistVerUpper

        self.cmbDistVerUpper = ComboBoxPanel(self.pnlDistVerUpper)
        self.cmbDistVerUpper.CaptionUnits = "ft"
        self.cmbDistVerUpper.Caption = "Upper Altitude Limit"
        self.pnlDistVerUpper.Add = self.cmbDistVerUpper

        self.txtDistVerUpper = AltitudeBoxPanel(self.pnlDistVerUpper)
        self.txtDistVerUpper.CaptionUnits = "ft"
        self.txtDistVerUpper.LabelWidth = 0
        self.pnlDistVerUpper.Add = self.txtDistVerUpper

        self.pnlValVerAngle = NumberBoxPanel(self.gbAttributes)
        self.pnlValVerAngle.Caption = "Climb / Descent Angle [+/-] (" + define._degreeStr + ")"
        self.gbAttributes.Add = self.pnlValVerAngle

        self.tableLayoutPanel2 = Frame(self.gbAttributes, "HL")
        self.gbAttributes.Add = self.tableLayoutPanel2

        self.cmbCodeSpeedRef = ComboBoxPanel(self.tableLayoutPanel2)
        self.cmbCodeSpeedRef.CaptionUnits = "kts"
        self.cmbCodeSpeedRef.Caption = "Speed Restriction"
        self.tableLayoutPanel2.Add = self.cmbCodeSpeedRef

        self.txtValSpeed = SpeedBoxPanel(self.tableLayoutPanel2)
        self.txtValSpeed.LabelWidth = 0
        self.tableLayoutPanel2.Add = self.txtValSpeed

        self.pnlValDist = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM)
        self.pnlValDist.Caption = "Segment Length"
        self.pnlValDist.Button = None
        self.gbAttributes.Add = self.pnlValDist

        self.pnlValDur = NumberBoxPanel(self.gbAttributes)
        self.pnlValDur.CaptionUnits = "min"
        self.pnlValDur.Caption = "Duration"
        self.gbAttributes.Add = self.pnlValDur

        self.pnlCodeRepAtc = ComboBoxPanel(self.gbAttributes)
        self.pnlCodeRepAtc.Caption = "ATC Reporting"
        self.gbAttributes.Add = self.pnlCodeRepAtc

        self.pnlValTheta = TrackRadialBoxPanel(self.gbAttributes)
        self.pnlValTheta.Caption = "Magnetic Bearing / Radial from Recommended Nav. Aid"
        self.pnlValTheta.LabelWidth = 350
        self.gbAttributes.Add = self.pnlValTheta

        self.pnlValRho = DistanceBoxPanel(self.gbAttributes, DistanceUnits.NM)
        self.pnlValRho.Caption = "Distance from Recommended Nav. Aid"
        self.pnlValRho.LabelWidth = 350
        self.gbAttributes.Add = self.pnlValRho

        self.txtRemarks = TextBoxPanel(self.gbAttributes, True)
        self.txtRemarks.Caption = "Remarks"
        self.gbAttributes.Add = self.txtRemarks

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"));
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok);
        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)



        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.trvLegs.pressed.connect(self.trvLegs_pressed)

        self.data = None
        self.legs = None
        self.aerodrome = None;
        self.magnVar = 0.0



        for value in CodeIapFixAixm.Items:
            self.pnlCodeRoleFix.Add(value);
        for codeTypeProcPathAixm in CodeTypeProcPathAixm.Items:
            self.pnlCodeType.Add(codeTypeProcPathAixm);
        for codePhaseProcAixm in CodePhaseProcAixm.Items:
            self.pnlCodePhase.Add(codePhaseProcAixm);
        for codeTypeCourseAixm in CodeTypeCourseAixm.Items:
            self.cmbCodeTypeCourse.Add(codeTypeCourseAixm);
        for codeDirTurnAixm in CodeDirTurnAixm.Items:
            self.pnlCodeDirTurn.Add(codeDirTurnAixm);
        for codeDescrDistVerAixm in CodeDescrDistVerAixm.Items:
            self.pnlCodeDescrDistVer.Add(codeDescrDistVerAixm);
        for codeDistVerAixm in CodeDistVerAixm.Items:
            self.cmbDistVerLower.Add(codeDistVerAixm);
        for value1 in CodeDistVerAixm.Items:
            self.cmbDistVerUpper.Add(value1);
        for codeSpeedRefAixm in CodeSpeedRefAixm.Items:
            self.cmbCodeSpeedRef.Add(codeSpeedRefAixm);
        for codeTypeFlyByAixm in CodeTypeFlyByAixm.Items:
            self.pnlTurnValid.Add(codeTypeFlyByAixm);
        for codeRepAtcAixm in CodeRepAtcAixm.Items:
            self.pnlCodeRepAtc.Add(codeRepAtcAixm);
        self.method_6()

        self.connect(self.pnlValRho, SIGNAL("Event_0"), self.pnlValRho_Event_0)
        self.connect(self.pnlValTheta, SIGNAL("Event_0"), self.pnlValTheta_Event_0)
        self.connect(self.pnlCodeRepAtc, SIGNAL("Event_0"), self.pnlCodeRepAtc_Event_0)
        self.connect(self.pnlValDur, SIGNAL("Event_0"), self.pnlValDur_Event_0)
        self.connect(self.pnlValDist, SIGNAL("Event_0"), self.pnlValDist_Event_0)
        self.connect(self.cmbCodeSpeedRef, SIGNAL("Event_0"), self.cmbCodeSpeedRef_Event_0)
        self.connect(self.txtValSpeed, SIGNAL("Event_0"), self.txtValSpeed_Event_0)
        self.connect(self.txtDistVerUpper, SIGNAL("Event_0"), self.txtDistVerUpper_Event_0)
        self.connect(self.cmbDistVerUpper, SIGNAL("Event_0"), self.cmbDistVerUpper_Event_0)
        self.connect(self.txtDistVerLower, SIGNAL("Event_0"), self.txtDistVerLower_Event_0)

        self.connect(self.cmbDistVerLower, SIGNAL("Event_0"), self.cmbDistVerLower_Event_0)
        self.connect(self.pnlValBankAngle, SIGNAL("Event_0"), self.pnlValBankAngle_Event_0)
        self.connect(self.cmbCenter, SIGNAL("Event_0"), self.cmbCenter_Event_0)
        self.connect(self.pnlTurnValid, SIGNAL("Event_0"), self.pnlTurnValid_Event_0)
        self.connect(self.pnlCodeDirTurn, SIGNAL("Event_0"), self.pnlCodeDirTurn_Event_0)
        self.connect(self.cmbCodeTypeCourse, SIGNAL("Event_0"), self.cmbCodeTypeCourse_Event_0)
        self.connect(self.txtValCourse, SIGNAL("Event_0"), self.txtValCourse_Event_0)
        self.connect(self.pnlCodeType, SIGNAL("Event_0"), self.pnlCodeType_Event_0)
        self.connect(self.pnlCodePhase, SIGNAL("Event_0"), self.pnlCodePhase_Event_0)
        self.connect(self.pnlCodeRoleFix, SIGNAL("Event_0"), self.pnlCodeRoleFix_Event_0)
        self.connect(self.txtRemarks, SIGNAL("Event_0"), self.txtRemarks_Event_0)
        self.connect(self.cmbRecommendedEnt, SIGNAL("Event_0"), self.cmbRecommendedEnt_Event_0)

        self.connect(self.cmbFixPos, SIGNAL("Event_0"), self.cmbFixPos_Event_0)
        self.connect(self.cmbCenter, SIGNAL("Event_3"), self.method_14)
        self.connect(self.cmbFixPos, SIGNAL("Event_3"), self.method_13)

        self.btnAdd.clicked.connect(self.btnAdd_Click)
        self.btnMoveDown.clicked.connect(self.btnMoveDown_Click)
        self.btnMoveUp.clicked.connect(self.btnMoveUp_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        self.trvLegs.setHeaderHidden(True)

        if self.trvLegsStdModel.rowCount() > 0:
            self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(0,0))
            self.method_8()
        # rootModelIndex = self.trvLegs.rootIndex()
        # rootItem = self.trvLegsStdModel.itemFromIndex(rootModelIndex)
        # rootItem.setText("Legs")
    def btnAdd_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0 and not self.method_5()):
            return;
        listInsertPosition = ListInsertPosition.Append;
        resultDlg, listInsertPosition = DlgAixmInsertLeg.smethod_0(listInsertPosition)
        if (self.trvLegsStdModel.rowCount() > 0 and not resultDlg):
            return;
        count = self.trvLegsStdModel.rowCount()
        if (listInsertPosition == ListInsertPosition.Before):
            count = self.trvLegs.selectedIndexes()[0].row();
        elif (listInsertPosition == ListInsertPosition.After):
            count = self.trvLegs.selectedIndexes()[0].row() + 1;
        self.trvLegsStdModel.setItem(self.trvLegsStdModel.rowCount(), QStandardItem(str(self.trvLegsStdModel.rowCount() + 1)));
        self.legs.insert(count, DataBaseProcedureLeg());
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(count, 0))
        self.trvLegs_pressed()
    def btnMoveDown_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return;
        index = self.trvLegs.selectedIndexes()[0].row();
        item = self.legs[index];
        self.legs.pop(index);
        self.legs.insert(index + 1, item);
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index + 1, 0))
        self.trvLegs_pressed()
    def btnMoveUp_Click(self):
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return;
        index = self.trvLegs.selectedIndexes()[0].row();
        item = self.legs[index];
        self.legs.pop(index);
        self.legs.insert(index - 1, item);
        self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index - 1, 0))
        self.trvLegs_pressed()
    def btnRemove_Click(self):
        item = None;
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return;
        if (QMessageBox.question(self, "Question", "Are you sure you want to delete the selected procedure leg?", QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes):
            index = self.trvLegs.selectedIndexes()[0].row();
            self.legs.pop(index);
            self.trvLegsStdModel.takeRow(self.trvLegsStdModel.rowCount() - 1);
            if (index >= self.trvLegsStdModel.rowCount() - 1):
                index -= 1;
            # treeView = self.trvLegs;
            # if (index >= 0):
            if self.trvLegsStdModel.rowCount() > 0 and index < 0:
                index = 0
            self.trvLegs.setCurrentIndex(self.trvLegsStdModel.index(index, 0))

            self.trvLegs_pressed()
    def cmbRecommendedEnt_Event_0(self):
        self.method_10(self.cmbRecommendedEnt)
    def txtRemarks_Event_0(self):
        self.method_10(self.txtRemarks)
    def cmbFixPos_Event_0(self):
        self.method_10(self.cmbFixPos)
    def cmbDistVerLower_Event_0(self):
        self.method_10(self.cmbDistVerLower)
    def pnlValBankAngle_Event_0(self):
        self.method_10(self.pnlValBankAngle)
    def cmbCenter_Event_0(self):
        self.method_10(self.cmbCenter)
    def pnlTurnValid_Event_0(self):
        self.method_10(self.pnlTurnValid)
    def pnlCodeDirTurn_Event_0(self):
        self.method_10(self.pnlCodeDirTurn)
    def cmbCodeTypeCourse_Event_0(self):
        self.method_10(self.cmbCodeTypeCourse)
    def txtValCourse_Event_0(self):
        self.method_10(self.txtValCourse)
    def pnlCodeType_Event_0(self):
        self.method_10(self.pnlCodeType)
    def pnlCodePhase_Event_0(self):
        self.method_10(self.pnlCodePhase)
    def pnlCodeRoleFix_Event_0(self):
        self.method_10(self.pnlCodeRoleFix)
    def txtDistVerLower_Event_0(self):
        self.method_10(self.txtDistVerLower)
    def cmbDistVerUpper_Event_0(self):
        self.method_10(self.cmbDistVerUpper)
    def txtDistVerUpper_Event_0(self):
        self.method_10(self.txtDistVerUpper)
    def txtValSpeed_Event_0(self):
        self.method_10(self.txtValSpeed)
    def cmbCodeSpeedRef_Event_0(self):
        self.method_10(self.cmbCodeSpeedRef)
    def pnlValDist_Event_0(self):
        self.method_10(self.pnlValDist)
    def pnlValDur_Event_0(self):
        self.method_10(self.pnlValDur)
    def pnlCodeRepAtc_Event_0(self):
        self.method_10(self.pnlCodeRepAtc)
    def pnlValTheta_Event_0(self):
        self.method_10(self.pnlValTheta)
    def pnlValRho_Event_0(self):
        self.method_10(self.pnlValRho)
    def trvLegs_pressed(self):
        self.method_6()
        self.method_8()
    def acceptDlg(self):
        self.legs.refresh()
        QObject.emit(self, SIGNAL("DlgAixmProcLegs_Smethod_0_Event"), self.legs, self.data)
        self.accept()
    
    def method_5(self):
        pass
    def method_6(self):
        self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok)
        self.btnOK.setEnabled(len(self.trvLegs.selectedIndexes()) > 0)
        self.btnRemove.setEnabled(len(self.trvLegs.selectedIndexes()) > 0);
        self.btnMoveUp.setEnabled((len(self.trvLegs.selectedIndexes()) > 0 and self.trvLegs.selectedIndexes()[0].row() != 0) and True or False);
        self.btnMoveDown.setEnabled((len(self.trvLegs.selectedIndexes()) <=  0 or self.trvLegsStdModel.rowCount() <= 0) and False or ((len(self.trvLegs.selectedIndexes()) >  0) and self.trvLegs.selectedIndexes()[0].row() < self.trvLegsStdModel.rowCount() - 1));
	
    def method_7(self):
        for i in range(self.legs.Count):
            num = i + 1;
            self.trvLegsStdModel.setItem(i, QStandardItem(str(num)));
        self.method_6()
        # if (self.trvLegsStdModel.rowCount() > 0):
        #     self.trvLegs.setCurrentIndex() = self.trvLegs.Nodes[0];
    def method_8(self):
        if (len(self.trvLegs.selectedIndexes()) <= 0):
            self.scrollBox.Enabled = False;
            self.cmbFixPos.SelectedIndex = -1;
            self.pnlCodeRoleFix.SelectedIndex = -1;
            self.cmbRecommendedEnt.SelectedIndex = -1;
            self.pnlCodePhase.SelectedIndex = -1;
            self.pnlCodeType.SelectedIndex = -1;
            self.cmbCodeTypeCourse.SelectedIndex = -1;
            self.txtValCourse.Value = 0;
            self.pnlCodeDirTurn.SelectedIndex = -1;
            self.cmbCenter.SelectedIndex = -1;
            self.pnlTurnValid.SelectedIndex = -1;
            self.pnlValBankAngle.Value = 0;
            self.pnlCodeDescrDistVer.SelectedIndex = -1;
            self.cmbDistVerLower.SelectedIndex = -1;
            self.txtDistVerLower.Value = None;
            self.cmbDistVerUpper.SelectedIndex = -1;
            self.txtDistVerUpper.Value = None;
            self.pnlValVerAngle.Value = None;
            self.cmbCodeSpeedRef.SelectedIndex = -1;
            self.txtValSpeed.Value = None;
            self.pnlValDist.Value = None;
            self.pnlValDur.Value = 0;
            self.pnlCodeRepAtc.SelectedIndex = -1;
            self.pnlValTheta.Value = 0;
            self.pnlValRho.Value = None;
            self.txtRemarks.Value = ""
            return;
        self.scrollBox.Enabled = True;
        item = self.legs[self.trvLegs.selectedIndexes()[0].row()];
        if (item.PointEnt == None):
            self.cmbFixPos.SelectedIndex = -1;
        else:
            self.cmbFixPos.SelectedIndex = self.cmbFixPos.IndexOf(item.PointEnt);
        self.pnlCodeRoleFix.SelectedIndex = self.method_9(self.pnlCodeRoleFix.Items, item.CodeRoleFix);
        if (item.RecommendedEnt == None):
            self.cmbRecommendedEnt.SelectedIndex = -1;
        else:
            self.cmbRecommendedEnt.SelectedIndex = self.cmbRecommendedEnt.IndexOf(item.RecommendedEnt);
        self.pnlCodePhase.SelectedIndex = self.method_9(self.pnlCodePhase.Items, item.CodePhase);
        self.pnlCodeType.SelectedIndex = self.method_9(self.pnlCodeType.Items, item.CodeType);
        self.cmbCodeTypeCourse.SelectedIndex = self.method_9(self.cmbCodeTypeCourse.Items, item.CodeTypeCourse);
        self.txtValCourse.Value = item.ValCourse;
        self.pnlCodeDirTurn.SelectedIndex = self.method_9(self.pnlCodeDirTurn.Items, item.CodeDirTurn);
        if (item.CenterEnt == None):
            self.cmbCenter.SelectedIndex = -1;
        else:
            self.cmbCenter.SelectedIndex = self.cmbCenter.IndexOf(item.CenterEnt);
        self.pnlTurnValid.SelectedIndex = self.method_9(self.pnlTurnValid.Items, item.CodeTurnValid)
        self.pnlValBankAngle.Value = item.ValBankAngle;
        self.pnlCodeDescrDistVer.SelectedIndex = self.method_9(self.pnlCodeDescrDistVer.Items, item.CodeDescrDistVer)
        self.cmbDistVerLower.SelectedIndex = self.method_9(self.cmbDistVerLower.Items, item.CodeDistVerLower)
        self.txtDistVerLower.Value = item.ValDistVerLower;
        self.cmbDistVerUpper.SelectedIndex = self.method_9(self.cmbDistVerUpper.Items, item.CodeDistVerUpper)
        self.txtDistVerUpper.Value = item.ValDistVerUpper;
        self.pnlValVerAngle.Value = item.ValVerAngle;
        self.cmbCodeSpeedRef.SelectedIndex = self.method_9(self.cmbCodeSpeedRef.Items, item.CodeSpeedRef)
        self.txtValSpeed.Value = item.ValSpeedLimit;
        self.pnlValDist.Value = item.ValDist;
        self.pnlValDur.Value = item.ValDur;
        self.pnlCodeRepAtc.SelectedIndex = self.method_9(self.pnlCodeRepAtc.Items, item.CodeRepAtc)
        self.pnlValTheta.Value = item.ValTheta;
        self.pnlValRho.Value = item.ValRho;
        self.txtRemarks.Value = item.TxtRmk;
        self.method_6()

    def method_9(self, ilist_0, string_0):
        for i in range(len(ilist_0)):
            if (ilist_0[i] == string_0):
                return i;
        return -1;
    def method_10(self, sender):
        if (len(self.trvLegs.selectedIndexes()) == 0):
            return;
        item = self.legs[self.trvLegs.selectedIndexes()[0].row()];
        if (sender == self.cmbFixPos):
            item.PointEnt = self.cmbFixPos.SelectedItem;
        if (sender == self.pnlCodeRoleFix):
            item.CodeRoleFix = self.pnlCodeRoleFix.SelectedItem;
        if (sender == self.cmbRecommendedEnt):
            item.RecommendedEnt = self.cmbRecommendedEnt.SelectedItem
        if (sender == self.pnlCodePhase):
            item.CodePhase = self.pnlCodePhase.SelectedItem
        if (sender == self.pnlCodeType):
            item.CodeType = self.pnlCodeType.SelectedItem
        if (sender == self.cmbCodeTypeCourse):
            item.CodeTypeCourse = self.cmbCodeTypeCourse.SelectedItem
        if (sender == self.txtValCourse):
            item.ValCourse = self.txtValCourse.Value;
        if (sender == self.pnlCodeDirTurn):
            item.CodeDirTurn = self.pnlCodeDirTurn.SelectedItem
        if (sender == self.cmbCenter):
            item.CenterEnt = self.cmbCenter.SelectedItem;
            return;
        if (sender == self.pnlTurnValid):
            item.CodeTurnValid = self.pnlTurnValid.SelectedItem
            return;
        if (sender == self.pnlValBankAngle):
            item.ValBankAngle = self.pnlValBankAngle.Value;
            return;
        if (sender == self.pnlCodeDescrDistVer):
            item.CodeDescrDistVer = self.pnlTurnValid.SelectedItem
            return;
        if (sender == self.cmbDistVerLower):
            item.CodeDistVerLower = self.cmbDistVerLower.SelectedItem
            return;
        if (sender == self.txtDistVerLower):
            item.ValDistVerLower = self.txtDistVerLower.Value;
            return;
        if (sender == self.cmbDistVerUpper):
            item.CodeDistVerUpper = self.cmbDistVerUpper.SelectedItem
            return;
        if (sender == self.txtDistVerUpper):
            item.ValDistVerUpper = self.txtDistVerUpper.Value;
            return;
        if (sender == self.pnlValVerAngle):
            item.ValVerAngle = self.pnlValVerAngle.Value;
            return;
        if (sender == self.cmbCodeSpeedRef):
            item.CodeSpeedRef = self.cmbCodeSpeedRef.SelectedItem
            return;
        if (sender == self.txtValSpeed):
            item.ValSpeedLimit = self.txtValSpeed.Value;
            return;
        if (sender == self.pnlValDist):
            item.ValDist = self.pnlValDist.Value;
            return;
        if (sender == self.pnlValDur):
            item.ValDur = self.pnlValDur.Value;
            return;
        if (sender == self.pnlCodeRepAtc):
            item.CodeRepAtc = self.pnlCodeRepAtc.SelectedItem
            return;
        if (sender == self.pnlValTheta):
            item.ValTheta = self.pnlValTheta.Value;
            return;
        if (sender == self.pnlValRho):
            item.ValRho = self.pnlValRho.Value;
            return;
        if (sender == self.txtRemarks):
            item.TxtRmk = self.txtRemarks.Value;
    def method_13(self):
        point3d = None;
        procEntityBase = None;
        selectTool = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Fixes)
        QObject.connect(selectTool, SIGNAL("DlgAixmSelectPosition_Smethod_0_Event"), self.method_13_Event)
    def method_13_Event(self, flag, procEntityBase):
        # flag, procEntityBase = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Fixes)
        if (flag and procEntityBase != None):
            if (not self.cmbFixPos.Contains(procEntityBase)):
                self.cmbFixPos.Add(procEntityBase);
            self.cmbFixPos.SelectedIndex = self.cmbFixPos.IndexOf(procEntityBase);
            self.method_10(self.cmbFixPos);

    def method_14(self):
        point3d = None;
        procEntityBase = None;
        selectTool = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Centers)
        QObject.connect(selectTool, SIGNAL("DlgAixmSelectPosition_Smethod_0_Event"), self.method_14_Event)
    def method_14_Event(self, flag, procEntityBase):
        # flag, procEntityBase = DlgAixmSelectPosition.smethod_0(self.data, point3d, ProcEntityListType.Centers)
        if (flag and procEntityBase != None):
            if (not self.cmbCenter.Contains(procEntityBase)):
                self.cmbCenter.Add(procEntityBase);
            self.cmbCenter.SelectedIndex = self.cmbCenter.IndexOf(procEntityBase);
            self.method_10(self.cmbCenter);
    @staticmethod
    def smethod_0(parent, dataBaseProcedureLegs_0, dataBaseProcedureData_0, procEntityAHP_0):
        flag = False
        dlgAixmProcLeg = DlgAixmProcLegs(parent)
        dlgAixmProcLeg.legs = dataBaseProcedureLegs_0;
        dlgAixmProcLeg.data = dataBaseProcedureData_0;
        if (procEntityAHP_0 != None):
            dlgAixmProcLeg.aerodrome = procEntityAHP_0;
            dlgAixmProcLeg.magnVar = procEntityAHP_0.ValMagVar;
        dataBaseProcedureData_0.method_59(dlgAixmProcLeg.cmbFixPos, ProcEntityListType.Fixes);
        dataBaseProcedureData_0.method_59(dlgAixmProcLeg.cmbCenter, ProcEntityListType.Centers);
        dataBaseProcedureData_0.method_59(dlgAixmProcLeg.cmbRecommendedEnt, ProcEntityListType.RecommendedNavAids);
        if (dlgAixmProcLeg.legs.Count == 0):
            dlgAixmProcLeg.legs.Add(DataBaseProcedureLeg());

        dlgAixmProcLeg.method_7()
        if dlgAixmProcLeg.trvLegsStdModel.rowCount() > 0:
            dlgAixmProcLeg.trvLegs.setCurrentIndex(dlgAixmProcLeg.trvLegsStdModel.index(0,0))
            dlgAixmProcLeg.method_6()

        dlgAixmProcLeg.method_8();
        dlgAixmProcLeg.show()
        return dlgAixmProcLeg
Exemplo n.º 7
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(473, 580)
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setBold(False)
        font.setWeight(50)
        Form.setFont(font)
        self.vlForm = QtGui.QVBoxLayout(Form)
        self.vlForm.setObjectName(("vlForm"))

        self.gbFile = GroupBox(Form)
        self.gbFile.Title = "Database File"
        self.vlForm.addWidget(self.gbFile)

        self.pnlFile = TextBoxPanel(self.gbFile)
        self.pnlFile.Caption = ""
        self.pnlFile.LabelWidth = 0
        self.pnlFile.textBox.setMaximumWidth(100000)
        self.pnlFile.hLayoutBoxPanel.removeItem(self.pnlFile.spacerItem)
        self.pnlFile.Button = "openData.png"
        self.gbFile.Add = self.pnlFile

        self.lblEffectiveDate = QtGui.QLabel(self.gbFile)
        self.lblEffectiveDate.setText("Effective Date")
        self.lblEffectiveDate.setObjectName("lblEffectiveDate")
        self.gbFile.Add = self.lblEffectiveDate

        self.gbContent = GroupBox(Form)
        self.gbContent.Title = "Procedures"
        self.vlForm.addWidget(self.gbContent)

        self.tabControl = QtGui.QTabWidget(Form)
        self.tabControl.setObjectName(("tabControl"))

        self.tabSIDs = QtGui.QWidget(Form)
        self.tabSIDs.setObjectName(("tabSIDs"))
        self.vl_tabSIDs = QtGui.QVBoxLayout(self.tabSIDs)
        self.vl_tabSIDs.setObjectName("vl_tabSIDs")
        self.tabControl.addTab(self.tabSIDs, ("SIDs"))

        self.tabSTARs = QtGui.QWidget(Form)
        self.tabSTARs.setObjectName(("tabSTARs"))
        self.vl_tabSTARs = QtGui.QVBoxLayout(self.tabSTARs)
        self.vl_tabSTARs.setObjectName("vl_tabSTARs")
        self.tabControl.addTab(self.tabSTARs, ("STARs"))

        self.tabIAPs = QtGui.QWidget(Form)
        self.tabIAPs.setObjectName(("tabIAPs"))
        self.vl_tabIAPs = QtGui.QVBoxLayout(self.tabIAPs)
        self.vl_tabIAPs.setObjectName("vl_tabIAPs")
        self.tabControl.addTab(self.tabIAPs, ("IAPs"))

        self.tabHoldings = QtGui.QWidget(Form)
        self.tabHoldings.setObjectName(("tabHoldings"))
        self.vl_tabHoldings = QtGui.QVBoxLayout(self.tabHoldings)
        self.vl_tabHoldings.setObjectName("vl_tabHoldings")
        self.tabControl.addTab(self.tabHoldings, ("Holdings"))
        self.gbContent.Add = self.tabControl

        self.splitContainer = Frame(self.tabSIDs)
        self.vl_tabSIDs.addWidget(self.splitContainer)
        p1 = Frame(self.splitContainer, "HL")
        self.splitContainer.Add = p1
        p2 = Frame(self.splitContainer, "HL")
        self.splitContainer.Add = p2

        self.pnlProcButtons = Frame(p1)
        

        self.btnProcAdd = QtGui.QPushButton(self.pnlProcButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/add.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnProcAdd.setIcon(icon)
        self.btnProcAdd.setToolTip("Add")
        self.pnlProcButtons.Add = self.btnProcAdd

        self.btnProcEdit = QtGui.QPushButton(self.pnlProcButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/mIconEditableEdits.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnProcEdit.setIcon(icon)
        self.btnProcEdit.setToolTip("Modify")
        self.pnlProcButtons.Add = self.btnProcEdit

        self.btnProcRemove = QtGui.QPushButton(self.pnlProcButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/remove.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnProcRemove.setIcon(icon)
        self.btnProcRemove.setToolTip("Remove")
        self.pnlProcButtons.Add = self.btnProcRemove

        self.gridProcedures = QtGui.QTableView(self.splitContainer)
        self.gridProcedures.setSelectionBehavior(1)
        self.gridProceduresSortModel = QtGui.QSortFilterProxyModel()
        self.gridProceduresStdModel = StandardItemModel()
        self.gridProceduresSortModel.setSourceModel(self.gridProceduresStdModel)
        self.gridProcedures.setModel(self.gridProceduresSortModel)
        p1.Add = self.gridProcedures
        p1.Add = self.pnlProcButtons

        self.gbProcLegs = GroupBox(p2)
        self.gbProcLegs.Title = "Procedure Legs"
        p2.Add = self.gbProcLegs

        self.tabControlProcLegs = QtGui.QTabWidget(self.gbProcLegs)
        self.tabControlProcLegs.setObjectName(("tabControlProcLegs"))
        self.tabProcLegs = QtGui.QWidget(Form)
        self.tabProcLegs.setObjectName(("tabProcLegs"))
        self.hlTabProcLegs = QtGui.QHBoxLayout(self.tabProcLegs)
        self.hlTabProcLegs.setObjectName("hlTabProcLegs")
        
        self.gridLegs = QtGui.QTableView(self.tabProcLegs)
        self.gridLegs.setSelectionBehavior(1)
        self.gridLegsStdModel = StandardItemModel()
        self.gridLegs.setModel(self.gridLegsStdModel)
        self.hlTabProcLegs.addWidget(self.gridLegs)
        
        self.pnlProcLegsButtons = Frame(self.tabProcLegs)

        self.btnLegsEdit = QtGui.QPushButton(self.pnlProcLegsButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/mIconEditableEdits.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnLegsEdit.setIcon(icon)
        self.btnLegsEdit.setToolTip("Modify")
        self.pnlProcLegsButtons.Add = self.btnLegsEdit

        self.btnLegsPreview = QtGui.QPushButton(self.pnlProcLegsButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/pre.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnLegsPreview.setIcon(icon)
        self.btnLegsPreview.setToolTip("Preview")
        self.pnlProcLegsButtons.Add = self.btnLegsPreview
        self.hlTabProcLegs.addWidget(self.pnlProcLegsButtons)

        

        self.tabControlProcLegs.addTab(self.tabProcLegs, ("AIXM 4.5"))


        self.tabProcLegsEx = QtGui.QWidget(Form)
        self.tabProcLegsEx.setObjectName(("tabProcLegsEx"))
        self.hlTabProcLegsEx = QtGui.QHBoxLayout(self.tabProcLegsEx)
        self.hlTabProcLegsEx.setObjectName("hlTabProcLegsEx")

        self.gridLegsEx = QtGui.QTableView(self.tabProcLegsEx)
        self.gridLegsEx.setSelectionBehavior(1)
        self.gridLegsExStdModel = StandardItemModel()
        self.gridLegsEx.setModel(self.gridLegsExStdModel)
        self.hlTabProcLegsEx.addWidget(self.gridLegsEx)


        self.pnlProcLegsExButtons = Frame(self.tabProcLegsEx)

        self.btnLegsExEdit = QtGui.QPushButton(self.pnlProcLegsExButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/mIconEditableEdits.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnLegsExEdit.setIcon(icon)
        self.btnLegsExEdit.setToolTip("Modify")
        self.pnlProcLegsExButtons.Add = self.btnLegsExEdit

        self.btnLegsExPreview = QtGui.QPushButton(self.pnlProcLegsExButtons)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Resource/pre.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.btnLegsExPreview.setIcon(icon)
        self.btnLegsExPreview.setToolTip("Preview")
        self.pnlProcLegsExButtons.Add = self.btnLegsExPreview
        self.hlTabProcLegsEx.addWidget(self.pnlProcLegsExButtons)


        self.tabControlProcLegs.addTab(self.tabProcLegsEx, ("AIXM 4.5+"))
        self.gbProcLegs.Add = self.tabControlProcLegs