示例#1
0
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Select Date...'))
		#self.set_has_separator(False)
		#self.set_skip_taskbar_hint(True)
		self.connect('delete-event', self.hideMe)
		self.mode = calTypes.primary
		###### Reciving dropped day!
		self.drag_dest_set(
			gtk.DestDefaults.ALL,
			(),
			gdk.DragAction.COPY,
		)
		self.drag_dest_add_text_targets()
		self.connect('drag-data-received', self.dragRec)
		######
		hb0 = gtk.HBox(spacing=4)
		pack(hb0, gtk.Label(_('Date Mode')))
		combo = CalTypeCombo()
		combo.set_active(self.mode)
		pack(hb0, combo)
		pack(self.vbox, hb0)
		#######################
		hbox = gtk.HBox(spacing=5)
		rb1 = gtk.RadioButton.new_with_label(None, '')
		rb1.num = 1
		pack(hbox, rb1)
		self.ymdBox = YearMonthDayBox()
		pack(hbox, self.ymdBox)
		pack(self.vbox, hbox)
		########
		hb2 = gtk.HBox(spacing=4)
		pack(hb2, gtk.Label('yyyy/mm/dd'))
		dateInput = DateButtonOption(hist_size=16)
		pack(hb2, dateInput)
		rb2 = gtk.RadioButton.new_with_label_from_widget(rb1, '')
		rb2.num = 2
		#rb2.set_group([rb1])
		hb2i = gtk.HBox(spacing=5)
		pack(hb2i, rb2)
		pack(hb2i, hb2)
		pack(self.vbox, hb2i)
		#######
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 2, self.hideMe)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), 1, self.ok)
		#######
		self.comboMode = combo
		self.dateInput = dateInput
		self.radio1 = rb1
		self.radio2 = rb2
		self.hbox2 = hb2
		#######
		combo.connect ('changed', self.comboModeChanged)
		rb1.connect_after('clicked', self.radioChanged)
		rb2.connect_after('clicked', self.radioChanged)
		dateInput.connect('activate', self.ok)
		self.radioChanged()
		#######
		self.vbox.show_all()
		self.resize(1, 1)
示例#2
0
	def __init__(self, account=None, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Edit Account') if account else _('Add New Account'))
		###
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		##
		self.connect('response', lambda w, e: self.hide())
		#######
		self.account = account
		self.activeWidget = None
		#######
		hbox = gtk.HBox()
		combo = gtk.ComboBoxText()
		for cls in event_lib.classes.account:
			combo.append_text(cls.desc)
		pack(hbox, gtk.Label(_('Account Type')))
		pack(hbox, combo)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		####
		if self.account:
			self.isNew = False
			combo.set_active(event_lib.classes.account.names.index(self.account.name))
		else:
			self.isNew = True
			defaultAccountTypeIndex = 0
			combo.set_active(defaultAccountTypeIndex)
			self.account = event_lib.classes.account[defaultAccountTypeIndex]()
		self.activeWidget = None
		combo.connect('changed', self.typeChanged)
		self.comboType = combo
		self.vbox.show_all()
		self.typeChanged()
示例#3
0
 def __init__(self, group, **kwargs):
     self._group = group
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Sort Events'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ##
     self.connect('response', lambda w, e: self.hide())
     ####
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Sort events of group "%s"') % group.title))
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ###
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Based on') + ' '))
     self.sortByNames = []
     self.sortByCombo = gtk.ComboBoxText()
     sortByDefault, sortBys = group.getSortBys()
     for item in sortBys:
         self.sortByNames.append(item[0])
         self.sortByCombo.append_text(item[1])
     self.sortByCombo.set_active(
         self.sortByNames.index(sortByDefault))  ## FIXME
     pack(hbox, self.sortByCombo)
     self.reverseCheck = gtk.CheckButton(_('Descending'))
     pack(hbox, self.reverseCheck)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ####
     self.vbox.show_all()
示例#4
0
 def __init__(self, event, typeChangable=True, isNew=False, useSelectedDate=False, **kwargs):
     checkEventsReadOnly()
     gtk.Dialog.__init__(self, **kwargs)
     #self.set_transient_for(None)
     #self.set_type_hint(gdk.WindowTypeHint.NORMAL)
     self.isNew = isNew
     #self.connect('delete-event', lambda obj, e: self.destroy())
     #self.resize(800, 600)
     ###
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ###
     self.connect('response', lambda w, e: self.hide())
     ###
     self.activeWidget = None
     self._group = event.parent
     self.eventTypeOptions = list(self._group.acceptsEventTypes)
     ####
     if not event.name in self.eventTypeOptions:
         self.eventTypeOptions.append(event.name)
     eventTypeIndex = self.eventTypeOptions.index(event.name)
     ####
     self.event = event
     #######
     if isNew and not event.timeZone:
         event.timeZone = str(core.localTz)## why? FIXME
     #######
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(
         _('Group') + ': ' + self._group.title
     ))
     hbox.show_all()
     pack(self.vbox, hbox)
     #######
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Event Type')))
     if typeChangable:
         combo = gtk.ComboBoxText()
         for tmpEventType in self.eventTypeOptions:
             combo.append_text(event_lib.classes.event.byName[tmpEventType].desc)
         pack(hbox, combo)
         ####
         combo.set_active(eventTypeIndex)
         ####
         #self.activeWidget = makeWidget(event)
         combo.connect('changed', self.typeChanged)
         self.comboEventType = combo
     else:
         pack(hbox, gtk.Label(':  '+event.desc))
     pack(hbox, gtk.Label(''), 1, 1)
     hbox.show_all()
     pack(self.vbox, hbox)
     #####
     if useSelectedDate:
         self.event.setJd(ui.cell.jd)
     self.activeWidget = makeWidget(event)
     if self.isNew:
         self.activeWidget.focusSummary()
     pack(self.vbox, self.activeWidget, 1, 1)
     self.vbox.show()
示例#5
0
 def __init__(self, group=None, **kwargs):
     checkEventsReadOnly()
     gtk.Dialog.__init__(self, **kwargs)
     self.isNew = (group is None)
     self.set_title(_('Add New Group') if self.isNew else _('Edit Group'))
     #self.connect('delete-event', lambda obj, e: self.destroy())
     #self.resize(800, 600)
     ###
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     self.connect('response', lambda w, e: self.hide())
     #######
     self.activeWidget = None
     #######
     hbox = gtk.HBox()
     combo = gtk.ComboBoxText()
     for cls in event_lib.classes.group:
         combo.append_text(cls.desc)
     pack(hbox, gtk.Label(_('Group Type')))
     pack(hbox, combo)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ####
     if self.isNew:
         self._group = event_lib.classes.group[event_lib.defaultGroupTypeIndex]()
         combo.set_active(event_lib.defaultGroupTypeIndex)
     else:
         self._group = group
         combo.set_active(event_lib.classes.group.names.index(group.name))
     self.activeWidget = None
     combo.connect('changed', self.typeChanged)
     self.comboType = combo
     self.vbox.show_all()
     self.typeChanged()
示例#6
0
 def __init__(self, group, **kwargs):
     from scal3.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo
     self._group = group
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Convert Calendar Type'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ##
     self.connect('response', lambda w, e: self.hide())
     ####
     hbox = gtk.HBox()
     label = gtk.Label(
         _('This is going to convert calendar types of all events inside group \"%s\" to a specific type. This operation does not work for Yearly events and also some of Custom events. You have to edit those events manually to change calendar type.'
           ) % group.title)
     label.set_line_wrap(True)
     pack(hbox, label)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ###
     hbox = gtk.HBox()
     pack(hbox, gtk.Label(_('Calendar Type') + ':'))
     combo = CalTypeCombo()
     combo.set_active(group.mode)
     pack(hbox, combo)
     pack(hbox, gtk.Label(''), 1, 1)
     self.modeCombo = combo
     pack(self.vbox, hbox)
     ####
     self.vbox.show_all()
     window_set_size_aspect(self, 1.6)
示例#7
0
	def __init__(self, group=None, **kwargs):
		checkEventsReadOnly()
		gtk.Dialog.__init__(self, **kwargs)
		self.isNew = (group is None)
		self.set_title(_('Add New Group') if self.isNew else _('Edit Group'))
		#self.connect('delete-event', lambda obj, e: self.destroy())
		#self.resize(800, 600)
		###
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		self.connect('response', lambda w, e: self.hide())
		#######
		self.activeWidget = None
		#######
		hbox = gtk.HBox()
		combo = gtk.ComboBoxText()
		for cls in event_lib.classes.group:
			combo.append_text(cls.desc)
		pack(hbox, gtk.Label(_('Group Type')))
		pack(hbox, combo)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		####
		if self.isNew:
			self._group = event_lib.classes.group[event_lib.defaultGroupTypeIndex]()
			combo.set_active(event_lib.defaultGroupTypeIndex)
		else:
			self._group = group
			combo.set_active(event_lib.classes.group.names.index(group.name))
		self.activeWidget = None
		combo.connect('changed', self.typeChanged)
		self.comboType = combo
		self.vbox.show_all()
		self.typeChanged()
示例#8
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Select Date...'))
     #self.set_has_separator(False)
     #self.set_skip_taskbar_hint(True)
     self.connect('delete-event', self.hideMe)
     self.mode = calTypes.primary
     ###### Reciving dropped day!
     self.drag_dest_set(
         gtk.DestDefaults.ALL,
         (),
         gdk.DragAction.COPY,
     )
     self.drag_dest_add_text_targets()
     self.connect('drag-data-received', self.dragRec)
     ######
     hb0 = gtk.HBox(spacing=4)
     pack(hb0, gtk.Label(_('Date Mode')))
     combo = CalTypeCombo()
     combo.set_active(self.mode)
     pack(hb0, combo)
     pack(self.vbox, hb0)
     #######################
     hbox = gtk.HBox(spacing=5)
     rb1 = gtk.RadioButton.new_with_label(None, '')
     rb1.num = 1
     pack(hbox, rb1)
     self.ymdBox = YearMonthDayBox()
     pack(hbox, self.ymdBox)
     pack(self.vbox, hbox)
     ########
     hb2 = gtk.HBox(spacing=4)
     pack(hb2, gtk.Label('yyyy/mm/dd'))
     dateInput = DateButtonOption(hist_size=16)
     pack(hb2, dateInput)
     rb2 = gtk.RadioButton.new_with_label_from_widget(rb1, '')
     rb2.num = 2
     #rb2.set_group([rb1])
     hb2i = gtk.HBox(spacing=5)
     pack(hb2i, rb2)
     pack(hb2i, hb2)
     pack(self.vbox, hb2i)
     #######
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 2, self.hideMe)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), 1, self.ok)
     #######
     self.comboMode = combo
     self.dateInput = dateInput
     self.radio1 = rb1
     self.radio2 = rb2
     self.hbox2 = hb2
     #######
     combo.connect('changed', self.comboModeChanged)
     rb1.connect_after('clicked', self.radioChanged)
     rb2.connect_after('clicked', self.radioChanged)
     dateInput.connect('activate', self.ok)
     self.radioChanged()
     #######
     self.vbox.show_all()
     self.resize(1, 1)
