~ubuntu-branches/ubuntu/precise/ubuntuone-client/precise

« back to all changes in this revision

Viewing changes to ubuntuone/platform/windows/__init__.py

  • Committer: Package Import Robot
  • Author(s): Rodney Dawes
  • Date: 2011-12-21 15:46:25 UTC
  • mfrom: (1.1.56)
  • Revision ID: package-import@ubuntu.com-20111221154625-ujvunri4frsecj2k
Tags: 2.99.0-0ubuntu1
* New upstream release.
  - Verify timestamp to avoid invalid auth failures (LP: #692597)
  - Files in new UDFs not uploaded due to filtering (LP: #869920)
* debian/patches:
  - Remove upstreamed patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ubuntuone.platform.windows - windows platform imports
2
2
#
3
 
# Author: Lucio Torre <lucio.torre@canonical.com>
4
 
#         Manuel de la Pena <manuel@canonical.com>
5
 
#
6
 
# Copyright 2010-11 Canonical Ltd.
 
3
# Copyright 2010-2011 Canonical Ltd.
7
4
#
8
5
# This program is free software: you can redistribute it and/or modify it
9
6
# under the terms of the GNU General Public License version 3, as published
25
22
platform = "win32"
26
23
 
27
24
 
 
25
import constants
 
26
import event_logging
 
27
import filesystem_notifications
 
28
import launcher
 
29
import logger
 
30
import messaging
 
31
import notification
 
32
import os_helper
 
33
import session
 
34
 
28
35
from ubuntuone.platform.windows.os_helper import (
29
36
    access,
30
37
    allow_writes,
36
43
    make_dir,
37
44
    make_link,
38
45
    move_to_trash,
 
46
    native_rename,
39
47
    normpath,
40
48
    open_file,
41
49
    path_exists,
58
66
from ubuntuone.platform.windows import event_logging
59
67
from ubuntuone.platform.windows.logger import (
60
68
    setup_filesystem_logging,
61
 
    get_filesystem_logger)
 
69
    get_filesystem_logger,
 
70
)
62
71
from ubuntuone.platform.windows.filesystem_notifications import (
63
 
    FilesystemMonitor)
64
 
from ubuntuone.platform.windows.notification import Notification
65
 
 
66
 
 
67
 
def is_already_running():
68
 
    """An ugly workaround for circular imports, see bug #817559."""
69
 
    from ubuntuone.platform.windows.ipc import is_already_running
70
 
    return is_already_running()
71
 
 
72
 
 
73
 
class ExternalInterface(object):
74
 
    """An ExternalInterface implemented with a IPC interface."""
75
 
 
76
 
    def __init__(self, main, glib_loop=False, broadcast_events=False,
77
 
                 dbus_iface=None):
78
 
        """Create an instance using the same params as in Linux."""
79
 
 
80
 
        if dbus_iface is None:
81
 
            from ubuntuone.platform.windows import ipc
82
 
            self.dbus_iface = ipc.IPCInterface(main,
83
 
                                               send_events=broadcast_events)
84
 
 
85
 
        else:
86
 
            self.dbus_iface = dbus_iface
87
 
            self.bus = None
88
 
 
89
 
    def _get_credentials(self):
90
 
        return self.dbus_iface.oauth_credentials
91
 
 
92
 
    def _set_credentials(self, credentials):
93
 
        self.dbus_iface.oauth_credentials = credentials
94
 
 
95
 
    oauth_credentials = property(fget=_get_credentials, fset=_set_credentials)
96
 
 
97
 
    def shutdown(self, with_restart):
98
 
        self.dbus_iface.shutdown(with_restart)
99
 
 
100
 
    def connect(self, *args, **kwargs):
101
 
        self.dbus_iface.connect(*args, **kwargs)
 
72
    FilesystemMonitor,
 
73
    NotifyProcessor as _GeneralINotifyProcessor,
 
74
)
 
75
from ubuntuone.platform.windows import notification
 
76
from ubuntuone.platform.windows.ipc import (
 
77
    IPCInterface as ExternalInterface,
 
78
    is_already_running,
 
79
)