本文整理汇总了Python中rabbitvcs.ui.dialog.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, path):
InterfaceNonView.__init__(self)
log.debug("incoming path: %s"%path)
self.path = path
self.vcs = rabbitvcs.vcs.VCS()
self.svn = self.vcs.svn()
status = self.svn.status(self.path)
if status.simple_content_status() != rabbitvcs.vcs.status.status_complicated:
log.debug("The specified file is not conflicted. There is nothing to do.")
self.close()
return
filename = os.path.basename(path)
dialog = rabbitvcs.ui.dialog.ConflictDecision(filename)
action = dialog.run()
dialog.destroy()
if action == -1:
#Cancel
pass
elif action == 0:
#Accept Mine
working = self.get_working_path(path)
shutil.copyfile(working, path)
self.svn.resolve(path)
elif action == 1:
#Accept Theirs
ancestor, theirs = self.get_revisioned_paths(path)
shutil.copyfile(theirs, path)
self.svn.resolve(path)
elif action == 2:
#Merge Manually
working = self.get_working_path(path)
ancestor, theirs = self.get_revisioned_paths(path)
log.debug("launching merge tool with base: %s, mine: %s, theirs: %s, merged: %s"%(ancestor, working, theirs, path))
rabbitvcs.util.helper.launch_merge_tool(base=ancestor, mine=working, theirs=theirs, merged=path)
dialog = rabbitvcs.ui.dialog.MarkResolvedPrompt()
mark_resolved = dialog.run()
dialog.destroy()
if mark_resolved == 1:
self.svn.resolve(path)
self.close()
示例2: get_log_message
def get_log_message(self):
"""
A callback method that retrieves a supplied log message.
Returns a list where the first element is True/False. Returning true
tells the action to continue, false tells it to cancel. The second
element is the log message, which is specified by self.message.
self.message is set by calling the self.set_log_message() method from
the UI interface class.
@rtype: (boolean, string)
@return: (True=continue/False=cancel, log message)
"""
if self.message is None:
gtk.gdk.threads_enter()
dialog = rabbitvcs.ui.dialog.TextChange(_("Log Message"))
result = dialog.run()
gtk.gdk.threads_leave()
should_continue = (result[0] == gtk.RESPONSE_OK)
return should_continue, result[1].encode("utf-8")
else:
return True, self.message.encode("utf-8")
示例3: browser_copy_to
def browser_copy_to(self, data=None, user_data=None):
from rabbitvcs.ui.dialog import OneLineTextChange
dialog = OneLineTextChange(
_("Where do you want to copy the selection?"),
_("New Location:"),
self.caller.get_url()
)
result = dialog.run()
if result is None:
return
(response, new_url) = result
if response == Gtk.ResponseType.CANCEL:
return
sources = self.__generate_sources_list()
self.caller.action = rabbitvcs.ui.action.SVNAction(
self.svn,
notification=False
)
self.caller.action.append(self.svn.copy_all, sources, new_url, copy_as_child=True)
self.caller.action.append(self.svn.list, self.caller.get_url(), recurse=False)
self.caller.action.append(self.caller.populate_table, 1)
self.caller.action.schedule()
示例4: get_client_cert
def get_client_cert(self, realm, may_save):
"""
A callback method that is used to get an ssl certificate.
The dialog must be called from within a threaded block, otherwise it
will not be responsive.
@type realm: string
@param realm: The certificate realm.
@type may_save: boolean
@param may_save: Whether or not the passphrase can be saved.
@rtype: (boolean, string, boolean)
@return: (True=continue/False=cancel, password, may save)
"""
gtk.gdk.threads_enter()
dialog = rabbitvcs.ui.dialog.SSLClientCertPrompt(
realm,
may_save
)
result = dialog.run()
gtk.gdk.threads_leave()
return result
示例5: get_user
def get_user(self):
gtk.gdk.threads_enter()
dialog = rabbitvcs.ui.dialog.NameEmailPrompt()
result = dialog.run()
gtk.gdk.threads_leave()
return result
示例6: saveas
def saveas(self, path=None):
if path is None:
from rabbitvcs.ui.dialog import FileSaveAs
dialog = FileSaveAs()
path = dialog.run()
if path is not None:
fh = open(path, "w")
fh.write(self.table.generate_string_from_data())
fh.close()
示例7: delete_properties
def delete_properties(self, names):
recursive = False
if(os.path.isdir(self.path)):
dialog = rabbitvcs.ui.dialog.Confirmation(RECURSIVE_DELETE_MSG)
recursive = dialog.run()
for name in names:
self.svn.propdel(self.path, name, recurse=recursive)
self.refresh()
示例8: __init__
def __init__(self, path):
InterfaceNonView.__init__(self)
self.path = path
self.vcs = rabbitvcs.vcs.VCS()
self.svn = self.vcs.svn()
status = self.svn.status(self.path)
if status.simple_content_status() != rabbitvcs.vcs.status.status_complicated:
log.debug("The specified file is not conflicted. There is nothing to do.")
self.close()
return
filename = os.path.basename(path)
dialog = rabbitvcs.ui.dialog.ConflictDecision(filename)
(action, mark_resolved) = dialog.run()
dialog.destroy()
if action == -1:
#Cancel
pass
elif action == 0:
#Accept Mine
working = self.get_working_path(path)
shutil.copyfile(working, path)
if mark_resolved:
self.svn.resolve(path)
elif action == 1:
#Accept Theirs
head = self.get_head_path(path)
shutil.copyfile(head, path)
if mark_resolved:
self.svn.resolve(path)
elif action == 2:
#Merge Manually
head = self.get_head_path(path)
working = self.get_working_path(path)
shutil.copyfile(working, path)
rabbitvcs.util.helper.launch_merge_tool(path, head)
if mark_resolved:
self.svn.resolve(path)
self.close()
示例9: edit_property
def edit_property(self, name=""):
value = self.svn.propget(self.path, name)
dialog = rabbitvcs.ui.dialog.Property(name, value)
name,value,recurse = dialog.run()
if name:
success = self.svn.propset(self.path, name, value, overwrite=True, recurse=False)
if not success:
rabbitvcs.ui.dialog.MessageBox(_("Unable to set new value for property."))
self.refresh()
示例10: create_repository_folder
def create_repository_folder(self, data=None, user_data=None):
from rabbitvcs.ui.dialog import NewFolder
dialog = NewFolder()
result = dialog.run()
if result is None:
return
(folder_name, log_message) = result
new_url = self.paths[0].rstrip("/") + "/" + folder_name
self.caller.action = rabbitvcs.ui.action.SVNAction(
self.svn,
notification=False
)
self.caller.action.append(self.svn.mkdir, new_url, log_message)
self.caller.action.append(self.svn.list, self.paths[0], recurse=False)
self.caller.action.append(self.caller.populate_table, 1)
self.caller.action.schedule()
示例11: get_ssl_trust
def get_ssl_trust(self, data):
"""
A callback method that requires the user to either accept or deny
a certificate from an ssl secured repository. It opens a dialog that
shows the user information about the ssl certificate and then gives
them the option of denying, accepting, or accepting once.
The dialog must be called from within a threaded block, otherwise it
will not be responsive.
@type data: dictionary
@param data: A dictionary with SSL certificate info.
@rtype: (boolean, int, boolean)
@return: (True=Accept/False=Deny, number of accepted failures, remember)
"""
gtk.gdk.threads_enter()
if not data:
return (False, 0, False)
dialog = rabbitvcs.ui.dialog.Certificate(
data["realm"],
data["hostname"],
data["issuer_dname"],
data["valid_from"],
data["valid_until"],
data["finger_print"]
)
result = dialog.run()
gtk.gdk.threads_leave()
if result == 0:
#Deny
return (False, 0, False)
elif result == 1:
#Accept Once
return (True, data["failures"], False)
elif result == 2:
#Accept Forever
return (True, data["failures"], True)
示例12: get_login
def get_login(self, realm, username, may_save):
"""
A callback method that requests a username/password to login to a
password-protected repository. This method runs the Authentication
dialog, which provides a username, password, and saving widget. The
dialog returns a tuple, which is returned directly to the VCS caller.
If the login fails greater than three times, cancel the action.
The dialog must be called from within a threaded block, otherwise it
will not be responsive.
@type realm: string
@param realm: The realm of the repository.
@type username: string
@param username: Username passed by the vcs caller.
@type may_save: boolean
@param may_save: Whether or not the authentication can be saved.
@rtype: (boolean, string, string, boolean)
@return: (True=continue/False=cancel, username,password, may_save)
"""
if self.login_tries >= 3:
return (False, "", "", False)
gtk.gdk.threads_enter()
dialog = rabbitvcs.ui.dialog.Authentication(
realm,
may_save
)
result = dialog.run()
gtk.gdk.threads_leave()
if result is not None:
self.login_tries += 1
return result
示例13: choose_patch_path
def choose_patch_path(self):
path = ""
dialog = gtk.FileChooserDialog(
_("Create Patch"),
None,
gtk.FILE_CHOOSER_ACTION_SAVE,(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_SAVE, gtk.RESPONSE_OK))
dialog.set_do_overwrite_confirmation(True)
dialog.set_default_response(gtk.RESPONSE_OK)
dialog.set_current_folder_uri(
get_common_directory(self.paths).replace("file://", "")
)
response = dialog.run()
if response == gtk.RESPONSE_OK:
path = dialog.get_filename()
dialog.destroy()
return path
示例14: choose_patch_path
def choose_patch_path(self):
path = ""
dialog = Gtk.FileChooserDialog(
title = _("Create Patch"),
parent = None,
action = Gtk.FileChooserAction.SAVE)
dialog.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
dialog.add_button(_("_Create"), Gtk.ResponseType.OK)
dialog.set_do_overwrite_confirmation(True)
dialog.set_default_response(Gtk.ResponseType.OK)
dialog.set_current_folder_uri(
helper.get_common_directory(self.paths).replace("file://", "")
)
response = dialog.run()
if response == Gtk.ResponseType.OK:
path = dialog.get_filename()
dialog.destroy()
return path
示例15: browser_move_to
def browser_move_to(self, data=None, user_data=None):
from rabbitvcs.ui.dialog import OneLineTextChange
dialog = OneLineTextChange(
_("Where do you want to move the selection?"),
_("New Location:"),
self.caller.get_url()
)
result = dialog.run()
if result is None:
return
(response, new_url) = result
if response == gtk.RESPONSE_CANCEL:
return
self.caller.action = rabbitvcs.ui.action.SVNAction(
self.svn,
notification=False
)
self.caller.action.append(self.svn.move_all, self.paths, new_url, move_as_child=True)
self.caller.action.append(self.svn.list, self.caller.get_url(), recurse=False)
self.caller.action.append(self.caller.populate_table, 1)
self.caller.action.start()