2007-04-05 Don Allingham <don@gramps-project.org>

* src/plugins/Checkpoint.py: fix some more Popen issues



svn: r8359
This commit is contained in:
Don Allingham 2007-04-06 04:34:48 +00:00
parent 7046e711fb
commit abb87d57fd
4 changed files with 27 additions and 18 deletions

View File

@ -1,3 +1,6 @@
2007-04-05 Don Allingham <don@gramps-project.org>
* src/plugins/Checkpoint.py: fix some more Popen issues
2007-04-05 Brian Matherly <brian@gramps-project.org> 2007-04-05 Brian Matherly <brian@gramps-project.org>
* src/plugins/NarrativeWeb.py: 0000998: Source Ref link refers to nothing in * src/plugins/NarrativeWeb.py: 0000998: Source Ref link refers to nothing in
Narrative web report. Narrative web report.

View File

@ -313,7 +313,7 @@ class DateParser:
self.french_to_int) self.french_to_int)
def _parse_greg_julian(self, text): def _parse_greg_julian(self, text):
return self._parse_calendar(text, self._text,self._text2, return self._parse_calendar(text, self._text, self._text2,
self.month_to_int, gregorian_valid) self.month_to_int, gregorian_valid)
def _parse_calendar(self, text, regex1, regex2, mmap, check=None): def _parse_calendar(self, text, regex1, regex2, mmap, check=None):

View File

@ -145,9 +145,10 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
# Display controls according to the state # Display controls according to the state
if self.options.handler.options_dict['rcs']: if self.options.handler.options_dict['rcs']:
self.rcs_rb.set_active(1) self.rcs_rb.set_active(_rcs_found)
self.cust_rb.set_active(not _rcs_found)
else: else:
self.cust_rb.set_active(1) self.cust_rb.set_active(True)
self.cust_arch_cb.set_sensitive(self.cust_rb.get_active()) self.cust_arch_cb.set_sensitive(self.cust_rb.get_active())
self.cust_ret_cb.set_sensitive(self.cust_rb.get_active()) self.cust_ret_cb.set_sensitive(self.cust_rb.get_active())
@ -157,6 +158,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
# and show the normally hidden warning # and show the normally hidden warning
if not _rcs_found: if not _rcs_found:
self.rcs_rb.set_sensitive(False) self.rcs_rb.set_sensitive(False)
self.cust_rb.set_sensitive(True)
self.glade.get_widget('warning_label').show() self.glade.get_widget('warning_label').show()
self.title = _("Checkpoint Data") self.title = _("Checkpoint Data")
@ -217,12 +219,14 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
if self.options.handler.options_dict['rcs']: if self.options.handler.options_dict['rcs']:
self.rcs(archive,cli) self.rcs(archive, cli)
print "RCS Done"
elif archive: elif archive:
self.custom(self.options.handler.options_dict['cacmd'],True,cli) self.custom(self.options.handler.options_dict['cacmd'], True, cli)
else: else:
self.custom(self.options.handler.options_dict['crcmd'],False,cli) self.custom(self.options.handler.options_dict['crcmd'], False, cli)
print "Continue"
if not cli: if not cli:
self.uistate.window.window.set_cursor(None) self.uistate.window.window.set_cursor(None)
self.window.window.set_cursor(None) self.window.window.set_cursor(None)
@ -276,7 +280,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
else: else:
dialog(msg1,msg2) dialog(msg1,msg2)
def rcs(self,checkin,cli): def rcs(self, checkin, cli):
""" """
Check the generated XML file into RCS. Initialize the RCS file if Check the generated XML file into RCS. Initialize the RCS file if
it does not already exist. it does not already exist.
@ -290,9 +294,8 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
# If the archive file does not exist, we either set it up # If the archive file does not exist, we either set it up
# or die trying # or die trying
if not os.path.exists(archive): if not os.path.exists(archive):
proc = subprocess.Popen( cmd = [ 'rcs', '-i', '-U', '-q', '-t-"GRAMPS database"', archive ]
'rcs -i -U -q -t-"GRAMPS database" %s' % archive, proc = subprocess.Popen(cmd, stderr = subprocess.PIPE )
stderr = subprocess.PIPE )
status = proc.wait() status = proc.wait()
message = "\n".join(proc.stderr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close() proc.stderr.close()
@ -318,18 +321,21 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
if checkin: if checkin:
# At this point, we have an existing archive file # At this point, we have an existing archive file
xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False) xmlwrite = GrampsDb.XmlWriter(self.db, self.callback, False, False)
xmlwrite.write(archive_base) xmlwrite.write(archive_base)
cmd = ["ci", archive_base]
print cmd
proc = subprocess.Popen( proc = subprocess.Popen(
"ci %s" % archive_base, cmd,
stdin = subprocess.PIPE, stdin = subprocess.PIPE,
stderr = subprocess.PIPE ) stderr = subprocess.PIPE )
proc.stdin.write(comment) proc.stdin.write(comment)
proc.stdin.close() proc.stdin.close()
status = proc.wait()
message = "\n".join(proc.stderr.readlines()) message = "\n".join(proc.stderr.readlines())
proc.stderr.close() proc.stderr.close()
status = proc.wait()
del proc del proc
if status: if status:
@ -349,7 +355,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
else: else:
proc = subprocess.Popen( proc = subprocess.Popen(
"co -p %s > %s.gramps" % (archive_base,archive_base), ("co", "-p", archive_base), stdout=subprocess.PIPE
stderr = subprocess.PIPE ) stderr = subprocess.PIPE )
status = proc.wait() status = proc.wait()
message = "\n".join(proc.stderr.readlines()) message = "\n".join(proc.stderr.readlines())

View File

@ -78,7 +78,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
""" """
Tool.Tool.__init__(self, dbstate, options_class, name) Tool.Tool.__init__(self, dbstate, options_class, name)
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
if not self.person: if not self.person:
ErrorDialog(_('Active person has not been set'), ErrorDialog(_('Active person has not been set'),
@ -97,7 +97,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
self.title = _('Relationship calculator: %(person_name)s' self.title = _('Relationship calculator: %(person_name)s'
) % {'person_name' : name} ) % {'person_name' : name}
window = self.glade.get_widget('relcalc') window = self.glade.get_widget('relcalc')
self.set_window(window,self.glade.get_widget('title'), self.set_window(window, self.glade.get_widget('title'),
_('Relationship to %(person_name)s' _('Relationship to %(person_name)s'
) % {'person_name' : name }, ) % {'person_name' : name },
self.title) self.title)