コード例 #1
0
    def init(self):
        self.dmt = TaskCoachDMTClientConfig(self.taskFile.syncMLConfig(),
                                            self.clientName)

        if not (self.dmt.read() and \
                self.dmt.deviceConfig.devID == self.clientName):
            self.dmt.setClientDefaults()

        ac = self.dmt.accessConfig
        ac.username = self.username
        ac.password = self.password

        ac.useProxy = 0
        ac.syncURL = self.url
        self.dmt.accessConfig = ac

        dc = self.dmt.deviceConfig
        dc.devID = self.clientName
        dc.devType = 'workstation'
        dc.manufacturerName = 'Task Coach developers'
        dc.modelName = sys.platform
        dc.firmwareVersion = '0.0'
        dc.softwareVersion = data.version
        self.dmt.deviceConfig = dc

        # Tasks source configuration

        self.sources = []

        if self.synctasks:
            try:
                cfg = self.dmt.getSyncSourceConfig('%s.Tasks' %
                                                   self.clientName)
            except ValueError:
                cfg = SyncSourceConfig('%s.Tasks' % self.clientName)

            cfg.URI = self.taskdbname
            cfg.syncModes = 'two-way'
            cfg.supportedTypes = 'text/calendar'
            cfg.version = '1.0'

            self.dmt.setSyncSourceConfig(cfg)

            src = TaskSource(self, self.taskFile.tasks(),
                             self.taskFile.categories(),
                             '%s.Tasks' % self.clientName, cfg)
            src.preferredSyncMode = globals()[self.taskmode]
            self.sources.append(src)

        if self.syncnotes:
            try:
                cfg = self.dmt.getSyncSourceConfig('%s.Notes' %
                                                   self.clientName)
            except ValueError:
                cfg = SyncSourceConfig('%s.Notes' % self.clientName)

            cfg.URI = self.notedbname
            cfg.syncModes = 'two-way'
            cfg.supportedTypes = 'text/x-vnote:1.1'
            cfg.version = '1.0'

            self.dmt.setSyncSourceConfig(cfg)

            src = NoteSource(
                self,
                self.taskFile.notes(),
                self.taskFile.categories(),
                # This is ugly and doesn't work for every configuration but well...
                'text/plain'
                if self.url.endswith('rpc.php') else 'text/x-vnote',
                '%s.Notes' % self.clientName,
                cfg)
            src.preferredSyncMode = globals()[self.notemode]
            self.sources.append(src)
コード例 #2
0
ファイル: sync.py プロジェクト: asone77/taskcoach
    def init(self):
        self.dmt = TaskCoachDMTClientConfig(self.taskFile.syncMLConfig(), self.clientName)

        if not (self.dmt.read() and \
                self.dmt.deviceConfig.devID == self.clientName):
            self.dmt.setClientDefaults()

        ac = self.dmt.accessConfig
        ac.username = self.username
        ac.password = self.password

        ac.useProxy = 0
        ac.syncURL = self.url
        self.dmt.accessConfig = ac

        dc = self.dmt.deviceConfig
        dc.devID = self.clientName
        dc.devType = 'workstation'
        dc.manufacturerName = 'Task Coach developers'
        dc.modelName = sys.platform
        dc.firmwareVersion = '0.0'
        dc.softwareVersion = data.version
        self.dmt.deviceConfig = dc

        # Tasks source configuration

        self.sources = []

        if self.synctasks:
            try:
                cfg = self.dmt.getSyncSourceConfig('%s.Tasks' % self.clientName)
            except ValueError:
                cfg = SyncSourceConfig()

            cfg.name = '%s.Tasks' % self.clientName
            cfg.URI = self.taskdbname
            cfg.syncModes = 'two-way'
            cfg.supportedTypes = 'text/vcard:3.0'
            cfg.version = '1.0'

            self.dmt.setSyncSourceConfig(cfg)

            src = TaskSource(self,
                             self.taskFile.tasks(),
                             self.taskFile.categories(),
                             '%s.Tasks' % self.clientName, cfg)
            src.preferredSyncMode = globals()[self.taskmode]
            self.sources.append(src)

        if self.syncnotes:
            try:
                cfg = self.dmt.getSyncSourceConfig('%s.Notes' % self.clientName)
            except ValueError:
                cfg = SyncSourceConfig()

            cfg.name = '%s.Notes' % self.clientName
            cfg.URI = self.notedbname
            cfg.syncModes = 'two-way'
            cfg.supportedTypes = 'text/plain'
            cfg.version = '1.0'

            self.dmt.setSyncSourceConfig(cfg)

            src = NoteSource(self,
                             self.taskFile.notes(),
                             '%s.Notes' % self.clientName, cfg)
            src.preferredSyncMode = globals()[self.notemode]
            self.sources.append(src)
コード例 #3
0
ファイル: sync.py プロジェクト: HieronymusCH/TaskCoach
    def init(self):
        self.dmt = TaskCoachDMTClientConfig(self.taskFile.syncMLConfig(), self.clientName)

        if not (self.dmt.read() and self.dmt.deviceConfig.devID == self.clientName):
            self.dmt.setClientDefaults()

        ac = self.dmt.accessConfig
        ac.username = self.username
        ac.password = self.password

        ac.useProxy = 0
        ac.syncURL = self.url
        self.dmt.accessConfig = ac

        dc = self.dmt.deviceConfig
        dc.devID = self.clientName
        dc.devType = "workstation"
        dc.manufacturerName = "Task Coach developers"
        dc.modelName = sys.platform
        dc.firmwareVersion = "0.0"
        dc.softwareVersion = data.version
        self.dmt.deviceConfig = dc

        # Tasks source configuration

        self.sources = []

        if self.synctasks:
            try:
                cfg = self.dmt.getSyncSourceConfig("%s.Tasks" % self.clientName)
            except ValueError:
                cfg = SyncSourceConfig("%s.Tasks" % self.clientName)

            cfg.URI = self.taskdbname
            cfg.syncModes = "two-way"
            cfg.supportedTypes = "text/calendar"
            cfg.version = "1.0"

            self.dmt.setSyncSourceConfig(cfg)

            src = TaskSource(self, self.taskFile.tasks(), self.taskFile.categories(), "%s.Tasks" % self.clientName, cfg)
            src.preferredSyncMode = globals()[self.taskmode]
            self.sources.append(src)

        if self.syncnotes:
            try:
                cfg = self.dmt.getSyncSourceConfig("%s.Notes" % self.clientName)
            except ValueError:
                cfg = SyncSourceConfig("%s.Notes" % self.clientName)

            cfg.URI = self.notedbname
            cfg.syncModes = "two-way"
            cfg.supportedTypes = "text/x-vnote:1.1"
            cfg.version = "1.0"

            self.dmt.setSyncSourceConfig(cfg)

            src = NoteSource(
                self,
                self.taskFile.notes(),
                self.taskFile.categories(),
                # This is ugly and doesn't work for every configuration but well...
                "text/plain" if self.url.endswith("rpc.php") else "text/x-vnote",
                "%s.Notes" % self.clientName,
                cfg,
            )
            src.preferredSyncMode = globals()[self.notemode]
            self.sources.append(src)