def load_url(self, from_reload=False): url = self.combo.currentText() if not url: return prev_table = self.table try: with self.progressBar(3) as progress: progress.advance() table = Table.from_url(url) progress.advance() except Exception as e: log.exception("Couldn't load data from: %s", url) self.Error.error(try_(lambda: e.args[0], '')) self.table = None else: self.Error.clear() self.table = table self.combo.setTitleFor(self.combo.currentIndex(), table.name) self.set_info() def _equal(data1, data2): NAN = float('nan') return (try_(lambda: data1.checksum(), NAN) == try_(lambda: data2.checksum(), NAN)) if not (from_reload and _equal(prev_table, self.table)): self.commit()
def retrieve(self, url): if not url: return progress = gui.ProgressBar(self, 10) for i in range(3): progress.advance() try: table = Table.from_url(url) except Exception as e: import traceback log.error(traceback.format_exc()) log.error("Couldn't load spreadsheet %s: %s", url, e) self.error("Couldn't load spreadsheet. Ensure correct read permissions; rectangular, top-left aligned sheet data ...") return else: for i in range(7): progress.advance() finally: progress.finish() return table
def retrieve(self, url): if not url: return progress = gui.ProgressBar(self, 10) for i in range(3): progress.advance() try: table = Table.from_url(url) except Exception as e: import traceback log.error(traceback.format_exc()) log.error("Couldn't load spreadsheet %s: %s", url, e) self.error( "Couldn't load spreadsheet. Ensure correct read permissions; rectangular, top-left aligned sheet data ..." ) return else: for i in range(7): progress.advance() finally: progress.finish() return table