示例#1
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('Reliability App')
        self.window.connect('destroy', lambda x: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(210, 150)

        box = gtk.VBox(False, 5)
        create_button = UIUtils.create_button('Create Check',
                                              UIUtils.BUTTON_ICONS.CREATE)
        create_button.connect('clicked',
                              lambda widget, data=None: CreateWindow())
        box.pack_start(create_button, False, False, 0)
        create_button.show()

        load_button = UIUtils.create_button('Load Check',
                                            UIUtils.BUTTON_ICONS.RUN)
        load_button.connect('clicked', lambda widget, data=None: LoadWindow())
        box.pack_start(load_button, False, False, 0)
        load_button.show()

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda widget: gtk.main_quit())
        box.pack_start(exit_button, False, False, 0)
        exit_button.show()

        self.window.add(box)
        box.show()
        self.window.show()
示例#2
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('TRS Splitter')
        self.window.connect('destroy', lambda w: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(150, 100)

        box = gtk.VBox(False, 5)
        split_button = UIUtils.create_button('Split File',
                                             UIUtils.BUTTON_ICONS.SPLIT)
        split_button.connect('clicked', lambda w: self.split_file())
        box.pack_start(split_button, False, False, 0)
        split_button.show()

        merge_button = UIUtils.create_button('Merge Files',
                                             UIUtils.BUTTON_ICONS.MERGE)
        merge_button.connect('clicked', lambda w: self.merge_files())
        box.pack_start(merge_button, False, False, 0)
        merge_button.show()

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda w: gtk.main_quit())
        box.pack_start(exit_button, False, False, 0)
        exit_button.show()

        self.window.add(box)
        box.show()
        self.window.show()
示例#3
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('Statistics Application')
        self.window.set_border_width(10)
        self.window.set_default_size(600, 450)
        self.window.connect('destroy', lambda x: gtk.main_quit())

        vbox = gtk.VBox()

        treeview = self._build_treeview()
        scrolled_win = gtk.ScrolledWindow()
        scrolled_win.set_policy(gtk.PolicyType.AUTOMATIC,
                                gtk.PolicyType.AUTOMATIC)
        scrolled_win.add(treeview)
        vbox.pack_start(scrolled_win, True, True, 0)

        button_box = gtk.HButtonBox()
        button_box.set_layout(gtk.ButtonBoxStyle.EDGE)

        create_button = UIUtils.create_button('Create Configuration',
                                              UIUtils.BUTTON_ICONS.CREATE)
        create_button.connect(
            'clicked',
            lambda w: ConfigWindow(lambda new_config: self._add_callback(
                treeview.get_model(), new_config)))
        button_box.pack_start(create_button, True, True, 0)

        edit_button = UIUtils.create_button('Edit Configuration',
                                            UIUtils.BUTTON_ICONS.EDIT)
        edit_button.connect('clicked', lambda w: self._edit_config(treeview))
        button_box.pack_start(edit_button, True, True, 0)

        run_button = UIUtils.create_button('Run Configuration',
                                           UIUtils.BUTTON_ICONS.RUN)
        run_button.connect('clicked', lambda w: self._run_config(treeview))
        button_box.pack_start(run_button, True, True, 0)

        delete_button = UIUtils.create_button('Delete',
                                              UIUtils.BUTTON_ICONS.DELETE)
        delete_button.connect('clicked',
                              lambda w: self._delete_config(treeview))
        button_box.pack_start(delete_button, True, True, 0)

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda w: gtk.main_quit())
        button_box.pack_start(exit_button, True, True, 0)

        vbox.pack_end(button_box, False, False, 0)

        self.window.add(vbox)
        self.window.show_all()
