def __init__(self, parent = None):
        QDialog.__init__(self, parent)
        
        self.resize(290, 136);
        self.setWindowTitle("Reference Positions")
        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"));
        frameDate = QFrame(self);
        frameDate.setObjectName(("frameDate"));
        frameDate.setFrameShape(QFrame.StyledPanel);
        frameDate.setFrameShadow(QFrame.Raised);
        horizontalLayoutDate = QHBoxLayout(frameDate);
        horizontalLayoutDate.setObjectName(("horizontalLayoutDate"));
        labelDate = QLabel(frameDate);
        labelDate.setObjectName(("labelDate"));
        labelDate.setMinimumSize(QSize(70, 0));
        labelDate.setMaximumSize(QSize(70, 16777215));
        labelDate.setText("Date:")

        horizontalLayoutDate.addWidget(labelDate);

        self.dtpDate = QDateEdit(frameDate);
        self.dtpDate.setObjectName(("dtpDate"));

        horizontalLayoutDate.addWidget(self.dtpDate);

        self.btnDtpDate =  QToolButton(frameDate);
        self.btnDtpDate.setObjectName(("btnDtpDate"));
        sizePolicy.setHeightForWidth(self.btnDtpDate.sizePolicy().hasHeightForWidth());
        self.btnDtpDate.setSizePolicy(sizePolicy);
        self.btnDtpDate.setMinimumSize(QSize(25, 0));
        self.btnDtpDate.setMaximumSize(QSize(25, 16777215));
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/calender.png")), QIcon.Normal, QIcon.Off)
        self.btnDtpDate.setIcon(icon)

        horizontalLayoutDate.addWidget(self.btnDtpDate);


        verticalLayoutDlg.addWidget(frameDate);

        frameModel = QFrame(self);
        frameModel.setObjectName(("frameModel"));
        frameModel.setFrameShape(QFrame.StyledPanel);
        frameModel.setFrameShadow(QFrame.Raised);
        horizontalLayoutModel = QHBoxLayout(frameModel);
        horizontalLayoutModel.setObjectName(("horizontalLayoutModel"));
        labelModel = QLabel(frameModel);
        labelModel.setObjectName(("labelModel"));
        labelModel.setMinimumSize(QSize(70, 0));
        labelModel.setMaximumSize(QSize(70, 16777215));
        labelModel.setText("Model:")

        horizontalLayoutModel.addWidget(labelModel);

        self.cmbModel = QComboBox(frameModel);
        self.cmbModel.setObjectName(("cmbModel"));

        horizontalLayoutModel.addWidget(self.cmbModel);


        verticalLayoutDlg.addWidget(frameModel);

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


        verticalLayoutDlg.addWidget(self.buttonBox);

        self.calendar = QCalendarWidget()
        self.calendar.clicked.connect(self.calendar_clicked)
        self.menu = QMenu()
        layout = QVBoxLayout(self.menu)
        layout.addWidget(self.calendar)

        self.btnDtpDate.clicked.connect(self.btnDtpDate_clicked)
        self.cmbModel.addItems(["WMM2015", "WMM2010" , "WMM2005", "WMM2000", "WMM95", "WMM90", "WMM85", "IGRF2000", "IGRF95", "IGRF90"])
    def __init__(self, parent=None, bool_0=None):
        QDialog.__init__(self, parent)

        self.resize(100, 70)
        self.setWindowTitle("QA Entry")
        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)
        self.groupBox.Caption = ""
        verticalLayoutDlg.addWidget(self.groupBox)

        # self.lblHeading = TextBoxPanel(self.groupBox)
        # self.lblHeading.Enabled = False
        # self.lblHeading.Caption = "Title"
        # self.lblHeading.LabelWidth = 120
        # self.groupBox.Add = self.lblHeading

        self.txtHeading = TextBoxPanel(self.groupBox)
        self.txtHeading.Caption = "Title"
        self.txtHeading.LabelWidth = 120
        self.txtHeading.Width = 200
        self.groupBox.Add = self.txtHeading

        self.chbLimit = CheckBox(self.groupBox)
        self.chbLimit.Caption = "Limit # of table entries to"
        self.groupBox.Add = self.chbLimit

        self.gbColumns = GroupBox(self.groupBox)
        self.groupBox.Add = self.gbColumns

        self.lstColumns = CheckedListBox(self.gbColumns)
        self.gbColumns.Add = self.lstColumns

        self.txtLimit = TextBoxPanel(self.groupBox)
        self.txtLimit.Caption = ""
        self.txtLimit.LabelWidth = 0
        self.txtLimit.Width = 200
        # self.txtLimit.LabelWidth = 120
        self.chbLimit.hLayout.addWidget(self.txtLimit)

        self.chbIgnoreNA = CheckBox(self.groupBox)
        self.chbIgnoreNA.Caption = "Ignore columns containing \"N/A\" values"
        self.groupBox.Add = self.chbIgnoreNA

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

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        if bool_0 != None:
            if (bool_0):
                # int width = base.ClientSize.Width
                # System.Drawing.Size clientSize = base.ClientSize
                # base.ClientSize = new System.Drawing.Size(width, clientSize.Height - (this.gbColumns.Bottom - this.txtHeading.Bottom))
                self.chbLimit.Visible = False
                self.txtLimit.Visible = False
                self.chbIgnoreNA.Visible = False
                self.gbColumns.Visible = False
            self.connect(self.chbLimit, SIGNAL("Event_0"),
                         self.chbLimit_Event_0)
        else:
            DlgQaHeading.rowLimit = 10
            DlgQaHeading.ignoreNAcolumns = True
Esempio n. 3
0
    def setupUi(self):
        self.setWindowTitle(self.tr('Parameter definition'))

        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setSpacing(40)
        self.verticalLayout.setMargin(20)

        self.horizontalLayout = QHBoxLayout(self)
        self.horizontalLayout.setSpacing(2)
        self.horizontalLayout.setMargin(0)
        self.label = QLabel(self.tr('Parameter name'))
        self.horizontalLayout.addWidget(self.label)
        self.nameTextBox = QLineEdit()
        self.horizontalLayout.addWidget(self.nameTextBox)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.horizontalLayout2 = QHBoxLayout(self)
        self.horizontalLayout2.setSpacing(2)
        self.horizontalLayout2.setMargin(0)
        self.horizontalLayout3 = QHBoxLayout(self)
        self.horizontalLayout3.setSpacing(2)
        self.horizontalLayout3.setMargin(0)

        if isinstance(self.param, Parameter):
            self.nameTextBox.setText(self.param.description)

        if self.paramType == ModelerParameterDefinitionDialog.PARAMETER_BOOLEAN or \
           isinstance(self.param, ParameterBoolean):
            self.state = QCheckBox()
            self.state.setText(self.tr('Checked'))
            self.state.setChecked(False)
            if self.param is not None:
                self.state.setChecked(True if self.param.value else False)
            self.horizontalLayout2.addWidget(self.state)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_TABLE_FIELD or \
                isinstance(self.param, ParameterTableField):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Parent layer')))
            self.parentCombo = QComboBox()
            idx = 0
            for param in self.alg.inputs.values():
                if isinstance(param.param, (ParameterVector, ParameterTable)):
                    self.parentCombo.addItem(param.param.description,
                                             param.param.name)
                    if self.param is not None:
                        if self.param.parent == param.param.name:
                            self.parentCombo.setCurrentIndex(idx)
                    idx += 1
            self.horizontalLayout2.addWidget(self.parentCombo)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_RASTER or \
                isinstance(self.param, ParameterRaster):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
            self.yesNoCombo = QComboBox()
            self.yesNoCombo.addItem(self.tr('Yes'))
            self.yesNoCombo.addItem(self.tr('No'))
            if self.param is not None:
                self.yesNoCombo.setCurrentIndex(
                    1 if self.param.optional else 0)
            self.horizontalLayout2.addWidget(self.yesNoCombo)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_TABLE or \
                isinstance(self.param, ParameterTable):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
            self.yesNoCombo = QComboBox()
            self.yesNoCombo.addItem(self.tr('Yes'))
            self.yesNoCombo.addItem(self.tr('No'))
            if self.param is not None:
                self.yesNoCombo.setCurrentIndex(
                    1 if self.param.optional else 0)
            self.horizontalLayout2.addWidget(self.yesNoCombo)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_VECTOR or \
                isinstance(self.param, ParameterVector):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Required')))
            self.yesNoCombo = QComboBox()
            self.yesNoCombo.addItem(self.tr('Yes'))
            self.yesNoCombo.addItem(self.tr('No'))
            self.horizontalLayout2.addWidget(self.yesNoCombo)
            self.horizontalLayout3.addWidget(QLabel(self.tr('Shape type')))
            self.shapetypeCombo = QComboBox()
            self.shapetypeCombo.addItem(self.tr('Any'))
            self.shapetypeCombo.addItem(self.tr('Point'))
            self.shapetypeCombo.addItem(self.tr('Line'))
            self.shapetypeCombo.addItem(self.tr('Polygon'))
            if self.param is not None:
                self.yesNoCombo.setCurrentIndex(
                    1 if self.param.optional else 0)
                self.shapetypeCombo.setCurrentIndex(self.param.shapetype[0] +
                                                    1)
            self.horizontalLayout3.addWidget(self.shapetypeCombo)
            self.verticalLayout.addLayout(self.horizontalLayout3)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_MULTIPLE or \
                isinstance(self.param, ParameterMultipleInput):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Mandatory')))
            self.yesNoCombo = QComboBox()
            self.yesNoCombo.addItem(self.tr('Yes'))
            self.yesNoCombo.addItem(self.tr('No'))
            self.horizontalLayout2.addWidget(self.yesNoCombo)
            self.horizontalLayout3.addWidget(QLabel(self.tr('Data type')))
            self.datatypeCombo = QComboBox()
            self.datatypeCombo.addItem(self.tr('Vector (any)'))
            self.datatypeCombo.addItem(self.tr('Vector (point)'))
            self.datatypeCombo.addItem(self.tr('Vector (line)'))
            self.datatypeCombo.addItem(self.tr('Vector (polygon)'))
            self.datatypeCombo.addItem(self.tr('Raster'))
            self.datatypeCombo.addItem(self.tr('Table'))
            if self.param is not None:
                self.yesNoCombo.setCurrentIndex(
                    1 if self.param.optional else 0)
                self.datatypeCombo.setCurrentIndex(self.param.datatype + 1)
            self.horizontalLayout3.addWidget(self.datatypeCombo)
            self.verticalLayout.addLayout(self.horizontalLayout3)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_NUMBER or \
                isinstance(self.param, ParameterNumber):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Min/Max values')))
            self.minTextBox = QLineEdit()
            self.maxTextBox = QLineEdit()
            if self.param is not None:
                self.minTextBox.setText(str(self.param.min))
                self.maxTextBox.setText(str(self.param.max))
            self.horizontalLayout2.addWidget(self.minTextBox)
            self.horizontalLayout2.addWidget(self.maxTextBox)
            self.verticalLayout.addLayout(self.horizontalLayout2)
            self.horizontalLayout3.addWidget(QLabel(self.tr('Default value')))
            self.defaultTextBox = QLineEdit()
            self.defaultTextBox.setText(self.tr('0'))
            if self.param is not None:
                default = self.param.default
                if self.param.isInteger:
                    default = int(math.floor(default))
                self.defaultTextBox.setText(str(default))
            self.horizontalLayout3.addWidget(self.defaultTextBox)
            self.verticalLayout.addLayout(self.horizontalLayout3)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_STRING or \
                isinstance(self.param, ParameterString):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Default value')))
            self.defaultTextBox = QLineEdit()
            if self.param is not None:
                self.defaultTextBox.setText(self.param.default)
            self.horizontalLayout2.addWidget(self.defaultTextBox)
            self.verticalLayout.addLayout(self.horizontalLayout2)
        elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_FILE or \
                isinstance(self.param, ParameterFile):
            self.horizontalLayout2.addWidget(QLabel(self.tr('Type')))
            self.fileFolderCombo = QComboBox()
            self.fileFolderCombo.addItem(self.tr('File'))
            self.fileFolderCombo.addItem(self.tr('Folder'))
            if self.param is not None:
                self.fileFolderCombo.setCurrentIndex(
                    1 if self.param.isFolder else 0)
            self.horizontalLayout2.addWidget(self.fileFolderCombo)
            self.verticalLayout.addLayout(self.horizontalLayout2)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)
        self.buttonBox.setObjectName('buttonBox')
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)

        self.verticalLayout.addWidget(self.buttonBox)

        self.setLayout(self.verticalLayout)
    def __init__(self, parent, fName, resformat, paradigm, sep):
        QDialog.__init__(self, parent)
        self.fName = fName
        self.resformat = resformat
      
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
        self.prm = self.parent().prm

        if paradigm in [self.tr("Transformed Up-Down"), self.tr("Transformed Up-Down Limited"),
                        self.tr("Weighted Up-Down"), self.tr("PEST"), self.tr("Weighted Up-Down Limited")]:
            self.paradigm = "adaptive"
        elif paradigm in [self.tr("Transformed Up-Down Interleaved"), self.tr("Weighted Up-Down Interleaved")]:
            self.paradigm = "adaptive_interleaved"
        elif paradigm == self.tr("Constant 1-Interval 2-Alternatives"):
            self.paradigm = "constant1Interval2Alternatives" 
        elif paradigm == self.tr("Multiple Constants 1-Interval 2-Alternatives"):
            self.paradigm = "multipleConstants1Interval2Alternatives" 
        elif paradigm == self.tr("Constant m-Intervals n-Alternatives"):
            self.paradigm = "constantMIntervalsNAlternatives"
        elif paradigm == self.tr("Multiple Constants m-Intervals n-Alternatives"):
            self.paradigm = "multipleConstantsMIntervalsNAlternatives"
        elif paradigm == self.tr("Constant 1-Pair Same/Different"):
            self.paradigm = "constant1PairSD"
        elif paradigm == self.tr("Multiple Constants 1-Pair Same/Different"):
            self.paradigm = "multipleConstants1PairSD"
        elif paradigm == self.tr("Multiple Constants ABX") and self.resformat == "table": #currently supports only tabular
            self.paradigm = "multipleConstantsABX"
        elif paradigm == self.tr("Multiple Constants Odd One Out") and self.resformat == "table": #currently supports only tabular
            self.paradigm = "multipleConstantsOddOneOut"

        else:
            QMessageBox.warning(self, self.tr("Error"), self.tr("File type or paradigm not supported."))
            return
        
        self.soundPrefWidget = QWidget()
        self.vBoxSizer = QVBoxLayout()
        self.hCsvSeparator =  QHBoxLayout()
        self.plotBox =  QHBoxLayout()
        self.pdfPlotBox =  QHBoxLayout()
        self.hBox1 =  QHBoxLayout()
        self.hBox1_1 =  QHBoxLayout()
        self.hBox2 =  QHBoxLayout()
        self.hBox3 =  QHBoxLayout()
        self.hBox4 =  QHBoxLayout()
        self.hBox5 =  QHBoxLayout()
        self.hBox6 =  QHBoxLayout()
        self.hBox7a =  QHBoxLayout()
        self.hBox7 =  QHBoxLayout()
        self.hBox8 =  QHBoxLayout()
        self.hBox9 =  QHBoxLayout()
    
        n = 0
        self.fileChooseLabel = QLabel(self.tr('Input File(s): '))
        self.hBox1.addWidget(self.fileChooseLabel)
        self.fileTF = QLineEdit(';'.join(self.fName))
        self.hBox1.addWidget(self.fileTF)
        self.chooseFileButton = QPushButton(self.tr("Change File"), self)
        self.chooseFileButton.clicked.connect(self.onClickChooseFileButton)
        self.hBox1.addWidget(self.chooseFileButton)

        n = n +1
        self.outfileChooseLabel = QLabel(self.tr('Output File: '))
        self.hBox1_1.addWidget(self.outfileChooseLabel)
        self.outfileTF = QLineEdit("")
        self.hBox1_1.addWidget(self.outfileTF)
        self.chooseOutFileButton = QPushButton(self.tr("Change File"), self)
        self.chooseOutFileButton.clicked.connect(self.onClickChooseOutFileButton)
        self.hBox1_1.addWidget(self.chooseOutFileButton)

        if self.resformat == 'table':
            self.csvSeparatorLabel = QLabel(self.tr('csv separator:'))
            self.csvSeparatorTF = QLineEdit(sep)#parent.prm['pref']["general"]["csvSeparator"])
            self.hCsvSeparator.addWidget(self.csvSeparatorLabel)
            self.hCsvSeparator.addWidget(self.csvSeparatorTF)
            if self.parent().prm['appData']['plotting_available'] == True:
                self.plotCheckBox = QCheckBox(self.tr('Plot'))
                #self.plotCheckBox.setChecked(True)
                self.plotBox.addWidget(self.plotCheckBox)
                self.pdfPlotCheckBox = QCheckBox(self.tr('PDF Plot'))
                #self.plotCheckBox.setChecked(True)
                self.pdfPlotBox.addWidget(self.pdfPlotCheckBox)

        n = n+1
        self.label1 = QLabel(self.tr('For each condition process: '))
        self.hBox2.addWidget(self.label1)

        n = n+1
        self.processAllBlocksCheckBox = QCheckBox(self.tr('All Blocks'))
        self.processAllBlocksCheckBox.setChecked(True)
        self.hBox3.addWidget(self.processAllBlocksCheckBox)

        n = n+1
        self.label2 = QLabel(self.tr('Last: '))
        self.hBox4.addWidget(self.label2)
        self.lastNBlocksTF = QLineEdit("")
        self.lastNBlocksTF.setValidator(QIntValidator(self))
        self.hBox4.addWidget(self.lastNBlocksTF)
        self.processLastNBlocksCheckBox = QCheckBox(self.tr('Blocks'))
        self.processLastNBlocksCheckBox.setChecked(False)
        self.hBox4.addWidget(self.processLastNBlocksCheckBox)

        n = n+1
        self.processBlocksInRangeCheckBox = QCheckBox(self.tr('Blocks in the following range'))
        self.processBlocksInRangeCheckBox.setChecked(False)
        self.hBox5.addWidget(self.processBlocksInRangeCheckBox)
        n = n+1
        self.label3 = QLabel(self.tr('From: '))
        self.hBox6.addWidget(self.label3)
        self.label4 = QLabel(self.tr('To: '))
        self.fromTF = QLineEdit("")
        self.fromTF.setValidator(QIntValidator(self))
        self.hBox6.addWidget(self.fromTF)
        self.hBox6.addWidget(self.label4)
        self.toTF = QLineEdit("")
        self.toTF.setValidator(QIntValidator(self))
        self.hBox6.addWidget(self.toTF)

        self.processAllBlocksCheckBox.clicked.connect(self.onCheckProcessAllBlocks)
        self.processLastNBlocksCheckBox.clicked.connect(self.onCheckProcessLastNBlocks)
        self.processBlocksInRangeCheckBox.clicked.connect(self.onCheckProcessBlocksInRange)

        if self.paradigm in ["constant1Interval2Alternatives", "multipleConstants1Interval2Alternatives",
                             "constant1PairSD", "multipleConstants1PairSD", "constantABX", "multipleConstantsABX"]:
            self.dpCorrCheckBox = QCheckBox(self.tr('d-prime correction'))
            self.dpCorrCheckBox.setChecked(self.prm['pref']['general']['dprimeCorrection'])
            self.hBox7a.addWidget(self.dpCorrCheckBox)
        n = n+1
        self.openResultsFile = QCheckBox(self.tr('When Finished, Open Results File'))
        self.openResultsFile.setChecked(False)
        self.hBox7.addWidget(self.openResultsFile)

        n = n+1
        self.openResultsFolder = QCheckBox(self.tr('When Finished, Open Results Folder'))
        self.openResultsFolder.setChecked(False)
        self.hBox8.addWidget(self.openResultsFolder)

        n = n+1
        self.runButton = QPushButton(self.tr("Run!"), self)
        self.runButton.clicked.connect(self.onClickRunButton)
        self.runButton.setIcon(QIcon.fromTheme("system-run", QIcon(":/system-run")))
        self.hBox9.addWidget(self.runButton)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Close)
        buttonBox.rejected.connect(self.reject)
       
        self.vBoxSizer.addLayout(self.hBox1)
        self.vBoxSizer.addLayout(self.hBox1_1)
        if self.resformat == 'table':
            self.vBoxSizer.addLayout(self.hCsvSeparator)
            if self.parent().prm['appData']['plotting_available'] == True:
                self.vBoxSizer.addLayout(self.plotBox)
                self.vBoxSizer.addLayout(self.pdfPlotBox)
        self.vBoxSizer.addLayout(self.hBox2)
        self.vBoxSizer.addLayout(self.hBox3)
        self.vBoxSizer.addLayout(self.hBox4)
        self.vBoxSizer.addLayout(self.hBox5)
        self.vBoxSizer.addLayout(self.hBox6)
        self.vBoxSizer.addLayout(self.hBox7a)
        self.vBoxSizer.addLayout(self.hBox7)
        self.vBoxSizer.addLayout(self.hBox8)
        self.vBoxSizer.addLayout(self.hBox9)
        self.vBoxSizer.addWidget(buttonBox)
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Process Results "))
        self.show()
