Пример #1
0
 def _on_show_times_changed(self, item, active_item):
     """Change the units in which positions are shown."""
     page = self.get_current_page()
     edit_mode = active_item.mode
     if edit_mode == page.edit_mode: return
     gaupol.util.set_cursor_busy(self.window)
     page.edit_mode = edit_mode
     gaupol.conf.editor.mode = edit_mode
     has_focus = page.view.props.has_focus
     focus_row, focus_col = page.view.get_focus()
     selected_rows = page.view.get_selected_rows()
     scroller = page.view.get_parent()
     scroller.remove(page.view)
     page.view = gaupol.View(edit_mode)
     self.connect_view_signals(page.view)
     scroller.add(page.view)
     scroller.show_all()
     page.reload_view_all()
     if focus_row is not None:
         page.view.set_focus(focus_row, focus_col)
         page.view.scroll_to_row(focus_row)
     page.view.select_rows(selected_rows)
     page.view.props.has_focus = has_focus
     gaupol.util.set_cursor_normal(self.window)
     page.emit("view-created", page.view)
Пример #2
0
 def _on_set_edit_mode_activate(self, action, parameter):
     """Change the units in which positions are shown."""
     page = self.get_current_page()
     edit_mode = getattr(aeidon.modes, parameter.get_string())
     if edit_mode == page.edit_mode: return
     gaupol.util.set_cursor_busy(self.window)
     page.edit_mode = edit_mode
     gaupol.conf.editor.mode = edit_mode
     has_focus = page.view.has_focus()
     focus_row, focus_col = page.view.get_focus()
     selected_rows = page.view.get_selected_rows()
     scroller = page.view.get_parent()
     scroller.remove(page.view)
     page.view = gaupol.View(edit_mode)
     self.connect_view_signals(page.view)
     scroller.add(page.view)
     scroller.show_all()
     page.reload_view_all()
     if focus_row is not None:
         page.view.set_focus(focus_row, focus_col)
         page.view.scroll_to_row(focus_row)
     page.view.select_rows(selected_rows)
     page.view.props.has_focus = has_focus
     self.update_gui()
     gaupol.util.set_cursor_normal(self.window)
     page.emit("view-created", page.view)
Пример #3
0
 def setup_time(self):
     self.view = gaupol.View(aeidon.modes.TIME)
     store = self.view.get_model()
     self.project = self.new_project()
     for i, subtitle in enumerate(self.project.subtitles):
         store.append((i + 1, subtitle.start_time, subtitle.end_time,
                       subtitle.duration_seconds, subtitle.main_text,
                       subtitle.tran_text))
Пример #4
0
 def setup_frame(self):
     self.view = gaupol.View(aeidon.modes.FRAME)
     store = self.view.get_model()
     self.project = self.new_project()
     for i, subtitle in enumerate(self.project.subtitles):
         store.append((
             i,
             subtitle.start_frame,
             subtitle.end_frame,
             subtitle.duration_frame,
             subtitle.main_text,
             subtitle.tran_text,
         ))
Пример #5
0
 def __init__(self, count=0):
     """Initialize a :class:`Page` instance."""
     aeidon.Observable.__init__(self)
     self.edit_mode = gaupol.conf.editor.mode
     self.project = None
     self.tab_label = None
     self.tab_widget = None
     self.untitle = _("Untitled {:d}").format(count)
     self.view = gaupol.View(self.edit_mode)
     self._init_project()
     self._init_widgets()
     self._init_signal_handlers()
     self.update_tab_label()
     self.emit("view-created", self.view)