python类message_dialog()的实例源码

set_python_interpreter.py 文件源码 项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def update_interpreter_settings(self, venv_path: str) -> None:
        """Updates the project and adds/modifies the Venv path"""
        project_data = self.get_project_data()

        # Check if have settings set in the project settings
        if project_data.get('settings', False):

            try:
                # Try to get the python_interpreter key
                project_data['settings'].get('python_interpreter', False)
            except AttributeError:
                # If this happens that mean your settings is a sting not a dict
                sublime.message_dialog(
                    'Ops your project settings is missed up'
                )
            else:
                # Set the path and save the project
                project_data['settings']['python_interpreter'] = venv_path
                self.save_project_data(project_data)
        else:
            # This will excute if settings key is not in you project settings
            project_data.update(
                {
                    'settings': {'python_interpreter': venv_path}
                }
            )
            self.save_project_data(project_data)
            AnacondaSetPythonBuilder().update_interpreter_build_system(
                venv_path
            )
autoimport.py 文件源码 项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def run(self, edit: sublime.Edit) -> None:

        self.data = None  # type: List[str]
        location = self.view.rowcol(self.view.sel()[0].begin())
        if not self._detected_undefined_name(location):
            sublime.message_dialog(
                'The word under the cursor is not an undefined name.')
            return

        for name in self.data:
            self.insert_import(edit, name)
ProjectWizzard.py 文件源码 项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def _create_tsconfigjson(self):
        """ Location for the tsconfig.json file """
        Debug('project+', 'Ask for tsconfig.json location')
        self.window.show_input_panel("Location for tsconfig.json (use your project folder)",
                                     os.path.dirname(self.view.file_name()),
                                     lambda folder: self._set_folder_and_go_on(folder),
                                     None, # on change
                                     lambda: [self._cleanup(),
                                               set_plugin_temporarily_disabled(folder=self.view),
                                              sublime.message_dialog(
                                        "ArcticTypescript disabled for this file's folder")]
                                    )
ProjectWizzard.py 文件源码 项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def _ask_output_directory(self, default="built/"):
        """ For multiple file output, ask for the output directory """
        Debug('project+', 'Ask for output directory')
        self.window.show_input_panel("Relative output FOLDER for all compiled js files: %s/" % self.tsconfigfolder,
                                     default,
                                     lambda outdir: [self._set_outdir(outdir), self._ask_for_files()],
                                     None, # on change
                                     lambda: [self._cleanup(),
                                               set_plugin_temporarily_disabled(folder=self.view),
                                               sublime.message_dialog(
                                                "ArcticTypescript disabled for this file's folder")])
ProjectWizzard.py 文件源码 项目:sublimeTextConfig 作者: luoye-fe 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _ask_for_files(self, dialog=True):
        """ Ask to define all files which are the roots of the reference tree """
        if dialog:
            sublime.message_dialog("Please name all files which should be compiled, relative to %s/ \n \n You don't need to specify files which are refrenced using /// <reference> or import a = require('a');\n\n So only name the files which are on top of your reference tree.\n\n Press <Esc> or enter nothing to finish." % self.tsconfigfolder)

        firstfile = os.path.relpath(self.view.file_name(), self.tsconfigfolder)
        Debug('project+', 'Ask for files')
        self.window.show_input_panel("(%i) Please name all files which should be compiled, relative to %s/"
                                        % (len(self.files), self.tsconfigfolder),
                                     firstfile if dialog else "",
                                     lambda file: self._file_entered(file),
                                     None, # on change
                                     lambda: self._file_entered(""))
GoTests.py 文件源码 项目:GoTests-Sublime 作者: cweill 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def run(self, edit):
        settings = sublime.load_settings("GoTests.sublime-settings")
        gopath = settings.get("GOPATH", "")
        if os.environ.get("GOPATH") == None:
            if gopath != "":
                # Set $GOPATH in this shell and add $GOPATH/bin to $PATH.
                os.environ["GOPATH"] = gopath
                os.environ["PATH"] += os.pathsep + os.path.join(gopath, "bin")
            else:
                sublime.message_dialog("GoTests: GOPATH is not set.")
                return False
        fn = self.view.file_name()
        if fn and fn.endswith('.go') and not fn.endswith('_test.go'):
            fs = []
            for s in self.view.sel():
                line = self.function_line(s.begin())
                i = line.begin()
                while i <= s.end():
                    f = self.function_name(line)
                    i = line.end() + 1
                    line = self.view.line(i)
                    if not f:
                        continue
                    fs.append(f)
            try:
                gotests = settings.get("gotests_cmd", "gotests")
                cmd = [gotests, '-w', '-only=(?i)^(' + "|".join(fs) + ')$', fn]
                proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
                print(proc.stdout.read().decode("utf-8").replace('\r\n', '\n'))
            except OSError as e:
                sublime.message_dialog("GoTests error: " + str(e) + ".")
                return False
            return True
        return False

    # Returns a function signature's line from a point in its body.
