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


Python sublime.ok_cancel_dialog函数代码示例

本文整理汇总了Python中sublime.ok_cancel_dialog函数的典型用法代码示例。如果您正苦于以下问题:Python ok_cancel_dialog函数的具体用法?Python ok_cancel_dialog怎么用?Python ok_cancel_dialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ok_cancel_dialog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

    def run(self):
        repo = self.get_repo()
        if not repo:
            return

        branch = self.get_current_branch(repo)
        if not branch:
            return sublime.error_message("You really shouldn't push a detached head")

        remotes = self.get_remotes(repo)
        if not remotes:
            if sublime.ok_cancel_dialog(NO_REMOTES, 'Add Remote'):
                self.window.run_command('git_remote_add')
                return

        branch_remote, branch_merge = self.get_branch_upstream(repo, branch)
        if not branch_remote or not branch_merge:
            if sublime.ok_cancel_dialog(NO_TRACKING, 'Yes'):
                self.window.run_command('git_pull_current_branch')
            return

        self.panel = self.window.get_output_panel('git-pull')
        self.panel_shown = False

        thread = self.git_async(['pull', '-v'], cwd=repo, on_data=self.on_data)
        runner = StatusSpinner(thread, "Pulling from %s" % (branch_remote))
        runner.start()
开发者ID:SpiritBreaker226,项目名称:SublimeGit,代码行数:27,代码来源:remote.py

示例2: check_version

def check_version(editor, p_settings, upgrade_callback):
    update_available = False
    version, version_limits = read_versions()

    if version is not None and version_limits is not None:
        # True if versions are okay
        ignore_key = "%s:%s" % (version, version_limits["max"])
        if not version_compare(version, version_limits["min"]):
            ignore_versions = str(p_settings.get("ignore_version_update", ""))
            if not ignore_key == ignore_versions:
                if sublime.ok_cancel_dialog(MSGS["upgrade"] % version_limits["max"], "Update"):
                    update_binary(upgrade_callback)
                    update_available = True
                elif sublime.ok_cancel_dialog(MSGS["ignore_critical"] % (version, version_limits["min"]), "Ignore"):
                    p_settings.set("ignore_version_update", ignore_key)
                    sublime.save_settings(PLUGIN_SETTINGS)

        elif not version_compare(version, version_limits["max"]):
            if sublime.ok_cancel_dialog(MSGS["upgrade"] % version_limits["max"], "Update"):
                update_binary(upgrade_callback)
                update_available = True
            elif sublime.ok_cancel_dialog(MSGS["ignore_critical"], "Ignore"):
                p_settings.set("ignore_version_update", ignore_key)
                sublime.save_settings(PLUGIN_SETTINGS)
    else:
        sublime.error_message(MSGS["version"])
    return update_available
开发者ID:GJSchmidt,项目名称:SublimeResources,代码行数:27,代码来源:binary_manager.py

示例3: run

    def run(self):
        # For Windows
        if is_windows():
            if os.path.exists(get_location()):
                runWinBeyondCompare()
                return
            else:
                sublime.error_message('Could not find Beyond Compare. Please set the path to your tool in BeyondCompare.sublime-settings.')
                return

        # For OSX
        if os.path.exists(get_location()):
            runMacBeyondCompare()

        else:
            commandLinePrompt = sublime.ok_cancel_dialog('Could not find bcompare.\nPlease install the command line tools.', 'Do it now!')
            if commandLinePrompt:
                new = 2  # open in a new tab, if possible
                url = "http://www.scootersoftware.com/support.php?zz=kb_OSXInstallCLT"
                webbrowser.open(url, new=new)
                bCompareInstalled = sublime.ok_cancel_dialog('Once you have installed the command line tools, click the ok button to continue')
                if bCompareInstalled:
                    if os.path.exists("/usr/local/bin/bcompare"):
                        runMacBeyondCompare()

                    else:
                        sublime.error_message('Still could not find bcompare. \nPlease make sure it exists at:\n/usr/local/bin/bcompare\nand try again')

                else:
                    sublime.error_message('Please try again after you have command line tools installed.')
            else:
                sublime.error_message('Please try again after you have command line tools installed.')
开发者ID:npadley,项目名称:BeyondCompare,代码行数:32,代码来源:BeyondCompare.py

示例4: on_enter_directory

    def on_enter_directory(self, path):
        self.suggested_git_root = path
        if self.suggested_git_root and os.path.exists(os.path.join(self.suggested_git_root, ".git")):
            sublime.ok_cancel_dialog(RECLONE_CANT_BE_DONE)
            return

        sublime.set_timeout_async(self.do_clone, 0)
开发者ID:stoivo,项目名称:GitSavvy,代码行数:7,代码来源:init.py

示例5: handle_result

