当前位置: 首页>>代码示例>>Python>>正文


Python pub.sendMessage函数代码示例

本文整理汇总了Python中taskcoachlib.thirdparty.pubsub.pub.sendMessage函数的典型用法代码示例。如果您正苦于以下问题:Python sendMessage函数的具体用法?Python sendMessage怎么用?Python sendMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setFilename

 def setFilename(self, filename):
     if filename == self.__filename:
         return
     self.__lastFilename = filename or self.__filename
     self.__filename = filename
     self.__notifier.setFilename(filename)
     pub.sendMessage('taskfile.filenameChanged', filename=filename)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:7,代码来源:taskfile.py

示例2: save

    def save(self):
        try:
            pub.sendMessage('taskfile.aboutToSave', taskFile=self)
        except:
            pass
        # When encountering a problem while saving (disk full,
        # computer on fire), if we were writing directly to the file,
        # it's lost. So write to a temporary file and rename it if
        # everything went OK.
        self.__saving = True
        try:
            self.mergeDiskChanges()

            if self.__needSave or not os.path.exists(self.__filename):
                fd = self._openForWrite()
                try:
                    xml.XMLWriter(fd).write(self.tasks(), self.categories(), self.notes(),
                                            self.syncMLConfig(), self.guid())
                finally:
                    fd.close()

            self.markClean()
        finally:
            self.__saving = False
            self.__notifier.saved()
            try:
                pub.sendMessage('taskfile.justSaved', taskFile=self)
            except:
                pass
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:29,代码来源:taskfile.py

示例3: __show_effort_aggregation

 def __show_effort_aggregation(self, aggregation):
     ''' Change the aggregation mode. Can be one of 'details', 'day', 'week'
         and 'month'. '''
     assert aggregation in ('details', 'day', 'week', 'month')
     self.aggregation = aggregation
     self.setPresentation(self.createSorter(self.createFilter(\
                          self.domainObjectsToView())))
     self.secondRefresher.updatePresentation()
     self.registerPresentationObservers()
     # Invalidate the UICommands used for the column popup menu:
     self.__columnUICommands = None
     # Clear the selection to remove the cached selection
     self.clear_selection()
     # If the widget is auto-resizing columns, turn it off temporarily to 
     # make removing/adding columns faster
     autoResizing = self.widget.IsAutoResizing()
     if autoResizing:
         self.widget.ToggleAutoResizing(False)
     # Refresh first so that the list control doesn't think there are more
     # efforts than there really are when switching from aggregate mode to
     # detail mode.
     self.refresh()
     self._showWeekdayColumns(show=aggregation == 'week')
     self._showTotalColumns(show=aggregation != 'details')
     if autoResizing:
         self.widget.ToggleAutoResizing(True)
     self.__initRoundingToolBarUICommands()
     pub.sendMessage('effortviewer.aggregation')
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:28,代码来源:effort.py

示例4: _refresh

 def _refresh(self, clear=False):
     if clear:
         self.__domainObjectsToView = None
     self.setPresentation(self.createSorter(self.createFilter(self.domainObjectsToView())))
     self.secondRefresher.updatePresentation()
     self.registerPresentationObservers()
     # Invalidate the UICommands used for the column popup menu:
     self.__columnUICommands = None
     # Clear the selection to remove the cached selection
     self.clear_selection()
     # If the widget is auto-resizing columns, turn it off temporarily to
     # make removing/adding columns faster
     autoResizing = self.widget.IsAutoResizing()
     if autoResizing:
         self.widget.ToggleAutoResizing(False)
     # Refresh first so that the list control doesn't think there are more
     # efforts than there really are when switching from aggregate mode to
     # detail mode.
     self.refresh()
     self._showWeekdayColumns(show=self.aggregation == "week")
     self._showTotalColumns(show=self.aggregation != "details")
     if autoResizing:
         self.widget.ToggleAutoResizing(True)
     self.__initRoundingToolBarUICommands()
     pub.sendMessage("effortviewer.aggregation")
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:25,代码来源:effort.py

