Exemple #1
0
class DurationInputBox(gtk.HBox):
	def __init__(self):
		gtk.HBox.__init__(self)
		##
		self.valueSpin = FloatSpinButton(0, 999, 1)
		pack(self, self.valueSpin)
		##
		combo = gtk.ComboBoxText()
		for unitValue, unitName in durationUnitsAbs:
			combo.append_text(_(
				" " + unitName.capitalize() + "s"
			))
		combo.set_active(2) ## hour FIXME
		pack(self, combo)
		self.unitCombo = combo

	def getDuration(self):
		return (
			self.valueSpin.get_value(),
			durationUnitValues[self.unitCombo.get_active()],
		)

	def setDuration(self, value, unit):
		self.valueSpin.set_value(value)
		self.unitCombo.set_active(durationUnitValues.index(unit))
Exemple #2
0
class DurationInputBox(gtk.HBox):
    def __init__(self):
        gtk.HBox.__init__(self)
        ##
        self.valueSpin = FloatSpinButton(0, 999, 1)
        pack(self, self.valueSpin)
        ##
        combo = gtk.ComboBoxText()
        for unitValue, unitName in durationUnitsAbs:
            combo.append_text(_(' '+unitName.capitalize()+'s'))
        combo.set_active(2) ## hour FIXME
        pack(self, combo)
        self.unitCombo = combo
    def getDuration(self):
        return self.valueSpin.get_value(), durationUnitValues[self.unitCombo.get_active()]
    def setDuration(self, value, unit):
        self.valueSpin.set_value(value)
        self.unitCombo.set_active(durationUnitValues.index(unit))
Exemple #3
0
def getFloatWidget():
	from scal3.ui_gtk.mywidgets.multi_spin.float_num import FloatSpinButton
	btn = FloatSpinButton(-3.3, 5.5, 1)
	btn.set_value(3.67)
	btn.set_editable(True)
	return btn