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


Python pub.subscribe函数代码示例

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


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

示例1: _registerObserverForAttribute

 def _registerObserverForAttribute(self, attribute):
     for eventType in self._getSortEventTypes(attribute):
         if eventType.startswith('pubsub'):
             pub.subscribe(self.onAttributeChanged, eventType)
         else:
             patterns.Publisher().registerObserver(self.onAttributeChanged_Deprecated, 
                                                   eventType=eventType)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:7,代码来源:sorter.py

示例2: __startObserving

 def __startObserving(self, eventTypes):
     for eventType in eventTypes:
         if eventType.startswith('pubsub'):
             pub.subscribe(self.onAttributeChanged, eventType)
         else:
             self.registerObserver(self.onAttributeChanged_Deprecated, 
                                   eventType=eventType)                    
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:7,代码来源:base.py

示例3: addViewer

 def addViewer(self, viewer, floating=False):
     ''' Add a new pane with the specified viewer. '''
     self.containerWidget.addPane(viewer, viewer.title(), floating=floating)
     self.viewers.append(viewer)
     if len(self.viewers) == 1:
         self.activateViewer(viewer)
     pub.subscribe(self.onStatusChanged, viewer.viewerStatusEventType())
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:7,代码来源:container.py

示例4: __register_for_window_component_changes

 def __register_for_window_component_changes(self):
     pub.subscribe(self.__onFilenameChanged, 'taskfile.filenameChanged')
     pub.subscribe(self.__onDirtyChanged, 'taskfile.dirty')
     pub.subscribe(self.__onDirtyChanged, 'taskfile.clean')
     pub.subscribe(self.showStatusBar, 'settings.view.statusbar')
     pub.subscribe(self.showToolBar, 'settings.view.toolbar')
     self.Bind(aui.EVT_AUI_PANE_CLOSE, self.onCloseToolBar)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:7,代码来源:mainwindow.py

示例5: __init__

    def __init__(self, effortList, includeComposites=False):
        '''@param effortList: The effort list to observe.
        @param includeComposites: if False, composite efforts will be
            ignored.'''
        super(EffortListTracker, self).__init__()
        Publisher.__init__(self)

        self.__effortList = effortList
        self.__includeComposites = includeComposites

        # __trackedEfforts is a list and not a set because when an effort is
        # moved from one task to another task we might get the event that the
        # effort is (re)added to the effortList before the event that the effort
        # was removed from the effortList. If we would use a set, the effort
        # would be missing from the set after the removal event.    
        self.__trackedEfforts = self.__filterTrackedEfforts(self.__effortList)

        self.registerObserver(self.onEffortAdded, 
                              eventType=self.__effortList.addItemEventType(),
                              eventSource=self.__effortList)
        self.registerObserver(self.onEffortRemoved, 
                              eventType=self.__effortList.removeItemEventType(),
                              eventSource=self.__effortList)
        pub.subscribe(self.onTrackingChanged, 
                      effort.Effort.trackingChangedEventType())
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:25,代码来源:effortlist.py

示例6: __start_observing_attribute

 def __start_observing_attribute(self, eventType, eventSource):
     if eventType.startswith('pubsub'):
         pub.subscribe(self.onAttributeChanged, eventType)
     else:
         patterns.Publisher().registerObserver(self.onAttributeChanged_Deprecated,
                                               eventType=eventType,
                                               eventSource=eventSource)
开发者ID:jonnybest,项目名称:taskcoach,代码行数:7,代码来源:attributesync.py

示例7: __init__

 def __init__(self, *args, **kwargs):
     kwargs.setdefault("settingsSection", "effortviewerforselectedtasks")
     self.__viewerContainer = kwargs.pop("viewerContainer")
     self.__currentTaskViewer = (
         self.__viewerContainer.activeViewer() if self.__viewerContainer.activeViewer().isShowingTasks() else None
     )
     pub.subscribe(self.onTaskSelectionChanged, "all.viewer.status")
     super(EffortViewerForSelectedTasks, self).__init__(*args, **kwargs)
开发者ID:HieronymusCH,项目名称:TaskCoach,代码行数:8,代码来源:effort.py

示例8: testNoNotificationForSetStopWhenNewStopEqualsOldStop

 def testNoNotificationForSetStopWhenNewStopEqualsOldStop(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.stopChangedEventType())
     self.effort.setStop(self.effort.getStop())
     self.failIf(events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortTest.py

示例9: testAddTrackedEffortToTaskDoesNotCauseListEmptyNotification

 def testAddTrackedEffortToTaskDoesNotCauseListEmptyNotification(self):
     events = []
     
     def onEvent(sender):
         events.append(sender)
         
     pub.subscribe(onEvent, effort.CompositeEffort.compositeEmptyEventType())
     self.task.addEffort(effort.Effort(self.task, self.composite.getStart()))
     self.failIf(events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortCompositeTest.py

示例10: testNotificationForStartTracking

 def testNotificationForStartTracking(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, self.effort.trackingChangedEventType())
     self.effort.setStop(date.DateTime())
     self.assertEqual([(True, self.effort)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortTest.py

示例11: testAddEffortNotification

 def testAddEffortNotification(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.durationChangedEventType())
     self.task.addEffort(self.effort1)
     self.assertEqual([(self.composite.duration(), self.composite)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortCompositeTest.py

示例12: testAddEffortToChildTaskNotification

 def testAddEffortToChildTaskNotification(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.durationChangedEventType())
     self.child.addEffort(self.childEffort)
     self.failUnless((self.composite.duration(), self.composite) in events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortCompositeTest.py

示例13: testDurationNotificationForSetStop

 def testDurationNotificationForSetStop(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.durationChangedEventType())
     self.effort.setStop(date.DateTime.now())
     self.assertEqual([(self.effort.duration(), self.effort)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortTest.py

示例14: testThatAnHourlyFeeChangeCausesARevenueNotification

 def testThatAnHourlyFeeChangeCausesARevenueNotification(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.revenueChangedEventType())
     self.child.setHourlyFee(100)
     self.failUnless((0.0, self.composite) in events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortCompositeTest.py

示例15: testRevenueNotificationForTaskHourlyFeeChange

 def testRevenueNotificationForTaskHourlyFeeChange(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.revenueChangedEventType())
     self.task.setHourlyFee(100)
     self.assertEqual([(2400.0, self.effort)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:9,代码来源:EffortTest.py


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