Esempio n. 5
0
 def createWidgets(self):
     self.keySequenceLabel = QLabel("Enter a new hotkey")
     self.keySequenceLineEdit = KeySequenceEdit(
         QKeySequence(self.keySequence))
     self.keySequenceButtonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                                  | QDialogButtonBox.Cancel)
    def __init__(self, parent, title, valueList = None):
        QDialog.__init__(self, parent)
        
        self.resize(100, 70);
        self.setWindowTitle(title)
        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.frameBasic = Frame(self)
        verticalLayoutDlg.addWidget(self.frameBasic)

        self.pnlName = TextBoxPanel(self.frameBasic)
        self.pnlName.Caption = "Name"
        self.pnlName.LabelWidth = 120
        self.frameBasic.Add = self.pnlName


        self.pnlLowerLimit = DistanceBoxPanel(self.frameBasic, DistanceUnits.M)
        self.pnlLowerLimit.Caption = "Lower Limit"
        self.pnlLowerLimit.Button = None
        self.pnlLowerLimit.LabelWidth = 120
        self.frameBasic.Add = self.pnlLowerLimit

        self.pnlUpperLimit = DistanceBoxPanel(self.frameBasic, DistanceUnits.M)
        self.pnlUpperLimit.Caption = "Upper Limit"
        self.pnlUpperLimit.Button = None
        self.pnlUpperLimit.LabelWidth = 120
        self.frameBasic.Add = self.pnlUpperLimit

        self.pnlRadius = DistanceBoxPanel(self.frameBasic, DistanceUnits.M)
        self.pnlRadius.Caption = "Radius"
        self.pnlRadius.Button = None
        self.pnlRadius.LabelWidth = 120
        self.frameBasic.Add = self.pnlRadius

        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.name = ""
        self.lowerLimit = ""
        self.upperLimit = ""
        self.radius = ""


        if valueList != None:
            self.pnlName.Value = valueList[0]
            self.pnlLowerLimit.Value = Distance(float(valueList[1]))
            self.pnlUpperLimit.Value = Distance(float(valueList[2]))
            if valueList[3] != None and valueList[3] != "":
                self.pnlRadius.Value = Distance(float(valueList[3]))
Esempio n. 7
0
    def __init__(self, parent, rnavType, category, position_0, position_1, position_List, flagStr = None):
        QDialog.__init__(self, parent)
        self.flagStrName = flagStr
#         self.resize(326, 310)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setMargin(3)
        self.verticalLayout.setObjectName(("verticalLayout"))
        self.groupBox = QGroupBox(self)
        self.groupBox.setTitle((""))
        self.groupBox.setObjectName(("groupBox"))
        self.verticalLayout_2 = QVBoxLayout(self.groupBox)
        self.verticalLayout_2.setSpacing(0)
        self.verticalLayout_2.setMargin(3)
        self.verticalLayout_2.setObjectName(("verticalLayout_2"))
        self.groupBox_5 = QGroupBox(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth())
        self.groupBox_5.setSizePolicy(sizePolicy)
        font = QFont()
        font.setFamily(("Arial"))
        self.groupBox_5.setFont(font)
        self.groupBox_5.setObjectName(("groupBox_5"))
        self.horizontalLayout_19 = QHBoxLayout(self.groupBox_5)
        self.horizontalLayout_19.setSpacing(0)
        self.horizontalLayout_19.setMargin(0)
        self.horizontalLayout_19.setObjectName(("horizontalLayout_19"))
        self.frame_18 = QFrame(self.groupBox_5)
        self.frame_18.setFrameShape(QFrame.StyledPanel)
        self.frame_18.setFrameShadow(QFrame.Raised)
        self.frame_18.setObjectName(("frame_18"))
        self.verticalLayout_13 = QVBoxLayout(self.frame_18)
        self.verticalLayout_13.setSpacing(0)
        self.verticalLayout_13.setContentsMargins(-1, -1, 0, -1)
        self.verticalLayout_13.setObjectName(("verticalLayout_13"))
        self.frame_19 = QFrame(self.frame_18)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_19.sizePolicy().hasHeightForWidth())
        self.frame_19.setSizePolicy(sizePolicy)
        self.frame_19.setFrameShape(QFrame.StyledPanel)
        self.frame_19.setFrameShadow(QFrame.Raised)
        self.frame_19.setObjectName(("frame_19"))
        self.horizontalLayout_20 = QHBoxLayout(self.frame_19)
        self.horizontalLayout_20.setSpacing(0)
        self.horizontalLayout_20.setMargin(0)
        self.horizontalLayout_20.setObjectName(("horizontalLayout_20"))
        self.label_9 = QLabel(self.frame_19)
        self.label_9.setMaximumSize(QSize(60, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_9.setFont(font)
        self.label_9.setObjectName(("label_9"))
        self.horizontalLayout_20.addWidget(self.label_9)
        self.txtTHR_X = QLineEdit(self.frame_19)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtTHR_X.sizePolicy().hasHeightForWidth())
        self.txtTHR_X.setSizePolicy(sizePolicy)
        self.txtTHR_X.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtTHR_X.setFont(font)
        self.txtTHR_X.setObjectName(("txtTHR_X"))
        self.horizontalLayout_20.addWidget(self.txtTHR_X)
        self.verticalLayout_13.addWidget(self.frame_19)
        self.frame_20 = QFrame(self.frame_18)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_20.sizePolicy().hasHeightForWidth())
        self.frame_20.setSizePolicy(sizePolicy)
        self.frame_20.setFrameShape(QFrame.StyledPanel)
        self.frame_20.setFrameShadow(QFrame.Raised)
        self.frame_20.setObjectName(("frame_20"))
        self.horizontalLayout_21 = QHBoxLayout(self.frame_20)
        self.horizontalLayout_21.setSpacing(0)
        self.horizontalLayout_21.setMargin(0)
        self.horizontalLayout_21.setObjectName(("horizontalLayout_21"))
        self.label_10 = QLabel(self.frame_20)
        self.label_10.setMaximumSize(QSize(60, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_10.setFont(font)
        self.label_10.setObjectName(("label_10"))
        self.horizontalLayout_21.addWidget(self.label_10)
        self.txtTHR_Y = QLineEdit(self.frame_20)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtTHR_Y.sizePolicy().hasHeightForWidth())
        self.txtTHR_Y.setSizePolicy(sizePolicy)
        self.txtTHR_Y.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtTHR_Y.setFont(font)
        self.txtTHR_Y.setObjectName(("txtTHR_Y"))
        self.horizontalLayout_21.addWidget(self.txtTHR_Y)
        self.verticalLayout_13.addWidget(self.frame_20)
        self.horizontalLayout_19.addWidget(self.frame_18)
        self.frame_21 = QFrame(self.groupBox_5)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_21.sizePolicy().hasHeightForWidth())
        self.frame_21.setSizePolicy(sizePolicy)
        self.frame_21.setMaximumSize(QSize(30, 70))
        self.frame_21.setFrameShape(QFrame.StyledPanel)
        self.frame_21.setFrameShadow(QFrame.Raised)
        self.frame_21.setObjectName(("frame_21"))
        self.verticalLayout_14 = QVBoxLayout(self.frame_21)
        self.verticalLayout_14.setSpacing(0)
        self.verticalLayout_14.setMargin(0)
        self.verticalLayout_14.setObjectName(("verticalLayout_14"))
        self.btnCaptureRunwayTHR = QToolButton(self.frame_21)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnCaptureRunwayTHR.sizePolicy().hasHeightForWidth())
        self.btnCaptureRunwayTHR.setSizePolicy(sizePolicy)
        self.btnCaptureRunwayTHR.setMaximumSize(QSize(16777215, 47))
        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/coordinate_capture.png")), QIcon.Normal, QIcon.Off)
        self.btnCaptureRunwayTHR.setIcon(icon)
        self.btnCaptureRunwayTHR.setObjectName(("btnCaptureRunwayTHR"))
        self.verticalLayout_14.addWidget(self.btnCaptureRunwayTHR)
