def organizeContent(self, widget):
        # get style metrics
        leftMargin = self.app.style().pixelMetric(QStyle.PM_LayoutLeftMargin)
        topMargin = self.app.style().pixelMetric(QStyle.PM_LayoutTopMargin)
        standHeight = self.app.style().pixelMetric(QStyle.PM_ButtonMargin) +\
                      self.app.fontMetrics().height()
        doubleStandHeight = standHeight * 2
        hsepara = self.app.style().pixelMetric(QStyle.PM_LayoutHorizontalSpacing)
        vsepara = self.app.style().pixelMetric(QStyle.PM_LayoutVerticalSpacing)
        # calculate grids
        col0Left = leftMargin
        col1Left = leftMargin + doubleStandHeight + vsepara
        col2Left = leftMargin + doubleStandHeight + standHeight + 2*vsepara
        col3Left = leftMargin + 2*doubleStandHeight + standHeight + 4*vsepara
        row0Top = topMargin
        row1Top = topMargin + standHeight + hsepara
        row2Top = topMargin + 3*standHeight + 2*hsepara
        row3Top = topMargin + 4*standHeight + 3*hsepara

        btnUp = QPushButton('Up', widget)
        btnUp.setGeometry(col1Left, row1Top, standHeight, doubleStandHeight)
        btnLeft = QPushButton('Left', widget)
        btnLeft.setGeometry(col0Left, row2Top, doubleStandHeight, standHeight)
        txtQuant = QLineEdit(widget)
        txtQuant.setGeometry(col1Left, row2Top, standHeight, standHeight)
        txtQuant.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        btnRight = QPushButton('Right', widget)
        btnRight.setGeometry(col2Left, row2Top, doubleStandHeight, standHeight)
        btnDown = QPushButton('Dn', widget)
        btnDown.setGeometry(col1Left, row3Top, standHeight, doubleStandHeight)
        lb3 = QLabel('Elevation:', widget)
        lb3.setGeometry(col3Left, row2Top, lb3.sizeHint().width(), standHeight)
        wi = self.app.fontMetrics().width('Horizontal:') + 2
        lb4 = QLabel('Horizontal:', widget)
        lb4.setGeometry(col3Left, row3Top, wi, standHeight)
        col4Left = leftMargin + 2*doubleStandHeight + standHeight + 5*vsepara + wi
        txtElev = QLineEdit(widget)
        txtElev.setGeometry(col4Left, row2Top, doubleStandHeight, standHeight)
        txtElev.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        txtHoriz = QLineEdit(widget)
        txtHoriz.setGeometry(col4Left, row3Top, doubleStandHeight, standHeight)
        txtHoriz.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        lb2 = QLabel('Angles in degrees', widget)
        lb2.setGeometry(col3Left, row2Top - standHeight - hsepara, wi + hsepara + doubleStandHeight, standHeight)
        lb2.setAlignment(Qt.AlignVCenter | Qt.AlignCenter) #Qt.AlignVCenter
        totalWi = col4Left + doubleStandHeight - col0Left
        totalHi = row3Top + doubleStandHeight - row0Top
        lb1 = QLabel('Camera position control panel', widget)
        lb1.setGeometry(col0Left, row0Top, totalWi, standHeight)
        lb1.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        lb1.setFrameStyle(QFrame.Box)
Exemple #2
0
    def __init__(self, parent):
        super(RotationControl, self).__init__(parent)
        self.parent = parent
        # get style metrics
        style = self.parent.app.style()
        fm = self.parent.app.fontMetrics()
        self.leftMargin = style.pixelMetric(QStyle.PM_LayoutLeftMargin)
        self.topMargin = style.pixelMetric(QStyle.PM_LayoutTopMargin)
        standHeight = style.pixelMetric(QStyle.PM_ButtonMargin) + fm.height() + 2
        doubleStandHeight = standHeight * 2
        hsepara = style.pixelMetric(QStyle.PM_LayoutHorizontalSpacing)
        vsepara = style.pixelMetric(QStyle.PM_LayoutVerticalSpacing)
        # calculate grids
        col0Left = self.leftMargin
        col1Left = self.leftMargin + doubleStandHeight + vsepara
        col2Left = self.leftMargin + doubleStandHeight + standHeight + 2*vsepara
        col3Left = self.leftMargin + 2*doubleStandHeight + standHeight + 4*vsepara
        row0Top = self.topMargin
        row1Top = self.topMargin + standHeight + hsepara
        row2Top = self.topMargin + 3*standHeight + 2*hsepara
        row3Top = self.topMargin + 4*standHeight + 3*hsepara
    
        btnUp = QPushButton('Up', self)
        btnUp.setGeometry(col1Left, row1Top, standHeight, doubleStandHeight)
        btnUp.clicked.connect(self.btnUp_OnClick)

        btnLeft = QPushButton('Left', self)
        btnLeft.setGeometry(col0Left, row2Top, doubleStandHeight, standHeight)
        btnLeft.clicked.connect(self.btnLeft_OnClick)

        self.txtQuant = QLineEdit(self)
        self.txtQuant.setObjectName('txtQuant')
        self.txtQuant.setGeometry(col1Left, row2Top, standHeight, standHeight)
        self.txtQuant.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        self.txtQuant.setText('5')

        btnRight = QPushButton('Right', self)
        btnRight.setGeometry(col2Left, row2Top, doubleStandHeight, standHeight)
        btnRight.clicked.connect(self.btnRight_OnClick)

        btnDown = QPushButton('Dn', self)
        btnDown.setObjectName('btnDown')
        btnDown.setGeometry(col1Left, row3Top, standHeight, doubleStandHeight)
        btnDown.clicked.connect(self.btnDown_OnClick)

        lb3 = QLabel('Elevation:', self)
        lb3.setGeometry(col3Left, row2Top, lb3.sizeHint().width(), standHeight)

        wi = fm.width('Horizontal:') + 2
        lb4 = QLabel('Horizontal:', self)
        lb4.setGeometry(col3Left, row3Top, wi, standHeight)
        col4Left = self.leftMargin + 2*doubleStandHeight + standHeight + 5*vsepara + wi
    
        txtElev = QLineEdit(self)
        txtElev.setObjectName('txtElev')
        txtElev.setGeometry(col4Left, row2Top, doubleStandHeight, standHeight)
        txtElev.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        txtElev.setText(str(self.parent.renderArea.alef))

        txtHoriz = QLineEdit(self)
        txtHoriz.setObjectName('txtHoriz')
        txtHoriz.setGeometry(col4Left, row3Top, doubleStandHeight, standHeight)
        txtHoriz.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        txtHoriz.setText(str(self.parent.renderArea.bet))

        lb2 = QLabel('Angles in degrees', self)
        lb2.setGeometry(col3Left, row2Top - standHeight - hsepara, wi + hsepara + doubleStandHeight, standHeight)
        lb2.setAlignment(Qt.AlignVCenter | Qt.AlignCenter) #Qt.AlignVCenter

        self.totalWi = col4Left + doubleStandHeight - col0Left
        self.totalHi = row3Top + doubleStandHeight - row0Top
        lb1 = QLabel('Camera position control panel', self)
        lb1.setGeometry(col0Left, row0Top, self.totalWi, standHeight)
        lb1.setAlignment(Qt.AlignVCenter | Qt.AlignCenter)
        self.width_ = col4Left + doubleStandHeight + vsepara
        #lb1.setFrameStyle(QFrame.Box)
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)