parameters: (self, TopicCount)
return_statement: return tuple(results), TopicCount
docstring: Packs up the topic values. Called by excel when it's ready for an update.
      
      Needs to:
        * Return the current number of topics, via the "ByRef" TopicCount
        * Return a 2d SafeArray of the topic data.
          - 1st dim: topic numbers
          - 2nd dim: topic values
        
      We could do some caching, instead of repacking everytime...
      But this works for demonstration purposes.
docstring_summary: Packs up the topic values. Called by excel when it's ready for an update.
      
      Needs to:
        * Return the current number of topics, via the "ByRef" TopicCount
        * Return a 2d SafeArray of the topic data.
          - 1st dim: topic numbers
          - 2nd dim: topic values
        
      We could do some caching, instead of repacking everytime...
      But this works for demonstration purposes.
docstring_tokens: Packs up the topic values . Called by excel when it s ready for an update . Needs to : * Return the current number of topics via the ByRef TopicCount * Return a 2d SafeArray of the topic data . - 1st dim : topic numbers - 2nd dim : topic values We could do some caching instead of repacking everytime ... But this works for demonstration purposes .
function: def RefreshData(self, TopicCount):
      """Packs up the topic values. Called by excel when it's ready for an update.
      
      Needs to:
        * Return the current number of topics, via the "ByRef" TopicCount
        * Return a 2d SafeArray of the topic data.
          - 1st dim: topic numbers
          - 2nd dim: topic values
        
      We could do some caching, instead of repacking everytime...
      But this works for demonstration purposes."""
      TopicCount = len(self.topics)
      self.OnRefreshData()
      
      # Grow the lists, so we don't need a heap of calls to append()
      results = [[None] * TopicCount, [None] * TopicCount]
      
      # Excel expects a 2-dimensional array. The first dim contains the 
      # topic numbers, and the second contains the values for the topics.
      # In true VBA style (yuck), we need to pack the array in row-major format,
      # which looks like:
      #   ( (topic_num1, topic_num2, ..., topic_numN), \
      #     (topic_val1, topic_val2, ..., topic_valN) )
      for idx, topicdata in enumerate(self.topics.iteritems()):
        topicNum, topic = topicdata
        results[0][idx] = topicNum
        results[1][idx] = topic.GetValue()
        
      # TopicCount is meant to be passed to us ByRef, so return it as well, as per
      # the way pywin32 handles ByRef arguments.
      return tuple(results), TopicCount
function_tokens: def RefreshData ( self , TopicCount ) : TopicCount = len ( self . topics ) self . OnRefreshData ( ) # Grow the lists, so we don't need a heap of calls to append() results = [ [ None ] * TopicCount , [ None ] * TopicCount ] # Excel expects a 2-dimensional array. The first dim contains the  # topic numbers, and the second contains the values for the topics. # In true VBA style (yuck), we need to pack the array in row-major format, # which looks like: #   ( (topic_num1, topic_num2, ..., topic_numN), \ #     (topic_val1, topic_val2, ..., topic_valN) ) for idx , topicdata in enumerate ( self . topics . iteritems ( ) ) : topicNum , topic = topicdata results [ 0 ] [ idx ] = topicNum results [ 1 ] [ idx ] = topic . GetValue ( ) # TopicCount is meant to be passed to us ByRef, so return it as well, as per # the way pywin32 handles ByRef arguments. return tuple ( results ) , TopicCount