Bring dialog box, if updates available (doesn't update them yet)
svn: r15725
This commit is contained in:
103
src/glade/updateaddons.glade
Normal file
103
src/glade/updateaddons.glade
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 2.12 -->
|
||||||
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
|
<object class="GtkListStore" id="liststore1"/>
|
||||||
|
<object class="GtkDialog" id="dialog1">
|
||||||
|
<property name="border_width">5</property>
|
||||||
|
<property name="window_position">center</property>
|
||||||
|
<property name="default_width">500</property>
|
||||||
|
<property name="default_height">400</property>
|
||||||
|
<property name="destroy_with_parent">True</property>
|
||||||
|
<property name="type_hint">normal</property>
|
||||||
|
<property name="has_separator">False</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkVBox" id="dialog-vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="title">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes"><b>Available Gramps Updates for Addons</b></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="padding">20</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="hscrollbar_policy">automatic</property>
|
||||||
|
<property name="vscrollbar_policy">automatic</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="pack_type">end</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="cancel">
|
||||||
|
<property name="label">gtk-cancel</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="apply">
|
||||||
|
<property name="label">gtk-apply</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="pack_type">end</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<action-widgets>
|
||||||
|
<action-widget response="0">cancel</action-widget>
|
||||||
|
<action-widget response="0">apply</action-widget>
|
||||||
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
@@ -333,21 +333,59 @@ class ViewManager(CLIManager):
|
|||||||
if (version_str_to_tup(plugin_dict["v"], 3) >
|
if (version_str_to_tup(plugin_dict["v"], 3) >
|
||||||
version_str_to_tup(plugin.version, 3)):
|
version_str_to_tup(plugin.version, 3)):
|
||||||
LOG.debug(" Downloading '%s'..." % plugin_dict["z"])
|
LOG.debug(" Downloading '%s'..." % plugin_dict["z"])
|
||||||
addon_update_list.append("%s/download/%s" %
|
addon_update_list.append(("update",
|
||||||
(SOURCEFORGE,
|
"%s/download/%s" %
|
||||||
plugin_dict["z"]))
|
(ADDONS_URL,
|
||||||
|
plugin_dict["z"]),
|
||||||
|
plugin_dict))
|
||||||
else:
|
else:
|
||||||
LOG.debug(" '%s' is ok" % plugin_dict["n"])
|
LOG.debug(" '%s' is ok" % plugin_dict["n"])
|
||||||
else:
|
else:
|
||||||
LOG.debug(" '%s' is not installed" % plugin_dict["n"])
|
LOG.debug(" '%s' is not installed" % plugin_dict["n"])
|
||||||
|
#addon_update_list.append(("new",
|
||||||
|
# "%s/download/%s" %
|
||||||
|
# (ADDONS_URL,
|
||||||
|
# plugin_dict["z"]),
|
||||||
|
# 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"))
|
||||||
if fp:
|
if fp:
|
||||||
fp.close()
|
fp.close()
|
||||||
#for plugin_url in addon_update_list:
|
LOG.debug("Done checking!")
|
||||||
# load_addon_file(plugin_url, callback=print)
|
if addon_update_list:
|
||||||
LOG.debug("Done updating!")
|
self.update_addons(addon_update_list)
|
||||||
|
|
||||||
|
def update_addons(self, addon_update_list):
|
||||||
|
from glade import Glade
|
||||||
|
import ManagedWindow
|
||||||
|
import ListModel
|
||||||
|
glade = Glade("updateaddons.glade")
|
||||||
|
self.update_dialog = glade.toplevel
|
||||||
|
ManagedWindow.set_titles(self.update_dialog,
|
||||||
|
glade.get_object('title'),
|
||||||
|
_('Available Gramps Updates for Addons'))
|
||||||
|
apply_button = glade.get_object('apply')
|
||||||
|
cancel_button = glade.get_object('cancel')
|
||||||
|
apply_button.connect("clicked", self.install_addons)
|
||||||
|
cancel_button.connect("clicked",
|
||||||
|
lambda obj: self.update_dialog.destroy())
|
||||||
|
list = ListModel.ListModel(glade.get_object("list"),
|
||||||
|
[('Name',-1,10)],)
|
||||||
|
pos = None
|
||||||
|
for (status,plugin_url,plugin_dict) in addon_update_list:
|
||||||
|
if pos is None:
|
||||||
|
pos = list.add([plugin_dict["n"]])
|
||||||
|
else:
|
||||||
|
list.add([plugin_dict["n"]])
|
||||||
|
if pos:
|
||||||
|
list.selection.select_iter(pos)
|
||||||
|
self.update_dialog.run()
|
||||||
|
|
||||||
|
def install_addons(self, obj):
|
||||||
|
#for plugin_url in addon_update_list:
|
||||||
|
# load_addon_file(plugin_url, callback=print)
|
||||||
|
self.update_dialog.destroy()
|
||||||
|
|
||||||
def _errordialog(title, errormessage):
|
def _errordialog(title, errormessage):
|
||||||
"""
|
"""
|
||||||
Show the error.
|
Show the error.
|
||||||
|
Reference in New Issue
Block a user