#         self.btnToolTHR = QToolButton(self.frame_21)
#         sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(self.btnToolTHR.sizePolicy().hasHeightForWidth())
#         self.btnToolTHR.setSizePolicy(sizePolicy)
#         self.btnToolTHR.setMaximumSize(QSize(16777215, 20))
#         icon1 = QIcon()
#         icon1.addPixmap(QPixmap(("Resource/sort2.png")), QIcon.Normal, QIcon.Off)
#         self.btnToolTHR.setIcon(icon1)
#         self.btnToolTHR.setObjectName(("btnToolTHR"))
#         self.verticalLayout_14.addWidget(self.btnToolTHR)
        self.horizontalLayout_19.addWidget(self.frame_21)
        self.verticalLayout_2.addWidget(self.groupBox_5)
        self.groupBox_4 = QGroupBox(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.groupBox_4.sizePolicy().hasHeightForWidth())
        self.groupBox_4.setSizePolicy(sizePolicy)
        font = QFont()
        font.setFamily(("Arial"))
        self.groupBox_4.setFont(font)
        self.groupBox_4.setObjectName(("groupBox_4"))
        self.horizontalLayout_16 = QHBoxLayout(self.groupBox_4)
        self.horizontalLayout_16.setSpacing(0)
        self.horizontalLayout_16.setMargin(0)
        self.horizontalLayout_16.setObjectName(("horizontalLayout_16"))
        self.frame_14 = QFrame(self.groupBox_4)
        self.frame_14.setFrameShape(QFrame.StyledPanel)
        self.frame_14.setFrameShadow(QFrame.Raised)
        self.frame_14.setObjectName(("frame_14"))
        self.verticalLayout_11 = QVBoxLayout(self.frame_14)
        self.verticalLayout_11.setSpacing(0)
        self.verticalLayout_11.setContentsMargins(-1, -1, 0, -1)
        self.verticalLayout_11.setObjectName(("verticalLayout_11"))
        self.frame_15 = QFrame(self.frame_14)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_15.sizePolicy().hasHeightForWidth())
        self.frame_15.setSizePolicy(sizePolicy)
        self.frame_15.setFrameShape(QFrame.StyledPanel)
        self.frame_15.setFrameShadow(QFrame.Raised)
        self.frame_15.setObjectName(("frame_15"))
        self.horizontalLayout_17 = QHBoxLayout(self.frame_15)
        self.horizontalLayout_17.setSpacing(0)
        self.horizontalLayout_17.setMargin(0)
        self.horizontalLayout_17.setObjectName(("horizontalLayout_17"))
        self.label_7 = QLabel(self.frame_15)
        self.label_7.setMaximumSize(QSize(60, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_7.setFont(font)
        self.label_7.setObjectName(("label_7"))
        self.horizontalLayout_17.addWidget(self.label_7)
        self.txtEND_X = QLineEdit(self.frame_15)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtEND_X.sizePolicy().hasHeightForWidth())
        self.txtEND_X.setSizePolicy(sizePolicy)
        self.txtEND_X.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtEND_X.setFont(font)
        self.txtEND_X.setObjectName(("txtEND_X"))
        self.horizontalLayout_17.addWidget(self.txtEND_X)
        self.verticalLayout_11.addWidget(self.frame_15)
        self.frame_16 = QFrame(self.frame_14)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_16.sizePolicy().hasHeightForWidth())
        self.frame_16.setSizePolicy(sizePolicy)
        self.frame_16.setFrameShape(QFrame.StyledPanel)
        self.frame_16.setFrameShadow(QFrame.Raised)
        self.frame_16.setObjectName(("frame_16"))
        self.horizontalLayout_18 = QHBoxLayout(self.frame_16)
        self.horizontalLayout_18.setSpacing(0)
        self.horizontalLayout_18.setMargin(0)
        self.horizontalLayout_18.setObjectName(("horizontalLayout_18"))
        self.label_8 = QLabel(self.frame_16)
        self.label_8.setMaximumSize(QSize(60, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_8.setFont(font)
        self.label_8.setObjectName(("label_8"))
        self.horizontalLayout_18.addWidget(self.label_8)
        self.txtEND_Y = QLineEdit(self.frame_16)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtEND_Y.sizePolicy().hasHeightForWidth())
        self.txtEND_Y.setSizePolicy(sizePolicy)
        self.txtEND_Y.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtEND_Y.setFont(font)
        self.txtEND_Y.setObjectName(("txtEND_Y"))
        self.horizontalLayout_18.addWidget(self.txtEND_Y)
        self.verticalLayout_11.addWidget(self.frame_16)
        self.horizontalLayout_16.addWidget(self.frame_14)
        self.frame_17 = QFrame(self.groupBox_4)
        self.frame_17.setMaximumSize(QSize(30, 16777215))
        self.frame_17.setFrameShape(QFrame.StyledPanel)
        self.frame_17.setFrameShadow(QFrame.Raised)
        self.frame_17.setObjectName(("frame_17"))
        self.verticalLayout_12 = QVBoxLayout(self.frame_17)
        self.verticalLayout_12.setSpacing(0)
        self.verticalLayout_12.setMargin(0)
        self.verticalLayout_12.setObjectName(("verticalLayout_12"))
        self.btnCaptureRunwayEND = QToolButton(self.frame_17)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnCaptureRunwayEND.sizePolicy().hasHeightForWidth())
        self.btnCaptureRunwayEND.setSizePolicy(sizePolicy)
        self.btnCaptureRunwayEND.setMaximumSize(QSize(16777215, 47))
        self.btnCaptureRunwayEND.setIcon(icon)
        self.btnCaptureRunwayEND.setObjectName(("btnCaptureRunwayEND"))
        self.verticalLayout_12.addWidget(self.btnCaptureRunwayEND)
#         self.btnToolEND = QToolButton(self.frame_17)
#         sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(self.btnToolEND.sizePolicy().hasHeightForWidth())
#         self.btnToolEND.setSizePolicy(sizePolicy)
#         self.btnToolEND.setMaximumSize(QSize(16777215, 20))
#         self.btnToolEND.setIcon(icon1)
#         self.btnToolEND.setObjectName(("btnToolEND"))
#         self.verticalLayout_12.addWidget(self.btnToolEND)
        self.horizontalLayout_16.addWidget(self.frame_17)
        self.verticalLayout_2.addWidget(self.groupBox_4)
        self.lbl1 = QLabel(self.groupBox)
        font = QFont()
        font.setFamily(("Arial"))
        self.lbl1.setFont(font)
        self.lbl1.setText((""))
        self.lbl1.setAlignment(Qt.AlignCenter)
        self.lbl1.setWordWrap(False)
        self.lbl1.setMargin(0)
        self.lbl1.setObjectName(("lbl1"))
        self.verticalLayout_2.addWidget(self.lbl1)
        self.lbl2 = QLabel(self.groupBox)
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.lbl2.setFont(font)
        self.lbl2.setText((""))
        self.lbl2.setAlignment(Qt.AlignCenter)
        self.lbl2.setObjectName(("lbl2"))
        self.verticalLayout_2.addWidget(self.lbl2)
        self.frame_22 = QFrame(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_22.sizePolicy().hasHeightForWidth())
        self.frame_22.setSizePolicy(sizePolicy)
        self.frame_22.setFrameShape(QFrame.StyledPanel)
        self.frame_22.setFrameShadow(QFrame.Raised)
        self.frame_22.setObjectName(("frame_22"))
        self.horizontalLayout_22 = QHBoxLayout(self.frame_22)
        self.horizontalLayout_22.setSpacing(0)
        self.horizontalLayout_22.setMargin(0)
        self.horizontalLayout_22.setObjectName(("horizontalLayout_22"))
        self.label_11 = QLabel(self.frame_22)
        self.label_11.setMinimumSize(QSize(170, 0))
        self.label_11.setMaximumSize(QSize(180, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_11.setFont(font)
        self.label_11.setObjectName(("label_11"))
        self.horizontalLayout_22.addWidget(self.label_11)
        self.txtForm = QLineEdit(self.frame_22)
        self.txtForm.setEnabled(False)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtForm.sizePolicy().hasHeightForWidth())
        self.txtForm.setSizePolicy(sizePolicy)
        self.txtForm.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtForm.setFont(font)
        self.txtForm.setObjectName(("txtForm"))
        self.horizontalLayout_22.addWidget(self.txtForm)
        self.verticalLayout_2.addWidget(self.frame_22)
        self.frame_23 = QFrame(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_23.sizePolicy().hasHeightForWidth())
        self.frame_23.setSizePolicy(sizePolicy)
        self.frame_23.setFrameShape(QFrame.StyledPanel)
        self.frame_23.setFrameShadow(QFrame.Raised)
        self.frame_23.setObjectName(("frame_23"))
        self.horizontalLayout_23 = QHBoxLayout(self.frame_23)
        self.horizontalLayout_23.setSpacing(0)
        self.horizontalLayout_23.setMargin(0)
        self.horizontalLayout_23.setObjectName(("horizontalLayout_23"))
        self.label_12 = QLabel(self.frame_23)
        self.label_12.setMinimumSize(QSize(170, 0))
        self.label_12.setMaximumSize(QSize(180, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.label_12.setFont(font)
        self.label_12.setObjectName(("label_12"))
        self.horizontalLayout_23.addWidget(self.label_12)
        self.txtBearing = QLineEdit(self.frame_23)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtBearing.sizePolicy().hasHeightForWidth())
        self.txtBearing.setSizePolicy(sizePolicy)
        self.txtBearing.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtBearing.setFont(font)
        self.txtBearing.setObjectName(("txtBearing"))
        self.horizontalLayout_23.addWidget(self.txtBearing)
        self.btnCaptureBearing = QToolButton(self.frame_23)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnCaptureBearing.sizePolicy().hasHeightForWidth())
        self.btnCaptureBearing.setSizePolicy(sizePolicy)
        self.btnCaptureBearing.setMaximumSize(QSize(16777215, 25))
        self.btnCaptureBearing.setStyleSheet((""))
        self.btnCaptureBearing.setIcon(icon)
        self.btnCaptureBearing.setObjectName(("btnCaptureBearing"))
        self.horizontalLayout_23.addWidget(self.btnCaptureBearing)
        self.verticalLayout_2.addWidget(self.frame_23)
        self.frame_24 = QFrame(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.frame_24.sizePolicy().hasHeightForWidth())
        self.frame_24.setSizePolicy(sizePolicy)
        self.frame_24.setFrameShape(QFrame.StyledPanel)
        self.frame_24.setFrameShadow(QFrame.Raised)
        self.frame_24.setObjectName(("frame_24"))
        self.horizontalLayout_24 = QHBoxLayout(self.frame_24)
        self.horizontalLayout_24.setSpacing(0)
        self.horizontalLayout_24.setMargin(0)
        self.horizontalLayout_24.setObjectName(("horizontalLayout_24"))
        self.lblDistance = QLabel(self.frame_24)
        self.lblDistance.setMinimumSize(QSize(170, 0))
        self.lblDistance.setMaximumSize(QSize(180, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        font.setBold(False)
        font.setWeight(50)
        self.lblDistance.setFont(font)
        self.lblDistance.setObjectName(("lblDistance"))
        self.horizontalLayout_24.addWidget(self.lblDistance)
        self.txtDistance = QLineEdit(self.frame_24)
        self.txtDistance.setEnabled(False)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.txtDistance.sizePolicy().hasHeightForWidth())
        self.txtDistance.setSizePolicy(sizePolicy)
        self.txtDistance.setMaximumSize(QSize(16777215, 16777215))
        font = QFont()
        font.setFamily(("Arial"))
        self.txtDistance.setFont(font)
        self.txtDistance.setObjectName(("txtDistance"))
        self.horizontalLayout_24.addWidget(self.txtDistance)
        self.btnCaptureDistance = QToolButton(self.frame_24)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnCaptureDistance.sizePolicy().hasHeightForWidth())
        self.btnCaptureDistance.setSizePolicy(sizePolicy)
        self.btnCaptureDistance.setMaximumSize(QSize(16777215, 23))
        self.btnCaptureDistance.setStyleSheet((""))
        self.btnCaptureDistance.setIcon(icon)
        self.btnCaptureDistance.setObjectName(("btnCaptureDistance"))
        self.horizontalLayout_24.addWidget(self.btnCaptureDistance)
        self.verticalLayout_2.addWidget(self.frame_24)
        self.verticalLayout.addWidget(self.groupBox)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)
        self.btnCaptureDistance.clicked.connect(self.method_9)
        self.btnCaptureBearing.clicked.connect(self.method_8)
        self.txtEND_X.textChanged.connect(self.method_4)
        self.txtEND_Y.textChanged.connect(self.method_4)
        self.txtTHR_X.textChanged.connect(self.method_4)
        self.txtTHR_Y.textChanged.connect(self.method_4)
        self.type = rnavType
        self.category = category
        self.resultPosionList = position_List
        self.MinBearing2 = 0
        self.MaxBearing2= 0
        self.waypoint = None
        self.distanceMeasureTool = MeasureTool(define._canvas, self.txtDistance, DistanceUnits.NM)
        self.bearingTool = CaptureBearingTool(define._canvas, self.txtBearing)
        self.CaptureTHRCoordTool = CaptureCoordinateTool(define._canvas, self.txtTHR_X, self.txtTHR_Y)
        self.CaptureTHRCoordTool.rubberBandClick.setColor(Qt.green)        
        self.CaptureENDCoordTool = CaptureCoordinateTool(define._canvas, self.txtEND_X, self.txtEND_Y)
        self.CaptureENDCoordTool.rubberBandClick.setColor(Qt.blue)
        if rnavType == RnavCommonWaypoint.FAWP or rnavType == RnavCommonWaypoint.MAWP:
            self.from1 = position_0
            
            self.resize(326, 310)
            if position_List[0] != None:        
                self.setThrPosition(position_List[0].x(),position_List[0].y())
                self.CaptureTHRCoordTool.rubberBandClick.addPoint(QgsPoint(position_List[0].x(),position_List[0].y()))
#                 self.CaptureTHRCoordTool.rubberBandClick.show()
            if position_List[1] != None: 
                self.setEndPosition(position_List[1].x(),position_List[1].y())
                self.CaptureENDCoordTool.rubberBandClick.addPoint(QgsPoint(position_List[1].x(),position_List[1].y()))
#             self.setWaypoint(position_List[2])
        else:
            self.from1 = position_1
            num = RnavWaypoints.smethod_0(position_0, position_1)
            self.MinBearing = RnavWaypoints.smethod_7(rnavType, category, num)
            self.MaxBearing= RnavWaypoints.smethod_8(rnavType, category, num)
            self.MinDistance = RnavWaypoints.smethod_4(rnavType, category)
            if flagStr == "Y-Bar":
                if (rnavType == RnavCommonWaypoint.IAWP1):
                    self.setBearing(self.MaxBearing)
                elif (rnavType != RnavCommonWaypoint.IAWP3):
                    self.setBearing(num)
                else:
                    self.setBearing(self.MinBearing)
            else:
                if (rnavType == RnavCommonWaypoint.IAWP1):
                    self.setBearing(self.MinBearing)
                elif (rnavType != RnavCommonWaypoint.IAWP3):
                    self.setBearing(num)
                else:
                    self.setBearing(self.MaxBearing)
#             if self.txtDistance.isEnabled():
#             self.setDistance(RnavWaypoints.smethod_6(rnavType, category).NauticalMiles)
#             self.setWaypoint(position_List.pop(0))
        self.method_4()
        self.retranslateUi()
        QObject.connect(self.buttonBox, SIGNAL(("accepted()")), self.btnCalculate_Click)
        QObject.connect(self.buttonBox, SIGNAL(("rejected()")), self.reject)
#         QMetaObject.connectSlotsByName(Dialog)
        
#         self.btnToolEND.clicked.connect(self.removeEnd)
#         self.btnToolTHR.clicked.connect(self.removeThr)
        self.btnCaptureRunwayTHR.clicked.connect(self.captureTHR)
        self.btnCaptureRunwayEND.clicked.connect(self.captureEND)
