Beispiel #1
0
    def initUI(self):

        ui = FreeCADGui.UiLoader()

        # create our window
        # define window		xLoc,yLoc,xDim,yDim
        self.setGeometry(250, 250, 640, 480)
        self.setWindowTitle(
            translate('Rocket', "Minimum Thrust to Weight Calculator"))
        self.resize(QtCore.QSize(100, 100).expandedTo(
            self.minimumSizeHint()))  # sets size of the widget
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.weightLabel = QtGui.QLabel(translate('Rocket', "Weight"), self)

        self.weightInput = ui.createWidget("Gui::InputField")
        self.weightInput.unit = 'kg'
        self.weightInput.setFixedWidth(100)
        self.weightInput.setText("1.0")
        self.weightInput.textEdited.connect(self.onWeight)

        self.thrustLabel = QtGui.QLabel(translate('Rocket', "Minimum Thrust"),
                                        self)

        self.thrustInput = ui.createWidget("Gui::InputField")
        self.thrustInput.unit = 'N'
        self.thrustInput.setText("49.0")
        self.thrustInput.setFixedWidth(100)
        self.thrustInput.setReadOnly(True)

        # OK button
        okButton = QtGui.QPushButton('OK', self)
        okButton.setDefault(False)
        okButton.setAutoDefault(False)
        okButton.clicked.connect(self.onOk)

        layout = QVBoxLayout()
        line = QGridLayout()

        line.addWidget(self.weightLabel, 0, 0, 1, 2)
        line.addWidget(self.weightInput, 0, 1)

        line.addWidget(self.thrustLabel, 1, 0)
        line.addWidget(self.thrustInput, 1, 1)
        layout.addLayout(line)

        # layout.addStretch()

        line = QHBoxLayout()
        line.addStretch()
        line.addWidget(okButton)
        layout.addLayout(line)

        self.setLayout(layout)

        # now make the window visible
        self.show()
Beispiel #2
0
    def initUI(self):

        ui = FreeCADGui.UiLoader()

        # create our window
        # define window		xLoc,yLoc,xDim,yDim
        self.setGeometry(250, 250, 640, 480)
        self.setWindowTitle(translate('Rocket', "Parachute Calculator"))
        self.resize(QtCore.QSize(100, 100).expandedTo(
            self.minimumSizeHint()))  # sets size of the widget
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.weightLabel = QtGui.QLabel(translate('Rocket', "Rocket Weight"),
                                        self)

        self.weightInput = ui.createWidget("Gui::InputField")
        self.weightInput.unit = 'kg'
        self.weightInput.setFixedWidth(100)
        self.weightInput.setText("0.0")
        self.weightInput.textEdited.connect(self.onWeight)

        self.velocityLabel = QtGui.QLabel(
            translate('Rocket', "Terminal Velocity"), self)

        self.velocityInput = ui.createWidget("Gui::InputField")
        self.velocityInput.unit = "m/s"
        self.velocityInput.setText("6.1")
        self.velocityInput.setFixedWidth(100)
        self.velocityInput.textEdited.connect(self.onVelocity)

        self.velocityTypes = (VELOCITY_CUSTOM, VELOCITY_DROGUE, VELOCITY_MAIN)
        self.velocityCombo = QtGui.QComboBox(self)
        self.velocityCombo.addItems(self.velocityTypes)
        self.velocityCombo.setCurrentText(VELOCITY_MAIN)
        self.velocityCombo.currentTextChanged.connect(self.onVelocityCombo)

        self.dragLabel = QtGui.QLabel(translate('Rocket', "Drag Coefficient"),
                                      self)

        self.dragInput = QtGui.QLineEdit()
        self.dragInput.setText("0.75")
        self.dragInput.setFixedWidth(100)
        self.dragInput.textEdited.connect(self.onDrag)

        self.dragShapes = (DRAG_CUSTOM, DRAG_DOME, DRAG_ROUND, DRAG_HEX,
                           DRAG_SQUARE)
        self.dragCombo = QtGui.QComboBox(self)
        self.dragCombo.addItems(self.dragShapes)
        self.dragCombo.setCurrentText(DRAG_ROUND)
        self.dragCombo.currentTextChanged.connect(self.onDragCombo)

        self.diameterLabel = QtGui.QLabel(translate('Rocket', "Diameter"),
                                          self)

        self.diameterInput = QtGui.QLineEdit(
        )  # ui.createWidget("Gui::InputField")
        # self.diameterInput.unit = 'mm'
        self.diameterInput.setText("0.0 N")
        self.diameterInput.setFixedWidth(100)
        # self.diameterInput.textEdited.connect(self.onDiameter)
        self.diameterInput.setReadOnly(True)

        # OK button
        okButton = QtGui.QPushButton('OK', self)
        okButton.setDefault(False)
        okButton.setAutoDefault(False)
        okButton.clicked.connect(self.onOk)

        layout = QVBoxLayout()

        line = QGridLayout()

        row = 0
        line.addWidget(self.weightLabel, row, 0, 1, 2)
        line.addWidget(self.weightInput, row, 1)
        row += 1

        line.addWidget(self.velocityLabel, row, 0)
        line.addWidget(self.velocityInput, row, 1)
        line.addWidget(self.velocityCombo, row, 2)
        row += 1

        line.addWidget(self.dragLabel, row, 0)
        line.addWidget(self.dragInput, row, 1)
        line.addWidget(self.dragCombo, row, 2)
        row += 1

        line.addWidget(self.diameterLabel, row, 0)
        line.addWidget(self.diameterInput, row, 1)

        layout.addLayout(line)

        line = QHBoxLayout()
        line.addStretch()
        line.addWidget(okButton)
        layout.addLayout(line)

        self.setLayout(layout)

        self._calcDiameter()

        # now make the window visible
        self.show()
