Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #876 from cmft/remove_subs_api
Browse files Browse the repository at this point in the history
 Remove _{un,}subscribeEvents API in TaurusAttribute
  • Loading branch information
Carlos Pascual authored Mar 4, 2019
2 parents b0b8a59 + ce0028a commit c229aa9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ develop branch) won't be reflected in this file.
- `TaurusModelSelector` and `TaurusModelSelectorItem` classes and the
(experimental) `"taurus.qt.qtgui.panel.TaurusModelSelector.items"` entry point (#869)

### Deprecated
- `TaurusAttribute._(un)subscribeEvents` API

## [4.5.1] - 2019-02-15

Expand Down
8 changes: 0 additions & 8 deletions lib/taurus/core/epics/epicsattribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,6 @@ def poll(self):

def isUsingEvents(self):
return True # TODO: implement this

def _subscribeEvents(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute._subscribeEvents")

def _unsubscribeEvents(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute._unsubscribeEvents")
# ------------------------------------------------------------------------------

def factory(self):
Expand Down
6 changes: 0 additions & 6 deletions lib/taurus/core/evaluation/evalattribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,6 @@ def poll(self):
v = self.read(cache=False)
self.fireEvent(TaurusEventType.Periodic, v)

def _subscribeEvents(self):
pass

def _unsubscribeEvents(self):
pass

def isUsingEvents(self):
# if this attributes depends from others, then we consider it uses
# events
Expand Down
9 changes: 5 additions & 4 deletions lib/taurus/core/tango/tangoattribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def __del__(self):
def cleanUp(self):
self.trace("[TangoAttribute] cleanUp")
self._unsubscribeConfEvents()
self._unsubscribeChangeEvents()
TaurusAttribute.cleanUp(self)
self.__dev_hw_obj = None
self._pytango_attrinfoex = None
Expand Down Expand Up @@ -600,7 +601,7 @@ def addListener(self, listener):
assert len(listeners) >= 1

if self.__subscription_state == SubscriptionState.Unsubscribed and len(listeners) == 1:
self._subscribeEvents()
self._subscribeChangeEvents()

# if initial_subscription_state == SubscriptionState.Subscribed:
if (len(listeners) > 1
Expand Down Expand Up @@ -630,7 +631,7 @@ def removeListener(self, listener):
return ret

if self.__subscription_state != SubscriptionState.Unsubscribed:
self._unsubscribeEvents()
self._unsubscribeChangeEvents()

return ret

Expand All @@ -654,7 +655,7 @@ def getSubscriptionState(self):
def _process_event_exception(self, ex):
pass

def _subscribeEvents(self):
def _subscribeChangeEvents(self):
""" Enable subscription to the attribute events. If change events are
not supported polling is activated """

Expand Down Expand Up @@ -705,7 +706,7 @@ def _call_dev_hw_subscribe_event(self, stateless=True):

return self.__chg_evt_id

def _unsubscribeEvents(self):
def _unsubscribeChangeEvents(self):
# Careful in this method: This is intended to be executed in the cleanUp
# so we should not access external objects from the factory, like the
# parent object
Expand Down
14 changes: 5 additions & 9 deletions lib/taurus/core/taurusattribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def __init__(self, name='', parent=None, **kwargs):

def cleanUp(self):
self.trace("[TaurusAttribute] cleanUp")
self._unsubscribeEvents()
if hasattr(self, '_unsuscribeEvents'):
self.deprecated(
dep='TaurusAttribute._unsuscribeEvents API',
alt='If you need it called in cleanUp, re-implement cleanUp')
self._unsuscribeEvents()
TaurusModel.cleanUp(self)

#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Expand Down Expand Up @@ -146,14 +150,6 @@ def poll(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute.poll")

def _subscribeEvents(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute._subscribeEvents")

def _unsubscribeEvents(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute._unsubscribeEvents")

def isUsingEvents(self):
raise NotImplementedError("Not allowed to call AbstractClass" +
" TaurusAttribute.isUsingEvents")
Expand Down

0 comments on commit c229aa9

Please sign in to comment.