Пример #1
0
from scal2 import core
from scal2.locale_man import tr as _
from scal2.locale_man import textNumEncode, textNumDecode
from scal2.date_utils import dateEncode, dateDecode

from scal2 import event_lib
from scal2 import ui

import gtk
from gtk import gdk

from scal2.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 RuleWidget(gtk.HBox):
    def __init__(self, rule):
        self.rule = rule
        gtk.HBox.__init__(self)
        ###
        self.countLabel = gtk.Label('')
        self.pack_start(self.countLabel, 0, 0)
        ###
        self.editButton = gtk.Button(_('Edit'))
        self.editButton.set_image(gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
        self.editButton.connect('clicked', self.showDialog)
        self.pack_start(self.editButton, 0, 0)
        ###
Пример #2
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()


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

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

from scal2.ui_gtk import *
from scal2.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.editButton = gtk.Button(_('Edit'))
        self.editButton.set_image(
            gtk.image_new_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON))
        self.editButton.connect('clicked', self.showDialog)
Пример #4
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()