Exemplo n.º 1
0
    def __init__(self, variables=None, *args, **kwargs):
        Grid.__init__(self, *args, **kwargs)

        self.variables = variables
        self.subject.title = self.subject_title
        self.subject.description = self.subject_description
        self.property.title = self.property_title
        self.property.description = self.property_description
        self.object.title = self.object_title
        self.object.description = self.object_description

        self.members = (self.subject, self.property, self.object)

        for widget in self.members:
            widget.entity = {"Label":"", "Description":"", "URI":""}
            widget.popover = EntityPopover(widget.entity,
                                                  variables=self.variables)
            widget.popover.set_relative_to(widget)
            widget.popover.connect("default-variable-selected",
                                          self.default_variable_selected_cb)
            widget.popover.connect("entity-new",
                                          self.entity_new_clicked_cb)
            widget.popover.connect("new-window-clicked",
                                          self.new_window_clicked_cb)
            widget.popover.connect("object-selected",
                                          self.object_selected_cb)
            widget.popover.connect("variable-deleted",
                                          self.variable_deleted_cb)

        self.property.popover.search_entry.set_text("property:")

        self.show_all()
Exemplo n.º 2
0
    def __init__(self, claim, *args, new=False, **kwargs):
        Grid.__init__(self, *args, **kwargs)

        self.qualifier_new.modify_font(FontDescription('Cantarell 8'))
        self.reference_new.modify_font(FontDescription('Cantarell 8'))
        self.qualifier_pos = {}

        self.qualifier_row = 0
        self.reference_row = 0
        self.references_expanded = False

        if new:
            snak = None
        else:
            snak = claim['mainsnak']

        self.entity = Entity(snak=snak, new=new)
        self.entity.connect("entity-editing", self.entity_editing_cb)
        self.entity.connect("entity-leaving", self.entity_leaving_cb)
        self.entity.connect("object-selected", self.object_selected_cb, claim)
        self.entity.connect('new-window-clicked', self.new_window_clicked_cb)
        self.mainsnak.add(self.entity)

        self.hide_actions = True

        if 'qualifiers' in claim:
            self.props.row_spacing = 3
            self.qualifiers.set_visible(True)
            claims = claim['qualifiers']

            for i, P in enumerate(claims):
                download_light(P, self.load_qualifier, i, claims[P])

        self.actions_hide = False

        if 'references' in claim:
            self.references = claim['references']
            self.button_connection = self.button.connect(
                "button-press-event", self.references_expand_clicked_cb)
        else:
            self.icon.set_from_icon_name('list-add-symbolic', IconSize.BUTTON)
            #self.button_connection = self.button.connect("button-press-event", self.reference_new_clicked_cb)

        self.button_press_connection = self.connect("button-press-event",
                                                    self.clicked_cb)

        del claim