Ejemplo n.º 1
0
def chat_handler(buffer, message, channel=None, from_db=False):
    """from_db=True if showing chat history"""
    try:
        active_channel_sid = channels_window.current_value
        if channel == active_channel_sid:  # only show the message if the channel it was sent to is the active one
            output = output_field.text + message
            output_field.document = Document(
                text=output,
                cursor_position=len(output),
            )
    except BaseException as e:
        output = output_field.text + "{}\n".format(e)
        output_field.document = Document(
            text=output,
            cursor_position=len(output),
        )
    else:
        """When a user switches channels, we want to clear the messages
        in the current channel and show the messages from the new channel.
        When they come back to a previous channel, they expect to see the
        messages they left there (+new unread ones if any). Fetching all
        channel messages from the server each time would be expensive,
        so save chat in sqlite db and fetch from there."""
        if not from_db:
            try:
                msg_data = message.split(None, 2)
                c.execute('INSERT INTO history VALUES (NULL,?,?,?,?)',
                          (msg_data[0], msg_data[1], msg_data[2], channel))
                conn.commit()
                # show notification if user is @mentioned
                if f'@{identity}' in msg_data[2].split():
                    mentioned_channel = [
                        ch[1] for ch in utils.get_channels()
                        if ch[0] == channel
                    ][0]
                    n.update(
                        'cchat',
                        f'You\'ve been mentioned on #{mentioned_channel}')
                    n.show()
            except IndexError:
                # not a chat message
                pass
            except Exception as e:
                conn.rollback()
                output = output_field.text + "{}\n".format(e)
                output_field.document = Document(
                    text=output,
                    cursor_position=len(output),
                )
Ejemplo n.º 2
0
def main(argv):

    channels = get_channels(FLAGS.data_path)
    model = ImageHighResolution(FLAGS.data_path, FLAGS.num_threads,
                                FLAGS.batch_size, FLAGS.learning_rate,
                                FLAGS.input_height, FLAGS.input_width,
                                FLAGS.output_height, FLAGS.output_width,
                                channels)

    if FLAGS.mode == 'train':
        model.train(FLAGS.num_steps)
    elif FLAGS.mode == 'eval':
        pass
    elif FLAGS.mode == 'convert':
        pass
    else:
        pass
Ejemplo n.º 3
0
def command_handler(buffer):
    # input starting with '/' is treated as a command
    try:
        if input_field.text.startswith('/'):  # command
            cmd_response = utils.command_handler(input_field.text)
            output = f"{cmd_response}\n"
            new_text = output_field.text + output
            output_field.document = Document(
                text=new_text,
                cursor_position=len(new_text),
            )
            if cmd_response.find('Error') == -1 and \
                    input_field.text.find('channel') != -1:
                # channel command - refresh channel list
                channels_window.values = utils.get_channels()
                channels_window.current_value = general_ch
                output_window.title = "#general"
                c.execute('SELECT * FROM history WHERE channel=?',
                          (general_ch, ))
                chat_history = c.fetchall()
                output_field.document = Document(
                    text='',
                    cursor_position=0,
                )
                buffer = Application.current_buffer
                chat_handler(buffer, process_response(chat_history, True),
                             general_ch, True)
        elif input_field.text.strip():  # message
            utils.send_message(channels_window.current_value, input_field.text)
    except BaseException as e:
        output = f"\n\n{e}"
        new_text = output_field.text + output
        output_field.document = Document(
            text=new_text,
            cursor_position=len(new_text),
        )