def handle_result(operation, process_id, printer, result, thread):
    #print(thread.process_id)
    #print(thread.params)
    process_region = printer.panel.find(process_id,0)
    status_region = printer.panel.find('Result:',process_region.begin())

    try:
        result = json.loads(result)
        if operation == 'compile' and 'actions' in result and util.to_bool(result['success']) == False:
            diff_merge_settings = config.settings.get('mm_diff_server_conflicts', False)
            if diff_merge_settings:
                if sublime.ok_cancel_dialog(result["body"], result["actions"][0].title()):
                    printer.panel.run_command('write_operation_status', {"text": " Diffing with server", 'region': [status_region.end(), status_region.end()+10] })
                    th = MavensMateDiffThread(thread.window, thread.view, result['tmp_file_path'])
                    th.start()
                    
                else:
                    printer.panel.run_command('write_operation_status', {"text": " "+result["actions"][1].title(), 'region': [status_region.end(), status_region.end()+10] })
            else:
                if sublime.ok_cancel_dialog(result["body"], "Overwrite Server Copy"):
                    printer.panel.run_command('write_operation_status', {"text": " Overwriting server copy", 'region': [status_region.end(), status_region.end()+10] })
                    thread.params['action'] = 'overwrite'
                    sublime.set_timeout(lambda: call('compile', params=thread.params), 100)   
                else:
                    printer.panel.run_command('write_operation_status', {"text": " "+result["actions"][1].title(), 'region': [status_region.end(), status_region.end()+10] })
   
        else:
            print_result_message(operation, process_id, status_region, result, printer, thread) 
            if operation == 'new_metadata' and 'success' in result and util.to_bool(result['success']) == True:
                if 'messages' in result:
                    if type(result['messages']) is not list:
                        result['messages'] = [result['messages']]
                    for m in result['messages']:
                        if 'package.xml' not in m['fileName']:
                            file_name = m['fileName']
                            location = util.mm_project_directory() + "/" + file_name.replace('unpackaged/', 'src/')
                            sublime.active_window().open_file(location)
                            break
            if 'success' in result and util.to_bool(result['success']) == True:
                if printer != None and len(ThreadTracker.get_pending_mm_panel_threads(thread.window)) == 0:
                    printer.hide()  
            elif 'State' in result and result['State'] == 'Completed' and len(ThreadTracker.get_pending_mm_panel_threads(thread.window)) == 0:
                #tooling api
                if printer != None:
                    printer.hide()
            if operation == 'refresh':            
                sublime.set_timeout(lambda: sublime.active_window().active_view().run_command('revert'), 200)
                util.clear_marked_line_numbers()
    except AttributeError:   
        if printer != None:
            printer.write('\n[RESPONSE FROM MAVENSMATE]: '+result+'\n')
            msg = ' [OPERATION FAILED]: Whoops, unable to parse the response. Please report this issue at https://github.com/joeferraro/MavensMate-SublimeText\n'
            msg += '[RESPONSE FROM MAVENSMATE]: '+result
            printer.panel.run_command('write_operation_status', {'text': msg, 'region': [status_region.end(), status_region.end()+10] })
    except Exception:
        if printer != None:
            printer.write('\n[RESPONSE FROM MAVENSMATE]: '+result+'\n')
            msg = ' [OPERATION FAILED]: Whoops, unable to parse the response. Please report this issue at https://github.com/joeferraro/MavensMate-SublimeText\n'
            msg += '[RESPONSE FROM MAVENSMATE]: '+result
            printer.panel.run_command('write_operation_status', {'text': msg, 'region': [status_region.end(), status_region.end()+10] })
开发者ID:alexmichaelroth,项目名称:MavensMate-SublimeText,代码行数:60,代码来源:mm_interface.py

示例6: Is_save

	def Is_save(self):
		'''
		@ 函数名:Is_save		 --> 作者:Dandy.Mu
		@ 函数说明:检测当前文件是否已经保存
		@ 谱写日期:2013-12-17 10:37:59
		'''

		self.FILE = None

		# 当前文件的对象
		self.FILE = self.view.file_name()

		# 检测文件是否存在,也就是说文件是否已经创建,语法检测和运行的时候需要用到
		if not os.path.exists(self.FILE):
			if sublime.ok_cancel_dialog('搞不了, 是不是还没有保存文件啊?\n现在保存不?'.decode('utf-8')):
				self.view.run_command('save')
			else:
				return sublime.status_message('你吖不保存,偶搞不了!'.decode('utf-8'))

		# 检测当前文件是否已经保存
		if self.view.is_dirty():
			if sublime.ok_cancel_dialog("当前文件未保存, 是否现在保存当前文件?.".decode('utf-8')):
				self.view.run_command('save')
			else:
				return sublime.status_message('文件未保存取消检测!'.decode('utf-8'))

		# 检测扩展名是否为PHP
		if not self.FILE[-3:] == 'php':
			if not sublime.ok_cancel_dialog("当前文件可能不是PHP文件, 是否要继续执行?".decode('utf-8')):
				return sublime.status_message('取消非PHP文件的语法检测!'.decode('utf-8'))

		return self.FILE;
		pass
