Changeset 08eca2607f01…
Parent f01671e11984…
by
Changes to 13 files · Browse files at 08eca2607f01 Showing diff from parent f01671e11984 Diff from another changeset...
@@ -273,7 +273,7 @@
# verify input
if src == "":
- error_dialog("Source path is empty", "Please enter")
+ error_dialog(self, "Source path is empty", "Please enter")
self._src_input.grab_focus()
return False
@@ -307,11 +307,11 @@ dlg.run()
dlg.hide()
except util.Abort, inst:
- error_dialog("Clone aborted", str(inst))
+ error_dialog(self, "Clone aborted", str(inst))
return False
except:
import traceback
- error_dialog("Clone error", traceback.format_exc())
+ error_dialog(self, "Clone error", traceback.format_exc())
return False
self._add_src_to_recent(src)
|
@@ -28,7 +28,7 @@ def about():
raise "About dialog currently under construction"
-def _message_dialog(type, primary, secondary, buttons=gtk.BUTTONS_OK,
+def _message_dialog(parent, type, primary, secondary, buttons=gtk.BUTTONS_OK,
title="TortoiseHg"):
""" Display a given type of MessageDialog with the given message.
@@ -36,7 +36,7 @@
:param message: the message you want to display.
"""
- dialog = MessageDialog(flags=gtk.DIALOG_MODAL, type=type,
+ dialog = MessageDialog(parent, flags=gtk.DIALOG_MODAL, type=type,
buttons=buttons)
dialog.set_title(title)
dialog.set_markup('<big><b>' + primary + '</b></big>')
@@ -46,7 +46,7 @@ dialog.destroy()
return response
-def entry_dialog(msg, visible=True, default='', respfunc=None):
+def entry_dialog(parent, msg, visible=True, default='', respfunc=None):
""" Allow a user to enter a text string (username/password)
:param message: the message you want to display.
:param visible: should reponse be visible to user
@@ -54,7 +54,7 @@ :param respfunc: callback function for when dialog exits
:returns if respfunc returns dialog, else return response text
"""
- dialog = gtk.Dialog(flags=gtk.DIALOG_MODAL,
+ dialog = gtk.Dialog(parent=parent, flags=gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK))
dialog.set_title('TortoiseHg Prompt')
entry = gtk.Entry()
@@ -78,18 +78,19 @@ dialog.destroy()
return text
-def error_dialog(primary, secondary):
+def error_dialog(parent, primary, secondary):
""" Display an error dialog with the given message. """
- return _message_dialog(gtk.MESSAGE_ERROR, primary, secondary)
+ return _message_dialog(parent, gtk.MESSAGE_ERROR, primary, secondary)
-def info_dialog(primary, secondary):
+def info_dialog(parent, primary, secondary):
""" Display an info dialog with the given message. """
- return _message_dialog(gtk.MESSAGE_INFO, primary, secondary)
+ return _message_dialog(parent, gtk.MESSAGE_INFO, primary, secondary)
-def warning_dialog(primary, secondary):
+def warning_dialog(parent, primary, secondary):
""" Display a warning dialog with the given message. """
- return _message_dialog(gtk.MESSAGE_WARNING, primary, secondary)
+ return _message_dialog(parent, gtk.MESSAGE_WARNING, primary, secondary)
-def question_dialog(primary, secondary):
+def question_dialog(parent, primary, secondary):
""" Display a dialog with the given question. """
- return _message_dialog(gtk.MESSAGE_QUESTION, primary, secondary, gtk.BUTTONS_YES_NO)
+ return _message_dialog(parent, gtk.MESSAGE_QUESTION, primary, secondary,
+ gtk.BUTTONS_YES_NO)
|
@@ -83,8 +83,8 @@ self._image_frame = gtk.Frame()
self._image_frame.set_shadow_type(gtk.SHADOW_NONE)
self._image = gtk.Image()
- imageid = MessageDialog.image_map[type]
- self._image.set_from_stock(imageid, gtk.ICON_SIZE_DIALOG)
+ self._image.set_from_stock(MessageDialog.image_map[type],
+ gtk.ICON_SIZE_DIALOG)
self._image_frame.add(self._image)
hbox.pack_start(self._image_frame, padding=5)
|
@@ -207,7 +207,7 @@ if name == 'patchbomb':
break
else:
- error_dialog('Email not enabled',
+ error_dialog(self, 'Email not enabled',
'You must enable the patchbomb extension to use this tool')
self.response(gtk.RESPONSE_CANCEL)
@@ -261,11 +261,11 @@ subjtext = self._subjbox.child.get_text()
if not totext:
- info_dialog('Info required', 'You must specify a recipient')
+ info_dialog(self, 'Info required', 'You must specify a recipient')
self._tobox.grab_focus()
return
if not fromtext:
- info_dialog('Info required', 'You must specify a sender address')
+ info_dialog(self, 'Info required', 'You must specify a sender address')
self._frombox.grab_focus()
return
if not self.repo:
@@ -273,7 +273,7 @@
if self.repo.ui.config('email', 'method', 'smtp') == 'smtp':
if not self.repo.ui.config('smtp', 'host'):
- info_dialog('Info required', 'You must configure SMTP')
+ info_dialog(self, 'Info required', 'You must configure SMTP')
dlg = ConfigDialog(self.root, False)
dlg.show_all()
dlg.focus_field('smtp.host')
|
@@ -117,7 +117,7 @@ feedback from Mercurial can be handled by the user via dialog
windows.
'''
- def __init__(self, args=[], postfunc=None):
+ def __init__(self, args=[], postfunc=None, parent=None):
self.outputq = Queue.Queue()
self.dialogq = Queue.Queue()
self.responseq = Queue.Queue()
@@ -125,6 +125,7 @@ self.args = args
self.ret = None
self.postfunc = postfunc
+ self.parent = parent
threading.Thread.__init__(self)
def getqueue(self):
@@ -142,7 +143,7 @@ '''Polled every 10ms to serve dialogs for the background thread'''
try:
(prompt, visible, default) = self.dialogq.get_nowait()
- self.dlg = entry_dialog(prompt, visible, default,
+ self.dlg = entry_dialog(self.parent, prompt, visible, default,
self.dialog_response)
except Queue.Empty:
pass
|
@@ -182,11 +182,11 @@ while q.qsize(): out += q.get(0)
self.hgout = out
except util.Abort, inst:
- error_dialog("Error in %s command" % cmd, "abort: %s" % inst)
+ error_dialog(self, "Error in %s command" % cmd, "abort: %s" % inst)
return False
except:
import traceback
- error_dialog("Error in %s command" % cmd,
+ error_dialog(self, "Error in %s command" % cmd,
"Traceback:\n%s" % traceback.format_exc())
return False
return True
|
@@ -202,10 +202,10 @@ rev = self._rev_input.get_text()
if not rev:
- error_dialog("Can't unmerge", "please select revision to unmerge")
+ error_dialog(self, "Can't unmerge", "please select revision to unmerge")
return
- response = question_dialog("Undo merge",
+ response = question_dialog(self, "Undo merge",
"and checkout revision %s?" % rev)
if response != gtk.RESPONSE_YES:
return
@@ -224,10 +224,10 @@ force = self._chbox_force.get_active()
if not rev:
- error_dialog("Can't merge", "please enter revision to merge")
+ error_dialog(self, "Can't merge", "please enter revision to merge")
return
- response = question_dialog("Really want to merge?",
+ response = question_dialog(self, "Really want to merge?",
"with revision %s" % rev)
if response != gtk.RESPONSE_YES:
return
|
@@ -97,7 +97,7 @@
def _close_clicked(self, *args):
if threading.activeCount() != 1:
- error_dialog("Can't close now", "command is running")
+ error_dialog(self, "Can't close now", "command is running")
else:
gtk.main_quit()
@@ -122,7 +122,7 @@ return tbutton
def _clean_clicked(self, toolbutton, data=None):
- response = question_dialog("Clean repository",
+ response = question_dialog(self, "Clean repository",
"%s ?" % os.path.basename(self.root))
if not response == gtk.RESPONSE_YES:
return
@@ -141,7 +141,7 @@ shell_notify([self.cwd])
def _rollback_clicked(self, toolbutton, data=None):
- response = question_dialog("Rollback repository",
+ response = question_dialog(self, "Rollback repository",
"%s ?" % os.path.basename(self.root))
if not response == gtk.RESPONSE_YES:
return
|
@@ -157,7 +157,7 @@ check if server is running, or to terminate if running
'''
if gservice and not gservice.stopped:
- if question_dialog("Really Exit?",
+ if question_dialog(self, "Really Exit?",
"Server process is still running\n" +
"Exiting will stop the server.") != gtk.RESPONSE_YES:
return False
@@ -223,7 +223,7 @@ except:
try: port = int(self.defport)
except: port = 8000
- error_dialog("Invalid port 2048..65535", "Defaulting to " +
+ error_dialog(self, "Invalid port 2048..65535", "Defaulting to " +
self.defport)
global gservice
|
@@ -250,7 +250,7 @@ flags = ['--clean']
msg = 'Lose all changes in your working directory?'
warning += ', requires clean checkout'
- if question_dialog(msg, warning) != gtk.RESPONSE_YES:
+ if question_dialog(self, msg, warning) != gtk.RESPONSE_YES:
return
self.write("", False)
@@ -307,13 +307,13 @@
def _close_clicked(self, toolbutton, data=None):
if threading.activeCount() != 1:
- error_dialog("Can't close now", "command is running")
+ error_dialog(self, "Can't close now", "command is running")
else:
gtk.main_quit()
def _delete(self, widget, event):
if threading.activeCount() != 1:
- error_dialog("Can't close now", "command is running")
+ error_dialog(self, "Can't close now", "command is running")
return True
else:
gtk.main_quit()
@@ -372,7 +372,7 @@ def _email_clicked(self, toolbutton, data=None):
path = self._pathtext.get_text()
if not path:
- info_dialog('No repository selected',
+ info_dialog(self, 'No repository selected',
'Select a peer repository to compare with')
self._pathbox.grab_focus()
return
@@ -424,7 +424,7 @@
# execute command and show output on text widget
gobject.timeout_add(10, self.process_queue)
- self.hgthread = HgThread(cmdline)
+ self.hgthread = HgThread(cmdline, parent=self)
self.hgthread.start()
self.stbar.begin()
self.stbar.set_status_text('hg ' + ' '.join(cmd + [remote_path]))
|
@@ -176,25 +176,26 @@
# verify input
if name == "":
- error_dialog("Tag input is empty", "Please enter tag name")
+ error_dialog(self, "Tag input is empty", "Please enter tag name")
self._tag_input.grab_focus()
return False
if use_msg and not message:
- error_dialog("Custom commit message is empty", "Please enter commit message")
+ error_dialog(self, "Custom commit message is empty",
+ "Please enter commit message")
self._commit_message.grab_focus()
return False
# add tag to repo
try:
self._add_hg_tag(name, rev, message, is_local, force=force)
- info_dialog("Tagging completed", "Tag '%s' has been added" % name)
+ info_dialog(self, "Tagging completed", "Tag '%s' has been added" % name)
self._refresh()
except util.Abort, inst:
- error_dialog("Error in tagging", str(inst))
+ error_dialog(self, "Error in tagging", str(inst))
return False
except:
import traceback
- error_dialog("Error in tagging", traceback.format_exc())
+ error_dialog(self, "Error in tagging", traceback.format_exc())
return False
def _do_rm_tag(self):
@@ -206,7 +207,7 @@
# verify input
if name == "":
- error_dialog("Tag name is empty", "Please select tag name to remove")
+ error_dialog(self, "Tag name is empty", "Please select tag name to remove")
self._tag_input.grab_focus()
return False
@@ -217,14 +218,14 @@
try:
self._rm_hg_tag(name, message, is_local)
- info_dialog("Tagging completed", "Tag '%s' has been removed" % name)
+ info_dialog(self, "Tagging completed", "Tag '%s' has been removed" % name)
self._refresh()
except util.Abort, inst:
- error_dialog("Error in tagging", str(inst))
+ error_dialog(self, "Error in tagging", str(inst))
return False
except:
import traceback
- error_dialog("Error in tagging", traceback.format_exc())
+ error_dialog(self, "Error in tagging", traceback.format_exc())
return False
|
@@ -33,7 +33,7 @@ except RepoError:
repo = None
if configrepo:
- error_dialog('No repository found', 'no repo at ' + root)
+ error_dialog(self, 'No repository found', 'no repo at ' + root)
self.response(gtk.RESPONSE_CANCEL)
# Catch close events
@@ -301,7 +301,7 @@
def _response(self, widget, response_id):
if self.dirty:
- if question_dialog('Quit without saving?',
+ if question_dialog(self, 'Quit without saving?',
'Yes to abandon changes, No to continue') != gtk.RESPONSE_YES:
widget.emit_stop_by_name('response')
@@ -584,7 +584,7 @@ f.write(str(self.ini))
f.close()
except IOError, e:
- error_dialog('Unable to write back configuration file', str(e))
+ error_dialog(self, 'Unable to write back configuration file', str(e))
self._btn_apply.set_sensitive(False)
self.dirty = False
|
@@ -172,10 +172,10 @@ overwrite = self._overwrite.get_active()
if not rev:
- error_dialog("Can't update", "please enter revision to update to")
+ error_dialog(self, "Can't update", "please enter revision to update to")
return
- response = question_dialog("Really want to update?",
+ response = question_dialog(self, "Really want to update?",
"to revision %s" % rev)
if response != gtk.RESPONSE_YES:
return
|
Loading...