Esempio n. 1
0
    def execute(self, context):
        filename_info = pkt.core_filename_info(self.filepath)
        warning = None

        if not filename_info.is_zip:
            warning = 'We distribute our Core Library as a ZIP-file. ' +\
                      'The selected file appears to be of a different type'
        elif not filename_info.is_keentools_core:
            warning = 'The selected file name appears to be different from Core library file name'
        elif filename_info.version != pkt.MINIMUM_VERSION_REQUIRED:

            def _version_to_string(version):
                return str(version[0]) + '.' + str(version[1]) + '.' + str(
                    version[2])
            warning = 'Core library version %s doesn\'t match the add-on version %s' %\
                      (_version_to_string(filename_info.version),
                       _version_to_string(pkt.MINIMUM_VERSION_REQUIRED))
        elif filename_info.os != pkt.os_name():
            warning = 'Your OS is %s, you\'re trying to install the core library for %s' %\
                      (pkt.os_name(), filename_info.os)
        elif filename_info.is_nightly:
            warning = 'You\'re installing an unstable nightly build, is this what you really want?'

        if warning is not None:
            install_with_warning = get_operator(
                PREF_OT_InstalFromFilePktWithWarning.bl_idname)
            install_with_warning('INVOKE_DEFAULT',
                                 filepath=self.filepath,
                                 filename=filename_info.filename,
                                 warning=warning)
            return {'FINISHED'}

        InstallationProgress.start_zip_install(self.filepath)
        return {'FINISHED'}
Esempio n. 2
0
    def execute(self, context):
        if not self.confirm_install:
            self._report_canceled()
            return {'CANCELLED'}

        InstallationProgress.start_zip_install(self.filepath)
        self.report({'INFO'}, 'The core library has been '
                    'installed successfully.')
        return {'FINISHED'}
Esempio n. 3
0
 def _draw_download_progress(self, layout):
     col = layout.column()
     col.scale_y = 0.75
     download_state = InstallationProgress.get_state()
     if download_state['active']:
         col.label(text="Downloading: {:.1f}%".format(
             100 * download_state['progress']))
     if download_state['status'] is not None:
         col.label(text="{}".format(download_state['status']))
 def execute(self, context):
     InstallationProgress.start_download(self.install_type)
     return {'FINISHED'}
 def execute(self, context):
     InstallationProgress.start_zip_install(self.filepath)
     return {'FINISHED'}