def run(self, message): v = OutputPanel('dart.config.check') text = HEADING + '\n' text += ('=' * 80) + '\n' text += 'MESSAGE:\n' text += message + '\n' text += '\n' text += 'CONFIGURATION:\n' text += ('-' * 80) + '\n' text += "editor version: {} ({})".format(sublime.version(), sublime.channel()) text += '\n' text += ('-' * 80) + '\n' text += "os: {} ({})".format(sublime.platform(), sublime.arch()) text += '\n' text += ('-' * 80) + '\n' setts = sublime.load_settings('Dart - Plugin Settings.sublime-settings') text += "dart_sdk_path: {}".format(setts.get('dart_sdk_path')) text += '\n' text += '=' * 80 v.write(text) v.show()
def run(self, message): v = OutputPanel('dart.config.check') text = HEADING + '\n' text += ('=' * 80) + '\n' text += 'MESSAGE:\n' text += message + '\n' text += '\n' text += 'CONFIGURATION:\n' text += ('-' * 80) + '\n' text += "editor version: {} ({})".format(sublime.version(), sublime.channel()) text += '\n' text += ('-' * 80) + '\n' text += "os: {} ({})".format(sublime.platform(), sublime.arch()) text += '\n' text += ('-' * 80) + '\n' setts = sublime.load_settings( 'Dart - Plugin Settings.sublime-settings') text += "dart_sdk_path: {}".format(setts.get('dart_sdk_path')) text += '\n' text += '=' * 80 v.write(text) v.show()
def sanity_check(env={}, error_log=False): if not env: env = gs.env() ns = '(not set)' sl = [ ('install state', gs.attr(INSTALL_ATTR_NAME)), ('sublime.version', sublime.version()), ('sublime.channel', sublime.channel()), ('about.ann', gs.attr('about.ann')), ('about.version', gs.attr('about.version')), ('version', about.VERSION), ('platform', about.PLATFORM), ('~bin', '%s' % gs.home_path('bin')), ('MarGo', '%s (%s)' % _tp(_margo_bin())), ('GOROOT', '%s' % env.get('GOROOT', ns)), ('GOPATH', '%s' % env.get('GOPATH', ns)), ('GOBIN', '%s (should usually be `%s`)' % (env.get('GOBIN', ns), ns)), ] if error_log: try: with open(gs.home_path('log.txt'), 'r') as f: s = f.read().strip() sl.append(('error log', s)) except Exception: pass return sl
def get_support_info(): pc_settings = sublime.load_settings('Package Control.sublime-settings') is_installed_by_pc = str( PACKAGE_NAME in set(pc_settings.get('installed_packages', []))) info = {} info['channel'] = sublime.channel() info['version'] = sublime.version() info['platform'] = sublime.platform() info['arch'] = sublime.arch() info['package_name'] = PACKAGE_NAME info['package_version'] = PACKAGE_VERSION info['pc_install'] = is_installed_by_pc try: import mdpopups info['mdpopups_version'] = format_version(mdpopups, 'version', call=True) except Exception: info['mdpopups_version'] = 'Version could not be acquired!' try: import markdown info['markdown_version'] = format_version(markdown, 'version') except Exception: info['markdown_version'] = 'Version could not be acquired!' try: import jinja2 info['jinja_version'] = format_version(jinja2, '__version__') except Exception: info['jinja_version'] = 'Version could not be acquired!' try: import pygments info['pygments_version'] = format_version(pygments, '__version__') except Exception: info['pygments_version'] = 'Version could not be acquired!' return '''%(package_name)s:\n\n* version: %(package_version)s\n* installed via Package Control: %(pc_install)s\n\nSublime Text:\n\n* channel: %(channel)s\n* version: %(version)s\n* platform: %(platform)s\n* architecture: %(arch)s\n\nDependency versions:\n\n* mdpopups: %(mdpopups_version)s\n* markdown: %(markdown_version)s\n* pygments: %(pygments_version)s\n* jinja2: %(jinja_version)s''' % info
def sanity_check(env={}, error_log=False): if not env: env = sh.env() ns = "(not set)" sl = [ ("install state", _inst_state()), ("sublime.version", sublime.version()), ("sublime.channel", sublime.channel()), ("about.ann", gs.attr("about.ann", "")), ("about.version", gs.attr("about.version", "")), ("version", about.VERSION), ("platform", about.PLATFORM), ("~bin", "%s" % gs.home_dir_path("bin")), ("margo.exe", "%s (%s)" % _tp(_margo_bin())), ("go.exe", "%s (%s)" % _tp(sh.which("go") or "go")), ("go.version", sh.GO_VERSION), ("GOROOT", "%s" % env.get("GOROOT", ns)), ("GOPATH", "%s" % env.get("GOPATH", ns)), ("GOBIN", "%s (should usually be `%s`)" % (env.get("GOBIN", ns), ns)), ("set.shell", str(gs.lst(gs.setting("shell")))), ("env.shell", env.get("SHELL", "")), ("shell.cmd", str(sh.cmd("${CMD}"))), ] if error_log: try: with open(gs.home_path("log.txt"), "r") as f: s = f.read().strip() sl.append(("error log", s)) except Exception: pass return sl
def get_support_info(): pc_settings = sublime.load_settings('Package Control.sublime-settings') is_installed_by_pc = str(PACKAGE_NAME in set(pc_settings.get('installed_packages', []))) info = {} info['channel'] = sublime.channel() info['version'] = sublime.version() info['platform'] = sublime.platform() info['arch'] = sublime.arch() info['package_name'] = PACKAGE_NAME info['package_version'] = PACKAGE_VERSION info['pc_install'] = is_installed_by_pc try: import mdpopups info['mdpopups_version'] = format_version(mdpopups, 'version', call=True) except Exception: info['mdpopups_version'] = 'Version could not be acquired!' try: import markdown info['markdown_version'] = format_version(markdown, 'version') except Exception: info['markdown_version'] = 'Version could not be acquired!' try: import jinja2 info['jinja_version'] = format_version(jinja2, '__version__') except Exception: info['jinja_version'] = 'Version could not be acquired!' try: import pygments info['pygments_version'] = format_version(pygments, '__version__') except Exception: info['pygments_version'] = 'Version could not be acquired!' return '''%(package_name)s:\n\n* version: %(package_version)s\n* installed via Package Control: %(pc_install)s\n\nSublime Text:\n\n* channel: %(channel)s\n* version: %(version)s\n* platform: %(platform)s\n* architecture: %(arch)s\n\nDependency versions:\n\n* mdpopups: %(mdpopups_version)s\n* markdown: %(markdown_version)s\n* pygments: %(pygments_version)s\n* jinja2: %(jinja_version)s''' % info
def sanity_check(env={}, error_log=False): if not env: env = sh.env() ns = '(not set)' sl = [ ('install state', _inst_state()), ('sublime.version', sublime.version()), ('sublime.channel', sublime.channel()), ('about.ann', gs.attr('about.ann', '')), ('about.version', gs.attr('about.version', '')), ('version', about.VERSION), ('platform', about.PLATFORM), ('~bin', '%s' % gs.home_dir_path('bin')), ('margo.exe', '%s (%s)' % _tp(_margo_bin())), ('go.exe', '%s (%s)' % _tp(sh.which('go') or 'go')), ('go.version', sh.GO_VERSION), ('GOROOT', '%s' % env.get('GOROOT', ns)), ('GOPATH', '%s' % env.get('GOPATH', ns)), ('GOBIN', '%s' % env.get('GOBIN', ns)), ('set.shell', str(gs.lst(gs.setting('shell')))), ('env.shell', env.get('SHELL', '')), ('shell.cmd', str(sh.cmd('${CMD}'))), ] if error_log: try: with open(gs.home_path('log.txt'), 'r') as f: s = f.read().strip() sl.append(('error log', s)) except Exception: pass return sl
def sanity_check(env={}, error_log=False): if not env: env = gs.env() ns = '(not set)' sl = [ ('install state', gs.attr(_inst_name(), '')), ('sublime.version', sublime.version()), ('sublime.channel', sublime.channel()), ('about.ann', gs.attr('about.ann', '')), ('about.version', gs.attr('about.version', '')), ('version', about.VERSION), ('platform', about.PLATFORM), ('~bin', '%s' % gs.home_path('bin')), ('margo.exe', '%s (%s)' % _tp(_margo_bin())), ('go.exe', '%s (%s)' % _tp(gs.which('go') or 'go')), ('GOROOT', '%s' % env.get('GOROOT', ns)), ('GOPATH', '%s' % env.get('GOPATH', ns)), ('GOBIN', '%s (should usually be `%s`)' % (env.get('GOBIN', ns), ns)), ] if error_log: try: with open(gs.home_path('log.txt'), 'r') as f: s = f.read().strip() sl.append(('error log', s)) except Exception: pass return sl
def collect(self): self.elements.clear() db0 = DataBlock('Version and architecture') db0.items.append(DataItem('name', 'Sublime Text')) db0.items.append(DataItem('version', sublime.version())) db0.items.append(DataItem('architecture', sublime.arch())) db0.items.append(DataItem('channel', sublime.channel())) db0.items.append(DataItem('platform', sublime.platform())) view = sublime.active_window().active_view() view_settings = view.settings() db1 = DataBlock('View settings') for setting_name in ('syntax', 'tab_size', 'translate_tabs_to_spaces'): db1.items.append(DataItem(setting_name, view_settings.get(setting_name))) db2 = DataBlock('View state') db2.items.append(DataItem('is view dirty', view.is_dirty())) db2.items.append(DataItem('is view readonly', view.is_read_only())) db1.items.append(DataItem('encoding', view.encoding())) db1.items.append(DataItem('em width', view.em_width())) db1.items.append(DataItem('selection count', len(view.sel()))) db1.items.append(DataItem('has non empty selections', view.has_non_empty_selection_region())) self.elements.append(db0) # TODO: Split the rest up into methods. self.collect_package_data() self.elements.append(db1) self.elements.append(db2) self.collect_profiling_data()
def sanity_check(env={}, error_log=False): if not env: env = sh.env() ns = '(not set)' sl = [ ('install state', _inst_state()), ('sublime.version', sublime.version()), ('sublime.channel', sublime.channel()), ('about.ann', gs.attr('about.ann', '')), ('about.version', gs.attr('about.version', '')), ('version', about.VERSION), ('platform', about.PLATFORM), ('~bin', '%s' % gs.home_dir_path('bin')), ('margo.exe', '%s (%s)' % _tp(_margo_bin())), ('go.exe', '%s (%s)' % _tp(sh.which('go') or 'go')), ('go.version', sh.GO_VERSION), ('GOROOT', '%s' % env.get('GOROOT', ns)), ('GOPATH', '%s' % env.get('GOPATH', ns)), ('GOBIN', '%s (should usually be `%s`)' % (env.get('GOBIN', ns), ns)), ('set.shell', str(gs.lst(gs.setting('shell')))), ('env.shell', env.get('SHELL', '')), ('shell.cmd', str(sh.cmd('${CMD}'))), ] if error_log: try: with open(gs.home_path('log.txt'), 'r') as f: s = f.read().strip() sl.append(('error log', s)) except Exception: pass return sl
def run(self): self.load_json("package-metadata.json") sublime_info = "[Sublime Text " + sublime.version() + "/" + sublime.channel() + "/" + sublime.platform() + "/" + sublime.arch() + "]" canary_file = os.path.join(_corona_utils.PACKAGE_DIR, "about.py") if _corona_utils.SUBLIME_VERSION < 3000 else _corona_utils.PLUGIN_PATH install_info = "Installed: " + str(datetime.datetime.fromtimestamp(os.path.getmtime(canary_file))) about_mesg = "Corona Editor for Sublime Text\n\nVersion: " + self._about_info['version'] + "\n\n" + install_info + "\n\n" + self._about_info['description'] + "\n\n" + sublime_info print("about: " + about_mesg.replace("\n\n", " | ")) sublime.message_dialog(about_mesg)
def run(self, selector=None, action=""): if self.action != "": action = self.action self.action = "" if action == "additional_packages": view = self.window.new_file() view.set_name("Javatar - Additional Packages") view.set_scratch(True) view.run_command("javatar_util", {"type": "insert", "text": "==== This section is under development ====\n\nAdditional packages\n========\n To reduce plugin size, Javatar provides additional packages for different version of Java you are working.\n\nHere are all available packages:\n\nJavaSE7: http://\nJavaSE8: http://\nJavaFX8: http://\n\n==== This section is under development ===="}) if action == "actions_history": if not getSettings("enable_actions_history"): sublime.message_dialog("Actions History is disabled. Please enable them first.") return self.action = action if selector is not None: report = "## Javatar Report\n### System Informations\n* Javatar Version: `%javatar_version%`\n* Sublime Version: `%sublime_version%`\n* Package Path: `%packages_path%`\n* Javatar Channel: `%javatar_channel%`\n* Sublime Channel: `%sublime_channel%`\n* Platform: `%platform%`\n* As Packages: `%is_package%`\n* Package Control: `%package_control%`\n* Architecture: `%arch%`\n* Javatar's Parent Folder: `%parent_folder%`\n* Is Project: `%is_project%`\n* Is File: `%is_file%`\n* Is Java: `%is_java%`\n\n### Action List\n%actions%" report = report.replace("%javatar_version%", getVersion()) report = report.replace("%javatar_channel%", str.lower(getSettings("package_channel"))) report = report.replace("%is_package%", str(getPath("exist", getPath("join", sublime.installed_packages_path(), "Javatar.sublime-package")))) report = report.replace("%parent_folder%", getPath("javatar_parent")) report = report.replace("%sublime_version%", str(sublime.version())) report = report.replace("%sublime_channel%", sublime.channel()) report = report.replace("%package_control%", str(getPath("exist", getPath("join", sublime.packages_path(), "Package Control")) or getPath("exist", getPath("join", sublime.installed_packages_path(), "Package Control.sublime-package")))) report = report.replace("%is_project%", str(isProject())) report = report.replace("%is_file%", str(isFile())) report = report.replace("%is_java%", str(isJava())) report = report.replace("%packages_path%", sublime.packages_path()) report = report.replace("%platform%", sublime.platform()) report = report.replace("%arch%", sublime.arch()) selectors = selector.split("|") if len(selectors) > 1: include = selectors[0].split(",") exclude = selectors[1].split(",") else: include = selectors[0].split(",") exclude = [] actionText = "" actions = getAction().getAction(include, exclude) c = 1 for action in actions: if c > 1: actionText += "\n" actionText += str(c) + ". " + action c += 1 report = report.replace("%actions%", actionText) view = self.window.new_file() view.set_name("Javatar Actions History Report") view.set_scratch(True) view.run_command("javatar_util", {"type": "add", "text": report, "dest": "Actions History"}) view.run_command("javatar_util", {"type": "set_read_only"}) else: self.window.show_input_panel("Selector: ", "", self.run, "", "")
def run(self): self.load_json("package-metadata.json") sublime_info = "[Sublime Text " + sublime.version() + "/" + sublime.channel() + "/" + sublime.platform() + "/" + sublime.arch() + "]" canary_file = os.path.join(_corona_utils.PACKAGE_DIR, "about.py") if _corona_utils.SUBLIME_VERSION < 3000 else _corona_utils.PLUGIN_PATH try: install_info = "Installed: " + str(datetime.datetime.fromtimestamp(os.path.getmtime(canary_file))) except: # Test installations can end up with a confused "PLUGIN_PATH" so try something else canary_file = os.path.realpath(__file__) install_info = "Installed: " + str(datetime.datetime.fromtimestamp(os.path.getmtime(canary_file))) about_mesg = "Corona Editor for Sublime Text\n\nVersion: " + self._about_info['version'] + "\n\n" + install_info + "\n\n" + self._about_info['description'] + "\n\n" + sublime_info print("about: " + about_mesg.replace("\n\n", " | ")) sublime.message_dialog(about_mesg)
def print_action_history(self, selector): """ Show an action history to user using specified selector @param selector: a action selector """ selector = selector or "" actions = self.get_actions(selector) actionText = "\n".join( "{}. {}".format(i, action) for i, action in enumerate(actions, 1) ) report = REPORT_TEMPLATE.format_map({ "javatar_version": Constant.get_version(), "is_package": os.path.exists(os.path.join( sublime.installed_packages_path(), "Javatar.sublime-package") ), "parent_folder": __name__.split('.')[0], "sublime_version": sublime.version(), "sublime_channel": sublime.channel(), "is_debug": Settings().get("debug_mode"), "package_control": (os.path.exists( os.path.join(sublime.packages_path(), "Package Control") ) or os.path.exists(os.path.join( sublime.installed_packages_path(), "Package Control.sublime-package" ))), "is_project": StateProperty().is_project(), "is_file": StateProperty().is_file(), "is_java": StateProperty().is_java(), "packages_path": sublime.packages_path(), "platform": sublime.platform(), "arch": sublime.arch(), "actions": actionText, }) view = self.window.new_file() view.set_name("Javatar Action History Report") view.set_scratch(True) view.run_command("javatar_utils", { "util_type": "add", "text": report, "dest": "Action History" }) view.run_command("javatar_utils", {"util_type": "set_read_only"})
def do_report(): data = { "report" : json.dumps ({ 'time' : time.ctime(), 'arch' : sublime.arch(), 'platform' : sublime.platform(), 'version' : sublime.version(), 'packages_path' : sublime.packages_path(), 'channel' : sublime.channel(), 'arbitrage_version' : 2, 'unicode_sys_path_problem' : ( WINDOWS and not short_path_names(sublime.packages_path()) ) })} req = urllib2.Request(URL, urllib.urlencode(data)) urllib2.urlopen(req, timeout=2)
def do_report(): importable = importable_path(sublime.packages_path()) data = { "report": json.dumps({ 'arbitrage_version': 3, 'time': time.ctime(), 'arch': sublime.arch(), 'platform': sublime.platform(), 'version': sublime.version(), 'channel': sublime.channel(), 'packages_path': sublime.packages_path(), 'importable_path': importable, 'unicode_sys_path_problem': not importable, }) } req = urllib2.Request(URL, urllib.urlencode(data)) urllib2.urlopen(req, timeout=2)
def actions_history(self, selector, action): if not get_settings("enable_actions_history"): sublime.message_dialog("Actions History is disabled. Please enable them first.") return self.action = action if selector is None: self.window.show_input_panel("Selector: ", "", self.run, "", "") return actions = self.get_actions(selector) actionText = '\n'.join( '{}. {}'.format(i, action) for i, action in enumerate(actions, 1) ) report = REPORT_TEMPLATE.format_map({ "javatar_version": get_version(), "javatar_channel": str.lower(get_settings("package_channel")), "is_package": exists(join(sublime.installed_packages_path(), "Javatar.sublime-package")), "parent_folder": get_javatar_parent(), "sublime_version": sublime.version(), "sublime_channel": sublime.channel(), "is_debug": get_settings("debug_mode"), "package_control": exists(join(sublime.packages_path(), "Package Control")) or exists(join(sublime.installed_packages_path(), "Package Control.sublime-package")), "is_project": is_project(), "is_file": is_file(), "is_java": is_java(), "packages_path": sublime.packages_path(), "platform": sublime.platform(), "arch": sublime.arch(), "actions": actionText, }) view = self.window.new_file() view.set_name("Javatar Actions History Report") view.set_scratch(True) view.run_command("javatar_util", {"util_type": "add", "text": report, "dest": "Actions History"}) view.run_command("javatar_util", {"util_type": "set_read_only"})
def do_report(): importable = importable_path(sublime.packages_path()) data = { "report" : json.dumps ({ 'arbitrage_version' : 3, 'time' : time.ctime(), 'arch' : sublime.arch(), 'platform' : sublime.platform(), 'version' : sublime.version(), 'channel' : sublime.channel(), 'packages_path' : sublime.packages_path(), 'importable_path' : importable, 'unicode_sys_path_problem' : not importable, })} req = urllib2.Request(URL, urllib.urlencode(data)) urllib2.urlopen(req, timeout=2)
def run(self): sdk = SDK() previous_view = self.window.active_view() report = self.window.new_file() report.set_name('Dart - Configuration Report') report.set_scratch(True) self.append(report, 'Sublime Text Information\n') self.append(report, '=' * 80) self.add_newline(report) self.append(report, 'version: ') self.append(report, sublime.version()) self.append(report, ' (') self.append(report, sublime.channel()) self.append(report, ' channel)') self.add_newline(report) self.append(report, 'platform: ') self.append(report, sublime.platform()) self.add_newline(report) self.append(report, 'architecture: ') self.append(report, sublime.arch()) self.add_newline(report) self.add_newline(report) self.append(report, 'Dart SDK Information\n') self.append(report, '=' * 80) self.add_newline(report) self.append(report, 'version: ') dart_version = sdk.check_version() self.append(report, dart_version) self.add_newline(report) self.append(report, 'Dart Package Settings\n') self.append(report, '=' * 80) self.add_newline(report) self.append(report, 'dart_sdk_path: ') self.append(report, sdk.path) self.add_newline(report) self.append(report, 'dart_dartium_path: ') self.append(report, sdk.path_to_dartium) self.add_newline(report) self.append(report, 'dart_user_browsers: ') self.add_newline(report) self.append(report, pprint.pformat(sdk.user_browsers)) self.add_newline(report) self.add_newline(report) self.append(report, 'Project Information\n') self.append(report, '=' * 80) self.add_newline(report) if previous_view: try: self.append( report, str(PubspecFile.from_path( previous_view.file_name()).path) ) except Exception as e: self.append(report, 'No pubspec found\n') self.add_newline(report)
def run(self, selector=None, action=""): if self.action != "": action = self.action self.action = "" if action == "actions_history": if not get_settings("enable_actions_history"): sublime.message_dialog( "Actions History is disabled. Please enable them first.") return self.action = action if selector is not None: report = "## Javatar Report\n### System Informations\n* Javatar Version: `%javatar_version%`\n* Sublime Version: `%sublime_version%`\n* Package Path: `%packages_path%`\n* Javatar Channel: `%javatar_channel%`\n* Sublime Channel: `%sublime_channel%`\n* Is Debug Mode: `%is_debug%`\n* Platform: `%platform%`\n* As Packages: `%is_package%`\n* Package Control: `%package_control%`\n* Architecture: `%arch%`\n* Javatar's Parent Folder: `%parent_folder%`\n* Is Project: `%is_project%`\n* Is File: `%is_file%`\n* Is Java: `%is_java%`\n\n### Action List\n%actions%" report = report.replace("%javatar_version%", get_version()) report = report.replace( "%javatar_channel%", str.lower(get_settings("package_channel"))) report = report.replace( "%is_package%", str( get_path( "exist", get_path("join", sublime.installed_packages_path(), "Javatar.sublime-package")))) report = report.replace("%parent_folder%", get_path("javatar_parent")) report = report.replace("%sublime_version%", str(sublime.version())) report = report.replace("%sublime_channel%", sublime.channel()) report = report.replace("%is_debug%", str(get_settings("debug_mode"))) report = report.replace( "%package_control%", str( get_path( "exist", get_path("join", sublime.packages_path(), "Package Control")) or get_path( "exist", get_path("join", sublime.installed_packages_path(), "Package Control.sublime-package")))) report = report.replace("%is_project%", str(is_project())) report = report.replace("%is_file%", str(is_file())) report = report.replace("%is_java%", str(is_java())) report = report.replace("%packages_path%", sublime.packages_path()) report = report.replace("%platform%", sublime.platform()) report = report.replace("%arch%", sublime.arch()) selectors = selector.split("|") if len(selectors) > 1: include = selectors[0].split(",") exclude = selectors[1].split(",") else: include = selectors[0].split(",") exclude = [] actionText = "" actions = get_action().get_action(include, exclude) c = 1 for action in actions: if c > 1: actionText += "\n" actionText += str(c) + ". " + action c += 1 report = report.replace("%actions%", actionText) view = self.window.new_file() view.set_name("Javatar Actions History Report") view.set_scratch(True) view.run_command("javatar_util", { "util_type": "add", "text": report, "dest": "Actions History" }) view.run_command("javatar_util", {"util_type": "set_read_only"}) else: self.window.show_input_panel("Selector: ", "", self.run, "", "")