def updateTypeParamsWidget(self): vbox = self.typeParamsVbox for child in vbox.get_children(): child.destroy() ### n = len(calTypes.active) while len(ui.wcalTypeParams) < n: ui.wcalTypeParams.append({ 'font': None, }) sgroupLabel = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) sgroupFont = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) for i, mode in enumerate(calTypes.active): #try: params = ui.wcalTypeParams[i] #except IndexError: ## hbox = WcalTypeParamBox(self.wcal, i, mode, params, sgroupLabel, sgroupFont) pack(vbox, hbox) ### vbox.show_all()
def updateCols(self): #self.foreach(gtk._widget.destroy)## Couses crash tray icon in gnome3 #self.foreach(lambda child: self.remove(child))## Couses crash tray icon in gnome3 ######## columns = self.get_children() n = len(columns) n2 = len(calTypes.active) width = self.getWidthValue() if n > n2: for i in range(n2, n): columns[i].destroy() elif n < n2: for i in range(n, n2): col = DaysOfMonthColumn(self.wcal, self, 0, i) pack(self, col) columns.append(col) for i, mode in enumerate(calTypes.active): col = columns[i] col.mode = mode col.show() col.set_property('width-request', width)
def __init__(self): ToolbarItem.__init__(self, 'mainMenu', None, '', _('Main Menu'), enableToolip=False) self.connect('clicked', self.onClicked) self.updateImage() #### self.optionsWidget = gtk.VBox() ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon')+' ')) self.iconSelect = IconSelectButton() self.iconSelect.set_filename(ui.wcal_toolbar_mainMenu_icon) self.iconSelect.connect('changed', self.onIconChanged) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.optionsWidget, hbox) self.optionsWidget.show_all()
def __init__(self, wcal): Column.__init__(self, wcal) self.expand = ui.wcal_eventsCount_expand ## hbox = gtk.HBox() check = gtk.CheckButton(_('Expand')) check.set_active(ui.wcal_eventsCount_expand) check.connect('clicked', self.expandCheckClicked) pack(hbox, check) pack(hbox, gtk.Label(''), 1, 1) pack(self.optionsWidget, hbox) self.optionsWidget.show_all() ## self.connect('expose-event', self.onExposeEvent)
def __init__(self, wcal, index, mode, params, sgroupLabel, sgroupFont): 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)
def __init__(self, wcal): gtk.HBox.__init__(self) self.initVars() self.wcal = wcal self.updateCols() self.updateDir() self.show() ##### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Direction'))) combo = DirectionComboBox() pack(hbox, combo) combo.setValue(ui.wcal_daysOfMonth_dir) combo.connect('changed', self.dirComboChanged) pack(self.optionsWidget, hbox) #### frame = gtk.Frame(_('Calendars')) self.typeParamsVbox = gtk.VBox() frame.add(self.typeParamsVbox) frame.show_all() pack(self.optionsWidget, frame) self.updateTypeParamsWidget()## FIXME #### self.optionsWidget.show_all()
def initVars(self, *a, **ka): CustomizableCalObj.initVars(self, *a, **ka) if not self.optionsWidget: self.optionsWidget = gtk.VBox() #### if self.customizeWidth: value = self.getWidthValue() self.setWidthWidget(value) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Width'))) spin = IntSpinButton(0, 999) pack(hbox, spin) spin.set_value(value) spin.connect('changed', self.widthSpinChanged) pack(self.optionsWidget, hbox) #### if self.customizeFont: hbox = gtk.HBox() pack(hbox, gtk.Label(_('Font Family'))) combo = FontFamilyCombo(hasAuto=True) combo.set_value(self.getFontValue()) pack(hbox, combo) combo.connect('changed', self.fontFamilyComboChanged) pack(self.optionsWidget, hbox) #### self.optionsWidget.show_all()
def __init__(self): gtk.HBox.__init__(self) CalBase.__init__(self) self.set_property('height-request', ui.wcalHeight) ###################### self.connect('scroll-event', self.scroll) ### self.connect('button-press-event', self.buttonPress) ##### defaultItems = [ ToolbarColumn(self), WeekDaysColumn(self), PluginsTextColumn(self), EventsIconColumn(self), EventsCountColumn(self), EventsTextColumn(self), EventsBoxColumn(self), DaysOfMonthColumnGroup(self), ] defaultItemsDict = dict([(item._name, item) for item in defaultItems]) itemNames = defaultItemsDict.keys() for name, enable in ui.wcalItems: try: item = defaultItemsDict[name] except KeyError: print('weekCal item %s does not exist'%name) else: item.enable = enable self.appendItem(item) itemNames.remove(name) for name in itemNames: item = defaultItemsDict[name] item.enable = False self.appendItem(item) ##### 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 __init__(self, wcal): Column.__init__(self, wcal) self.connect('expose-event', self.onExposeEvent) ##### hbox = gtk.HBox() check = gtk.CheckButton(_('Show Description')) check.set_active(ui.wcal_eventsText_showDesc) pack(hbox, check) pack(hbox, gtk.Label(''), 1, 1) check.connect('clicked', self.descCheckClicked) pack(self.optionsWidget, hbox) ## hbox = gtk.HBox() check = gtk.CheckButton(_('Colorize')) check.set_active(ui.wcal_eventsText_colorize) pack(hbox, check) pack(hbox, gtk.Label(''), 1, 1) check.connect('clicked', self.colorizeCheckClicked) pack(self.optionsWidget, hbox) ## self.optionsWidget.show_all()
if __name__=='__main__': win = gtk.Dialog() cal = WeekCal() win.add_events( gdk.POINTER_MOTION_MASK | gdk.FOCUS_CHANGE_MASK | gdk.BUTTON_MOTION_MASK | gdk.BUTTON_PRESS_MASK | gdk.BUTTON_RELEASE_MASK | gdk.SCROLL_MASK | gdk.KEY_PRESS_MASK | gdk.VISIBILITY_NOTIFY_MASK | gdk.EXPOSURE_MASK ) pack(win.vbox, cal, 1, 1) win.vbox.show_all() win.resize(600, 400) cal.onConfigChange() win.run()