示例#1
0
    def __init__(self,
                 column_title,
                 tree_model,
                 quantity_store_idx,
                 is_multi_entitled_store_idx,
                 available_store_idx=None,
                 quantity_increment_idx=None,
                 editable=True):
        self.quantity_store_idx = quantity_store_idx
        self.is_multi_entitled_store_idx = is_multi_entitled_store_idx
        self.available_store_idx = available_store_idx
        self.quantity_increment_idx = quantity_increment_idx

        self.quantity_renderer = ga_Gtk.CellRendererSpin()
        self.quantity_renderer.set_property("xalign", 0)
        self.quantity_renderer.set_property(
            "adjustment", ga_Gtk.Adjustment(lower=1, upper=100, step_incr=1))
        self.quantity_renderer.set_property("editable", editable)
        self.quantity_renderer.connect("edited", self._on_edit, tree_model)
        self.quantity_renderer.connect("editing-started", self._setup_editor)

        super(QuantitySelectionColumn,
              self).__init__(column_title,
                             self.quantity_renderer,
                             text=self.quantity_store_idx)
        self.set_cell_data_func(self.quantity_renderer,
                                self._update_cell_based_on_data)

        self.set_max_width(100)
        self.set_min_width(100)