Added addons-url to config and Preferences; currently set to old URL, but will update in a couple of days when new addons URL comes on-line

svn: r20894
This commit is contained in:
Doug Blank 2012-12-30 21:59:00 +00:00
parent 34c7d6baee
commit 6841776261
3 changed files with 26 additions and 14 deletions

View File

@ -4,7 +4,7 @@
# #
# Copyright (C) 2005-2007 Donald N. Allingham # Copyright (C) 2005-2007 Donald N. Allingham
# Copyright (C) 2008-2009 Gary Burton # Copyright (C) 2008-2009 Gary Burton
# Copyright (C) 2009 Doug Blank <doug.blank@gmail.com> # Copyright (C) 2009-2012 Doug Blank <doug.blank@gmail.com>
# Copyright (C) 2011 Tim G L Lyons # Copyright (C) 2011 Tim G L Lyons
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -151,6 +151,7 @@ register('behavior.surname-guessing', 0)
register('behavior.use-tips', False) register('behavior.use-tips', False)
register('behavior.welcome', 100) register('behavior.welcome', 100)
register('behavior.web-search-url', 'http://google.com/#&q=%(text)s') register('behavior.web-search-url', 'http://google.com/#&q=%(text)s')
register('behavior.addons-url', "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/trunk")
register('export.proxy-order', [ register('export.proxy-order', [
["privacy", 0], ["privacy", 0],

View File

@ -5,6 +5,7 @@
# Copyright (C) 2008 Raphael Ackermann # Copyright (C) 2008 Raphael Ackermann
# Copyright (C) 2010 Benny Malengier # Copyright (C) 2010 Benny Malengier
# Copyright (C) 2010 Nick Hall # Copyright (C) 2010 Nick Hall
# Copyright (C) 2012 Doug Blank <doug.blank@gmail.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -321,7 +322,7 @@ class ConfigureDialog(ManagedWindow):
table.attach(hbox, 2, 3, index, index+1, yoptions=0) table.attach(hbox, 2, 3, index, index+1, yoptions=0)
def add_entry(self, table, label, index, constant, callback=None, def add_entry(self, table, label, index, constant, callback=None,
config=None): config=None, col_attach=0):
if not config: if not config:
config = self.__config config = self.__config
if not callback: if not callback:
@ -330,9 +331,9 @@ class ConfigureDialog(ManagedWindow):
entry = Gtk.Entry() entry = Gtk.Entry()
entry.set_text(config.get(constant)) entry.set_text(config.get(constant))
entry.connect('changed', callback, constant) entry.connect('changed', callback, constant)
table.attach(lwidget, 0, 1, index, index+1, yoptions=0, table.attach(lwidget, col_attach, col_attach+1, index, index+1, yoptions=0,
xoptions=Gtk.AttachOptions.FILL) xoptions=Gtk.AttachOptions.FILL)
table.attach(entry, 1, 2, index, index+1, yoptions=0) table.attach(entry, col_attach+1, col_attach+2, index, index+1, yoptions=0)
def add_pos_int_entry(self, table, label, index, constant, callback=None, def add_pos_int_entry(self, table, label, index, constant, callback=None,
config=None, col_attach=1): config=None, col_attach=1):
@ -1147,7 +1148,7 @@ class GrampsPreferences(ConfigureDialog):
return _('Dates'), table return _('Dates'), table
def add_behavior_panel(self, configdialog): def add_behavior_panel(self, configdialog):
table = Gtk.Table(3, 6) table = Gtk.Table(2, 8)
table.set_border_width(12) table.set_border_width(12)
table.set_col_spacings(6) table.set_col_spacings(6)
table.set_row_spacings(6) table.set_row_spacings(6)
@ -1205,16 +1206,18 @@ class GrampsPreferences(ConfigureDialog):
table.attach(lwidget, 1, 2, 7, 8, yoptions=0) table.attach(lwidget, 1, 2, 7, 8, yoptions=0)
table.attach(self.whattype_box, 2, 3, 7, 8, yoptions=0) table.attach(self.whattype_box, 2, 3, 7, 8, yoptions=0)
self.add_entry(table, _('Where to check'), 8, 'behavior.addons-url', col_attach=1)
checkbutton = Gtk.CheckButton( checkbutton = Gtk.CheckButton(
_("Do not ask about previously notified addons")) _("Do not ask about previously notified addons"))
checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates')) checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates'))
checkbutton.connect("toggled", self.toggle_hide_previous_addons) checkbutton.connect("toggled", self.toggle_hide_previous_addons)
table.attach(checkbutton, 0, 3, 8, 9, yoptions=0) table.attach(checkbutton, 0, 3, 9, 10, yoptions=0)
button = Gtk.Button(_("Check now")) button = Gtk.Button(_("Check now"))
button.connect("clicked", lambda obj: \ button.connect("clicked", lambda obj: \
self.uistate.viewmanager.check_for_updates(force=True)) self.uistate.viewmanager.check_for_updates(force=True))
table.attach(button, 3, 4, 8, 9, yoptions=0) table.attach(button, 3, 4, 9, 10, yoptions=0)
return _('General'), table return _('General'), table

View File

@ -7,6 +7,7 @@
# Copyright (C) 2010 Nick Hall # Copyright (C) 2010 Nick Hall
# Copyright (C) 2010 Jakim Friant # Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Gary Burton # Copyright (C) 2012 Gary Burton
# Copyright (C) 2012 Doug Blank <doug.blank@gmail.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -237,7 +238,6 @@ UIDEFAULT = '''<ui>
WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % URL_MANUAL_PAGE WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % URL_MANUAL_PAGE
WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % URL_MANUAL_PAGE WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % URL_MANUAL_PAGE
WIKI_HELP_PAGE_MAN = '%s' % URL_MANUAL_PAGE WIKI_HELP_PAGE_MAN = '%s' % URL_MANUAL_PAGE
ADDONS_URL = "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/trunk"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -383,10 +383,10 @@ class ViewManager(CLIManager):
# now we have a list of languages to try: # now we have a list of languages to try:
fp = None fp = None
for lang in langs: for lang in langs:
URL = "%s/listings/addons-%s.txt" % (ADDONS_URL, lang) URL = "%s/listings/addons-%s.txt" % (config.get("behavior.addons-url"), lang)
LOG.debug(" trying: %s" % URL) LOG.debug(" trying: %s" % URL)
try: try:
fp = urlopen(URL) fp = urlopen(URL, timeout=10) # abort after 10 seconds
except: # some error except: # some error
LOG.debug(" IOError!") LOG.debug(" IOError!")
fp = None fp = None
@ -420,7 +420,7 @@ class ViewManager(CLIManager):
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): plugin_dict["i"] not in config.get('behavior.previously-seen-updates')):
addon_update_list.append((_("Updated"), addon_update_list.append((_("Updated"),
"%s/download/%s" % "%s/download/%s" %
(ADDONS_URL, (config.get("behavior.addons-url"),
plugin_dict["z"]), plugin_dict["z"]),
plugin_dict)) plugin_dict))
else: else:
@ -432,14 +432,22 @@ class ViewManager(CLIManager):
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')): plugin_dict["i"] not in config.get('behavior.previously-seen-updates')):
addon_update_list.append((_("New"), addon_update_list.append((_("New"),
"%s/download/%s" % "%s/download/%s" %
(ADDONS_URL, (config.get("behavior.addons-url"),
plugin_dict["z"]), plugin_dict["z"]),
plugin_dict)) plugin_dict))
config.set("behavior.last-check-for-updates", config.set("behavior.last-check-for-updates",
datetime.date.today().strftime("%Y/%m/%d")) datetime.date.today().strftime("%Y/%m/%d"))
count += 1 count += 1
if fp: if fp:
fp.close() fp.close()
else:
from .dialog import OkDialog
OkDialog(_("Checking Addons Failed"),
_("The addon repository appears to be unavailable. Please try again later."),
self.window)
if fp:
fp.close()
return
LOG.debug("Done checking!") LOG.debug("Done checking!")
# List of translated strings used here # List of translated strings used here
# Dead code for l10n # Dead code for l10n