1 from gi.repository
import Gtk
as gtk, Pango
14 where_cond =
'Batch_Num = ? and Batch_Order = ?',
21 [
'clip_id',
'Participant_Num',
'Question_Rating'],
29 where_cond =
'Batch_Num = ?',
45 if (self.
order_num - 1) == num_clips
or num_clips == 1:
48 elif (self.
order_num - 1) % self.props.break_interval == 0:
50 self.pause_grid.show_all()
57 UIUtils.show_message_dialog(
'Testing complete! Thanks for your help.')
63 where_cond =
'Batch_Num = ? and Batch_Order = ?',
66 filename, age = row[0]
74 map(
lambda button: button.set_sensitive(
False), self.
scale_buttons)
75 while gtk.events_pending():
78 time.sleep(self.props.inter_clip_sound_del)
83 wav_parser.play_clip(0, wav_parser.get_sound_len())
86 map(
lambda button: button.set_sensitive(
True), self.
scale_buttons)
90 self.pause_grid.hide()
91 self.test_grid.show_all()
98 label = gtk.Label(
'Click the button below when you\'re ready to continue.')
99 vbox.pack_start(label,
False,
False, 0)
101 button = gtk.Button(
'Continue')
102 button.connect(
'clicked',
lambda w: self.
_continue(db))
104 hbox.pack_start(button,
True,
False, 0)
105 vbox.pack_start(hbox,
True,
True, 10)
110 icon = UIUtils.BUTTON_ICONS.VOLUME_OFF
112 icon = UIUtils.BUTTON_ICONS.VOLUME_ON
114 icon_path = UIUtils.get_icon_path(
116 UIUtils.BUTTON_ICON_SIZES.PX64
119 self.playing_icon.set_from_file(icon_path)
121 while gtk.events_pending():
128 self.progress.set_orientation(gtk.Orientation.HORIZONTAL)
132 grid.attach(self.
progress, 0, 0, 5, 1)
140 question_label = gtk.Label(
'How much does this sentence sound like a question?')
141 UIUtils.set_font_size(question_label, 30, bold=
True)
142 grid.attach(question_label, 0, 1, 5, 1)
145 self.playing_icon.set_vexpand(
True)
146 self.playing_icon.set_vexpand_set(
True)
151 button_grid = gtk.Grid()
152 button_grid.set_column_homogeneous(
True)
154 label_low = gtk.Label(
'Not Very Much like a Question')
155 label_low.set_alignment(0, 0)
156 UIUtils.set_font_size(label_low, 20, bold=
True)
157 button_grid.attach(label_low, 0, 0, 2, 1)
159 label_high = gtk.Label(
'Very Much like a Question')
160 label_high.set_alignment(1, 0)
161 UIUtils.set_font_size(label_high, 20, bold=
True)
162 button_grid.attach(label_high, self.props.num_options - 2, 0, 2, 1)
164 for i
in range(self.props.num_options):
165 button = gtk.Button(
'\n' + str(i + 1) +
'\n')
166 UIUtils.set_font_size(button, 15, bold=
True)
167 button.connect(
'button-release-event',
lambda w, e: self.
_next(db, int(w.get_label())))
168 button.set_vexpand(
False)
169 button.set_vexpand_set(
False)
171 self.scale_buttons.append(button)
172 button.set_hexpand(
True)
173 button.set_hexpand_set(
True)
174 button_grid.attach(button, i, 1, 1, 1)
176 grid.attach(button_grid, 0, 3, 5, 1)
180 def __init__(self, db, batch_num, participant_num):
190 self.
window = gtk.Window(gtk.WindowType.TOPLEVEL)
191 self.window.set_title(
'Batch %d' % (batch_num))
194 self.window.connect(
'destroy',
lambda w: self.window.destroy())
195 self.window.set_border_width(10)
196 self.window.set_size_request(800, 600)
201 vbox.pack_start(self.
test_grid,
True,
True, 0)
202 self.test_grid.hide()
205 vbox.pack_start(self.
pause_grid,
True,
False, 0)
206 self.pause_grid.show_all()
208 self.window.add(vbox)