コード例 #1
0
ファイル: sessionmgr.py プロジェクト: giangdip2410/pyRevit
def _perform_onsessionloadstart_ops():
    # clear the cached engines
    if not _clear_running_engines():
        mlogger.debug('No Engine Manager exists...')

    # check for updates
    if user_config.auto_update \
            and not _check_autoupdate_inprogress():
        mlogger.info('Auto-update is active. Attempting update...')
        _set_autoupdate_inprogress(True)
        updater.update_pyrevit()
        _set_autoupdate_inprogress(False)

    # once pre-load is complete, report environment conditions
    uuid_str = sessioninfo.new_session_uuid()
    sessioninfo.report_env()

    # reset the list of assemblies loaded under pyRevit session
    sessioninfo.set_loaded_pyrevit_assemblies([])

    # init executor
    runtime_types.ScriptExecutor.Initialize()

    # init routes
    routes.init()

    # asking telemetry module to setup the telemetry system
    # (active or not active)
    telemetry.setup_telemetry(uuid_str)

    # apply Upgrades
    upgrade.upgrade_existing_pyrevit()

    # setup hooks
    hooks.setup_hooks()
コード例 #2
0
def _perform_onsessionload_ops():
    # clear the cached engines
    if not _clear_running_engines():
        mlogger.debug('No Engine Manager exists...')

    # check for updates
    if user_config.core.get_option('autoupdate', default_value=False) \
            and not _check_autoupdate_inprogress():
        mlogger.info('Auto-update is active. Attempting update...')
        _set_autoupdate_inprogress(True)
        updater.update_pyrevit()
        _set_autoupdate_inprogress(False)

    # once pre-load is complete, report environment conditions
    uuid_str = sessioninfo.new_session_uuid()
    sessioninfo.report_env()

    # reset the list of assemblies loaded under pyRevit session
    sessioninfo.set_loaded_pyrevit_assemblies([])

    # asking usagelog module to setup the usage logging system
    # (active or not active)
    setup_usage_logfile(uuid_str)

    # apply Upgrades
    upgrade.upgrade_existing_pyrevit()
コード例 #3
0
def _update_repo(repo_info):
    # update one by one
    logger.debug('Updating repo: {}'.format(repo_info.directory))
    try:
        upped_repo_info = updater.update_pyrevit(repo_info)
        logger.info(':inbox_tray: Successfully updated: {} to {}'.format(
            upped_repo_info.name, upped_repo_info.last_commit_hash[:7]))
    except Exception:
        logger.info(
            'Can not update repo: {}  (Run in debug to see why)'.format(
                repo_info.name))
コード例 #4
0
from pyrevit.coreutils import ribbon
from pyrevit.versionmgr import updater
from pyrevit.userconfig import user_config
from pyrevit import script


logger = script.get_logger()


def __selfinit__(script_cmp, ui_button_cmp, __rvt__):
    # do not load the tool if user should not update
    if not user_config.user_can_update:
        return False
    # otherwise set icon depending on if updates are available
    try:
        has_update_icon = script_cmp.get_bundle_file('icon_hasupdates.png')
        if user_config.check_updates \
                and not user_config.auto_update \
                and updater.check_for_updates():
            ui_button_cmp.set_icon(has_update_icon,
                                   icon_size=ribbon.ICON_LARGE)
        return True
    except Exception as ex:
        logger.error('Error in checking updates: {}'.format(ex))
        return False


if __name__ == '__main__':
    updater.update_pyrevit()
コード例 #5
0
            ui_button_cmp.set_icon(has_update_icon, icon_size=ICON_LARGE)
    except:
        return


if __name__ == '__main__':
    # collect a list of all repos to be updates
    if _check_connection():
        repo_info_list = updater.get_all_extension_repos()
        logger.debug('List of repos to be updated: {}'.format(repo_info_list))

        for repo_info in repo_info_list:
            # update one by one
            logger.debug('Updating repo: {}'.format(repo_info.directory))
            try:
                upped_repo_info = updater.update_pyrevit(repo_info)
                logger.info(
                    ':inbox_tray: Successfully updated: {} to {}'.format(
                        upped_repo_info.name,
                        upped_repo_info.last_commit_hash[:7]))
            except:
                logger.info(
                    'Can not update repo: {}  (Run in debug to see why)'.
                    format(repo_info.name))

        # perform upgrade tasks
        logger.info('Upgrading settings...')
        upgrade.upgrade_existing_pyrevit()

        # now re-load pyrevit session.
        sleep(1)