def run(self, qAndaDict=None, **kwds): _async = kwds.pop("async", True) commands = kwds.pop("commands") run_mode = kwds.pop("run_mode", "capture_both") win_mode = kwds.pop("win_mode", "hide") run_opts = kwds.pop("run_opts", {}) dyn_report_mul = kwds.pop("dyn_report_mul", True) if qAndaDict: commands = [Str.renderText(cmd, **qAndaDict) for cmd in commands] commands = Setting.expandVariables(self.window, *commands) cwd, = Setting.expandVariables(self.window, run_opts.get("cwd", "${file_path}")) if cwd: run_opts["cwd"] = cwd workParams = dict(commands=commands, run_mode=run_mode, win_mode=win_mode, run_opts=run_opts, dyn_report_mul=dyn_report_mul ) print(workParams) if _async: view = self.window.active_view() self.asncCmdCount += 1 if run_mode != "run": view.set_status(ASYNC_STATUS_KEY, "***asnc command running***") self.doWorkAsnc(view, workParams, **kwds) else: self.doWork(**Data.mergeDicts(kwds, workParams))
def transf(self, obj, _): if self.qAndaDict is not None: obj = Str.renderText(obj, **self.qAndaDict) if self.need_expand_variables: obj, = Setting.expandVariables(self.window, obj) return obj
def doWork(self, **kwds): evalCode, = Setting.expandVariables(self.window, self.code) err = None ret = None try: ret = eval(evalCode) # pylint: disable=W0123 except Exception: # pylint: disable=W0703 err = traceback.format_exc() secs = [("code", evalCode, False)] if err is not None: secs.append(("error info", err, True)) if ret is not None: secs.append(("output info", str(ret), True)) infos = [] infos.append(StormOutputView.Info("success" if err is None else "error", *secs)) return err is not None, infos, kwds
def run(self, edit): window = self.view.window() lineRegion = self.view.full_line(self.view.sel()[0].begin()) sLine = self.view.substr(lineRegion) for filePattern in FILE_REGEX_ARR: res = re.match(filePattern, sLine) if res is None: continue filePath = res.group(1).replace("/", "\\") line = res.group(2) if not os.path.exists(filePath): fileDirectory, = Setting.expandVariables(window, "${file_path}") filePath = os.path.join(fileDirectory, filePath) if not os.path.exists(filePath): continue window.open_file("{0}:{1}".format(filePath, line), sublime.ENCODED_POSITION) return sublime.status_message("can't find file!")
self.window.open_file(content) else: raise ValueError("assetType: {} is not support!".format(assetType)) def vOnQuickPanelCancel(self): quickPanelView.endPane() class ClipboardPaletteRecordCommand(ProjectWiseJsonAssetRecordBaseCommand): def __init__(self, *args): super().__init__(*args) @staticmethod def vProjectWiseAssetManager(): return pwa def vPreTransContent(self, _, val): if val["content"] == "$<<clipboard>>": val["content"] = sublime.get_clipboard() pwa = Project.ProjectWiseAsset(srcExt=SRC_FILE_EXT) pwa.am = ClipboardAssetManager(srcExt=SRC_FILE_EXT, assetKey="assets", key="key") pwa.ps = Setting.PluginSetting(SKEY) pwa.prjInfo = Project.ProjectInfo(SKEY) tmpShowFile = Os.TmpFile() quickPanelView = WView.NewGroupPane("right")