def __init__(self, event): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry gtk.VBox.__init__(self) self.event = event ########### hbox = gtk.HBox() ### pack(hbox, gtk.Label(_('Calendar Type'))) combo = CalTypeCombo() combo.set_active(calTypes.primary) ## overwritten in updateWidget() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo ### pack(self, hbox) ########### if event.isAllDay: self.tzCheck = None else: hbox = gtk.HBox() self.tzCheck = gtk.CheckButton(_('Time Zone')) set_tooltip(self.tzCheck, _('For input times of event')) pack(hbox, self.tzCheck) combo = TimeZoneComboBoxEntry() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.tzCombo = combo pack(self, hbox) self.tzCheck.connect( 'clicked', lambda check: self.tzCombo.set_sensitive(check.get_active())) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Summary'))) self.summaryEntry = gtk.Entry() pack(hbox, self.summaryEntry, 1, 1) pack(self, hbox) ########### self.descriptionInput = TextFrame() swin = gtk.ScrolledWindow() swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swin.add_with_viewport(self.descriptionInput) ### exp = gtk.Expander() exp.set_expanded(True) exp.set_label(_('Description')) exp.add(swin) pack(self, exp, 1, 1) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon') + ':')) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ########## self.modeCombo.connect( 'changed', self.modeComboChanged) ## right place? before updateWidget? FIXME
class TrashEditorDialog(gtk.Dialog): def __init__(self): gtk.Dialog.__init__(self) self.set_title(_('Edit Trash')) #self.connect('delete-event', lambda obj, e: self.destroy()) #self.resize(800, 600) ### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) ####### self.trash = ui.eventTrash ## sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ####### hbox = gtk.HBox() label = gtk.Label(_('Title')) label.set_alignment(0, 0.5) pack(hbox, label) sizeGroup.add_widget(label) self.titleEntry = gtk.Entry() pack(hbox, self.titleEntry, 1, 1) pack(self.vbox, hbox) #### hbox = gtk.HBox() label = gtk.Label(_('Icon')) label.set_alignment(0, 0.5) pack(hbox, label) sizeGroup.add_widget(label) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) #### self.vbox.show_all() self.updateWidget() def run(self): if gtk.Dialog.run(self)==gtk.RESPONSE_OK: self.updateVars() self.destroy() def updateWidget(self): self.titleEntry.set_text(self.trash.title) self.iconSelect.set_filename(self.trash.icon) def updateVars(self): self.trash.title = self.titleEntry.get_text() self.trash.icon = self.iconSelect.filename self.trash.save()
def __init__(self): gtk.HBox.__init__(self) ######### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Category')+':')) ##### ls = gtk.ListStore(gdk.Pixbuf, str) combo = gtk.ComboBox() combo.set_model(ls) ### cell = gtk.CellRendererPixbuf() pack(combo, cell, False) combo.add_attribute(cell, 'pixbuf', 0) ### cell = gtk.CellRendererText() pack(combo, cell, True) combo.add_attribute(cell, 'text', 1) ### ls.append([None, _('Custom')])## first or last FIXME for item in ui.eventTags: ls.append([ gdk.pixbuf_new_from_file(item.icon) if item.icon else None, item.desc ]) ### self.customItemIndex = 0 ## len(ls)-1 pack(hbox, combo) self.typeCombo = combo self.typeStore = ls ### vbox = gtk.VBox() pack(vbox, hbox) pack(self, vbox) ######### iconLabel = gtk.Label(_('Icon')) pack(hbox, iconLabel) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) tagsLabel = gtk.Label(_('Tags')) pack(hbox, tagsLabel) hbox3 = gtk.HBox() self.tagButtons = [] for item in ui.eventTags: button = gtk.ToggleButton(item.desc) button.tagName = item.name self.tagButtons.append(button) pack(hbox3, button) self.swin = gtk.ScrolledWindow() self.swin.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_NEVER)## horizontal AUTOMATIC or ALWAYS FIXME self.swin.add_with_viewport(hbox3) pack(self, self.swin, 1, 1) self.customTypeWidgets = (iconLabel, self.iconSelect, tagsLabel, self.swin) ######### self.typeCombo.connect('changed', self.typeComboChanged) self.connect('scroll-event', self.scrollEvent) ######### self.show_all() hideList(self.customTypeWidgets)
def __init__(self, event): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry gtk.VBox.__init__(self) self.event = event ########### hbox = gtk.HBox() ### pack(hbox, gtk.Label(_('Calendar Type'))) combo = CalTypeCombo() combo.set_active(calTypes.primary)## overwritten in updateWidget() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo ### pack(self, hbox) ########### if event.isAllDay: self.tzCheck = None else: hbox = gtk.HBox() self.tzCheck = gtk.CheckButton(_('Time Zone')) set_tooltip(self.tzCheck, _('For input times of event')) pack(hbox, self.tzCheck) combo = TimeZoneComboBoxEntry() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.tzCombo = combo pack(self, hbox) self.tzCheck.connect('clicked', lambda check: self.tzCombo.set_sensitive(check.get_active())) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Summary'))) self.summaryEntry = gtk.Entry() pack(hbox, self.summaryEntry, 1, 1) pack(self, hbox) ########### self.descriptionInput = TextFrame() swin = gtk.ScrolledWindow() swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swin.add_with_viewport(self.descriptionInput) ### exp = gtk.Expander() exp.set_expanded(True) exp.set_label(_('Description')) exp.add(swin) pack(self, exp, 1, 1) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon')+':')) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ########## self.modeCombo.connect('changed', self.modeComboChanged)## right place? before updateWidget? FIXME
def optionsWidgetCreate(self): from os.path import isabs from scal2.ui_gtk.mywidgets.icon import IconSelectButton if self.optionsWidget: return self.optionsWidget = gtk.VBox() ### iconPath = ui.wcal_toolbar_mainMenu_icon if not isabs(iconPath): iconPath = join(pixDir, iconPath) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon')+' ')) self.iconSelect = IconSelectButton() self.iconSelect.set_filename(iconPath) 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 optionsWidgetCreate(self): from scal2.ui_gtk.mywidgets.icon import IconSelectButton if self.optionsWidget: return 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): 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()
class MainMenuToolbarItem(ToolbarItem): def __init__(self): ToolbarItem.__init__(self, 'mainMenu', None, '', _('Main Menu'), enableTooltip=False) self.connect('clicked', self.onClicked) self.updateImage() def optionsWidgetCreate(self): from os.path import isabs from scal2.ui_gtk.mywidgets.icon import IconSelectButton if self.optionsWidget: return self.optionsWidget = gtk.VBox() ### iconPath = ui.wcal_toolbar_mainMenu_icon if not isabs(iconPath): iconPath = join(pixDir, iconPath) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon')+' ')) self.iconSelect = IconSelectButton() self.iconSelect.set_filename(iconPath) 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 updateImage(self): from scal2.ui_gtk.utils import imageFromFile self.set_property('label-widget', imageFromFile(ui.wcal_toolbar_mainMenu_icon)) self.show_all() def getMenuPos(self): wcal = self.get_parent().get_parent() w = self.get_allocation().width h = self.get_allocation().height x0, y0 = self.translate_coordinates(wcal, 0, 0) return ( x0 if rtl else x0+w, y0+h, ) def onClicked(self, widget=None): x, y = self.getMenuPos() self.get_parent().get_parent().emit( 'popup-main-menu', 0, x, y, ) def onIconChanged(self, widget, iconPath): if not iconPath: iconPath = ui.wcal_toolbar_mainMenu_icon_default self.iconSelect.set_filename(iconPath) direc = join(pixDir, "") if iconPath.startswith(direc): iconPath = iconPath[len(direc):] ui.wcal_toolbar_mainMenu_icon = iconPath self.updateImage()
class MainMenuToolbarItem(ToolbarItem): def __init__(self): ToolbarItem.__init__(self, 'mainMenu', None, '', _('Main Menu'), enableTooltip=False) self.connect('clicked', self.onClicked) self.updateImage() def optionsWidgetCreate(self): from scal2.ui_gtk.mywidgets.icon import IconSelectButton if self.optionsWidget: return 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 updateImage(self): from scal2.ui_gtk.utils import imageFromFile self.set_property('label-widget', imageFromFile(ui.wcal_toolbar_mainMenu_icon)) self.show_all() def getMenuPos(self): wcal = self.get_parent().get_parent() w = self.get_allocation().width h = self.get_allocation().height x0, y0 = self.translate_coordinates(wcal, 0, 0) return ( x0 if rtl else x0+w, y0+h, ) def onClicked(self, widget=None): x, y = self.getMenuPos() self.get_parent().get_parent().emit( 'popup-main-menu', 0, x, y, ) def onIconChanged(self, widget, icon): if not icon: icon = ui.wcal_toolbar_mainMenu_icon_default self.iconSelect.set_filename(icon) ui.wcal_toolbar_mainMenu_icon = icon self.updateImage()
class EventsBulkEditDialog(gtk.Dialog): def __init__(self, container): from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry self._container = container gtk.Dialog.__init__(self) self.set_title(_('Bulk Edit Events')) #### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) #### try: title = container.title except AttributeError: event_count = len(container) msg = _('Here you are going to modify these %s events at once.' ) % event_count else: msg = _( 'Here you are going to modify all events inside group "%s" at once.' ) % title msg += ' ' msg += _( 'You better make a backup from your events before doing this. Just right click on group and select "Export" (or a full backup: menu File -> Export)' ) msg += '\n\n' label = gtk.Label(msg) label.set_line_wrap(True) pack(self.vbox, label) #### hbox = gtk.HBox() self.iconRadio = gtk.RadioButton(label=_('Icon')) pack(hbox, self.iconRadio, 1, 1) self.summaryRadio = gtk.RadioButton(label=_('Summary'), group=self.iconRadio) pack(hbox, self.summaryRadio, 1, 1) self.descriptionRadio = gtk.RadioButton(label=_('Description'), group=self.iconRadio) pack(hbox, self.descriptionRadio, 1, 1) self.timeZoneRadio = gtk.RadioButton(label=_('Time Zone'), group=self.iconRadio) pack(hbox, self.timeZoneRadio, 1, 1) pack(self.vbox, hbox) ### self.iconRadio.connect('clicked', self.firstRadioChanged) self.summaryRadio.connect('clicked', self.firstRadioChanged) self.descriptionRadio.connect('clicked', self.firstRadioChanged) self.timeZoneRadio.connect('clicked', self.firstRadioChanged) #### hbox = gtk.HBox() self.iconChangeCombo = gtk.combo_box_new_text() self.iconChangeCombo.append_text('----') self.iconChangeCombo.append_text(_('Change')) self.iconChangeCombo.append_text(_('Change if empty')) pack(hbox, self.iconChangeCombo) pack(hbox, gtk.Label(' ')) self.iconSelect = IconSelectButton() try: self.iconSelect.set_filename(container.icon) except AttributeError: pass pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) self.iconHbox = hbox #### self.textVbox = gtk.VBox() ### hbox = gtk.HBox() self.textChangeCombo = gtk.combo_box_new_text() self.textChangeCombo.append_text('----') self.textChangeCombo.append_text(_('Add to beginning')) self.textChangeCombo.append_text(_('Add to end')) self.textChangeCombo.append_text(_('Replace text')) self.textChangeCombo.connect('changed', self.textChangeComboChanged) pack(hbox, self.textChangeCombo) pack(hbox, gtk.Label(''), 1, 1) ## CheckButton(_('Regexp')) pack(self.textVbox, hbox) ### self.textInput1 = TextFrame() pack(self.textVbox, self.textInput1, 1, 1) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('with'))) pack(hbox, gtk.Label(''), 1, 1) pack(self.textVbox, hbox, 1, 1) self.withHbox = hbox ### self.textInput2 = TextFrame() pack(self.textVbox, self.textInput2, 1, 1) #### pack(self.vbox, self.textVbox, 1, 1) #### hbox = gtk.HBox() self.timeZoneChangeCombo = gtk.combo_box_new_text() self.timeZoneChangeCombo.append_text('----') self.timeZoneChangeCombo.append_text(_('Change')) self.timeZoneChangeCombo.append_text(_('Change if empty')) pack(hbox, self.timeZoneChangeCombo) pack(hbox, gtk.Label(' ')) self.timeZoneInput = TimeZoneComboBoxEntry() pack(hbox, self.timeZoneInput) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox, 1, 1) self.timeZoneHbox = hbox #### self.vbox.show_all() self.iconRadio.set_active(True) self.iconChangeCombo.set_active(0) self.textChangeCombo.set_active(0) self.firstRadioChanged() def firstRadioChanged(self, w=None): if self.iconRadio.get_active(): self.iconHbox.show() self.textVbox.hide() self.timeZoneHbox.hide() elif self.timeZoneRadio.get_active(): self.iconHbox.hide() self.textVbox.hide() self.timeZoneHbox.show() elif self.summaryRadio.get_active( ) or self.descriptionRadio.get_active(): self.iconHbox.hide() self.textChangeComboChanged() self.timeZoneHbox.hide() def textChangeComboChanged(self, w=None): self.textVbox.show_all() chType = self.textChangeCombo.get_active() if chType == 0: self.textInput1.hide() self.withHbox.hide() self.textInput2.hide() elif chType in (1, 2): self.withHbox.hide() self.textInput2.hide() def doAction(self): container = self._container if self.iconRadio.get_active(): chType = self.iconChangeCombo.get_active() if chType != 0: icon = self.iconSelect.get_filename() for event in container: if not (chType == 2 and event.icon): event.icon = icon event.afterModify() event.save() elif self.timeZoneRadio.get_active(): chType = self.timeZoneChangeCombo.get_active() timeZone = self.timeZoneInput.get_text() if chType != 0: try: natz.timezone(timeZone) except: myRaise('Invalid Time Zone "%s"' % timeZone) else: for event in container: if not (chType == 2 and event.timeZone): event.timeZone = timeZone event.afterModify() event.save() else: chType = self.textChangeCombo.get_active() if chType != 0: text1 = self.textInput1.get_text() text2 = self.textInput2.get_text() if self.summaryRadio.get_active(): for event in container: if chType == 1: event.summary = text1 + event.summary elif chType == 2: event.summary = event.summary + text1 elif chType == 3: event.summary = event.summary.replace(text1, text2) event.afterModify() event.save() elif self.descriptionRadio.get_active(): for event in container: if chType == 1: event.description = text1 + event.description elif chType == 2: event.description = event.description + text1 elif chType == 3: event.description = event.description.replace( text1, text2) event.afterModify() event.save()
def __init__(self, group): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo gtk.VBox.__init__(self) self.group = group ######## self.sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### hbox = gtk.HBox() label = gtk.Label(_('Title')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.titleEntry = gtk.Entry() pack(hbox, self.titleEntry, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Color')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.colorButton = MyColorButton() self.colorButton.set_use_alpha(True) ## FIXME pack(hbox, self.colorButton) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Default Icon')) ## FIXME label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Default Calendar Type')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) combo = CalTypeCombo() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Show in Calendar')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInDCalCheck = gtk.CheckButton(_('Day')) self.showInWCalCheck = gtk.CheckButton(_('Week')) self.showInMCalCheck = gtk.CheckButton(_('Month')) pack(hbox, self.showInDCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInWCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInMCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Show in')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInTimeLineCheck = gtk.CheckButton(_('Time Line')) self.showInStatusIconCheck = gtk.CheckButton(_('Status Icon')) pack(hbox, self.showInTimeLineCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInStatusIconCheck) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Event Cache Size')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.cacheSizeSpin = IntSpinButton(0, 9999) pack(hbox, self.cacheSizeSpin) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Event Text Seperator')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.sepInput = TextFrame() pack(hbox, self.sepInput, 1, 1) pack(self, hbox) set_tooltip( hbox, _('Using to seperate Summary and Description when displaying event' )) ##### #hbox = gtk.HBox() #label = gtk.Label(_('Show Full Event Description')) #label.set_alignment(0, 0.5) #pack(hbox, label) #self.sizeGroup.add_widget(label) #self.showFullEventDescCheck = gtk.CheckButton('') #pack(hbox, self.showFullEventDescCheck, 1, 1) #pack(self, hbox) ### self.modeCombo.connect( 'changed', self.modeComboChanged) ## right place? before updateWidget? FIXME
def __init__(self, group): self._group = group gtk.Dialog.__init__(self) self.set_title(_('Bulk Edit Events')) #### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) #### label = gtk.Label(_('Here you are going to modify all events inside group "%s" at once. You better make a backup from you events before doing this. Just right click on group and select "Export" (or a full backup: menu File -> Export)')%group.title+'\n\n') label.set_line_wrap(True) pack(self.vbox, label) #### hbox = gtk.HBox() self.iconRadio = gtk.RadioButton(label=_('Icon')) pack(hbox, self.iconRadio, 1, 1) self.summaryRadio = gtk.RadioButton(label=_('Summary'), group=self.iconRadio) pack(hbox, self.summaryRadio, 1, 1) self.descriptionRadio = gtk.RadioButton(label=_('Description'), group=self.iconRadio) pack(hbox, self.descriptionRadio, 1, 1) self.timeZoneRadio = gtk.RadioButton(label=_('Time Zone'), group=self.iconRadio) pack(hbox, self.timeZoneRadio, 1, 1) pack(self.vbox, hbox) ### self.iconRadio.connect('clicked', self.firstRadioChanged) self.summaryRadio.connect('clicked', self.firstRadioChanged) self.descriptionRadio.connect('clicked', self.firstRadioChanged) self.timeZoneRadio.connect('clicked', self.firstRadioChanged) #### hbox = gtk.HBox() self.iconChangeCombo = gtk.combo_box_new_text() self.iconChangeCombo.append_text('----') self.iconChangeCombo.append_text(_('Change')) self.iconChangeCombo.append_text(_('Change if empty')) pack(hbox, self.iconChangeCombo) pack(hbox, gtk.Label(' ')) self.iconSelect = IconSelectButton() self.iconSelect.set_filename(group.icon) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) self.iconHbox = hbox #### self.textVbox = gtk.VBox() ### hbox = gtk.HBox() self.textChangeCombo = gtk.combo_box_new_text() self.textChangeCombo.append_text('----') self.textChangeCombo.append_text(_('Add to beginning')) self.textChangeCombo.append_text(_('Add to end')) self.textChangeCombo.append_text(_('Replace text')) self.textChangeCombo.connect('changed', self.textChangeComboChanged) pack(hbox, self.textChangeCombo) pack(hbox, gtk.Label(''), 1, 1) ## CheckButton(_('Regexp')) pack(self.textVbox, hbox) ### self.textInput1 = TextFrame() pack(self.textVbox, self.textInput1, 1, 1) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('with'))) pack(hbox, gtk.Label(''), 1, 1) pack(self.textVbox, hbox, 1, 1) self.withHbox = hbox ### self.textInput2 = TextFrame() pack(self.textVbox, self.textInput2, 1, 1) #### pack(self.vbox, self.textVbox, 1, 1) #### hbox = gtk.HBox() self.timeZoneChangeCombo = gtk.combo_box_new_text() self.timeZoneChangeCombo.append_text('----') self.timeZoneChangeCombo.append_text(_('Change')) self.timeZoneChangeCombo.append_text(_('Change if empty')) pack(hbox, self.timeZoneChangeCombo) pack(hbox, gtk.Label(' ')) self.timeZoneInput = TimeZoneComboBoxEntry() pack(hbox, self.timeZoneInput) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox, 1, 1) self.timeZoneHbox = hbox #### self.vbox.show_all() self.iconRadio.set_active(True) self.iconChangeCombo.set_active(0) self.textChangeCombo.set_active(0) self.firstRadioChanged()
class GroupBulkEditDialog(gtk.Dialog): def __init__(self, group): self._group = group gtk.Dialog.__init__(self) self.set_title(_('Bulk Edit Events')) #### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) #### label = gtk.Label(_('Here you are going to modify all events inside group "%s" at once. You better make a backup from you events before doing this. Just right click on group and select "Export" (or a full backup: menu File -> Export)')%group.title+'\n\n') label.set_line_wrap(True) pack(self.vbox, label) #### hbox = gtk.HBox() self.iconRadio = gtk.RadioButton(label=_('Icon')) pack(hbox, self.iconRadio, 1, 1) self.summaryRadio = gtk.RadioButton(label=_('Summary'), group=self.iconRadio) pack(hbox, self.summaryRadio, 1, 1) self.descriptionRadio = gtk.RadioButton(label=_('Description'), group=self.iconRadio) pack(hbox, self.descriptionRadio, 1, 1) self.timeZoneRadio = gtk.RadioButton(label=_('Time Zone'), group=self.iconRadio) pack(hbox, self.timeZoneRadio, 1, 1) pack(self.vbox, hbox) ### self.iconRadio.connect('clicked', self.firstRadioChanged) self.summaryRadio.connect('clicked', self.firstRadioChanged) self.descriptionRadio.connect('clicked', self.firstRadioChanged) self.timeZoneRadio.connect('clicked', self.firstRadioChanged) #### hbox = gtk.HBox() self.iconChangeCombo = gtk.combo_box_new_text() self.iconChangeCombo.append_text('----') self.iconChangeCombo.append_text(_('Change')) self.iconChangeCombo.append_text(_('Change if empty')) pack(hbox, self.iconChangeCombo) pack(hbox, gtk.Label(' ')) self.iconSelect = IconSelectButton() self.iconSelect.set_filename(group.icon) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) self.iconHbox = hbox #### self.textVbox = gtk.VBox() ### hbox = gtk.HBox() self.textChangeCombo = gtk.combo_box_new_text() self.textChangeCombo.append_text('----') self.textChangeCombo.append_text(_('Add to beginning')) self.textChangeCombo.append_text(_('Add to end')) self.textChangeCombo.append_text(_('Replace text')) self.textChangeCombo.connect('changed', self.textChangeComboChanged) pack(hbox, self.textChangeCombo) pack(hbox, gtk.Label(''), 1, 1) ## CheckButton(_('Regexp')) pack(self.textVbox, hbox) ### self.textInput1 = TextFrame() pack(self.textVbox, self.textInput1, 1, 1) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('with'))) pack(hbox, gtk.Label(''), 1, 1) pack(self.textVbox, hbox, 1, 1) self.withHbox = hbox ### self.textInput2 = TextFrame() pack(self.textVbox, self.textInput2, 1, 1) #### pack(self.vbox, self.textVbox, 1, 1) #### hbox = gtk.HBox() self.timeZoneChangeCombo = gtk.combo_box_new_text() self.timeZoneChangeCombo.append_text('----') self.timeZoneChangeCombo.append_text(_('Change')) self.timeZoneChangeCombo.append_text(_('Change if empty')) pack(hbox, self.timeZoneChangeCombo) pack(hbox, gtk.Label(' ')) self.timeZoneInput = TimeZoneComboBoxEntry() pack(hbox, self.timeZoneInput) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox, 1, 1) self.timeZoneHbox = hbox #### self.vbox.show_all() self.iconRadio.set_active(True) self.iconChangeCombo.set_active(0) self.textChangeCombo.set_active(0) self.firstRadioChanged() def firstRadioChanged(self, w=None): if self.iconRadio.get_active(): self.iconHbox.show() self.textVbox.hide() self.timeZoneHbox.hide() elif self.timeZoneRadio.get_active(): self.iconHbox.hide() self.textVbox.hide() self.timeZoneHbox.show() elif self.summaryRadio.get_active() or self.descriptionRadio.get_active(): self.iconHbox.hide() self.textChangeComboChanged() self.timeZoneHbox.hide() def textChangeComboChanged(self, w=None): self.textVbox.show_all() chType = self.textChangeCombo.get_active() if chType==0: self.textInput1.hide() self.withHbox.hide() self.textInput2.hide() elif chType in (1, 2): self.withHbox.hide() self.textInput2.hide() def doAction(self): group = self._group if self.iconRadio.get_active(): chType = self.iconChangeCombo.get_active() if chType!=0: icon = self.iconSelect.get_filename() for event in group: if not (chType==2 and event.icon): event.icon = icon event.afterModify() event.save() elif self.timeZoneRadio.get_active(): chType = self.timeZoneChangeCombo.get_active() timeZone = self.timeZoneInput.get_text() if chType!=0: try: pytz.timezone(timeZone) except: myRaise('Invalid Time Zone "%s"'%timeZone) else: for event in group: if not (chType==2 and event.timeZone): event.timeZone = timeZone event.afterModify() event.save() else: chType = self.textChangeCombo.get_active() if chType!=0: text1 = self.textInput1.get_text() text2 = self.textInput2.get_text() if self.summaryRadio.get_active(): for event in group: if chType==1: event.summary = text1 + event.summary elif chType==2: event.summary = event.summary + text1 elif chType==3: event.summary = event.summary.replace(text1, text2) event.afterModify() event.save() elif self.descriptionRadio.get_active(): for event in group: if chType==1: event.description = text1 + event.description elif chType==2: event.description = event.description + text1 elif chType==3: event.description = event.description.replace(text1, text2) event.afterModify() event.save()
def __init__(self, event):## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == 'universityTerm' ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError('No courses added') self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) #combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_('Course')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Date')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.dateInput = DateButton() pack(hbox, self.dateInput) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Time')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButton() self.dayTimeEndCombo = HourMinuteButton() ## #self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) #self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(' ' + _('to') + ' ')) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### #hbox = gtk.HBox() #label = gtk.Label(_('Summary')) #label.set_alignment(0, 0.5) #sizeGroup.add_widget(label) #pack(hbox, label) #self.summaryEntry = gtk.Entry() #pack(hbox, self.summaryEntry, 1, 1) #pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Description')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Icon')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() #print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### #self.filesBox = common.FilesBox(self.event) #pack(self, self.filesBox) ###### self.courseCombo.set_active(0)
class WidgetClass(gtk.VBox): def __init__(self, event):## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == 'universityTerm' ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError('No courses added') self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) #combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_('Course')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Date')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.dateInput = DateButton() pack(hbox, self.dateInput) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Time')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButton() self.dayTimeEndCombo = HourMinuteButton() ## #self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) #self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(' ' + _('to') + ' ')) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### #hbox = gtk.HBox() #label = gtk.Label(_('Summary')) #label.set_alignment(0, 0.5) #sizeGroup.add_widget(label) #pack(hbox, label) #self.summaryEntry = gtk.Entry() #pack(hbox, self.summaryEntry, 1, 1) #pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Description')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Icon')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() #print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### #self.filesBox = common.FilesBox(self.event) #pack(self, self.filesBox) ###### self.courseCombo.set_active(0) #self.updateSummary() def focusSummary(self): pass #def updateSummary(self, widget=None): # courseIndex = self.courseCombo.get_active() # summary = _('%s Exam')%self.courseNames[courseIndex] # self.summaryEntry.set_text(summary) # self.event.summary = summary def updateWidget(self):## FIXME if self.event.courseId is None: pass else: self.courseCombo.set_active(self.courseIds.index(self.event.courseId)) ## self.dateInput.set_value(self.event.getDate()) ## timeRangeRule = self.event['dayTimeRange'] self.dayTimeStartCombo.set_value(timeRangeRule.dayTimeStart) self.dayTimeEndCombo.set_value(timeRangeRule.dayTimeEnd) #### #self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) #### self.notificationBox.updateWidget() #### #self.filesBox.updateWidget() def updateVars(self):## FIXME courseIndex = self.courseCombo.get_active() if courseIndex is None: showError(_('No course is selected'), self) raise RuntimeError('No courses is selected') else: self.event.courseId = self.courseIds[courseIndex] ## self.event.setDate(*tuple(self.dateInput.get_value())) ## self.event['dayTimeRange'].setRange( self.dayTimeStartCombo.get_value(), self.dayTimeEndCombo.get_value(), ) #### #self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() #### self.notificationBox.updateVars() self.event.updateSummary() def modeComboChanged(self, obj=None):## overwrite method from common.WidgetClass newMode = self.modeCombo.get_active() self.dateInput.changeMode(self.event.mode, newMode) self.event.mode = newMode
class EventTagsAndIconSelect(gtk.HBox): def __init__(self): gtk.HBox.__init__(self) ######### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Category')+':')) ##### ls = gtk.ListStore(gdk.Pixbuf, str) combo = gtk.ComboBox(ls) ### cell = gtk.CellRendererPixbuf() pack(combo, cell, False) combo.add_attribute(cell, 'pixbuf', 0) ### cell = gtk.CellRendererText() pack(combo, cell, True) combo.add_attribute(cell, 'text', 1) ### ls.append([None, _('Custom')])## first or last FIXME for item in ui.eventTags: ls.append([ gdk.pixbuf_new_from_file(item.icon) if item.icon else None, item.desc ]) ### self.customItemIndex = 0 ## len(ls)-1 pack(hbox, combo) self.typeCombo = combo self.typeStore = ls ### vbox = gtk.VBox() pack(vbox, hbox) pack(self, vbox) ######### iconLabel = gtk.Label(_('Icon')) pack(hbox, iconLabel) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) tagsLabel = gtk.Label(_('Tags')) pack(hbox, tagsLabel) hbox3 = gtk.HBox() self.tagButtons = [] for item in ui.eventTags: button = gtk.ToggleButton(item.desc) button.tagName = item.name self.tagButtons.append(button) pack(hbox3, button) self.swin = gtk.ScrolledWindow() self.swin.set_policy(gtk.POLICY_ALWAYS, gtk.POLICY_NEVER)## horizontal AUTOMATIC or ALWAYS FIXME self.swin.add_with_viewport(hbox3) pack(self, self.swin, 1, 1) self.customTypeWidgets = (iconLabel, self.iconSelect, tagsLabel, self.swin) ######### self.typeCombo.connect('changed', self.typeComboChanged) self.connect('scroll-event', self.scrollEvent) ######### self.show_all() hideList(self.customTypeWidgets) def scrollEvent(self, widget, event): self.swin.get_hscrollbar().emit('scroll-event', event) def typeComboChanged(self, combo): i = combo.get_active() if i is None: return if i == self.customItemIndex: showList(self.customTypeWidgets) else: hideList(self.customTypeWidgets) def getData(self): active = self.typeCombo.get_active() if active in (-1, None): icon = '' tags = [] else: if active == self.customItemIndex: icon = self.iconSelect.get_filename() tags = [button.tagName for button in self.tagButtons if button.get_active()] else: item = ui.eventTags[active] icon = item.icon tags = [item.name] return { 'icon': icon, 'tags': tags, }
def __init__(self, group): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo gtk.VBox.__init__(self) self.group = group ######## self.sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### hbox = gtk.HBox() label = gtk.Label(_('Title')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.titleEntry = gtk.Entry() pack(hbox, self.titleEntry, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Color')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.colorButton = MyColorButton() self.colorButton.set_use_alpha(True) ## FIXME pack(hbox, self.colorButton) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Default Icon'))## FIXME label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Default Calendar Type')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) combo = CalTypeCombo() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Show in Calendar')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInDCalCheck = gtk.CheckButton(_('Day')) self.showInWCalCheck = gtk.CheckButton(_('Week')) self.showInMCalCheck = gtk.CheckButton(_('Month')) pack(hbox, self.showInDCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInWCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInMCalCheck) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Show in')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInTimeLineCheck = gtk.CheckButton(_('Time Line')) self.showInStatusIconCheck = gtk.CheckButton(_('Status Icon')) pack(hbox, self.showInTimeLineCheck) pack(hbox, gtk.Label(''), 1, 1) pack(hbox, self.showInStatusIconCheck) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Event Cache Size')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.cacheSizeSpin = IntSpinButton(0, 9999) pack(hbox, self.cacheSizeSpin) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Event Text Seperator')) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.sepInput = TextFrame() pack(hbox, self.sepInput, 1, 1) pack(self, hbox) set_tooltip(hbox, _('Using to seperate Summary and Description when displaying event')) ##### #hbox = gtk.HBox() #label = gtk.Label(_('Show Full Event Description')) #label.set_alignment(0, 0.5) #pack(hbox, label) #self.sizeGroup.add_widget(label) #self.showFullEventDescCheck = gtk.CheckButton('') #pack(hbox, self.showFullEventDescCheck, 1, 1) #pack(self, hbox) ### self.modeCombo.connect('changed', self.modeComboChanged)## right place? before updateWidget? FIXME
class EventWidget(gtk.VBox): def __init__(self, event):## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == 'universityTerm' ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError('No courses added') self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) #combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_('Course')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Week')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.weekNumModeCombo = WeekNumModeRuleWidget(event['weekNumMode']) pack(hbox, self.weekNumModeCombo) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Week Day')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.weekDayCombo = WeekDayComboBox() #self.weekDayCombo.connect('changed', self.updateSummary) pack(hbox, self.weekDayCombo) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Time')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButtonOption() self.dayTimeEndCombo = HourMinuteButtonOption() ## #self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) #self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(' ' + _('to') + ' ')) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### #hbox = gtk.HBox() #label = gtk.Label(_('Summary')) #label.set_alignment(0, 0.5) #sizeGroup.add_widget(label) #pack(hbox, label) #self.summaryEntry = gtk.Entry() #pack(hbox, self.summaryEntry, 1, 1) #pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Description')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Icon')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() #print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### #self.filesBox = common.FilesBox(self.event) #pack(self, self.filesBox) ###### self.courseCombo.set_active(0) #self.updateSummary() def focusSummary(self): pass #def updateSummary(self, widget=None): # courseIndex = self.courseCombo.get_active() # summary = _('%s Class')%self.courseNames[courseIndex] + ' (' + self.weekDayCombo.get_active_text() + ')' # self.summaryEntry.set_text(summary) # self.event.summary = summary def updateWidget(self):## FIXME if self.event.courseId is None: pass else: self.courseCombo.set_active(self.courseIds.index(self.event.courseId)) ## self.weekNumModeCombo.updateWidget() weekDayList = self.event['weekDay'].weekDayList if len(weekDayList)==1: self.weekDayCombo.setValue(weekDayList[0])## FIXME else: self.weekDayCombo.set_active(0) ## self.dayTimeStartCombo.clear_history() self.dayTimeEndCombo.clear_history() for hm in reversed(self.event.parent.classTimeBounds): for combo in (self.dayTimeStartCombo, self.dayTimeEndCombo): combo.set_value(hm) combo.add_history() timeRangeRule = self.event['dayTimeRange'] self.dayTimeStartCombo.set_value(timeRangeRule.dayTimeStart) self.dayTimeEndCombo.set_value(timeRangeRule.dayTimeEnd) #### #self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) #### self.notificationBox.updateWidget() #### #self.filesBox.updateWidget() def updateVars(self):## FIXME courseIndex = self.courseCombo.get_active() if courseIndex is None: showError(_('No course is selected'), self) raise RuntimeError('No courses is selected') else: self.event.courseId = self.courseIds[courseIndex] ## self.weekNumModeCombo.updateVars() self.event['weekDay'].weekDayList = [self.weekDayCombo.getValue()]## FIXME ## self.event['dayTimeRange'].setRange( self.dayTimeStartCombo.get_value(), self.dayTimeEndCombo.get_value(), ) #### #self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() #### self.notificationBox.updateVars() self.event.updateSummary()
class WidgetClass(gtk.VBox): def __init__(self, event):## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == 'universityTerm' ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError('No courses added') self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) #combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_('Course')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Week')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.weekNumModeCombo = WeekNumModeWidgetClass(event['weekNumMode']) pack(hbox, self.weekNumModeCombo) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Week Day')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.weekDayCombo = WeekDayComboBox() #self.weekDayCombo.connect('changed', self.updateSummary) pack(hbox, self.weekDayCombo) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Time')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButtonOption() self.dayTimeEndCombo = HourMinuteButtonOption() ## #self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) #self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(' ' + _('to') + ' ')) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### #hbox = gtk.HBox() #label = gtk.Label(_('Summary')) #label.set_alignment(0, 0.5) #sizeGroup.add_widget(label) #pack(hbox, label) #self.summaryEntry = gtk.Entry() #pack(hbox, self.summaryEntry, 1, 1) #pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Description')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_('Icon')) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() #print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### #self.filesBox = common.FilesBox(self.event) #pack(self, self.filesBox) ###### self.courseCombo.set_active(0) #self.updateSummary() def focusSummary(self): pass #def updateSummary(self, widget=None): # courseIndex = self.courseCombo.get_active() # summary = _('%s Class')%self.courseNames[courseIndex] + ' (' + self.weekDayCombo.get_active_text() + ')' # self.summaryEntry.set_text(summary) # self.event.summary = summary def updateWidget(self):## FIXME if self.event.courseId is None: pass else: self.courseCombo.set_active(self.courseIds.index(self.event.courseId)) ## self.weekNumModeCombo.updateWidget() weekDayList = self.event['weekDay'].weekDayList if len(weekDayList)==1: self.weekDayCombo.setValue(weekDayList[0])## FIXME else: self.weekDayCombo.set_active(0) ## self.dayTimeStartCombo.clear_history() self.dayTimeEndCombo.clear_history() for hm in reversed(self.event.parent.classTimeBounds): for combo in (self.dayTimeStartCombo, self.dayTimeEndCombo): combo.set_value(hm) combo.add_history() timeRangeRule = self.event['dayTimeRange'] self.dayTimeStartCombo.set_value(timeRangeRule.dayTimeStart) self.dayTimeEndCombo.set_value(timeRangeRule.dayTimeEnd) #### #self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) #### self.notificationBox.updateWidget() #### #self.filesBox.updateWidget() def updateVars(self):## FIXME courseIndex = self.courseCombo.get_active() if courseIndex is None: showError(_('No course is selected'), self) raise RuntimeError('No courses is selected') else: self.event.courseId = self.courseIds[courseIndex] ## self.weekNumModeCombo.updateVars() self.event['weekDay'].weekDayList = [self.weekDayCombo.getValue()]## FIXME ## self.event['dayTimeRange'].setRange( self.dayTimeStartCombo.get_value(), self.dayTimeEndCombo.get_value(), ) #### #self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() #### self.notificationBox.updateVars() self.event.updateSummary()
class WidgetClass(gtk.VBox): def __init__(self, event): ## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == "universityTerm" ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError("No courses added") self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) # combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_("Course")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Date")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.dateInput = DateButton() pack(hbox, self.dateInput) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Time")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButton() self.dayTimeEndCombo = HourMinuteButton() ## # self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) # self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(" " + _("to") + " ")) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### # hbox = gtk.HBox() # label = gtk.Label(_('Summary')) # label.set_alignment(0, 0.5) # sizeGroup.add_widget(label) # pack(hbox, label) # self.summaryEntry = gtk.Entry() # pack(hbox, self.summaryEntry, 1, 1) # pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Description")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Icon")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() # print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(""), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### # self.filesBox = common.FilesBox(self.event) # pack(self, self.filesBox) ###### self.courseCombo.set_active(0) # self.updateSummary() def focusSummary(self): pass # def updateSummary(self, widget=None): # courseIndex = self.courseCombo.get_active() # summary = _('%s Exam')%self.courseNames[courseIndex] # self.summaryEntry.set_text(summary) # self.event.summary = summary def updateWidget(self): ## FIXME if self.event.courseId is None: pass else: self.courseCombo.set_active(self.courseIds.index(self.event.courseId)) ## self.dateInput.set_value(self.event.getDate()) ## timeRangeRule = self.event["dayTimeRange"] self.dayTimeStartCombo.set_value(timeRangeRule.dayTimeStart) self.dayTimeEndCombo.set_value(timeRangeRule.dayTimeEnd) #### # self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) #### self.notificationBox.updateWidget() #### # self.filesBox.updateWidget() def updateVars(self): ## FIXME courseIndex = self.courseCombo.get_active() if courseIndex is None: showError(_("No course is selected"), self) raise RuntimeError("No courses is selected") else: self.event.courseId = self.courseIds[courseIndex] ## self.event.setDate(*tuple(self.dateInput.get_value())) ## self.event["dayTimeRange"].setRange(self.dayTimeStartCombo.get_value(), self.dayTimeEndCombo.get_value()) #### # self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() #### self.notificationBox.updateVars() self.event.updateSummary() def modeComboChanged(self, obj=None): ## overwrite method from common.WidgetClass newMode = self.modeCombo.get_active() self.dateInput.changeMode(self.event.mode, newMode) self.event.mode = newMode
def __init__(self, container): from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry self._container = container gtk.Dialog.__init__(self) self.set_title(_('Bulk Edit Events')) #### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) #### try: title = container.title except AttributeError: event_count = len(container) msg = _('Here you are going to modify these %s events at once.' ) % event_count else: msg = _( 'Here you are going to modify all events inside group "%s" at once.' ) % title msg += ' ' msg += _( 'You better make a backup from your events before doing this. Just right click on group and select "Export" (or a full backup: menu File -> Export)' ) msg += '\n\n' label = gtk.Label(msg) label.set_line_wrap(True) pack(self.vbox, label) #### hbox = gtk.HBox() self.iconRadio = gtk.RadioButton(label=_('Icon')) pack(hbox, self.iconRadio, 1, 1) self.summaryRadio = gtk.RadioButton(label=_('Summary'), group=self.iconRadio) pack(hbox, self.summaryRadio, 1, 1) self.descriptionRadio = gtk.RadioButton(label=_('Description'), group=self.iconRadio) pack(hbox, self.descriptionRadio, 1, 1) self.timeZoneRadio = gtk.RadioButton(label=_('Time Zone'), group=self.iconRadio) pack(hbox, self.timeZoneRadio, 1, 1) pack(self.vbox, hbox) ### self.iconRadio.connect('clicked', self.firstRadioChanged) self.summaryRadio.connect('clicked', self.firstRadioChanged) self.descriptionRadio.connect('clicked', self.firstRadioChanged) self.timeZoneRadio.connect('clicked', self.firstRadioChanged) #### hbox = gtk.HBox() self.iconChangeCombo = gtk.combo_box_new_text() self.iconChangeCombo.append_text('----') self.iconChangeCombo.append_text(_('Change')) self.iconChangeCombo.append_text(_('Change if empty')) pack(hbox, self.iconChangeCombo) pack(hbox, gtk.Label(' ')) self.iconSelect = IconSelectButton() try: self.iconSelect.set_filename(container.icon) except AttributeError: pass pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) self.iconHbox = hbox #### self.textVbox = gtk.VBox() ### hbox = gtk.HBox() self.textChangeCombo = gtk.combo_box_new_text() self.textChangeCombo.append_text('----') self.textChangeCombo.append_text(_('Add to beginning')) self.textChangeCombo.append_text(_('Add to end')) self.textChangeCombo.append_text(_('Replace text')) self.textChangeCombo.connect('changed', self.textChangeComboChanged) pack(hbox, self.textChangeCombo) pack(hbox, gtk.Label(''), 1, 1) ## CheckButton(_('Regexp')) pack(self.textVbox, hbox) ### self.textInput1 = TextFrame() pack(self.textVbox, self.textInput1, 1, 1) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('with'))) pack(hbox, gtk.Label(''), 1, 1) pack(self.textVbox, hbox, 1, 1) self.withHbox = hbox ### self.textInput2 = TextFrame() pack(self.textVbox, self.textInput2, 1, 1) #### pack(self.vbox, self.textVbox, 1, 1) #### hbox = gtk.HBox() self.timeZoneChangeCombo = gtk.combo_box_new_text() self.timeZoneChangeCombo.append_text('----') self.timeZoneChangeCombo.append_text(_('Change')) self.timeZoneChangeCombo.append_text(_('Change if empty')) pack(hbox, self.timeZoneChangeCombo) pack(hbox, gtk.Label(' ')) self.timeZoneInput = TimeZoneComboBoxEntry() pack(hbox, self.timeZoneInput) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox, 1, 1) self.timeZoneHbox = hbox #### self.vbox.show_all() self.iconRadio.set_active(True) self.iconChangeCombo.set_active(0) self.textChangeCombo.set_active(0) self.firstRadioChanged()
class WidgetClass(gtk.VBox): def __init__(self, event): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry gtk.VBox.__init__(self) self.event = event ########### hbox = gtk.HBox() ### pack(hbox, gtk.Label(_('Calendar Type'))) combo = CalTypeCombo() combo.set_active(calTypes.primary)## overwritten in updateWidget() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo ### pack(self, hbox) ########### if event.isAllDay: self.tzCheck = None else: hbox = gtk.HBox() self.tzCheck = gtk.CheckButton(_('Time Zone')) set_tooltip(self.tzCheck, _('For input times of event')) pack(hbox, self.tzCheck) combo = TimeZoneComboBoxEntry() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.tzCombo = combo pack(self, hbox) self.tzCheck.connect('clicked', lambda check: self.tzCombo.set_sensitive(check.get_active())) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Summary'))) self.summaryEntry = gtk.Entry() pack(hbox, self.summaryEntry, 1, 1) pack(self, hbox) ########### self.descriptionInput = TextFrame() swin = gtk.ScrolledWindow() swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swin.add_with_viewport(self.descriptionInput) ### exp = gtk.Expander() exp.set_expanded(True) exp.set_label(_('Description')) exp.add(swin) pack(self, exp, 1, 1) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon')+':')) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ########## self.modeCombo.connect('changed', self.modeComboChanged)## right place? before updateWidget? FIXME def focusSummary(self): self.summaryEntry.select_region(0, -1) self.summaryEntry.grab_focus() def updateWidget(self): #print('updateWidget', self.event.files) self.modeCombo.set_active(self.event.mode) if self.tzCheck: self.tzCheck.set_active(self.event.timeZoneEnable) self.tzCombo.set_sensitive(self.event.timeZoneEnable) self.tzCombo.set_text(self.event.timeZone) self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) ##### for attr in ('notificationBox', 'filesBox'): try: getattr(self, attr).updateWidget() except AttributeError: pass ##### self.modeComboChanged() def updateVars(self): self.event.mode = self.modeCombo.get_active() if self.tzCheck: self.event.timeZoneEnable = self.tzCheck.get_active() self.event.timeZone = self.tzCombo.get_text() else: self.event.timeZoneEnable = False ## FIXME self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() ##### for attr in ('notificationBox', 'filesBox'): try: getattr(self, attr).updateVars() except AttributeError: pass ##### def modeComboChanged(self, obj=None):## FIXME pass
def __init__(self, event): ## FIXME gtk.VBox.__init__(self) self.event = event assert event.parent.name == "universityTerm" ## FIXME sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### if not event.parent.courses: showError(event.parent.noCourseError) raise RuntimeError("No courses added") self.courseIds = [] self.courseNames = [] combo = gtk.combo_box_new_text() for course in event.parent.courses: self.courseIds.append(course[0]) self.courseNames.append(course[1]) combo.append_text(course[1]) # combo.connect('changed', self.updateSummary) self.courseCombo = combo ## hbox = gtk.HBox() label = gtk.Label(_("Course")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) pack(hbox, combo) ## pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Date")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.dateInput = DateButton() pack(hbox, self.dateInput) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Time")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) ## self.dayTimeStartCombo = HourMinuteButton() self.dayTimeEndCombo = HourMinuteButton() ## # self.dayTimeStartCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) # self.dayTimeEndCombo.get_child().set_direction(gtk.TEXT_DIR_LTR) ## pack(hbox, self.dayTimeStartCombo) pack(hbox, gtk.Label(" " + _("to") + " ")) pack(hbox, self.dayTimeEndCombo) pack(self, hbox) ########### # hbox = gtk.HBox() # label = gtk.Label(_('Summary')) # label.set_alignment(0, 0.5) # sizeGroup.add_widget(label) # pack(hbox, label) # self.summaryEntry = gtk.Entry() # pack(hbox, self.summaryEntry, 1, 1) # pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Description")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.descriptionInput = TextFrame() pack(hbox, self.descriptionInput, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Icon")) label.set_alignment(0, 0.5) sizeGroup.add_widget(label) pack(hbox, label) self.iconSelect = IconSelectButton() # print(join(pixDir, self.icon)) pack(hbox, self.iconSelect) pack(hbox, gtk.Label(""), 1, 1) pack(self, hbox) ###### self.notificationBox = common.NotificationBox(event) pack(self, self.notificationBox) ###### # self.filesBox = common.FilesBox(self.event) # pack(self, self.filesBox) ###### self.courseCombo.set_active(0)
def __init__(self, container): from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry self._container = container gtk.Dialog.__init__(self) self.set_title(_('Bulk Edit Events')) #### dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.RESPONSE_CANCEL) dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.RESPONSE_OK) ## self.connect('response', lambda w, e: self.hide()) #### try: title = container.title except AttributeError: event_count = len(container) msg = _('Here you are going to modify these %s events at once.'%event_count) else: msg = _('Here you are going to modify all events inside group "%s" at once.'%title) msg += ' ' msg += _('You better make a backup from you events before doing this. Just right click on group and select "Export" (or a full backup: menu File -> Export)') msg += '\n\n' label = gtk.Label(msg) label.set_line_wrap(True) pack(self.vbox, label) #### hbox = gtk.HBox() self.iconRadio = gtk.RadioButton(label=_('Icon')) pack(hbox, self.iconRadio, 1, 1) self.summaryRadio = gtk.RadioButton(label=_('Summary'), group=self.iconRadio) pack(hbox, self.summaryRadio, 1, 1) self.descriptionRadio = gtk.RadioButton(label=_('Description'), group=self.iconRadio) pack(hbox, self.descriptionRadio, 1, 1) self.timeZoneRadio = gtk.RadioButton(label=_('Time Zone'), group=self.iconRadio) pack(hbox, self.timeZoneRadio, 1, 1) pack(self.vbox, hbox) ### self.iconRadio.connect('clicked', self.firstRadioChanged) self.summaryRadio.connect('clicked', self.firstRadioChanged) self.descriptionRadio.connect('clicked', self.firstRadioChanged) self.timeZoneRadio.connect('clicked', self.firstRadioChanged) #### hbox = gtk.HBox() self.iconChangeCombo = gtk.combo_box_new_text() self.iconChangeCombo.append_text('----') self.iconChangeCombo.append_text(_('Change')) self.iconChangeCombo.append_text(_('Change if empty')) pack(hbox, self.iconChangeCombo) pack(hbox, gtk.Label(' ')) self.iconSelect = IconSelectButton() try: self.iconSelect.set_filename(container.icon) except AttributeError: pass pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox) self.iconHbox = hbox #### self.textVbox = gtk.VBox() ### hbox = gtk.HBox() self.textChangeCombo = gtk.combo_box_new_text() self.textChangeCombo.append_text('----') self.textChangeCombo.append_text(_('Add to beginning')) self.textChangeCombo.append_text(_('Add to end')) self.textChangeCombo.append_text(_('Replace text')) self.textChangeCombo.connect('changed', self.textChangeComboChanged) pack(hbox, self.textChangeCombo) pack(hbox, gtk.Label(''), 1, 1) ## CheckButton(_('Regexp')) pack(self.textVbox, hbox) ### self.textInput1 = TextFrame() pack(self.textVbox, self.textInput1, 1, 1) ### hbox = gtk.HBox() pack(hbox, gtk.Label(_('with'))) pack(hbox, gtk.Label(''), 1, 1) pack(self.textVbox, hbox, 1, 1) self.withHbox = hbox ### self.textInput2 = TextFrame() pack(self.textVbox, self.textInput2, 1, 1) #### pack(self.vbox, self.textVbox, 1, 1) #### hbox = gtk.HBox() self.timeZoneChangeCombo = gtk.combo_box_new_text() self.timeZoneChangeCombo.append_text('----') self.timeZoneChangeCombo.append_text(_('Change')) self.timeZoneChangeCombo.append_text(_('Change if empty')) pack(hbox, self.timeZoneChangeCombo) pack(hbox, gtk.Label(' ')) self.timeZoneInput = TimeZoneComboBoxEntry() pack(hbox, self.timeZoneInput) pack(hbox, gtk.Label(''), 1, 1) pack(self.vbox, hbox, 1, 1) self.timeZoneHbox = hbox #### self.vbox.show_all() self.iconRadio.set_active(True) self.iconChangeCombo.set_active(0) self.textChangeCombo.set_active(0) self.firstRadioChanged()
def __init__(self, group): gtk.VBox.__init__(self) self.group = group ######## self.sizeGroup = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) ##### hbox = gtk.HBox() label = gtk.Label(_("Title")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.titleEntry = gtk.Entry() pack(hbox, self.titleEntry, 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Color")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.colorButton = MyColorButton() self.colorButton.set_use_alpha(True) ## FIXME pack(hbox, self.colorButton) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Default Icon")) ## FIXME label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Default Calendar Type")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) combo = CalTypeCombo() pack(hbox, combo) pack(hbox, gtk.Label(""), 1, 1) self.modeCombo = combo pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Show in Calendar")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInDCalCheck = gtk.CheckButton(_("Day")) self.showInWCalCheck = gtk.CheckButton(_("Week")) self.showInMCalCheck = gtk.CheckButton(_("Month")) pack(hbox, self.showInDCalCheck) pack(hbox, gtk.Label(""), 1, 1) pack(hbox, self.showInWCalCheck) pack(hbox, gtk.Label(""), 1, 1) pack(hbox, self.showInMCalCheck) pack(hbox, gtk.Label(""), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Show in")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.showInTimeLineCheck = gtk.CheckButton(_("Time Line")) self.showInTrayCheck = gtk.CheckButton(_("Tray")) pack(hbox, self.showInTimeLineCheck) pack(hbox, gtk.Label(""), 1, 1) pack(hbox, self.showInTrayCheck) pack(hbox, gtk.Label(""), 1, 1) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Event Cache Size")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.cacheSizeSpin = IntSpinButton(0, 9999) pack(hbox, self.cacheSizeSpin) pack(self, hbox) ##### hbox = gtk.HBox() label = gtk.Label(_("Event Text Seperator")) label.set_alignment(0, 0.5) pack(hbox, label) self.sizeGroup.add_widget(label) self.sepInput = TextFrame() pack(hbox, self.sepInput, 1, 1) pack(self, hbox) set_tooltip(hbox, _("Using to seperate Summary and Description when displaying event")) ##### # hbox = gtk.HBox() # label = gtk.Label(_('Show Full Event Description')) # label.set_alignment(0, 0.5) # pack(hbox, label) # self.sizeGroup.add_widget(label) # self.showFullEventDescCheck = gtk.CheckButton('') # pack(hbox, self.showFullEventDescCheck, 1, 1) # pack(self, hbox) ### self.modeCombo.connect("changed", self.modeComboChanged) ## right place? before updateWidget? FIXME
class WidgetClass(gtk.VBox): def __init__(self, event): from scal2.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo from scal2.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry gtk.VBox.__init__(self) self.event = event ########### hbox = gtk.HBox() ### pack(hbox, gtk.Label(_('Calendar Type'))) combo = CalTypeCombo() combo.set_active(calTypes.primary) ## overwritten in updateWidget() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.modeCombo = combo ### pack(self, hbox) ########### if event.isAllDay: self.tzCheck = None else: hbox = gtk.HBox() self.tzCheck = gtk.CheckButton(_('Time Zone')) set_tooltip(self.tzCheck, _('For input times of event')) pack(hbox, self.tzCheck) combo = TimeZoneComboBoxEntry() pack(hbox, combo) pack(hbox, gtk.Label(''), 1, 1) self.tzCombo = combo pack(self, hbox) self.tzCheck.connect( 'clicked', lambda check: self.tzCombo.set_sensitive(check.get_active())) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Summary'))) self.summaryEntry = gtk.Entry() pack(hbox, self.summaryEntry, 1, 1) pack(self, hbox) ########### self.descriptionInput = TextFrame() swin = gtk.ScrolledWindow() swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) swin.add_with_viewport(self.descriptionInput) ### exp = gtk.Expander() exp.set_expanded(True) exp.set_label(_('Description')) exp.add(swin) pack(self, exp, 1, 1) ########### hbox = gtk.HBox() pack(hbox, gtk.Label(_('Icon') + ':')) self.iconSelect = IconSelectButton() pack(hbox, self.iconSelect) pack(hbox, gtk.Label(''), 1, 1) pack(self, hbox) ########## self.modeCombo.connect( 'changed', self.modeComboChanged) ## right place? before updateWidget? FIXME def focusSummary(self): self.summaryEntry.select_region(0, -1) self.summaryEntry.grab_focus() def updateWidget(self): #print('updateWidget', self.event.files) self.modeCombo.set_active(self.event.mode) if self.tzCheck: self.tzCheck.set_active(self.event.timeZoneEnable) self.tzCombo.set_sensitive(self.event.timeZoneEnable) self.tzCombo.set_text(self.event.timeZone) self.summaryEntry.set_text(self.event.summary) self.descriptionInput.set_text(self.event.description) self.iconSelect.set_filename(self.event.icon) ##### for attr in ('notificationBox', 'filesBox'): try: getattr(self, attr).updateWidget() except AttributeError: pass ##### self.modeComboChanged() def updateVars(self): self.event.mode = self.modeCombo.get_active() if self.tzCheck: self.event.timeZoneEnable = self.tzCheck.get_active() self.event.timeZone = self.tzCombo.get_text() else: self.event.timeZoneEnable = False ## FIXME self.event.summary = self.summaryEntry.get_text() self.event.description = self.descriptionInput.get_text() self.event.icon = self.iconSelect.get_filename() ##### for attr in ('notificationBox', 'filesBox'): try: getattr(self, attr).updateVars() except AttributeError: pass ##### def modeComboChanged(self, obj=None): ## FIXME pass