def draw_connection(self, commit1, commit2): col1, row1 = commit1.dag_data.col, commit1.dag_data.row col2, row2 = commit2.dag_data.col, commit2.dag_data.row # down-wards connections if row1 < row2: if col1 == col2: # a stright line line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/stright', color=self._color_for_column(col1), size_hint_align=(0.5, 0.0)) elif col1 > col2: # a "fork" line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/fork', color=self._color_for_column(col1), size_hint_align=(1.0, 0.0)) else: # a merge line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/merge', color=self._color_for_column(col2), size_hint_align=(0.0, 0.0)) # delete the same (upwards) line from parent (if was created) upward = commit2.dag_data.upwards_lines.pop(commit1, None) if upward is not None: upward.delete() # up-wards connections else: if col1 == col2: # a stright line line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/stright', color=self._color_for_column(col1), size_hint_align=(0.5, 1.0)) elif col1 < col2: # a "fork" line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/fork', color=self._color_for_column(col2), size_hint_align=(0.0, 1.0)) else: # a merge line = Edje(self.evas, file=self.themef, group='egitu/graph/connection/merge', color=self._color_for_column(col1), size_hint_align=(1.0, 1.0)) # store the line for later deletion commit1.dag_data.upwards_lines[commit2] = line # calculate size, append to the connections box and show line.size_hint_min = (abs(col2 - col1) + 1) * self.COLW, \ (abs(row2 - row1) + 1) * self.ROWH commit1.dag_data.icon_obj.box_append('connections.box', line) line.show()
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