當前位置: 首頁>>代碼示例>>Python>>正文


Python sublime.ok_cancel_dialog方法代碼示例

本文整理匯總了Python中sublime.ok_cancel_dialog方法的典型用法代碼示例。如果您正苦於以下問題:Python sublime.ok_cancel_dialog方法的具體用法?Python sublime.ok_cancel_dialog怎麽用?Python sublime.ok_cancel_dialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sublime的用法示例。


在下文中一共展示了sublime.ok_cancel_dialog方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def run(self, edit):
        files = self.get_marked() or self.get_selected()
        if files:
            # Yes, I know this is English.  Not sure how Sublime is translating.
            if len(files) == 1:
                msg = "Delete {}?".format(files[0])
            else:
                msg = "Delete {} items?".format(len(files))
            if sublime.ok_cancel_dialog(msg):
                for filename in files:
                    fqn = join(self.path, filename)
                    if isdir(fqn):
                        shutil.rmtree(fqn)
                    else:
                        os.remove(fqn)
                self.view.run_command('dired_refresh') 
開發者ID:kublaios,項目名稱:dired,代碼行數:18,代碼來源:dired.py

示例2: remove_virtualenv

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def remove_virtualenv(self, index):
        """Request confirmation and delete the directory tree.

        Also set current virtualenv to None.
        """
        if index == -1:
            return

        venv = self.available_venvs[index][1]
        confirmed = sublime.ok_cancel_dialog(
            "Please confirm deletion of virtualenv at:\n\"{}\".".format(venv))
        if confirmed:
            try:
                shutil.rmtree(venv)
                logger.info("\"{}\" deleted.".format(venv))
            except (IOError, OSError):
                logger.error("Could not delete \"{}\".".format(venv))
            else:
                if venv == self.get_virtualenv():
                    self.set_virtualenv(None) 
開發者ID:AdrianLC,項目名稱:sublime-text-virtualenv,代碼行數:22,代碼來源:commands.py

示例3: run

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def run(self, edit, trash=False):
        self.index = self.get_all()
        files = self.get_marked() or self.get_selected(parent=False)
        if not files:
            return sublime.status_message('Nothing chosen')

        msg, trash = self.setup_msg(files, trash)

        emit_event(u'ignore_view', self.view.id(), plugin=u'FileBrowserWFS')
        if trash:
            need_confirm = self.view.settings().get('dired_confirm_send2trash', True)
            msg = msg.replace('Delete', 'Delete to trash', 1)
            if not need_confirm or (need_confirm and sublime.ok_cancel_dialog(msg)):
                self._to_trash(files)
        elif not trash and sublime.ok_cancel_dialog(msg):
            self._delete(files)
        else:
            print("Cancel delete or something wrong in DiredDeleteCommand")
        emit_event(u'watch_view', self.view.id(), plugin=u'FileBrowserWFS') 
開發者ID:aziz,項目名稱:SublimeFileBrowser,代碼行數:21,代碼來源:dired_file_operations.py

示例4: on_pick_point

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def on_pick_point(self, index):
        if index == -1:
            return
        name, target = self.jump_points[index]
        if isdir(target):
            settings = load_settings('dired.sublime-settings')
            smart_jump = settings.get('dired_smart_jump', False)
            auto = self.new_window == 'auto'
            if self.new_window is True or ((not smart_jump) and auto) or (smart_jump and auto and len(self.view.window().views()) > 0):
                self.view.run_command("dired_open_in_new_window", {"project_folder": [target]})
            else:
                show(self.view.window(), target, view_id=self.view.id())
                status_message(u"Jumping to point '{0}' complete".format(unicodify(name)))
        else:
            # workaround ST3 bug https://github.com/SublimeText/Issues/issues/39
            self.view.window().run_command('hide_overlay')
            msg = u"Can't jump to '{0} → {1}'.\n\nRemove that jump point?".format(name, target)
            if ok_cancel_dialog(msg):
                points = load_jump_points()
                del points[name]
                save_jump_points(points)
                status_message(u"Jump point '{0}' was removed".format(name))
                self.view.run_command('dired_refresh') 
開發者ID:aziz,項目名稱:SublimeFileBrowser,代碼行數:25,代碼來源:jumping.py

