Пример #1
0
    def __init__(self, window):

        QtCore.QObject.__init__(self)

        # print('main thread id: {}'.format(QtCore.QThread.currentThreadId()))
        self.window = window
        self.core = core.Core()

        self.settings = QSettings('settings.ini', QSettings.IniFormat)

        self.previewQueue = Queue()

        self.previewThread = QtCore.QThread(self)
        self.previewWorker = preview_thread.Worker(self, self.previewQueue)

        self.previewWorker.moveToThread(self.previewThread)
        self.previewWorker.imageCreated.connect(self.showPreviewImage)

        self.previewThread.start()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.processTask.emit)
        self.timer.start(500)

        window.pushButton_selectInput.clicked.connect(self.openInputFileDialog)
        window.pushButton_selectOutput.clicked.connect(
            self.openOutputFileDialog)
        window.pushButton_createVideo.clicked.connect(
            self.createAudioVisualisation)
        window.pushButton_selectBackground.clicked.connect(
            self.openBackgroundFileDialog)

        window.fontComboBox.currentFontChanged.connect(self.drawPreview)
        window.lineEdit_title.textChanged.connect(self.drawPreview)

        window.progressBar_create.setValue(0)
        window.setWindowTitle("Audio Visualizer")
        window.pushButton_selectInput.setText("Select Input Music File")
        window.pushButton_selectOutput.setText("Select Output Video File")
        window.pushButton_selectBackground.setText("Select Background Image")
        window.label_font.setText("Title Font")
        window.label_title.setText("Title Text")
        window.pushButton_createVideo.setText("Create Video")
        window.groupBox_create.setTitle("Create")
        window.groupBox_settings.setTitle("Settings")
        window.groupBox_preview.setTitle("Preview")

        titleFont = self.settings.value("titleFont")
        if not titleFont == None:
            window.fontComboBox.setCurrentFont(QFont(titleFont))

        self.drawPreview()

        window.show()
Пример #2
0
    def __init__(self, window):
        QtCore.QObject.__init__(self)

        # print('main thread id: {}'.format(QtCore.QThread.currentThreadId()))
        self.window = window
        self.core = core.Core()
        self.settings = QSettings('settings.ini', QSettings.IniFormat)

        # load colors as tuples from a comma-separated string
        self.textColor = core.Core.RGBFromString(
            self.settings.value("textColor", '255, 255, 255'))
        self.visColor = core.Core.RGBFromString(
            self.settings.value("visColor", '255, 255, 255'))

        self.previewQueue = Queue()

        self.previewThread = QtCore.QThread(self)
        self.previewWorker = preview_thread.Worker(self, self.previewQueue)

        self.previewWorker.moveToThread(self.previewThread)
        self.previewWorker.imageCreated.connect(self.showPreviewImage)

        self.previewThread.start()

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.processTask.emit)
        self.timer.start(500)

        window.pushButton_selectInput.clicked.connect(self.openInputFileDialog)
        window.pushButton_selectOutput.clicked.connect(
            self.openOutputFileDialog)
        window.pushButton_createVideo.clicked.connect(
            self.createAudioVisualisation)
        window.pushButton_selectBackground.clicked.connect(
            self.openBackgroundFileDialog)

        window.progressBar_create.setValue(0)
        window.setWindowTitle("Audio Visualizer")
        window.pushButton_selectInput.setText("Select Input Music File")
        window.pushButton_selectOutput.setText("Select Output Video File")
        window.pushButton_selectBackground.setText("Select Background Image")
        window.label_font.setText("Title Font")
        window.label_alignment.setText("Title Options")
        window.label_colorOptions.setText("Colors")
        window.label_fontsize.setText("Fontsize")
        window.label_title.setText("Title Text")
        window.label_textColor.setText("Text:")
        window.label_visColor.setText("Visualizer:")
        window.pushButton_createVideo.setText("Create Video")
        window.groupBox_create.setTitle("Create")
        window.groupBox_settings.setTitle("Settings")
        window.groupBox_preview.setTitle("Preview")

        window.alignmentComboBox.addItem("Left")
        window.alignmentComboBox.addItem("Middle")
        window.alignmentComboBox.addItem("Right")
        window.fontsizeSpinBox.setValue(35)
        window.textXSpinBox.setValue(70)
        window.textYSpinBox.setValue(375)
        window.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
        window.lineEdit_visColor.setText('%s,%s,%s' % self.visColor)
        window.pushButton_textColor.clicked.connect(
            lambda: self.pickColor('text'))
        window.pushButton_visColor.clicked.connect(
            lambda: self.pickColor('vis'))
        btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(
            *self.textColor).name()
        window.pushButton_textColor.setStyleSheet(btnStyle)
        btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(
            *self.visColor).name()
        window.pushButton_visColor.setStyleSheet(btnStyle)

        titleFont = self.settings.value("titleFont")
        if not titleFont == None:
            window.fontComboBox.setCurrentFont(QFont(titleFont))

        alignment = self.settings.value("alignment")
        if not alignment == None:
            window.alignmentComboBox.setCurrentIndex(int(alignment))
        fontSize = self.settings.value("fontSize")
        if not fontSize == None:
            window.fontsizeSpinBox.setValue(int(fontSize))
        xPosition = self.settings.value("xPosition")
        if not xPosition == None:
            window.textXSpinBox.setValue(int(xPosition))
        yPosition = self.settings.value("yPosition")
        if not yPosition == None:
            window.textYSpinBox.setValue(int(yPosition))

        window.fontComboBox.currentFontChanged.connect(self.drawPreview)
        window.lineEdit_title.textChanged.connect(self.drawPreview)
        window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
        window.textXSpinBox.valueChanged.connect(self.drawPreview)
        window.textYSpinBox.valueChanged.connect(self.drawPreview)
        window.fontsizeSpinBox.valueChanged.connect(self.drawPreview)
        window.lineEdit_textColor.textChanged.connect(self.drawPreview)
        window.lineEdit_visColor.textChanged.connect(self.drawPreview)

        self.drawPreview()

        window.show()
