コード例 #1
0
def swapToSpeakers():  #The inverse of the one above
    element = getSelectedElement(gui.GUI.listWidgetHeadphones)
    if element == None:
        return
    sdata.headphones.remove(element)
    sdata.speakers.append(element)
    updateDevices()
    fileop.removeElementFromFile(sdata.headphonesSaveFile, element)
    fileop.writeListToFile(sdata.speakersFile, sdata.speakers)
    fileop.writeListToFile(sdata.headphonesFile, sdata.headphones)
コード例 #2
0
def swapToHeadphones(
):  #Swaps the selected device from speakers section to headphone section
    element = getSelectedElement(gui.GUI.listWidgetSpeakers)
    if element == None:
        return
    sdata.speakers.remove(element)
    sdata.headphones.append(element)
    updateDevices()
    fileop.addElementToFile(sdata.headphonesSaveFile, element)
    fileop.writeListToFile(sdata.speakersFile, sdata.speakers)
    fileop.writeListToFile(sdata.headphonesFile, sdata.headphones)
コード例 #3
0
def lowerSelectedElement():
    element = getSelectedElement(gui.GUI.listWidgetSpeakers)
    if element == None:
        return
    index = sdata.speakers.index(element)
    if index < len(sdata.speakers) - 1:
        save = sdata.speakers[index + 1]
        sdata.speakers[index + 1] = sdata.speakers[index]
        sdata.speakers[index] = save
        updateDevices()
        gui.GUI.listWidgetSpeakers.setCurrentRow(index + 1)
        fileop.writeListToFile(sdata.speakersFile, sdata.speakers)
コード例 #4
0
def loadModes():  #Loads the saved functioning modes
    if os.path.getsize(sdata.modesFile) > 0:
        sdata.loadedModes = fileop.loadModesFromFile(sdata.modesFile)
    else:
        restoreDefaultModes()
    if os.path.getsize(sdata.currentModeFile) > 0:
        sdata.currentMode = int(
            fileop.loadListFromFile(sdata.currentModeFile)[0])
        if sdata.currentMode == -1:
            sdata.currentMode = 0
    else:
        fileop.writeListToFile(sdata.currentModeFile, [sdata.currentMode])

    updateModes()
    gui.GUI.comboBox.setCurrentIndex(sdata.currentMode)
コード例 #5
0
def loadDevices(
):  #Loads and filters all of the audio devices saved, removes the ones that dont work anymore and adds the new ones
    au.getXmlData()
    sdata.allDevices = au.getDeviceList()
    if os.path.getsize(sdata.headphonesSaveFile) == 0:
        sdata.speakers = sdata.allDevices[:]
        fileop.writeListToFile(sdata.speakersFile, sdata.speakers)
    else:
        sdata.headphones = fileop.loadListFromFile(sdata.headphonesSaveFile)
        sdata.speakers = []
        if os.path.getsize(sdata.speakersFile) != 0:
            sdata.speakers = fileop.loadListFromFile(sdata.speakersFile)

        for device in sdata.headphones:
            if device not in sdata.allDevices:
                sdata.headphones.remove(device)
        for device in sdata.allDevices:
            if device not in sdata.headphones and device not in sdata.speakers:
                sdata.speakers.append(device)

    updateDevices()
    fileop.writeListToFile(sdata.speakersFile, sdata.speakers)
    fileop.writeListToFile(sdata.headphonesFile, sdata.headphones)
コード例 #6
0
def updateCurrentMode(mode):
    sdata.currentMode = mode
    fileop.writeListToFile(sdata.currentModeFile, [mode])
    monitor.toSend.append("l")
コード例 #7
0
def updateSpinBoxValue():  #The inverse of the one above again
    sdata.volumeLimit = gui.GUI.spinBox_7.value()
    gui.GUI.horizontalSlider.setValue(sdata.volumeLimit)
    fileop.writeListToFile(sdata.volumeLimitFile, [sdata.volumeLimit])
    monitor.toSend.append("v")
コード例 #8
0
def updateSliderValue():  #Links the slider to the spinbox
    sdata.volumeLimit = gui.GUI.horizontalSlider.value()
    gui.GUI.spinBox_7.setValue(sdata.volumeLimit)
    fileop.writeListToFile(sdata.volumeLimitFile, [sdata.volumeLimit])
    monitor.toSend.append("v")