示例5: reset

 def reset(self, forceEvent=False):
     ''' reset does the actual sorting. If the order of the list changes, 
         observers are notified by means of the list-sorted event. '''
     oldSelf = self[:]
     self.sort(key=self.createSortKeyFunction(), 
               reverse=not self._sortAscending)
     if forceEvent or self != oldSelf:
         pub.sendMessage(self.sortEventType(), sender=self)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:8,代码来源:sorter.py

示例6: __extend_self_with_composites

 def __extend_self_with_composites(self, new_composites, event=None):
     ''' Add composites to the aggregator. '''
     super(EffortAggregator, self).extendSelf(new_composites, event=event)
     for new_composite in new_composites:
         if new_composite.isBeingTracked():
             self.__trackedComposites.add(new_composite)
             pub.sendMessage(effort.Effort.trackingChangedEventType(),
                             newValue=True, sender=new_composite)
开发者ID:jonnybest,项目名称:taskcoach,代码行数:8,代码来源:reducer.py

示例7: load

    def load(self, filename=None):
        pub.sendMessage('taskfile.aboutToRead', taskFile=self)
        self.__loading = True
        if filename:
            self.setFilename(filename)
        try:
            if self.exists():
                fd = self._openForRead()
                try:
                    tasks, categories, notes, syncMLConfig, changes, guid = self._read(fd)
                finally:
                    fd.close()
            else:
                tasks = []
                categories = []
                notes = []
                changes = dict()
                guid = generate()
                syncMLConfig = createDefaultSyncConfig(guid)
            self.clear()
            self.__monitor.reset()
            self.__changes = changes
            self.__changes[self.__monitor.guid()] = self.__monitor
            self.categories().extend(categories)
            self.tasks().extend(tasks)
            self.notes().extend(notes)
            def registerOtherObjects(objects):
                for obj in objects:
                    if isinstance(obj, base.CompositeObject):
                        registerOtherObjects(obj.children())
                    if isinstance(obj, note.NoteOwner):
                        registerOtherObjects(obj.notes())
                    if isinstance(obj, attachment.AttachmentOwner):
                        registerOtherObjects(obj.attachments())
                    if isinstance(obj, task.Task):
                        registerOtherObjects(obj.efforts())
                    if isinstance(obj, note.Note) or \
                           isinstance(obj, attachment.Attachment) or \
                           isinstance(obj, effort.Effort):
                        self.__monitor.setChanges(obj.id(), set())
            registerOtherObjects(self.categories().rootItems())
            registerOtherObjects(self.tasks().rootItems())
            registerOtherObjects(self.notes().rootItems())
            self.__monitor.resetAllChanges()
            self.__syncMLConfig = syncMLConfig
            self.__guid = guid

            if os.path.exists(self.filename()):
                # We need to reset the changes on disk because we're up to date.
                xml.ChangesXMLWriter(file(self.filename() + '.delta', 'wb')).write(self.__changes)
        except:
            self.setFilename('')
            raise
        finally:
            self.__loading = False
            self.markClean()
            self.__changedOnDisk = False
            pub.sendMessage('taskfile.justRead', taskFile=self)
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:58,代码来源:taskfile.py

示例8: clear

 def clear(self, regenerate=True, event=None):
     pub.sendMessage('taskfile.aboutToClear', taskFile=self)
     try:
         self.tasks().clear(event=event)
         self.categories().clear(event=event)
         self.notes().clear(event=event)
         if regenerate:
             self.__guid = generate()
             self.__syncMLConfig = createDefaultSyncConfig(self.__guid)
     finally:
         pub.sendMessage('taskfile.justCleared', taskFile=self)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:11,代码来源:taskfile.py

示例9: setStart

 def setStart(self, startDateTime):
     if startDateTime == self._start:
         return
     self._start = startDateTime
     self.__updateDurationCache()
     pub.sendMessage(self.startChangedEventType(), newValue=startDateTime,
                     sender=self)
     self.task().sendTimeSpentChangedMessage()
     self.sendDurationChangedMessage()
     if self.task().hourlyFee():
         self.sendRevenueChangedMessage()
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:11,代码来源:effort.py