Пример #3
0
    def __init__(self, window):
        QObject.__init__(self)

        # print('main thread id: {}'.format(QThread.currentThreadId()))
        self.window = window
        self.core = core.Core()
        self.settings = QSettings("settings.ini", QSettings.IniFormat)

        # load colors as tuples from a comma-separated string
        self.textColor = core.Core.RGBFromString(
            self.settings.value("textColor", "255, 255, 255"))
        self.visColor = core.Core.RGBFromString(
            self.settings.value("visColor", "255, 255, 255"))

        self.previewQueue = Queue()

        self.previewThread = QThread(self)
        self.previewWorker = preview_thread.Worker(self, self.previewQueue)

        self.previewWorker.moveToThread(self.previewThread)
        self.previewWorker.imageCreated.connect(self.showPreviewImage)

        self.previewThread.start()

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.processTask.emit)
        self.timer.start(500)

        window.pushButton_font.clicked.connect(self.openFontDialog)
        window.pushButton_selectInput.clicked.connect(self.openInputFileDialog)
        window.pushButton_selectOutput.clicked.connect(
            self.openOutputFileDialog)
        window.pushButton_createVideo.clicked.connect(
            self.createAudioVisualisation)
        window.pushButton_selectBackground.clicked.connect(
            self.openBackgroundFileDialog)

        window.progressBar_create.setValue(0)
        window.setWindowTitle("Audio Visualizer")
        window.pushButton_selectInput.setText("Input Audio")
        window.pushButton_selectOutput.setText("Output Video")
        window.pushButton_selectBackground.setText("Background")
        window.pushButton_font.setText("Font")
        window.label_alignment.setText("Title Options")
        window.label_visOptions.setText("Visualization")
        window.label_title.setText("Title Text")
        window.label_video_settings.setText("Video Settings")
        window.label_video_res_x.setText("H. Res")
        window.label_video_res_y.setText("V. Res")
        window.label_video_fps.setText("FPS")
        window.pushButton_createVideo.setText("Create Video")
        window.groupBox_create.setTitle("Create")
        window.groupBox_settings.setTitle("Settings")
        window.groupBox_preview.setTitle("Preview")

        window.lineEdit_video_res_x.setText(str(1280))
        window.lineEdit_video_res_y.setText(str(720))
        window.comboBox_video_fps.addItems(["29.97", "30", "59.94", "60"])
        window.alignmentComboBox.addItems(["Left", "Center", "Right"])
        window.textXSpinBox.setValue(0)
        window.textYSpinBox.setValue(0)
        window.pushButton_textColor.clicked.connect(
            lambda: self.pickColor("text"))
        window.pushButton_visColor.clicked.connect(
            lambda: self.pickColor("vis"))
        window.comboBox_visStyle.addItems(["Mirrored", "Up", "Down", "Circle"])
        btnStyle = ("QPushButton { background-color : %s; outline: none; }" %
                    QColor(*self.textColor).name())
        window.pushButton_textColor.setStyleSheet(btnStyle)
        btnStyle = ("QPushButton { background-color : %s; outline: none; }" %
                    QColor(*self.visColor).name())
        window.pushButton_visColor.setStyleSheet(btnStyle)

        input_file = self.settings.value("input")
        if input_file is not None:
            self.window.label_input.setText(input_file)
        background_file = self.settings.value("background")
        if background_file is not None:
            self.window.label_background.setText(background_file)

        fps = self.settings.value("fps")
        if fps is not None:
            window.comboBox_video_fps.setCurrentText(fps)
        alignment = self.settings.value("alignment")
        if alignment is not None:
            window.alignmentComboBox.setCurrentIndex(int(alignment))
        xPosition = self.settings.value("xPosition")
        if xPosition is not None:
            window.textXSpinBox.setValue(int(xPosition))
        yPosition = self.settings.value("yPosition")
        if yPosition is not None:
            window.textYSpinBox.setValue(int(yPosition))
        xResolution = self.settings.value("xResolution")
        if xResolution is not None:
            window.lineEdit_video_res_x.setText(xResolution)
        yResolution = self.settings.value("yResolution")
        if yResolution is not None:
            window.lineEdit_video_res_y.setText(yResolution)
        title = self.settings.value("title")
        if title is not None:
            self.window.lineEdit_title.setText(title)

        window.lineEdit_title.textChanged.connect(self.drawPreview)
        window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
        window.textXSpinBox.valueChanged.connect(self.drawPreview)
        window.textYSpinBox.valueChanged.connect(self.drawPreview)
        window.comboBox_visStyle.currentIndexChanged.connect(self.drawPreview)
        window.lineEdit_video_res_x.textChanged.connect(self.drawPreview)
        window.lineEdit_video_res_y.textChanged.connect(self.drawPreview)

        window.show()
        self.drawPreview()