Ejemplo n.º 4
0
    def __init__(self, handle):

        activity.Activity.__init__(self, handle, True)

        self.max_participants = 1

        # CHART_OPTIONS

        self._font_option = TITLE_FONT
        self.x_label = ''
        self.y_label = ''
        self.chart_color = utils.get_user_fill_color('str')
        self.chart_line_color = utils.get_user_stroke_color('str')
        self.current_chart = None
        self.charts_area = None
        self.chart_data = []
        self.chart_type_buttons = []
        self._font_options = {
            'titleColor': '#000000',
            'titleFont': 'Sans',
            'titleFontSize': 12,
            'axis': {
                'tickFont': 'Sans',
                'tickFontSize': 12,
                'tickColor': '#000000',
                'labelFontSize': 14,
                'labelColor': '#666666',
                'labelFont': 'Sans',
                'lineColor': '#b3b3b3'}}

        # TOOLBARS
        self._labels_font = RadioToolButton()
        self._title_font = RadioToolButton()

        toolbarbox = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        activity_btn_toolbar = activity_button.page

        activity_btn_toolbar.title.connect('changed', self._set_chart_title)

        save_as_image = ToolButton('save-as-image')
        save_as_image.connect('clicked', self._save_as_image)
        save_as_image.set_tooltip(_('Save as image'))
        activity_btn_toolbar.insert(save_as_image, -1)

        save_as_image.show()

        import_stopwatch = ToolButton('import-stopwatch')
        import_stopwatch.connect('clicked', self.__import_stopwatch_cb)
        import_stopwatch.set_tooltip(_('Read StopWatch data'))
        activity_btn_toolbar.insert(import_stopwatch, -1)

        import_stopwatch.show()

        import_measure = ToolButton('import-measure')
        import_measure.set_tooltip(_('Read Measure data'))

        if utils.get_channels() == 1:
            import_measure.connect('clicked', self.__import_measure_cb, 1)

        else:
            import_measure.connect('clicked', self._measure_btn_clicked)
            self._create_measure_palette(import_measure)

        activity_btn_toolbar.insert(import_measure, -1)
        import_measure.show()

        toolbarbox.toolbar.insert(activity_button, 0)

        add_v = ToolButton('gtk-add')
        add_v.connect('clicked', self._add_value)
        add_v.set_tooltip(_('Add a value'))

        toolbarbox.toolbar.insert(add_v, -1)

        remove_v = ToolButton('gtk-remove')
        remove_v.connect('clicked', self._remove_value)
        remove_v.set_tooltip(_('Remove the selected value'))

        toolbarbox.toolbar.insert(remove_v, -1)

        self._remove_v = remove_v

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        # We create two sets: one for the main toolbar and one for the
        # chart toolbar. We choose which set to use based on the
        # screen width.
        self._create_chart_buttons(toolbarbox.toolbar)

        self._chart_button = ToolbarButton(icon_name='vbar')
        chart_toolbar = Gtk.Toolbar()
        self._create_chart_buttons(chart_toolbar)
        self._chart_button.props.page = chart_toolbar
        chart_toolbar.show_all()
        toolbarbox.toolbar.insert(self._chart_button, -1)

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        self._options_button = ToolbarButton(icon_name='preferences-system')
        options_toolbar = Gtk.Toolbar()

        self.chart_color_btn = ColorToolButton()
        self.chart_color_btn.set_color(_COLOR1)
        self.chart_color_btn.set_title(_('Chart Color'))
        options_toolbar.insert(self.chart_color_btn, -1)
        GObject.timeout_add(1000,
                            self._connect_color_btn,
                            self.chart_color_btn,
                            self._set_chart_color)

        self.line_color_btn = ColorToolButton()
        self.line_color_btn.set_color(_COLOR2)
        self.line_color_btn.set_title(_('Line Color'))
        options_toolbar.insert(self.line_color_btn, -1)
        GObject.timeout_add(1000,
                            self._connect_color_btn,
                            self.line_color_btn,
                            self._set_chart_line_color)

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        options_toolbar.insert(separator, -1)

        h_label_icon = Icon(icon_name='hlabel')
        h_label_tool_item = Gtk.ToolItem()
        h_label_tool_item.add(h_label_icon)
        options_toolbar.insert(h_label_tool_item, -1)

        self.h_label = Entry(_('Horizontal label...'))
        self.h_label.entry.connect('changed', self._set_h_label)
        options_toolbar.insert(self.h_label, -1)

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(False)
        separator.set_expand(False)
        options_toolbar.insert(separator, -1)

        v_label_icon = Icon(icon_name='vlabel')
        v_label_tool_item = Gtk.ToolItem()
        v_label_tool_item.add(v_label_icon)
        options_toolbar.insert(v_label_tool_item, -1)

        self.v_label = Entry(_('Vertical label...'))
        self.v_label.entry.connect('changed', self._set_v_label)
        options_toolbar.insert(self.v_label, -1)

        self._options_button.props.page = options_toolbar
        options_toolbar.show_all()

        toolbarbox.toolbar.insert(self._options_button, -1)

        text_toolbar_btn = ToolbarButton()
        text_toolbar_btn.props.icon_name = 'format-text'
        text_toolbar_btn.props.label = _('Text')
        toolbarbox.toolbar.insert(text_toolbar_btn, -1)
        self._text_options_btn = text_toolbar_btn

        texttoolbar = Gtk.Toolbar()

        self.font_name_combo = FontComboBox()
        self.font_name_combo.set_font_name('Sans')

        def set_font_name(w):
            self._set_chart_font_options(font=w.get_font_name())

        self.font_name_combo.connect("changed", set_font_name)
        texttoolbar.insert(ToolComboBox(self.font_name_combo), -1)

        self.font_size = FontSize()

        def set_font_size(w):
            self._set_chart_font_options(size=w.get_font_size())

        self.font_size.connect("changed", set_font_size)
        texttoolbar.insert(self.font_size, -1)

        self.text_color_btn = ColorToolButton()
        self.text_color_btn.set_color(style.COLOR_BLACK.get_gdk_color())
        self.text_color_btn.set_title(_('Font Color'))
        texttoolbar.insert(self.text_color_btn, -1)
        GObject.timeout_add(1000, self._connect_color_btn,
                            self.text_color_btn,
                            self._set_text_color)

        # self._title_font created in the top of the file
        self._title_font.connect('clicked', self._set_font_option,
                                 TITLE_FONT)
        self._title_font.set_tooltip(_('Title font'))
        self._title_font.props.icon_name = 'title-font'
        op_group = self._title_font

        texttoolbar.insert(self._title_font, 0)

        # self._labels_font created in the top of the file
        self._labels_font.connect('clicked', self._set_font_option,
                                  LABELS_FONT)
        self._labels_font.set_tooltip(_('Labels font'))
        self._labels_font.props.icon_name = 'labels-font'
        self._labels_font.props.group = op_group
        texttoolbar.insert(self._labels_font, 1)

        tick_font = RadioToolButton()
        tick_font.connect('clicked', self._set_font_option, TICK_FONT)
        tick_font.set_tooltip(_('Tick font'))
        tick_font.props.icon_name = 'tick-font'
        tick_font.props.group = op_group
        texttoolbar.insert(tick_font, 2)

        separator = Gtk.SeparatorToolItem()
        texttoolbar.insert(separator, 3)

        text_toolbar_btn.props.page = texttoolbar
        texttoolbar.show_all()

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        self._fullscreen_button = ToolButton('view-fullscreen')
        self._fullscreen_button.set_tooltip(_("Fullscreen"))
        self._fullscreen_button.props.accelerator = '<Alt>Return'
        self._fullscreen_button.connect('clicked', self.__fullscreen_cb)
        toolbarbox.toolbar.insert(self._fullscreen_button, -1)

        charthelp.create_help(toolbarbox.toolbar)

        separator = Gtk.SeparatorToolItem()
        separator.set_draw(False)
        separator.set_expand(True)
        toolbarbox.toolbar.insert(separator, -1)

        stopbtn = StopButton(self)
        toolbarbox.toolbar.insert(stopbtn, -1)

        self.set_toolbar_box(toolbarbox)

        # CANVAS
        paned = Gtk.HPaned()
        box = Gtk.VBox()
        self.box = box

        # Set the info box width to 1/3 of the screen:
        def size_allocate_cb(widget, allocation):
            paned.disconnect(self._setup_handle)
            box_width = allocation.width / 3
            box.set_size_request(box_width, -1)

        self._setup_handle = paned.connect('size_allocate',
                                           size_allocate_cb)

        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.labels_and_values = ChartData(self)
        scroll.add(self.labels_and_values)

        self.labels_and_values.connect('label-changed', self._label_changed)
        self.labels_and_values.connect('value-changed', self._value_changed)

        box.pack_start(scroll, True, True, 0)

        liststore_toolbar = Gtk.Toolbar()

        move_up = ToolButton('go-up')
        move_up.set_tooltip(_('Move up'))
        move_up.connect('clicked', self._move_up)

        move_down = ToolButton('go-down')
        move_down.set_tooltip(_('Move down'))
        move_down.connect('clicked', self._move_down)

        liststore_toolbar.insert(move_up, 0)
        liststore_toolbar.insert(move_down, 1)

        box.pack_end(liststore_toolbar, False, False, 0)

        paned.add1(box)

        # CHARTS AREA
        eventbox = Gtk.EventBox()
        self.charts_area = ChartArea(self)

        eventbox.modify_bg(Gtk.StateType.NORMAL, _WHITE)
        eventbox.add(self.charts_area)

        self._notebook = Gtk.Notebook()
        self._notebook.set_property('show-tabs', False)
        self._notebook.append_page(eventbox, Gtk.Label())

        # EMPTY WIDGETS
        empty_widgets = Gtk.EventBox()
        empty_widgets.modify_bg(Gtk.StateType.NORMAL,
                                style.COLOR_WHITE.get_gdk_color())

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        mvbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.pack_start(mvbox, True, False, 0)

        image_icon = Icon(pixel_size=style.LARGE_ICON_SIZE,
                          icon_name='chart',
                          stroke_color=style.COLOR_BUTTON_GREY.get_svg(),
                          fill_color=style.COLOR_TRANSPARENT.get_svg())
        mvbox.pack_start(image_icon, False, False, style.DEFAULT_PADDING)

        label = Gtk.Label('<span foreground="%s"><b>%s</b></span>' %
                          (style.COLOR_BUTTON_GREY.get_html(),
                           _('No data')))
        label.set_use_markup(True)
        mvbox.pack_start(label, False, False, style.DEFAULT_PADDING)

        hbox = Gtk.Box()
        open_image_btn = Gtk.Button()
        open_image_btn.connect('clicked', self._add_value)
        add_image = Gtk.Image.new_from_stock(Gtk.STOCK_ADD,
                                             Gtk.IconSize.BUTTON)
        buttonbox = Gtk.Box()
        buttonbox.pack_start(add_image, False, True, 0)
        buttonbox.pack_end(Gtk.Label(_('Add a value')), True, True, 5)
        open_image_btn.add(buttonbox)
        hbox.pack_start(open_image_btn, True, False, 0)
        mvbox.pack_start(hbox, False, False, style.DEFAULT_PADDING)

        empty_widgets.add(vbox)
        empty_widgets.show_all()
        self._notebook.append_page(empty_widgets, Gtk.Label())

        paned.add2(self._notebook)

        self.set_canvas(paned)
        self.charts_area.connect('size_allocate', self._chart_size_allocate)

        self.show_all()

        Gdk.Screen.get_default().connect('size-changed', self._configure_cb)
        self._configure_cb()
