def plugin_loaded(): # this ensures we have empty settings file in 'User' directory during first start # otherwise sublime will copy entire contents of 'SQLTools.sublime-settings' # which is not desirable and prevents future changes to queries and other # sensible defaults defined in settings file, as those would be overridden by content # from older versions of SQLTools in 'User\SQLTools.sublime-settings' sublimeUserFolder = getSublimeUserFolder() userSettingFile = os.path.join(sublimeUserFolder, SQLTOOLS_SETTINGS_FILE) if not os.path.isfile(userSettingFile): # create empty settings file in 'User' folder sublime.save_settings(SQLTOOLS_SETTINGS_FILE) try: from package_control import events if events.install(__name__): Log('Installed %s!' % events.install(__name__)) elif events.post_upgrade(__name__): Log('Upgraded to %s!' % events.post_upgrade(__name__)) sublime.message_dialog(('{0} was upgraded.' + 'If you have any problem,' + 'just restart your Sublime Text.' ).format(__name__) ) except Exception: pass startPlugin() reload()
def plugin_loaded(): from package_control import events if events.install(package_name): print('Installed %s' % events.install(package_name)) elif events.post_upgrade(package_name): print('Upgraded to %s' % events.post_upgrade(package_name))
def plugin_loaded(): from package_control import events if events.install(package_name): print('Installed %s!' % events.install(package_name)) elif events.post_upgrade(package_name): print('Upgraded to %s!' % events.post_upgrade(package_name))
def plugin_loaded(): # this ensures we have empty settings file in 'User' directory during first start # otherwise sublime will copy entire contents of 'SQLTools.sublime-settings' # which is not desirable and prevents future changes to queries and other # sensible defaults defined in settings file, as those would be overridden by content # from older versions of SQLTools in 'User\SQLTools.sublime-settings' sublimeUserFolder = getSublimeUserFolder() userSettingFile = os.path.join(sublimeUserFolder, SQLTOOLS_SETTINGS_FILE) if not os.path.isfile(userSettingFile): # create empty settings file in 'User' folder sublime.save_settings(SQLTOOLS_SETTINGS_FILE) try: from package_control import events if events.install(__name__): Log('Installed %s!' % events.install(__name__)) elif events.post_upgrade(__name__): Log('Upgraded to %s!' % events.post_upgrade(__name__)) sublime.message_dialog( ('{0} was upgraded.' + 'If you have any problem,' + 'just restart your Sublime Text.').format(__name__)) except Exception: pass startPlugin() reload()
def plugin_loaded(): from package_control import events if events.install(PACKAGE_NAME): status_msg('Installed %s' % events.install(PACKAGE_NAME)) elif events.post_upgrade(PACKAGE_NAME): status_msg('Upgraded to %s' % events.post_upgrade(PACKAGE_NAME))
def plugin_loaded(): from package_control import events if events.install(package_name): print('Installed %s!' % events.install(package_name)) sublime.set_timeout(init, 20000) elif events.post_upgrade(package_name): print('Upgraded to %s!' % events.post_upgrade(package_name)) sublime.set_timeout(init, 20000)
def plugin_loaded(): try: from package_control import events if events.install(__pkg_name__): status_msg('Installed %s' % events.install(__pkg_name__)) elif events.post_upgrade(__pkg_name__): status_msg('Upgraded to %s' % events.post_upgrade(__pkg_name__)) except Exception as e: print(e)
def plugin_loaded(): try: from package_control import events if events.install('package_control-tester'): print('Installed %s!' % events.install('package_control-tester')) elif events.post_upgrade('package_control-tester'): print('Upgraded to %s!' % events.post_upgrade('package_control-tester')) except (ImportError): pass
def plugin_loaded(): from package_control import events if events.install(package_name): print('Installed %s!' % events.install(package_name)) global command_bin command_text = 'php "' + command_bin + '" index/index/build_completion' print(command_text) cloums = os.popen(command_text) print(cloums.read()) elif events.post_upgrade(package_name): print('Upgraded to %s!' % events.post_upgrade(package_name))
def plugin_loaded(): log_handler.install() try: from package_control import events if events.install('SublimeLinter') or events.post_upgrade('SublimeLinter'): # In case the user has an old version installed without the below # `unload`, we 'unload' here. persist.kill_switch = True persist.linter_classes.clear() # The 'event' (flag) is set for 5 seconds. To not get into a # reloader excess we wait for that time, so that the next time # this exact `plugin_loaded` handler runs, the flag is already # unset. sublime.set_timeout_async(reload_sublime_linter, 5000) return except ImportError: pass persist.api_ready = True persist.kill_switch = False persist.settings.load() logger.info("debug mode: on") logger.info("version: " + util.get_sl_version()) style.read_gutter_theme() # Lint the visible views from the active window on startup bc = BackendController() for view in other_visible_views(): bc.on_activated_async(view)
def plugin_loaded(): from package_control import events # chmod +x <script> if (events.install(pkg) or events.post_upgrade(pkg)) and os.name is 'posix' or 'mac': st = os.stat(script) os.chmod(script, st.st_mode | stat.S_IEXEC)
def plugin_loaded(): try: from package_control import events if events.install(__name__): print('Installed %s!' % events.install(__name__)) elif events.post_upgrade(__name__): print('Upgraded to %s!' % events.post_upgrade(__name__)) sublime.message_dialog( ('{0} was upgraded.' + 'If you have any problem,' + 'just restart your Sublime Text.').format(__name__)) except Exception: pass reload()
def plugin_loaded(): log_handler.install() backup_old_settings() try: from package_control import events if events.install('SublimeLinter'): reloader.reload_linter_plugins() return elif events.post_upgrade('SublimeLinter'): reloader.reload_everything() return except ImportError: pass persist.api_ready = True persist.settings.load() logger.info("debug mode: on") logger.info("version: " + util.get_sl_version()) style.read_gutter_theme() style.StyleParser()() # Lint the visible views from the active window on startup if persist.settings.get("lint_mode") in ("background", "load_save"): for view in visible_views(): hit(view)
def plugin_loaded(): log_handler.install() backup_old_settings() try: from package_control import events if events.install('SublimeLinter') or events.post_upgrade( 'SublimeLinter'): # In case the user has an old version installed without the below # `unload`, we 'unload' here. persist.kill_switch = True persist.linter_classes.clear() util.show_message('SublimeLinter has been installed or upgraded. ' 'Please restart Sublime Text.') return except ImportError: pass persist.api_ready = True persist.kill_switch = False persist.settings.load() logger.info("debug mode: on") logger.info("version: " + util.get_sl_version()) style.read_gutter_theme() style.StyleParser()() # Lint the visible views from the active window on startup if persist.settings.get("lint_mode") in ("background", "load_save"): for view in visible_views(): hit(view)
def plugin_loaded(): from package_control import events me = os.path.basename(os.path.dirname(os.path.realpath(__file__))) if events.install(me) or events.post_upgrade(me): build()
def plugin_loaded(): # Install PlatformIO PioInstall() # Search updates Update().check_update_async() # check syntax files Syntax().check_syntax_file() # Load or fix the right deviot syntax file Syntax().paint_iot_views() menu_path = getMainMenuPath() compile_lang = get_setting('compile_lang', True) if (compile_lang or not path.exists(menu_path)): from .libraries.top_menu import TopMenu TopMenu().make_menu_files() save_setting('compile_lang', False) from package_control import events # alert when deviot was updated if (events.post_upgrade(package_name)): from .libraries.I18n import I18n save_setting('compile_lang', True) message = I18n().translate("reset_after_upgrade") message_dialog(message)
def plugin_loaded(): try: from package_control import events if events.post_upgrade(__package__): from .tools.reloader import reload_package reload_package(__package__) except ImportError: pass theme_plugin_loaded() if not logger.hasHandlers(): ch = logging.StreamHandler(sys.stdout) logger.addHandler(ch) settings = sublime.load_settings("Terminus.sublime-settings") def on_change(debug): if debug: logger.setLevel(logging.DEBUG) else: logger.setLevel(logging.WARNING) on_change(settings.get("debug", False)) settings_on_change(settings, "debug")(on_change)
def plugin_loaded(): # import if not import_ok: sublime.status_message( "* GUNA : Error in importing sub-modules. Please, see the trace-back message in Sublime console" ) return if package_control_installed and (events.install('Guna') or events.post_upgrade('Guna')): def installed(): # automatically set theme sublime.active_window().run_command('guna_set_theme') # reload for settings engine.engine_reload() # engine start engine.start() # show `Read Me` @ first # sublime.active_window().run_command('guna_readme') sublime.set_timeout_async(installed, 1000) else: # engine start engine.start() return
def plugin_loaded(): if package_control_installed and (events.install('Log Highlight') or events.post_upgrade('Log Highlight')): sublime.set_timeout_async(loaded, 1000) else: loaded() return
def plugin_loaded(): try: from package_control import events if events.install(__name__): logger.info('Installed %s!' % events.install(__name__)) elif events.post_upgrade(__name__): logger.info('Upgraded to %s!' % events.post_upgrade(__name__)) sublime.message_dialog(('{0} was upgraded.' + 'If you have any problem,' + 'just restart your Sublime Text.' ).format(__name__) ) except Exception: pass startPlugin() reload()
def plugin_loaded(): """Plugin loaded callback.""" try: # Reload 'modules' once after upgrading to ensure Mql5Comp is ready # for use instantly again. (Works with ST3 and python3 only!) from package_control import events if events.post_upgrade(__package__): from .modules.reload import reload_package reload_package(__package__) except ImportError: # Fail silently if package control isn't installed. pass
def plugin_loaded(): """Plugin loaded callback.""" try: # Reload 'modules' once after upgrading to ensure GitGutter is ready # for use instantly again. (Works with ST3 and python3 only!) from package_control import events if events.post_upgrade(__package__): from .modules.reload import reload_package reload_package(__package__) except ImportError: # Fail silently if package control isn't installed. pass
def plugin_loaded(): _load_translator_completions() from package_control import events ver = events.install('Focus') if not ver: ver = events.post_upgrade('Focus') if not ver: return ver = VersionNumber(ver) if ver.major_version >= 2 and ver.minor_version == 0: sublime.run_command('migrate_focus_settings')
def plugin_loaded(): # import if not import_ok: sublime.status_message("* TEST : Error") return if package_control_installed and (events.install('testing') or events.post_upgrade('testing')): print('install/upgrade') else: print('else install/upgrade') print('plugin_loaded')
def plugin_loaded(): try: pc_event = None from package_control import events if events.install('NeoVintageous'): pc_event = 'install' if events.post_upgrade('NeoVintageous'): pc_event = 'post_upgrade' except ImportError: pass # Package Control isn't available except Exception: import traceback traceback.print_exc() try: _update_ignored_packages() except Exception: import traceback traceback.print_exc() try: _exception = None init_state(sublime.active_window().active_view(), new_session=True) except Exception as e: _exception = e import traceback traceback.print_exc() if _EXCEPTION or _exception: _cleanup_views() if isinstance(_EXCEPTION, ImportError) or isinstance( _exception, ImportError): if pc_event == 'post_upgrade': message = "Failed to load some modules trying to upgrade NeoVintageous. "\ "Please restart Sublime Text to finish the upgrade." else: message = "Failed to load some NeoVintageous modules. "\ "Please restart Sublime Text." else: if pc_event == 'post_upgrade': message = "An error occurred trying to upgrade NeoVintageous. "\ "Please restart Sublime Text to finish the upgrade." else: message = "An error occurred trying to load NeoVintageous. "\ "Please restart Sublime Text." print('NeoVintageous: ' + message) sublime.message_dialog(message)
def plugin_loaded(): """Setup plugin.""" init_plugin() try: from package_control import events settings = sublime.load_settings('scope_hunter.sublime-settings') if TOOLTIP_SUPPORT and events.post_upgrade(support.__pc_name__): if not LATEST_SUPPORTED_MDPOPUPS and settings.get('upgrade_dependencies', True): window = sublime.active_window() if window: window.run_command('satisfy_dependencies') except ImportError: log('Could not import Package Control')
def plugin_loaded(): global PACKAGE_NAME PACKAGE_NAME = ResourcePath.from_file_path(__file__).package global UNSUBSCRIBE UNSUBSCRIBE = get_settings().subscribe(get_configurations, auto_build) if events.install(PACKAGE_NAME): ensure_dependencies_loaded() print('JS Custom: New installation. Building all syntaxes.') sublime.active_window().run_command('build_js_custom_syntaxes') elif events.post_upgrade(PACKAGE_NAME): ensure_dependencies_loaded() print('JS Custom: Installation upgraded. Rebuilding all syntaxes.') sublime.active_window().run_command('build_js_custom_syntaxes')
def plugin_loaded(): from package_control import events # Get name of package folder me = os.path.basename(os.path.dirname(os.path.realpath(__file__))) if (events.install(me) or events.post_upgrade(me)) and os.name is 'posix' or 'mac': for file in files: # Concat full path file_path = sublime.packages_path() + '/' + me + '/' + file # Change permissions, if file exists if os.path.isfile(file_path): st = os.stat(file_path) os.chmod(file_path, st.st_mode | stat.S_IEXEC)
def plugin_loaded(): global import_ok if not import_ok: sublime.status_message( "(*E) Verilog Gadget : Error in importing sub-modules.") return if package_control_installed and (events.install('Verilog Gadget') or events.post_upgrade('Verilog Gadget')): def installed(): vgcore.loaded() sublime.set_timeout_async(installed, 1000) else: vgcore.loaded() return
def plugin_loaded(): global SYNTAXES_PATH SYNTAXES_PATH = path.join(sublime.packages_path(), 'User', 'JS Custom', 'Syntaxes') global SETTINGS SETTINGS = NamedSettingsDict('JS Custom.sublime-settings') if events.install("JSCustom") or events.post_upgrade("JSCustom"): def build(): sublime.active_window().run_command('build_js_custom_syntaxes') sublime.set_timeout_async(build, 500) global SUBSCRIPTION_KEY SUBSCRIPTION_KEY = SETTINGS.subscribe(get_configurations, auto_build)
def plugin_loaded() -> None: initialize_logger() # logger.info("plugin_loaded") global UNSUBSCRIBE UNSUBSCRIBE = get_settings().subscribe(get_configurations, auto_build) if events.install(PACKAGE_NAME): ensure_dependencies_loaded() logger.info('New installation. Building all syntaxes.') sublime.active_window().run_command('build_js_custom_syntaxes') elif events.post_upgrade(PACKAGE_NAME): ensure_dependencies_loaded() logger.info('Installation upgraded. Building all syntaxes.') sublime.active_window().run_command('build_js_custom_syntaxes')
def plugin_loaded(): """ DA UI loaded. """ cleaner.cleanup() was_upgraded = False try: from package_control import events except ImportError: pass else: was_upgraded = events.post_upgrade(package.NAME) finally: if was_upgraded: ensure_reload() else: loader.load()
def plugin_loaded(): from os.path import join from package_control import events # Get name of package folder me = os.path.basename(os.path.dirname(os.path.realpath(__file__))) if len(files) > 0: if (events.install(me) or events.post_upgrade(me)) and os.name is 'posix' or 'mac': for file in files: # Concat full path file_path = join(sublime.packages_path(), me + '/' + file) # Change permissions, if file exists if os.path.isfile(file_path): sublime.status_message("[%s] chmod +x %s" % (me, file)) st = os.stat(file_path) os.chmod(file_path, st.st_mode | stat.S_IEXEC) sublime.status_message("[%s] Completed" % me)
def plugin_loaded(): """ A File Icon loaded. Raises: ImportError: If `Package Control` is not installed. """ was_upgraded = False try: from package_control import events except ImportError as error: logging.log(NOPC_MSG) logging.dump(error) else: was_upgraded = events.post_upgrade(PACKAGE_NAME) finally: if was_upgraded: ensure_reload() else: main()
def plugin_loaded(): log_handler.install() backup_old_settings() from package_control import events if events.install('SublimeLinter'): util.message('SublimeLinter has been installed. Please restart Sublime Text.') elif events.post_upgrade('SublimeLinter'): util.message('SublimeLinter has been upgraded. Please restart Sublime Text.') persist.settings.load() logger.info("debug mode: on") logger.info("version: " + util.get_sl_version()) style.load_gutter_icons() style.StyleParser()() plugin = SublimeLinter.shared_plugin() # Lint the visible views from the active window on startup if persist.settings.get("lint_mode") in ("background", "load_save"): for view in visible_views(): plugin.hit(view)
def plugin_loaded(): """ General plugin initialization. Load up uniocode table, initialize settings and match object, and start event loop. Restart event loop if already loaded. """ global HIGH_VISIBILITY global bh_thread settings = sublime.load_settings("bh_core.sublime-settings") # Try and ensure key dependencies are at the latest known good version. # This is only done because Package Control does not do this on package upgrade at the present. try: from package_control import events if bh_popup.HOVER_SUPPORT and events.post_upgrade(support.__pc_name__): if not bh_popup.LATEST_SUPPORTED_MDPOPUPS and settings.get( 'upgrade_dependencies', True): window = sublime.active_window() if window: window.run_command('satisfy_dependencies') except ImportError: log('Could not import Package Control') init_bh_match() global HIGH_VISIBILITY if sublime.load_settings("bh_core.sublime-settings").get( 'high_visibility_enabled_by_default', False): HIGH_VISIBILITY = True if bh_thread is not None: bh_thread.kill() bh_thread = BhThread() bh_thread.start()
def plugin_loaded(): # import if not import_ok: sublime.status_message( "* GUNA : Error in importing sub-modules. Please, see the trace-back message in Sublime console" ) return # check reload time btw. Guna.py and sub-modules tdt_eng = (tchk - engine.tchk).total_seconds() tdt_api = (tchk - api.tchk).total_seconds() tdt_per = (tchk - persist.tchk).total_seconds() if tdt_eng > 10 or tdt_api > 10 or tdt_per > 10: GunaApi.alert_message( 3, " GUNA : Error in reloading sub-modules, Please, restart sublime text", 15, 1) return if package_control_installed and (events.install('Guna') or events.post_upgrade('Guna')): def installed(): # automatically set theme sublime.active_window().run_command('guna_set_theme') # reload for settings engine.engine_reload() # engine start engine.start() # show `Read Me` @ first # sublime.active_window().run_command('guna_readme') sublime.set_timeout_async(installed, 1000) else: # engine start engine.start()
def plugin_loaded(): """ General plugin initialization. Load up uniocode table, initialize settings and match object, and start event loop. Restart event loop if already loaded. """ global HIGH_VISIBILITY global bh_thread settings = sublime.load_settings("bh_core.sublime-settings") # Try and ensure key dependencies are at the latest known good version. # This is only done because Package Control does not do this on package upgrade at the present. try: from package_control import events if bh_popup.HOVER_SUPPORT and events.post_upgrade(support.__pc_name__): if not bh_popup.LATEST_SUPPORTED_MDPOPUPS and settings.get('upgrade_dependencies', True): window = sublime.active_window() if window: window.run_command('satisfy_dependencies') except ImportError: log('Could not import Package Control') init_bh_match() global HIGH_VISIBILITY if sublime.load_settings("bh_core.sublime-settings").get('high_visibility_enabled_by_default', False): HIGH_VISIBILITY = True if bh_thread is not None: bh_thread.kill() bh_thread = BhThread() bh_thread.start()
def plugin_loaded(): log_handler.install() backup_old_settings() from package_control import events if events.install('SublimeLinter'): util.message( 'SublimeLinter has been installed. Please restart Sublime Text.') elif events.post_upgrade('SublimeLinter'): util.message( 'SublimeLinter has been upgraded. Please restart Sublime Text.') persist.settings.load() logger.info("debug mode: on") logger.info("version: " + util.get_sl_version()) style.load_gutter_icons() style.StyleParser()() plugin = SublimeLinter.shared_plugin() # Lint the visible views from the active window on startup if persist.settings.get("lint_mode") in ("background", "load_save"): for view in visible_views(): plugin.hit(view)
import sublime import sys import logging # from PackageDev # https://github.com/SublimeText/PackageDev/blob/20a4966c60c487b30badd2dac9238872e6918af3/main.py try: from package_control import events except ImportError: pass else: if events.post_upgrade(__package__): # clean up sys.modules to ensure all submodules are reloaded modules_to_clear = set() prefix = __package__ + "." # don't clear the base package for module_name in sys.modules: if module_name.startswith(prefix) and module_name != __name__: modules_to_clear.add(module_name) print("[{}] Cleaning up {} cached modules after update…".format( __package__, len(modules_to_clear))) for module_name in modules_to_clear: del sys.modules[module_name] from .terminus.clipboard import TerminusClipboardHistoryUpdater from .terminus.core import ( TerminusCoreEventListener, TerminusOpenCommand, TerminusCloseCommand, TerminusCloseAllCommand, TerminusExecCommand, TerminusCancelBuildCommand, TerminusRecencyEventListener, TerminusInitializeCommand, TerminusActivateCommand, TerminusResetCommand, TerminusRenameTitleCommand,
try: from package_control import events except ImportError: pass else: if events.post_upgrade(__package__): # clean up sys.modules to ensure all submodules are reloaded import sys modules_to_clear = set() prefix = __package__ + "." # don't clear the base package for module_name in sys.modules: if module_name.startswith(prefix) and module_name != __name__: modules_to_clear.add(module_name) print("[{}] Cleaning up {} cached modules after update…" .format(__package__, len(modules_to_clear))) for module_name in modules_to_clear: del sys.modules[module_name] # Must be named "plugins_" # because sublime_plugin claims a plugin module's `plugin` attribute for itself. # Fixed in 3153 https://github.com/SublimeTextIssues/Core/issues/1991. from .plugins_ import * # noqa