def test_attach(self): entry = ProxyEntry() entry.data_type = currency self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None) calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB) pixbuf_pixels = calc.render_icon(STOQ_CALC, gtk.ICON_SIZE_MENU).get_pixels() self.assertEqual( entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) entry.set_sensitive(False) self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None) entry.set_sensitive(True) self.assertEqual( entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) spinbutton = ProxySpinButton() spinbutton.data_type = currency self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None) calc = CalculatorPopup(spinbutton, CalculatorPopup.MODE_SUB) pixbuf_pixels = calc.render_icon(STOQ_CALC, gtk.ICON_SIZE_MENU).get_pixels() self.assertEqual( spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) spinbutton.set_sensitive(False) self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None) spinbutton.set_sensitive(True) self.assertEqual( spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
def _create_spin(self): spin = ProxySpinButton() spin.data_type = decimal.Decimal unit = self.model.product.sellable.unit upper = self._quantity if self._validate_max_quantity else MAX_INT spin.set_adjustment(Gtk.Adjustment(lower=0, upper=upper, step_increment=1, page_increment=10)) if unit and unit.allow_fraction: spin.set_digits(QUANTITY_PRECISION) self.setup_spin(spin) spin.connect_after('content-changed', self._after_spinbutton__content_changed) spin.connect('validate', self._on_spinbutton__validate) return spin
def _create_spin(self): spin = ProxySpinButton() spin.data_type = decimal.Decimal unit = self.model.product.sellable.unit upper = self._quantity if self._validate_max_quantity else MAX_INT spin.set_adjustment(gtk.Adjustment(lower=0, upper=upper, step_incr=1, page_incr=10)) if unit and unit.allow_fraction: spin.set_digits(QUANTITY_PRECISION) self.setup_spin(spin) spin.connect_after('content-changed', self._after_spinbutton__content_changed) spin.connect('validate', self._on_spinbutton__validate) return spin
def test_attach(self): entry = ProxyEntry() entry.data_type = currency self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None) calc = CalculatorPopup(entry, CalculatorPopup.MODE_SUB) pixbuf_pixels = calc.render_icon(STOQ_CALC, Gtk.IconSize.MENU).get_pixels() self.assertEqual( entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) entry.set_sensitive(False) self.assertEqual(entry.get_property('secondary-icon-pixbuf'), None) entry.set_sensitive(True) self.assertEqual( entry.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) spinbutton = ProxySpinButton() spinbutton.data_type = currency self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None) calc = CalculatorPopup(spinbutton, CalculatorPopup.MODE_SUB) pixbuf_pixels = calc.render_icon(STOQ_CALC, Gtk.IconSize.MENU).get_pixels() self.assertEqual( spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels) spinbutton.set_sensitive(False) self.assertEqual(spinbutton.get_property('secondary-icon-pixbuf'), None) spinbutton.set_sensitive(True) self.assertEqual( spinbutton.get_property('secondary-icon-pixbuf').get_pixels(), pixbuf_pixels)
def test_show(self): spinbutton = ProxySpinButton() spinbutton.data_type = currency calc = CalculatorPopup(spinbutton, CalculatorPopup.MODE_SUB) self.check_widget(calc, 'calculator-popup-show')
def test_show(self): spinbutton = ProxySpinButton() spinbutton.data_type = currency calc = CalculatorPopup(spinbutton, CalculatorPopup.MODE_SUB) self.check_widget(calc, 'calculator-popup-show')