Пример #1
0
# Also avalable in /usr/share/common-licenses/GPL on Debian systems
# or /usr/share/licenses/common/GPL3/license.txt on ArchLinux

from scal3 import core
from scal3.date_utils import dateEncode, dateDecode
from scal3.locale_man import tr as _
from scal3.locale_man import textNumEncode, textNumDecode
from scal3 import event_lib
from scal3 import ui

from scal3.ui_gtk import *
from scal3.ui_gtk.utils import toolButtonFromStock, set_tooltip

## FIXME
encode = lambda d: textNumEncode(dateEncode(d))
decode = lambda s: dateDecode(textNumDecode(s))
validate = lambda s: encode(decode(s))

class WidgetClass(gtk.HBox):
	def __init__(self, rule):
		self.rule = rule
		gtk.HBox.__init__(self)
		###
		self.countLabel = gtk.Label('')
		pack(self, self.countLabel)
		###
		self.trees = gtk.ListStore(str)
		self.dialog = None
		###
		self.editButton = gtk.Button(_('Edit'))
		self.editButton.set_image(gtk.Image.new_from_stock(gtk.STOCK_EDIT, gtk.IconSize.BUTTON))
Пример #2
0
        newGroupsDict[title] = group
        ui.eventGroups.append(group)
        return group


for line in open('wikipedia-fa.tab'):
    line = line.strip()
    if not line:
        continue
    parts = line.split('\t')
    if len(parts) == 4:
        date_str, category, summary, description = parts
    elif len(parts) == 3:
        date_str, category, summary = parts
        description = ''
    else:
        print('BAD LINE', line)
        continue
    year, month, day = dateDecode(date_str)
    group = getGroupByTitle(groupTitlePrefix + category)
    event = group.createEvent('dailyNote')
    event.setDate(year, month, day)
    event.summary = summary
    event.description = description
    group.append(event)
    event.save()

for group in newGroupsDict.values():
    group.save()
ui.eventGroups.save()
Пример #3
0

for line in open('wikipedia-fa.tab'):
    line = line.strip()
    if not line:
        continue
    parts = line.split('\t')
    if len(parts)==4:
        date_str, category, summary, description = parts
    elif len(parts)==3:
        date_str, category, summary = parts
        description = ''
    else:
        print('BAD LINE', line)
        continue
    year, month, day = dateDecode(date_str)
    group = getGroupByTitle(groupTitlePrefix + category)
    event = group.createEvent('dailyNote')
    event.setDate(year, month, day)
    event.summary = summary
    event.description = description
    group.append(event)
    event.save()


for group in newGroupsDict.values():
    group.save()
ui.eventGroups.save()


Пример #4
0
def decode(s):
    return dateDecode(textNumDecode(s))