Example #1
0
 def __init__(self, label=None, forest=None):
     Node.__init__(self, forest=forest)
     self.repulsion = 0.25
     self._gravity = 3.0
     self.fshape = 2
     self.left_shape = 0
     self.right_shape = 0
     self.invert_colors = True
Example #2
0
 def __init__(self, label='', value='', family=''):
     Node.__init__(self)
     self.name = label
     self.value = value
     self.family = family
     self.repulsion = 0.25
     self._gravity = 2.5
     self.z_value = 60
     self.setZValue(self.z_value)
Example #3
0
 def __init__(self, label='', value='', family=''):
     Node.__init__(self)
     self.name = label
     self.value = value
     self.family = family
     self.repulsion = 0.25
     self._gravity = 2.5
     self.z_value = 60
     self.setZValue(self.z_value)
Example #4
0
 def paint(self, painter, option, widget=None):
     """ Painting is sensitive to mouse/selection issues, but usually with
     :param painter:
     :param option:
     :param widget:
     nodes it is the label of the node that needs complex painting """
     if ctrl.pressed == self or self._hovering or ctrl.is_selected(self):
         painter.setPen(ctrl.cm.get('background1'))
         painter.setBrush(self.contextual_background())
         painter.drawRoundedRect(self.inner_rect, 5, 5)
     Node.paint(self, painter, option, widget)
Example #5
0
 def paint(self, painter, option, widget=None):
     """ FeatureNodes can have shapes that suggest which features can value each other.
     :param painter:
     :param option:
     :param widget:
     """
     if self.fshape:
         self.draw_feature_shape(painter, self.inner_rect, self.left_shape, self.right_shape,
                                 self.contextual_color())
     else:
         Node.paint(self, painter, option, widget)
Example #6
0
 def paint(self, painter, option, widget=None):
     """ Painting is sensitive to mouse/selection issues, but usually with
     :param painter:
     :param option:
     :param widget:
     nodes it is the label of the node that needs complex painting """
     if ctrl.pressed == self or self._hovering or ctrl.is_selected(self):
         painter.setPen(ctrl.cm.get('background1'))
         painter.setBrush(self.contextual_background())
         painter.drawRoundedRect(self.inner_rect, 5, 5)
     Node.paint(self, painter, option, widget)
Example #7
0
 def __init__(self, label='comment', forest=None):
     self.image_object = None
     Node.__init__(self, forest=forest)
     if not label:
         label = 'comment'
     self.label = label
     self.physics_x = False
     self.physics_y = False
     self.image_path = None
     self.image = None
     self.pos_relative_to_host = -50, -50
     self.preferred_host = None
Example #8
0
 def __init__(self, label='comment'):
     self.image_object = None
     Node.__init__(self)
     if not label:
         label = 'comment'
     self.resizable = True
     self.label = label
     self.physics_x = False
     self.physics_y = False
     self.image_path = None
     self.image = None
     self.pos_relative_to_host = -50, -50
     self.preferred_host = None
Example #9
0
    def __init__(self, label=''):
        """ Most of the initiation is inherited from Node """
        Node.__init__(self)
        self.heads = []

        # ### Projection -- see also preferences that govern if these are used
        self.can_project = True
        self.projecting_to = set()

        self.index = ''
        self.label = label
        self.autolabel = ''
        self.gloss = ''

        self.is_trace = False
        self.merge_order = 0
        self.select_order = 0
        self.in_projections = []
Example #10
0
    def __init__(self,
                 forest=None,
                 host=None,
                 attribute_id=None,
                 label='',
                 show_label=False,
                 restoring=False):
        """

        :param host: 
        :param attribute_id: 
        :param attribute_label: 
        :param show_label: 
        :param forest: 
        :param restoring: 
        :raise: 
        """
        self.help_text = ""
        Node.__init__(self)
        self.host = host
        self.attribute_label = label or attribute_id
        self.attribute_id = attribute_id
        self._show_label = show_label
        # if self.attribute_label in color_map:
        # self.color = colors.feature_palette[color_map[self.attribute_label]]
        # else:
        # self.color = colors.feature
        if not restoring:
            # compute start position -- similar to FeatureNode, but happens on init
            # because host is given
            x, y = self.host.current_position
            k = self.attribute_label
            if k in color_map:
                x += color_map[k]
                y += color_map[k]
            else:
                x += random.uniform(-4, 4)
                y += random.uniform(-4, 4)
            self.set_original_position((x, y))
            self.update_help_text()
            self.update_label()
            self.update_bounding_rect()
            self.update_visibility()
Example #11
0
    def __init__(self, label=''):
        """ Most of the initiation is inherited from Node """
        Node.__init__(self)
        self.heads = []

        # ### Projection -- see also preferences that govern if these are used
        self.can_project = True
        self.projecting_to = set()

        self.index = ''
        self.label = label
        self.gloss = ''

        self.is_trace = False
        self.merge_order = 0
        self.select_order = 0
        self.original_parent = None
        self.in_projections = []
        self.halo = False
Example #12
0
    def __init__(self, forest=None, host=None, attribute_id=None, label='',
                 show_label=False, restoring=False):
        """

        :param host: 
        :param attribute_id: 
        :param attribute_label: 
        :param show_label: 
        :param forest: 
        :param restoring: 
        :raise: 
        """
        self.help_text = ""
        Node.__init__(self)
        self.host = host
        self.attribute_label = label or attribute_id
        self.attribute_id = attribute_id
        self._show_label = show_label
        # if self.attribute_label in color_map:
        # self.color = colors.feature_palette[color_map[self.attribute_label]]
        # else:
        # self.color = colors.feature
        if not restoring:
            # compute start position -- similar to FeatureNode, but happens on init
            # because host is given
            x, y = self.host.current_position
            k = self.attribute_label
            if k in color_map:
                x += color_map[k]
                y += color_map[k]
            else:
                x += random.uniform(-4, 4)
                y += random.uniform(-4, 4)
            self.set_original_position((x, y))
            self.update_help_text()
            self.update_label()
            self.update_bounding_rect()
            self.update_visibility()
Example #13
0
 def _remove_children(bad_mother: Node):
     for child in bad_mother.get_children(similar=False, visible=False):
         if child in folded:
             folded.remove(child)
             _remove_children(child)
Example #14
0
 def after_init(self):
     Node.after_init(self)
     if self.user_size:
         w, h = self.user_size
         self.set_user_size(w, h)
Example #15
0
 def after_init(self):
     Node.after_init(self)
     if self.user_size:
         w, h = self.user_size
         self.set_user_size(w, h)
Example #16
0
 def __init__(self, label=''):
     Node.__init__(self)
     if not label:
         label = 'gloss'
     self.label = label
     self._gravity = 1.5
Example #17
0
 def __init__(self, label=''):
     Node.__init__(self)
     if not label:
         label = 'gloss'
     self.label = label
     self._gravity = 1.5
Example #18
0
 def __init__(self, label='', forest=None):
     Node.__init__(self, forest=forest)
     if not label:
         label = 'gloss'
     self.label = label
     self._gravity = 1.5