示例#9
0
	def __init__(self, group, **kwargs):
		self._group = group
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Sort Events'))
		####
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		##
		self.connect('response', lambda w, e: self.hide())
		####
		hbox = gtk.HBox()
		pack(hbox, gtk.Label(_('Sort events of group "%s"')%group.title))
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		###
		hbox = gtk.HBox()
		pack(hbox, gtk.Label(_('Based on')+' '))
		self.sortByNames = []
		self.sortByCombo = gtk.ComboBoxText()
		sortByDefault, sortBys = group.getSortBys()
		for item in sortBys:
			self.sortByNames.append(item[0])
			self.sortByCombo.append_text(item[1])
		self.sortByCombo.set_active(self.sortByNames.index(sortByDefault))## FIXME
		pack(hbox, self.sortByCombo)
		self.reverseCheck = gtk.CheckButton(_('Descending'))
		pack(hbox, self.reverseCheck)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		####
		self.vbox.show_all()
示例#10
0
	def __init__(self, group, **kwargs):
		from scal3.ui_gtk.mywidgets.cal_type_combo import CalTypeCombo
		self._group = group
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Convert Calendar Type'))
		####
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		##
		self.connect('response', lambda w, e: self.hide())
		####
		hbox = gtk.HBox()
		label = gtk.Label(_('This is going to convert calendar types of all events inside group \"%s\" to a specific type. This operation does not work for Yearly events and also some of Custom events. You have to edit those events manually to change calendar type.')%group.title)
		label.set_line_wrap(True)
		pack(hbox, label)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		###
		hbox = gtk.HBox()
		pack(hbox, gtk.Label(_('Calendar Type')+':'))
		combo = CalTypeCombo()
		combo.set_active(group.mode)
		pack(hbox, combo)
		pack(hbox, gtk.Label(''), 1, 1)
		self.modeCombo = combo
		pack(self.vbox, hbox)
		####
		self.vbox.show_all()
		window_set_size_aspect(self, 1.6)
示例#11
0
 def __init__(self, account=None, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Edit Account') if account else _('Add New Account'))
     ###
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ##
     self.connect('response', lambda w, e: self.hide())
     #######
     self.account = account
     self.activeWidget = None
     #######
     hbox = gtk.HBox()
     combo = gtk.ComboBoxText()
     for cls in event_lib.classes.account:
         combo.append_text(cls.desc)
     pack(hbox, gtk.Label(_('Account Type')))
     pack(hbox, combo)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ####
     if self.account:
         self.isNew = False
         combo.set_active(event_lib.classes.account.names.index(self.account.name))
     else:
         self.isNew = True
         defaultAccountTypeIndex = 0
         combo.set_active(defaultAccountTypeIndex)
         self.account = event_lib.classes.account[defaultAccountTypeIndex]()
     self.activeWidget = None
     combo.connect('changed', self.typeChanged)
     self.comboType = combo
     self.vbox.show_all()
     self.typeChanged()
示例#12
0
文件: export.py 项目: ilius/starcal
	def __init__(self, group, **kwargs):
		self._group = group
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Export Group"))
		####
		dialog_add_button(
			self,
			gtk.STOCK_CANCEL,
			_("_Cancel"),
			gtk.ResponseType.CANCEL,
		)
		dialog_add_button(
			self,
			gtk.STOCK_OK,
			_("_OK"),
			gtk.ResponseType.OK,
		)
		self.connect("response", lambda w, e: self.hide())
		####
		hbox = gtk.HBox()
		frame = gtk.Frame()
		frame.set_label(_("Format"))
		radioBox = gtk.VBox()
		##
		self.radioIcs = gtk.RadioButton(label="iCalendar")
		self.radioJsonCompact = gtk.RadioButton(
			label=_("Compact JSON (StarCalendar)"),
			group=self.radioIcs,
		)
		self.radioJsonPretty = gtk.RadioButton(
			label=_("Pretty JSON (StarCalendar)"),
			group=self.radioIcs,
		)
		##
		pack(radioBox, self.radioJsonCompact)
		pack(radioBox, self.radioJsonPretty)
		pack(radioBox, self.radioIcs)
		##
		self.radioJsonCompact.set_active(True)
		self.radioIcs.connect("clicked", self.formatRadioChanged)
		self.radioJsonCompact.connect("clicked", self.formatRadioChanged)
		self.radioJsonPretty.connect("clicked", self.formatRadioChanged)
		##
		frame.add(radioBox)
		pack(hbox, frame)
		pack(hbox, gtk.Label(""), 1, 1)
		pack(self.vbox, hbox)
		########
		self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
		self.fcw.set_current_folder(deskDir)
		pack(self.vbox, self.fcw, 1, 1)
		####
		self.vbox.show_all()
		self.formatRadioChanged()
示例#13
0
文件: export.py 项目: ilius/starcal
 def __init__(self, group, **kwargs):
     self._group = group
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_("Export Group"))
     ####
     dialog_add_button(
         self,
         gtk.STOCK_CANCEL,
         _("_Cancel"),
         gtk.ResponseType.CANCEL,
     )
     dialog_add_button(
         self,
         gtk.STOCK_OK,
         _("_OK"),
         gtk.ResponseType.OK,
     )
     self.connect("response", lambda w, e: self.hide())
     ####
     hbox = gtk.HBox()
     frame = gtk.Frame()
     frame.set_label(_("Format"))
     radioBox = gtk.VBox()
     ##
     self.radioIcs = gtk.RadioButton(label="iCalendar")
     self.radioJsonCompact = gtk.RadioButton(
         label=_("Compact JSON (StarCalendar)"),
         group=self.radioIcs,
     )
     self.radioJsonPretty = gtk.RadioButton(
         label=_("Pretty JSON (StarCalendar)"),
         group=self.radioIcs,
     )
     ##
     pack(radioBox, self.radioJsonCompact)
     pack(radioBox, self.radioJsonPretty)
     pack(radioBox, self.radioIcs)
     ##
     self.radioJsonCompact.set_active(True)
     self.radioIcs.connect("clicked", self.formatRadioChanged)
     self.radioJsonCompact.connect("clicked", self.formatRadioChanged)
     self.radioJsonPretty.connect("clicked", self.formatRadioChanged)
     ##
     frame.add(radioBox)
     pack(hbox, frame)
     pack(hbox, gtk.Label(""), 1, 1)
     pack(self.vbox, hbox)
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     self.fcw.set_current_folder(deskDir)
     pack(self.vbox, self.fcw, 1, 1)
     ####
     self.vbox.show_all()
     self.formatRadioChanged()
示例#14
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export'))
     self.vbox.set_spacing(10)
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ####
     hbox = gtk.HBox()
     frame = gtk.Frame()
     frame.set_label(_('Format'))
     radioBox = gtk.VBox()
     ##
     self.radioIcs = gtk.RadioButton(label='iCalendar')
     self.radioJsonCompact = gtk.RadioButton(
         label=_('Compact JSON (StarCalendar)'), group=self.radioIcs)
     self.radioJsonPretty = gtk.RadioButton(
         label=_('Pretty JSON (StarCalendar)'), group=self.radioIcs)
     ##
     pack(radioBox, self.radioJsonCompact)
     pack(radioBox, self.radioJsonPretty)
     pack(radioBox, self.radioIcs)
     ##
     self.radioJsonCompact.set_active(True)
     self.radioIcs.connect('clicked', self.formatRadioChanged)
     self.radioJsonCompact.connect('clicked', self.formatRadioChanged)
     self.radioJsonPretty.connect('clicked', self.formatRadioChanged)
     ##
     frame.add(radioBox)
     pack(hbox, frame)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ########
     hbox = gtk.HBox(spacing=2)
     pack(hbox, gtk.Label(_('File') + ':'))
     self.fpathEntry = gtk.Entry()
     self.fpathEntry.set_text(
         join(deskDir,
              'events-%.4d-%.2d-%.2d' % core.getSysDate(DATE_GREG)))
     pack(hbox, self.fpathEntry, 1, 1)
     pack(self.vbox, hbox)
     ####
     self.groupSelect = GroupsTreeCheckList()
     swin = gtk.ScrolledWindow()
     swin.add(self.groupSelect)
     swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
     pack(self.vbox, swin, 1, 1)
     ####
     self.vbox.show_all()
     self.formatRadioChanged()
     self.resize(600, 600)
示例#15
0
	def __init__(self, **kwargs):
		from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Time Zone"))
		####
		dialog_add_button(
			self,
			gtk.STOCK_CANCEL,
			_("_Cancel"),
			gtk.ResponseType.CANCEL,
		)
		dialog_add_button(
			self,
			gtk.STOCK_OK,
			_("_OK"),
			gtk.ResponseType.OK,
		)
		###
		self.connect("response", self.onResponse)
		####
		label = gtk.Label()
		label.set_markup("".join([
			_("\"Time Zone\" property is newly added to events") + "\n",
			_("But this property needs to be saved for current events") + "\n",
			_("Select the time zone for your current location") + "\n\n",
			"<small>",
			_(
				"If you have been in a different time zone while adding some"
				" of your event, you need to edit those events manually and"
				" change the time zone"
			) + "\n",
			_("Time zone for All-Day events will be disabled by default"),
			"</small>",
		]))
		label.set_line_wrap(True)
		pack(self.vbox, label, 1, 1)
		####
		hbox = gtk.HBox()
		self.timeZoneInput = TimeZoneComboBoxEntry()
		pack(hbox, gtk.Label(""), 1, 1)
		pack(hbox, self.timeZoneInput)
		pack(hbox, gtk.Label(""), 1, 1)
		hbox.set_border_width(20)
		pack(self.vbox, hbox, 1, 1)
		####
		self.errorLabel = gtk.Label()
		pack(self.vbox, self.errorLabel, 1, 1)
		####
		pack(self.vbox, gtk.Label(""), 1, 1)
		####
		self.vbox.show_all()
示例#16
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.initVars()
     ud.windowList.appendItem(self)
     ###
     self.set_title(_('Day Info'))
     self.connect('delete-event', self.onClose)
     self.vbox.set_spacing(15)
     ###
     dialog_add_button(self, gtk.STOCK_CLOSE, _('Close'), 0, self.onClose)
     dialog_add_button(self, '', _('Previous'), 1, self.goBack)
     dialog_add_button(self, '', _('Today'), 2, self.goToday)
     dialog_add_button(self, '', _('Next'), 3, self.goNext)
     ###
     self.allDateLabels = AllDateLabelsVBox()
     self.pluginsTextView = PluginsTextView()
     self.eventsView = DayOccurrenceView()
     ###
     for item in (self.allDateLabels, self.pluginsTextView,
                  self.eventsView):
         self.appendItem(item)
         ###
         exp = gtk.Expander()
         exp.set_label(item.desc)
         exp.add(item)
         exp.set_expanded(True)
         pack(self.vbox, exp)
     self.vbox.show_all()
