Example #1
0
    def create_display_area(self):
        filter_column = Gtk.TreeViewColumn('Filter', Gtk.CellRendererText(), text=0)
        filter_column.set_alignment(.5)
        filter_column.set_expand(True)
        self.view.append_column(filter_column)

        caps_column = Gtk.TreeViewColumn('Case sensitive', Gtk.CellRendererText(), text=1)
        hide_matches_column = Gtk.TreeViewColumn('Hide matches', Gtk.CellRendererText(), text=2)
        self.view.append_column(caps_column)
        self.view.append_column(hide_matches_column)

        for f in self.choices:
            self.filter_list.append([f.filter, f.case_sensitive, f.hide_matches])

        view_title = Gtk.Label()
        view_title.set_markup('<b>Filters</b>')

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        remove_button = utilityFunctions.make_button(theme_icon_string="remove", tooltip_text="Remove selected filter",
                                                     signal="clicked", function=self.remove_filter)
        add_button = utilityFunctions.make_button(theme_icon_string="add", tooltip_text="Add a filter",
                                                  signal="clicked", function=self.add_filter)
        edit_button = utilityFunctions.make_button(theme_icon_string="gtk-edit", tooltip_text="Edit selected filter",
                                                   signal="clicked", function=self.edit_filter)
        hbox.add(remove_button)
        hbox.add(add_button)
        hbox.add(edit_button)

        scroll = Gtk.ScrolledWindow()
        scroll.add(self.view)
        scroll_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        scroll_vbox.pack_start(view_title, False, False, 5)
        scroll_vbox.pack_start(scroll, True, True, 0)
        frame = Gtk.Frame()
        frame.add(scroll_vbox)

        helpful_label = Gtk.Label('Filter changes appear on the next refresh.')
        helpful_label.set_line_wrap(True)
        helpful_align = Gtk.Alignment()
        helpful_align.set_padding(0, self.padding, 0, 0)
        helpful_align.add(helpful_label)

        vbox.add(helpful_align)
        vbox.add(hbox)
        vbox.pack_end(frame, True, True, 0)
        return self.surround_with_padding(vbox)
Example #2
0
 def create_add_button(self) -> Gtk.Button:
     add_button = make_button(
         theme_icon_string='add',
         tooltip='Quickly add a feed',
         signal='clicked',
         signal_func=self.on_add_clicked)
     return add_button
Example #3
0
 def create_refresh_button(self) -> Gtk.Button:
     refresh_button = make_button(
         theme_icon_string='view-refresh',
         tooltip='Refresh',
         signal='clicked',
         signal_func=self.on_refresh_clicked)
     refresh_button.set_focus_on_click(False)
     return refresh_button
Example #4
0
 def create_preferences_button(self) -> Gtk.Button:
     preferences_button = make_button(
         theme_icon_string='gtk-preferences',
         backup_icon_string='preferences-system',
         tooltip='Preferences',
         signal='clicked',
         signal_func=self.on_preferences_clicked)
     return preferences_button
Example #5
0
    def create_display_area(self) -> Gtk.Alignment:
        remove_button = utilityFunctions.make_button(
            theme_icon_string='remove',
            tooltip='Remove selected feed',
            signal='clicked',
            signal_func=self.remove_selection)

        add_button = utilityFunctions.make_button(theme_icon_string='add',
                                                  tooltip='Add a feed',
                                                  signal='clicked',
                                                  signal_func=self.add_feed)

        edit_button = utilityFunctions.make_button(
            theme_icon_string='gtk-edit',
            tooltip='Edit selected feed',
            signal='clicked',
            signal_func=self.edit_feed)

        clear_cache_button = utilityFunctions.make_button(
            tooltip='Clears all scraped articles and read history information',
            signal='clicked',
            signal_func=self.clear_cache)
        clear_cache_button.set_label('Clear cache')

        button_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        button_hbox.pack_start(remove_button, False, False, 0)
        button_hbox.pack_start(add_button, False, False, 0)
        button_hbox.pack_start(edit_button, False, False, 0)
        button_hbox.pack_end(clear_cache_button, False, False, 0)

        # List of Feeds
        for feed in self.choices.values():
            self.feed_list.append([feed.name, feed.uri])

        column = Gtk.TreeViewColumn('', Gtk.CellRendererText(), text=0)
        self.view.append_column(column)
        self.view.set_headers_visible(False)
        column_title = Gtk.Label()
        column_title.set_markup('<b> Feeds </b>')
        select = self.view.get_selection()
        select.connect('changed', self.feed_selected)
        scroll = Gtk.ScrolledWindow()
        scroll.add(self.view)
        feed_frame = Gtk.Frame()

        feed_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        feed_vbox.pack_start(column_title, False, False, 5)
        feed_vbox.pack_start(scroll, True, True, 0)
        feed_frame.add(feed_vbox)

        info_frame = Gtk.Frame()
        info_frame.add(self.info_box)

        feed_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        feed_hbox.pack_start(feed_frame, True, True, 0)
        feed_hbox.pack_end(info_frame, True, True, 1)

        helpful_label = Gtk.Label('New feeds appear on the next refresh.')
        helpful_label.set_line_wrap(True)
        helpful_align = Gtk.Alignment()
        helpful_align.set_padding(0, self.padding, 0, 0)
        helpful_align.add(helpful_label)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.add(helpful_align)
        vbox.add(button_hbox)
        vbox.pack_end(feed_hbox, True, True, 0)

        if len(self.feed_list) > 0:
            self.attempt_selection(self.view.get_selection(), 0)

        return self.surround_with_padding(vbox)