示例#4
0
    def _build_toolbar(self, db, treeview, col_headers):
        toolbar = gtk.Toolbar()

        clear_img_path = UIUtils.get_icon_path(UIUtils.BUTTON_ICONS.CLEAR, UIUtils.BUTTON_ICON_SIZES.PX16)
        #clear_pixbuf = gtk.gdk.pixbuf_new_from_file(clear_img_path)
        clear_pixbuf = GdkPixbuf.Pixbuf.new_from_file(clear_img_path)

        search_entry = gtk.Entry()
        search_entry.set_sensitive(False)
        search_entry.set_text(FilterWindow.get_filters_desc(self.filters, col_headers))
        
        filter_button = UIUtils.create_button('Filters', UIUtils.BUTTON_ICONS.FILTER, UIUtils.BUTTON_ICON_SIZES.PX16)
        filter_button.connect('clicked', lambda w: self._update_filters(db, treeview.get_model(), col_headers, search_entry))

        play_button = UIUtils.create_button('Play', UIUtils.BUTTON_ICONS.PLAY, UIUtils.BUTTON_ICON_SIZES.PX16)
        play_button.connect('clicked', lambda w: self._play_selected_row(col_headers, treeview))
        praat_button = UIUtils.create_button('Praat', UIUtils.BUTTON_ICONS.PRAAT, UIUtils.BUTTON_ICON_SIZES.PX16)
        praat_button.connect('clicked', lambda w: self._open_in_praat(col_headers, treeview))

        export_button = UIUtils.create_button('Export', UIUtils.BUTTON_ICONS.EXPORT, UIUtils.BUTTON_ICON_SIZES.PX16)
        export_button.connect('clicked', lambda w: self._export(treeview, col_headers, db))

        context_label = gtk.Label('Context')
        context_adj = gtk.Adjustment(value=0, lower=0, upper=99, step_increment=1)
        self.context_spinner = gtk.SpinButton()
        self.context_spinner.set_adjustment(context_adj)
        self.context_spinner.set_numeric(True)

        spacer = gtk.SeparatorToolItem()
        spacer.set_draw(False) #don't draw a vertical line
        spacer.set_expand(True)

        filter_label = gtk.Label('Filter state:')

        for widget in [filter_label, search_entry, filter_button, praat_button, play_button, self.context_spinner, context_label]:
            tool_item = gtk.ToolItem()
            tool_item.add(widget)
            if widget == search_entry:
                tool_item.set_expand(True)
            toolbar.insert(tool_item, -1)
        
        toolbar.insert(spacer, -1)

        tool_item = gtk.ToolItem()
        tool_item.add(export_button)
        toolbar.insert(tool_item, -1)
        
        return toolbar
示例#5
0
    def _build_button_box(self):
        button_box = gtk.HButtonBox()
        button_box.set_layout(gtk.ButtonBoxStyle.EDGE)

        back_button = gtk.Button(stock=gtk.STOCK_GO_BACK)
        button_box.add(back_button)
        save_button = UIUtils.create_button('Save & Exit',
                                            UIUtils.BUTTON_ICONS.SAVE,
                                            UIUtils.BUTTON_ICON_SIZES.PX32)
        button_box.add(save_button)
        next_button = gtk.Button(stock=gtk.STOCK_GO_FORWARD)
        button_box.add(next_button)

        next_handler = lambda w: self.next_test2(back_button, next_button)

        if self.check2.test2_index >= len(self.check2.test2s) - 1:
            next_button.set_label(gtk.STOCK_OK)
            next_handler = lambda w: self.save_and_export()

        self.handler_man.add_handler(next_button, 'clicked', next_handler)
        self.handler_man.add_handler(
            back_button, 'clicked',
            lambda w: self.back_test2(back_button, next_button))
        self.handler_man.add_handler(
            save_button, 'clicked', lambda w: self.window.destroy()
        )  #this will call save_and_exit() since the window 'destroy' signal is connected to that method (see constructor)

        back_button.set_sensitive(self.check2.test2_index > 0)
        next_button.set_sensitive(
            self.check2.test2_index < len(self.check2.test2s))

        return button_box
示例#6
0
    def _build_button_box(self):
        box = gtk.HButtonBox()
        box.set_layout(gtk.ButtonBoxStyle.EDGE)

        self.button_form.back_button = gtk.Button(stock=gtk.STOCK_GO_BACK)
        self.button_form.handler_man.add_handler(self.button_form.back_button,
                                                 'clicked',
                                                 lambda w: self._back())

        self.button_form.save_button = UIUtils.create_button(
            'Save & Exit', UIUtils.BUTTON_ICONS.SAVE,
            UIUtils.BUTTON_ICON_SIZES.PX32)
        self.button_form.handler_man.add_handler(self.button_form.save_button,
                                                 'clicked',
                                                 lambda w: self._exit())

        self.button_form.forward_button = gtk.Button(
            stock=gtk.STOCK_GO_FORWARD)
        self.button_form.handler_man.add_handler(
            self.button_form.forward_button, 'clicked',
            lambda w: self._forward())

        self._update_step_buttons()

        box.pack_start(self.button_form.back_button, False, False, 0)
        box.pack_start(self.button_form.save_button, False, False, 0)
        box.pack_end(self.button_form.forward_button, False, False, 0)

        return box
