def on_btnDown_clicked(self, widget): filter = self.selected_filter() if filter is not None: index = tree_selected_index(self.lstFilters) if index < self.controler.count_filters() - 1: self.controler.move_filter_down(filter) self.lstFilters.set_cursor(index + 1) self.set_state_modified()
def on_btnUp_clicked(self, widget): filter = self.selected_filter() if filter is not None: index = tree_selected_index(self.lstFilters) if index > 0: self.controler.move_filter_up(filter) self.lstFilters.set_cursor(index - 1) self.set_state_modified()
def on_lstImage_cursor_changed(self, widget): index = tree_selected_index(self.lstImage) if index >= 0: file_name = self.imageListStore[index][0] self.imgExample.set_from_pixbuf( numpy_to_pixbuf(self.test.example_image(file_name))) self.imgOriginal.set_from_pixbuf( numpy_to_pixbuf(self.test.original_image(file_name)))
def read_matrix_from_disk(self): index = tree_selected_index(self.lstImages) file_name = self.imageListStore[index][2] + '.map' if os.path.exists(file_name): f = file(file_name, 'r') s = f.read() f.close() self.matrices[-1] = np.fromstring(s, np.bool).reshape( self.pixbuf_image.get_height(), self.pixbuf_image.get_width())
def on_lstImages_cursor_changed(self, widget): index = tree_selected_index(self.lstImages) if index >= 0: self.undo_list = [] if len(self.matrices) > 1: self.save_matrix_to_disk() self.current_index = index img = cv2.imread(self.imageListStore[index][2]) self.pixbuf_image = numpy_to_pixbuf(img) self.drwImage.set_size_request(img.shape[1], img.shape[0]) self.drwImage.queue_draw() self.configure()
def on_lstImage_cursor_changed(self, widget): index = tree_selected_index(self.lstImages) if index >= 0: self.source.set_position(index)
def on_btnNext_clicked(self, widget): position = tree_selected_index(self.lstImages) + 1 if position < len(self.imageListStore): self.lstImages.set_cursor(position)
def on_btnPrevious_clicked(self, widget): position = tree_selected_index(self.lstImages) - 1 if position >= 0: self.lstImages.set_cursor(position)