Added timeout to urllib open; added URL path to addons to Preferences; added URL path to addons to config; refined layout in Preferences on first panel
svn: r20865
This commit is contained in:
parent
f0641d505c
commit
3e5dbd4e5b
@ -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/branches/gramps34/")
|
||||||
|
|
||||||
register('export.proxy-order', [
|
register('export.proxy-order', [
|
||||||
["privacy", 0],
|
["privacy", 0],
|
||||||
|
@ -307,7 +307,7 @@ class ConfigureDialog(ManagedWindow.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:
|
||||||
@ -316,9 +316,9 @@ class ConfigureDialog(ManagedWindow.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.FILL)
|
xoptions=gtk.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):
|
||||||
@ -1039,7 +1039,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)
|
||||||
@ -1097,16 +1097,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, 1, 2, 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, 2, 3, 9, 10, yoptions=0)
|
||||||
|
|
||||||
return _('General'), table
|
return _('General'), table
|
||||||
|
|
||||||
|
@ -227,7 +227,6 @@ UIDEFAULT = '''<ui>
|
|||||||
WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % const.URL_MANUAL_PAGE
|
WIKI_HELP_PAGE_FAQ = '%s_-_FAQ' % const.URL_MANUAL_PAGE
|
||||||
WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % const.URL_MANUAL_PAGE
|
WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % const.URL_MANUAL_PAGE
|
||||||
WIKI_HELP_PAGE_MAN = '%s' % const.URL_MANUAL_PAGE
|
WIKI_HELP_PAGE_MAN = '%s' % const.URL_MANUAL_PAGE
|
||||||
ADDONS_URL = "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/branches/gramps34/"
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -357,7 +356,7 @@ class ViewManager(CLIManager):
|
|||||||
elif howoften == 4: # always
|
elif howoften == 4: # always
|
||||||
update = True
|
update = True
|
||||||
if update:
|
if update:
|
||||||
import urllib, locale
|
import urllib2, locale
|
||||||
LOG.debug("Checking for updated addons...")
|
LOG.debug("Checking for updated addons...")
|
||||||
langs = []
|
langs = []
|
||||||
lang = locale.getlocale()[0] # not None
|
lang = locale.getlocale()[0] # not None
|
||||||
@ -370,10 +369,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 = urllib.urlopen(URL)
|
fp = urllib2.urlopen(URL, timeout=10) # wait up to 10 seconds
|
||||||
except: # some error
|
except: # some error
|
||||||
LOG.debug(" IOError!")
|
LOG.debug(" IOError!")
|
||||||
fp = None
|
fp = None
|
||||||
@ -407,7 +406,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:
|
||||||
@ -419,14 +418,20 @@ 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:
|
else:
|
||||||
fp.close()
|
from QuestionDialog 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
|
||||||
|
Loading…
Reference in New Issue
Block a user