Esempio n. 8
0
    def __init__(self, parent = None):
        QDialog.__init__(self, parent)

        self.resize(400, 500)
        self.setWindowTitle("Aerodrome Surfaces Criteria")
        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"))

        scrollArea = QScrollArea(self);
        scrollArea.setObjectName("scrollArea")
        scrollArea.setWidgetResizable(True)
        scrollAreaWidgetContents = QWidget(scrollArea)
        scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        # scrollAreaWidgetContents.setGeometry(QRect(0, 0, 380, 280))
        vLayoutScrollArea = QVBoxLayout(scrollAreaWidgetContents)
        vLayoutScrollArea.setObjectName("vLayoutScrollArea")
        scrollArea.setWidget(scrollAreaWidgetContents)
        verticalLayoutDlg.addWidget(scrollArea)

        self.groupBox = GroupBox(self)
        self.groupBox.Caption = ""
        vLayoutScrollArea.addWidget(self.groupBox)

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

        self.pnlName = TextBoxPanel(self.panel)
        self.pnlName.LabelWidth = 0
        self.panel.Add = self.pnlName

        self.gbApproach = GroupBox(self.panel)
        self.gbApproach.Caption = "Approach"
        self.panel.Add = self.gbApproach

        self.pnlAPP_InnerEdge = DistanceBoxPanel(self.gbApproach, DistanceUnits.M)
        self.pnlAPP_InnerEdge.Caption = "Inner Edge"
        self.pnlAPP_InnerEdge.Button = None
        self.gbApproach.Add = self.pnlAPP_InnerEdge

        self.pnlAPP_DistFromTHR = DistanceBoxPanel(self.gbApproach, DistanceUnits.M)
        self.pnlAPP_DistFromTHR.Caption = "Distance From Threshold"
        self.pnlAPP_DistFromTHR.Button = None
        self.gbApproach.Add = self.pnlAPP_DistFromTHR

        self.pnlAPP_Divergence = AngleGradientBoxPanel(self.gbApproach)
        self.pnlAPP_Divergence.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlAPP_Divergence.Caption = "Divergence (each side)"
        self.gbApproach.Add = self.pnlAPP_Divergence

        self.gbApproach1 = GroupBox(self.gbApproach)
        self.gbApproach1.Caption = "First Section"
        self.gbApproach.Add = self.gbApproach1

        self.pnlAPP_Length1 = DistanceBoxPanel(self.gbApproach1, DistanceUnits.M)
        self.pnlAPP_Length1.Caption = "Length"
        self.pnlAPP_Length1.Button = None
        self.gbApproach1.Add = self.pnlAPP_Length1

        self.pnlAPP_Slope1 = AngleGradientBoxPanel(self.gbApproach1)
        self.pnlAPP_Slope1.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlAPP_Slope1.Caption = "Slope"
        self.gbApproach1.Add = self.pnlAPP_Slope1

        self.gbApproach2 = GroupBox(self.gbApproach)
        self.gbApproach2.Caption = "Second Section"
        self.gbApproach.Add = self.gbApproach2

        self.pnlAPP_Length2 = DistanceBoxPanel(self.gbApproach2, DistanceUnits.M)
        self.pnlAPP_Length2.Caption = "Length"
        self.pnlAPP_Length2.Button = None
        self.gbApproach2.Add = self.pnlAPP_Length2

        self.pnlAPP_Slope2 = AngleGradientBoxPanel(self.gbApproach2)
        self.pnlAPP_Slope2.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlAPP_Slope2.Caption = "Slope"
        self.gbApproach2.Add = self.pnlAPP_Slope2

        self.gbApproach3 = GroupBox(self.gbApproach)
        self.gbApproach3.Caption = "Horizontal Section"
        self.gbApproach.Add = self.gbApproach3

        self.pnlAPP_Length3 = DistanceBoxPanel(self.gbApproach3, DistanceUnits.M)
        self.pnlAPP_Length3.Caption = "Length"
        self.pnlAPP_Length3.Button = None
        self.gbApproach3.Add = self.pnlAPP_Length3

        self.pnlAPP_TotalLength = DistanceBoxPanel(self.gbApproach3, DistanceUnits.M)
        self.pnlAPP_TotalLength.Caption = "Total Length"
        self.pnlAPP_TotalLength.Button = None
        self.gbApproach3.Add = self.pnlAPP_TotalLength

        self.gbBalkedLanding = GroupBox(self.panel)
        self.gbBalkedLanding.Caption = "Balked Landing"
        self.panel.Add = self.gbBalkedLanding

        self.pnlBL_InnerEdge = DistanceBoxPanel(self.gbBalkedLanding, DistanceUnits.M)
        self.pnlBL_InnerEdge.Caption = "Length of Inner Edge"
        self.pnlBL_InnerEdge.Button = None
        self.gbBalkedLanding.Add = self.pnlBL_InnerEdge

        self.pnlBL_DistFromTHR = Frame(self.gbBalkedLanding, "HL")
        self.gbBalkedLanding.Add = self.pnlBL_DistFromTHR

        self.cmbBL_DistFromTHR = ComboBoxPanel(self.pnlBL_DistFromTHR)
        self.cmbBL_DistFromTHR.CaptionUnits = "m"
        self.cmbBL_DistFromTHR.Caption = "Distance From Threshold"
        self.pnlBL_DistFromTHR.Add = self.cmbBL_DistFromTHR

        self.txtBL_DistFromTHR = DistanceBoxPanel(self.pnlBL_DistFromTHR, DistanceUnits.M)
        self.txtBL_DistFromTHR.LabelWidth = 0
        self.txtBL_DistFromTHR.Button = None
        self.pnlBL_DistFromTHR.Add = self.txtBL_DistFromTHR

        self.pnlBL_Divergence = AngleGradientBoxPanel(self.gbBalkedLanding)
        self.pnlBL_Divergence.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlBL_Divergence.Caption = "Divergence (each side)"
        self.gbBalkedLanding.Add = self.pnlBL_Divergence

        self.pnlBL_Slope = AngleGradientBoxPanel(self.gbBalkedLanding)
        self.pnlBL_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlBL_Slope.Caption = "Slope"
        self.gbBalkedLanding.Add = self.pnlBL_Slope

        self.gbConical = GroupBox(self.panel)
        self.gbConical.Caption = "Conical"
        self.panel.Add = self.gbConical

        self.pnlCON_Slope = AngleGradientBoxPanel(self.gbConical)
        self.pnlCON_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlCON_Slope.Caption = "Slope"
        self.gbConical.Add = self.pnlCON_Slope

        self.pnlCON_Height = AltitudeBoxPanel(self.gbConical)
        self.pnlCON_Height.CaptionUnits = "m"
        self.pnlCON_Height.Caption = "Height"
        self.gbConical.Add = self.pnlCON_Height

        self.gbInnerApproach = GroupBox(self.panel)
        self.gbInnerApproach.Caption = "Inner Approach"
        self.panel.Add = self.gbInnerApproach

        self.pnlIA_Width = DistanceBoxPanel(self.gbInnerApproach, DistanceUnits.M)
        self.pnlIA_Width.Caption = "Width"
        self.pnlIA_Width.Button = None
        self.gbInnerApproach.Add = self.pnlIA_Width

        self.pnlIA_DistFromTHR = DistanceBoxPanel(self.gbInnerApproach, DistanceUnits.M)
        self.pnlIA_DistFromTHR.Caption = "Distance From Threshold"
        self.pnlIA_DistFromTHR.Button = None
        self.gbInnerApproach.Add = self.pnlIA_DistFromTHR

        self.pnlIA_Length = DistanceBoxPanel(self.gbInnerApproach, DistanceUnits.M)
        self.pnlIA_Length.Caption = "Length"
        self.pnlIA_Length.Button = None
        self.gbInnerApproach.Add = self.pnlIA_Length

        self.pnlIA_Slope = AngleGradientBoxPanel(self.gbInnerApproach)
        self.pnlIA_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlIA_Slope.Caption = "Slope"
        self.gbInnerApproach.Add = self.pnlIA_Slope

        self.gbInnerHorizontal = GroupBox(self.panel)
        self.gbInnerHorizontal.Caption = "Inner Horizontal"
        self.panel.Add = self.gbInnerHorizontal

        self.pnlIH_Location = ComboBoxPanel(self.gbInnerHorizontal)
        self.pnlIH_Location.Caption = "Location"
        self.gbInnerHorizontal.Add = self.pnlIH_Location

        self.pnlIH_Height = AltitudeBoxPanel(self.gbInnerHorizontal)
        self.pnlIH_Height.CaptionUnits = "m"
        self.pnlIH_Height.Caption = "Height"
        self.gbInnerHorizontal.Add = self.pnlIH_Height

        self.pnlIH_Radius = DistanceBoxPanel(self.gbInnerHorizontal, DistanceUnits.M)
        self.pnlIH_Radius.Caption = "Radius"
        self.pnlIH_Radius.Button = None
        self.gbInnerHorizontal.Add = self.pnlIH_Radius

        self.gbInnerTransitional = GroupBox(self.panel)
        self.gbInnerTransitional.Caption = "Inner Transitional"
        self.panel.Add = self.gbInnerTransitional

        self.pnlIT_Slope = AngleGradientBoxPanel(self.gbInnerTransitional)
        self.pnlIT_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlIT_Slope.Caption = "Slope"
        self.gbInnerTransitional.Add = self.pnlIT_Slope

        self.gbNavAid = GroupBox(self.panel)
        self.gbNavAid.Caption = "1:10 Navigational Aid"
        self.panel.Add = self.gbNavAid

        self.pnlNA_Slope = AngleGradientBoxPanel(self.gbNavAid)
        self.pnlNA_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlNA_Slope.Caption = "Slope"
        self.gbNavAid.Add = self.pnlNA_Slope

        self.gbOuterHorizontal = GroupBox(self.panel)
        self.gbOuterHorizontal.Caption = "Outer Horizontal"
        self.panel.Add = self.gbOuterHorizontal

        self.pnlOH_Height = AltitudeBoxPanel(self.gbOuterHorizontal)
        self.pnlOH_Height.CaptionUnits = "m"
        self.pnlOH_Height.Caption = "Height"
        self.gbOuterHorizontal.Add = self.pnlOH_Height

        self.pnlOH_Radius = DistanceBoxPanel(self.gbOuterHorizontal, DistanceUnits.M)
        self.pnlOH_Radius.Caption = "Radius"
        self.pnlOH_Radius.Button = None
        self.gbOuterHorizontal.Add = self.pnlOH_Radius

        self.gbStrip = GroupBox(self.panel)
        self.gbStrip.Caption = "Strip"
        self.panel.Add = self.gbStrip

        self.pnlS_Width = DistanceBoxPanel(self.gbStrip, DistanceUnits.M)
        self.pnlS_Width.Caption = "Width"
        self.pnlS_Width.Button = None
        self.gbStrip.Add = self.pnlS_Width

        self.pnlS_Length = DistanceBoxPanel(self.gbStrip, DistanceUnits.M)
        self.pnlS_Length.Caption = "Length"
        self.pnlS_Length.Button = None
        self.gbStrip.Add = self.pnlS_Length

        self.gbTakeOff = GroupBox(self.panel)
        self.gbTakeOff.Caption = "Take-off "
        self.panel.Add = self.gbTakeOff

        self.pnlTO_InnerEdge = DistanceBoxPanel(self.gbTakeOff, DistanceUnits.M)
        self.pnlTO_InnerEdge.Caption = "Length of Inner Edge"
        self.pnlTO_InnerEdge.Button = None
        self.gbTakeOff.Add = self.pnlTO_InnerEdge

        self.pnlTO_DistFromEND = Frame(self.gbTakeOff, "HL")
        self.gbTakeOff.Add = self.pnlTO_DistFromEND

        self.cmbTO_DistFromEND = ComboBoxPanel(self.pnlTO_DistFromEND)
        self.cmbTO_DistFromEND.CaptionUnits = "m"
        self.cmbTO_DistFromEND.Caption = "Distance From Runway End"
        self.pnlTO_DistFromEND.Add = self.cmbTO_DistFromEND

        self.txtTO_DistFromEND = DistanceBoxPanel(self.pnlTO_DistFromEND, DistanceUnits.M)
        self.txtTO_DistFromEND.LabelWidth = 0
        self.txtTO_DistFromEND.Button = None
        self.pnlTO_DistFromEND.Add = self.txtTO_DistFromEND

        self.pnlTO_Divergence = AngleGradientBoxPanel(self.gbTakeOff)
        self.pnlTO_Divergence.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlTO_Divergence.Caption = "Divergence (each side)"
        self.gbTakeOff.Add = self.pnlTO_Divergence

        self.pnlTO_FinalWidth = DistanceBoxPanel(self.gbTakeOff, DistanceUnits.M)
        self.pnlTO_FinalWidth.Caption = "Final Width"
        self.pnlTO_FinalWidth.Button = None
        self.gbTakeOff.Add = self.pnlTO_FinalWidth

        self.pnlTO_Length = DistanceBoxPanel(self.gbTakeOff, DistanceUnits.M)
        self.pnlTO_Length.Caption = "Length"
        self.pnlTO_Length.Button = None
        self.gbTakeOff.Add = self.pnlTO_Length

        self.pnlTO_Slope = AngleGradientBoxPanel(self.gbTakeOff)
        self.pnlTO_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlTO_Slope.Caption = "Slope"
        self.gbTakeOff.Add = self.pnlTO_Slope

        self.gbTransitional = GroupBox(self.panel)
        self.gbTransitional.Caption = "Transitional"
        self.panel.Add = self.gbTransitional

        self.pnlT_Slope = AngleGradientBoxPanel(self.gbTransitional)
        self.pnlT_Slope.CaptionUnits = AngleGradientSlopeUnits.Percent
        self.pnlT_Slope.Caption = "Slope"
        self.gbTransitional.Add = self.pnlT_Slope

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)

        self.btnSave = self.btnBoxOkCancel.button(QDialogButtonBox.Ok)
        self.btnSave.setText("Save")

        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        vLayoutScrollArea.addWidget(self.btnBoxOkCancel)

        self.cmbBL_DistFromTHR.Items = AerodromeSurfacesBalkedLandingFrom.Items
        self.pnlIH_Location.Items = AerodromeSurfacesInnerHorizontalLocation.Items
        self.cmbTO_DistFromEND.Items = AerodromeSurfacesTakeOffFrom.Items


        self.connect(self.pnlT_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlTO_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlTO_Length, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlTO_FinalWidth, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlTO_Divergence, SIGNAL("Event_0"), self.method_6)
        self.connect(self.txtTO_DistFromEND, SIGNAL("Event_0"), self.method_6)
        self.connect(self.cmbTO_DistFromEND, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlTO_InnerEdge, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlS_Length, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlS_Width, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlOH_Radius, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlOH_Height, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlNA_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIT_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIH_Radius, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIH_Height, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIH_Location, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIA_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIA_Length, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIA_DistFromTHR, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlIA_Width, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlCON_Height, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlCON_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlBL_Slope, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlBL_Divergence, SIGNAL("Event_0"), self.method_6)

        self.connect(self.txtBL_DistFromTHR, SIGNAL("Event_0"), self.method_6)
        self.connect(self.cmbBL_DistFromTHR, SIGNAL("Event_0"), self.cmbBL_DistFromTHR_currentIndexChanged)
        self.connect(self.pnlBL_InnerEdge, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_TotalLength, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Length3, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Slope2, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Length2, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Slope1, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Length1, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_Divergence, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_DistFromTHR, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlAPP_InnerEdge, SIGNAL("Event_0"), self.method_6)
        self.connect(self.pnlName, SIGNAL("Event_0"), self.method_6)

        self.modified = False
        self.criteria = None
Esempio n. 9
0
    def __init__(self, parent):
        super(InfoDialog, self).__init__(parent)
        self.setWindowModality(Qt.WindowModal)

        layout = QVBoxLayout()
        layout.setSpacing(10)
        self.setLayout(layout)

        self.tab = QTabWidget()
        tab_general = QWidget()
        tab_toolcommands = QWidget()
        self.tab.addTab(tab_general, "")
        self.tab.addTab(tab_toolcommands, "")

        # general tab
        vbox = QVBoxLayout()
        vbox.setSpacing(4)
        tab_general.setLayout(vbox)

        hbox = QHBoxLayout()
        self.lilyname = QLineEdit()
        self.lilynameLabel = l = QLabel()
        l.setBuddy(self.lilyname)
        hbox.addWidget(l)
        hbox.addWidget(self.lilyname)
        vbox.addLayout(hbox)

        self.lilypond = widgets.urlrequester.UrlRequester()
        self.lilypond.setFileMode(QFileDialog.ExistingFile)
        self.lilypondLabel = l = QLabel()
        l.setBuddy(self.lilypond)
        vbox.addWidget(l)
        vbox.addWidget(self.lilypond)

        self.auto = QCheckBox()
        vbox.addWidget(self.auto)
        vbox.addStretch(1)

        # toolcommands tab
        grid = QGridLayout()
        grid.setSpacing(4)
        tab_toolcommands.setLayout(grid)

        self.ly_tool_widgets = {}
        row = 0
        for name, gui in self.toolnames():
            w = QLineEdit()
            l = QLabel()
            l.setBuddy(w)
            grid.addWidget(l, row, 0)
            grid.addWidget(w, row, 1)
            row += 1
            self.ly_tool_widgets[name] = (l, w)

        layout.addWidget(self.tab)
        layout.addWidget(widgets.Separator())
        b = self.buttons = QDialogButtonBox(self)
        layout.addWidget(b)

        b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        b.accepted.connect(self.accept)
        b.rejected.connect(self.reject)
        userguide.addButton(b, "prefs_lilypond")
        app.translateUI(self)
        qutil.saveDialogSize(self,
                             "/preferences/lilypond/lilypondinfo/dialog/size")
