Example #1
0
	def updateVars(self):## FIXME
		courseIndex = self.courseCombo.get_active()
		if courseIndex is None:
			showError(_("No course is selected"), ui.eventManDialog)
			raise RuntimeError("No courses is selected")
		else:
			self.event.courseId = self.courseIds[courseIndex]
		##
		self.weekNumModeCombo.updateVars()
		##
		weekDay, ok = self.event["weekDay"]
		if not ok:
			raise RuntimeError("no weekDay rule")
		weekDay.weekDayList = [self.weekDayCombo.getValue()]## FIXME
		##
		dayTimeRange, ok = self.event["dayTimeRange"]
		if not ok:
			raise RuntimeError("no dayTimeRange rule")
		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()
Example #2
0
 def updateVars(self):  ## FIXME
     courseIndex = self.courseCombo.get_active()
     if courseIndex is None:
         showError(_("No course is selected"), ui.eventManDialog)
         raise RuntimeError("No courses is selected")
     else:
         self.event.courseId = self.courseIds[courseIndex]
     ##
     self.weekNumModeCombo.updateVars()
     ##
     weekDay, ok = self.event["weekDay"]
     if not ok:
         raise RuntimeError("no weekDay rule")
     weekDay.weekDayList = [self.weekDayCombo.getValue()]  ## FIXME
     ##
     dayTimeRange, ok = self.event["dayTimeRange"]
     if not ok:
         raise RuntimeError("no dayTimeRange rule")
     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()
Example #3
0
	def checkEventToAdd(self, group, event):
		if not group.checkEventToAdd(event):
			showError(
				_('Group type "%s" can not contain event type "%s"')%(group.desc, event.desc),
				self,
			)
			raise RuntimeError('Invalid event type for this group')
Example #4
0
def checkEventsReadOnly(doException=True):
	if event_lib.readOnly:
		error = 'Events are Read-Only because they are locked by another StarCalendar 3.x process'
		showError(_(error))
		if doException:
			raise RuntimeError(error)
		return False
	return True
Example #5
0
def checkEventsReadOnly(doException=True):
    if event_lib.readOnly:
        error = 'Events are Read-Only because they are locked by another StarCalendar 3.x process'
        showError(_(error))
        if doException:
            raise RuntimeError(error)
        return False
    return True
Example #6
0
	def checkEventToAdd(self, group, event):
		if not group.checkEventToAdd(event):
			showError(
				_("Group type \"%s\" can not contain event type \"%s\"") % (
					group.desc,
					event.desc,
				),
				self,
			)
			raise RuntimeError("Invalid event type for this group")
Example #7
0
	def checkEventToAdd(self, group, event):
		if not group.checkEventToAdd(event):
			showError(
				_("Group type \"%s\" can not contain event type \"%s\"") % (
					group.desc,
					event.desc,
				),
				self,
			)
			raise RuntimeError("Invalid event type for this group")
Example #8
0
	def editGroupByPath(self, path):
		from scal3.ui_gtk.event.group.editor import GroupEditorDialog
		checkEventsReadOnly()  # FIXME
		group, = self.getObjsByPath(path)
		if group.name == "trash":
			self.editTrash()
		elif group.isReadOnly():
			showError(_(
				"Event group \"%s\" is synchronizing and read-only"
			) % group.title, parent=self)
		else:
			group = GroupEditorDialog(group, parent=self).run()
			if group is None:
				return
			groupIter = self.trees.get_iter(path)
			for i, value in enumerate(self.getGroupRow(group)):
				self.trees.set_value(groupIter, i, value)
			self.onGroupModify(group)
Example #9
0
	def editGroupByPath(self, path):
		from scal3.ui_gtk.event.group.editor import GroupEditorDialog
		checkEventsReadOnly()  # FIXME
		group, = self.getObjsByPath(path)
		if group.name == "trash":
			self.editTrash()
		elif group.isReadOnly():
			showError(_(
				"Event group \"%s\" is synchronizing and read-only"
			) % group.title, parent=self)
		else:
			group = GroupEditorDialog(group, parent=self).run()
			if group is None:
				return
			groupIter = self.trees.get_iter(path)
			for i, value in enumerate(self.getGroupRow(group)):
				self.trees.set_value(groupIter, i, value)
			self.onGroupModify(group)
