Exemplo n.º 1
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        super(AVWidget, self).__init__(parent)

        self.mainLayout = QtGui.QVBoxLayout()
        self.mainLayout.addStretch(0)
        self.setLayout(self.mainLayout)

        config_icon = QtGui.QIcon.fromTheme("preferences-system")

        fontSize = self.font().pixelSize()
        fontUnit = "px"
        if fontSize == -1:  # Font is set as points, not pixels.
            fontUnit = "pt"
            fontSize = self.font().pointSize()

        boxStyle = "QGroupBox {{ font-weight: bold; font-size: {}{} }}".format(
            fontSize + 1, fontUnit)
        BOX_WIDTH = 400
        BOX_HEIGHT = 60

        #
        # Audio Input
        #

        audioLayout = QtGui.QGridLayout()
        self.audioGroupBox = QGroupBoxWithDpi("Audio Input")
        self.audioGroupBox.setLayout(audioLayout)
        self.mainLayout.insertWidget(0, self.audioGroupBox)

        self.audioGroupBox.setCheckable(True)
        self.audioGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed)
        self.audioGroupBox.setFixedSize(BOX_WIDTH, 1.5 * BOX_HEIGHT)
        self.audioGroupBox.setStyleSheet(boxStyle)

        self.audioMixerLabel = QtGui.QLabel("Audio Mixer")
        self.audioMixerLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                           QtGui.QSizePolicy.Maximum)
        self.audioMixerComboBox = QtGui.QComboBox()
        self.audioMixerLabel.setBuddy(self.audioMixerComboBox)
        self.audioMixerSetupPushButton = QtGui.QToolButton()
        self.audioMixerSetupPushButton.setText("Setup")
        self.audioMixerSetupPushButton.setIcon(config_icon)
        self.audioMixerSetupPushButton.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                                     QtGui.QSizePolicy.Maximum)
        self.audioMixerSetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        audioLayout.addWidget(self.audioMixerLabel, 0, 0)
        audioLayout.addWidget(self.audioMixerComboBox, 0, 1)
        audioLayout.addWidget(self.audioMixerSetupPushButton, 0, 2)

        self.audioQualityLabel = QtGui.QLabel("Audio Quality")
        self.audioQualityLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                             QtGui.QSizePolicy.Maximum)
        self.audioQualityComboBox = QtGui.QComboBox()
        self.audioQualityComboBox.addItems(Quality.qualities)
        self.audioQualityLabel.setBuddy(self.audioQualityComboBox)
        self.audioQualitySetupPushButton = QtGui.QToolButton()
        self.audioQualitySetupPushButton.setText("Setup")
        self.audioQualitySetupPushButton.setIcon(config_icon)
        self.audioQualitySetupPushButton.setSizePolicy(
            QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)
        self.audioQualitySetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        self.audioQualitySetupPushButton.setEnabled(False)
        audioLayout.addWidget(self.audioQualityLabel, 1, 0)
        audioLayout.addWidget(self.audioQualityComboBox, 1, 1)
        audioLayout.addWidget(self.audioQualitySetupPushButton, 1, 2)

        #
        # Video Input
        #

        videoLayout = QtGui.QGridLayout()
        self.videoGroupBox = QGroupBoxWithDpi("Video Input")
        self.videoGroupBox.setLayout(videoLayout)
        self.mainLayout.insertWidget(0, self.videoGroupBox)

        self.videoGroupBox.setCheckable(True)
        self.videoGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed)
        self.videoGroupBox.setFixedSize(BOX_WIDTH, 1.5 * BOX_HEIGHT)
        self.videoGroupBox.setStyleSheet(boxStyle)

        self.videoMixerLabel = QtGui.QLabel("Video Mixer")
        self.videoMixerLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                           QtGui.QSizePolicy.Maximum)
        self.videoMixerComboBox = QtGui.QComboBox()
        self.videoMixerLabel.setBuddy(self.videoMixerComboBox)
        self.videoMixerSetupPushButton = QtGui.QToolButton()
        self.videoMixerSetupPushButton.setText("Setup")
        self.videoMixerSetupPushButton.setIcon(config_icon)
        self.videoMixerSetupPushButton.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                                     QtGui.QSizePolicy.Maximum)
        self.videoMixerSetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        videoLayout.addWidget(self.videoMixerLabel, 0, 0)
        videoLayout.addWidget(self.videoMixerComboBox, 0, 1)
        videoLayout.addWidget(self.videoMixerSetupPushButton, 0, 2)

        self.videoQualityLabel = QtGui.QLabel("Video Quality")
        self.videoQualityLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                             QtGui.QSizePolicy.Maximum)
        self.videoQualityComboBox = QtGui.QComboBox()
        self.videoQualityComboBox.addItems(Quality.qualities)
        self.videoQualityLabel.setBuddy(self.videoQualityComboBox)
        self.videoQualitySetupPushButton = QtGui.QToolButton()
        self.videoQualitySetupPushButton.setText("Setup")
        self.videoQualitySetupPushButton.setIcon(config_icon)
        self.videoQualitySetupPushButton.setSizePolicy(
            QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Maximum)
        self.videoQualitySetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        self.videoQualitySetupPushButton.setEnabled(False)
        videoLayout.addWidget(self.videoQualityLabel, 1, 0)
        videoLayout.addWidget(self.videoQualityComboBox, 1, 1)
        videoLayout.addWidget(self.videoQualitySetupPushButton, 1, 2)

        #
        # Record to Stream
        #

        streamLayout = QtGui.QGridLayout()
        self.streamGroupBox = QGroupBoxWithDpi("Record to Stream")
        self.streamGroupBox.setLayout(streamLayout)
        self.mainLayout.insertWidget(0, self.streamGroupBox)

        self.streamGroupBox.setCheckable(True)
        self.streamGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                          QtGui.QSizePolicy.Fixed)
        self.streamGroupBox.setFixedSize(BOX_WIDTH, BOX_HEIGHT)
        self.streamGroupBox.setStyleSheet(boxStyle)

        self.streamLabel = QtGui.QLabel("Stream Format")
        self.streamLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                       QtGui.QSizePolicy.Maximum)
        self.streamComboBox = QtGui.QComboBox()
        self.streamLabel.setBuddy(self.streamComboBox)
        self.streamSetupPushButton = QtGui.QToolButton()
        self.streamSetupPushButton.setText("Setup")
        self.streamSetupPushButton.setIcon(config_icon)
        self.streamSetupPushButton.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                                 QtGui.QSizePolicy.Maximum)
        self.streamSetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        streamLayout.addWidget(self.streamLabel, 0, 0)
        streamLayout.addWidget(self.streamComboBox, 0, 1)
        streamLayout.addWidget(self.streamSetupPushButton, 0, 2)

        #
        # Record to File
        #

        fileLayout = QtGui.QGridLayout()
        self.fileGroupBox = QGroupBoxWithDpi("Record to File")
        self.fileGroupBox.setLayout(fileLayout)
        self.mainLayout.insertWidget(0, self.fileGroupBox)

        self.fileGroupBox.setCheckable(True)
        self.fileGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                        QtGui.QSizePolicy.Fixed)
        self.fileGroupBox.setFixedSize(BOX_WIDTH, BOX_HEIGHT + 40)
        self.fileGroupBox.setStyleSheet(boxStyle)

        self.fileDirLabel = QtGui.QLabel("Record Directory")
        self.fileDirLineEdit = QtGui.QLineEdit()
        self.fileDirLabel.setBuddy(self.fileDirLineEdit)
        self.fileDirPushButton = QtGui.QPushButton("Browse...")
        fileLayout.addWidget(self.fileDirLabel, 0, 0)
        fileLayout.addWidget(self.fileDirLineEdit, 0, 1)
        fileLayout.addWidget(self.fileDirPushButton, 0, 2)

        self.fileLabel = QtGui.QLabel("File Format")
        self.fileLabel.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                     QtGui.QSizePolicy.Maximum)
        self.fileComboBox = QtGui.QComboBox()
        self.fileLabel.setBuddy(self.fileComboBox)
        self.fileSetupPushButton = QtGui.QToolButton()
        self.fileSetupPushButton.setText("Setup")
        self.fileSetupPushButton.setIcon(config_icon)
        self.fileSetupPushButton.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                               QtGui.QSizePolicy.Maximum)
        self.fileSetupPushButton.setToolButtonStyle(
            QtCore.Qt.ToolButtonIconOnly)
        fileLayout.addWidget(self.fileLabel, 1, 0)
        fileLayout.addWidget(self.fileComboBox, 1, 1)
        fileLayout.addWidget(self.fileSetupPushButton, 1, 2)

        #
        # Heading
        #

        self.mainLayout.insertSpacerItem(0, QtGui.QSpacerItem(0, fontSize * 2))
        self.title = QtGui.QLabel(u"{0} Recording {1}".format(
            u'<h1>', u'</h1>'))
        self.mainLayout.insertWidget(0, self.title)
