当前位置: 首页>>代码示例>>Python>>正文


Python MunkiItems.getInstallInfo方法代码示例

本文整理汇总了Python中MunkiItems.getInstallInfo方法的典型用法代码示例。如果您正苦于以下问题:Python MunkiItems.getInstallInfo方法的具体用法?Python MunkiItems.getInstallInfo怎么用?Python MunkiItems.getInstallInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MunkiItems的用法示例。


在下文中一共展示了MunkiItems.getInstallInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: updateOptionalInstallButtonClicked_

# 需要导入模块: import MunkiItems [as 别名]
# 或者: from MunkiItems import getInstallInfo [as 别名]
    def updateOptionalInstallButtonClicked_(self, item_name):
        '''this method is called from JavaScript when a user clicks
        the cancel or add button in the updates list'''
        # TO-DO: better handling of all the possible "unexpected error"s
        document = self.webView.mainFrameDocument()
        item = MunkiItems.optionalItemForName_(item_name)
        if not item:
            msclog.debug_log('Unexpected error: Can\'t find item for %s' % item_name)
            return
        update_table_row = document.getElementById_('%s_update_table_row' % item_name)
        if not update_table_row:
            msclog.debug_log('Unexpected error: Can\'t find table row for %s' % item_name)
            return
        # remove this row from its current table
        node = update_table_row.parentNode().removeChild_(update_table_row)

        previous_status = item['status']
        # update item status
        item.update_status()
        
        # do we need to add a new node to the other list?
        if item.get('needs_update'):
            # make some new HTML for the updated item
            managed_update_names = MunkiItems.getInstallInfo().get('managed_updates', [])
            item_template = mschtml.get_template('update_row_template.html')
            item_html = item_template.safe_substitute(item)

            if item['status'] in ['install-requested', 'update-will-be-installed', 'installed']:
                # add the node to the updates-to-install table
                table = document.getElementById_('updates-to-install-table')
            if item['status'] == 'update-available':
                # add the node to the other-updates table
                table = document.getElementById_('other-updates-table')
            if not table:
                msclog.debug_log('Unexpected error: could not find other-updates-table')
                return
            # this isn't the greatest way to add something to the DOM
            # but it works...
            table.setInnerHTML_(table.innerHTML() + item_html)

        # might need to toggle visibility of other updates div
        other_updates_div = document.getElementById_('other-updates')
        other_updates_div_classes = other_updates_div.className().split(' ')
        other_updates_table = document.getElementById_('other-updates-table')
        if other_updates_table.innerHTML().strip():
            if 'hidden' in other_updates_div_classes:
                other_updates_div_classes.remove('hidden')
                other_updates_div.setClassName_(' '.join(other_updates_div_classes))
        else:
            if not 'hidden' in other_updates_div_classes:
                other_updates_div_classes.append('hidden')
                other_updates_div.setClassName_(' '.join(other_updates_div_classes))

        # update the updates-to-install header to reflect the new list of updates to install
        updateCount = self.getUpdateCount()
        update_count_message = msclib.updateCountMessage(updateCount)
        update_count_element = document.getElementById_('update-count-string')
        if update_count_element:
            update_count_element.setInnerText_(update_count_message)

        warning_text = mschtml.get_warning_text()
        warning_text_element = document.getElementById_('update-warning-text')
        if warning_text_element:
            warning_text_element.setInnerHTML_(warning_text)

        # update text of Install All button
        install_all_button_element = document.getElementById_('install-all-button-text')
        if install_all_button_element:
            install_all_button_element.setInnerText_(
                msclib.getInstallAllButtonTextForCount(updateCount))

        # update count badges
        self.displayUpdateCount()
        
        if MunkiItems.updateCheckNeeded():
            # check for updates after a short delay so UI changes visually complete first
            self.performSelector_withObject_afterDelay_(self.checkForUpdates, True, 1.0)
开发者ID:altyus,项目名称:munki,代码行数:79,代码来源:MSCMainWindowController.py


注:本文中的MunkiItems.getInstallInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。