def retrieve_data(self): settings = Settings() email = settings.value("Email") tool = quote(settings.applicationName()) if not email: self.error.emit( "NCBI requests users of their webservice to identify themselves with an email adress! \n\nPlease set your email in the settings to download data from ncbi!" ) self.finished.emit() return try: self.information = get_pubmed_information(pmid=self.pmid, email=email, tool=tool) except URLError: self.error.emit( "There appears to be a problem with your internet connection!") except (ValueError, TypeError) as e: self.error.emit(repr(e)) self.finished.emit()
def __init__(self, mainwindow): QDialog.__init__(self, mainwindow) self.setupUi(self) self.error_dialog = QErrorMessage(self) self.found_ids = [] self.known_ids = {} self.known_id_path = None self.current_index = 0 self.count = 0 self.pmid_thread = QtCore.QThread(self) self.pmid_worker = RetrievePubmedData() self.pmid_worker.moveToThread(self.pmid_thread) self.pmid_thread.started.connect(self.pmid_worker.retrieve_data) self.pmid_worker.error.connect(self.error_dialog.showMessage) self.pmid_worker.finished.connect(self.pmid_thread.quit) self.pmid_worker.finished.connect(self.update_info_from_online) # Search parameters settings = Settings() self.email = settings.value("Email") self.tool = quote(settings.applicationName()) # Connect slots self.webView.loadProgress.connect(self.progressBar.setValue) # Adjust window settings self.setWindowFlags(QtCore.Qt.Window) #self.webView.page().setLinkDelegationPolicy(QWebEnginePage.DelegateExternalLinks) self.webView.setContentsMargins(0, 0, 0, 0) self.buttonPrevious.setVisible(False) self.buttonNext.setVisible(False) self.resultsBox.layout().setContentsMargins(9, 0, 9, 9) self.resultsBox.hide() self.adjustSize() self.load_knowns()