示例#1
0
 def save(self, widget=None):
     self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.WATCH))
     while gtk.events_pending():
         gtk.main_iteration_do(False)
     path = self.fcw.get_filename()
     if path in (None, ''):
         return
     print('Exporting to html file "%s"'%path)
     i = self.combo.get_active()
     months = []
     module = calTypes.primaryModule()
     if i==0:
         s = getCurrentMonthStatus()
         months = [s]
         title = '%s %s'%(locale_man.getMonthName(calTypes.primary, s.month, s.year), _(s.year))
     elif i==1:
         for i in range(1, 13):
             months.append(getMonthStatus(ui.cell.year, i))
         title = '%s %s'%(_('Calendar'), _(ui.cell.year))
     elif i==2:
         y0, m0 = self.ymBox0.get_value()
         y1, m1 = self.ymBox1.get_value()
         for ym in range(y0*12+m0-1, y1*12+m1):
             y, m = divmod(ym, 12)
             m += 1
             months.append(getMonthStatus(y, m))
         title = _('Calendar')
     exportToHtml(path, months, title)
     self.get_window().set_cursor(gdk.Cursor.new(gdk.CursorType.LEFT_PTR))
     self.hide()
示例#2
0
	def _save(self, path):
		comboItem = self.combo.get_active()
		months = []
		module = calTypes.primaryModule()
		if comboItem == 0:
			s = getCurrentMonthStatus()
			months = [s]
			title = "%s %s" % (
				locale_man.getMonthName(
					calTypes.primary,
					s.month,
					s.year,
				),
				_(s.year),
			)
		elif comboItem == 1:
			for i in range(1, 13):
				months.append(getMonthStatus(ui.cell.year, i))
			title = "%s %s" % (_("Calendar"), _(ui.cell.year))
		elif comboItem == 2:
			y0, m0 = self.ymBox0.get_value()
			y1, m1 = self.ymBox1.get_value()
			for ym in range(y0 * 12 + m0 - 1, y1 * 12 + m1):
				y, m = divmod(ym, 12)
				m += 1
				months.append(getMonthStatus(y, m))
			title = _("Calendar")
		exportToHtml(path, months, title)
		self.hide()