def on_table_row_click(self, item): ''' Event handler for opening a new image when a particular row entry if clicked ''' row = item.row() col = item.column() entry_id = int(self.wtable.item(row, 0).data(0)) entry = database.get_entry_by_id(entry_id) if col == self.table_headers.index('Starred'): if entry.starred: database.unstar(entry) else: database.star(entry) database.commit() self.view_database() image = AstroImage.AstroImage() image.load_file(entry.path) # TODO: Fit image to entire available space? chaname = entry.path.split('/')[-1] self.fv.add_image(chaname, image, chname=chaname) self.fitsimage = self.fv.get_fitsimage(chaname) #Create a map with only the already opened metadata for speed sunpy_map = sunpy.map.Map((np.zeros([1, 1]), image.get_header())) cm = "{0}{1}{2}".format(sunpy_map.observatory.lower(), sunpy_map.detector.lower(), sunpy_map.wavelength) try: cm = cmap.get_cmap(cm) rgbmap = self.fitsimage.get_rgbmap() rgbmap.set_cmap(cm) except KeyError: pass
def on_table_row_click(self, item): """ Event handler for opening a new image when a particular row entry if clicked """ row = item.row() col = item.column() entry_id = int(self.wtable.item(row, 0).data(0)) entry = database.get_entry_by_id(entry_id) if col == self.table_headers.index("Starred"): if entry.starred: database.unstar(entry) else: database.star(entry) database.commit() self.view_database() image = AstroImage.AstroImage() image.load_file(entry.path) # TODO: Fit image to entire available space? chaname = entry.path.split("/")[-1] self.fv.add_image(chaname, image, chname=chaname) self.fitsimage = self.fv.get_fitsimage(chaname) # Create a map with only the already opened metadata for speed sunpy_map = sunpy.map.Map((np.zeros([1, 1]), image.get_header())) cm = "{0}{1}{2}".format(sunpy_map.observatory.lower(), sunpy_map.detector.lower(), sunpy_map.wavelength) try: cm = cmap.get_cmap(cm) rgbmap = self.fitsimage.get_rgbmap() rgbmap.set_cmap(cm) except KeyError: pass
def commit_database(self): """ Commits the newly added files to the connected database """ database.commit() self.set_info("Status: Database Committed")
def commit_database(self): ''' Commits the newly added files to the connected database ''' database.commit() self.set_info("Status: Database Committed")
def commit_database(self): database.commit()