Esempio n. 10
0
    def registerEvent(self):
        selection = self.ui.modulesList.selectedItems()
        if not selection:
            return

        try:
            module = self.weboob.modules_loader.get_or_load_module(unicode(selection[0].text()).lower())
        except ModuleLoadError:
            module = None

        if not module:
            return

        dialog = QDialog(self)
        vbox = QVBoxLayout(dialog)
        if module.website:
            website = 'on the website <b>%s</b>' % module.website
        else:
            website = 'with the module <b>%s</b>' % module.name
        vbox.addWidget(QLabel('To create an account %s, please provide this information:' % website))
        formlayout = QFormLayout()
        props_widgets = OrderedDict()
        for key, prop in module.klass.ACCOUNT_REGISTER_PROPERTIES.iteritems():
            widget = QtValue(prop)
            formlayout.addRow(QLabel(u'%s:' % prop.label), widget)
            props_widgets[prop.id] = widget

        vbox.addLayout(formlayout)
        buttonBox = QDialogButtonBox(dialog)
        buttonBox.setStandardButtons(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(dialog.accept)
        buttonBox.rejected.connect(dialog.reject)
        vbox.addWidget(buttonBox)

        end = False
        while not end:
            end = True
            if dialog.exec_():
                account = Account()
                account.properties = {}
                for key, widget in props_widgets.iteritems():
                    try:
                        v = widget.get_value()
                    except ValueError as e:
                        QMessageBox.critical(self, self.tr('Invalid value'),
                            unicode(self.tr('Invalid value for field "%s":<br /><br />%s')) % (key, e))
                        end = False
                        break
                    else:
                        account.properties[key] = v
                if end:
                    try:
                        module.klass.register_account(account)
                    except AccountRegisterError as e:
                        QMessageBox.critical(self, self.tr('Error during register'),
                            unicode(self.tr('Unable to register account %s:<br /><br />%s')) % (website, e))
                        end = False
                    else:
                        for key, value in account.properties.iteritems():
                            if key in self.config_widgets:
                                self.config_widgets[key][1].set_value(value)
Esempio n. 11
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        self.resize(290, 136)
        self.setWindowTitle("Runway Setup")
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        verticalLayoutDlg = QVBoxLayout(self)
        verticalLayoutDlg.setObjectName(("verticalLayoutDlg"))

        self.basicFrame = Frame(self)
        verticalLayoutDlg.addWidget(self.basicFrame)

        self.groupBox = GroupBox(self.basicFrame)
        self.basicFrame.Add = self.groupBox

        self.pnlName = TextBoxPanel(self.groupBox)
        self.pnlName.Caption = "Name"
        self.pnlName.LabelWidth = 70
        self.groupBox.Add = self.pnlName

        self.pnlDesignatorFrame = Frame(self.groupBox, "HL")
        self.groupBox.Add = self.pnlDesignatorFrame

        self.pnlDesignator = TextBoxPanel(self.groupBox)
        self.pnlDesignator.Caption = "Designator"
        self.pnlDesignator.LabelWidth = 70
        self.pnlDesignator.Button = "Calculator.bmp"
        self.pnlDesignatorFrame.Add = self.pnlDesignator

        self.cmbDesignator = ComboBoxPanel(self.groupBox)
        self.cmbDesignator.Caption = ""
        self.cmbDesignator.LabelWidth = 0
        self.cmbDesignator.Items = ["", "L", "C", "R"]
        self.pnlDesignatorFrame.Add = self.cmbDesignator

        self.gbPositions = GroupBox(self.groupBox)
        self.gbPositions.Caption = "Positions"
        self.groupBox.Add = self.gbPositions

        self.pnlPosition = PositionPanel(self.gbPositions)
        # self.pnlPosition.hideframe_Altitude()
        self.pnlPosition.btnCalculater.setVisible(False)
        self.gbPositions.Add = self.pnlPosition

        self.pnlTree = Frame(self.gbPositions)
        self.gbPositions.Add = self.pnlTree

        self.trvPositions = TreeView(self.pnlTree)
        self.pnlTree.Add = self.trvPositions

        self.pnlButtons = Frame(self.pnlTree, "HL")
        self.pnlTree.Add = self.pnlButtons

        self.btnPrevious = QPushButton(self.pnlButtons)
        self.btnPrevious.setObjectName("btnPrevious")
        self.btnPrevious.setText("")
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/Prev_32x32.png"),
                       QIcon.Normal, QIcon.Off)
        self.btnPrevious.setIcon(icon)
        self.pnlButtons.Add = self.btnPrevious

        self.btnInsert = QPushButton(self.pnlButtons)
        self.btnInsert.setObjectName("btnInsert")
        self.btnInsert.setText("")
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/add.png"), QIcon.Normal, QIcon.Off)
        self.btnInsert.setIcon(icon)
        self.pnlButtons.Add = self.btnInsert

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

        self.btnNext = QPushButton(self.pnlButtons)
        self.btnNext.setObjectName("btnNext")
        self.btnNext.setText("")
        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/Next_32x32.png"),
                       QIcon.Normal, QIcon.Off)
        self.btnNext.setIcon(icon)
        self.pnlButtons.Add = self.btnNext

        self.pnlSafetyAreaWidth = DistanceBoxPanel(self.groupBox,
                                                   DistanceUnits.M)
        self.pnlSafetyAreaWidth.Caption = "Safety Area Width"
        self.pnlSafetyAreaWidth.LabelWidth = 250
        self.groupBox.Add = self.pnlSafetyAreaWidth

        self.pnlSafetyAreaStart = DistanceBoxPanel(self.groupBox,
                                                   DistanceUnits.M)
        self.pnlSafetyAreaStart.Caption = "Safety Area Length [START -> boundary]"
        self.pnlSafetyAreaStart.LabelWidth = 250
        self.groupBox.Add = self.pnlSafetyAreaStart

        self.pnlSafetyAreaEnd = DistanceBoxPanel(self.groupBox,
                                                 DistanceUnits.M)
        self.pnlSafetyAreaEnd.Caption = "Safety Area Length [END -> boundary]"
        self.pnlSafetyAreaEnd.LabelWidth = 250
        self.groupBox.Add = self.pnlSafetyAreaEnd

        self.btnBoxOkCancel = QDialogButtonBox(self)
        self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel"))
        self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel
                                               | QDialogButtonBox.Ok)

        self.btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok)

        self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg)
        self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.btnOK.setText("Save")
        self.connect(self.pnlDesignator, SIGNAL("Event_1"), self.method_15)

        self.connect(self.pnlPosition, SIGNAL("captureFinished"),
                     self.method_14)
        self.btnInsert.clicked.connect(self.btnInsert_Click)
        self.btnNext.clicked.connect(self.btnNext_Click)
        self.btnPrevious.clicked.connect(self.btnPrevious_Click)
        self.btnRemove.clicked.connect(self.btnRemove_Click)

        self.trvPositions.clicked.connect(self.trvPositions_clicked)
Esempio n. 12
0
    def __createLayout(self):
        " Creates the dialog layout "
        self.resize(640, 480)
        self.setSizeGripEnabled(True)

        layout = QVBoxLayout()

        # Plugins list
        self.__pluginsView = QTreeWidget()
        self.__pluginsView.setAlternatingRowColors(True)
        self.__pluginsView.setRootIsDecorated(False)
        self.__pluginsView.setItemsExpandable(False)
        self.__pluginsView.setSortingEnabled(True)
        self.__pluginsView.setItemDelegate(NoOutlineHeightDelegate(4))
        self.__pluginsView.setUniformRowHeights(True)

        # Alert | system/user | Enable | Name | Version
        self.__pluginsHeader = QTreeWidgetItem(
            ["", "", "", "Name", "Version", ""])
        self.__pluginsView.setHeaderItem(self.__pluginsHeader)
        self.__pluginsView.header().setSortIndicator(NAME_COL,
                                                     Qt.AscendingOrder)
        self.connect(self.__pluginsView, SIGNAL("itemSelectionChanged()"),
                     self.__pluginSelectionChanged)
        self.connect(self.__pluginsView,
                     SIGNAL("itemChanged(QTreeWidgetItem*,int)"),
                     self.__onItemChanged)

        layout.addWidget(self.__pluginsView)

        # Detailed information
        detailsLabel = QLabel("Detailed information")
        layout.addWidget(detailsLabel)
        self.__details = QTreeWidget()
        self.__details.setAlternatingRowColors(False)
        self.__details.setRootIsDecorated(False)
        self.__details.setItemsExpandable(False)
        self.__details.setSortingEnabled(False)
        self.__details.setItemDelegate(NoOutlineHeightDelegate(4))
        self.__details.setUniformRowHeights(True)

        detailsHeader = QTreeWidgetItem(["", ""])
        self.__details.setHeaderItem(detailsHeader)
        self.__details.setHeaderHidden(True)

        metrics = QFontMetrics(self.__details.font())
        rect = metrics.boundingRect("X")
        self.__details.setFixedHeight(rect.height() * 6 + 5)
        layout.addWidget(self.__details)

        # Errors/warnings
        errorsLabel = QLabel("Errors / warnings")
        layout.addWidget(errorsLabel)
        self.__errorsText = QTextEdit()
        self.__errorsText.setReadOnly(True)
        self.__errorsText.setAcceptRichText(False)
        metrics = QFontMetrics(self.__errorsText.font())
        rect = metrics.boundingRect("X")
        self.__errorsText.setFixedHeight(rect.height() * 4 + 5)
        layout.addWidget(self.__errorsText)

        # Buttons box
        buttonBox = QDialogButtonBox(self)
        buttonBox.setOrientation(Qt.Horizontal)
        buttonBox.setStandardButtons(QDialogButtonBox.Ok)
        self.__OKButton = buttonBox.button(QDialogButtonBox.Ok)
        self.__OKButton.setDefault(True)
        self.connect(buttonBox, SIGNAL("accepted()"), self.close)
        self.connect(buttonBox, SIGNAL("rejected()"), self.close)
        layout.addWidget(buttonBox)

        self.setLayout(layout)
        return
Esempio n. 13
0
    def __createLayout(self, action, title, files):
        """ Creates the dialog layout """

        self.resize(400, 300)
        self.setSizeGripEnabled(True)

        # Top level layout
        layout = QVBoxLayout(self)

        # Pixmap and the message
        topLayout = QHBoxLayout()
        pixmap = QLabel()
        pixmap.setPixmap(PixmapCache().getPixmap('warning.png'))
        topLayout.addWidget(pixmap)
        hSpacer = QWidget()
        hSpacer.setFixedSize(15, 15)
        topLayout.addWidget(hSpacer)
        message = QLabel( "All the project files must be " \
                          "saved before start debugging" )
        message.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        message.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        message.setWordWrap(True)
        topLayout.addWidget(message)
        layout.addLayout(topLayout)

        vSpacer = QWidget()
        vSpacer.setFixedSize(15, 15)
        layout.addWidget(vSpacer)

        layout.addWidget(QLabel(title + ":"))
        filesList = QTreeWidget()
        filesList.setRootIsDecorated(False)
        filesList.setAlternatingRowColors(True)
        filesList.setUniformRowHeights(True)
        filesList.setItemsExpandable(False)
        filesList.setItemDelegate(NoOutlineHeightDelegate(4))
        filesList.setSelectionMode(QAbstractItemView.NoSelection)
        filesList.setHeaderHidden(True)
        for item in files:
            fileName = item[0]
            fileItem = QTreeWidgetItem([fileName])
            fileType = detectFileType(fileName)
            fileItem.setIcon(0, getFileIcon(fileType))
            if fileType in [PythonFileType, Python3FileType]:
                infoSrc = GlobalData().briefModinfoCache
                info = infoSrc.get(fileName)
                if info.docstring is not None:
                    fileItem.setToolTip(0, info.docstring.text)
                else:
                    fileItem.setToolTip(0, "")
            filesList.addTopLevelItem(fileItem)
        layout.addWidget(filesList)

        # Buttons at the bottom
        buttonBox = QDialogButtonBox()
        buttonBox.setOrientation(Qt.Horizontal)
        buttonBox.setStandardButtons(QDialogButtonBox.Cancel)
        continueButton = buttonBox.addButton(action,
                                             QDialogButtonBox.ActionRole)
        continueButton.setDefault(True)
        layout.addWidget(buttonBox)

        continueButton.clicked.connect(self.accept)
        buttonBox.rejected.connect(self.close)
        continueButton.setFocus()
        return
Esempio n. 14
0
    def __init__(self, widget, name, text=""):
        super(Edit, self).__init__(widget)

        self._name = name

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.topLabel = QLabel()
        self.text = QTextEdit(cursorWidth=2, acceptRichText=False)
        self.titleLabel = QLabel()
        self.titleEntry = QLineEdit()
        self.shortcutLabel = QLabel()
        self.shortcutButton = ShortcutButton(clicked=self.editShortcuts)

        layout.addWidget(self.topLabel)
        layout.addWidget(self.text)

        grid = QGridLayout()
        layout.addLayout(grid)

        grid.addWidget(self.titleLabel, 0, 0)
        grid.addWidget(self.titleEntry, 0, 1)
        grid.addWidget(self.shortcutLabel, 1, 0)
        grid.addWidget(self.shortcutButton, 1, 1)

        layout.addWidget(widgets.Separator())

        b = QDialogButtonBox(accepted=self.accept, rejected=self.reject)
        layout.addWidget(b)

        buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
        if name and name in builtin.builtin_snippets:
            b.setStandardButtons(buttons | QDialogButtonBox.RestoreDefaults)
            b.button(QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.slotDefaults)
        else:
            b.setStandardButtons(buttons)
        userguide.addButton(b, "snippet_editor")

        # PyQt4.10 en sip4.14.5 delete the Highlighter, even though it is
        # constructed with a parent, that's why we save it in an unused attribute.
        self._highlighter = highlight.Highlighter(self.text.document())
        Matcher(self.text)
        widgets.indenter.Indenter(self.text)
        self.text.installEventFilter(homekey.handler)
        wordboundary.handler.install_textedit(self.text)
        completer.Completer(self.text)

        if name:
            self.titleEntry.setText(snippets.title(name, False) or '')
            self.text.setPlainText(snippets.text(name))
            ac = self.parent().parent().snippetActions
            self.setShortcuts(ac.shortcuts(name))
        else:
            self.text.setPlainText(text)
            self.setShortcuts(None)

        app.translateUI(self)

        self.readSettings()
        app.settingsChanged.connect(self.readSettings)
        qutil.saveDialogSize(self, "snippettool/editor/size", QSize(400, 300))
        self.show()
Esempio n. 15
0
    def __init__(self, parent = None):
        QDialog.__init__(self, parent)
        
        self.resize(290, 136);
        self.setWindowTitle("Standard Instrument Departure (SID)")
        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.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.data = None
        self.table = None
        self.selected = None;
