* src/DisplayState.py: Warning log handler, add timeout handler
svn: r5824
This commit is contained in:
parent
a484bfa838
commit
6ed9d0a161
@ -1,5 +1,5 @@
|
|||||||
2006-01-23 Don Allingham <don@gramps-project.org>
|
2006-01-23 Don Allingham <don@gramps-project.org>
|
||||||
* src/DisplayState.py: Warning log handler
|
* src/DisplayState.py: Warning log handler, add timeout handler
|
||||||
* src/EditFamily.py: remove icon in father/mother column
|
* src/EditFamily.py: remove icon in father/mother column
|
||||||
* src/EditPerson.py: remove commented out code
|
* src/EditPerson.py: remove commented out code
|
||||||
* src/GrampsWidgets.py: add WarnButton
|
* src/GrampsWidgets.py: add WarnButton
|
||||||
|
@ -533,11 +533,21 @@ class WarnHandler(RotateHandler):
|
|||||||
self.setLevel(logging.WARN)
|
self.setLevel(logging.WARN)
|
||||||
self.button = button
|
self.button = button
|
||||||
button.on_clicked(self.display)
|
button.on_clicked(self.display)
|
||||||
|
self.timer = None
|
||||||
|
|
||||||
def emit(self,record):
|
def emit(self,record):
|
||||||
|
if self.timer:
|
||||||
|
gobject.source_remove(self.timer)
|
||||||
|
gobject.timeout_add(180*1000,self._clear)
|
||||||
RotateHandler.emit(self,record)
|
RotateHandler.emit(self,record)
|
||||||
self.button.show()
|
self.button.show()
|
||||||
|
|
||||||
|
def _clear(self):
|
||||||
|
self.button.hide()
|
||||||
|
self.set_capacity(self._capacity)
|
||||||
|
self.timer = None
|
||||||
|
return False
|
||||||
|
|
||||||
def display(self,obj):
|
def display(self,obj):
|
||||||
obj.hide()
|
obj.hide()
|
||||||
g = gtk.glade.XML(const.gladeFile,'scrollmsg')
|
g = gtk.glade.XML(const.gladeFile,'scrollmsg')
|
||||||
@ -546,7 +556,9 @@ class WarnHandler(RotateHandler):
|
|||||||
buf = msg.get_buffer()
|
buf = msg.get_buffer()
|
||||||
for i in self.get_formatted_log():
|
for i in self.get_formatted_log():
|
||||||
buf.insert_at_cursor(i + '\n')
|
buf.insert_at_cursor(i + '\n')
|
||||||
|
self.set_capacity(self._capacity)
|
||||||
top.run()
|
top.run()
|
||||||
|
top.destroy()
|
||||||
|
|
||||||
class DisplayState(GrampsDb.GrampsDBCallback):
|
class DisplayState(GrampsDb.GrampsDBCallback):
|
||||||
|
|
||||||
@ -565,7 +577,9 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
|||||||
self.widget = None
|
self.widget = None
|
||||||
self.warnbtn = warnbtn
|
self.warnbtn = warnbtn
|
||||||
|
|
||||||
|
formatter = logging.Formatter('%(levelname)s %(name)s: %(message)s')
|
||||||
self.rh = WarnHandler(capacity=400,button=warnbtn)
|
self.rh = WarnHandler(capacity=400,button=warnbtn)
|
||||||
|
self.rh.setFormatter(formatter)
|
||||||
self.log = logging.getLogger()
|
self.log = logging.getLogger()
|
||||||
self.log.setLevel(logging.WARN)
|
self.log.setLevel(logging.WARN)
|
||||||
self.log.addHandler(self.rh)
|
self.log.addHandler(self.rh)
|
||||||
|
@ -85,7 +85,7 @@ def latin_to_utf8(s):
|
|||||||
return unicode(s,'iso-8859-1')
|
return unicode(s,'iso-8859-1')
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger('.ReadGedcom')
|
log = logging.getLogger('.GEDCOM_import')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -572,7 +572,7 @@ class GedcomParser:
|
|||||||
self.index += 1
|
self.index += 1
|
||||||
self.text = "";
|
self.text = "";
|
||||||
self.backoff = 0
|
self.backoff = 0
|
||||||
msg = _("Warning: Premature end of file at line %d.\n") % self.index
|
msg = _("Premature end of file at line %d.\n") % self.index
|
||||||
self.errmsg(msg)
|
self.errmsg(msg)
|
||||||
self.error_count = self.error_count + 1
|
self.error_count = self.error_count + 1
|
||||||
self.groups = (-1, TOKEN_UNKNOWN, "","")
|
self.groups = (-1, TOKEN_UNKNOWN, "","")
|
||||||
@ -584,10 +584,7 @@ class GedcomParser:
|
|||||||
return self.groups
|
return self.groups
|
||||||
|
|
||||||
def barf(self,level):
|
def barf(self,level):
|
||||||
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index
|
msg = _("Line %d was not understood, so it was ignored.") % self.index
|
||||||
self.errmsg(msg)
|
|
||||||
msg = "\n\t%s\n" % self.text
|
|
||||||
|
|
||||||
self.errmsg(msg)
|
self.errmsg(msg)
|
||||||
self.error_count = self.error_count + 1
|
self.error_count = self.error_count + 1
|
||||||
self.ignore_sub_junk(level)
|
self.ignore_sub_junk(level)
|
||||||
@ -1128,7 +1125,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
(ok,path) = self.find_file(filename,self.dir_path)
|
(ok,path) = self.find_file(filename,self.dir_path)
|
||||||
if not ok:
|
if not ok:
|
||||||
self.warn(_("Warning: could not import %s") % filename)
|
self.warn(_("Could not import %s") % filename)
|
||||||
path = filename.replace('\\','/')
|
path = filename.replace('\\','/')
|
||||||
photo_handle = self.media_map.get(path)
|
photo_handle = self.media_map.get(path)
|
||||||
if photo_handle == None:
|
if photo_handle == None:
|
||||||
@ -1169,7 +1166,7 @@ class GedcomParser:
|
|||||||
if form:
|
if form:
|
||||||
(ok,path) = self.find_file(filename,self.dir_path)
|
(ok,path) = self.find_file(filename,self.dir_path)
|
||||||
if not ok:
|
if not ok:
|
||||||
self.warn(_("Warning: could not import %s") % filename)
|
self.warn(_("Could not import %s") % filename)
|
||||||
path = filename.replace('\\','/')
|
path = filename.replace('\\','/')
|
||||||
photo_handle = self.media_map.get(path)
|
photo_handle = self.media_map.get(path)
|
||||||
if photo_handle == None:
|
if photo_handle == None:
|
||||||
|
@ -182,7 +182,6 @@ class ViewManager:
|
|||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
self.window.add(vbox)
|
self.window.add(vbox)
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
hbox.set_border_width(4)
|
|
||||||
self.ebox = gtk.EventBox()
|
self.ebox = gtk.EventBox()
|
||||||
self.bbox = gtk.VBox()
|
self.bbox = gtk.VBox()
|
||||||
self.ebox.add(self.bbox)
|
self.ebox.add(self.bbox)
|
||||||
|
Loading…
Reference in New Issue
Block a user