• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pub.subscribe函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testNotificationForSetTask

 def testNotificationForSetTask(self):
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.taskChangedEventType())
     task2 = task.Task()
     self.effort.setTask(task2)
     self.assertEqual([(task2, self.effort)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:10,代码来源:EffortTest.py


示例17: testRevenueNotificationForEffortDurationChange_ChangeStart

 def testRevenueNotificationForEffortDurationChange_ChangeStart(self):
     self.task.setHourlyFee(100)
     events = []
     
     def onEvent(newValue, sender):
         events.append((newValue, sender))
         
     pub.subscribe(onEvent, effort.Effort.revenueChangedEventType())
     self.effort.setStart(date.DateTime(2004, 1, 1, 12, 0, 0))
     self.assertEqual([(1200.0, self.effort)], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:10,代码来源:EffortTest.py


示例18: testRemoveChildWithEffortCausesEmptyNotification

 def testRemoveChildWithEffortCausesEmptyNotification(self):
     events = []
     
     def onEvent(sender):
         events.append(sender)
         
     pub.subscribe(onEvent, effort.CompositeEffort.compositeEmptyEventType())
     self.child.addEffort(self.childEffort)
     self.task.removeChild(self.child)
     self.assertEqual([self.composite], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:10,代码来源:EffortCompositeTest.py


示例19: testRemoveEffortFromChildNotification

 def testRemoveEffortFromChildNotification(self):
     self.child.addEffort(self.childEffort)
     events = []
     
     def onEvent(sender):
         events.append(sender)
         
     pub.subscribe(onEvent, effort.CompositeEffort.compositeEmptyEventType())
     self.child.removeEffort(self.childEffort)
     self.assertEqual([self.composite], events)
开发者ID:MahadJamal,项目名称:Task-Coach-Evolution,代码行数:10,代码来源:EffortCompositeTest.py


示例20: __init__

 def __init__(self, *args, **kwargs):
     self.__treeMode = kwargs.pop('treeMode', False)
     self.__sortByTaskStatusFirst = kwargs.pop('sortByTaskStatusFirst', True)
     super(Sorter, self).__init__(*args, **kwargs)
     for eventType in (task.Task.prerequisitesChangedEventType(),
                       task.Task.dueDateTimeChangedEventType(),
                       task.Task.plannedStartDateTimeChangedEventType(),
                       task.Task.actualStartDateTimeChangedEventType(),
                       task.Task.completionDateTimeChangedEventType()):
         pub.subscribe(self.onAttributeChanged, eventType)
开发者ID:pk-codebox-evo,项目名称:ios-apps-taskcoach,代码行数:10,代码来源:sorter.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python engines.load函数代码示例发布时间:2022-05-27
下一篇:
Python pub.sendMessage函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap