当前位置: 首页>>代码示例>>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;未经允许,请勿转载。