示例#1
0
 def __init__(self, parent=None):
     super(CDLookupOptionsPage, self).__init__(parent)
     self.ui = Ui_CDLookupOptionsPage()
     self.ui.setupUi(self)
     if AUTO_DETECT_DRIVES:
         self.drives = get_cdrom_drives()
         self.ui.cd_lookup_device.addItems(self.drives)
示例#2
0
class CDLookupOptionsPage(OptionsPage):

    NAME = "cdlookup"
    TITLE = N_("CD Lookup")
    PARENT = None
    SORT_ORDER = 50
    ACTIVE = True

    options = [
        TextOption("setting", "cd_lookup_device", ""),
    ]

    def __init__(self, parent=None):
        super(CDLookupOptionsPage, self).__init__(parent)
        self.ui = Ui_CDLookupOptionsPage()
        self.ui.setupUi(self)
        if AUTO_DETECT_DRIVES:
            self.drives = get_cdrom_drives()
            self.ui.cd_lookup_device.addItems(self.drives)

    def load(self):
        if AUTO_DETECT_DRIVES:
            try:
                self.ui.cd_lookup_device.setCurrentIndex(self.drives.index(self.config.setting["cd_lookup_device"]))
            except ValueError:
                pass
        else:
            self.ui.cd_lookup_device.setText(self.config.setting["cd_lookup_device"])

    def save(self):
        if AUTO_DETECT_DRIVES:
            self.config.setting["cd_lookup_device"] = unicode(self.ui.cd_lookup_device.currentText())
        else:
            self.config.setting["cd_lookup_device"] = unicode(self.ui.cd_lookup_device.text())
示例#3
0
class CDLookupOptionsPage(OptionsPage):

    NAME = "cdlookup"
    TITLE = N_("CD Lookup")
    PARENT = None
    SORT_ORDER = 50
    ACTIVE = True

    options = [
        config.TextOption("setting", "cd_lookup_device",
                          ",".join(DEFAULT_DRIVES)),
    ]

    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_CDLookupOptionsPage()
        self.ui.setupUi(self)
        if AUTO_DETECT_DRIVES:
            self.drives = get_cdrom_drives()
            self.ui.cd_lookup_device.addItems(self.drives)

    def load(self):
        if AUTO_DETECT_DRIVES:
            try:
                self.ui.cd_lookup_device.setCurrentIndex(self.drives.index(config.setting["cd_lookup_device"]))
            except ValueError:
                pass
        else:
            self.ui.cd_lookup_device.setText(config.setting["cd_lookup_device"])

    def save(self):
        if AUTO_DETECT_DRIVES:
            config.setting["cd_lookup_device"] = self.ui.cd_lookup_device.currentText()
        else:
            config.setting["cd_lookup_device"] = self.ui.cd_lookup_device.text()
示例#4
0
 def __init__(self, parent=None):
     super(CDLookupOptionsPage, self).__init__(parent)
     self.ui = Ui_CDLookupOptionsPage()
     self.ui.setupUi(self)
     if AUTO_DETECT_DRIVES:
         self.drives = get_cdrom_drives()
         self.ui.cd_lookup_device.addItems(self.drives)
示例#5
0
class CDLookupOptionsPage(OptionsPage):

    NAME = "cdlookup"
    TITLE = N_("CD Lookup")
    PARENT = None
    SORT_ORDER = 50
    ACTIVE = True
    HELP_URL = '/config/options_cdlookup.html'

    options = [
        TextOption("setting", "cd_lookup_device", ",".join(DEFAULT_DRIVES)),
    ]

    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_CDLookupOptionsPage()
        self.ui.setupUi(self)
        if AUTO_DETECT_DRIVES:
            self._device_list = get_cdrom_drives()
            self.ui.cd_lookup_device.addItems(self._device_list)

    def load(self):
        config = get_config()
        device = config.setting["cd_lookup_device"]
        if AUTO_DETECT_DRIVES:
            try:
                self.ui.cd_lookup_device.setCurrentIndex(
                    self._device_list.index(device))
            except ValueError:
                pass
        else:
            self.ui.cd_lookup_device.setText(device)

    def save(self):
        config = get_config()
        if AUTO_DETECT_DRIVES:
            device = self.ui.cd_lookup_device.currentText()
            device_list = self._device_list
        else:
            device = self.ui.cd_lookup_device.text()
            device_list = [device]
        config.setting["cd_lookup_device"] = device
        self.tagger.window.update_cd_lookup_drives(device_list)