def __init__(self, scrolled_window, api, group_name): super(FeedWebView, self).__init__() self.api = api self.group_name = group_name self.scroll = FeedWebViewScroll() self.link_on_webview = FeedWebViewLink() self.scrolled_window = scrolled_window self.theme = scrolled_window.theme self.dnd = DnDFile() self.load_uri("file://%s" % SHARED_DATA_FILE('html/base.html')) self.connect("navigation-policy-decision-requested", self.on_click_link, api) self.connect("populate-popup", self.on_popup, api) self.connect("hovering-over-link", self.on_hovering_over_link) self.connect('scroll-event', self.on_scroll_event) self.connect("document-load-finished", self.on_load_finished) self.connect("drag-data-received", self.on_drag_data_received) self.connect("drag-drop", self.on_drag_drop) SETTINGS_VIEW.connect("changed::theme", self.on_load_finished) SETTINGS_DESKTOP.connect("changed::document-font-name", self.on_changed_system_font) scrolled_window.add(self) self.show_all()
def _get_default(self): if SETTINGS_VIEW.get_boolean('use-system-font'): font_name = SETTINGS_DESKTOP.get_string('document-font-name') else: font_name = SETTINGS_VIEW.get_string('font') font_template, size = self.get_pango_font_format(font_name) return font_template, size
def _get_default(self): if SETTINGS_VIEW.get_boolean("use-system-font"): font_name = SETTINGS_DESKTOP.get_string("document-font-name") else: font_name = SETTINGS_VIEW.get_string("font") font_template, size = self.get_pango_font_format(font_name) return font_template, size
def __init__(self, liststore): self.liststore = liststore self.gui = gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE('gfeedline.glade')) self.window = window = gui.get_object('main_window') self.column = MultiColumnDict(gui) # multi-columns for Notebooks self.theme = Theme() self.font = FontSet() self.notification = StatusNotification(liststore) dnd_list = [ Gtk.TargetEntry.new("text/uri-list", 0, 1), Gtk.TargetEntry.new("text/x-moz-url", 0, 4), ] window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_list, Gdk.DragAction.COPY) target = Gtk.TargetList.new([]) target.add(Gdk.Atom.intern("text/x-moz-url", False), 0, 4) target.add(Gdk.Atom.intern("text/uri-list", False), 0, 1) window.drag_dest_set_target_list(target) window.connect("drag-data-received", self.on_drag_data_received) SETTINGS.connect("changed::window-sticky", self.on_settings_sticky_change) self.on_settings_sticky_change(SETTINGS, 'window-sticky') SETTINGS_VIEW.connect("changed::theme", self.on_settings_theme_change) self.on_settings_theme_change(SETTINGS_VIEW, 'theme') is_multi_column = SETTINGS_VIEW.get_boolean('multi-column') menuitem_multicolumn = gui.get_object('menuitem_multicolumn') menuitem_multicolumn.set_active(is_multi_column) menuitem_update = MenuItemUpdate(gui, liststore) x, y, w, h = self._get_geometry_from_settings() # window.show() # for wrong position when auto-start if x >= 0 and y >= 0: window.move(x, y) window.resize(w, h) window.show() gui.connect_signals(self)
def __init__(self, liststore): self.liststore = liststore self.gui = gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE("gfeedline.glade")) self.window = window = gui.get_object("main_window") self.column = MultiColumnDict(gui) # multi-columns for Notebooks self.theme = Theme() self.font = FontSet() self.notification = StatusNotification(liststore) dnd_list = [Gtk.TargetEntry.new("text/uri-list", 0, 1), Gtk.TargetEntry.new("text/x-moz-url", 0, 4)] window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_list, Gdk.DragAction.COPY) target = Gtk.TargetList.new([]) target.add(Gdk.Atom.intern("text/x-moz-url", False), 0, 4) target.add(Gdk.Atom.intern("text/uri-list", False), 0, 1) window.drag_dest_set_target_list(target) window.connect("drag-data-received", self.on_drag_data_received) SETTINGS.connect("changed::window-sticky", self.on_settings_sticky_change) self.on_settings_sticky_change(SETTINGS, "window-sticky") SETTINGS_VIEW.connect("changed::theme", self.on_settings_theme_change) self.on_settings_theme_change(SETTINGS_VIEW, "theme") is_multi_column = SETTINGS_VIEW.get_boolean("multi-column") menuitem_multicolumn = gui.get_object("menuitem_multicolumn") menuitem_multicolumn.set_active(is_multi_column) menuitem_update = MenuItemUpdate(gui, liststore) x, y, w, h = self._get_geometry_from_settings() # window.show() # for wrong position when auto-start if x >= 0 and y >= 0: window.move(x, y) window.resize(w, h) window.show() gui.connect_signals(self)
def __init__(self, liststore, notebook, api, name='', page=-1): super(FeedView, self).__init__() self.name = name self.api = api self.liststore = liststore self.window = liststore.window # access from RetweetMenuItem self.theme = self.window.theme self.feed_counter = 1 # numbers of feeds self.webview = FeedWebView(self, api, notebook.group_name) self.notification = self.window.notification self.id_history = CacheList() SETTINGS_VIEW.connect("changed::theme", self.id_history.clear) self.box = Gtk.VBox() self.profile = ProfilePane() self.append(notebook, page)
def get_notebook(self, group_name): if not SETTINGS_VIEW.get_boolean("multi-column"): group_name = "dummy for single column" if group_name in self.column: notebook = self.column.get(group_name) else: notebook = FeedNotebook(self.column, group_name, self.liststore) self.column.add(group_name, notebook) return notebook
def get_notebook(self, group_name): if not SETTINGS_VIEW.get_boolean('multi-column'): group_name = 'dummy for single column' if group_name in self.column: notebook = self.column.get(group_name) else: notebook = FeedNotebook(self.column, group_name, self.liststore) self.column.add(group_name, notebook) return notebook
def __init__(self): self.template = {} self.all_themes = {} theme_system = SHARED_DATA_FILE('html/theme/') alllist = [(theme_system, p) for p in os.listdir(theme_system)] +\ [(THEME_HOME, p) for p in os.listdir(THEME_HOME)] for path, filename in alllist: full_path = os.path.join(path, filename) if not os.path.isdir(full_path): continue name = filename.split('.')[0] self.all_themes.setdefault(name, {}) self.all_themes[name]['dir'] = full_path if filename.count('Ascending'): self.all_themes[name]['is_ascending'] = True SETTINGS_VIEW.connect("changed::theme", self.on_setting_theme_changed) self.on_setting_theme_changed(SETTINGS_VIEW, 'theme')
def __init__(self): self.template = {} self.all_themes = {} theme_system = SHARED_DATA_FILE("html/theme/") alllist = [(theme_system, p) for p in os.listdir(theme_system)] + [ (THEME_HOME, p) for p in os.listdir(THEME_HOME) ] for path, filename in alllist: full_path = os.path.join(path, filename) if not os.path.isdir(full_path): continue name = filename.split(".")[0] self.all_themes.setdefault(name, {}) self.all_themes[name]["dir"] = full_path if filename.count("Ascending"): self.all_themes[name]["is_ascending"] = True SETTINGS_VIEW.connect("changed::theme", self.on_setting_theme_changed) self.on_setting_theme_changed(SETTINGS_VIEW, "theme")
def is_ascending(self, save_value=None): if save_value == None: save_value = SETTINGS_VIEW.get_int("timeline-order") if save_value == 0: # default theme_name = self._get_theme_name() if theme_name not in self.all_themes: theme_name = "Default" is_ascending = bool(self.all_themes[theme_name].get("is_ascending")) else: is_ascending = save_value == 1 return is_ascending
def is_ascending(self, save_value=None): if save_value == None: save_value = SETTINGS_VIEW.get_int('timeline-order') if save_value == 0: # default theme_name = self._get_theme_name() if theme_name not in self.all_themes: theme_name = 'Default' is_ascending = bool( self.all_themes[theme_name].get('is_ascending')) else: is_ascending = save_value == 1 return is_ascending
def pause(self): self.is_paused = True delay = SETTINGS_VIEW.get_int('auto-scroll-delay') if delay < 0: return # print "pause!", delay if self._timer and not self._timer.called: # print "cancel" delayed_time = self._timer.getTime() - time.time() if delayed_time > delay: delay = delayed_time self._timer.cancel() self._timer = reactor.callLater(delay, self._resume)
def __init__(self, name, notebook, child): super(NotebookTabLabel, self).__init__() self.label = Gtk.Label.new_with_mnemonic(name) self.connect("button-press-event", self._on_button_press_cb, notebook, child) box = Gtk.Box() if SETTINGS_VIEW.get_boolean("favicon"): feedview = child.get_children()[1] icon_pixbuf = feedview.webview.api.account.icon.get_pixbuf() icon = Gtk.Image.new_from_pixbuf(icon_pixbuf) box.pack_start(icon, True, True, 2) box.pack_start(self.label, True, True, 0) self.set_visible_window(False) self.add(box) self.show_all()
def __init__(self, name, notebook, child): super(NotebookTabLabel, self).__init__() self.label = Gtk.Label.new_with_mnemonic(name) self.connect('button-press-event', self._on_button_press_cb, notebook, child) box = Gtk.Box() if SETTINGS_VIEW.get_boolean('favicon'): feedview = child.get_children()[1] icon_pixbuf = feedview.webview.api.account.icon.get_pixbuf() icon = Gtk.Image.new_from_pixbuf(icon_pixbuf) box.pack_start(icon, True, True, 2) box.pack_start(self.label, True, True, 0) self.set_visible_window(False) self.add(box) self.show_all()
def _get_theme_name(self): return SETTINGS_VIEW.get_string("theme")
def __init__(self): self.is_paused = SETTINGS_VIEW.get_int('auto-scroll-delay') < 0 self._timer = None SETTINGS_VIEW.connect("changed::auto-scroll-delay", self._on_changed_delay)
def on_changed_system_font(self, settings, key): if SETTINGS_VIEW.get_boolean('use-system-font'): self.change_font()
def on_menuitem_multicolumn_toggled(self, menuitem): is_multi_column = menuitem.get_active() SETTINGS_VIEW.set_boolean("multi-column", is_multi_column) self.toggle_multicolumn_mode()
def _on_changed_delay(self, view, *args): self.is_paused = SETTINGS_VIEW.get_int('auto-scroll-delay') < 0
def on_menuitem_multicolumn_toggled(self, menuitem): is_multi_column = menuitem.get_active() SETTINGS_VIEW.set_boolean('multi-column', is_multi_column) self.toggle_multicolumn_mode()
def _get_theme_name(self): return SETTINGS_VIEW.get_string('theme')