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

svn: r20895
This commit is contained in:
Doug Blank 2012-12-30 22:00:58 +00:00
parent fdcc02d1bd
commit e41c6db70d
3 changed files with 25 additions and 13 deletions

View File

@ -151,6 +151,7 @@ register('behavior.surname-guessing', 0)
register('behavior.use-tips', False)
register('behavior.welcome', 100)
register('behavior.web-search-url', 'http://google.com/#&q=%(text)s')
register('behavior.addons-url', "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/branches/gramps40/")
register('export.proxy-order', [
["privacy", 0],

View File

@ -5,6 +5,7 @@
# Copyright (C) 2008 Raphael Ackermann
# Copyright (C) 2010 Benny Malengier
# 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
# 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)
def add_entry(self, table, label, index, constant, callback=None,
config=None):
config=None, col_attach=0):
if not config:
config = self.__config
if not callback:
@ -330,9 +331,9 @@ class ConfigureDialog(ManagedWindow):
entry = Gtk.Entry()
entry.set_text(config.get(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)
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,
config=None, col_attach=1):
@ -1147,7 +1148,7 @@ class GrampsPreferences(ConfigureDialog):
return _('Dates'), table
def add_behavior_panel(self, configdialog):
table = Gtk.Table(3, 6)
table = Gtk.Table(2, 8)
table.set_border_width(12)
table.set_col_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(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(
_("Do not ask about previously notified addons"))
checkbutton.set_active(config.get('behavior.do-not-show-previously-seen-updates'))
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.connect("clicked", lambda obj: \
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

View File

@ -7,6 +7,7 @@
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2010 Jakim Friant
# 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
# 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_KEY = '%s_-_Keybindings' % 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:
fp = None
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)
try:
fp = urlopen(URL)
fp = urlopen(URL, timeout=10) # abort after 10 seconds
except: # some error
LOG.debug(" IOError!")
fp = None
@ -420,7 +420,7 @@ class ViewManager(CLIManager):
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')):
addon_update_list.append((_("Updated"),
"%s/download/%s" %
(ADDONS_URL,
(config.get("behavior.addons-url"),
plugin_dict["z"]),
plugin_dict))
else:
@ -432,14 +432,22 @@ class ViewManager(CLIManager):
plugin_dict["i"] not in config.get('behavior.previously-seen-updates')):
addon_update_list.append((_("New"),
"%s/download/%s" %
(ADDONS_URL,
(config.get("behavior.addons-url"),
plugin_dict["z"]),
plugin_dict))
config.set("behavior.last-check-for-updates",
datetime.date.today().strftime("%Y/%m/%d"))
count += 1
if fp:
fp.close()
if fp:
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!")
# List of translated strings used here
# Dead code for l10n