def commit(): msgbox = QMessageBox(self) msgbox.setIcon(QMessageBox.Question) msgbox.setWindowTitle('Type of gallery source') msgbox.setInformativeText('What type of gallery source is it?') dir = msgbox.addButton('Directory', QMessageBox.YesRole) archive = msgbox.addButton('Archive', QMessageBox.NoRole) msgbox.exec() new_path = '' if msgbox.clickedButton() == dir: new_path = QFileDialog.getExistingDirectory(self, 'Choose directory') elif msgbox.clickedButton() == archive: new_path = QFileDialog.getOpenFileName(self, 'Choose archive', filter=utils.FILE_FILTER) new_path = new_path[0] else: return None if new_path: g = utils.update_gallery_path(new_path, gallery) self.UPDATE_SIGNAL.emit(g) self.close()
def commit(): g = utils.update_gallery_path(new_path, gallery) self.UPDATE_SIGNAL.emit(g) self.close()