Esempio n. 1
0
    def add_new_label(self, instance):
        button_parent = self.info_panel
        button_parent.remove_widget(self.info_panel.button_layout)
        self.info_panel.button_layout.clear_widgets()

        attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None))
        edit_label = EditableLabel(text="",
                                   size=(300, 30),
                                   size_hint=(None, None),
                                   pos_hint={
                                       "center_x": .5,
                                       "center_y": .5
                                   },
                                   color=(1, 1, 1, 1),
                                   font_size=14)
        attr_layout.add_widget(edit_label)
        button_parent.add_widget(attr_layout)
        edit_label.toggle_edit(edit_label)

        self.info_panel.button_layout.add_widget(
            HoverButton(font_size=20,
                        text='New Attribute',
                        size=(500, 30),
                        size_hint=(None, None),
                        pos_hint={"center_x": .5},
                        button_up=DD_LCHRC[0],
                        button_down=DD_LCHRC[1],
                        on_press=self.add_new_label))
        self.info_panel.add_widget(self.info_panel.button_layout)
Esempio n. 2
0
    def add_new_label(self, group=False):
        for child in self.layout.children:
            if type(child) == EditableLabel:
                if child.text == '':
                    self.layout.remove_widget(child)
                else:
                    pass

        if manager.CURRENT_USER != None or manager.CURRENT_GROUP != None:

            attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None))

            edit_label = EditableLabel(text=(''),
                                       pos_hint={
                                           "center_x": .5,
                                           "center_y": .5
                                       },
                                       size_hint=(None, None),
                                       size=(300, 30),
                                       group=group,
                                       color=(1, 1, 1, 1),
                                       font_size=14)
            edit_label.name = None
            edit_label.val = None
            self.attribute_labels.append(edit_label)
            attr_layout.add_widget(edit_label)
            self.layout.add_widget(attr_layout)
            edit_label.toggle_edit(edit_label)