示例10: expand

 def expand(self, expand=True, context='None', notify=True):
     ''' Expands (or collapses) the composite object in the specified 
         context. ''' 
     if expand == self.isExpanded(context):
         return
     if expand:
         self.__expandedContexts.add(context)
     else:
         self.__expandedContexts.discard(context)
     if notify:
         pub.sendMessage(self.expansionChangedEventType(), newValue=expand,
                         sender=self)
开发者ID:jonnybest,项目名称:taskcoach,代码行数:12,代码来源:object.py

示例11: save

    def save(self):
        pickle.dump([name for task, name in self._templates], file(os.path.join(self._path, 'list.pickle'), 'wb'))

        for task, name in self._templates:
            templateFile = file(os.path.join(self._path, name), 'w')
            writer = TemplateXMLWriter(templateFile)
            writer.write(task)
            templateFile.close()

        for task, name in self._toDelete:
            os.remove(os.path.join(self._path, name))
        self._toDelete = []
        pub.sendMessage('templates.saved')
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:13,代码来源:templatelist.py

示例12: reset

    def reset(self, forceEvent=False):
        ''' reset does the actual sorting. If the order of the list changes, 
            observers are notified by means of the list-sorted event. '''
        if self.isFrozen():
            return

        oldSelf = self[:]
        # XXXTODO: create only one function with all keys ? Reversing may
        # be problematic.
        for sortKey in reversed(self._sortKeys):
            self.sort(key=self.createSortKeyFunction(sortKey.lstrip('-')), reverse=sortKey.startswith('-'))
        if forceEvent or self != oldSelf:
            pub.sendMessage(self.sortEventType(), sender=self)
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:13,代码来源:sorter.py

示例13: extendSelf

 def extendSelf(self, tasks, event=None):
     ''' This method is called when a task is added to the observed list.
         It overrides ObservableListObserver.extendSelf whose default 
         behaviour is to add the item that is added to the observed 
         list to the observing list (this list) unchanged. But we want to 
         add the efforts of the tasks, rather than the tasks themselves. '''
     effortsToAdd = []
     for task in tasks:
         effortsToAdd.extend(task.efforts())
     super(EffortList, self).extendSelf(effortsToAdd, event)
     for effort in effortsToAdd:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=True, sender=effort)
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:13,代码来源:effortlist.py

示例14: onAddEffortToOrRemoveEffortFromTask

 def onAddEffortToOrRemoveEffortFromTask(self, newValue, sender):
     if sender not in self.observable():
         return
     newValue, oldValue = newValue
     effortsToAdd = [effort for effort in newValue if not effort in oldValue]
     effortsToRemove = [effort for effort in oldValue if not effort in newValue]
     super(EffortList, self).extendSelf(effortsToAdd)
     super(EffortList, self).removeItemsFromSelf(effortsToRemove)
     for effort in effortsToAdd + effortsToRemove:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(),
                             newValue=effort in effortsToAdd,
                             sender=effort)
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:13,代码来源:effortlist.py

示例15: removeItemsFromSelf

 def removeItemsFromSelf(self, tasks, event=None):
     ''' This method is called when a task is removed from the observed 
         list. It overrides ObservableListObserver.removeItemsFromSelf 
         whose default behaviour is to remove the item that was removed
         from the observed list from the observing list (this list) 
         unchanged. But we want to remove the efforts of the tasks, rather 
         than the tasks themselves. '''
     effortsToRemove = []
     for task in tasks:
         effortsToRemove.extend(task.efforts())
     for effort in effortsToRemove:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=False, sender=effort)
     super(EffortList, self).removeItemsFromSelf(effortsToRemove, event)
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:14,代码来源:effortlist.py


注:本文中的taskcoachlib.thirdparty.pubsub.pub.sendMessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。