开发者ID:ChinaDandyMu,项目名称:Sublime-Text,代码行数:33,代码来源:PHPTools.py

示例7: run

    def run(self):
        while 1:
            self.recording(self.workingMins, updateWorkingTimeStatus)
            self.pomodoroCounter = self.pomodoroCounter + 1

            if settings().get("event_logging"):
                sublime.active_window().show_input_panel("What did you just do?:", "", self.add_to_log, None, self.on_cancel)
            
            if self.stopped(): 
                #sublime.error_message('Pomodoro Cancelled')
                break
                
            while self.wait:
                time.sleep(1)

            self.wait = True
            breakType =  self.pomodoroCounter % (self.numberPomodoro)
            print(breakType)
            if breakType == 0:
                
                rest = sublime.ok_cancel_dialog('Time for a long break.', 'OK')
            else:
                rest = sublime.ok_cancel_dialog('Time for a short break.', 'OK')
            if rest:
                if breakType == 0:
                    self.recording(self.longBreakMins, updateRestingTimeStatus)
                else:
                    self.recording(self.shortBreakMins, updateRestingTimeStatus)
                work = sublime.ok_cancel_dialog("Break over. Start next pomodoro?", 'OK')
            if not work:
                self.stop()

        time.sleep(2)
        self.stop()
开发者ID:fk128,项目名称:Sublime-Pomodoro,代码行数:34,代码来源:pomodoro.py

示例8: handle_unknown_error

 def handle_unknown_error(err):
     print(err)
     msg = "An unhandled error was encountered while prettifying. See the console output for more information. Do you wish to file a bug?"
     if ok_cancel_dialog(msg):
         msg = "Please include detailed information in your bug report."
         if ok_cancel_dialog(msg):
             file_bug()
     return None
开发者ID:Jackysonglanlan,项目名称:devops,代码行数:8,代码来源:script_utils.py

示例9: onselect_003

 def onselect_003(self):
     if self.type_db != 'M':
         sublime.message_dialog(self.MESSAGE_MYSQL)
         return
     sublime.ok_cancel_dialog(
         'Current database on remote server will be destroyed. \
         Are you sure?', 'Continue')
     Tools.show_input_panel(
         'Input confirmation password', '', self.oninput_003, None, None)
开发者ID:vladgr,项目名称:DCPanel-sublime,代码行数:9,代码来源:cmd_controldatabases.py

示例10: on_input

    def on_input(self, input):
        # Create component to local according to user input
        if self.template_attr["extension"] == ".trigger":
            if not re.match('^[a-zA-Z]+\\w+,[_a-zA-Z]+\\w+$', input):
                message = 'Invalid format, do you want to try again?'
                if not sublime.ok_cancel_dialog(message): return
                self.window.show_input_panel("Follow [Name<,sobject for trigger>]", 
                    "", self.on_input, None, None)
                return
            name, sobject = [ele.strip() for ele in input.split(",")]
        else:
            if not re.match('^[a-zA-Z]+\\w+$', input):
                message = 'Invalid format, are you want to input again?'
                if not sublime.ok_cancel_dialog(message): return
                self.window.show_input_panel("Follow [Name<,sobject for trigger>]", 
                    "", self.on_input, None, None)
                return
            name = input
        
        extension = self.template_attr["extension"]
        body = self.template_attr["body"]
        if extension == ".trigger":
            body = body % (name, sobject)
        elif extension == ".cls":
            body = body.replace("class_name", name)

        settings = context.get_toolingapi_settings()
        component_type = settings[extension]
        component_outputdir = settings[component_type]["outputdir"]
        if not os.path.exists(component_outputdir):
            os.makedirs(component_outputdir)
            settings = context.get_toolingapi_settings()
            context.add_project_to_workspace(settings["workspace"])

        file_name = "%s/%s" % (component_outputdir, name + extension)
        if os.path.isfile(file_name):
            self.window.open_file(file_name)
            sublime.error_message(name + " is already exist")
            return

        with open(file_name, "w") as fp:
            fp.write(body)

        # Compose data
        data = {
            "name": name,
            settings[component_type]["body"]: body,
        }
        if component_type == "ApexClass":
            data["IsValid"] = True
        elif component_type == "ApexTrigger":
            data["TableEnumOrId"] = sobject
        elif component_type in ["ApexPage", "ApexComponent"]:
            data["MasterLabel"] = name

        processor.handle_create_component(data, name, component_type, file_name)