Beispiel #3
0
    def initUI(self):

        ui = FreeCADGui.UiLoader()

        # create our window
        # define window		xLoc,yLoc,xDim,yDim
        self.setGeometry(250, 250, 640, 480)
        self.setWindowTitle(translate('Rocket', "Vent Hole Size Calculator"))
        self.resize(QtCore.QSize(100, 100).expandedTo(
            self.minimumSizeHint()))  # sets size of the widget
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

        self.diameterLabel = QtGui.QLabel(
            translate('Rocket', "Body Tube Diameter"), self)

        self.diameterInput = ui.createWidget("Gui::InputField")
        self.diameterInput.unit = 'mm'
        self.diameterInput.setFixedWidth(100)
        self.diameterInput.setText("54.0")
        self.diameterInput.textEdited.connect(self.onDiameter)

        self.lengthLabel = QtGui.QLabel(
            translate('Rocket', "Body Tube Length"), self)

        self.lengthInput = ui.createWidget("Gui::InputField")
        self.lengthInput.unit = 'mm'
        self.lengthInput.setFixedWidth(100)
        self.lengthInput.setText("1000.0")
        self.lengthInput.textEdited.connect(self.onLength)

        self.holeCountLabel = QtGui.QLabel(
            translate('Rocket', "Vent Hole Count"), self)

        self.holeCountSpinBox = QtGui.QSpinBox(self)
        self.holeCountSpinBox.setFixedWidth(100)
        self.holeCountSpinBox.setMinimum(1)
        self.holeCountSpinBox.setMaximum(10000)
        self.holeCountSpinBox.setValue(3)
        self.holeCountSpinBox.valueChanged.connect(self.onHoleCount)

        self.sizeLabel = QtGui.QLabel(translate('Rocket', "Vent Hole Size"),
                                      self)

        self.sizeInput = ui.createWidget("Gui::InputField")
        self.sizeInput.unit = 'mm'
        self.sizeInput.setText("49.0")
        self.sizeInput.setFixedWidth(100)
        self.sizeInput.setReadOnly(True)

        # OK button
        okButton = QtGui.QPushButton('OK', self)
        okButton.setDefault(False)
        okButton.setAutoDefault(False)
        okButton.clicked.connect(self.onOk)

        layout = QVBoxLayout()
        line = QGridLayout()
        row = 0

        line.addWidget(self.diameterLabel, row, 0, 1, 2)
        line.addWidget(self.diameterInput, row, 1)
        row += 1

        line.addWidget(self.lengthLabel, row, 0)
        line.addWidget(self.lengthInput, row, 1)
        layout.addLayout(line)
        row += 1

        line.addWidget(self.holeCountLabel, row, 0)
        line.addWidget(self.holeCountSpinBox, row, 1)
        layout.addLayout(line)
        row += 1

        line.addWidget(self.sizeLabel, row, 0)
        line.addWidget(self.sizeInput, row, 1)
        layout.addLayout(line)
        row += 1

        # layout.addStretch()

        line = QHBoxLayout()
        line.addStretch()
        line.addWidget(okButton)
        layout.addLayout(line)

        self.setLayout(layout)

        self._calc()

        # now make the window visible
        self.show()