コード例 #1
0
 def finished(retval, progress_b):
 
    pb = progress_b
    
    l = retval
    
    pb.stop()
 
    browse_all_list_box_var.set(l)
    
    maxa = to_eng_notation(permuted_components[key][-1])
    
    mina = to_eng_notation(permuted_components[key][0])
    
    browse_all_max_min_label_var.set('Max: %s Min: %s' % (maxa, mina))
    
    progress_frame.hide()
    return
コード例 #2
0
ファイル: component.py プロジェクト: robwasab/Permutation
   def __str__(self):
   
      prefix = self.__class__.__name__[0]
   
      eng_val = to_eng_notation(self.parts[self.VALUE])

      if len(self.parts[self.COMPONENTS]) <= 1:
         return prefix + eng_val

      label = self.parts[self.LABEL] 
      
      comp_str = ''
      
      for component in self.parts[self.COMPONENTS]:
         if type(component) == float: 
            eng_str = to_eng_notation(component)
            
            comp_str = comp_str + eng_str
            
         else:
         
            foobar = ''
            
            if len(component) > 1:
            
               foobar = '(' + str(component) + ')'
            
            else:
               
               foobar = str(component)
               
            comp_str = comp_str + foobar   
            
         comp_str = comp_str + label
      
      #remove the last appended label...
      comp_str = comp_str[0:len(comp_str) - len(label)]
         
      return prefix + eng_val + " = " + comp_str
コード例 #3
0
ファイル: component_gui.py プロジェクト: robwasab/Permutation
   def draw_value(self, value, tolerance = 0):

      self.c.delete(ALL)
      
      color = self.color

      for i in range(0, len(self.rectangles)):
           
         cord = self.rectangles[i]
            
         x = self.origin[X]
         
         y = self.origin[Y]
         
         cord = (cord[0] + x, cord[1] + y, cord[2] + x, cord[3] + y)

         if self.orientation == HORIZONTAL:
            
            cord = rotate_horiz(self.origin, cord)
         
         self.c.create_rectangle(cord, fill = color)
      
      t = to_eng_notation(value)
      
      t = t + 'F'
      
      if tolerance != 0:
      
        t = t + ' +/-' + str(tolerance * 100) + '%'
      
      #text cordinate
      cord = (int(self.c['width'])/2, int(self.c['height']) - 7) 
      
      self.c.create_text(cord, text = t)
      
      return