Esempio n. 16
0
    def __init__(self, parent = None):
        super(CalibrationWidget, self).__init__(parent)

        self.aggregate_calculated = False

        self.calibraton = None


        ## Create geometry
        self.setWindowTitle(_("Calibration"))
        self.setObjectName(_("Calibration"))

        # Parameters widgets TODO: use _()
        up_spinbox      = MyDoubleSpinBox(self, 'Ratio maximal','','',min_=1, max_=100, step=1, value = CONF.get('calibration', 'up'), changed = self.set_param)
        invlo_spinbox   = MyDoubleSpinBox(self, 'Inverse du ratio minimal','','',min_=1, max_=100, step=1, value = CONF.get('calibration', 'invlo'), changed = self.set_param)
        method_choices  = [(u'Linéaire', 'linear'),(u'Raking ratio', 'raking ratio'), (u'Logit', 'logit')]
        method_combo     = MyComboBox(self, u'Choix de la méthode', method_choices)
        self.param_widgets = {'up': up_spinbox.spin, 'invlo': invlo_spinbox.spin, 'method': method_combo.box}

        # Total population widget
        self.ini_totalpop_label = QLabel("", parent = self)
        self.pop_checkbox = QCheckBox(u"Ajuster", self)
        self.pop_spinbox = MySpinBox(self, u" Cible :", "", option = None ,min_=15e6, max_=30e6, step=5e6, changed = self.set_totalpop)
        self.pop_spinbox.setDisabled(True)

        # Margins table view
        self.view = DataFrameViewWidget(self)

        # Add/Remove margin button

        save_btn = self.add_toolbar_btn(tooltip = u"Sauvegarder les paramètres et cales actuels",
                                        icon = "document-save.png")

        open_btn = self.add_toolbar_btn(tooltip = u"Ouvrir des paramètres",
                                        icon = "document-open.png")

        add_var_btn  = self.add_toolbar_btn(tooltip = u"Ajouter une variable de calage",
                                        icon = "list-add.png")

        rmv_var_btn = self.add_toolbar_btn(tooltip = u"Retirer une variable de calage",
                                        icon = "list-remove.png")

        rst_var_btn = self.add_toolbar_btn(tooltip = u"Retirer toutes les variables de calage",
                                        icon = "view-refresh.png")

        self.calibrate_btn = self.add_toolbar_btn(tooltip = u"Lancer le calage",
                                             icon = "calculator_red.png")
        self.calibrate_btn.setDisabled(True)

        toolbar_btns = [save_btn, open_btn, add_var_btn, rmv_var_btn, rst_var_btn, self.calibrate_btn]
        toolbar_lyt = QHBoxLayout()

        for btn in toolbar_btns:
            toolbar_lyt.addWidget(btn)
        # Build layouts
        calib_lyt = QHBoxLayout()
        calib_lyt.addLayout(toolbar_lyt)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

        for w in [spacerItem, up_spinbox, invlo_spinbox, method_combo]:
            if isinstance(w, QSpacerItem):
                calib_lyt.addItem(w)
            else:
                calib_lyt.addWidget(w)

        verticalLayout = QVBoxLayout(self)
        verticalLayout.addLayout(calib_lyt)

        totalpop_lyt = QHBoxLayout()
        for w in [self.ini_totalpop_label,
                  self.pop_checkbox, self.pop_spinbox]:
            totalpop_lyt.addWidget(w)
        verticalLayout.addLayout(totalpop_lyt)
        verticalLayout.addWidget(self.view)

        # weights ratio plot
        self.mplwidget = MatplotlibWidget(self)
        verticalLayout.addWidget(self.mplwidget)

        button_box = QDialogButtonBox(QDialogButtonBox.Cancel| QDialogButtonBox.Ok, parent = self)
        verticalLayout.addWidget(button_box)

        # Connect signals
        self.connect(method_combo.box, SIGNAL('currentIndexChanged(int)'), self.set_param)
        self.connect(self.pop_checkbox, SIGNAL('clicked()'), self.set_totalpop)
        self.connect(save_btn, SIGNAL('clicked()'), self.save_config)
        self.connect(open_btn, SIGNAL('clicked()'), self.load_config)
        self.connect(add_var_btn, SIGNAL('clicked()'), self.add_var)
        self.connect(rmv_var_btn, SIGNAL('clicked()'), self.rmv_var)
        self.connect(rst_var_btn, SIGNAL('clicked()'), self.rst_var)
        self.connect(self.calibrate_btn, SIGNAL('clicked()'), self.calibrate)
        self.connect(button_box, SIGNAL('accepted()'), self.accept);
        self.connect(button_box, SIGNAL('rejected()'), self.reject);

#        self.connect(self, SIGNAL('param_or_margins_changed()'), self)

        self.calibration = None
Esempio n. 17
0
    def branch(self):
        """create branch and import layers"""
        layer = QgsMapLayerRegistry.instance().mapLayer(self.current_layers[0])
        uri = QgsDataSourceURI(layer.source())
        mtch = re.match(r'(.+)_([^_]+)_rev_(head|\d+)', uri.schema())
        schema = mtch.group(1)
        base_branch = mtch.group(2)
        base_rev = mtch.group(3)
        assert (schema)
        dlg = QDialog()
        dlg.setWindowTitle('Enter branch name')
        layout = QVBoxLayout(dlg)
        button_box = QDialogButtonBox(dlg)
        button_box.setStandardButtons(QDialogButtonBox.Cancel
                                      | QDialogButtonBox.Ok)
        button_box.accepted.connect(dlg.accept)
        button_box.rejected.connect(dlg.reject)

        line_edit = QLineEdit(dlg)
        layout.addWidget(line_edit)
        layout.addWidget(button_box)
        if not dlg.exec_():
            return
        branch = line_edit.text()

        if not branch:
            print 'aborted'
            return

        pcur = versioning_base.Db(psycopg2.connect(self.pg_conn_info()))
        pcur.execute("SELECT * FROM " + schema + ".revisions "
                     "WHERE branch = '" + branch + "'")
        if pcur.fetchone():
            pcur.close()
            QMessageBox.warning(self.iface.mainWindow(), "Warning",
                                "Branch " + branch + ' already exists.')
            return
        pcur.close()

        # get the commit message
        if not self.q_commit_msg_dlg.exec_():
            return
        commit_msg = self.commit_msg_dlg.commitMessage.document().toPlainText()
        if not commit_msg:
            QMessageBox.warning(self.iface.mainWindow(), "Warning",
                                "No commit message, aborting commit")
            print "aborted"
            return
        versioning_base.add_branch(uri.connectionInfo(), schema, branch,
                                   commit_msg, base_branch, base_rev)
        grp_name = branch + ' revision head'
        grp_idx = self.iface.legendInterface().addGroup(grp_name)
        for layer_id in reversed(self.current_layers):
            layer = QgsMapLayerRegistry.instance().mapLayer(layer_id)
            new_uri = QgsDataSourceURI(layer.source())
            new_uri.setDataSource(schema + '_' + branch + '_rev_head',
                                  new_uri.table(), new_uri.geometryColumn(),
                                  new_uri.sql(), new_uri.keyColumn())
            display_name = QgsMapLayerRegistry.instance().mapLayer(
                layer_id).name()

            new_layer = self.iface.addVectorLayer(
                new_uri.uri().replace('()', ''), display_name, 'postgres')
            self.iface.legendInterface().moveLayer(new_layer, grp_idx)
Esempio n. 18
0
    def __createLayout(self, varName, varType, varValue, isGlobal):
        """ Creates the dialog layout """

        varTypeParts = varType.split()
        if varTypeParts[0].lower() in ["string", "unicode", "qstring"]:
            length = str(len(varValue))
            lines = str(len(varValue.splitlines()))
            varType = varType.split( "(" )[ 0 ].strip() + \
                      " (lines: " + lines + ", characters: " + length + ")"

        self.resize(600, 250)
        self.setSizeGripEnabled(True)

        # Top level layout
        layout = QVBoxLayout(self)

        gridLayout = QGridLayout()
        gridLayout.setSpacing(2)
        varScopeLabel = QLabel("Scope:")
        gridLayout.addWidget(varScopeLabel, 0, 0, Qt.AlignTop)
        if isGlobal:
            varScopeValue = FramedLabelWithDoubleClick("Global")
        else:
            varScopeValue = FramedLabelWithDoubleClick("Local")
        varScopeValue.setToolTip("Double click to copy")
        font = varScopeValue.font()
        font.setFamily(GlobalData().skin.baseMonoFontFace)
        varScopeValue.setFont(font)
        gridLayout.addWidget(varScopeValue, 0, 1)

        varNameLabel = QLabel("Name:")
        gridLayout.addWidget(varNameLabel, 1, 0, Qt.AlignTop)
        varNameValue = FramedLabelWithDoubleClick(varName)
        varNameValue.setToolTip("Double click to copy")
        varNameValue.setFont(font)
        gridLayout.addWidget(varNameValue, 1, 1)
        varTypeLabel = QLabel("Type:")
        gridLayout.addWidget(varTypeLabel, 2, 0, Qt.AlignTop)
        varTypeValue = FramedLabelWithDoubleClick(varType)
        varTypeValue.setToolTip("Double click to copy")
        varTypeValue.setFont(font)
        gridLayout.addWidget(varTypeValue, 2, 1)
        varValueLabel = QLabel("Value:")
        gridLayout.addWidget(varValueLabel, 3, 0, Qt.AlignTop)
        varValueValue = QTextEdit()
        varValueValue.setReadOnly(True)
        varValueValue.setFontFamily(GlobalData().skin.baseMonoFontFace)
        # varValueValue.setLineWrapMode( QTextEdit.NoWrap )
        varValueValue.setAcceptRichText(False)
        varValueValue.setPlainText(varValue)
        gridLayout.addWidget(varValueValue, 3, 1)
        layout.addLayout(gridLayout)

        # Buttons at the bottom
        buttonBox = QDialogButtonBox(self)
        buttonBox.setOrientation(Qt.Horizontal)
        buttonBox.setStandardButtons(QDialogButtonBox.Ok)
        self.__OKButton = buttonBox.button(QDialogButtonBox.Ok)
        self.__OKButton.setDefault(True)
        buttonBox.accepted.connect(self.close)
        buttonBox.rejected.connect(self.close)
        layout.addWidget(buttonBox)

        varValueValue.setFocus()
        return
Esempio n. 19
0
    def __init__(self, parent=None):
        super(ContactDlg, self).__init__(parent)

        forenameLabel = QLabel("&Forename:")
        self.forenameEdit = QLineEdit()
        forenameLabel.setBuddy(self.forenameEdit)
        surnameLabel = QLabel("&Surname:")
        self.surnameEdit = QLineEdit()
        surnameLabel.setBuddy(self.surnameEdit)
        categoryLabel = QLabel("&Category:")
        self.categoryComboBox = QComboBox()
        categoryLabel.setBuddy(self.categoryComboBox)
        self.categoryComboBox.addItems(["Business", "Domestic", "Personal"])
        companyLabel = QLabel("C&ompany:")
        self.companyEdit = QLineEdit()
        companyLabel.setBuddy(self.companyEdit)
        addressLabel = QLabel("A&ddress:")
        self.addressEdit = QLineEdit()
        addressLabel.setBuddy(self.addressEdit)
        phoneLabel = QLabel("&Phone:")
        self.phoneEdit = QLineEdit()
        phoneLabel.setBuddy(self.phoneEdit)
        mobileLabel = QLabel("&Mobile:")
        self.mobileEdit = QLineEdit()
        mobileLabel.setBuddy(self.mobileEdit)
        faxLabel = QLabel("Fa&x:")
        self.faxEdit = QLineEdit()
        faxLabel.setBuddy(self.faxEdit)
        emailLabel = QLabel("&Email:")
        self.emailEdit = QLineEdit()
        emailLabel.setBuddy(self.emailEdit)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        addButton = self.buttonBox.button(QDialogButtonBox.Ok)
        addButton.setText("&Add")
        addButton.setEnabled(False)

        grid = QGridLayout()
        grid.addWidget(forenameLabel, 0, 0)
        grid.addWidget(self.forenameEdit, 0, 1)
        grid.addWidget(surnameLabel, 0, 2)
        grid.addWidget(self.surnameEdit, 0, 3)
        grid.addWidget(categoryLabel, 1, 0)
        grid.addWidget(self.categoryComboBox, 1, 1)
        grid.addWidget(companyLabel, 1, 2)
        grid.addWidget(self.companyEdit, 1, 3)
        grid.addWidget(addressLabel, 2, 0)
        grid.addWidget(self.addressEdit, 2, 1, 1, 3)
        grid.addWidget(phoneLabel, 3, 0)
        grid.addWidget(self.phoneEdit, 3, 1)
        grid.addWidget(mobileLabel, 3, 2)
        grid.addWidget(self.mobileEdit, 3, 3)
        grid.addWidget(faxLabel, 4, 0)
        grid.addWidget(self.faxEdit, 4, 1)
        grid.addWidget(emailLabel, 4, 2)
        grid.addWidget(self.emailEdit, 4, 3)
        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(self.buttonBox)
        self.setLayout(layout)

        self.lineedits = (self.forenameEdit, self.surnameEdit,
                          self.companyEdit, self.phoneEdit, self.emailEdit)
        for lineEdit in self.lineedits:
            lineEdit.setProperty("mandatory", QVariant(True))
            self.connect(lineEdit, SIGNAL("textEdited(QString)"),
                         self.updateUi)
        self.connect(self.categoryComboBox, SIGNAL("activated(int)"),
                     self.updateUi)

        self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept)
        self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject)

        self.setStyleSheet(ContactDlg.StyleSheet)
        self.setWindowTitle("Add Contact")
Esempio n. 20
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.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()
Esempio n. 21
0
    def __init__(self, scenario, parent=None):
        super(InfoComp, self).__init__(parent)

        self.resize(300, 223)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)
        self.setWindowTitle(u"Informations complémentaires")
        icon = get_icon(":/images/people.png")
        self.setWindowIcon(icon)
        self.verticalLayout = QVBoxLayout(self)
        self.gridLayout = QGridLayout()
        self.gridLayout.setHorizontalSpacing(10)
        self.setStyleSheet(OfSs.bold_center)

        self.label_0 = QLabel(u'n°', self)
        self.gridLayout.addWidget(self.label_0, 0, 0, 1, 1)

        self.label_1 = QLabel(u'Activité', self)
        self.gridLayout.addWidget(self.label_1, 0, 1, 1, 1)

        self.label_2 = QLabel(u"Invalide", self)
        self.gridLayout.addWidget(self.label_2, 0, 2, 1, 1)

        self.label_3 = QLabel(u'Garde\nalternée', self)
        self.gridLayout.addWidget(self.label_3, 0, 3, 1, 1)

        self.gridLayout.setColumnStretch(1, 1)
        self.gridLayout.setColumnStretch(2, 1)
        self.gridLayout.setColumnStretch(3, 1)
        self.verticalLayout.addLayout(self.gridLayout)

        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok,
                                          parent=self)
        self.verticalLayout.addWidget(self.buttonBox)

        self.connect(self.buttonBox, SIGNAL('accepted()'), self.accept)
        self.connect(self.buttonBox, SIGNAL('rejected()'), self.reject)

        self.parent = parent
        self.scenario = scenario
        self.inv_list = []
        self.alt_list = []
        self.act_list = []
        for noi, vals in self.scenario.indiv.iteritems():
            self.gridLayout.addWidget(QLabel('%d' % (noi + 1), self), noi + 1,
                                      0)

            # Acitivité
            cb_act = QComboBox(self)
            cb_act.addItems([
                u'Actif occupé', u'Chômeur', u'Étudiant, élève', u'Retraité',
                u'Autre inactif'
            ])
            cb_act.setCurrentIndex(vals['activite'])
            self.act_list.append(cb_act)
            self.gridLayout.addWidget(cb_act, noi + 1, 1)

            # Invalide
            cb_inv = QCheckBox(self)
            cb_inv.setChecked(vals['inv'])
            layout1 = QHBoxLayout()
            layout1.addItem(
                QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum))
            layout1.addWidget(cb_inv)
            layout1.addItem(
                QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum))
            self.inv_list.append(cb_inv)
            self.gridLayout.addLayout(layout1, noi + 1, 2)

            # Garde alternée
            cb_alt = QCheckBox(self)
            if vals['quifoy'][:3] != 'pac':
                vals['alt'] = 0
                cb_alt.setEnabled(False)
            cb_alt.setChecked(vals['alt'])
            layout2 = QHBoxLayout()
            layout2.addItem(
                QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum))
            layout2.addWidget(cb_alt)
            layout2.addItem(
                QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum))
            self.alt_list.append(cb_alt)
            self.gridLayout.addLayout(layout2, noi + 1, 3)
