def addBoxEditor(self, box, data_box=None): if not data_box: data_box = DataBox() data_box.setLanguage(self.configuration_manager.language) data_box.updateBoundsFromBox(box) self.boxes_dict[box] = data_box self.editor.setBoxes(box, data_box)
def __init__(self, box, pixbuf, ocr_engines, reviewer): self.pixbuf = pixbuf self.data_box = DataBox() self.box_editor = BoxEditor(pixbuf.get_width(), pixbuf.get_height()) self.reviewer = reviewer self.ocr_engines = ocr_engines self.updateOcrEngines(self.ocr_engines) self.box_editor.x_spin_button.connect('value-changed', self.__updateBoxX) self.box_editor.y_spin_button.connect('value-changed', self.__updateBoxY) self.box_editor.width_spin_button.connect('value-changed', self.__updateBoxWidth) self.box_editor.height_spin_button.connect('value-changed', self.__updateBoxHeight) self.box_editor.make_text_button.connect( 'toggled', self.__pressedTextContextButton) self.box_editor.make_image_button.connect( 'toggled', self.__pressedImageContextButton) self.box_editor.perform_ocr_button.connect( 'clicked', self.__pressedPerformOcrButton) self.box_editor.detect_angle_button.connect( 'clicked', self.__pressedAngleDetectionButton) self.box_editor.font_button.connect('font-set', self.__setDataBoxFont) self.box_editor.align_left_button.connect('toggled', self.__setDataBoxAlign, ALIGN_LEFT) self.box_editor.align_right_button.connect('toggled', self.__setDataBoxAlign, ALIGN_RIGHT) self.box_editor.align_center_button.connect('toggled', self.__setDataBoxAlign, ALIGN_CENTER) self.box_editor.align_fill_button.connect('toggled', self.__setDataBoxAlign, ALIGN_FILL) self.box_editor.letter_spacing_spin.connect( 'value-changed', self.__setDataBoxLetterSpacing) self.box_editor.line_spacing_spin.connect('value-changed', self.__setDataBoxLineSpacing) self.__connectDataBoxSignals() self.update(box)
def addBoxEditor(self, box, data_box=None): if not data_box: data_box = DataBox() data_box.updateBoundsFromBox(box) self.boxes_dict[box] = data_box self.editor.setBoxes(box, data_box)