Example #1
0
 def _select_file(self, title, page, file=None):
     """Select a file to save or raise :exc:`gaupol.Default`."""
     gaupol.util.set_cursor_busy(self.window)
     mode = page.project.get_mode()
     dialog = gaupol.SaveDialog(self.window, title, mode)
     if file is not None:
         dialog.set_name(file.path)
         dialog.set_format(file.format)
         dialog.set_encoding(file.encoding)
         dialog.set_newline(file.newline)
         dialog.set_framerate(page.project.framerate)
     gaupol.util.set_cursor_normal(self.window)
     response = gaupol.util.run_dialog(dialog)
     format = dialog.get_format()
     path = dialog.get_filename()
     encoding = dialog.get_encoding()
     newline = dialog.get_newline()
     framerate = dialog.get_framerate()
     dialog.destroy()
     if response != Gtk.ResponseType.OK:
         raise gaupol.Default
     if format.mode != mode:
         # Set framerate to the selected one.
         self.set_current_page(page)
         action = self.get_action("set-framerate")
         action.activate(str(framerate))
     gaupol.util.iterate_main()
     return aeidon.files.new(format, path, encoding, newline)
Example #2
0
    def setup_method(self, method):
        gaupol.conf.file.directory = os.getcwd()
        self.dialog = gaupol.SaveDialog(parent=Gtk.Window(),
                                        title="test",
                                        mode=aeidon.modes.TIME)

        self.dialog.show()
Example #3
0
    def _select_file(self, title, file=None):
        """
        Select a file and return a :class:`aeidon.SubtitleFile`.

        Raise :exc:`gaupol.Default` if cancelled.
        """
        gaupol.util.set_cursor_busy(self.window)
        dialog = gaupol.SaveDialog(self.window, title)
        if file is not None:
            dialog.set_name(file.path)
            dialog.set_format(file.format)
            dialog.set_encoding(file.encoding)
            dialog.set_newline(file.newline)
        gaupol.util.set_cursor_normal(self.window)
        response = gaupol.util.run_dialog(dialog)
        format = dialog.get_format()
        path = dialog.get_filename()
        encoding = dialog.get_encoding()
        newline = dialog.get_newline()
        dialog.destroy()
        if response != Gtk.ResponseType.OK:
            raise gaupol.Default
        gaupol.util.iterate_main()
        return aeidon.files.new(format, path, encoding, newline)
Example #4
0
 def setup_method(self, method):
     gaupol.conf.file.directory = os.getcwd()
     self.dialog = gaupol.SaveDialog(Gtk.Window(), "test")
     self.dialog.show()