Exemplo n.º 2
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        super(GeneralWidget, self).__init__(parent)

        self.mainLayout = QtGui.QVBoxLayout()
        self.mainLayout.addStretch(0)
        self.setLayout(self.mainLayout)

        fontSize = self.font().pixelSize()
        fontUnit = "px"
        if fontSize == -1:  # Font is set as points, not pixels.
            fontUnit = "pt"
            fontSize = self.font().pointSize()

        boxStyle = "QGroupBox {{ font-weight: bold; font-size: {}{} }}".format(
            fontSize + 1, fontUnit)
        BOX_WIDTH = 400
        BOX_HEIGHT = 60

        #
        # Heading
        #

        self.title = QtGui.QLabel(u"{0} General {1}".format(u'<h1>', u'</h1>'))
        self.mainLayout.insertWidget(0, self.title)
        self.mainLayout.insertSpacerItem(1, QtGui.QSpacerItem(0, fontSize * 2))

        #
        # Language
        #

        languageBoxLayout = QtGui.QVBoxLayout()
        self.languageGroupBox = QGroupBoxWithDpi("Language")
        self.languageGroupBox.setLayout(languageBoxLayout)
        self.languageGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                            QtGui.QSizePolicy.Fixed)
        self.languageGroupBox.setFixedSize(BOX_WIDTH, BOX_HEIGHT)
        self.languageGroupBox.setStyleSheet(boxStyle)
        self.mainLayout.insertWidget(2, self.languageGroupBox)

        languageLayout = QtGui.QHBoxLayout()
        languageBoxLayout.addLayout(languageLayout)
        self.translateButton = QtGui.QPushButton("Help us translate")
        self.languageComboBox = QtGui.QComboBox()
        self.languageComboBox.setContextMenuPolicy(
            QtCore.Qt.ActionsContextMenu)
        languageLayout.addWidget(self.languageComboBox, 2)
        languageLayout.addSpacerItem(self.qspacer_item_with_dpi(40, 0))
        languageLayout.addWidget(self.translateButton, 1)

        #
        # Appearance
        #

        appearanceBoxLayout = QtGui.QVBoxLayout()
        self.appearanceGroupBox = QGroupBoxWithDpi("Appearance")
        self.appearanceGroupBox.setLayout(appearanceBoxLayout)
        self.appearanceGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                              QtGui.QSizePolicy.Fixed)
        self.appearanceGroupBox.setFixedSize(BOX_WIDTH, BOX_HEIGHT)
        self.appearanceGroupBox.setStyleSheet(boxStyle)
        self.mainLayout.insertWidget(3, self.appearanceGroupBox)

        self.autoHideCheckBox = QtGui.QCheckBox(
            "Auto-Hide to system tray on record")
        appearanceBoxLayout.addWidget(self.autoHideCheckBox)

        #
        # Reset
        #

        resetBoxLayout = QtGui.QVBoxLayout()
        self.resetGroupBox = QGroupBoxWithDpi("Reset")
        self.resetGroupBox.setLayout(resetBoxLayout)
        self.resetGroupBox.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed)
        self.resetGroupBox.setFixedSize(BOX_WIDTH / 2, BOX_HEIGHT)
        self.resetGroupBox.setStyleSheet(boxStyle)
        self.mainLayout.addWidget(self.resetGroupBox)
        self.mainLayout.addSpacerItem(self.qspacer_item_with_dpi(0, 20))

        resetLayout = QtGui.QHBoxLayout()
        resetBoxLayout.addLayout(resetLayout)
        self.resetButton = QtGui.QPushButton("Reset settings to defaults")
        resetLayout.addWidget(self.resetButton)
Exemplo n.º 3
0
 def setup(self):
     ''' Construct a tested class '''
     self.tested_cls = QGroupBoxWithDpi()