예제 #1
0
    def readValue(self, itemReader, offset, data, withSchema, view, name,
                  afterLoadHooks):

        type = data[offset]

        if type == LSTRING:
            project, catalog_name, msgid = data[offset + 1:offset + 4]
            return offset + 4, MessageFactory(project, catalog_name)(msgid)
        else:
            value = data[offset + 1]
            return offset + 2, value
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.


import wx
from i18n import MessageFactory

_ = MessageFactory("Chandler-EVDBPlugin")

# Fields in the Date: drop-down. Values can be handed off
# the evdb module to run queries (with the exception of "This month".
_DATES = ["All", "Future", "Past", "Today", "Last Week", "This Week", "Next week", "This month"]

# Localized names for the above.
_DATE_NAMES = [
    _(u"All"),
    _(u"Future"),
    _(u"Past"),
    _(u"Today"),
    _(u"Last Week"),
    _(u"This Week"),
    _(u"Next Week"),
    _(u"This Month")
예제 #3
0
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import wx, webbrowser

from flickr import setLicense
from application import Utility, Globals
from i18n import MessageFactory
from osaf.startup import PeriodicTask

LICENSE_URL = "http://www.flickr.com/services/api/misc.api_keys.html"
PLUGIN_NAME = "Chandler-FlickrPlugin"
_ = MessageFactory(PLUGIN_NAME)


class LicenseTask(PeriodicTask):

    # target is periodic task
    def getTarget(self):
        return self

    # target is already constructed as self
    def __call__(self, periodicTask):
        return self

    # target needs no view of its own
    def fork(self):
        return self
예제 #4
0
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.


import logging, wx
from osaf.views import detail
from application import schema, dialogs
import osaf.framework.blocks.Block as Block
from channels import FeedChannel, FeedItem
from i18n import MessageFactory
from osaf import messages
from osaf.pim.structs import SizeType, RectType

_ = MessageFactory("Chandler-FeedsPlugin")

logger = logging.getLogger(__name__)


class FeedItemDetail(detail.HTMLDetailArea):
    """
    This class implements a block for visualizing feed item content.
    """
    def getHTMLText(self, item):
        """
        This method renders the feed item content as HTML.
        """
        # check that we have a valid feed item.
        if item == item.itsView:
            return
예제 #5
0
#   limitations under the License.

import os, md5
import gdata, atom, gdata.calendar.service
from osaf import pim, sharing
from osaf.sharing import NoChange as NC, Inherit
from application import schema
from chandlerdb.util.c import UUID
from application.Utility import getUserAgent
from application.dialogs.AccountPreferences import AccountPanel
from dateutil.parser import parse as dateutilparser
from osaf.pim.calendar.TimeZone import convertToICUtzinfo
from osaf.framework.twisted import waitForDeferred
from itertools import chain
from i18n import MessageFactory
_ = MessageFactory("Chandler-gdataPlugin")

import logging
logger = logging.getLogger(__name__)

__all__ = [
    'GDataAccount',
    'GDataConduit',
    'GDataState',
    'GDataTranslator',
    'GDataAccountRecord',
    'GDataConduitRecord',
    'GDataStateRecord',
]

예제 #6
0
#   limitations under the License.

import wx

from application import schema, dialogs
from i18n import MessageFactory
from osaf.framework.blocks.Block import Block
from osaf.framework.blocks import BlockEvent, ChoiceEvent, MenuItem, Menu

from debug.generate import GenerateAllItems
from debug.GenerateItemsFromFile import GenerateItems
from debug.mail import loadMailTests
from wx import xrc
import debug.generate_dialog.ItemGenerator as itemGenerator

_ = MessageFactory("Chandler-debugPlugin")


class TestMenuHandler(Block):

    def setStatusMessage(self, msg):
        Block.findBlockByName('StatusBar').setStatusMessage(msg)

    def on_debug_GenerateDataEvent(self, event):
        # triggered from "Tools | Test | Generate Data" and
        #                "Tools | Test | Generate Lots of Data" menu items

        if event.arguments['sender'].blockName == '_debug_GenerateMuchDataItem':
            count = 100
        else:
            count = 4
예제 #7
0
__parcel__ = "photos"

import urllib2, time, cStringIO, logging, mimetypes
from datetime import datetime
from osaf import pim
from chandlerdb.util.URL import URL
from application import schema
import EXIF
from i18n import MessageFactory
from osaf.framework.blocks import NewItemEvent
import application.dialogs.Util
import wx
import os

_ = MessageFactory("Chandler-PhotoPlugin")

logger = logging.getLogger(__name__)


class PhotoMixin(pim.ContentItem):
    dateTaken = schema.One(schema.DateTimeTZ)
    file = schema.One(schema.Text)
    exif = schema.Mapping(schema.Text, initialValue={})
    photoBody = schema.One(schema.Lob)

    @schema.observer(photoBody)
    def onPhotoBodyChanged(self, op, attribute):
        self.processEXIF()

    schema.addClouds(sharing=schema.Cloud(literal=[dateTaken, photoBody]))
예제 #8
0
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import wx

from application import schema
from osaf.framework.blocks.Block import Block
from osaf.pim.mail import SMTPAccount, IMAPAccount
from i18n import MessageFactory

from p2p.account import findAccounts, findDefaultAccounts, findLoggedInAccounts
from p2p.mail import MailAccount
from chandlerdb.item.Access import ACL, ACE, Permissions

_ = MessageFactory("Chandler-p2pPlugin")
PROTOCOLS = ['jabber']
PROTOCOL_NAMES = [_(u"Jabber")]


def setStatusMessage(msg):
    wx.GetApp().CallItemMethodAsync("MainView", 'setStatusMessage', msg)


class SubscribeDialog(wx.Dialog):
    def __init__(self):

        # Instead of calling wx.Dialog.__init__ we precreate the dialog
        # so we can set an extra style that must be set before
        # creation, and then we create the GUI dialog using the Create
        # method.
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

__parcel__ = "amazon"

from application import schema
import AmazonKinds
import osaf.framework.blocks.Block as Block
import osaf.views.detail as Detail
from i18n import MessageFactory

_ = MessageFactory("Chandler-AmazonPlugin")


class AmazonController(Block.Block):
    def onNewAmazonCollectionEvent(self, event):
        """
        Called when a NewAmazonCollection Search by Keyword Event is triggered.

        @type event: BlockEvent
        @param event: The BlockEvent triggered on NewAmazonCollection command

        @rtype: AmazonCollection or C{None}
        @return: AmazonCollection for the search keyword or C{None}
                 if search results == 0  
        """
        return AmazonKinds.SearchByKeyword(self.itsView)
예제 #10
0
from application import schema
from osaf import pim
from photos import PhotoMixin
from osaf.pim.collections import KindCollection
from chandlerdb.util.URL import URL
from chandlerdb.item.Item import MissingClass
from datetime import datetime, timedelta
from i18n import MessageFactory
from osaf import messages
from osaf.pim.structs import SizeType, RectType
from osaf.framework.blocks import BlockEvent, Menu, MenuItem, AddToSidebarEvent
from osaf.framework.blocks.Block import Block
from osaf.startup import PeriodicTask, fork_item
from osaf.usercollections import UserCollection

_ = MessageFactory("Chandler-FlickrPlugin")


class FlickrPhotoMixin(PhotoMixin):
    """
    A mixin that adds flickr attributes to a Note item
    """
    flickrID = schema.One(schema.Text)
    imageURL = schema.One(schema.URL)
    datePosted = schema.One(schema.DateTime)
    tags = schema.Sequence()
    owner = schema.One(schema.Text, indexed=True)

    schema.addClouds(sharing=schema.Cloud(
        literal=[owner, flickrID, imageURL, tags]))
예제 #11
0
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import os, sys

from application import schema
from i18n import MessageFactory

from osaf.framework.blocks import BlockEvent, MenuItem
from osaf.framework.blocks.Block import Block

from sidebar import sidebar

_ = MessageFactory("Chandler-fusePlugin")
MOUNT_NAME = 'Sidebar'


class fuseHandler(Block):
    def __setup__(self):
        self.onItemLoad(None)

    def onItemLoad(self, view):
        self.setPinned(True)
        self.sidebar = None

    def on_fuse_MountEventUpdateUI(self, event):

        if sys.platform == 'darwin':
            if self.sidebar is not None and self.sidebar.isMounted():
예제 #12
0
from osaf.framework.blocks import DispatchHook, BlockEvent
from osaf.framework.blocks.MenusAndToolbars import MenuItem
from osaf.startup import PeriodicTask, fork_item
from osaf.sharing.WebDAV import ChandlerServerHandle
from zanshin.http import Request
from string import joinfields
from datetime import timedelta
from datetime import datetime
import socket
import re
import logging
import logging.handlers
import os

from i18n import MessageFactory
_ = MessageFactory("Chandler-EventLoggerPlugin")

logger = logging.getLogger(__name__)

logDir = os.path.join(Globals.options.profileDir, 'eventLogger')
logFile = os.path.join(logDir, 'event.log')
logFileMaxSize = 100000  #Bytes
logFileMaxCount = 10  #Max logfiles to keep
logFileVersion = "1.0"  #Version of the logfile


class EventLoggingDispatchHook(DispatchHook):
    """
    Class to handle event dispatches
    """
    logging = schema.One(schema.Boolean, initialValue=False)