def show(self, name, contract=None, start=None, end=None, account=None, management=None, support_level="", support_type="", virt_only=None, products=[], highlight=None): """ Show subscription details. Start and end should be formatted strings, not actual date objects. Products is a list of tuples in the format (name, id) """ # set a new buffer to clear out all the old tag information self.subscription_text.set_buffer(gtk.TextBuffer()) self._set(self.subscription_text, name) buf = self.subscription_text.get_buffer() tag = buf.create_tag("highlight-tag", weight=pango.WEIGHT_BOLD) for index in utils.find_text(name, highlight): buf.apply_tag(tag, buf.get_iter_at_offset(index), buf.get_iter_at_offset(index + len(highlight))) self._set(self.support_level_text, support_level) self._set(self.support_type_text, support_type) if self.show_contract: self._set(self.contract_number_text, contract) self._set(self.start_end_date_text, "%s - %s" % ( managerlib.formatDate(start), managerlib.formatDate(end))) self._set(self.account_text, account) self._set(self.provides_management_text, management) self._set(self.virt_only_text, virt_only) self.bundled_products.clear() for product in products: self.bundled_products.add_product(utils.apply_highlight(product[0], highlight), product[1])
def show(self, name, contract=None, start=None, end=None, account=None, management=None, support_level="", support_type="", virt_only=None, products=[], highlight=None, sku=None): """ Show subscription details. Start and end should be datetime objects. Products is a list of tuples in the format (name, id) """ # set a new buffer to clear out all the old tag information self.subscription_text.set_buffer(gtk.TextBuffer()) self._set(self.subscription_text, name) buf = self.subscription_text.get_buffer() tag = buf.create_tag("highlight-tag", weight=pango.WEIGHT_BOLD) for index in utils.find_text(name, highlight): buf.apply_tag(tag, buf.get_iter_at_offset(index), buf.get_iter_at_offset(index + len(highlight))) self._set(self.sku_text, sku) display_level = support_level if support_level == "": display_level = _("Not Set") self._set(self.support_level_and_type_text, ", ".join([display_level, support_type])) self._show_other_details(name, contract, start, end, account, management, support_level, support_type, virt_only, products, highlight, sku) self.bundled_products.clear() for product in products: self.bundled_products.add_product(utils.apply_highlight(product[0], highlight), product[1])