svn: r8605

This commit is contained in:
Don Allingham 2007-06-20 03:56:39 +00:00
parent 542bbd9404
commit 28b00c5bab
2 changed files with 146 additions and 13 deletions

View File

@ -178,9 +178,11 @@ class DbManager:
is_rev = len(self.model.get_path(node)) > 1
if is_rev:
self.rcs.set_label(_("Check out"))
self.rcs.set_label(_("Restore"))
self.rename.set_sensitive(False)
else:
self.rcs.set_label(_("Check in"))
self.rcs.set_label(_("Archive"))
self.rename.set_sensitive(True)
if store.get_value(node, OPEN_COL):
self.connect.set_sensitive(False)
@ -192,7 +194,6 @@ class DbManager:
self.rcs.show()
else:
self.rcs.hide()
self.rename.set_sensitive(True)
if store.get_value(node, STOCK_COL) == gtk.STOCK_DIALOG_ERROR:
path = store.get_value(node, PATH_COL)
if os.path.isfile(os.path.join(path,"person.gbkp")):
@ -291,7 +292,7 @@ class DbManager:
items[4], items[5], items[6]]
iter = self.model.append(None, data)
for rdata in find_revisions(os.path.join(items[1], "rev.gramps,v")):
data = [rdata[0], "", "", "", 0, False, "" ]
data = [ _("Version %s") % rdata[0], "", "", rdata[1], 0, False, "" ]
self.model.append(iter, data)
self.dblist.set_model(self.model)
@ -336,6 +337,7 @@ class DbManager:
check_in(self.dbstate.db,
os.path.join(self.dbstate.db.get_save_path(), "rev.gramps"),
None)
self.__populate()
def __remove_db(self, obj):
"""
@ -517,7 +519,6 @@ def find_revisions(name):
import re
rev = re.compile("\s*revision\s+([\d\.]+)")
date = re.compile("\s*date:\s+([^;]+);")
if not os.path.isfile(name):
return []
@ -531,22 +532,32 @@ def find_revisions(name):
date_str = ""
rev_str = ""
next_com = False
if os.path.isfile(name):
for i in proc.stdout:
match = rev.match(i)
if match:
rev_str = match.groups()[0]
match = date.match(i)
if match:
date_str = match.groups()[0]
elif next_com:
next_com = False
date_str = i.strip()
revlist.append((rev_str, date_str))
elif i[0:5] == "date:":
next_com = True
return revlist
def check_in(db, filename, callback):
init = [ "rcs", '-i', '-U', '-q', '-t'"GRAMPS database", ]
ci = [ "ci", '-m"update"', "-q" ]
ci = [ "ci", "-q" ]
glade = gtk.glade.XML(const.gladeFile, "comment", "gramps")
top = glade.get_widget('comment')
text = glade.get_widget('description')
top.run()
comment = text.get_text()
top.destroy()
proc = subprocess.Popen(init + [filename + ",v"], stderr = subprocess.PIPE)
status = proc.wait()
@ -558,15 +569,18 @@ def check_in(db, filename, callback):
False, False)
xmlwrite.write(filename)
cmd = ci + [filename]
cmd = ci + ['-m%s' % comment, filename]
proc = subprocess.Popen(
cmd,
stdin = subprocess.PIPE,
stderr = subprocess.PIPE )
proc.stdin.write("comment")
proc.stdin.close()
message = "\n".join(proc.stderr.readlines())
proc.stderr.close()
status = proc.wait()
del proc
if __name__ == "__main__":
import sys
print find_revisions(sys.argv[1])

View File

@ -15763,7 +15763,7 @@ Very High</property>
<widget class="GtkButton" id="rcs">
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Check In</property>
<property name="label" translatable="yes">Archive</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -15803,4 +15803,123 @@ Very High</property>
</child>
</widget>
<widget class="GtkDialog" id="comment">
<property name="visible">True</property>
<property name="title" translatable="yes">Revision comment - GRAMPS</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox27">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area26">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="okbutton3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table80">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label714">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Version description&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="description">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>