Example #6
0
    def create_display_area(self):
        remove_button = utilityFunctions.make_button(theme_icon_string="remove", tooltip_text="Remove selected feed",
                                                     signal="clicked", function=self.remove_selection)

        add_button = utilityFunctions.make_button(theme_icon_string="add", tooltip_text="Add a feed",
                                                  signal="clicked", function=self.add_feed)

        edit_button = utilityFunctions.make_button(theme_icon_string="gtk-edit", tooltip_text="Edit selected feed",
                                                   signal="clicked", function=self.edit_feed)

        clear_cache_button = utilityFunctions.make_button(tooltip_text='Clears all scraped articles and ' +
                                                                       'read history information',
                                                          signal='clicked', function=self.clear_cache)
        clear_cache_button.set_label('Clear cache')

        button_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        button_hbox.pack_start(remove_button, False, False, 0)
        button_hbox.pack_start(add_button, False, False, 0)
        button_hbox.pack_start(edit_button, False, False, 0)
        button_hbox.pack_end(clear_cache_button, False, False, 0)

        # List of Feeds
        for feed in self.choices.values():
            self.feed_list.append([feed.name, feed.uri])

        column = Gtk.TreeViewColumn('', Gtk.CellRendererText(), text=0)
        self.view.append_column(column)
        self.view.set_headers_visible(False)
        column_title = Gtk.Label()
        column_title.set_markup('<b> Feeds </b>')
        select = self.view.get_selection()
        select.connect("changed", self.feed_selected)
        scroll = Gtk.ScrolledWindow()
        scroll.add(self.view)
        feed_frame = Gtk.Frame()

        feed_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        feed_vbox.pack_start(column_title, False, False, 5)
        feed_vbox.pack_start(scroll, True, True, 0)
        feed_frame.add(feed_vbox)

        info_frame = Gtk.Frame()
        info_frame.add(self.info_box)

        feed_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        feed_hbox.pack_start(feed_frame, True, True, 0)
        feed_hbox.pack_end(info_frame, True, True, 1)

        helpful_label = Gtk.Label('New feeds appear on the next refresh.')
        helpful_label.set_line_wrap(True)
        helpful_align = Gtk.Alignment()
        helpful_align.set_padding(0, self.padding, 0, 0)
        helpful_align.add(helpful_label)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.add(helpful_align)
        vbox.add(button_hbox)
        vbox.pack_end(feed_hbox, True, True, 0)

        if len(self.feed_list) > 0:
            self.attempt_selection(self.view.get_selection(), 0)

        return self.surround_with_padding(vbox)
Example #7
0
 def create_refresh_button(self):
     refresh_button = make_button(theme_icon_string="view-refresh", tooltip_text="Refresh",
                                  signal="clicked", function=self.on_refresh_clicked)
     refresh_button.set_focus_on_click(False)  # Don't keep it looking "pressed" after clicked
     return refresh_button
Example #8
0
 def create_preferences_button(self):
     preferences_button = make_button(theme_icon_string='gtk-preferences', backup_icon_string='preferences-system',
                                      tooltip_text="Preferences", signal="clicked",
                                      function=self.on_preferences_clicked)
     return preferences_button
Example #9
0
 def create_add_button(self):
     add_button = make_button(theme_icon_string="add", tooltip_text="Quickly add a feed",
                              signal="clicked", function=self.on_add_clicked)
     return add_button