Example #10
0
 def updateVars(self):  ## FIXME
     courseIndex = self.courseCombo.get_active()
     if courseIndex is None:
         showError(_('No course is selected'), ui.eventManDialog)
         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()
Example #11
0
 def updateVars(self):## FIXME
     courseIndex = self.courseCombo.get_active()
     if courseIndex is None:
         showError(_('No course is selected'), ui.eventManDialog)
         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()
Example #12
0
	def fetchClicked(self, obj=None):
		combo = self.combo
		account = combo.account
		if not account:
			self.msgLabel.set_label(_("No account selected"))
			return
		self.msgLabel.set_label(_("Fatching"))
		while gtk.events_pending():
			gtk.main_iteration_do(False)
		try:
			account.fetchGroups()
		except Exception as e:
			self.msgLabel.set_label(_("Error"))
			showError(
				_("Error in fetching remote groups") + "\n" + str(e),
				ui.eventManDialog,
			)
			return
		else:
			self.msgLabel.set_label("")
			account.save()
		self.combo.updateList()
Example #13
0
	def fetchClicked(self, obj=None):
		combo = self.combo
		account = combo.account
		if not account:
			self.msgLabel.set_label(_("No account selected"))
			return
		self.msgLabel.set_label(_("Fatching"))
		while gtk.events_pending():
			gtk.main_iteration_do(False)
		try:
			account.fetchGroups()
		except Exception as e:
			self.msgLabel.set_label(_("Error"))
			showError(
				_("Error in fetching remote groups") + "\n" + str(e),
				ui.eventManDialog,
			)
			return
		else:
			self.msgLabel.set_label("")
			account.save()
		self.combo.updateList()
Example #14
0
	def __init__(self, event):## FIXME
		gtk.VBox.__init__(self)
		self.event = event
		assert event.parent.name == "universityTerm" ## FIXME
		sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
		#####
		if not event.parent.courses:
			showError(event.parent.noCourseError, ui.eventManDialog)
			raise RuntimeError("No courses added")
		self.courseIds = []
		self.courseNames = []
		combo = gtk.ComboBoxText()
		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)
		weekNumModeRule, ok = event["weekNumMode"]
		if not ok:
			raise RuntimeError("no weekNumMode rule")
		self.weekNumModeCombo = WeekNumModeWidgetClass(weekNumModeRule)
		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.TextDirection.LTR)
		#self.dayTimeEndCombo.get_child().set_direction(gtk.TextDirection.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)
Example #15
0
 def __init__(self, event):  ## FIXME
     gtk.VBox.__init__(self)
     self.event = event
     assert event.parent.name == "universityTerm"  ## FIXME
     sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
     #####
     if not event.parent.courses:
         showError(event.parent.noCourseError, ui.eventManDialog)
         raise RuntimeError("No courses added")
     self.courseIds = []
     self.courseNames = []
     combo = gtk.ComboBoxText()
     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.TextDirection.LTR)
     #self.dayTimeEndCombo.get_child().set_direction(gtk.TextDirection.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)
Example #16
0
 def __init__(self, event):  ## FIXME
     gtk.VBox.__init__(self)
     self.event = event
     assert event.parent.name == 'universityTerm'  ## FIXME
     sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
     #####
     if not event.parent.courses:
         showError(event.parent.noCourseError, ui.eventManDialog)
         raise RuntimeError('No courses added')
     self.courseIds = []
     self.courseNames = []
     combo = gtk.ComboBoxText()
     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.TextDirection.LTR)
     #self.dayTimeEndCombo.get_child().set_direction(gtk.TextDirection.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)
Example #17
0
 def __init__(self, event):## FIXME
     gtk.VBox.__init__(self)
     self.event = event
     assert event.parent.name == 'universityTerm' ## FIXME
     sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.HORIZONTAL)
     #####
     if not event.parent.courses:
         showError(event.parent.noCourseError, ui.eventManDialog)
         raise RuntimeError('No courses added')
     self.courseIds = []
     self.courseNames = []
     combo = gtk.ComboBoxText()
     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.TextDirection.LTR)
     #self.dayTimeEndCombo.get_child().set_direction(gtk.TextDirection.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)