def __init__(self): gtk.HBox.__init__(self) ## self.valueSpin = FloatSpinButton(0, 999, 1) pack(self, self.valueSpin) ## combo = gtk.combo_box_new_text() for unitValue, unitName in durationUnitsAbs: combo.append_text(_(' ' + unitName.capitalize() + 's')) combo.set_active(2) ## hour FIXME pack(self, combo) self.unitCombo = combo
def __init__(self, module, opt): t = opt[1] self.opt = opt ## needed?? self.module = module self.type = t self.var_name = opt[0] hbox = gtk.HBox() if t==bool: w = gtk.CheckButton(_(opt[2])) self.get_value = w.get_active self.set_value = w.set_active elif t==list: pack(hbox, gtk.Label(_(opt[2]))) w = gtk.combo_box_new_text() ### or RadioButton for s in opt[3]: w.append_text(_(s)) self.get_value = w.get_active self.set_value = w.set_active elif t==int: pack(hbox, gtk.Label(_(opt[2]))) w = IntSpinButton(opt[3], opt[4]) self.get_value = w.get_value self.set_value = w.set_value elif t==float: pack(hbox, gtk.Label(_(opt[2]))) w = FloatSpinButton(opt[3], opt[4], opt[5]) self.get_value = w.get_value self.set_value = w.set_value else: raise RuntimeError('bad option type "%s"'%t) pack(hbox, w) self._widget = hbox #### self.updateVar = lambda: setattr(self.module, self.var_name, self.get_value()) self.updateWidget = lambda: self.set_value(getattr(self.module, self.var_name))
class DurationInputBox(gtk.HBox): def __init__(self): gtk.HBox.__init__(self) ## self.valueSpin = FloatSpinButton(0, 999, 1) pack(self, self.valueSpin) ## combo = gtk.combo_box_new_text() 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))
def __init__(self, module, varName, _min, _max, digits=1): self.module = module self.varName = varName if digits==0: w = IntSpinButton(_min, _max) else: w = FloatSpinButton(_min, _max, digits) self._widget = w self.get = w.get_value self.set = w.set_value
def __init__(self, mcal, index, mode, params, sgroupLabel, sgroupFont): from scal2.ui_gtk.mywidgets.multi_spin.float_num import FloatSpinButton from scal2.ui_gtk.mywidgets import MyFontButton, MyColorButton gtk.HBox.__init__(self) self.mcal = mcal self.index = index self.mode = mode ###### label = gtk.Label(_(calTypes[mode].desc)+' ') label.set_alignment(0, 0.5) pack(self, label) sgroupLabel.add_widget(label) ### pack(self, gtk.Label(''), 1, 1) pack(self, gtk.Label(_('position'))) ### spin = FloatSpinButton(-99, 99, 1) self.spinX = spin pack(self, spin) ### spin = FloatSpinButton(-99, 99, 1) self.spinY = spin pack(self, spin) #### pack(self, gtk.Label(''), 1, 1) ### fontb = MyFontButton(mcal) self.fontb = fontb pack(self, fontb) sgroupFont.add_widget(fontb) #### colorb = MyColorButton() self.colorb = colorb pack(self, colorb) #### self.set(params) #### self.spinX.connect('changed', self.onChange) self.spinY.connect('changed', self.onChange) fontb.connect('font-set', self.onChange) colorb.connect('color-set', self.onChange)
class DurationInputBox(gtk.HBox): def __init__(self): gtk.HBox.__init__(self) ## self.valueSpin = FloatSpinButton(0, 999, 1) pack(self, self.valueSpin) ## combo = gtk.combo_box_new_text() 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))
def __init__(self): gtk.HBox.__init__(self) ## self.valueSpin = FloatSpinButton(0, 999, 1) pack(self, self.valueSpin) ## combo = gtk.combo_box_new_text() for unitValue, unitName in durationUnitsAbs: combo.append_text(_(' '+unitName.capitalize()+'s')) combo.set_active(2) ## hour FIXME pack(self, combo) self.unitCombo = combo
def optionsWidgetCreate(self): from scal2.ui_gtk.mywidgets.multi_spin.integer import IntSpinButton from scal2.ui_gtk.mywidgets.multi_spin.float_num import FloatSpinButton from scal2.ui_gtk.pref_utils import CheckPrefItem, ColorPrefItem if self.optionsWidget: return ColumnBase.optionsWidgetCreate(self) ##### hbox = gtk.HBox() spin = IntSpinButton(1, 9999) spin.set_value(ui.wcalHeight) spin.connect('changed', self.heightSpinChanged) pack(hbox, gtk.Label(_('Height'))) pack(hbox, spin) pack(self.optionsWidget, hbox) ### hbox = gtk.HBox() spin = FloatSpinButton(0.01, 1, 2) spin.set_value(ui.wcalTextSizeScale) spin.connect('changed', self.textSizeScaleSpinChanged) pack(hbox, gtk.Label(_('Text Size Scale'))) pack(hbox, spin) pack(self.optionsWidget, hbox) ######## hbox = gtk.HBox(spacing=3) #### item = CheckPrefItem(ui, 'wcalGrid', _('Grid')) item.updateWidget() gridCheck = item._widget pack(hbox, gridCheck) gridCheck.item = item #### colorItem = ColorPrefItem(ui, 'wcalGridColor', True) colorItem.updateWidget() pack(hbox, colorItem._widget) gridCheck.colorb = colorItem._widget gridCheck.connect('clicked', self.gridCheckClicked) colorItem._widget.item = colorItem colorItem._widget.connect('color-set', self.gridColorChanged) colorItem._widget.set_sensitive(ui.wcalGrid) #### pack(self.optionsWidget, hbox) ### self.optionsWidget.show_all()
def getFloatWidget(): from scal2.ui_gtk.mywidgets.multi_spin.float_num import FloatSpinButton btn = FloatSpinButton(-3.3, 5.5, 1) btn.set_value(3.67) return btn