示例#7
0
    def _build_wo_context_frame(self):
        cur_test = self.check.tests[self.check.test_index]
        frame = gtk.Frame(label='Without Context')

        #table = gtk.Table(1, 3, False)
        grid = gtk.Grid()

        self.wo_form.play_button = UIUtils.create_button(
            '', UIUtils.BUTTON_ICONS.PLAY, UIUtils.BUTTON_ICON_SIZES.PX32)
        self.wo_form.handler_man.add_handler(self.wo_form.play_button,
                                             'clicked',
                                             lambda w: self.play_seg(0))
        #table.attach(self.wo_form.play_button, 0, 1, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.wo_form.play_button, 0, 0, 1, 1)

        syllables_label = gtk.Label('Syllables:')
        syllables_adj = gtk.Adjustment(value=0,
                                       lower=0,
                                       upper=1000,
                                       step_incr=1,
                                       page_incr=5)
        self.wo_form.syllables_spinner = gtk.SpinButton(syllables_adj)
        #table.attach(syllables_label, 1, 2, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(syllables_label, 1, 0, 1, 1)
        #table.attach(self.wo_form.syllables_spinner, 2, 3, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.wo_form.syllables_spinner, 2, 0, 1, 1)

        frame.add(grid)

        return frame
示例#8
0
    def __init__(self, label='Filters', existing_filters=[]):
        super(FiltersFrame, self).__init__(label=label)

        vbox = gtk.VBox()
        #build the treeview (list of current filters)
        list_store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
                                   gobject.TYPE_PYOBJECT)

        self.treeview = gtk.TreeView(list_store)

        col_names = ['Type', 'Description']
        for i in range(len(col_names)):
            col = gtk.TreeViewColumn(col_names[i],
                                     gtk.CellRendererText(),
                                     text=i)
            col.set_resizable(True)
            self.treeview.append_column(col)

        #if we have any already-existing filters, add them to the treeview model so that they are displayed
        model = self.treeview.get_model()
        for cur_filter in existing_filters:
            model.append([
                cur_filter.get_filter_type_str(),
                cur_filter.get_filter_desc_str(), cur_filter
            ])

        vbox.pack_start(self.treeview, True, True, 0)

        #create buttons for adding and removing filters
        button_box = gtk.HButtonBox()
        add_button = UIUtils.create_button('Add Filter',
                                           UIUtils.BUTTON_ICONS.ADD,
                                           UIUtils.BUTTON_ICON_SIZES.PX22)
        add_button.connect('clicked',
                           lambda w: AddFilterWindow(self._add_filter))
        remove_button = UIUtils.create_button('Remove Filter',
                                              UIUtils.BUTTON_ICONS.REMOVE,
                                              UIUtils.BUTTON_ICON_SIZES.PX22)
        remove_button.connect('clicked', lambda w: self._remove_filter())
        button_box.add(add_button)
        button_box.add(remove_button)

        vbox.pack_start(button_box, False, False, 0)
        self.add(vbox)
示例#9
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('WH-Frequency Counter')
        self.window.connect('destroy', lambda w: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(150, 100)

        box = gtk.VBox(False, 5)
        open_button = UIUtils.create_button('Open TRS File',
                                            UIUtils.BUTTON_ICONS.OPEN)
        open_button.connect('clicked', lambda w: self.open_file())
        box.pack_start(open_button, False, False, 0)
        open_button.show()

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda w: gtk.main_quit())
        box.pack_start(exit_button, False, False, 0)
        exit_button.show()

        self.window.add(box)
        box.show()
        self.window.show()