示例#17
0
文件: tags.py 项目: ubuntu-ir/starcal
	def __init__(self, eventType='', **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Tags'))
		self.set_transient_for(None)
		self.tags = []
		self.tagsBox = TagsListBox(eventType)
		pack(self.vbox, self.tagsBox, 1, 1)
		####
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		####
		self.vbox.show_all()
		self.getData = self.tagsBox.getData
		self.setData = self.tagsBox.setData
示例#18
0
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.initVars()
		ud.windowList.appendItem(self)
		###
		self.set_title(_('Day Info'))
		self.connect('delete-event', self.onClose)
		self.vbox.set_spacing(15)
		###
		dialog_add_button(self, gtk.STOCK_CLOSE, _('Close'), 0, self.onClose)
		dialog_add_button(self, '', _('Previous'), 1, self.goBack)
		dialog_add_button(self, '', _('Today'), 2, self.goToday)
		dialog_add_button(self, '', _('Next'), 3, self.goNext)
		###
		self.allDateLabels = AllDateLabelsVBox()
		self.pluginsTextView = PluginsTextView()
		self.eventsView = DayOccurrenceView()
		###
		for item in (self.allDateLabels, self.pluginsTextView, self.eventsView):
			self.appendItem(item)
			###
			exp = gtk.Expander()
			exp.set_label(item.desc)
			exp.add(item)
			exp.set_expanded(True)
			pack(self.vbox, exp)
		self.vbox.show_all()
示例#19
0
 def __init__(self, **kwargs):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_("Time Zone"))
     ####
     dialog_add_button(
         self,
         gtk.STOCK_CANCEL,
         _("_Cancel"),
         gtk.ResponseType.CANCEL,
     )
     dialog_add_button(
         self,
         gtk.STOCK_OK,
         _("_OK"),
         gtk.ResponseType.OK,
     )
     ###
     self.connect("response", self.onResponse)
     ####
     label = gtk.Label()
     label.set_markup("".join([
         _("\"Time Zone\" property is newly added to events") + "\n",
         _("But this property needs to be saved for current events") + "\n",
         _("Select the time zone for your current location") + "\n\n",
         "<small>",
         _("If you have been in a different time zone while adding some"
           " of your event, you need to edit those events manually and"
           " change the time zone") + "\n",
         _("Time zone for All-Day events will be disabled by default"),
         "</small>",
     ]))
     label.set_line_wrap(True)
     pack(self.vbox, label, 1, 1)
     ####
     hbox = gtk.HBox()
     self.timeZoneInput = TimeZoneComboBoxEntry()
     pack(hbox, gtk.Label(""), 1, 1)
     pack(hbox, self.timeZoneInput)
     pack(hbox, gtk.Label(""), 1, 1)
     hbox.set_border_width(20)
     pack(self.vbox, hbox, 1, 1)
     ####
     self.errorLabel = gtk.Label()
     pack(self.vbox, self.errorLabel, 1, 1)
     ####
     pack(self.vbox, gtk.Label(""), 1, 1)
     ####
     self.vbox.show_all()
示例#20
0
文件: tags.py 项目: ubuntu-ir/starcal
 def __init__(self, eventType='', **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Tags'))
     self.set_transient_for(None)
     self.tags = []
     self.tagsBox = TagsListBox(eventType)
     pack(self.vbox, self.tagsBox, 1, 1)
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ####
     self.vbox.show_all()
     self.getData = self.tagsBox.getData
     self.setData = self.tagsBox.setData
示例#21
0
文件: trash.py 项目: ilius/starcal
 def __init__(self, **kwargs):
     checkEventsReadOnly()
     gtk.Dialog.__init__(self, **kwargs)
     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.ResponseType.CANCEL,
     )
     dialog_add_button(
         self,
         gtk.STOCK_OK,
         _("_OK"),
         gtk.ResponseType.OK,
     )
     ##
     self.connect("response", lambda w, e: self.hide())
     #######
     self.trash = ui.eventTrash
     ##
     sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.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()
示例#22
0
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Export'))
		self.vbox.set_spacing(10)
		####
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		####
		hbox = gtk.HBox()
		frame = gtk.Frame()
		frame.set_label(_('Format'))
		radioBox = gtk.VBox()
		##
		self.radioIcs = gtk.RadioButton(label='iCalendar')
		self.radioJsonCompact = gtk.RadioButton(label=_('Compact JSON (StarCalendar)'), group=self.radioIcs)
		self.radioJsonPretty = gtk.RadioButton(label=_('Pretty JSON (StarCalendar)'), group=self.radioIcs)
		##
		pack(radioBox, self.radioJsonCompact)
		pack(radioBox, self.radioJsonPretty)
		pack(radioBox, self.radioIcs)
		##
		self.radioJsonCompact.set_active(True)
		self.radioIcs.connect('clicked', self.formatRadioChanged)
		self.radioJsonCompact.connect('clicked', self.formatRadioChanged)
		self.radioJsonPretty.connect('clicked', self.formatRadioChanged)
		##
		frame.add(radioBox)
		pack(hbox, frame)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		########
		hbox = gtk.HBox(spacing=2)
		pack(hbox, gtk.Label(_('File')+':'))
		self.fpathEntry = gtk.Entry()
		self.fpathEntry.set_text(join(deskDir, 'events-%.4d-%.2d-%.2d'%core.getSysDate(DATE_GREG)))
		pack(hbox, self.fpathEntry, 1, 1)
		pack(self.vbox, hbox)
		####
		self.groupSelect = GroupsTreeCheckList()
		swin = gtk.ScrolledWindow()
		swin.add(self.groupSelect)
		swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
		pack(self.vbox, swin, 1, 1)
		####
		self.vbox.show_all()
		self.formatRadioChanged()
		self.resize(600, 600)
示例#23
0
	def __init__(self, saveIcsFunc, defaultFileName, **kwargs):
		self.saveIcsFunc = saveIcsFunc
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Export to %s") % "iCalendar")
		## parent=None FIXME
		#self.set_has_separator(False)
		########
		hbox = gtk.HBox(spacing=2)
		pack(hbox, gtk.Label(_("From") + " "))
		self.startDateInput = DateButton()
		pack(hbox, self.startDateInput)
		pack(hbox, gtk.Label(" " + _("To") + " "))
		self.endDateInput = DateButton()
		pack(hbox, self.endDateInput)
		pack(self.vbox, hbox)
		####
		year, month, day = ui.todayCell.dates[calTypes.primary]
		self.startDateInput.set_value((year, 1, 1))
		self.endDateInput.set_value((year + 1, 1, 1))
		########
		self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
		pack(self.vbox, self.fcw, 1, 1)
		self.vbox.set_focus_child(self.fcw)## FIXME
		self.vbox.show_all()
		##
		dialog_add_button(
			self,
			gtk.STOCK_CANCEL,
			_("_Cancel"),
			1,
			self.onDelete,
		)
		dialog_add_button(
			self,
			gtk.STOCK_SAVE,
			_("_Save"),
			2,
			self.save,
		)
		##
		self.connect("delete-event", self.onDelete)
		self.fcw.connect("file-activated", self.save)  # not working FIXME
		##
		self.fcw.set_current_folder(core.deskDir)
		if not defaultFileName.endswith(".ics"):
			defaultFileName += ".ics"
		self.fcw.set_current_name(defaultFileName)
示例#24
0
 def __init__(self, group, **kwargs):
     self._group = group
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export Group'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     self.connect('response', lambda w, e: self.hide())
     ####
     hbox = gtk.HBox()
     frame = gtk.Frame()
     frame.set_label(_('Format'))
     radioBox = gtk.VBox()
     ##
     self.radioIcs = gtk.RadioButton(label='iCalendar')
     self.radioJsonCompact = gtk.RadioButton(
         label=_('Compact JSON (StarCalendar)'), group=self.radioIcs)
     self.radioJsonPretty = gtk.RadioButton(
         label=_('Pretty JSON (StarCalendar)'), group=self.radioIcs)
     ##
     pack(radioBox, self.radioJsonCompact)
     pack(radioBox, self.radioJsonPretty)
     pack(radioBox, self.radioIcs)
     ##
     self.radioJsonCompact.set_active(True)
     self.radioIcs.connect('clicked', self.formatRadioChanged)
     self.radioJsonCompact.connect('clicked', self.formatRadioChanged)
     self.radioJsonPretty.connect('clicked', self.formatRadioChanged)
     ##
     frame.add(radioBox)
     pack(hbox, frame)
     pack(hbox, gtk.Label(''), 1, 1)
     pack(self.vbox, hbox)
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     try:
         self.fcw.set_current_folder(deskDir)
     except AttributeError:  ## PyGTK < 2.4
         pass
     pack(self.vbox, self.fcw, 1, 1)
     ####
     self.vbox.show_all()
     self.formatRadioChanged()
示例#25
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export to %s') % 'HTML')
     ## parent=None FIXME
     #self.set_has_separator(False)
     ########
     hbox = gtk.HBox(spacing=2)
     pack(hbox, gtk.Label(_('Month Range')))
     combo = gtk.ComboBoxText()
     for t in ('Current Month', 'Whole Current Year', 'Custom'):
         combo.append_text(_(t))
     pack(hbox, combo)
     pack(hbox, gtk.Label(''), 1, 1)
     self.combo = combo
     ###
     hbox2 = gtk.HBox(spacing=2)
     pack(hbox2, gtk.Label(_('from month')))
     self.ymBox0 = YearMonthButton()
     pack(hbox2, self.ymBox0)
     pack(hbox2, gtk.Label(''), 1, 1)
     pack(hbox2, gtk.Label(_('to month')))
     self.ymBox1 = YearMonthButton()
     pack(hbox2, self.ymBox1)
     pack(hbox, hbox2, 1, 1)
     self.hbox2 = hbox2
     combo.set_active(0)
     pack(self.vbox, hbox)
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     pack(self.vbox, self.fcw, 1, 1)
     self.vbox.set_focus_child(self.fcw)  ## FIXME
     self.vbox.show_all()
     combo.connect('changed', self.comboChanged)
     ##
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1,
                       self.onDelete)
     dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
     ##
     self.connect('delete-event', self.onDelete)
     try:
         self.fcw.set_current_folder(core.deskDir)
     except AttributeError:  ## PyGTK < 2.4
         pass