Esempio n. 22
0
    def initUI(self):
        u"""Build the dialog box."""
        language_help = _(u'''<h4>Language code.</h4>
<p>This will be transmitted as part of the requst sent to the
sites. As some sites only support one language, this is also used to
decide where to send the requests. Use a standard language code
here. Using invalid values or codes of unsupported languages will
result in no downloads. Do <em>not</em> use domain codes (E.g. use
<code>zh</code> rather than <code>cn</code> for Chinese.)</p>''')
        self.setWindowTitle(_(u'Anki – Download audio'))
        self.setWindowIcon(QIcon(":/icons/anki.png"))
        layout = QVBoxLayout()
        self.setLayout(layout)
        edit_text_head = QLabel()
        kanji_et = _('''\
<h4>Requests to send to the download sites</h4>
<p>In the split edit fields, set the kanji on the left, the
kana on the right.</p>
''')
        base_et = _('''\
<h4>Requests to send to the download sites</h4>
<p>In split edit fields, set the expression (base) on the left, the
reading (ruby) on the right.</p>
''')
        single_et = _('''\
<h4>Requests to send to the download sites</h4>
''')
        # Now decide which help text to show.
        # First, decide if we have any split fields. (Don't care about
        # performance. This may not be the quickest way).
        if [itm for itm in self.data_fields if itm[5]]:
            # Yes, the list of all items with split fields is not empty.
            # A bit C-ish test. language_code may be None:
            if self.language_code and self.language_code.startswith('ja'):
                edit_text_head.setText(kanji_et)
            else:
                edit_text_head.setText(base_et)
        else:
            edit_text_head.setText(single_et)
        layout.addWidget(edit_text_head)
        self.create_data_rows(layout)
        line = QFrame(self)
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        layout.addWidget(line)
        lcode_head = QLabel(_('''<h4>Language code</h4>'''))
        layout.addWidget(lcode_head)
        lang_hlayout = QHBoxLayout()
        lc_label = QLabel(_(u'Language code:'), self)
        lang_hlayout.addWidget(lc_label)
        lc_label.setToolTip(language_help)
        self.language_code_lineedit = QLineEdit(self)
        try:
            self.language_code_lineedit.setText(self.language_code)
        except:
            self.language_code_lineedit.setText(default_audio_language_code)
        lang_hlayout.addWidget(self.language_code_lineedit)
        self.language_code_lineedit.setToolTip(language_help)
        layout.addLayout(lang_hlayout)
        dialog_buttons = QDialogButtonBox(self)
        dialog_buttons.addButton(QDialogButtonBox.Cancel)
        dialog_buttons.addButton(QDialogButtonBox.Ok)
        self.connect(dialog_buttons, SIGNAL("accepted()"), self,
                     SLOT("accept()"))
        self.connect(dialog_buttons, SIGNAL("rejected()"), self,
                     SLOT("reject()"))
        layout.addWidget(dialog_buttons)
Esempio n. 23
0
    def setupUI(self, mainData):
        ####
        #Creation of supporting layouts
        baseLayout = QVBoxLayout()

        ####
        #Select the base directory to look for calibration files
        calibDirGrpBox = QGroupBox("Calibration Directory:")
        self.calibDirTextBox = QLineEdit()
        self.calibDirTextBox.setText(mainData.calibDir)
        self.calibDirTextBox.textChanged.connect(self.calibDirPathChanged)
        self.browseCalibDirBtn = QPushButton("Browse...")
        self.browseCalibDirBtn.clicked.connect(self.calibDirBrowseBtnClick)
        calibDirLayout = QHBoxLayout()
        calibDirLayout.addWidget(self.calibDirTextBox)
        calibDirLayout.addWidget(self.browseCalibDirBtn)
        calibDirGrpBox.setLayout(calibDirLayout)
        baseLayout.addWidget(calibDirGrpBox)

        ####
        #Select specific calibration file names to use
        calibFileLayout = QGridLayout()
        calibFileGrpBox = QGroupBox("Calibration Files:")
        nrLabels = len(self.presenter.calibModel.calibFiles)
        self.calibFileLabels = {}
        self.calibFileTextBoxes = {}
        self.calibFileBrowseBtns = {}
        #        self.browseBtnRegister = {}

        colNr = 0
        rowNr = -1
        for i in range(nrLabels):
            uiElemName = self.presenter.calibModel.calibFiles.keys()[i]

            self.calibFileLabels[uiElemName] = QLabel("Calibration " +
                                                      uiElemName + ":")
            self.calibFileTextBoxes[uiElemName] = QLineEdit(
                self.presenter.calibModel.calibFiles[uiElemName])
            self.calibFileTextBoxes[uiElemName].textChanged.connect(
                self.calibFilePathChanged)

            self.calibFileBrowseBtns[uiElemName] = QPushButton("Browse...")
            self.calibFileBrowseBtns[uiElemName].clicked.connect(
                self.calibFileBrowseBtnClick)

            #Lay out UI elements in a 2 column format, with the label occupying 2x columns
            colNr = i % 2
            if (colNr == 0):
                rowNr += 1
            calibFileLayout.addWidget(self.calibFileLabels[uiElemName],
                                      (2 * rowNr), (2 * colNr), 1, 2)
            calibFileLayout.addWidget(self.calibFileTextBoxes[uiElemName],
                                      ((2 * rowNr) + 1), (2 * colNr))
            calibFileLayout.addWidget(self.calibFileBrowseBtns[uiElemName],
                                      ((2 * rowNr) + 1), (2 * colNr + 1))
        calibFileGrpBox.setLayout(calibFileLayout)
        baseLayout.addWidget(calibFileGrpBox)

        ####
        #Define temperature of bulb used for calibration
        bulbTLabel = QLabel("Bulb Temperature:")
        self.calibTempTextBox = QLineEdit()  #Populate from model
        self.calibTempTextBox.setFixedWidth(
            40)  #Same as integrationTextInputWidth in MainView
        self.calibTempTextBox.setText(str(mainData.bulbTemp))
        self.calibTempTextBox.textChanged.connect(self.bulbTempChanged)
        kTempLabel = QLabel("K")
        calibTempLayout = QHBoxLayout()
        calibTempLayout.addWidget(bulbTLabel)
        calibTempLayout.addWidget(self.calibTempTextBox)
        calibTempLayout.addWidget(kTempLabel)
        calibTempLayout.addStretch(1)
        baseLayout.addLayout(calibTempLayout)

        ####
        #Buttons to accept/reject dialog
        okCancelBtnBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)
        okCancelBtnBox.accepted.connect(self.okClick)
        okCancelBtnBox.rejected.connect(self.cancelClick)
        baseLayout.addWidget(okCancelBtnBox)

        ####
        #Set the base layout
        self.setLayout(baseLayout)
Esempio n. 24
0
    def __init__(self, parent=None, conflictCallback=None, *cbArgs):
        """conflictCallback is a optional method called when a shortcut is changed.
        
        cbArgs is optional arguments of the conflictCallback method.
        it should return the name of the potential conflict or a null value """

        super(ShortcutEditDialog, self).__init__(parent)
        self.conflictCallback = conflictCallback
        self.cbArgs = cbArgs
        self.setMinimumWidth(400)
        # create gui

        layout = QVBoxLayout()
        layout.setSpacing(10)
        self.setLayout(layout)

        top = QHBoxLayout()
        top.setSpacing(4)
        p = self.toppixmap = QLabel()
        l = self.toplabel = QLabel()
        top.addWidget(p)
        top.addWidget(l, 1)
        layout.addLayout(top)
        grid = QGridLayout()
        grid.setSpacing(4)
        grid.setColumnStretch(1, 2)
        layout.addLayout(grid)

        self.buttonDefault = QRadioButton(
            self, toggled=self.slotButtonDefaultToggled)
        self.buttonNone = QRadioButton(self)
        self.lconflictDefault = QLabel('test')
        self.lconflictDefault.setStyleSheet("color : red;")
        self.lconflictDefault.setVisible(False)
        self.buttonCustom = QRadioButton(self)
        grid.addWidget(self.buttonDefault, 0, 0, 1, 2)
        grid.addWidget(self.lconflictDefault, 1, 0, 1, 2)
        grid.addWidget(self.buttonNone, 2, 0, 1, 2)
        grid.addWidget(self.buttonCustom, 3, 0, 1, 2)

        self.keybuttons = []
        self.keylabels = []
        self.conflictlabels = []
        for num in range(4):
            l = QLabel(self)
            l.setStyleSheet("margin-left: 2em;")
            l.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
            b = KeySequenceWidget(self, num)
            b.keySequenceChanged.connect(self.slotKeySequenceChanged)
            l.setBuddy(b)
            self.keylabels.append(l)
            self.keybuttons.append(b)
            grid.addWidget(l, num + 4 + num, 0)
            grid.addWidget(b, num + 4 + num, 1)
            lconflict = QLabel()
            lconflict.setStyleSheet("color : red;")
            self.conflictlabels.append(lconflict)
            lconflict.setVisible(False)
            grid.addWidget(lconflict, num + 5 + num, 0, 1, 2, Qt.AlignHCenter)

        layout.addWidget(Separator(self))

        b = QDialogButtonBox(self)
        b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        layout.addWidget(b)
        b.accepted.connect(self.accept)
        b.rejected.connect(self.reject)
        app.translateUI(self)
Esempio n. 25
0
    def showDialog(self):
        dialog = QDialog(mw)

        zoomScrollLayout = QHBoxLayout()
        zoomScrollLayout.addWidget(self.createZoomGroupBox())
        zoomScrollLayout.addWidget(self.createScrollGroupBox())

        zoomScrollTab = QWidget()
        zoomScrollTab.setLayout(zoomScrollLayout)

        tabWidget = QTabWidget()
        tabWidget.setUsesScrollButtons(False)
        tabWidget.addTab(self.createGeneralTab(), 'General')
        tabWidget.addTab(self.createExtractionTab(), 'Extraction')
        tabWidget.addTab(self.createHighlightingTab(), 'Highlighting')
        tabWidget.addTab(self.createSchedulingTab(), 'Scheduling')
        tabWidget.addTab(self.createQuickKeysTab(), 'Quick Keys')
        tabWidget.addTab(zoomScrollTab, 'Zoom / Scroll')

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonBox.accepted.connect(dialog.accept)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(tabWidget)
        mainLayout.addWidget(buttonBox)

        dialog.setLayout(mainLayout)
        dialog.setWindowTitle('Incremental Reading Options')
        dialog.exec_()

        self.settings['zoomStep'] = self.zoomStepSpinBox.value() / 100.0
        self.settings['generalZoom'] = self.generalZoomSpinBox.value() / 100.0
        self.settings['lineScrollFactor'] = self.lineStepSpinBox.value() / 100.0
        self.settings['pageScrollFactor'] = self.pageStepSpinBox.value() / 100.0
        self.settings['editExtract'] = self.editExtractButton.isChecked()
        self.settings['editSource'] = self.editSourceCheckBox.isChecked()
        self.settings['plainText'] = self.plainTextCheckBox.isChecked()
        self.settings['schedSoonRandom'] = self.soonRandomCheckBox.isChecked()
        self.settings['schedLaterRandom'] = self.laterRandomCheckBox.isChecked()

        if self.extractDeckComboBox.currentText() == '[Current Deck]':
            self.settings['extractDeck'] = None
        else:
            self.settings['extractDeck'] = self.extractDeckComboBox.currentText()

        try:
            self.settings['schedSoonInt'] = int(
                self.soonIntegerEditBox.text())
            self.settings['schedLaterInt'] = int(
                self.laterIntegerEditBox.text())
        except:
            pass

        if self.soonPercentButton.isChecked():
            self.settings['schedSoonType'] = 'pct'
        else:
            self.settings['schedSoonType'] = 'cnt'

        if self.laterPercentButton.isChecked():
            self.settings['schedLaterType'] = 'pct'
        else:
            self.settings['schedLaterType'] = 'cnt'

        mw.viewManager.resetZoom(mw.state)
Esempio n. 26
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.groupBox1 = GroupBox(self)
        verticalLayoutDlg.addWidget(self.groupBox1)

        self.pnlCodeId = TextBoxPanel(self.groupBox1)
        self.pnlCodeId.Caption = "Code ID"
        self.groupBox1.Add = self.pnlCodeId

        self.pnlCodeType = ComboBoxPanel(self.groupBox1)
        self.pnlCodeType.Caption = "Code Type"
        self.groupBox1.Add = self.pnlCodeType

        self.pnlPosition = PositionPanel(self.groupBox1, None, None, "Degree")
        self.pnlPosition.hideframe_Altitude()
        self.pnlPosition.btnCalculater.hide()
        self.groupBox1.Add = self.pnlPosition

        self.pnlLocation = ComboBoxPanel(self.groupBox1)
        self.pnlLocation.Caption = "Location"
        self.groupBox1.Add = self.pnlLocation

        self.pnlAssociation = ComboBoxPanel(self.groupBox1)
        self.pnlAssociation.Caption = "Associated With"
        self.groupBox1.Add = self.pnlAssociation

        self.pnlName = TextBoxPanel(self.groupBox1)
        self.pnlName.Caption = "Name"
        self.groupBox1.Add = self.pnlName

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

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

        self.connect(self.pnlAssociation, SIGNAL("Event_0"), self.method_8)
        self.connect(self.pnlLocation, SIGNAL("Event_0"), self.method_7)

        verticalLayoutDlg.addWidget(self.btnBoxOkCancel)

        self.data = None
        self.dbEntry = None

        self.pnlCodeType.Items = CodeTypeDesigPtAixm.Items
Esempio n. 27
0
    def _init_gui(self):
        # Setup base elements
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setObjectName('glMain')
        self.gridLayout.addLayout(
            self.vlNotification, 0, 0, 1, 1
        )
        QApplication.processEvents()

        column_widget_area = self._setup_columns_content_area()
        self.gridLayout.addWidget(
            column_widget_area, 1, 0, 1, 1
        )
        QApplication.processEvents()
        # Add notification for mandatory columns if applicable
        next_row = 2
        if self.has_mandatory:
            self.required_fields_lbl = QLabel(self)
            msg = self.tr(
                'Please fill out all required (*) fields.'
            )
            msg = self._highlight_asterisk(msg)
            self.required_fields_lbl.setText(msg)
            self.gridLayout.addWidget(
                self.required_fields_lbl, next_row, 0, 1, 2
            )
            # Bump up row reference
            next_row += 1

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setObjectName('buttonBox')
        self.gridLayout.addWidget(
            self.buttonBox, next_row, 0, 1, 1
        )

        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.Cancel|QDialogButtonBox.Save
        )

        if self.edit_model is None:
            if not self.collect_model:
                self.save_new_button = QPushButton(
                    QApplication.translate(
                        'EntityEditorDialog', 'Save and New'
                    )
                )
                self.buttonBox.addButton(
                    self.save_new_button, QDialogButtonBox.ActionRole
                )

        # edit model, collect model
        # adding new record for child

        # Saving in parent editor
        if not isinstance(self._parent._parent, EntityEditorDialog):
            # adding a new record
            if self.edit_model is None:
                # saving when digitizing.
                if self.collect_model:
                    self.buttonBox.accepted.connect(self.on_model_added)
                # saving parent editor
                else:
                    self.buttonBox.accepted.connect(self.save_parent_editor)
                    self.save_new_button.clicked.connect(self.save_and_new)
            # updating existing record
            else:
                if not self.collect_model:
                    # updating existing record of the parent editor
                    self.buttonBox.accepted.connect(self.save_parent_editor)
        # Saving in child editor
        else:
            # save and new record
            if self.edit_model is None:
                self.buttonBox.accepted.connect(self.on_child_saved)
                self.save_new_button.clicked.connect(
                    lambda: self.on_child_saved(True)
                )

            else:
                # When updating an existing child editor save to the db
                self.buttonBox.accepted.connect(
                    self.on_child_saved
                )
                #self.buttonBox.accepted.connect(self.submit)

        self.buttonBox.rejected.connect(self.cancel)
