当前位置: 首页>>代码示例>>Python>>正文


Python dialog.run函数代码示例

本文整理汇总了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()
开发者ID:virtualthoughts,项目名称:rabbitvcs,代码行数:53,代码来源:editconflicts.py

示例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")
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:25,代码来源:action.py

示例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()
开发者ID:rabbitvcs,项目名称:rabbitvcs,代码行数:25,代码来源:browser.py

示例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
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:27,代码来源:action.py

示例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
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:7,代码来源:action.py

示例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()
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:10,代码来源:action.py

示例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()
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:12,代码来源:property_editor.py

示例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()
开发者ID:kuznetz,项目名称:rabbitvcs,代码行数:52,代码来源:editconflicts.py

示例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()
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:13,代码来源:property_editor.py

示例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()
开发者ID:rabbitvcs,项目名称:rabbitvcs,代码行数:18,代码来源:browser.py

示例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)
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:43,代码来源:action.py

示例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
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:41,代码来源:action.py

示例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
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:21,代码来源:createpatch.py

示例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
开发者ID:rabbitvcs,项目名称:rabbitvcs,代码行数:22,代码来源:createpatch.py

示例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()
开发者ID:CloCkWeRX,项目名称:rabbitvcs-svn-mirror,代码行数:23,代码来源:browser.py


注:本文中的rabbitvcs.ui.dialog.run函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。