Пример #4
0
  def __init__(self, window):

    QtCore.QObject.__init__(self)

    # print('main thread id: {}'.format(QtCore.QThread.currentThreadId()))
    self.window = window
    self.core = core.Core()

    self.settings = QSettings('settings.ini', QSettings.IniFormat)

    self.previewQueue = Queue()

    self.previewThread = QtCore.QThread(self)
    self.previewWorker = preview_thread.Worker(self, self.previewQueue)

    self.previewWorker.moveToThread(self.previewThread)
    self.previewWorker.imageCreated.connect(self.showPreviewImage)
    
    self.previewThread.start()

    self.timer = QtCore.QTimer(self)
    self.timer.timeout.connect(self.processTask.emit)
    self.timer.start(500)
    
    window.pushButton_selectInput.clicked.connect(self.openInputFileDialog)
    window.pushButton_selectOutput.clicked.connect(self.openOutputFileDialog)
    window.pushButton_createVideo.clicked.connect(self.createAudioVisualisation)
    window.pushButton_selectBackground.clicked.connect(self.openBackgroundFileDialog)

    window.progressBar_create.setValue(0)
    window.setWindowTitle("Audio Visualizer")
    window.pushButton_selectInput.setText("Select Input Music File")
    window.pushButton_selectOutput.setText("Select Output Video File")
    window.pushButton_selectBackground.setText("Select Background Image")
    window.label_font.setText("Title Font")
    window.label_alignment.setText("Title Options")
    window.label_fontsize.setText("Fontsize")
    window.label_title.setText("Title Text")
    window.pushButton_createVideo.setText("Create Video")
    window.groupBox_create.setTitle("Create")
    window.groupBox_settings.setTitle("Settings")
    window.groupBox_preview.setTitle("Preview")

    window.alignmentComboBox.addItem("Left")
    window.alignmentComboBox.addItem("Middle")
    window.alignmentComboBox.addItem("Right")
    window.fontsizeSpinBox.setValue(35)
    window.textXSpinBox.setValue(70)
    window.textYSpinBox.setValue(375)

    titleFont = self.settings.value("titleFont")
    if not titleFont == None: 
      window.fontComboBox.setCurrentFont(QFont(titleFont))

    alignment = self.settings.value("alignment")
    if not alignment == None:
      window.alignmentComboBox.setCurrentIndex(int(alignment))
    fontSize = self.settings.value("fontSize")
    if not fontSize == None:
      window.fontsizeSpinBox.setValue(int(fontSize))
    xPosition = self.settings.value("xPosition")
    if not xPosition == None:
      window.textXSpinBox.setValue(int(xPosition))
    yPosition = self.settings.value("yPosition")
    if not yPosition == None:
      window.textYSpinBox.setValue(int(yPosition))

    window.fontComboBox.currentFontChanged.connect(self.drawPreview)
    window.lineEdit_title.textChanged.connect(self.drawPreview)
    window.alignmentComboBox.currentIndexChanged.connect(self.drawPreview)
    window.textXSpinBox.valueChanged.connect(self.drawPreview)
    window.textYSpinBox.valueChanged.connect(self.drawPreview)
    window.fontsizeSpinBox.valueChanged.connect(self.drawPreview)

    self.drawPreview()

    window.show()