Make XML writer gtk independant again.
svn: r8144
This commit is contained in:
parent
4cf8d5d39a
commit
08cb17adde
@ -1,3 +1,12 @@
|
||||
2007-02-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||
* src/GrampsDb/_GrampsDbWriteXML.py: add non-gtk xml writer
|
||||
* src/GrampsDb/__init__.py: export non-gtk writer
|
||||
* src/GrampsDb/_GrampsDbExceptions.py: add WriteFailure exception
|
||||
* src/GrampsDb/_LongOpStatus.py: protect against div by zero
|
||||
* src/GrampsDb/_ProgressMonitor.py: workaround gtk issues
|
||||
* src/ProgressDialog.py: work around gtk issues
|
||||
* src/GrampsDbUtils/_WriteXML.py: make gtk wrapper for non-gtk version
|
||||
|
||||
2007-02-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||
* src/ViewManager.py: add progress monitor
|
||||
* src/GrampsDb/_GrampsDbBase.py: add get_length to cursors
|
||||
|
@ -31,7 +31,17 @@ class GrampsDbException(Exception):
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
|
||||
class GrampsDbWriteFailure(Exception):
|
||||
"""
|
||||
Error used to indicate that a write to a database has failed.
|
||||
"""
|
||||
|
||||
def __int__(self, value):
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return repr(self.value)
|
||||
|
||||
class FileVersionError(Exception):
|
||||
"""
|
||||
Error used to report that a file could not be read because
|
||||
|
1079
src/GrampsDb/_GrampsDbWriteXML.py
Normal file
1079
src/GrampsDb/_GrampsDbWriteXML.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,8 @@ class LongOpStatus(GrampsDBCallback):
|
||||
GrampsDBCallback.__init__(self)
|
||||
self._msg = msg
|
||||
self._total_steps = total_steps
|
||||
self._interval = interval
|
||||
# don't allow intervals less that 1
|
||||
self._interval = max(interval,1)
|
||||
self._can_cancel = can_cancel
|
||||
|
||||
self._cancel = False
|
||||
|
@ -74,7 +74,7 @@ class ProgressMonitor(object):
|
||||
self._dlg = self._dialog_class(self._dialog_class_params,
|
||||
self._title)
|
||||
|
||||
self._dlg.show()
|
||||
#self._dlg.show()
|
||||
|
||||
return self._dlg
|
||||
|
||||
@ -116,7 +116,8 @@ class ProgressMonitor(object):
|
||||
|
||||
if facade.pbar_idx == None:
|
||||
facade.pbar_idx = dlg.add(facade.status_obj)
|
||||
|
||||
|
||||
dlg.show()
|
||||
dlg.step(facade.pbar_idx)
|
||||
|
||||
def _end(self, idx):
|
||||
@ -137,47 +138,4 @@ class ProgressMonitor(object):
|
||||
facade.status_obj.disconnect(facade.end_cb_id)
|
||||
del self._status_stack[idx]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import time
|
||||
from GrampsDb import LongOpStatus
|
||||
|
||||
def test(a,b):
|
||||
d = ProgressDialog(_GtkProgressDialog, "Test Progress")
|
||||
|
||||
s = LongOpStatus("Doing very long operation", 100, 10)
|
||||
|
||||
d.add_op(s)
|
||||
|
||||
for i in xrange(0, 99):
|
||||
time.sleep(0.1)
|
||||
if i == 30:
|
||||
t = LongOpStatus("doing a shorter one", 100, 10,
|
||||
can_cancel=True)
|
||||
d.add_op(t)
|
||||
for j in xrange(0, 99):
|
||||
if t.should_cancel():
|
||||
break
|
||||
time.sleep(0.1)
|
||||
t.heartbeat()
|
||||
t.end()
|
||||
if i == 60:
|
||||
t = LongOpStatus("doing another shorter one", 100, 10)
|
||||
d.add_op(t)
|
||||
for j in xrange(0, 99):
|
||||
time.sleep(0.1)
|
||||
t.heartbeat()
|
||||
t.end()
|
||||
s.heartbeat()
|
||||
s.end()
|
||||
|
||||
w = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
w.connect('destroy', gtk.main_quit)
|
||||
button = gtk.Button("Test")
|
||||
button.connect("clicked", test, None)
|
||||
w.add(button)
|
||||
button.show()
|
||||
w.show()
|
||||
gtk.main()
|
||||
print 'done'
|
||||
|
@ -43,7 +43,7 @@ from _GrampsDbBase import GrampsDbBase
|
||||
from _GrampsDbFactories import \
|
||||
gramps_db_factory
|
||||
|
||||
from _GrampsDbExceptions import GrampsDbException, FileVersionError
|
||||
from _GrampsDbExceptions import *
|
||||
|
||||
from _GrampsDBCallback import GrampsDBCallback
|
||||
|
||||
@ -51,6 +51,9 @@ from _DbUtils import *
|
||||
|
||||
import _GrampsDbConst as GrampsDbConst
|
||||
|
||||
from _GrampsDbWriteXML import GrampsDbXmlWriter, \
|
||||
exportData, quick_write
|
||||
|
||||
from _LongOpStatus import LongOpStatus
|
||||
from _ProgressMonitor import ProgressMonitor
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -82,14 +82,8 @@ class GtkProgressDialog(gtk.Dialog):
|
||||
self.connect('delete_event', self._warn)
|
||||
self.set_has_separator(False)
|
||||
self.set_title(title)
|
||||
#self.set_border_width(12)
|
||||
#self.vbox.set_spacing(10)
|
||||
#lbl = gtk.Label('<span size="larger" weight="bold">%s</span>' % title)
|
||||
#lbl.set_use_markup(True)
|
||||
#self.vbox.pack_start(lbl)
|
||||
#self.set_size_request(350,125)
|
||||
self.set_resize_mode(gtk.RESIZE_IMMEDIATE)
|
||||
self.show_all()
|
||||
#self.set_resize_mode(gtk.RESIZE_IMMEDIATE)
|
||||
#self.show()
|
||||
|
||||
self._progress_bars = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user