def _format_state_icon(self, item, data): # This happens with lazy object lists. Sometimes it calls this function # without actually having the real object. if not isinstance(item, WorkOrderView): return stock_id, tooltip = get_workorder_state_icon(item.work_order) if stock_id is not None: return render_icon(stock_id, 16)
def _format_state_icon(self, item, data): # This happens with lazy object lists. Sometimes it calls this function # without actually having the real object. if not isinstance(item, WorkOrderView): return stock_id, tooltip = get_workorder_state_icon(item.work_order) if stock_id is not None: # We are using self.results because render_icon is a Gtk.Widget's # method. It has nothing to do with results tough. return self.results.render_icon(stock_id, Gtk.IconSize.MENU)
def _update_view(self): self.proxy.update('status_str') # Cache this to avoid multiple queries has_open_inventory = bool(Inventory.has_open( self.store, api.get_current_branch(self.store))) tab = self._get_tab('execution_holder') # If it's not opened, it's at least approved. # So, we can enable the execution slave tab.set_sensitive( self.model.status == WorkOrder.STATUS_WORK_IN_PROGRESS and not has_open_inventory and not self.visual_mode) has_items = bool(self.model.order_items.count()) branch = api.get_current_branch(self.store) if self.model.can_approve(): label = _("Approve") elif self.model.can_work(branch) and not has_items: label = _("Start") elif self.model.can_work(branch): label = _("Continue") elif self.model.can_pause(): label = _("Pause") else: label = '' self.toggle_status_btn.set_label(label) self.toggle_status_btn.set_sensitive(not self.visual_mode and self.model.client is not None) self.toggle_status_btn.set_visible(bool(label)) stock_id, tooltip = get_workorder_state_icon(self.model) if stock_id is not None: self.state_icon.set_from_icon_name(stock_id, Gtk.IconSize.MENU) self.state_icon.set_visible(True) self.state_icon.set_tooltip_text(tooltip) else: self.state_icon.hide()
def _update_view(self): self.proxy.update('status_str') # Cache this to avoid multiple queries has_open_inventory = bool(Inventory.has_open( self.store, api.get_current_branch(self.store))) tab = self._get_tab('execution_holder') # If it's not opened, it's at least approved. # So, we can enable the execution slave tab.set_sensitive( self.model.status == WorkOrder.STATUS_WORK_IN_PROGRESS and not has_open_inventory and not self.visual_mode) has_items = bool(self.model.order_items.count()) if self.model.can_approve(): label = _("Approve") elif self.model.can_work() and not has_items: label = _("Start") elif self.model.can_work(): label = _("Continue") elif self.model.can_pause(): label = _("Pause") else: label = '' self.toggle_status_btn.set_label(label) self.toggle_status_btn.set_sensitive(not self.visual_mode and self.model.client is not None) self.toggle_status_btn.set_visible(bool(label)) stock_id, tooltip = get_workorder_state_icon(self.model) if stock_id is not None: self.state_icon.set_from_icon_name(stock_id, Gtk.IconSize.MENU) self.state_icon.set_visible(True) self.state_icon.set_tooltip_text(tooltip) else: self.state_icon.hide()
def _format_state_icon(self, item, data): stock_id, tooltip = get_workorder_state_icon(item.work_order) if stock_id is not None: return render_icon(stock_id, Gtk.IconSize.MENU)
def _format_state_icon(self, item, data): stock_id, tooltip = get_workorder_state_icon(item.work_order) if stock_id is not None: # We are using self.identifier because render_icon is a # Gtk.Widget's # method. It has nothing to do with results tough. return self.identifier.render_icon(stock_id, Gtk.IconSize.MENU)
def _format_state_icon(self, item, data): stock_id, tooltip = get_workorder_state_icon(item.work_order) if stock_id is not None: # We are using self because render_icon is a gtk.Widget's # method. # It has nothing to do with results tough. return self.render_icon(stock_id, gtk.ICON_SIZE_MENU)