Esempio n. 1
0
    def point_add(self, commit, col, row):
        p = Layout(self, file=(self.themef,'egitu/graph/item'))
        p.signal_callback_add("mouse,down,*", "base",
                              self.point_mouse_down_cb, commit)
        p.tooltip_content_cb_set(lambda o,tt:
                CommitPopup(self, self.repo, commit))

        if options.show_message_in_dag is True:
            l = Layout(self, file=(self.themef, 'egitu/graph/msg'))
            l.text_set('msg.text', commit.title)
            p.box_append('refs.box', l)
            l.show()

        for head in commit.heads:
            if head == 'HEAD':
                p.signal_emit('head,show', 'egitu')
            else:
                l = Layout(self, file=(self.themef, 'egitu/graph/ref'))
                l.text_set('ref.text', head)
                p.box_append('refs.box', l)
                l.show()

        if options.show_remotes_in_dag:
            for head in commit.remotes:
                l = Layout(self, file=(self.themef, 'egitu/graph/ref'))
                l.text_set('ref.text', head)
                p.box_append('refs.box', l)
                l.show()

        for tag in commit.tags:
            l = Layout(self, file=(self.themef, 'egitu/graph/tag'))
            l.text_set('tag.text', tag)
            p.box_append('refs.box', l)
            l.show()

        self.pack(p, col, row, 1, 1)
        p.show()
Esempio n. 2
0
    def _gl_content_get(self, gl, part, commit):
        if part == 'egitu.swallow.pad':
            # padding rect (to place the point in the right column)
            size = commit.dag_data.col * self.COLW, 10
            r = Rectangle(gl.evas, color=(0,0,0,0),
                          size_hint_min=size, size_hint_max=size)
            return r

        elif part == 'egitu.swallow.icon':
            # the icon object (+ swallows for the connection lines)
            icon = Layout(gl, file=(self.themef,'egitu/graph/icon'))
            icon.tooltip_content_cb_set(lambda o,t: CommitTooltip(t, commit))
            commit.dag_data.icon_obj = icon
            if 'HEAD' in commit.heads:
                icon.signal_emit('head,show', 'egitu')
            return icon

        elif part == 'egitu.swallow.refs':
            box = Box(gl, horizontal=True)
            # local refs
            for head in commit.heads:
                ref = Layout(gl, file=(self.themef, 'egitu/graph/ref'))
                ref.text_set('ref.text', head)
                box.pack_end(ref)
                ref.show()
            # remote refs
            if options.show_remotes_in_dag:
                for head in commit.remotes:
                    ref = Layout(gl, file=(self.themef, 'egitu/graph/ref'))
                    ref.text_set('ref.text', head)
                    box.pack_end(ref)
                    ref.show()
            # tags
            for tag in commit.tags:
                ref = Layout(gl, file=(self.themef, 'egitu/graph/tag'))
                ref.text_set('tag.text', tag)
                box.pack_end(ref)
                ref.show()
            return box

        elif commit.dag_data.date_span and part == 'egitu.swallow.date':
            dt = Edje(gl.evas, file=self.themef, group='egitu/graph/date')
            dt.size_hint_min = self.COLW, commit.dag_data.date_span * self.ROWH
            fmt = '%d %b' if commit.dag_data.date_span > 2 else '%d'
            dt.part_text_set('date.text', commit.commit_date.strftime(fmt))
            return dt