Пример #1
0
    def _update_view(self):
        self.proxy.update('status_str')

        # If it's not opened, it's at least approved.
        # So, we can enable the execution slave
        tab = self._get_tab('execution_holder')
        tab.set_sensitive(self.model.status == WorkOrder.STATUS_WORK_IN_PROGRESS)

        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_stock(stock_id, gtk.ICON_SIZE_MENU)
            self.state_icon.set_visible(True)
            self.state_icon.set_tooltip_text(tooltip)
        else:
            self.state_icon.hide()
Пример #2
0
    def _update_view(self):
        self.proxy.update('status_str')

        # If it's not opened, it's at least approved.
        # So, we can enable the execution slave
        tab = self._get_tab('execution_holder')
        tab.set_sensitive(
            self.model.status == WorkOrder.STATUS_WORK_IN_PROGRESS)

        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_stock(stock_id, gtk.ICON_SIZE_MENU)
            self.state_icon.set_visible(True)
            self.state_icon.set_tooltip_text(tooltip)
        else:
            self.state_icon.hide()
Пример #3
0
    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.ICON_SIZE_MENU)
Пример #4
0
    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.ICON_SIZE_MENU)
Пример #5
0
 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.ICON_SIZE_MENU)
Пример #6
0
 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.ICON_SIZE_MENU)