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 utils.ui_utils import UIUtils
3 from utils.progress_dialog import ProgressDialog
4 from ui.wh_freq_app.freq_window import FreqWindow
5 
6 class MainWindow():
7  def __init__(self):
8  self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
9  self.window.set_title('WH-Frequency Counter')
10  self.window.connect('destroy', lambda w: gtk.main_quit())
11  self.window.set_border_width(10)
12  self.window.set_default_size(150, 100)
13 
14  box = gtk.VBox(False, 5)
15  open_button = UIUtils.create_button('Open TRS File', UIUtils.BUTTON_ICONS.OPEN)
16  open_button.connect('clicked', lambda w: self.open_file())
17  box.pack_start(open_button, False, False, 0)
18  open_button.show()
19 
20  exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
21  exit_button.connect('clicked', lambda w: gtk.main_quit())
22  box.pack_start(exit_button, False, False, 0)
23  exit_button.show()
24 
25  self.window.add(box)
26  box.show()
27  self.window.show()
28 
29  def open_file(self):
30  filename = UIUtils.open_file('Select trs file', [UIUtils.TRS_FILE_FILTER, UIUtils.ALL_FILE_FILTER])
31 
32  if filename:
33  progress_dialog = ProgressDialog('Processing File...', ['Parsing trs file...'])
34  progress_dialog.show()
35  FreqWindow(filename, progress_dialog)