示例#26
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export to %s')%'HTML')
     ## parent=None FIXME
     #self.set_has_separator(False)
     ########
     hbox = gtk.HBox(spacing=2)
     pack(hbox, gtk.Label(_('Month Range')))
     combo = gtk.ComboBoxText()
     for t in ('Current Month', 'Whole Current Year', 'Custom'):
         combo.append_text(_(t))
     pack(hbox, combo)
     pack(hbox, gtk.Label(''), 1, 1)
     self.combo = combo
     ###
     hbox2 = gtk.HBox(spacing=2)
     pack(hbox2, gtk.Label(_('from month')))
     self.ymBox0 = YearMonthButton()
     pack(hbox2, self.ymBox0)
     pack(hbox2, gtk.Label(''), 1, 1)
     pack(hbox2, gtk.Label(_('to month')))
     self.ymBox1 = YearMonthButton()
     pack(hbox2, self.ymBox1)
     pack(hbox, hbox2, 1, 1)
     self.hbox2 = hbox2
     combo.set_active(0)
     pack(self.vbox, hbox)
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     pack(self.vbox, self.fcw, 1, 1)
     self.vbox.set_focus_child(self.fcw)## FIXME
     self.vbox.show_all()
     combo.connect('changed', self.comboChanged)
     ##
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1, self.onDelete)
     dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
     ##
     self.connect('delete-event', self.onDelete)
     try:
         self.fcw.set_current_folder(core.deskDir)
     except AttributeError:## PyGTK < 2.4
         pass
示例#27
0
	def __init__(self, group, **kwargs):
		self._group = group
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_('Export Group'))
		####
		dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		self.connect('response', lambda w, e: self.hide())
		####
		hbox = gtk.HBox()
		frame = gtk.Frame()
		frame.set_label(_('Format'))
		radioBox = gtk.VBox()
		##
		self.radioIcs = gtk.RadioButton(label='iCalendar')
		self.radioJsonCompact = gtk.RadioButton(label=_('Compact JSON (StarCalendar)'), group=self.radioIcs)
		self.radioJsonPretty = gtk.RadioButton(label=_('Pretty JSON (StarCalendar)'), group=self.radioIcs)
		##
		pack(radioBox, self.radioJsonCompact)
		pack(radioBox, self.radioJsonPretty)
		pack(radioBox, self.radioIcs)
		##
		self.radioJsonCompact.set_active(True)
		self.radioIcs.connect('clicked', self.formatRadioChanged)
		self.radioJsonCompact.connect('clicked', self.formatRadioChanged)
		self.radioJsonPretty.connect('clicked', self.formatRadioChanged)
		##
		frame.add(radioBox)
		pack(hbox, frame)
		pack(hbox, gtk.Label(''), 1, 1)
		pack(self.vbox, hbox)
		########
		self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
		try:
			self.fcw.set_current_folder(deskDir)
		except AttributeError:## PyGTK < 2.4
			pass
		pack(self.vbox, self.fcw, 1, 1)
		####
		self.vbox.show_all()
		self.formatRadioChanged()
示例#28
0
文件: hijri.py 项目: ilius/starcal
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Hijri months expired"))
		self.connect("response", self.onResponse)
		###
		pack(self.vbox, gtk.Label(self.message + "\n\n"), 1, 1)
		###
		hbox = gtk.HBox()
		checkb = gtk.CheckButton(_("Don't show this again"))
		pack(hbox, checkb)
		pack(self.vbox, hbox)
		self.noShowCheckb = checkb
		###
		dialog_add_button(
			self,
			gtk.STOCK_CLOSE,
			_("_Close"),
			gtk.ResponseType.OK,
		)
		###
		self.vbox.show_all()
示例#29
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_("Hijri months expired"))
     self.connect("response", self.onResponse)
     ###
     pack(self.vbox, gtk.Label(self.message + "\n\n"), 1, 1)
     ###
     hbox = gtk.HBox()
     checkb = gtk.CheckButton(_("Don't show this again"))
     pack(hbox, checkb)
     pack(self.vbox, hbox)
     self.noShowCheckb = checkb
     ###
     dialog_add_button(
         self,
         gtk.STOCK_CLOSE,
         _("_Close"),
         gtk.ResponseType.OK,
     )
     ###
     self.vbox.show_all()
示例#30
0
 def __init__(self, **kwargs):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Time Zone'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'),
                       gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ###
     self.connect('response', self.onResponse)
     ####
     label = gtk.Label()
     label.set_markup(''.join([
         _('"Time Zone" property is newly added to events') + '\n',
         _('But this property needs to be saved for current events') + '\n',
         _('Select the time zone for your current location') + '\n\n',
         '<small>',
         _('If you have been in a different time zone while adding some of your event, you need to edit those events manually and change the time zone'
           ) + '\n',
         _('Time zone for All-Day events will be disabled by default'),
         '</small>',
     ]))
     label.set_line_wrap(True)
     pack(self.vbox, label, 1, 1)
     ####
     hbox = gtk.HBox()
     self.timeZoneInput = TimeZoneComboBoxEntry()
     pack(hbox, gtk.Label(''), 1, 1)
     pack(hbox, self.timeZoneInput)
     pack(hbox, gtk.Label(''), 1, 1)
     hbox.set_border_width(20)
     pack(self.vbox, hbox, 1, 1)
     ####
     self.errorLabel = gtk.Label()
     pack(self.vbox, self.errorLabel, 1, 1)
     ####
     pack(self.vbox, gtk.Label(''), 1, 1)
     ####
     self.vbox.show_all()
示例#31
0
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Export to %s") % "HTML")
		# parent=None FIXME
		#self.set_has_separator(False)
		########
		hbox = gtk.HBox(spacing=2)
		pack(hbox, gtk.Label(_("Month Range")))
		combo = gtk.ComboBoxText()
		for t in ("Current Month", "Whole Current Year", "Custom"):
			combo.append_text(_(t))
		pack(hbox, combo)
		pack(hbox, gtk.Label(""), 1, 1)
		self.combo = combo
		###
		hbox2 = gtk.HBox(spacing=2)
		pack(hbox2, gtk.Label(_("from month")))
		self.ymBox0 = YearMonthButton()
		pack(hbox2, self.ymBox0)
		pack(hbox2, gtk.Label(""), 1, 1)
		pack(hbox2, gtk.Label(_("to month")))
		self.ymBox1 = YearMonthButton()
		pack(hbox2, self.ymBox1)
		pack(hbox, hbox2, 1, 1)
		self.hbox2 = hbox2
		combo.set_active(0)
		pack(self.vbox, hbox)
		########
		self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
		pack(self.vbox, self.fcw, 1, 1)
		self.vbox.set_focus_child(self.fcw)## FIXME
		self.vbox.show_all()
		combo.connect("changed", self.comboChanged)
		##
		dialog_add_button(self, gtk.STOCK_CANCEL, _("_Cancel"), 1, self.onDelete)
		dialog_add_button(self, gtk.STOCK_SAVE, _("_Save"), 2, self.save)
		##
		self.connect("delete-event", self.onDelete)
		self.fcw.set_current_folder(core.deskDir)
示例#32
0
 def __init__(self, saveIcsFunc, defaultFileName, **kwargs):
     self.saveIcsFunc = saveIcsFunc
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export to %s') % 'iCalendar')
     ## parent=None FIXME
     #self.set_has_separator(False)
     ########
     hbox = gtk.HBox(spacing=2)
     pack(hbox, gtk.Label(_('From') + ' '))
     self.startDateInput = DateButton()
     pack(hbox, self.startDateInput)
     pack(hbox, gtk.Label(' ' + _('To') + ' '))
     self.endDateInput = DateButton()
     pack(hbox, self.endDateInput)
     pack(self.vbox, hbox)
     ####
     year, month, day = ui.todayCell.dates[calTypes.primary]
     self.startDateInput.set_value((year, 1, 1))
     self.endDateInput.set_value((year + 1, 1, 1))
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     pack(self.vbox, self.fcw, 1, 1)
     self.vbox.set_focus_child(self.fcw)  ## FIXME
     self.vbox.show_all()
     ##
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1,
                       self.onDelete)
     dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
     ##
     self.connect('delete-event', self.onDelete)
     self.fcw.connect('file-activated', self.save)  ## not working FIXME
     ##
     try:
         self.fcw.set_current_folder(core.deskDir)
     except AttributeError:  ## PyGTK < 2.4
         pass
     if not defaultFileName.endswith('.ics'):
         defaultFileName += '.ics'
     self.fcw.set_current_name(defaultFileName)
示例#33
0
 def __init__(self, saveIcsFunc, defaultFileName, **kwargs):
     self.saveIcsFunc = saveIcsFunc
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Export to %s')%'iCalendar')
     ## parent=None FIXME
     #self.set_has_separator(False)
     ########
     hbox = gtk.HBox(spacing=2)
     pack(hbox, gtk.Label(_('From')+' '))
     self.startDateInput = DateButton()
     pack(hbox, self.startDateInput)
     pack(hbox, gtk.Label(' '+_('To')+' '))
     self.endDateInput = DateButton()
     pack(hbox, self.endDateInput)
     pack(self.vbox, hbox)
     ####
     year, month, day = ui.todayCell.dates[calTypes.primary]
     self.startDateInput.set_value((year, 1, 1, 0))
     self.endDateInput.set_value((year+1, 1, 1, 0))
     ########
     self.fcw = gtk.FileChooserWidget(action=gtk.FileChooserAction.SAVE)
     pack(self.vbox, self.fcw, 1, 1)
     self.vbox.set_focus_child(self.fcw)## FIXME
     self.vbox.show_all()
     ##
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), 1, self.onDelete)
     dialog_add_button(self, gtk.STOCK_SAVE, _('_Save'), 2, self.save)
     ##
     self.connect('delete-event', self.onDelete)
     self.fcw.connect('file-activated', self.save)## not working FIXME
     ##
     try:
         self.fcw.set_current_folder(core.deskDir)
     except AttributeError:## PyGTK < 2.4
         pass
     if not defaultFileName.endswith('.ics'):
         defaultFileName += '.ics'
     self.fcw.set_current_name(defaultFileName)
示例#34
0
 def __init__(self):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Time Zone'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ###
     self.connect('response', self.onResponse)
     ####
     label = gtk.Label()
     label.set_markup(''.join([
         _('"Time Zone" property is newly added to events')+'\n',
         _('But this property needs to be saved for current events')+'\n',
         _('Select the time zone for your current location')+'\n\n',
         '<small>',
         _('If you have been in a different time zone while adding some of your event, you need to edit those events manually and change the time zone')+'\n',
         _('Time zone for All-Day events will be disabled by default'),
         '</small>',
     ]))
     label.set_line_wrap(True)
     pack(self.vbox, label, 1, 1)
     ####
     hbox = gtk.HBox()
     self.timeZoneInput = TimeZoneComboBoxEntry()
     pack(hbox, gtk.Label(''), 1, 1)
     pack(hbox, self.timeZoneInput)
     pack(hbox, gtk.Label(''), 1, 1)
     hbox.set_border_width(20)
     pack(self.vbox, hbox, 1, 1)
     ####
     self.errorLabel = gtk.Label()
     pack(self.vbox, self.errorLabel, 1, 1)
     ####
     pack(self.vbox, gtk.Label(''), 1, 1)
     ####
     self.vbox.show_all()