imp_developer.py 文件源码 项目:ElectricImp-Sublime 作者: electricimp 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def check_settings(self, callback=None, selecting_or_creating_model=None):
        # Setup pending callback
        if callback:
            self.env.tmp_check_settings_callback = callback
        else:
            callback = getattr(self.env, "tmp_check_settings_callback", None)

        if selecting_or_creating_model is not None:
            self.env.tmp_selecting_or_creating_model = selecting_or_creating_model
        else:
            selecting_or_creating_model = getattr(self.env, "tmp_selecting_or_creating_model", None)

        key = self.env.project_manager.get_build_api_key()

        # Perform the checks and prompts for appropriate settings
        if self.is_missing_node_js_path():
            self.prompt_for_node_js_path()
        elif self.is_missing_builder_cli_path():
            self.prompt_for_builder_cli_path()
        elif not key or not HTTP.is_build_api_key_valid(key):
            self.prompt_for_build_api_key()
        elif not selecting_or_creating_model and self.is_missing_model():
            sublime.message_dialog(STR_MODEL_NOT_ASSIGNED)
        else:
            # All the checks passed, invoke the callback now
            if callback:
                callback()
            self.env.tmp_check_settings_callback = None
            self.env.tmp_selecting_or_creating_model = None
imp_developer.py 文件源码 项目:ElectricImp-Sublime 作者: electricimp 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def select_device(self, need_to_confirm=True):
        model = self.load_this_model()
        if not model:
            sublime.message_dialog(STR_MODEL_NOT_ASSIGNED)
            return

        device_ids = model.get("devices")
        if not device_ids or not len(device_ids):
            sublime.message_dialog(STR_MODEL_HAS_NO_DEVICES)
            return

        if need_to_confirm and not sublime.ok_cancel_dialog(STR_SELECT_DEVICE): return
        (Env.For(self.window).tmp_device_ids, device_names) = self.load_devices(input_device_ids=device_ids)
        self.window.show_quick_panel(device_names, self.on_device_selected)
imp_developer.py 文件源码 项目:ElectricImp-Sublime 作者: electricimp 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run(self):
        self.init_env_and_settings()

        def check_settings_callback():
            settings = self.load_settings()
            if EI_DEVICE_ID in settings:
                device_id = settings.get(EI_DEVICE_ID)
                response, code = HTTP.get(self.env.project_manager.get_build_api_key(),
                                          PL_BUILD_API_URL_V4 + "devices/" + device_id)
                agent_id = response.get("device").get("agent_id")
                agent_url = PL_AGENT_URL.format(agent_id)
                sublime.set_clipboard(agent_url)
                sublime.message_dialog(STR_AGENT_URL_COPIED.format(device_id, agent_url))

        self.check_settings(callback=check_settings_callback)
imp_developer.py 文件源码 项目:ElectricImp-Sublime 作者: electricimp 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def select_existing_model(self, need_to_confirm=True):
        response, code = HTTP.get(self.env.project_manager.get_build_api_key(), PL_BUILD_API_URL_V4 + "models")
        if len(response["models"]) > 0:
            if need_to_confirm and not sublime.ok_cancel_dialog(STR_MODEL_SELECT_EXISTING_MODEL):
                return
            all_model_names = [model["name"] for model in response["models"]]
            self.__tmp_all_models = [(model["id"], model["name"]) for model in response["models"]]
        else:
            sublime.message_dialog(STR_MODEL_NO_MODELS_FOUND)
            return

        self.window.show_quick_panel(all_model_names, self.on_model_selected)
imp_developer.py 文件源码 项目:ElectricImp-Sublime 作者: electricimp 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def prompt_model_to_remove_device(self, need_to_confirm=True):
        if need_to_confirm and not sublime.ok_cancel_dialog(STR_MODEL_REMOVE_DEVICE): return

        model = self.load_this_model()
        device_ids = model.get("devices") if model else None

        if not device_ids or len(device_ids) == 0:
            sublime.message_dialog(STR_MODEL_NO_DEVICES_TO_REMOVE)
            return

        (Env.For(self.window).tmp_device_ids, device_names) = self.load_devices(input_device_ids=device_ids)
        self.window.show_quick_panel(device_names, self.on_remove_device_selected)