Ejemplo n.º 5
0
    channel = 'MSNBC'
    var = {'CNN':(1, 82529), 'FOX': (82530, 162639), 'MSNBC': (162640, 246922)}
    SIZE = 20000

    documents = Documents.load(doc_path)
    lexicon = Lexicon.load(lex_path)

    # Getting words
    words = get_lexicon()
<<<<<<< HEAD
    stop_words = set([">>"])
    print("Stop words", stop_words)
=======

    # Getting channels
    docid_to_channels = get_channels()

    # Selecting stop words
    stop_words = set(list(STOP_WORDS) + ["know", "don", "ve", "say", "way", "said", "ll", "think", "thing", "don’t", "like", "got", "people", "going", "talk", "right", "happened", ">>"])
>>>>>>> 9a7c722128d8519466f85c982d72c976b504aaaa
    
    start_idx, end_idx = var[channel] 
    doc_idxs = list(np.random.choice(np.arange(start_idx, end_idx), SIZE))

    # Create stemmer
<<<<<<< HEAD
    # stemmer = WordNetLemmatizer() 
   
    with CaptionIndex(idx_path, lexicon, documents) as index:
        for doc_id in tqdm.tqdm(doc_idxs):
            results = {}
Ejemplo n.º 6
0
    def __init__(self, handle):

        activity.Activity.__init__(self, handle, True)

        self.max_participants = 1

        # CHART_OPTIONS

        self.x_label = ""
        self.y_label = ""
        self.chart_color = utils.get_user_fill_color('str')
        self.chart_line_color = utils.get_user_stroke_color('str')
        self.current_chart = None
        self.charts_area = None
        self.chart_data = []

        # TOOLBARS
        toolbarbox = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        activity_btn_toolbar = activity_button.page

        activity_btn_toolbar.title.connect('changed', self._set_chart_title)

        save_as_image = ToolButton("save-as-image")
        save_as_image.connect("clicked", self._save_as_image)
        save_as_image.set_tooltip(_("Save as image"))
        activity_btn_toolbar.insert(save_as_image, -1)

        save_as_image.show()

        import_stopwatch = ToolButton("import-stopwatch")
        import_stopwatch.connect("clicked", self.__import_stopwatch_cb)
        import_stopwatch.set_tooltip(_("Read StopWatch data"))
        activity_btn_toolbar.insert(import_stopwatch, -1)

        import_stopwatch.show()

        import_measure = ToolButton("import-measure")
        import_measure.set_tooltip(_("Read Measure data"))

        if utils.get_channels() == 1:
            import_measure.connect("clicked", self.__import_measure_cb, 1)

        else:
            import_measure.connect("clicked", self._measure_btn_clicked)
            self._create_measure_palette(import_measure)

        activity_btn_toolbar.insert(import_measure, -1)

        import_measure.show()

        activity_btn_toolbar.keep.hide()

        toolbarbox.toolbar.insert(activity_button, 0)

        add_v = ToolButton("row-insert")
        add_v.connect("clicked", self._add_value)
        add_v.set_tooltip(_("Add a value"))

        toolbarbox.toolbar.insert(add_v, -1)

        remove_v = ToolButton("row-remove")
        remove_v.connect("clicked", self._remove_value)
        remove_v.set_tooltip(_("Remove the selected value"))

        toolbarbox.toolbar.insert(remove_v, -1)

        separator = gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        add_vbar_chart = RadioToolButton()
        add_vbar_chart.connect("clicked", self._add_chart_cb, "vbar")
        add_vbar_chart.set_tooltip(_("Vertical Bar Chart"))
        add_vbar_chart.props.icon_name = "vbar"
        charts_group = add_vbar_chart

        toolbarbox.toolbar.insert(add_vbar_chart, -1)

        add_hbar_chart = RadioToolButton()
        add_hbar_chart.connect("clicked", self._add_chart_cb, "hbar")
        add_hbar_chart.set_tooltip(_("Horizontal Bar Chart"))
        add_hbar_chart.props.icon_name = "hbar"
        add_hbar_chart.props.group = charts_group
        toolbarbox.toolbar.insert(add_hbar_chart, -1)

        add_line_chart = RadioToolButton()
        add_line_chart.connect("clicked", self._add_chart_cb, "line")
        add_line_chart.set_tooltip(_("Line Chart"))
        add_line_chart.props.icon_name = "line"
        add_line_chart.props.group = charts_group
        toolbarbox.toolbar.insert(add_line_chart, -1)

        add_pie_chart = RadioToolButton()
        add_pie_chart.connect("clicked", self._add_chart_cb, "pie")
        add_pie_chart.set_tooltip(_("Pie Chart"))
        add_pie_chart.props.icon_name = "pie"
        add_pie_chart.props.group = charts_group
        add_pie_chart.set_active(True)
        toolbarbox.toolbar.insert(add_pie_chart, -1)

        self.chart_type_buttons = [
            add_vbar_chart, add_hbar_chart, add_line_chart, add_pie_chart
        ]

        separator = gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        options_button = ToolbarButton(icon_name='preferences-system')
        options_toolbar = gtk.Toolbar()

        self.chart_color_btn = ColorToolButton()
        self.chart_color_btn.set_color(_COLOR1)
        self.chart_color_btn.set_title(_("Chart Color"))
        self.chart_color_btn.connect('notify::color', self._set_chart_color)
        options_toolbar.insert(self.chart_color_btn, -1)

        self.line_color_btn = ColorToolButton()
        self.line_color_btn.set_color(_COLOR2)
        self.line_color_btn.set_title(_("Line Color"))
        self.line_color_btn.connect('notify::color',
                                    self._set_chart_line_color)
        options_toolbar.insert(self.line_color_btn, -1)

        separator = gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        options_toolbar.insert(separator, -1)

        h_label_icon = Icon(icon_name="hlabel")
        h_label_tool_item = gtk.ToolItem()
        h_label_tool_item.add(h_label_icon)
        options_toolbar.insert(h_label_tool_item, -1)

        self.h_label = Entry(_("Horizontal label..."))
        self.h_label.entry.connect("changed", self._set_h_label)
        options_toolbar.insert(self.h_label, -1)

        separator = gtk.SeparatorToolItem()
        separator.set_draw(False)
        separator.set_expand(False)
        options_toolbar.insert(separator, -1)

        v_label_icon = Icon(icon_name="vlabel")
        v_label_tool_item = gtk.ToolItem()
        v_label_tool_item.add(v_label_icon)
        options_toolbar.insert(v_label_tool_item, -1)

        self.v_label = Entry(_("Vertical label..."))
        self.v_label.entry.connect("changed", self._set_v_label)
        options_toolbar.insert(self.v_label, -1)

        options_button.props.page = options_toolbar
        options_toolbar.show_all()

        toolbarbox.toolbar.insert(options_button, -1)

        separator = gtk.SeparatorToolItem()
        separator.set_draw(True)
        separator.set_expand(False)
        toolbarbox.toolbar.insert(separator, -1)

        fullscreen_btn = ToolButton('view-fullscreen')
        fullscreen_btn.set_tooltip(_('Fullscreen'))
        fullscreen_btn.connect("clicked", self.__fullscreen_cb)

        toolbarbox.toolbar.insert(fullscreen_btn, -1)

        separator = gtk.SeparatorToolItem()
        separator.set_draw(False)
        separator.set_expand(True)
        toolbarbox.toolbar.insert(separator, -1)

        simplegraphhelp.create_help(toolbarbox.toolbar)

        stopbtn = StopButton(self)
        toolbarbox.toolbar.insert(stopbtn, -1)

        self.set_toolbar_box(toolbarbox)

        # CANVAS
        paned = gtk.HPaned()
        box = gtk.VBox()
        self.box = box

        # Set the info box width to 1/3 of the screen:
        def size_allocate_cb(widget, allocation):
            paned.disconnect(self._setup_handle)
            box_width = allocation.width / 3
            box.set_size_request(box_width, -1)

        self._setup_handle = paned.connect('size_allocate', size_allocate_cb)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.labels_and_values = ChartData(self)
        scroll.add(self.labels_and_values)

        self.labels_and_values.connect("label-changed", self._label_changed)
        self.labels_and_values.connect("value-changed", self._value_changed)

        box.pack_start(scroll, True, True, 0)

        paned.add1(box)

        # CHARTS AREA

        eventbox = gtk.EventBox()
        self.charts_area = ChartArea(self)
        self.charts_area.connect('size_allocate', self._chart_size_allocate)

        eventbox.modify_bg(gtk.STATE_NORMAL, _WHITE)

        eventbox.add(self.charts_area)
        paned.add2(eventbox)

        self.set_canvas(paned)

        self.show_all()
Ejemplo n.º 7
0

spinner.start("rendering interface ...")


class FormatText(Processor):
    def apply_transformation(self, input_):
        fragments = to_formatted_text(
            ANSI(fragment_list_to_text(input_.fragments)))
        return Transformation(fragments)


# layout.
search_field = SearchToolbar()  # for reverse search.
output_field = Buffer()
channels_window = RadioList(utils.get_channels())
general_ch = utils.config['channels']['general']
channels_window.current_value = general_ch
channels_frame = Frame(channels_window, title="channels", width=23)

output_window = Frame(Window(BufferControl(buffer=output_field,
                                           focusable=False,
                                           input_processors=[FormatText()]),
                             wrap_lines=True),
                      title="#general")
input_field = TextArea(
    height=1,
    prompt='> ',
    multiline=False,
    wrap_lines=False,
    search_field=search_field,