示例#35
0
文件: trash.py 项目: greyzero/starcal
 def __init__(self, **kwargs):
     checkEventsReadOnly()
     gtk.Dialog.__init__(self, **kwargs)
     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.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     ##
     self.connect('response', lambda w, e: self.hide())
     #######
     self.trash = ui.eventTrash
     ##
     sizeGroup = gtk.SizeGroup(gtk.SizeGroupMode.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()
示例#36
0
文件: day_info.py 项目: ilius/starcal
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.initVars()
		ud.windowList.appendItem(self)
		###
		self.set_title(_("Day Info"))
		self.connect("delete-event", self.onClose)
		self.vbox.set_spacing(15)
		###
		dialog_add_button(self, gtk.STOCK_CLOSE, _("Close"), 0, self.onClose)
		dialog_add_button(self, "", _("Previous"), 1, self.goBack)
		dialog_add_button(self, "", _("Today"), 2, self.goToday)
		dialog_add_button(self, "", _("Next"), 3, self.goNext)
		###
		self.appendDayInfoItem(AllDateLabelsVBox())
		self.appendDayInfoItem(DayInfoJulianDayHBox(), expander=False)
		self.appendDayInfoItem(PluginsTextView())
		self.appendDayInfoItem(DayOccurrenceView())
		###
		self.vbox.show_all()
示例#37
0
 def __init__(self, container, **kwargs):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     self._container = container
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_("Bulk Edit Events"))
     ####
     dialog_add_button(
         self,
         gtk.STOCK_CANCEL,
         _("_Cancel"),
         gtk.ResponseType.CANCEL,
     )
     dialog_add_button(
         self,
         gtk.STOCK_OK,
         _("_OK"),
         gtk.ResponseType.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.ComboBoxText()
     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.ComboBoxText()
     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.ComboBoxText()
     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()
     ####
     window_set_size_aspect(self, 1.6)
示例#38
0
 def __init__(self, container, **kwargs):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     self._container = container
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Bulk Edit Events'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.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.ComboBoxText()
     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.ComboBoxText()
     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.ComboBoxText()
     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()
示例#39
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_("Tune Hijri Monthes"))
     self.connect("delete-event", self.onDeleteEvent)
     ############
     self.altMode = 0
     self.altModeDesc = "Gregorian"
     ############
     hbox = gtk.HBox()
     self.topLabel = gtk.Label()
     pack(hbox, self.topLabel)
     self.startDateInput = DateButton()
     self.startDateInput.set_editable(False)  ## FIXME
     self.startDateInput.connect("changed",
                                 lambda widget: self.updateEndDates())
     pack(hbox, self.startDateInput)
     pack(self.vbox, hbox)
     ############################
     treev = gtk.TreeView()
     trees = gtk.ListStore(
         int,  # ym (hidden)
         str,  # localized year
         str,  # localized month
         int,  # monthLenCombo
         str,  # localized endDate
     )
     treev.set_model(trees)
     #treev.get_selection().connect("changed", self.plugTreevCursorChanged)
     #treev.connect("row-activated", self.plugTreevRActivate)
     #treev.connect("button-press-event", self.plugTreevButtonPress)
     ###
     swin = gtk.ScrolledWindow()
     swin.add(treev)
     swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_("Year"), cell, text=1)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_("Month"), cell, text=2)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererCombo()
     mLenModel = gtk.ListStore(int)
     mLenModel.append([29])
     mLenModel.append([30])
     cell.set_property("model", mLenModel)
     #cell.set_property("has-entry", False)
     cell.set_property("editable", True)
     cell.set_property("text-column", 0)
     cell.connect("edited", self.monthLenCellEdited)
     col = gtk.TreeViewColumn(_("Month Length"), cell, text=3)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_("End Date"), cell, text=4)
     treev.append_column(col)
     ######
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.Orientation.VERTICAL)
     size = gtk.IconSize.SMALL_TOOLBAR
     ###
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _("Add"))
     tb.connect("clicked", self.addClicked)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _("Delete"))
     tb.connect("clicked", self.delClicked)
     toolbar.insert(tb, -1)
     ######
     self.treev = treev
     self.trees = trees
     #####
     mainHbox = gtk.HBox()
     pack(mainHbox, swin, 1, 1)
     pack(mainHbox, toolbar)
     pack(self.vbox, mainHbox, 1, 1)
     ######
     dialog_add_button(
         self,
         gtk.STOCK_OK,
         _("_OK"),
         gtk.ResponseType.OK,
     )
     dialog_add_button(
         self,
         gtk.STOCK_CANCEL,
         _("_Cancel"),
         gtk.ResponseType.CANCEL,
     )
     ##
     resetB = self.add_button(
         gtk.STOCK_UNDO,
         gtk.ResponseType.NONE,
     )
     resetB.set_label(_("_Reset to Defaults"))
     resetB.set_image(
         gtk.Image.new_from_stock(
             gtk.STOCK_UNDO,
             gtk.IconSize.BUTTON,
         ))
     resetB.connect("clicked", self.resetToDefaults)
     ##
     self.connect("response", self.onResponse)
     #print(dir(self.get_action_area()))
     #self.get_action_area().set_homogeneous(False)
     ######
     self.vbox.show_all()
示例#40
0
 def __init__(self, container, **kwargs):
     from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
     self._container = container
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Bulk Edit Events'))
     ####
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.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.ComboBoxText()
     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.ComboBoxText()
     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.ComboBoxText()
     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()
     ####
     window_set_size_aspect(self, 1.6)
示例#41
0
	def __init__(self, **kwargs):
		checkEventsReadOnly()  # FIXME
		gtk.Dialog.__init__(self, **kwargs)
		self.initVars()
		ud.windowList.appendItem(self)
		####
		self.syncing = None ## or a tuple of (groupId, statusText)
		self.groupIterById = {}
		self.trashIter = None
		self.isLoaded = False
		self.loadedGroupIds = set()
		self.eventsIter = {}
		####
		self.set_title(_("Event Manager"))
		self.resize(600, 300)
		self.connect("delete-event", self.onDeleteEvent)
		self.set_transient_for(None)
		self.set_type_hint(gdk.WindowTypeHint.NORMAL)
		##
		dialog_add_button(self, gtk.STOCK_OK, _("_OK"), gtk.ResponseType.OK)
		#self.connect("response", lambda w, e: self.hide())
		self.connect("response", self.onResponse)
		self.connect("show", self.onShow)
		#######
		self.searchWin = EventSearchWindow()
		#######
		menubar = gtk.MenuBar()
		####
		fileItem = MenuItem(_("_File"))
		fileMenu = gtk.Menu()
		fileItem.set_submenu(fileMenu)
		menubar.append(fileItem)
		##
		addGroupItem = MenuItem(_("Add New Group"))
		addGroupItem.set_sensitive(not event_lib.allReadOnly)
		addGroupItem.connect("activate", self.addGroupBeforeSelection)
		## or before selected group? FIXME
		fileMenu.append(addGroupItem)
		##
		searchItem = MenuItem(_("_Search Events"))## FIXME right place?
		searchItem.connect("activate", self.mbarSearchClicked)
		fileMenu.append(searchItem)
		##
		exportItem = MenuItem(_("_Export"))
		exportItem.connect("activate", self.mbarExportClicked)
		fileMenu.append(exportItem)
		##
		importItem = MenuItem(_("_Import"))
		importItem.set_sensitive(not event_lib.allReadOnly)
		importItem.connect("activate", self.mbarImportClicked)
		fileMenu.append(importItem)
		##
		orphanItem = MenuItem(_("Check for Orphan Events"))
		orphanItem.set_sensitive(not event_lib.allReadOnly)
		orphanItem.connect("activate", self.mbarOrphanClicked)
		fileMenu.append(orphanItem)
		####
		editItem = MenuItem(_("_Edit"))
		if event_lib.allReadOnly:
			editItem.set_sensitive(False)
		else:
			editMenu = gtk.Menu()
			editItem.set_submenu(editMenu)
			menubar.append(editItem)
			##
			editEditItem = MenuItem(_("Edit"))
			editEditItem.connect("activate", self.mbarEditClicked)
			editMenu.append(editEditItem)
			editMenu.connect("show", self.mbarEditMenuPopup)
			self.mbarEditItem = editEditItem
			##
			editMenu.append(gtk.SeparatorMenuItem())
			##
			cutItem = MenuItem(_("Cu_t"))
			cutItem.connect("activate", self.mbarCutClicked)
			editMenu.append(cutItem)
			self.mbarCutItem = cutItem
			##
			copyItem = MenuItem(_("_Copy"))
			copyItem.connect("activate", self.mbarCopyClicked)
			editMenu.append(copyItem)
			self.mbarCopyItem = copyItem
			##
			pasteItem = MenuItem(_("_Paste"))
			pasteItem.connect("activate", self.mbarPasteClicked)
			editMenu.append(pasteItem)
			self.mbarPasteItem = pasteItem
			##
			editMenu.append(gtk.SeparatorMenuItem())
			##
			dupItem = MenuItem(_("_Duplicate"))
			dupItem.connect("activate", self.duplicateSelectedObj)
			editMenu.append(dupItem)
			self.mbarDupItem = dupItem
			##
			editMenu.append(gtk.SeparatorMenuItem())
			##
			enableAllItem = MenuItem(_("Enable All Groups"))
			enableAllItem.connect("activate", self.enableAllClicked)
			editMenu.append(enableAllItem)
			self.mbarEnableAllItem = enableAllItem
			##
			disableAllItem = MenuItem(_("Disable All Groups"))
			disableAllItem.connect("activate", self.disableAllClicked)
			editMenu.append(disableAllItem)
			self.mbarDisableAllItem = disableAllItem
		####
		viewItem = MenuItem(_("_View"))
		viewMenu = gtk.Menu()
		viewItem.set_submenu(viewMenu)
		menubar.append(viewItem)
		##
		collapseItem = MenuItem(_("Collapse All"))
		collapseItem.connect("activate", self.collapseAllClicked)
		viewMenu.append(collapseItem)
		##
		expandItem = MenuItem(_("Expand All"))
		expandItem.connect("activate", self.expandAllClicked)
		viewMenu.append(expandItem)
		##
		viewMenu.append(gtk.SeparatorMenuItem())
		##
		self.showDescItem = gtk.CheckMenuItem(_("Show _Description"))
		self.showDescItem.set_use_underline(True)
		self.showDescItem.set_active(ui.eventManShowDescription)
		self.showDescItem.connect("toggled", self.showDescItemToggled)
		viewMenu.append(self.showDescItem)
		####
		#testItem = MenuItem(_("Test"))
		#testMenu = gtk.Menu()
		#testItem.set_submenu(testMenu)
		#menubar.append(testItem)
		###
		#item = MenuItem("")
		#item.connect("activate", )
		#testMenu.append(item)
		####
		menubar.show_all()
		pack(self.vbox, menubar)
		#######
		treeBox = gtk.HBox()
		#####
		self.treev = gtk.TreeView()
		self.treev.set_search_column(2)
		#self.treev.set_headers_visible(False)## FIXME
		#self.treev.get_selection().set_mode(gtk.SelectionMode.MULTIPLE)## FIXME
		#self.treev.set_rubber_banding(gtk.SelectionMode.MULTIPLE)## FIXME
		#self.treev.connect("realize", self.onTreeviewRealize)
		self.treev.get_selection().connect(
			"changed",
			self.treeviewCursorChanged,
		)  # FIXME
		self.treev.connect("button-press-event", self.treeviewButtonPress)
		self.treev.connect("row-activated", self.rowActivated)
		self.treev.connect("key-press-event", self.keyPress)
		#####
		swin = gtk.ScrolledWindow()
		swin.add(self.treev)
		swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
		pack(treeBox, swin, 1, 1)
		###
		toolbar = gtk.Toolbar()
		toolbar.set_orientation(gtk.Orientation.VERTICAL)
		size = gtk.IconSize.SMALL_TOOLBAR
		###
		tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
		set_tooltip(tb, _("Move up"))
		tb.connect("clicked", self.moveUpByButton)
		toolbar.insert(tb, -1)
		###
		tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
		set_tooltip(tb, _("Move down"))
		tb.connect("clicked", self.moveDownByButton)
		toolbar.insert(tb, -1)
		###
		tb = toolButtonFromStock(gtk.STOCK_COPY, size)
		set_tooltip(tb, _("Duplicate"))
		tb.connect("clicked", self.duplicateSelectedObj)
		toolbar.insert(tb, -1)
		###
		pack(treeBox, toolbar)
		#####
		pack(self.vbox, treeBox, 1, 1)
		#######
		self.trees = gtk.TreeStore(int, GdkPixbuf.Pixbuf, str, str)
		## event: eid,  event_icon,   event_summary, event_description
		## group: gid,  group_pixbuf, group_title,   ?description
		## trash: -1,        trash_icon,   _("Trash"),    ""
		self.treev.set_model(self.trees)
		###
		col = gtk.TreeViewColumn()
		cell = gtk.CellRendererPixbuf()
		pack(col, cell)
		col.add_attribute(cell, "pixbuf", 1)
		col.set_property("expand", False)
		self.treev.append_column(col)
		self.pixbufCol = col
		###
		col = gtk.TreeViewColumn(
			_("Summary"),
			gtk.CellRendererText(),
			text=2,
		)
		col.set_resizable(True)
		col.set_property("expand", True)
		self.treev.append_column(col)
		###
		self.colDesc = gtk.TreeViewColumn(
			_("Description"),
			gtk.CellRendererText(),
			text=3,
		)
		self.colDesc.set_property("expand", True)
		if ui.eventManShowDescription:
			self.treev.append_column(self.colDesc)
		###
		#self.treev.set_search_column(2)## or 3
		###
		self.toPasteEvent = None ## (treeIter, bool move)
		#####
		self.sbar = gtk.Statusbar()
		self.sbar.set_direction(gtk.TextDirection.LTR)
		#self.sbar.set_has_resize_grip(False)
		pack(self.vbox, self.sbar)
		#####
		self.vbox.show_all()