build.py 文件源码 项目:SublimeAnarchy 作者: AnarchyTools 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def run(self, *args, **kwargs):
        tool = kwargs.get("tool", "atllbuild")
        build_last = kwargs.get("build_last", False)
        if not self.window.project_file_name():
            return

        pkg = Package.fromFile(atpkgTools.findAtpkg(self.window.project_file_name()))   
        probable_task = pkg.task_for_file(self.window.active_view().file_name())

        if not build_last:
            tasks = []
            idx = 0
            for (name, task) in pkg.tasks.items():
                if task.tool != tool:
                    continue
                desc = "Task group"
                if task.tool == "atllbuild":
                    desc = "Compile Swift " + task.output_type.replace("-", " ")
                elif task.tool == "shell":
                    desc = "Run Shell script"
                elif task.tool == "xctestrun":
                    desc = "Execute Tests"
                if task == probable_task:
                    idx = len(tasks)
                tasks.append([name, desc])

            if len(tasks) == 0:
                sublime.message_dialog("SublimeAnarchy\n\nThere are no tasks to run")
                return

            if len(tasks) == 1:
                self.build(pkg, tasks, 0)
                return

            self.window.show_quick_panel(tasks, lambda x: self.build(pkg, tasks, x), 0, idx)
        else:
            if self.window.id() in last_build_target:
                BuildWithATBuild(self.window, pkg, last_build_target[self.window.id()]).start()
phpfmt.py 文件源码 项目:phpfmt_stable 作者: nanch 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def run(self, edit):
        s = sublime.load_settings('phpfmt.sublime-settings')

        php_bin = s.get("php_bin", "php")
        formatter_path = os.path.join(dirname(realpath(sublime.packages_path())), "Packages", "phpfmt", "fmt.phar")

        s = debugEnvironment(php_bin, formatter_path)
        sublime.message_dialog(s)
NewFileBase.py 文件源码 项目:new-file-pro 作者: KevinHoo 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_code(self, type='text' ):
        code = ''
        file_name = "%s.tmpl" % type
        isIOError = False

        if IS_GTE_ST3:
            tmpl_dir = 'Packages/' + PACKAGE_NAME + '/' + TMLP_DIR + '/'
            user_tmpl_dir = 'Packages/User/' + PACKAGE_NAME + '/' + TMLP_DIR + '/'
        else:
            tmpl_dir = os.path.join(PACKAGES_PATH, PACKAGE_NAME, TMLP_DIR)
            user_tmpl_dir = os.path.join(PACKAGES_PATH, 'User', PACKAGE_NAME, TMLP_DIR)

        self.user_tmpl_path = os.path.join(user_tmpl_dir, file_name)
        self.tmpl_path = os.path.join(tmpl_dir, file_name)

        if IS_GTE_ST3:
            try:
                code = sublime.load_resource(self.user_tmpl_path)
            except IOError:
                try:
                    code = sublime.load_resource(self.tmpl_path)
                except IOError:
                    isIOError = True
        else:
            if os.path.isfile(self.user_tmpl_path):
                code = self.open_file(self.user_tmpl_path)
            elif os.path.isfile(self.tmpl_path):
                code = self.open_file(self.tmpl_path)
            else:
                isIOError = True

        if isIOError:
            sublime.message_dialog('[Warning] No such file: ' + self.tmpl_path + ' or ' + self.user_tmpl_path)

        return self.format_tag(code)
core.py 文件源码 项目:OverrideAudit 作者: OdatNurd 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def log(message, *args, status=False, dialog=False):
    """
    Simple logging method; writes to the console and optionally also the status
    message as well.
    """
    message = message % args
    print("OverrideAudit:", message)
    if status:
        sublime.status_message(message)
    if dialog:
        sublime.message_dialog(message)
Transform PHP.py 文件源码 项目:st-user-package 作者: math2001 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def md(*t):
    t = ' '.join([str(txt) for txt in t])
    sublime.message_dialog(t)
Transform PHP.py 文件源码 项目:st-user-package 作者: math2001 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def m(self, text):
        sublime.message_dialog(str(text))
file-info.py 文件源码 项目:st-user-package 作者: math2001 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def md(*t):
    t = ' '.join([str(el) for el in t])
    sublime.message_dialog(t)
color-previewer.py 文件源码 项目:st-user-package 作者: math2001 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def md(*t, **kwargs):
    t = kwargs.get('sep', ' ').join([str(el) for el in t])
    sublime.message_dialog(t)
escape_path.py 文件源码 项目:st-user-package 作者: math2001 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def md(*t, **kwargs): sublime.message_dialog(kwargs.get('sep', ' ').join([str(el) for el in t]))


问题


面经


文章

微信
公众号

扫码关注公众号