示例5: deploy_open_files

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def deploy_open_files(self, file_list, type):
        message = "Are you sure to deploy files?"
        self.sublconsole.showlog("Ready to deploy : \n" + "\n".join(file_list))
        if not sublime.ok_cancel_dialog(message, "Yes!"):
            self.sublconsole.showlog("Cancel deploy !")
            return
        self.copy_open_files(file_list)
        
        try:
            if self._is_not_exist():
                self.build_migration_tools(self.save_dir)
            cmd = [self.osutil.get_cd_cmd(self.save_dir), self._get_deploy_cmd(type)]
            self.osutil.os_run(cmd)
        except Exception as ex:
            self.sublconsole.showlog("Please set ant! https://ant.apache.org/")
            pass 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:18,代碼來源:main_toolbox.py

示例6: _backup_src

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def _backup_src(self, root_path):
        if self.retrieve_type == "src":
            src_path = self.sf_basic_config.get_src_dir()
            if os.path.exists(src_path):
                backup_dir = os.path.join(root_path, "src_backup")
                new_src_name = "src_" + datetime.now().strftime('%Y%m%d_%H%M%S')
                new_src_path = os.path.join(backup_dir, new_src_name)
                message = "The src folder is exist. Start to backup the src to %s ?" % (new_src_name)
                if sublime.ok_cancel_dialog(message, "OK!"): 
                    self.sublconsole.close_views(src_path)
                    if not os.path.exists(backup_dir):
                        os.makedirs(backup_dir)
                    self.sublconsole.showlog('start to backup source')
                    shutil.copytree(src_path, new_src_path)
                    self.sublconsole.showlog('start to delete src folder')
                    if os.path.exists(src_path):
                        shutil.rmtree(src_path) 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:19,代碼來源:main_metadata.py

示例7: _remove_project

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def _remove_project(self, project):
        answer = sublime.ok_cancel_dialog('Remove "%s" from Project Manager?' % project)
        if answer is True:
            pfile = self.project_file_name(project)
            if self.which_project_dir(pfile):
                self.close_project_by_name(project)
                os.remove(self.project_file_name(project))
                os.remove(self.project_workspace(project))
            else:
                for pdir in self.projects_path:
                    j = JsonFile(os.path.join(pdir, 'library.json'))
                    data = j.load([])
                    if pfile in data:
                        data.remove(pfile)
                        j.save(data)
            sublime.status_message('Project "%s" is removed.' % project) 
開發者ID:randy3k,項目名稱:ProjectManager,代碼行數:18,代碼來源:project_manager.py

示例8: destructive

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def destructive(description):
    def decorator(fn):

        def wrapped_fn(*args, **kwargs):
            if GitSavvySettings().get("prompt_before_destructive_action"):
                message = (
                    "You are about to {desc}.  "
                    "This is a destructive action.  \n\n"
                    "Are you SURE you want to do this?  \n\n"
                    "(you can disable this prompt in "
                    "GitSavvy settings)").format(desc=description)
                if not sublime.ok_cancel_dialog(message):
                    return

            return fn(*args, **kwargs)

        return wrapped_fn

    return decorator 
開發者ID:timbrel,項目名稱:GitSavvy,代碼行數:21,代碼來源:actions.py

示例9: do_push

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def do_push(self, remote, branch, force=False, force_with_lease=False, remote_branch=None):
        """
        Perform `git push remote branch`.
        """
        if self.savvy_settings.get("confirm_force_push", True):
            if force:
                if not sublime.ok_cancel_dialog(CONFIRM_FORCE_PUSH.format("--force")):
                    return
            elif force_with_lease:
                if not sublime.ok_cancel_dialog(CONFIRM_FORCE_PUSH.format("--force--with-lease")):
                    return

        self.window.status_message(START_PUSH_MESSAGE)
        self.push(
            remote,
            branch,
            set_upstream=self.set_upstream,
            force=force,
            force_with_lease=force_with_lease,
            remote_branch=remote_branch
        )
        self.window.status_message(END_PUSH_MESSAGE)
        util.view.refresh_gitsavvy(self.window.active_view()) 
開發者ID:timbrel,項目名稱:GitSavvy,代碼行數:25,代碼來源:push.py

