def create_cell(self, text_line_type, text_view_type, row_index, editable):
cell = Gtk.TextView()
cell.set_editable(editable)
cell.set_cursor_visible(editable)
cellTextBuffer = cell.get_buffer()
index = row_index + self.tables_content[self.table_index]
text = textwrap.fill(self.tables_content[text_line_type][index].rstrip('\n'), width=40)
cellTextBuffer.set_text(text)
cellTextBuffer.create_tag("#F8CBCB",background="#F8CBCB")
cellTextBuffer.create_tag("#A6F3A6",background="#A6F3A6")
self.tables_content[text_view_type][index] = cell
if self.table_type == "translation_table":
cellTextBuffer.connect("changed", self.cell_in_translation_table_changed, index)
cell.connect("button-press-event", self.cell_in_translation_table_is_being_focused, index)
if index in self.translation_reference_text_TextViews_modified_flag:
self.tables_content[self.reference_text_views][index].override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0.7, 249, 249, 240))
cell.set_right_margin(20)
cell.show()
self.table.attach(
cell,
text_line_type + 1,
text_line_type + 2,
row_index + 1,
row_index + 2)
评论列表
文章目录