~ubuntu-branches/ubuntu/saucy/gaupol/saucy-proposed

« back to all changes in this revision

Viewing changes to gaupol/actions/position.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-01-06 17:10:10 UTC
  • mfrom: (1.2.8)
  • mto: (10.2.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: package-import@ubuntu.com-20130106171010-kmlq0sy324jlp9zz
Tags: upstream-0.21
Import upstream version 0.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
1
3
# Copyright (C) 2005-2008,2010 Osmo Salomaa
2
4
#
3
5
# This file is part of Gaupol.
18
20
 
19
21
import aeidon
20
22
import gaupol
21
 
import gtk
22
23
_ = aeidon.i18n._
23
24
 
 
25
from gi.repository import Gtk
 
26
 
24
27
 
25
28
class AdjustDurationsAction(gaupol.Action):
26
29
 
29
32
    def __init__(self):
30
33
        """Initialize an :class:`AdjustDurationsAction` object."""
31
34
        gaupol.Action.__init__(self, "adjust_durations")
32
 
        self.props.label = _("Adjust _Durations\342\200\246")
 
35
        self.props.label = _("Adjust _Durations…")
33
36
        self.props.tooltip = _("Lengthen or shorten durations")
34
37
        self.action_group = "main-unsafe"
35
38
 
45
48
    def __init__(self):
46
49
        """Initialize a :class:`ConvertFramerateAction` object."""
47
50
        gaupol.Action.__init__(self, "convert_framerate")
48
 
        self.props.label = _("Convert _Framerate\342\200\246")
 
51
        self.props.label = _("Convert _Framerate…")
49
52
        self.props.tooltip = _("Change positions for a different framerate")
50
53
        self.action_group = "main-unsafe"
51
54
 
63
66
        """Initialize a :class:`PreviewAction` object."""
64
67
        gaupol.Action.__init__(self, "preview")
65
68
        self.props.label = _("_Preview")
66
 
        self.props.stock_id = gtk.STOCK_MEDIA_PLAY
 
69
        self.props.stock_id = Gtk.STOCK_MEDIA_PLAY
67
70
        self.props.tooltip = _("Preview from selected position "
68
71
                               "with a video player")
69
72
 
76
79
        aeidon.util.affirm(page.project.video_path is not None)
77
80
        if gaupol.conf.preview.use_custom_command:
78
81
            aeidon.util.affirm(gaupol.conf.preview.custom_command)
79
 
        col = page.view.get_focus()[1]
80
 
        if col == page.view.columns.TRAN_TEXT:
81
 
            aeidon.util.affirm(page.project.tran_file is not None)
82
 
        else: # Any other column previews the main file.
83
 
            aeidon.util.affirm(page.project.main_file is not None)
84
82
 
85
83
 
86
84
class ShiftPositionsAction(gaupol.Action):
90
88
    def __init__(self):
91
89
        """Initialize a :class:`ShiftPositionsAction` object."""
92
90
        gaupol.Action.__init__(self, "shift_positions")
93
 
        self.props.label = _("_Shift Positions\342\200\246")
 
91
        self.props.label = _("_Shift Positions…")
94
92
        self.props.tooltip = _("Make subtitles appear earlier or later")
95
93
        self.accelerator = "H"
96
94
        self.action_group = "main-unsafe"
100
98
        aeidon.util.affirm(page is not None)
101
99
 
102
100
 
 
101
class SpeechRecognitionAction(gaupol.Action):
 
102
 
 
103
    """Generate subtitles by voice and speech recognition."""
 
104
 
 
105
    def __init__(self):
 
106
        """Initialize a :class:`SpeechRecognitionAction` object."""
 
107
        gaupol.Action.__init__(self, "speech_recognition")
 
108
        self.props.label = _("Sp_eech Recognition…")
 
109
        self.props.tooltip = _("Generate subtitles by voice "
 
110
                               "and speech recognition")
 
111
 
 
112
        self.action_group = "main-safe"
 
113
 
 
114
    def _affirm_doable(self, application, page):
 
115
        """Raise :exc:`aeidon.AffirmationError` if action cannot be done."""
 
116
        aeidon.util.affirm(gaupol.util.gst_available())
 
117
        aeidon.util.affirm(gaupol.util.pocketsphinx_available())
 
118
 
 
119
 
103
120
class TransformPositionsAction(gaupol.Action):
104
121
 
105
122
    """Change positions by linear two-point correction."""
107
124
    def __init__(self):
108
125
        """Initialize a :class:`TransformPositionsAction` object."""
109
126
        gaupol.Action.__init__(self, "transform_positions")
110
 
        self.props.label = _("_Transform Positions\342\200\246")
 
127
        self.props.label = _("_Transform Positions…")
111
128
        self.props.tooltip = _("Change positions by linear "
112
129
                               "two-point correction")
113
130
 
119
136
        aeidon.util.affirm(len(page.project.subtitles) > 1)
120
137
 
121
138
 
122
 
__all__ = tuple(filter(lambda x: x.endswith("Action"), dir()))
 
139
__all__ = tuple(x for x in dir() if x.endswith("Action"))