def on_load_clicked(self, bn): filename = uiutils.open_file(parent=self, current_folder=self.current_folder) if filename is not None: try: poly_region = imgutils.PolyRegion.from_file(filename, self.img.get_coordinate_system()) self.load_poly_region(poly_region) except Exception, e: msg = "Failed to load region %s\n%s" % (filename, e) print msg uiutils.error_msg(msg, self)
def on_save_clicked(self, bn): filename = uiutils.select_file(parent=self, current_folder=self.current_folder) if filename is not None: vertices = self.poly.xy color = self.color_entry.get_text() title = self.title_entry.get_text() poly_region = imgutils.PolyRegion(vertices, color=color, title=title) try: poly_region.to_file(filename, self.img.get_coordinate_system()) except: msg = "Failed to save region %s" % filename print msg uiutils.error_msg(msg, self)
def on_save_clicked(self, bn): filename = uiutils.select_file(parent=self, current_folder=self.current_folder) if filename is not None: vertices = self.poly.xy color = self.color_entry.get_text() title = self.title_entry.get_text() poly_region = imgutils.PolyRegion(vertices, color=color, title=title) try: poly_region.to_file(filename, self.img.get_coordinate_system()) except Exception: msg = "Failed to save region %s" % filename print msg uiutils.error_msg(msg, self)