def __init__(self, component_manager): ImportDialog.__init__(self, component_manager) QtGui.QDialog.__init__(self, self.main_widget()) self.setupUi(self) # File formats. i = 0 current_index = None for format in self.component_manager.all("file_format"): if not format.import_possible: continue self.file_formats.addItem(_(format.description)) if str(type(format)) == self.config()["import_format"]: current_index = i i += 1 if current_index is not None: self.file_formats.setCurrentIndex(current_index) # Extra tag. i = 0 current_index = None for tag in self.database().tags(): if tag.name == self.config()["import_extra_tag_names"]: current_index = i if tag.name != "__UNTAGGED__": self.tags.addItem(tag.name) i += 1 if current_index is not None: self.tags.setCurrentIndex(current_index) if self.config()["import_extra_tag_names"] == "": self.tags.insertItem(0, "") self.tags.setCurrentIndex(0) if "," in self.config()["import_extra_tag_names"]: self.tags.insertItem(0, self.config()["import_extra_tag_names"]) self.tags.setCurrentIndex(0)
def activate(self): ImportDialog.activate(self) self.exec_()