示例10: run

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def run(self, edit, code=None, cmd=None, prog=None, resolve=True, confirmation=None):
        # set CodeSender before get_code() because get_code may change cursor locations.

        if confirmation:
            ok = sublime.ok_cancel_dialog(confirmation)
            if not ok:
                return

        if not code and cmd:
            print("SendCode: argument `cmd` is deprecated, use `code` instead.")
            code = cmd

        getter = CodeGetter.initialize(self.view)
        sender = CodeSender.initialize(self.view, prog=prog, from_view=code is None)
        if code and resolve:
            code = getter.resolve(code)
        else:
            code = getter.get_code()

        sublime.set_timeout_async(lambda: sender.send_text(code)) 
開發者ID:randy3k,項目名稱:SendCode,代碼行數:22,代碼來源:send_code.py

示例11: run

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def run(self, edit):
        if not ST3:
            return sublime.status_message('This feature is available only in Sublime Text 3')
        path = self.path.rstrip(os.sep)
        msg = u"Set '{0}' as only one project folder (will remove all other folders from project)?".format(path)
        if sublime.ok_cancel_dialog(msg):
            data = self.view.window().project_data() or {'folders': {}}
            data['folders'] = [{'path': path}]
            self.view.window().set_project_data(data)
            self.view.window().run_command('dired_refresh') 
開發者ID:aziz,項目名稱:SublimeFileBrowser,代碼行數:12,代碼來源:dired_misc.py

示例12: check_errors

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def check_errors(self):
        msg = u'FileBrowser:\n\nSome files exist already, Cancel to skip all, OK to overwrite or rename.\n\n\t%s' % '\n\t'.join(self.errors.keys())
        self.actions = [['Overwrite', 'Folder cannot be overwritten'],
                        ['Duplicate', 'Item will be renamed automatically']]
        if self.errors and sublime.ok_cancel_dialog(msg):
            self.show_quick_panel() 
開發者ID:aziz,項目名稱:SublimeFileBrowser,代碼行數:8,代碼來源:dired_file_operations.py

示例13: delete_meta

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def delete_meta(self, sel_meta):
        self.sublconsole.debug('>>>delete meta')
        self.sublconsole.debug(sel_meta)
        message = "Are you sure to delete %s?  id=%s " % (sel_meta["fileName"], sel_meta["id"])
        if not sublime.ok_cancel_dialog(message, "Delete!!"): 
            self.sublconsole.showlog('cancel delete metadata: ' + sel_meta["fileName"])
            return
        self.sublconsole.showlog('start to delete metadata : ' + sel_meta["fileName"])
        if sel_meta["id"]:
            self.sel_meta = sel_meta
            self.sublconsole.thread_run(target=self.delete_meta_process)
        else:
            self.sublconsole.showlog('the id is empty : ' + sel_meta["fileName"])
        return 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:16,代碼來源:main_metadata.py

示例14: _delete_meta

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def _delete_meta(self):
        sel_meta = self.meta_attr
        message = "Are you sure to delete %s?  id=%s " % (sel_meta["fileName"], sel_meta["id"])
        if not sublime.ok_cancel_dialog(message, "Delete!!"): 
            self.sublconsole.showlog('cancel delete metadata: ' + sel_meta["fileName"])
            return
        self.sublconsole.showlog('start to delete metadata : ' + sel_meta["fileName"])
        if sel_meta["id"]:
            self.sel_meta = sel_meta
            self.sublconsole.thread_run(target=self._delete_from_server)
        else:
            self.sublconsole.showlog('the id is empty : ' + sel_meta["fileName"])
        return 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:15,代碼來源:main_metadata.py

示例15: _delete_local_file

# 需要導入模塊: import sublime [as 別名]
# 或者: from sublime import ok_cancel_dialog [as 別名]
def _delete_local_file(self):
        if os.path.isdir(self.file_name):
            message = "Do you want to delete local lightning files?  %s" % (self.file_name)
            if sublime.ok_cancel_dialog(message, "Delete!!"): 
                self.sublconsole.showlog("delete local file start: " + self.file_name)
                shutil.rmtree(self.file_name)
                self.sublconsole.showlog("delete local file done! ")
        elif os.path.isfile(self.file_name):
            os.remove(self.file_name)
            self.sublconsole.showlog("delete local file done! " + self.file_name) 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:12,代碼來源:main_metadata.py


注:本文中的sublime.ok_cancel_dialog方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。