示例#42
0
 def __init__(self, widget, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Customize'))
     #self.set_has_separator(False)## not in gtk3
     self.connect('delete-event', self.close)
     dialog_add_button(self, gtk.STOCK_CLOSE, _('_Close'), 0, self.close)
     ###
     self._widget = widget
     self.activeOptionsWidget = None
     ###
     self.model = gtk.TreeStore(bool, str) ## (GdkPixbuf.Pixbuf, str)
     treev = self.treev = gtk.TreeView(self.model)
     ##
     treev.set_enable_tree_lines(True)
     treev.set_headers_visible(False)
     treev.connect('row-activated', self.rowActivated)
     ##
     col = gtk.TreeViewColumn('Widget')
     ##
     cell = gtk.CellRendererToggle()
     cell.connect('toggled', self.enableCellToggled)
     pack(col, cell)
     col.add_attribute(cell, 'active', 0)
     col.set_property('expand', False)
     ##
     treev.append_column(col)
     col = gtk.TreeViewColumn('Widget')
     col.set_property('expand', False)
     ##
     cell = gtk.CellRendererText()
     pack(col, cell)
     col.add_attribute(cell, 'text', 1)
     col.set_property('expand', True)
     ##
     treev.append_column(col)
     ###
     for item in widget.items:
         if item.customizable:
             self.appendItemTree(item, None)
     ###
     hbox = gtk.HBox()
     vbox_l = gtk.VBox()
     pack(vbox_l, treev, 1, 1)
     pack(hbox, vbox_l, 1, 1)
     ###
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.Orientation.VERTICAL)
     size = gtk.IconSize.SMALL_TOOLBAR
     toolbar.set_icon_size(size)
     ## argument2 to image_new_from_stock does not affect
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
     set_tooltip(tb, _('Move up'))
     tb.connect('clicked', self.upClicked)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
     set_tooltip(tb, _('Move down'))
     tb.connect('clicked', self.downClicked)
     toolbar.insert(tb, -1)
     ###
     pack(hbox, toolbar)
     pack(self.vbox, hbox, 1, 1)
     self.vbox_l = vbox_l
     ###
     self.vbox.connect('size-allocate', self.vboxSizeRequest)
     self.vbox.show_all()
     treev.get_selection().connect('changed', self.treevCursorChanged)
示例#43
0
文件: history.py 项目: ilius/starcal
    def __init__(self, event, **kwargs):
        checkEventsReadOnly()
        gtk.Dialog.__init__(self, **kwargs)
        self.set_title(_("History") + ": " + event.summary)
        self.event = event
        self.objectCache = {}  # hash(str) -> data(dict)

        dialog_add_button(
            self,
            gtk.STOCK_CLOSE,
            _("_Close"),
            gtk.ResponseType.OK,
        )

        self.connect("response", self.onResponse)

        treev = gtk.TreeView()
        treev.set_headers_clickable(True)
        trees = gtk.ListStore(
            str,  # hashBefore (hidden)
            str,  # hashAfter (hidden)
            str,  # formatted date & time
            str,  # change msg (names or the number of changed params)
        )
        treev.set_model(trees)
        treev.connect("cursor-changed", self.treeviewCursorChanged)
        # treev.connect("button-press-event", self.treeviewCursorChanged)
        # FIXME: what is the signal for deselecting / unselecting a row?
        self.trees = trees
        self.treev = treev

        treevSwin = gtk.ScrolledWindow()
        treevSwin.add(treev)
        treevSwin.set_policy(
            gtk.PolicyType.AUTOMATIC,
            gtk.PolicyType.AUTOMATIC,
        )

        hpan = gtk.HPaned()
        hpan.add1(treevSwin)
        leftVbox = gtk.VBox()
        hpan.add2(leftVbox)
        hpan.set_position(600)
        pack(self.vbox, hpan, expand=True, fill=True)

        actionBox = gtk.VBox(spacing=5)
        pack(leftVbox, actionBox, padding=30)

        # revertButton = gtk.Button()
        # revertButton.set_label(_("Revert this vhange"))
        # revertButton.set_image(gtk.Image.new_from_stock(
        # 	gtk.STOCK_UNDO,
        # 	gtk.IconSize.BUTTON,
        # ))
        # revertButton.connect("clicked", self.revertClicked)
        # pack(actionBox, revertButton, padding=1)
        # self.revertButton = revertButton

        checkoutAfterButton = gtk.Button()
        checkoutAfterButton.set_label(_("Select revision after this change"))
        checkoutAfterButton.set_image(
            gtk.Image.new_from_stock(
                gtk.STOCK_UNDO,
                gtk.IconSize.BUTTON,
            ))
        checkoutAfterButton.connect("clicked", self.checkoutAfterClicked)
        pack(actionBox, checkoutAfterButton, padding=1)
        self.checkoutAfterButton = checkoutAfterButton

        checkoutBeforeButton = gtk.Button()
        checkoutBeforeButton.set_label(_("Select revision before this change"))
        checkoutBeforeButton.set_image(
            gtk.Image.new_from_stock(
                gtk.STOCK_UNDO,
                gtk.IconSize.BUTTON,
            ))
        checkoutBeforeButton.connect("clicked", self.checkoutBeforeClicked)
        pack(actionBox, checkoutBeforeButton, padding=1)
        self.checkoutBeforeButton = checkoutBeforeButton

        self.setButtonsSensitive(False)

        combo = gtk.ComboBoxText()
        for text in self.textViewTypes:
            combo.append_text(_(text))
        combo.set_active(1)
        combo.connect("changed", self.viewTypeComboChanged)
        self.viewTypeCombo = combo

        textTypeHbox = gtk.HBox()
        pack(textTypeHbox, gtk.Label(_("View type") + ": "))
        pack(textTypeHbox, self.viewTypeCombo)
        pack(leftVbox, textTypeHbox)

        self.textview = ReadOnlyTextView()
        self.textview.set_wrap_mode(gtk.WrapMode.NONE)
        self.textview.set_justification(gtk.Justification.LEFT)
        self.textbuff = self.textview.get_buffer()

        cmpTreev = gtk.TreeView()
        cmpTreev.set_headers_clickable(True)
        cmpTrees = gtk.ListStore(
            str,  # change symbol ("M", "+", "-", "")
            str,  # key
            str,  # old value
            str,  # new value
        )
        cmpTreev.set_model(cmpTrees)
        # cmpTreev.connect("cursor-changed", self.cmpTreeviewCursorChanged)
        self.cmpTrees = cmpTrees
        self.cmpTreev = cmpTreev

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn("", cell, text=0)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Key"), cell, text=1)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Old Value"), cell, text=2)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("New Value"), cell, text=3)
        col.set_resizable(True)
        cmpTreev.append_column(col)

        leftSwin = gtk.ScrolledWindow()
        leftSwin.set_policy(
            gtk.PolicyType.AUTOMATIC,
            gtk.PolicyType.AUTOMATIC,
        )
        pack(leftVbox, leftSwin, expand=True, fill=True)
        self.leftSwin = leftSwin

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Time"), cell, text=2)
        treev.append_column(col)

        cell = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Change Summary"), cell, text=3)
        treev.append_column(col)
        col.set_property("expand", True)

        self.load()
        self.vbox.show_all()
        self.resize(ud.screenW, ud.screenH * 0.9)  # FIXME