示例#10
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('Transcription Verifier')
        self.window.connect('destroy', lambda w: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(150, 100)
                                         
        box = gtk.VBox(False, 5)
        open_button = UIUtils.create_button('Check TRS File', UIUtils.BUTTON_ICONS.OPEN)
        open_button.connect('clicked', lambda w: self.open_file())
        box.pack_start(open_button, False, False, 0)

        comp_button = UIUtils.create_button('Compare Files', UIUtils.BUTTON_ICONS.MERGE)
        comp_button.connect('clicked', lambda w: self.compare_files())
        box.pack_start(comp_button, False, False, 0)

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda w: gtk.main_quit())
        box.pack_start(exit_button, False, False, 0)

        self.window.add(box)
        self.window.show_all()
示例#11
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('Naptime Filter')
        self.window.connect('destroy', lambda x: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(210, 150)

        box = gtk.VBox(False, 5)
        update_button = UIUtils.create_button('Update Database',
                                              UIUtils.BUTTON_ICONS.UPDATE)
        update_button.connect('clicked', lambda widget, data=None: DBWindow())
        box.pack_start(update_button, False, False, 0)
        update_button.show()

        filter_file_button = UIUtils.create_button('Filter File',
                                                   UIUtils.BUTTON_ICONS.CREATE)
        filter_file_button.connect(
            'clicked', lambda widget, data=None: self._filter_file())
        box.pack_start(filter_file_button, False, False, 0)
        filter_file_button.show()

        filter_folder_button = UIUtils.create_button('Filter Folder',
                                                     UIUtils.BUTTON_ICONS.OPEN)
        filter_folder_button.connect(
            'clicked', lambda widget, data=None: self._filter_folder())
        box.pack_start(filter_folder_button, False, False, 0)
        filter_folder_button.show()

        exit_button = UIUtils.create_button('Exit', UIUtils.BUTTON_ICONS.EXIT)
        exit_button.connect('clicked', lambda widget: gtk.main_quit())
        box.pack_start(exit_button, False, False, 0)
        exit_button.show()

        self.window.add(box)
        box.show()
        self.window.show()
示例#12
0
    def __init__(self):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('ITS Anonymity')
        self.window.connect('destroy', lambda w: gtk.main_quit())
        self.window.set_border_width(10)
        self.window.set_default_size(240, 320)

        box = gtk.VBox(False, 5)
        open_button = UIUtils.create_button('Open ITS File',
                                            UIUtils.BUTTON_ICONS.OPEN)
        open_button.connect('clicked', lambda w: self.open_file())
        box.pack_start(open_button, True, True, 0)

        config_button = UIUtils.create_button('Configure template',
                                              UIUtils.BUTTON_ICONS.MERGE)
        config_button.connect('clicked', lambda w: self.open_config())
        box.pack_start(config_button, True, True, 0)

        run_button = UIUtils.create_button('Run', UIUtils.BUTTON_ICONS.RUN)
        run_button.connect('clicked', lambda w: self.run())
        box.pack_start(run_button, True, True, 0)

        self.window.add(box)
        self.window.show_all()
示例#13
0
    def _build_button_box(self, treeview):
        button_box = gtk.HButtonBox()
        button_box.set_layout(gtk.ButtonBoxStyle.EDGE)

        cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
        cancel_button.connect('clicked', lambda w: self.window.destroy())
        button_box.add(cancel_button)

        delete_button = UIUtils.create_button('Delete',
                                              UIUtils.BUTTON_ICONS.DELETE,
                                              UIUtils.BUTTON_ICON_SIZES.PX32)
        delete_button.connect('clicked', lambda w: self.delete_check(treeview))
        button_box.add(delete_button)

        ok_button = gtk.Button(stock=gtk.STOCK_OK)
        ok_button.connect('clicked', lambda w: self.load_check(treeview))
        button_box.add(ok_button)

        return button_box
示例#14
0
    def __init__(self, action_callback, edit_config=None):
        self.edit_config = edit_config
        self.action_callback = action_callback

        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('%s Configuration' %
                              ('Edit' if self.edit_config else 'Create'))
        self.window.set_border_width(10)
        self.window.set_default_size(500, 350)

        vbox = gtk.VBox()

        #properties frame
        props_frame = gtk.Frame(label='Properties')
        grid = gtk.Grid()  #gtk.Table(3, 2)
        grid.set_column_spacing(3)
        name_label = gtk.Label('Name:')
        self.name_entry = gtk.Entry()
        self.name_entry.set_width_chars(50)
        if self.edit_config:
            self.name_entry.set_text(self.edit_config.name)

        #It appears that proper alignment can only be acheived with HBoxes here...
        name_label_hbox = gtk.HBox()
        align = gtk.Alignment()
        align.set(1, 0, 0, 0)
        name_label_hbox.pack_start(align, True, True, 0)
        name_label_hbox.pack_start(name_label, False, False, 0)
        #table.attach(name_label_hbox, 0, 1, 0, 1)
        grid.attach(name_label_hbox, 0, 0, 1, 1)

        name_entry_hbox = gtk.HBox()
        name_entry_hbox.pack_start(self.name_entry, False, False, 0)
        #table.attach(name_entry_hbox, 1, 2, 0, 1)
        grid.attach(name_entry_hbox, 1, 0, 1, 1)

        desc_label = gtk.Label('Description:')
        self.desc_entry = gtk.Entry()
        self.desc_entry.set_width_chars(50)
        if self.edit_config:
            self.desc_entry.set_text(self.edit_config.desc)

        desc_label_hbox = gtk.HBox()
        align = gtk.Alignment()
        align.set(1, 0, 0, 0)
        desc_label_hbox.pack_start(align, True, True, 0)
        desc_label_hbox.pack_start(desc_label, False, False, 0)
        #table.attach(desc_label_hbox, 0, 1, 1, 2)
        grid.attach(desc_label_hbox, 0, 1, 1, 1)

        desc_entry_hbox = gtk.HBox()
        desc_entry_hbox.pack_start(self.desc_entry, False, False, 0)
        #table.attach(desc_entry_hbox, 1, 2, 1, 2)#, ypadding=3) #ypadding adds some space between bottom of entry and bottom of frame border
        grid.attach(desc_entry_hbox, 1, 1, 1, 1)

        self.output_overview = gtk.CheckButton(
            'Generate an overview file as well')
        grid.attach(self.output_overview, 1, 2, 1, 1)

        props_frame.add(grid)

        vbox.pack_start(props_frame, False, False, 0)

        #outputs frame
        outputs_frame = gtk.Frame(label='Outputs')
        outputs_vbox = gtk.VBox()
        existing_outputs = self.edit_config.outputs if self.edit_config else []
        self.outputs_treeview = self._build_outputs_treeview(existing_outputs)
        scrolled_win = gtk.ScrolledWindow()
        scrolled_win.set_policy(gtk.PolicyType.AUTOMATIC,
                                gtk.PolicyType.AUTOMATIC)
        scrolled_win.add(self.outputs_treeview)
        outputs_vbox.pack_start(scrolled_win, True, True, 0)

        outputs_button_box = gtk.HButtonBox()
        outputs_button_box.set_layout(gtk.ButtonBoxStyle.EDGE)

        add_button = UIUtils.create_button('Add Output',
                                           UIUtils.BUTTON_ICONS.ADD,
                                           UIUtils.BUTTON_ICON_SIZES.PX22)
        add_button.connect('clicked',
                           lambda w: OutputWindow(self._add_output_callback))
        outputs_button_box.pack_start(add_button, True, True, 0)

        edit_button = UIUtils.create_button('Edit Output',
                                            UIUtils.BUTTON_ICONS.EDIT,
                                            UIUtils.BUTTON_ICON_SIZES.PX22)
        edit_button.connect('clicked', lambda w: self._edit_output())
        outputs_button_box.pack_start(edit_button, True, True, 0)

        remove_button = UIUtils.create_button('Remove Output',
                                              UIUtils.BUTTON_ICONS.REMOVE,
                                              UIUtils.BUTTON_ICON_SIZES.PX22)
        remove_button.connect('clicked', lambda w: self._remove_output())
        outputs_button_box.pack_start(remove_button, True, True, 0)

        outputs_vbox.pack_start(outputs_button_box, False, False, 0)
        outputs_frame.add(outputs_vbox)

        vbox.pack_start(outputs_frame, True, True, 0)

        #buttons box
        button_box = gtk.HButtonBox()
        button_box.set_layout(gtk.ButtonBoxStyle.EDGE)
        cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
        cancel_button.connect('clicked', lambda w: self.window.destroy())
        button_box.pack_start(cancel_button, False, False, 0)

        ok_button = gtk.Button(stock=gtk.STOCK_OK)
        ok_button.connect('clicked', lambda w: self._create_config())
        button_box.pack_start(ok_button, False, False, 0)

        vbox.pack_end(button_box, False, False, 0)

        self.window.add(vbox)
        self.window.show_all()
示例#15
0
    def __init__(self, filename, progress_dialog):
        self.window = gtk.Window(gtk.WindowType.TOPLEVEL)
        self.window.set_title('WH-Frequency Counter')
        self.window.set_border_width(10)
        self.window.set_default_size(730, 400)

        self.logger = logging.getLogger(__name__)

        self.count_cols = self._get_initial_count_cols()
        self.trs_parser = TRSParser(filename)
        segments = self.trs_parser.parse(
            progress_update_fcn=progress_dialog.set_fraction,
            progress_next_phase_fcn=progress_dialog.next_phase,
            validate=False,
            seg_filters=[])

        self.filter_manager = FilterManager(
            segments
        )  #this object caches original segs and helps with lookup by segment number
        calc = CountOutputCalc('', CountOutputCalc.COUNT_TYPES.PER_SEG, 1)
        self.output = Output(
            '', '', [WHQFilter()], calc, False
        )  #this object filters and allows us to retrieve the filtered segs
        map(lambda seg: self.output.add_item(seg), segments)

        treeview = self._build_treeview()
        #ensure progress dialog self-destructs even if no utterances are found (in that case the above call never invokes progress_dialog.set_fraction)
        progress_dialog.ensure_finish()

        scrolled_win = gtk.ScrolledWindow()
        scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrolled_win.add(treeview)

        export_button = UIUtils.create_button('Export Results',
                                              UIUtils.BUTTON_ICONS.EXPORT)
        export_button.connect('clicked',
                              lambda widget: self._export_results(treeview))

        close_button = UIUtils.create_button('Close',
                                             UIUtils.BUTTON_ICONS.CLOSE)
        close_button.connect('clicked', lambda w: self.window.destroy())

        add_button = UIUtils.create_button('Add Count Column',
                                           UIUtils.BUTTON_ICONS.ADD)
        add_button.connect('clicked', lambda w: self._add_count_col(treeview))

        self.remove_button = UIUtils.create_button('Remove Count Column',
                                                   UIUtils.BUTTON_ICONS.REMOVE)
        self.remove_button.connect('clicked',
                                   lambda w: self._remove_count_col(treeview))
        self._update_remove_button_state()

        options_frame = gtk.Frame(label='Options')
        options_vbox = gtk.VBox()
        self.linked_checkbox = gtk.CheckButton('Group Linked Segments')
        self.linked_checkbox.connect('toggled', self._toggle_seg_grouping,
                                     treeview)
        options_vbox.pack_start(self.linked_checkbox, False, False, 0)

        self.context_checkbox = gtk.CheckButton('Show Context')
        self.context_checkbox.connect('toggled', self._toggle_show_context,
                                      treeview)
        options_vbox.pack_start(self.context_checkbox, False, False, 0)

        options_frame.add(options_vbox)

        self.statusbar = gtk.Statusbar()
        self.statusbar.set_has_resize_grip(False)
        self.num_whq = treeview.get_model().iter_n_children(None)
        self._update_statusbar()

        vbox = gtk.VBox()

        bbox = gtk.HButtonBox()
        bbox.pack_start(export_button, True, False, 0)
        bbox.pack_start(add_button, True, False, 0)
        bbox.pack_start(self.remove_button, True, False, 0)
        bbox.pack_start(close_button, True, False, 0)

        vbox.pack_start(scrolled_win, True, True, 0)
        vbox.pack_start(self.statusbar, False, False, 0)
        vbox.pack_end(bbox, False, False, 0)
        vbox.pack_end(options_frame, False, False, 0)
        self.window.add(vbox)

        self.window.show_all()
示例#16
0
    def _build_w_context_frame(self):
        cur_test = self.check.tests[self.check.test_index]
        frame = gtk.Frame(label='With Context')

        #table = gtk.Table(6, 4, False)
        grid = gtk.Grid()

        play_button = UIUtils.create_button('', UIUtils.BUTTON_ICONS.PLAY,
                                            UIUtils.BUTTON_ICON_SIZES.PX32)
        #table.attach(play_button, 0, 1, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(play_button, 0, 0, 1, 1)

        type_label = gtk.Label('Seg Category:')
        #table.attach(type_label, 1, 2, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(type_label, 1, 0, 1, 1)

        self.w_form.type_combo = UIUtils.build_options_combo(
            DBConstants.COMBO_GROUPS.RELIABILITY_CATEGORIES)
        #table.attach(self.w_form.type_combo, 2, 3, 0, 1, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.w_form.type_combo, 2, 0, 1, 1)

        uncertain_label = gtk.Label('Other/Uncertain:')
        self.w_form.uncertain_checkbox = gtk.CheckButton()
        #table.attach(uncertain_label, 1, 2, 1, 2, gtk.EXPAND, gtk.EXPAND)
        grid.attach(uncertain_label, 1, 1, 1, 1)
        #table.attach(self.w_form.uncertain_checkbox, 2, 3, 1, 2, gtk.EXPAND|gtk.FILL, gtk.EXPAND|gtk.FILL)
        grid.attach(self.w_form.uncertain_checkbox, 2, 1, 1, 1)

        padding_label = gtk.Label('Padding:')
        context_pad_adj = gtk.Adjustment(value=0,
                                         lower=1,
                                         upper=1000,
                                         step_incr=1,
                                         page_incr=5)
        self.w_form.context_pad_spinner = gtk.SpinButton(context_pad_adj)
        #table.attach(padding_label, 1, 2, 2, 3, gtk.EXPAND, gtk.EXPAND)
        grid.attach(padding_label, 1, 2, 1, 1)
        #table.attach(self.w_form.context_pad_spinner, 2, 3, 2, 3, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.w_form.context_pad_spinner, 2, 2, 1, 1)

        self.w_form.handler_man.add_handler(
            play_button, 'clicked', lambda w: self.play_seg(
                int(self.w_form.context_pad_spinner.get_value())))

        syllables_label = gtk.Label('Syllables:')
        syllables_adj = gtk.Adjustment(value=0,
                                       lower=0,
                                       upper=1000,
                                       step_incr=1,
                                       page_incr=5)
        self.w_form.syllables_spinner = gtk.SpinButton(syllables_adj)
        #table.attach(syllables_label, 1, 2, 3, 4, gtk.EXPAND, gtk.EXPAND)
        grid.attach(syllables_label, 1, 3, 1, 1)
        #table.attach(self.w_form.syllables_spinner, 2, 3, 3, 4, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.w_form.syllables_spinner, 2, 3, 1, 1)

        user_start_label = gtk.Label('User Start:')
        self.w_form.user_start_entry = gtk.Entry()
        self.w_form.user_start_entry.set_width_chars(10)
        #table.attach(user_start_label, 1, 2, 4, 5, gtk.EXPAND, gtk.EXPAND)
        grid.attach(user_start_label, 1, 4, 1, 1)
        #table.attach(self.w_form.user_start_entry, 2, 3, 4, 5, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.w_form.user_start_entry, 2, 5, 1, 1)

        user_end_label = gtk.Label('User End:')
        self.w_form.user_end_entry = gtk.Entry()
        self.w_form.user_end_entry.set_width_chars(10)
        #table.attach(user_end_label, 1, 2, 5, 6, gtk.EXPAND, gtk.EXPAND)
        grid.attach(user_end_label, 1, 5, 1, 1)
        #table.attach(self.w_form.user_end_entry, 2, 3, 5, 6, gtk.EXPAND, gtk.EXPAND)
        grid.attach(self.w_form.user_end_entry, 2, 5, 1, 1)

        open_praat_button = gtk.Button('Open Praat')
        #table.attach(open_praat_button, 3, 4, 4, 5, gtk.EXPAND, gtk.EXPAND)
        grid.attach(open_praat_button, 3, 4, 1, 1)
        self.w_form.handler_man.add_handler(open_praat_button, 'clicked',
                                            lambda w: self._open_praat())

        close_praat_button = gtk.Button('Close Praat')
        #table.attach(close_praat_button, 3, 4, 5, 6, gtk.EXPAND, gtk.EXPAND)
        grid.attach(close_praat_button, 3, 5, 1, 1)
        self.w_form.handler_man.add_handler(close_praat_button, 'clicked',
                                            lambda w: self._close_praat())

        frame.add(grid)

        return frame