Esempio n. 28
0
    def setupUi(self):
        self.labels = {}
        self.widgets = {}
        self.checkBoxes = {}
        self.showAdvanced = False
        self.valueItems = {}
        self.dependentItems = {}
        self.resize(650, 450)
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok)
        tooltips = self._alg.getParameterDescriptions()
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setSpacing(5)
        self.verticalLayout.setMargin(20)

        hLayout = QHBoxLayout()
        hLayout.setSpacing(5)
        hLayout.setMargin(0)
        descriptionLabel = QLabel(self.tr("Description"))
        self.descriptionBox = QLineEdit()
        self.descriptionBox.setText(self._alg.name)
        hLayout.addWidget(descriptionLabel)
        hLayout.addWidget(self.descriptionBox)
        self.verticalLayout.addLayout(hLayout)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
        self.verticalLayout.addWidget(line)

        for param in self._alg.parameters:
            if param.isAdvanced:
                self.advancedButton = QPushButton()
                self.advancedButton.setText(
                    self.tr('Show advanced parameters'))
                self.advancedButton.setMaximumWidth(150)
                self.advancedButton.clicked.connect(
                    self.showAdvancedParametersClicked)
                self.verticalLayout.addWidget(self.advancedButton)
                break
        for param in self._alg.parameters:
            if param.hidden:
                continue
            desc = param.description
            if isinstance(param, ParameterExtent):
                desc += '(xmin, xmax, ymin, ymax)'
            label = QLabel(desc)
            self.labels[param.name] = label
            widget = self.getWidgetFromParameter(param)
            self.valueItems[param.name] = widget
            if param.name in tooltips.keys():
                tooltip = tooltips[param.name]
            else:
                tooltip = param.description
            label.setToolTip(tooltip)
            widget.setToolTip(tooltip)
            if param.isAdvanced:
                label.setVisible(self.showAdvanced)
                widget.setVisible(self.showAdvanced)
                self.widgets[param.name] = widget
            self.verticalLayout.addWidget(label)
            self.verticalLayout.addWidget(widget)

        for output in self._alg.outputs:
            if output.hidden:
                continue
            if isinstance(output, (OutputRaster, OutputVector, OutputTable,
                                   OutputHTML, OutputFile, OutputDirectory)):
                label = QLabel(output.description + '<' +
                               output.__class__.__name__ + '>')
                item = QLineEdit()
                if hasattr(item, 'setPlaceholderText'):
                    item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME)
                self.verticalLayout.addWidget(label)
                self.verticalLayout.addWidget(item)
                self.valueItems[output.name] = item

        label = QLabel(' ')
        self.verticalLayout.addWidget(label)
        label = QLabel(self.tr('Parent algorithms'))
        self.dependenciesPanel = self.getDependenciesPanel()
        self.verticalLayout.addWidget(label)
        self.verticalLayout.addWidget(self.dependenciesPanel)

        self.verticalLayout.addStretch(1000)
        self.setLayout(self.verticalLayout)

        self.setPreviousValues()
        self.setWindowTitle(self._alg.name)
        self.verticalLayout2 = QVBoxLayout()
        self.verticalLayout2.setSpacing(2)
        self.verticalLayout2.setMargin(0)
        self.tabWidget = QTabWidget()
        self.tabWidget.setMinimumWidth(300)
        self.paramPanel = QWidget()
        self.paramPanel.setLayout(self.verticalLayout)
        self.scrollArea = QScrollArea()
        self.scrollArea.setWidget(self.paramPanel)
        self.scrollArea.setWidgetResizable(True)
        self.tabWidget.addTab(self.scrollArea, self.tr('Parameters'))
        self.webView = QWebView()

        html = None
        url = None
        isText, help = self._alg.help()
        if help is not None:
            if isText:
                html = help
            else:
                url = QUrl(help)
        else:
            html = self.tr('<h2>Sorry, no help is available for this '
                           'algorithm.</h2>')
        try:
            if html:
                self.webView.setHtml(html)
            elif url:
                self.webView.load(url)
        except:
            self.webView.setHtml(
                self.tr('<h2>Could not open help file :-( </h2>'))
        self.tabWidget.addTab(self.webView, 'Help')
        self.verticalLayout2.addWidget(self.tabWidget)
        self.verticalLayout2.addWidget(self.buttonBox)
        self.setLayout(self.verticalLayout2)
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)
        QMetaObject.connectSlotsByName(self)
Esempio n. 29
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().parent().prm
        self.audioManager = audioManager(self)
        self.currLocale = self.parent().parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)
        self.isPlaying = False

        self.sizer = QGridLayout()
        self.v1Sizer = QVBoxLayout()

        self.wavsTableWidget = QTableWidget()
        self.wavsTableWidget.setColumnCount(4)
        self.wavsTableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.wavsTableWidget.setSelectionMode(
            QAbstractItemView.ExtendedSelection)

        self.wavsTableWidget.setHorizontalHeaderLabels(
            [self.tr("File"),
             self.tr('Use'),
             self.tr("RMS Level"), 'id'])
        self.quidColumn = 3
        self.wavsTableWidget.hideColumn(self.quidColumn)
        self.wavsTableWidget.cellDoubleClicked[int, int].connect(
            self.onCellDoubleClicked)

        #ADD wav BUTTON
        self.addWavButton = QPushButton(self.tr("Add Wav"), self)
        self.addWavButton.clicked.connect(self.onClickAddWavButton)
        #REMOVE wav BUTTON
        self.removeWavButton = QPushButton(self.tr("Remove Wav"), self)
        self.removeWavButton.clicked.connect(self.onClickRemoveWavButton)

        #PLAY wav BUTTON
        self.playWavButton = QPushButton(self.tr("Play Wav"), self)
        self.playWavButton.clicked.connect(self.onClickPlayWavButton)
        #STOP wav BUTTON
        self.stopWavButton = QPushButton(self.tr("Stop Playing"), self)
        self.stopWavButton.clicked.connect(self.onClickStopWavButton)

        self.v1Sizer.addWidget(self.addWavButton)
        self.v1Sizer.addWidget(self.removeWavButton)
        self.v1Sizer.addWidget(self.playWavButton)
        self.v1Sizer.addWidget(self.stopWavButton)

        self.v1Sizer.addStretch()

        self.wavsList = {}

        for i in range(len(self.parent().wavsPref['endMessageFiles'])):
            currCount = i + 1
            thisID = self.parent().wavsPref['endMessageFilesID'][i]
            self.wavsList[thisID] = {}
            self.wavsList[thisID]['file'] = self.parent(
            ).wavsPref['endMessageFiles'][i]
            self.wavsList[thisID]['use'] = self.parent(
            ).wavsPref['endMessageFilesUse'][i]
            self.wavsList[thisID]['level'] = self.parent(
            ).wavsPref['endMessageLevels'][i]
            self.wavsTableWidget.setRowCount(currCount)
            n = 0
            newItem = QTableWidgetItem(self.wavsList[thisID]['file'])
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.wavsTableWidget.setItem(currCount - 1, n, newItem)
            n = n + 1
            newItem = QTableWidgetItem(self.wavsList[thisID]['use'])
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.wavsTableWidget.setItem(currCount - 1, n, newItem)
            n = n + 1
            newItem = QTableWidgetItem(
                self.currLocale.toString(self.wavsList[thisID]['level']))
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.wavsTableWidget.setItem(currCount - 1, n, newItem)
            n = n + 1
            self.wavsList[thisID]['qid'] = QTableWidgetItem(thisID)
            self.wavsTableWidget.setItem(currCount - 1, n,
                                         self.wavsList[thisID]['qid'])

        buttonBox = QDialogButtonBox(QDialogButtonBox.Apply
                                     | QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        self.sizer.addLayout(self.v1Sizer, 0, 0)
        self.sizer.addWidget(self.wavsTableWidget, 0, 1)
        self.sizer.addWidget(buttonBox, 1, 1)
        self.setLayout(self.sizer)
        self.setWindowTitle(self.tr("Edit Wavs"))
        self.show()
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(
            self.currLocale.OmitGroupSeparator
            | self.currLocale.RejectGroupSeparator)
        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() / 2.5, screen.height() / 3)
        self.isPlaying = False
        #self.audioManager = audioManager(self)
        #self.playThread = threadedPlayer(self)

        self.sizer = QGridLayout()
        self.v1Sizer = QVBoxLayout()
        self.v2Sizer = QVBoxLayout()
        self.calibSizer = QGridLayout()

        self.phonesTableWidget = QTableWidget()
        self.phonesTableWidget.setColumnCount(4)
        self.phonesTableWidget.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.phonesTableWidget.setSelectionMode(
            QAbstractItemView.ExtendedSelection)

        self.phonesTableWidget.setHorizontalHeaderLabels([
            self.tr('Phones'),
            self.tr('Max Level'),
            self.tr('Default'), 'id'
        ])
        self.phonesTableWidget.hideColumn(3)
        self.phonesTableWidget.cellDoubleClicked[int, int].connect(
            self.onCellDoubleClicked)

        #RENAME Phones BUTTON
        self.renamePhonesButton = QPushButton(self.tr("Rename Phones"), self)
        self.renamePhonesButton.clicked.connect(self.onEditLabel)
        #Change Level Phones BUTTON
        self.changeLevelPhonesButton = QPushButton(self.tr("Change Max Level"),
                                                   self)
        self.changeLevelPhonesButton.clicked.connect(self.onEditMaxLevel)

        #ADD Phones BUTTON
        self.addPhonesButton = QPushButton(self.tr("Add Phones"), self)
        self.addPhonesButton.clicked.connect(self.onClickAddPhonesButton)
        #REMOVE Phones BUTTON
        self.removePhonesButton = QPushButton(self.tr("Remove Phones"), self)
        self.removePhonesButton.clicked.connect(self.onClickRemovePhonesButton)
        #Set Default Phones BUTTON
        self.setDefaultPhonesButton = QPushButton(self.tr("Set Default"), self)
        self.setDefaultPhonesButton.clicked.connect(self.onEditDefault)

        self.v1Sizer.addWidget(self.renamePhonesButton)
        self.v1Sizer.addWidget(self.changeLevelPhonesButton)
        self.v1Sizer.addWidget(self.addPhonesButton)
        self.v1Sizer.addWidget(self.removePhonesButton)
        self.v1Sizer.addWidget(self.setDefaultPhonesButton)
        self.v1Sizer.addStretch()
        self.phonesList = {}

        for i in range(len(self.prm['phones']['phonesChoices'])):
            currCount = i + 1
            thisID = self.prm['phones']['phonesID'][i]
            self.phonesList[thisID] = {}
            self.phonesList[thisID]['label'] = self.prm['phones'][
                'phonesChoices'][i]
            self.phonesList[thisID]['maxLevel'] = self.prm['phones'][
                'phonesMaxLevel'][i]
            self.phonesList[thisID]['default'] = self.prm['phones'][
                'defaultPhones'][i]
            self.phonesTableWidget.setRowCount(currCount)
            newItem = QTableWidgetItem(self.phonesList[thisID]['label'])
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.phonesTableWidget.setItem(currCount - 1, 0, newItem)
            newItem = QTableWidgetItem(
                self.currLocale.toString(self.phonesList[thisID]['maxLevel']))
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.phonesTableWidget.setItem(currCount - 1, 1, newItem)
            newItem = QTableWidgetItem(self.phonesList[thisID]['default'])
            newItem.setFlags(QtCore.Qt.ItemIsSelectable
                             | QtCore.Qt.ItemIsEnabled)
            self.phonesTableWidget.setItem(currCount - 1, 2, newItem)
            self.phonesList[thisID]['qid'] = QTableWidgetItem(thisID)
            self.phonesTableWidget.setItem(currCount - 1, 3,
                                           self.phonesList[thisID]['qid'])

        ##CALIBRATION TONE
        n = 0
        self.calLabel = QLabel(self.tr('Calibration Tone:'), self)
        self.calibSizer.addWidget(self.calLabel, n, 0, 1, 2)
        n = n + 1
        self.toneFreqLabel = QLabel(self.tr('Frequency (Hz)'), self)
        self.toneFreqTF = QLineEdit("1000")
        self.toneFreqTF.setValidator(QDoubleValidator(self))
        self.calibSizer.addWidget(self.toneFreqLabel, n, 0)
        self.calibSizer.addWidget(self.toneFreqTF, n, 1)
        n = n + 1
        self.toneLevLabel = QLabel(self.tr('Level (dB)'), self)
        self.toneLevTF = QLineEdit("60")
        self.toneLevTF.setValidator(QDoubleValidator(self))
        self.calibSizer.addWidget(self.toneLevLabel, n, 0)
        self.calibSizer.addWidget(self.toneLevTF, n, 1)
        n = n + 1
        self.toneDurLabel = QLabel(self.tr('Duration (ms)'), self)
        self.toneDurTF = QLineEdit("980")
        self.toneDurTF.setValidator(QDoubleValidator(self))
        self.calibSizer.addWidget(self.toneDurLabel, n, 0)
        self.calibSizer.addWidget(self.toneDurTF, n, 1)
        n = n + 1
        self.toneRampsLabel = QLabel(self.tr('Ramps (ms)'), self)
        self.toneRampsTF = QLineEdit("10")
        self.toneRampsTF.setValidator(QDoubleValidator(self))
        self.calibSizer.addWidget(self.toneRampsLabel, n, 0)
        self.calibSizer.addWidget(self.toneRampsTF, n, 1)
        n = n + 1
        self.earLabel = QLabel(self.tr('Ear:'), self)
        self.earChooser = QComboBox()
        self.earChooser.addItems(
            [self.tr("Right"),
             self.tr("Left"),
             self.tr("Both")])
        self.calibSizer.addWidget(self.earLabel, n, 0)
        self.calibSizer.addWidget(self.earChooser, n, 1)
        n = n + 1
        self.playCalibButton = QPushButton(self.tr("Play"), self)
        self.playCalibButton.clicked.connect(self.onClickPlayCalibButton)
        self.playCalibButton.setIcon(
            QIcon.fromTheme("media-playback-start",
                            QIcon(":/media-playback-start")))
        self.calibSizer.addWidget(self.playCalibButton, n, 0, 1, 2)
        n = n + 1
        self.stopCalibButton = QPushButton(self.tr("Stop"), self)
        self.stopCalibButton.clicked.connect(self.onClickStopCalibButton)
        self.stopCalibButton.setIcon(
            QIcon.fromTheme("media-playback-stop",
                            QIcon(":/media-playback-stop")))
        self.calibSizer.addWidget(self.stopCalibButton, n, 0, 1, 2)
        if self.prm['pref']['sound']['playCommand'] in [
                "alsaaudio", "pyaudio"
        ]:
            self.stopCalibButton.show()
        else:
            self.stopCalibButton.hide()

        buttonBox = QDialogButtonBox(QDialogButtonBox.Apply
                                     | QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        buttonBox.button(QDialogButtonBox.Apply).clicked.connect(
            self.permanentApply)

        self.sizer.addLayout(self.v1Sizer, 0, 0)
        self.v2Sizer.addLayout(self.calibSizer)
        self.v2Sizer.addStretch()
        self.sizer.addWidget(self.phonesTableWidget, 0, 1)
        self.sizer.addLayout(self.v2Sizer, 0, 2)
        self.sizer.addWidget(buttonBox, 1, 1, 1, 2)
        self.sizer.setColumnStretch(1, 2)
        self.setLayout(self.sizer)
        self.setWindowTitle(self.tr("Edit Phones"))
        self.show()