示例#44
0
	def __init__(self, container, **kwargs):
		from scal3.ui_gtk.mywidgets.tz_combo import TimeZoneComboBoxEntry
		self._container = container
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Bulk Edit Events"))
		####
		dialog_add_button(
			self,
			gtk.STOCK_CANCEL,
			_("_Cancel"),
			gtk.ResponseType.CANCEL,
		)
		dialog_add_button(
			self,
			gtk.STOCK_OK,
			_("_OK"),
			gtk.ResponseType.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.ComboBoxText()
		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.ComboBoxText()
		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.ComboBoxText()
		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()
		####
		window_set_size_aspect(self, 1.6)
示例#45
0
 def __init__(self, **kwargs):
     gtk.Dialog.__init__(self, **kwargs)
     self.set_title(_('Tune Hijri Monthes'))
     self.connect('delete-event', self.onDeleteEvent)
     ############
     self.altMode = 0
     self.altModeDesc = 'Gregorian'
     ############
     hbox = gtk.HBox()
     self.topLabel = gtk.Label()
     pack(hbox, self.topLabel)
     self.startDateInput = DateButton()
     self.startDateInput.set_editable(False)## FIXME
     self.startDateInput.connect('changed', lambda widget: self.updateEndDates())
     pack(hbox, self.startDateInput)
     pack(self.vbox, hbox)
     ############################
     treev = gtk.TreeView()
     trees = gtk.ListStore(int, str, str, int, str)## ym, yearShown, monthShown, monthLenCombo, endDateShown
     treev.set_model(trees)
     #treev.get_selection().connect('changed', self.plugTreevCursorChanged)
     #treev.connect('row-activated', self.plugTreevRActivate)
     #treev.connect('button-press-event', self.plugTreevButtonPress)
     ###
     swin = gtk.ScrolledWindow()
     swin.add(treev)
     swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Year'), cell, text=1)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('Month'), cell, text=2)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererCombo()
     mLenModel = gtk.ListStore(int)
     mLenModel.append([29])
     mLenModel.append([30])
     cell.set_property('model', mLenModel)
     #cell.set_property('has-entry', False)
     cell.set_property('editable', True)
     cell.set_property('text-column', 0)
     cell.connect('edited', self.monthLenCellEdited)
     col = gtk.TreeViewColumn(_('Month Length'), cell, text=3)
     treev.append_column(col)
     ######
     cell = gtk.CellRendererText()
     col = gtk.TreeViewColumn(_('End Date'), cell, text=4)
     treev.append_column(col)
     ######
     toolbar = gtk.Toolbar()
     toolbar.set_orientation(gtk.Orientation.VERTICAL)
     size = gtk.IconSize.SMALL_TOOLBAR
     ###
     tb = toolButtonFromStock(gtk.STOCK_ADD, size)
     set_tooltip(tb, _('Add'))
     tb.connect('clicked', self.addClicked)
     toolbar.insert(tb, -1)
     ###
     tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
     set_tooltip(tb, _('Delete'))
     tb.connect('clicked', self.delClicked)
     toolbar.insert(tb, -1)
     ######
     self.treev = treev
     self.trees = trees
     #####
     mainHbox = gtk.HBox()
     pack(mainHbox, swin, 1, 1)
     pack(mainHbox, toolbar)
     pack(self.vbox, mainHbox, 1, 1)
     ######
     dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
     dialog_add_button(self, gtk.STOCK_CANCEL, _('_Cancel'), gtk.ResponseType.CANCEL)
     ##
     resetB = self.add_button(gtk.STOCK_UNDO, gtk.ResponseType.NONE)
     resetB.set_label(_('_Reset to Defaults'))
     resetB.set_image(gtk.Image.new_from_stock(gtk.STOCK_UNDO, gtk.IconSize.BUTTON))
     resetB.connect('clicked', self.resetToDefaults)
     ##
     self.connect('response', self.onResponse)
     #print(dir(self.get_action_area()))
     #self.get_action_area().set_homogeneous(False)
     ######
     self.vbox.show_all()
示例#46
0
文件: history.py 项目: ilius/starcal
	def __init__(
		self,
		event,
		**kwargs
	):
		checkEventsReadOnly()
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("History") + ": " + event.summary)
		self.event = event
		self.objectCache = {} # hash(str) -> data(dict)

		dialog_add_button(
			self,
			gtk.STOCK_CLOSE,
			_("_Close"),
			gtk.ResponseType.OK,
		)

		self.connect("response", self.onResponse)

		treev = gtk.TreeView()
		treev.set_headers_clickable(True)
		trees = gtk.ListStore(
			str, # hashBefore (hidden)
			str, # hashAfter (hidden)
			str, # formatted date & time
			str, # change msg (names or the number of changed params)
		)
		treev.set_model(trees)
		treev.connect("cursor-changed", self.treeviewCursorChanged)
		# treev.connect("button-press-event", self.treeviewCursorChanged)
		# FIXME: what is the signal for deselecting / unselecting a row?
		self.trees = trees
		self.treev = treev

		treevSwin = gtk.ScrolledWindow()
		treevSwin.add(treev)
		treevSwin.set_policy(
			gtk.PolicyType.AUTOMATIC,
			gtk.PolicyType.AUTOMATIC,
		)

		hpan = gtk.HPaned()
		hpan.add1(treevSwin)
		leftVbox = gtk.VBox()
		hpan.add2(leftVbox)
		hpan.set_position(600)
		pack(self.vbox, hpan, expand=True, fill=True)

		actionBox = gtk.VBox(spacing=5)
		pack(leftVbox, actionBox, padding=30)

		# revertButton = gtk.Button()
		# revertButton.set_label(_("Revert this vhange"))
		# revertButton.set_image(gtk.Image.new_from_stock(
		# 	gtk.STOCK_UNDO,
		# 	gtk.IconSize.BUTTON,
		# ))
		# revertButton.connect("clicked", self.revertClicked)
		# pack(actionBox, revertButton, padding=1)
		# self.revertButton = revertButton

		checkoutAfterButton = gtk.Button()
		checkoutAfterButton.set_label(_("Select revision after this change"))
		checkoutAfterButton.set_image(gtk.Image.new_from_stock(
			gtk.STOCK_UNDO,
			gtk.IconSize.BUTTON,
		))
		checkoutAfterButton.connect("clicked", self.checkoutAfterClicked)
		pack(actionBox, checkoutAfterButton, padding=1)
		self.checkoutAfterButton = checkoutAfterButton

		checkoutBeforeButton = gtk.Button()
		checkoutBeforeButton.set_label(_("Select revision before this change"))
		checkoutBeforeButton.set_image(gtk.Image.new_from_stock(
			gtk.STOCK_UNDO,
			gtk.IconSize.BUTTON,
		))
		checkoutBeforeButton.connect("clicked", self.checkoutBeforeClicked)
		pack(actionBox, checkoutBeforeButton, padding=1)
		self.checkoutBeforeButton = checkoutBeforeButton

		self.setButtonsSensitive(False)

		combo = gtk.ComboBoxText()
		for text in self.textViewTypes:
			combo.append_text(_(text))
		combo.set_active(1)
		combo.connect("changed", self.viewTypeComboChanged)
		self.viewTypeCombo = combo

		textTypeHbox = gtk.HBox()
		pack(textTypeHbox, gtk.Label(_("View type")+": "))
		pack(textTypeHbox, self.viewTypeCombo)
		pack(leftVbox, textTypeHbox)

		self.textview = ReadOnlyTextView()
		self.textview.set_wrap_mode(gtk.WrapMode.NONE)
		self.textview.set_justification(gtk.Justification.LEFT)
		self.textbuff = self.textview.get_buffer()

		cmpTreev = gtk.TreeView()
		cmpTreev.set_headers_clickable(True)
		cmpTrees = gtk.ListStore(
			str, # change symbol ("M", "+", "-", "")
			str, # key
			str, # old value
			str, # new value
		)
		cmpTreev.set_model(cmpTrees)
		# cmpTreev.connect("cursor-changed", self.cmpTreeviewCursorChanged)
		self.cmpTrees = cmpTrees
		self.cmpTreev = cmpTreev

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn("", cell, text=0)
		col.set_resizable(True)
		cmpTreev.append_column(col)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Key"), cell, text=1)
		col.set_resizable(True)
		cmpTreev.append_column(col)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Old Value"), cell, text=2)
		col.set_resizable(True)
		cmpTreev.append_column(col)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("New Value"), cell, text=3)
		col.set_resizable(True)
		cmpTreev.append_column(col)

		leftSwin = gtk.ScrolledWindow()
		leftSwin.set_policy(
			gtk.PolicyType.AUTOMATIC,
			gtk.PolicyType.AUTOMATIC,
		)
		pack(leftVbox, leftSwin, expand=True, fill=True)
		self.leftSwin = leftSwin

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Time"), cell, text=2)
		treev.append_column(col)

		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Change Summary"), cell, text=3)
		treev.append_column(col)
		col.set_property("expand", True)

		self.load()
		self.vbox.show_all()
		self.resize(ud.screenW, ud.screenH*0.9) # FIXME
