Baby Language Lab Scripts
A collection of data processing tools.
 All Classes Namespaces Files Functions Variables Pages
main_window.py
Go to the documentation of this file.
1 from gi.repository import Gtk as gtk
2 from ui.verifier_app.verification_window import VerificationWindow
3 from utils.ui_utils import UIUtils
4 from utils.progress_dialog import ProgressDialog
5 from ui.verifier_app.open_pair_window import OpenPairWindow
6 
7 class MainWindow():
8  def __init__(self):
9  self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
10  self.window.set_title('Transcription Verifier')
11  self.window.connect('destroy', lambda w: gtk.main_quit())
12  self.window.set_border_width(10)
13  self.window.set_default_size(150, 100)
14 
15  box = gtk.VBox(False, 5)
16  open_button = UIUtils.create_button('Check TRS File', UIUtils.BUTTON_ICONS.OPEN)
17  open_button.connect('clicked', lambda w: self.open_file())
18  box.pack_start(open_button, False, False, 0)
19 
20  comp_button = UIUtils.create_button('Compare Files', UIUtils.BUTTON_ICONS.MERGE)
21  comp_button.connect('clicked', lambda w: self.compare_files())
22  box.pack_start(comp_button, False, False, 0)
23 
24  exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
25  exit_button.connect('clicked', lambda w: gtk.main_quit())
26  box.pack_start(exit_button, False, False, 0)
27 
28  self.window.add(box)
29  self.window.show_all()
30 
31  def open_file(self):
32  filename = UIUtils.open_file('Select trs file', [UIUtils.TRS_FILE_FILTER, UIUtils.ALL_FILE_FILTER])
33 
34  if filename:
35  progress_dialog = ProgressDialog('Processing File...', ['Parsing trs file...', 'Validating data...', 'Building UI...'])
36  progress_dialog.show()
37  VerificationWindow(filename, progress_dialog)
38 
39  def compare_files(self):