error: Rename confusing sync/async param to modal

This commit is contained in:
Cole Robinson 2013-09-06 20:16:37 -04:00
parent aabb3c8e48
commit 0551d8956b
7 changed files with 23 additions and 25 deletions

View File

@ -49,7 +49,7 @@ def _show_startup_error(msg, details):
err.show_err(title + ": " + msg,
details=details,
title=title,
async=False,
modal=True,
debug=False)

View File

@ -1194,7 +1194,7 @@ class vmmAddHardware(vmmGObjectUI):
"next guest shutdown?")),
dialog_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.YES_NO,
async=False)
modal=True)
if not res:
return (False, None)

View File

@ -463,8 +463,7 @@ class VNCViewer(Viewer):
"the VNC server"),
details=(_("The credential type %s is not supported") %
(str(cred))),
title=_("Unable to authenticate"),
async=True)
title=_("Unable to authenticate"))
# schedule_retry will error out
self.console.viewerRetriesScheduled = 10
@ -735,7 +734,7 @@ class SpiceViewer(Viewer):
error = self.console.err
error.show_err(_("USB redirection error"),
text2=str(errstr),
async=False)
modal=True)
def get_usb_widget(self):

View File

@ -283,15 +283,14 @@ class vmmCreateVolume(vmmGObjectUI):
return True
def show_err(self, info, details=None):
async = not self.topwin.get_modal()
self.err.show_err(info, details, async=async)
self.err.show_err(info, details, modal=self.topwin.get_modal())
def val_err(self, info, details):
modal = self.topwin.get_modal()
ret = False
try:
self.topwin.set_modal(False)
ret = self.err.val_err(info, details, async=not modal)
ret = self.err.val_err(info, details, modal=modal)
finally:
self.topwin.set_modal(modal)

View File

@ -604,14 +604,14 @@ class vmmEngine(vmmGObject):
if probe_connection:
remember_connection = self.err.show_err(msg, details, title,
buttons=Gtk.ButtonsType.YES_NO,
dialog_type=Gtk.MessageType.QUESTION, async=False)
dialog_type=Gtk.MessageType.QUESTION, modal=True)
if remember_connection:
self.conns[conn.get_uri()]["probeConnection"] = False
else:
self.idle_add(self._do_edit_connect, self.windowManager, conn)
else:
if self._can_exit():
self.err.show_err(msg, details, title, async=False)
self.err.show_err(msg, details, title, modal=True)
self.idle_add(self.exit_app, conn)
else:
self.err.show_err(msg, details, title)
@ -731,7 +731,7 @@ class vmmEngine(vmmGObject):
# The error message must be sync otherwise the user will not
# know why the application ended.
self.err.show_err("%s does not have VM with UUID %s" %
(uri, uuid), async=False)
(uri, uuid), modal=True)
return
details = self._get_details_dialog(uri, uuid)
@ -1013,7 +1013,7 @@ class vmmEngine(vmmGObject):
"start up?"),
dialog_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.YES_NO,
async=False)
modal=True)
if not res:
return

View File

@ -28,7 +28,7 @@ from virtManager.baseclass import vmmGObject
def _launch_dialog(dialog, primary_text, secondary_text, title,
widget=None, sync=True):
widget=None, modal=True):
dialog.set_property("text", primary_text)
dialog.format_secondary_text(secondary_text or None)
dialog.set_title(title)
@ -37,7 +37,7 @@ def _launch_dialog(dialog, primary_text, secondary_text, title,
dialog.get_content_area().add(widget)
res = False
if sync:
if modal:
res = dialog.run()
res = bool(res in [Gtk.ResponseType.YES, Gtk.ResponseType.OK])
dialog.destroy()
@ -65,7 +65,7 @@ class vmmErrorDialog(vmmGObject):
return self._parent
def show_err(self, summary, details=None, title="",
async=True, debug=True,
modal=False, debug=True,
dialog_type=Gtk.MessageType.ERROR,
buttons=Gtk.ButtonsType.CLOSE,
text2=None):
@ -91,14 +91,14 @@ class vmmErrorDialog(vmmGObject):
return dialog.show_dialog(primary_text=summary,
secondary_text=text2,
details=details, title=title,
sync=not async)
modal=modal)
###################################
# Simple one shot message dialogs #
###################################
def _simple_dialog(self, dialog_type, buttons, text1,
text2, title, widget=None, async=False):
text2, title, widget=None, modal=True):
dialog = Gtk.MessageDialog(self.get_parent(),
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT,
@ -111,9 +111,9 @@ class vmmErrorDialog(vmmGObject):
return _launch_dialog(self._simple,
text1, text2 or "", title or "",
widget=widget,
sync=not async)
modal=modal)
def val_err(self, text1, text2=None, title=_("Input Error"), async=True):
def val_err(self, text1, text2=None, title=_("Input Error"), modal=True):
logtext = "Validation Error: %s" % text1
if text2:
logtext += " %s" % text2
@ -128,13 +128,13 @@ class vmmErrorDialog(vmmGObject):
self._simple_dialog(dtype, buttons,
str(text1),
text2 and str(text2) or "",
str(title), None, async)
str(title), None, modal)
return False
def show_info(self, text1, text2=None, title="", widget=None, async=True):
def show_info(self, text1, text2=None, title="", widget=None, modal=True):
dtype = Gtk.MessageType.INFO
buttons = Gtk.ButtonsType.OK
self._simple_dialog(dtype, buttons, text1, text2, title, widget, async)
self._simple_dialog(dtype, buttons, text1, text2, title, widget, modal)
return False
def yes_no(self, text1, text2=None, title=None):
@ -233,7 +233,7 @@ class _errorDialog (Gtk.MessageDialog):
def show_dialog(self, primary_text, secondary_text="",
title="", details="", chktext="",
sync=True):
modal=True):
chkbox = None
res = None
@ -256,7 +256,7 @@ class _errorDialog (Gtk.MessageDialog):
res = _launch_dialog(self,
primary_text, secondary_text or "",
title,
sync=sync)
modal=modal)
if chktext:
res = [res, chkbox.get_active()]

View File

@ -371,4 +371,4 @@ class vmmStorageBrowser(vmmGObjectUI):
def show_err(self, info, details=None):
self.err.show_err(info,
details=details,
async=False)
modal=True)