Reviewers: ,
Please review this at http://codereview.tryton.org/396002/
Affected files:
M tryton/common/common.py
M tryton/gui/window/dbcreate.py
M tryton/gui/window/view_form/screen/screen.py
M tryton/gui/window/view_form/view/form.py
M tryton/gui/window/view_form/view/list_gtk/parser.py
M tryton/gui/window/wizard.py
Index: tryton/common/common.py
===================================================================
--- a/tryton/common/common.py
+++ b/tryton/common/common.py
@@ -1227,10 +1227,7 @@
thread.start_new_thread(self.start, ())
watch = None
- parent_sensitive = self.parent.props.sensitive
i = 0
- win = None
- progressbar = None
while (not self.res) and (not self.error):
i += 1
if i > 1:
@@ -1240,55 +1237,9 @@
with gtk.gdk.lock:
while gtk.events_pending():
gtk.main_iteration()
- if i > 10 and main_iteration_p:
- if not win or not progressbar:
- win = gtk.Window(type=gtk.WINDOW_TOPLEVEL)
- win.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
- if hasattr(win, 'set_deletable'):
- win.set_deletable(False)
- win.set_decorated(False)
- vbox = gtk.VBox(False, 0)
- hbox = gtk.HBox(False, 13)
- hbox.set_border_width(10)
- img = gtk.Image()
- img.set_from_stock('tryton-dialog-information',
- gtk.ICON_SIZE_DIALOG)
- hbox.pack_start(img, expand=True, fill=False)
- vbox2 = gtk.VBox(False, 0)
- label = gtk.Label()
- label.set_markup(
- '<b>' + _('Operation in progress') + '</b>')
- label.set_alignment(0.0, 0.5)
- vbox2.pack_start(label, expand=True, fill=False)
- vbox2.pack_start(gtk.HSeparator(), expand=True,
fill=True)
- vbox2.pack_start(gtk.Label(_("Please wait,\n" \
- "this operation may take a while...")),
- expand=True, fill=False)
- hbox.pack_start(vbox2, expand=True, fill=True)
- vbox.pack_start(hbox)
- progressbar = gtk.ProgressBar()
- progressbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)
- vbox.pack_start(progressbar, expand=True, fill=False)
- viewport = gtk.Viewport()
- viewport.set_shadow_type(gtk.SHADOW_ETCHED_IN)
- viewport.add(vbox)
- win.add(viewport)
- win.set_transient_for(self.parent)
- win.set_modal(True)
- win.show_all()
- win.window.set_cursor(watch)
- self.parent.props.sensitive = False
- with gtk.gdk.lock:
- progressbar.pulse()
time.sleep(0.1)
- self.parent.props.sensitive = parent_sensitive
if self.parent.window:
self.parent.window.set_cursor(None)
- if win:
- win.destroy()
- with gtk.gdk.lock:
- while gtk.events_pending():
- gtk.main_iteration()
if self.exception:
if process_exception_p:
if process_exception(self.exception):
Index: tryton/gui/window/dbcreate.py
===================================================================
--- a/tryton/gui/window/dbcreate.py
+++ b/tryton/gui/window/dbcreate.py
@@ -315,6 +315,7 @@
self.button_create.set_sensitive(False)
while True:
+ self.dialog.props.sensitive = True
res = self.dialog.run()
dbname = self.entry_dbname.get_text()
url = self.entry_server_connection.get_text()
@@ -367,6 +368,7 @@
else: # Everything runs fine, break the block here
host = url_m.group(1)
port = url_m.group(2)
+ self.dialog.props.sensitive = False
try:
rpcprogress = common.RPCProgress('db_exec',
(host, int(port), 'create', dbname,
passwd,
Index: tryton/gui/window/view_form/screen/screen.py
===================================================================
--- a/tryton/gui/window/view_form/screen/screen.py
+++ b/tryton/gui/window/view_form/screen/screen.py
@@ -536,8 +536,7 @@
return True
return False
- def reload(self, written=False):
- ids = self.sel_ids_get()
+ def reload(self, ids, written=False):
self.group.reload(ids)
if written:
self.group.written(ids)
Index: tryton/gui/window/view_form/view/form.py
===================================================================
--- a/tryton/gui/window/view_form/view/form.py
+++ b/tryton/gui/window/view_form/view/form.py
@@ -196,6 +196,6 @@
}, context=context)
else:
raise Exception('Unallowed button type')
- self.screen.reload(written=True)
+ self.screen.reload([record_id], written=True)
else:
self.screen.display()
Index: tryton/gui/window/view_form/view/list_gtk/parser.py
===================================================================
--- a/tryton/gui/window/view_form/view/list_gtk/parser.py
+++ b/tryton/gui/window/view_form/view/list_gtk/parser.py
@@ -976,7 +976,7 @@
}, context=ctx)
else:
raise Exception('Unallowed button type')
- self.screen.reload(written=True)
+ self.screen.reload([obj_id], written=True)
else:
self.screen.display()
Index: tryton/gui/window/wizard.py
===================================================================
--- a/tryton/gui/window/wizard.py
+++ b/tryton/gui/window/wizard.py
@@ -348,7 +348,8 @@
else:
dialog = self.page
if hasattr(dialog, 'screen'):
- dialog.screen.reload(written=True)
+ dialog.screen.reload([dialog.screen.current_record.id],
+ written=True)
def end(self):
super(WizardDialog, self).end()
--
[email protected] mailing list