开发者ID:lqcys,项目名称:SublimeApex,代码行数:56,代码来源:main.py

示例11: safe_open

def safe_open(filename, mode, *args, **kwargs):
    try:
        with open(filename, mode, *args, **kwargs) as file:
            yield file
    except PermissionError as e:
        sublime.ok_cancel_dialog("GitSavvy could not access file: \n{}".format(e))
        raise e
    except OSError as e:
        sublime.ok_cancel_dialog("GitSavvy encountered an OS error: \n{}".format(e))
        raise e
开发者ID:stoivo,项目名称:GitSavvy,代码行数:10,代码来源:file.py

示例12: _user_permission_dialog

 def _user_permission_dialog():
     message = "Mousemap already exists. Do you want to overwrite it?"
     ok = sublime.ok_cancel_dialog(message, "Overwrite")
     if ok:
         result = _OVERWRITE
     else:
         message = "Do you want me to change it?"
         ok = sublime.ok_cancel_dialog(message, "Change existing mousemap")
         result = _CHANGE if ok else _CANCEL
     return result
开发者ID:softwarekitty,项目名称:sublime_3_settings,代码行数:10,代码来源:create_mousemap.py

示例13: notify_user

def notify_user(message):
    """
    Open a dialog for the user to inform them of a user interaction that is
    part of the test suite

    :param message:
        A unicode string of the message to present to the user
    """

    sublime.ok_cancel_dialog('Test Suite for Golang Build\n\n' + message, 'Ok')
开发者ID:codexns,项目名称:golang-build,代码行数:10,代码来源:tests.py

示例14: load_launch

def load_launch(env):
    if not os.path.exists(env.session_file) or not os.path.getsize(env.session_file):
        message = "Launch configuration does not exist. "
        message += "Sublime will now create a configuration file for you. Do you wish to proceed?"
        if sublime.ok_cancel_dialog(message):
            env.save_session()  # to pre-populate the config, so that the user has easier time filling it in
            env.w.run_command("ensime_show_session")
        return None

    session = env.load_session()
    if not session:
        message = "Launch configuration for the Ensime project could not be loaded. "
        message += "Maybe the config is not accessible, but most likely it's simply not a valid JSON. "
        message += "\n\n"
        message += "Sublime will now open the configuration file for you to fix. "
        message += "If you don't know how to fix the config, delete it and Sublime will recreate it from scratch. "
        message += "Do you wish to proceed?"
        if sublime.ok_cancel_dialog(message):
            env.w.run_command("ensime_show_session")
        return None

    launch = session.launch
    if not launch:
        message = "Your current " + session.launch_name + " is not present. "
        message += "\n\n"
        message += "This error happened because the \"current_launch_config\" field of the config "
        if session.launch_key:
            config_status = "set to \"" + session.launch_key + "\""
        else:
            config_status = "set to an empty string"
        message += "(which is currently " + config_status + ") "
        message += "doesn't correspond to any entries in the \"launch_configs\" field of the launch configuration."
        message += "\n\n"
        message += "Sublime will now open the configuration file for you to fix. Do you wish to proceed?"
        if sublime.ok_cancel_dialog(message):
            env.w.run_command("ensime_show_session")
        return None

    if not launch.is_valid():
        message = "Your current " + session.launch_name + " is incorrect. "
        message += "\n\n"
        if session.launch_key:
            launch_description = "the entry named \"" + session.launch_key + "\""
        else:
            launch_description = "the default unnamed entry"
        message += "This error happened because " + launch_description + \
                   " in the \"launch_configs\" field of the launch configuration "
        message += "has neither the \"main_class\", nor the \"remote_address\" attribute set."
        message += "\n\n"
        message += "Sublime will now open the configuration file for you to fix. Do you wish to proceed?"
        if sublime.ok_cancel_dialog(message):
            env.w.run_command("ensime_show_session")
        return None

    return launch
开发者ID:OlivierBlanvillain,项目名称:ensime-sublime,代码行数:55,代码来源:dotsession.py

示例15: handle_output_diagnostics

    def handle_output_diagnostics(output):
        if get_pref("print_diagnostics"):
            print(output)

        file_parse_error = get_diagnostics_parse_fail(output)
        if file_parse_error:
            msg = "Ignoring malformed config file: " + file_parse_error.group(1)
            if ok_cancel_dialog(msg):
                msg = "Please fix the syntax errors in your config file and try again. See the console output for more information. Do you wish to file a bug instead?"
                if ok_cancel_dialog(msg):
                    file_bug()
开发者ID:Jackysonglanlan,项目名称:devops,代码行数:11,代码来源:script_utils.py


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