示例#47
0
文件: hijri.py 项目: ilius/starcal
	def __init__(self, **kwargs):
		gtk.Dialog.__init__(self, **kwargs)
		self.set_title(_("Tune Hijri Monthes"))
		self.connect("delete-event", self.onDeleteEvent)
		############
		self.altMode = 0
		self.altModeDesc = "Gregorian"
		############
		hbox = gtk.HBox()
		self.topLabel = gtk.Label()
		pack(hbox, self.topLabel)
		self.startDateInput = DateButton()
		self.startDateInput.set_editable(False)## FIXME
		self.startDateInput.connect("changed", lambda widget: self.updateEndDates())
		pack(hbox, self.startDateInput)
		pack(self.vbox, hbox)
		############################
		treev = gtk.TreeView()
		trees = gtk.ListStore(
			int,  # ym (hidden)
			str,  # localized year
			str,  # localized month
			int,  # monthLenCombo
			str,  # localized endDate
		)
		treev.set_model(trees)
		#treev.get_selection().connect("changed", self.plugTreevCursorChanged)
		#treev.connect("row-activated", self.plugTreevRActivate)
		#treev.connect("button-press-event", self.plugTreevButtonPress)
		###
		swin = gtk.ScrolledWindow()
		swin.add(treev)
		swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
		######
		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Year"), cell, text=1)
		treev.append_column(col)
		######
		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("Month"), cell, text=2)
		treev.append_column(col)
		######
		cell = gtk.CellRendererCombo()
		mLenModel = gtk.ListStore(int)
		mLenModel.append([29])
		mLenModel.append([30])
		cell.set_property("model", mLenModel)
		#cell.set_property("has-entry", False)
		cell.set_property("editable", True)
		cell.set_property("text-column", 0)
		cell.connect("edited", self.monthLenCellEdited)
		col = gtk.TreeViewColumn(_("Month Length"), cell, text=3)
		treev.append_column(col)
		######
		cell = gtk.CellRendererText()
		col = gtk.TreeViewColumn(_("End Date"), cell, text=4)
		treev.append_column(col)
		######
		toolbar = gtk.Toolbar()
		toolbar.set_orientation(gtk.Orientation.VERTICAL)
		size = gtk.IconSize.SMALL_TOOLBAR
		###
		tb = toolButtonFromStock(gtk.STOCK_ADD, size)
		set_tooltip(tb, _("Add"))
		tb.connect("clicked", self.addClicked)
		toolbar.insert(tb, -1)
		###
		tb = toolButtonFromStock(gtk.STOCK_DELETE, size)
		set_tooltip(tb, _("Delete"))
		tb.connect("clicked", self.delClicked)
		toolbar.insert(tb, -1)
		######
		self.treev = treev
		self.trees = trees
		#####
		mainHbox = gtk.HBox()
		pack(mainHbox, swin, 1, 1)
		pack(mainHbox, toolbar)
		pack(self.vbox, mainHbox, 1, 1)
		######
		dialog_add_button(
			self,
			gtk.STOCK_OK,
			_("_OK"),
			gtk.ResponseType.OK,
		)
		dialog_add_button(
			self,
			gtk.STOCK_CANCEL,
			_("_Cancel"),
			gtk.ResponseType.CANCEL,
		)
		##
		resetB = self.add_button(
			gtk.STOCK_UNDO,
			gtk.ResponseType.NONE,
		)
		resetB.set_label(_("_Reset to Defaults"))
		resetB.set_image(gtk.Image.new_from_stock(
			gtk.STOCK_UNDO,
			gtk.IconSize.BUTTON,
		))
		resetB.connect("clicked", self.resetToDefaults)
		##
		self.connect("response", self.onResponse)
		#print(dir(self.get_action_area()))
		#self.get_action_area().set_homogeneous(False)
		######
		self.vbox.show_all()
示例#48
0
	def __init__(self, **kwargs):
		checkEventsReadOnly() ## FIXME
		gtk.Dialog.__init__(self, **kwargs)
		self.initVars()
		ud.windowList.appendItem(self)
		####
		self.syncing = None ## or a tuple of (groupId, statusText)
		self.groupIterById = {}
		self.trashIter = None
		self.isLoaded = False
		self.loadedGroupIds = set()
		self.eventsIter = {}
		####
		self.set_title(_('Event Manager'))
		self.resize(600, 300)
		self.connect('delete-event', self.onDeleteEvent)
		self.set_transient_for(None)
		self.set_type_hint(gdk.WindowTypeHint.NORMAL)
		##
		dialog_add_button(self, gtk.STOCK_OK, _('_OK'), gtk.ResponseType.OK)
		#self.connect('response', lambda w, e: self.hide())
		self.connect('response', self.onResponse)
		self.connect('show', self.onShow)
		#######
		self.searchWin = EventSearchWindow()
		#######
		menubar = gtk.MenuBar()
		####
		fileItem = MenuItem(_('_File'))
		fileMenu = gtk.Menu()
		fileItem.set_submenu(fileMenu)
		menubar.append(fileItem)
		##
		addGroupItem = MenuItem(_('Add New Group'))
		addGroupItem.set_sensitive(not event_lib.readOnly)
		addGroupItem.connect('activate', self.addGroupBeforeSelection)
		## or before selected group? FIXME
		fileMenu.append(addGroupItem)
		##
		searchItem = MenuItem(_('_Search Events'))## FIXME right place?
		searchItem.connect('activate', self.mbarSearchClicked)
		fileMenu.append(searchItem)
		##
		exportItem = MenuItem(_('_Export'))
		exportItem.connect('activate', self.mbarExportClicked)
		fileMenu.append(exportItem)
		##
		importItem = MenuItem(_('_Import'))
		importItem.set_sensitive(not event_lib.readOnly)
		importItem.connect('activate', self.mbarImportClicked)
		fileMenu.append(importItem)
		##
		orphanItem = MenuItem(_('Check for Orphan Events'))
		orphanItem.set_sensitive(not event_lib.readOnly)
		orphanItem.connect('activate', self.mbarOrphanClicked)
		fileMenu.append(orphanItem)
		####
		editItem = MenuItem(_('_Edit'))
		if event_lib.readOnly:
			editItem.set_sensitive(False)
		else:
			editMenu = gtk.Menu()
			editItem.set_submenu(editMenu)
			menubar.append(editItem)
			##
			editEditItem = MenuItem(_('Edit'))
			editEditItem.connect('activate', self.mbarEditClicked)
			editMenu.append(editEditItem)
			editMenu.connect('show', self.mbarEditMenuPopup)
			self.mbarEditItem = editEditItem
			##
			editMenu.append(gtk.SeparatorMenuItem())
			##
			cutItem = MenuItem(_('Cu_t'))
			cutItem.connect('activate', self.mbarCutClicked)
			editMenu.append(cutItem)
			self.mbarCutItem = cutItem
			##
			copyItem = MenuItem(_('_Copy'))
			copyItem.connect('activate', self.mbarCopyClicked)
			editMenu.append(copyItem)
			self.mbarCopyItem = copyItem
			##
			pasteItem = MenuItem(_('_Paste'))
			pasteItem.connect('activate', self.mbarPasteClicked)
			editMenu.append(pasteItem)
			self.mbarPasteItem = pasteItem
			##
			editMenu.append(gtk.SeparatorMenuItem())
			##
			dupItem = MenuItem(_('_Duplicate'))
			dupItem.connect('activate', self.duplicateSelectedObj)
			editMenu.append(dupItem)
			self.mbarDupItem = dupItem
		####
		viewItem = MenuItem(_('_View'))
		viewMenu = gtk.Menu()
		viewItem.set_submenu(viewMenu)
		menubar.append(viewItem)
		##
		collapseItem = MenuItem(_('Collapse All'))
		collapseItem.connect('activate', self.collapseAllClicked)
		viewMenu.append(collapseItem)
		##
		expandItem = MenuItem(_('Expand All'))
		expandItem.connect('activate', self.expandAllClicked)
		viewMenu.append(expandItem)
		##
		viewMenu.append(gtk.SeparatorMenuItem())
		##
		self.showDescItem = gtk.CheckMenuItem(_('Show _Description'))
		self.showDescItem.set_active(ui.eventManShowDescription)
		self.showDescItem.connect('toggled', self.showDescItemToggled)
		viewMenu.append(self.showDescItem)
		####
		#testItem = MenuItem(_('Test'))
		#testMenu = gtk.Menu()
		#testItem.set_submenu(testMenu)
		#menubar.append(testItem)
		###
		#item = MenuItem('')
		#item.connect('activate', )
		#testMenu.append(item)
		####
		menubar.show_all()
		pack(self.vbox, menubar)
		#######
		treeBox = gtk.HBox()
		#####
		self.treev = gtk.TreeView()
		self.treev.set_search_column(2)
		#self.treev.set_headers_visible(False)## FIXME
		#self.treev.get_selection().set_mode(gtk.SelectionMode.MULTIPLE)## FIXME
		#self.treev.set_rubber_banding(gtk.SelectionMode.MULTIPLE)## FIXME
		#self.treev.connect('realize', self.onTreeviewRealize)
		self.treev.get_selection().connect('changed', self.treeviewCursorChanged)## FIXME
		self.treev.connect('button-press-event', self.treeviewButtonPress)
		self.treev.connect('row-activated', self.rowActivated)
		self.treev.connect('key-press-event', self.keyPress)
		#####
		swin = gtk.ScrolledWindow()
		swin.add(self.treev)
		swin.set_policy(gtk.PolicyType.AUTOMATIC, gtk.PolicyType.AUTOMATIC)
		pack(treeBox, swin, 1, 1)
		###
		toolbar = gtk.Toolbar()
		toolbar.set_orientation(gtk.Orientation.VERTICAL)
		size = gtk.IconSize.SMALL_TOOLBAR
		###
		tb = toolButtonFromStock(gtk.STOCK_GO_UP, size)
		set_tooltip(tb, _('Move up'))
		tb.connect('clicked', self.moveUpByButton)
		toolbar.insert(tb, -1)
		###
		tb = toolButtonFromStock(gtk.STOCK_GO_DOWN, size)
		set_tooltip(tb, _('Move down'))
		tb.connect('clicked', self.moveDownByButton)
		toolbar.insert(tb, -1)
		###
		tb = toolButtonFromStock(gtk.STOCK_COPY, size)
		set_tooltip(tb, _('Duplicate'))
		tb.connect('clicked', self.duplicateSelectedObj)
		toolbar.insert(tb, -1)
		###
		pack(treeBox, toolbar)
		#####
		pack(self.vbox, treeBox, 1, 1)
		#######
		self.trees = gtk.TreeStore(int, GdkPixbuf.Pixbuf, str, str)
		## event: eid,  event_icon,   event_summary, event_description
		## group: gid,  group_pixbuf, group_title,   ?description
		## trash: -1,        trash_icon,   _('Trash'),    ''
		self.treev.set_model(self.trees)
		###
		col = gtk.TreeViewColumn()
		cell = gtk.CellRendererPixbuf()
		pack(col, cell)
		col.add_attribute(cell, 'pixbuf', 1)
		col.set_property('expand', False)
		self.treev.append_column(col)
		###
		col = gtk.TreeViewColumn(
			_('Summary'),
			gtk.CellRendererText(),
			text=2,
		)
		col.set_resizable(True)
		col.set_property('expand', True)
		self.treev.append_column(col)
		###
		self.colDesc = gtk.TreeViewColumn(
			_('Description'),
			gtk.CellRendererText(),
			text=3,
		)
		self.colDesc.set_property('expand', True)
		if ui.eventManShowDescription:
			self.treev.append_column(self.colDesc)
		###
		#self.treev.set_search_column(2)## or 3
		###
		self.toPasteEvent = None ## (path, bool move)
		#####
		self.sbar = gtk.Statusbar()
		self.sbar.set_direction(gtk.TextDirection.LTR)
		#self.sbar.set_has_resize_grip(False)
		pack(self.vbox, self.sbar)
		#####
		self.vbox.show_all()