Пример #1
0
 def _on_load_video_activate(self, *args):
     """Load a video file."""
     gaupol.util.set_cursor_busy(self.window)
     page = self.get_current_page()
     dialog = gaupol.VideoDialog(self.window,
                                 title=_("Load Video"),
                                 button_label=_("_Load"))
     if page.project.main_file is not None:
         directory = os.path.dirname(page.project.main_file.path)
         dialog.set_current_folder(directory)
     if page.project.video_path is not None:
         dialog.set_filename(page.project.video_path)
     gaupol.util.set_cursor_normal(self.window)
     response = gaupol.util.run_dialog(dialog)
     path = dialog.get_filename()
     dialog.destroy()
     if response != Gtk.ResponseType.OK: return
     self.load_video(path)
Пример #2
0
 def _on_select_video_file_activate(self, *args):
     """Select a video file."""
     gaupol.util.set_cursor_busy(self.window)
     page = self.get_current_page()
     path = page.project.video_path
     dialog = gaupol.VideoDialog(self.window)
     if page.project.main_file is not None:
         directory = os.path.dirname(page.project.main_file.path)
         dialog.set_current_folder(directory)
     if page.project.video_path is not None:
         dialog.set_filename(page.project.video_path)
     gaupol.util.set_cursor_normal(self.window)
     response = gaupol.util.run_dialog(dialog)
     path = dialog.get_filename()
     dialog.destroy()
     if response != Gtk.ResponseType.OK: return
     page.project.video_path = path
     self.update_gui()
Пример #3
0
    def _on_load_video_activate(self, *args):
        """Load a video file."""
        gaupol.util.set_cursor_busy(self.window)
        page = self.get_current_page()
        path = page.project.video_path
        dialog = gaupol.VideoDialog(self.window,
                                    title=_("Load Video"),
                                    button_label=_("_Load"))

        if page.project.main_file is not None:
            directory = os.path.dirname(page.project.main_file.path)
            dialog.set_current_folder(directory)
        if page.project.video_path is not None:
            dialog.set_filename(page.project.video_path)
        gaupol.util.set_cursor_normal(self.window)
        response = gaupol.util.run_dialog(dialog)
        path = dialog.get_filename()
        dialog.destroy()
        if response != Gtk.ResponseType.OK: return
        page.project.video_path = path
        if self.player is None:
            self._init_player_widgets()
            self._init_cache_updates()
            self._init_update_handlers()
            self._update_subtitle_cache()
        else:  # Player exists
            if self.player.is_playing():
                action = self.get_action("play_pause")
                action.activate()
            adjustment = self.seekbar.get_adjustment()
            adjustment.set_value(0)
            self.player.stop()
        self.player.set_path(path)
        action = self.get_action("toggle_player")
        action.set_active(True)
        self.update_gui()
        self.player.play()
Пример #4
0
 def _on_load_video_activate(self, *args):
     """Load a video file."""
     gaupol.util.set_cursor_busy(self.window)
     page = self.get_current_page()
     dialog = gaupol.VideoDialog(self.window,
                                 title=_("Load Video"),
                                 button_label=_("_Load"))
     if page.project.main_file is not None:
         directory = os.path.dirname(page.project.main_file.path)
         dialog.set_current_folder(directory)
     if page.project.video_path is not None:
         dialog.set_filename(page.project.video_path)
     gaupol.util.set_cursor_normal(self.window)
     response = gaupol.util.run_dialog(dialog)
     path = dialog.get_filename()
     dialog.destroy()
     if response != Gtk.ResponseType.OK: return
     page.project.video_path = path
     if self.player is None:
         self._init_player_widgets()
         self._init_cache_updates()
         self._init_update_handlers()
         self._update_subtitle_cache()
     else:  # Player exists
         if self.player.is_playing():
             self.get_action("play-pause").activate()
         adjustment = self.seekbar.get_adjustment()
         adjustment.set_value(0)
         self.player.stop()
     self.player.set_path(path)
     # Playback initialization can fail, e.g. due to missing codecs,
     # in which case the player itself has shown an error dialog.
     if not self.player.ready: return
     self._update_languages_menu()
     self.update_gui()
     self.player.play()
Пример #5
0
    def setup_method(self, method):
        self.dialog = gaupol.VideoDialog(parent=Gtk.Window(),
                                         title="Select Video",
                                         button_label="Select")

        self.dialog.show()
Пример #6
0
 def setup_method(self, method):
     self.dialog = gaupol.VideoDialog(Gtk.Window())
     self.dialog.show()