class WcalTypeParamBox(gtk.HBox): def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont): from scal3.ui_gtk.mywidgets import MyFontButton gtk.HBox.__init__(self) self.wcal = wcal self._parent = wcal self.index = index self.mode = mode ###### module, ok = calTypes[mode] if not ok: raise RuntimeError("cal type %r not found" % mode) label = gtk.Label(_(module.desc) + " ") label.set_alignment(0, 0.5) pack(self, label) sgroupLabel.add_widget(label) ### self.fontCheck = gtk.CheckButton(_("Font")) pack(self, gtk.Label(""), 1, 1) pack(self, self.fontCheck) ### self.fontb = MyFontButton(wcal) pack(self, self.fontb) sgroupFont.add_widget(self.fontb) #### self.set(params) #### self.fontCheck.connect("clicked", self.onChange) self.fontb.connect("font-set", self.onChange) def get(self): return { "font": ( self.fontb.get_font_name() if self.fontCheck.get_active() else None ), } def set(self, data): font = data["font"] self.fontCheck.set_active(bool(font)) if not font: font = ui.getFont() self.fontb.set_font_name(font) def onChange(self, obj=None, event=None): ui.wcalTypeParams[self.index] = self.get() self.wcal.queue_draw()
class WcalTypeParamBox(gtk.HBox): def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont): from scal3.ui_gtk.mywidgets import MyFontButton gtk.HBox.__init__(self) self.wcal = wcal self._parent = wcal self.index = index self.mode = mode ###### module, ok = calTypes[mode] if not ok: raise RuntimeError("cal type %r not found" % mode) label = gtk.Label(_(module.desc) + " ") label.set_alignment(0, 0.5) pack(self, label) sgroupLabel.add_widget(label) ### self.fontCheck = gtk.CheckButton(_("Font")) pack(self, gtk.Label(""), 1, 1) pack(self, self.fontCheck) ### self.fontb = MyFontButton(wcal) pack(self, self.fontb) sgroupFont.add_widget(self.fontb) #### self.set(params) #### self.fontCheck.connect("clicked", self.onChange) self.fontb.connect("font-set", self.onChange) def get(self): return { "font": (self.fontb.get_font_name() if self.fontCheck.get_active() else None), } def set(self, data): font = data["font"] self.fontCheck.set_active(bool(font)) if not font: font = ui.getFont() self.fontb.set_font_name(font) def onChange(self, obj=None, event=None): ui.wcalTypeParams[self.index] = self.get() self.wcal.queue_draw()
class WcalTypeParamBox(gtk.HBox): def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont): from scal3.ui_gtk.mywidgets import MyFontButton gtk.HBox.__init__(self) self.wcal = wcal 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) ### self.fontCheck = gtk.CheckButton(_('Font')) pack(self, gtk.Label(''), 1, 1) pack(self, self.fontCheck) ### self.fontb = MyFontButton(wcal) pack(self, self.fontb) sgroupFont.add_widget(self.fontb) #### self.set(params) #### self.fontCheck.connect('clicked', self.onChange) self.fontb.connect('font-set', self.onChange) get = lambda self: { 'font': self.fontb.get_font_name() if self.fontCheck.get_active() else None, } def set(self, data): font = data['font'] self.fontCheck.set_active(bool(font)) if not font: font = ui.getFont() self.fontb.set_font_name(font) def onChange(self, obj=None, event=None): ui.wcalTypeParams[self.index] = self.get() self.wcal.queue_draw()
class WcalTypeParamBox(gtk.HBox): def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont): from scal3.ui_gtk.mywidgets import MyFontButton gtk.HBox.__init__(self) self.wcal = wcal 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) ### self.fontCheck = gtk.CheckButton(_('Font')) pack(self, gtk.Label(''), 1, 1) pack(self, self.fontCheck) ### self.fontb = MyFontButton(wcal) pack(self, self.fontb) sgroupFont.add_widget(self.fontb) #### self.set(params) #### self.fontCheck.connect('clicked', self.onChange) self.fontb.connect('font-set', self.onChange) get = lambda self: { 'font': self.fontb.get_font_name() if self.fontCheck.get_active() else None, } def set(self, data): font = data['font'] self.fontCheck.set_active(bool(font)) if not font: font = ui.getFont() self.fontb.set_font_name(font) def onChange(self, obj=None, event=None): ui.wcalTypeParams[self.index] = self.get() self.wcal.queue_draw()