Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
 def wallSelected(self, obj, item):
     #self.previewBox.clear()
     
     #edjeObj = Layout(self.previewBox, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     
     edjeObj = Edje(self.previewBox.evas, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     
     filePath = item.data["filePath"]
     edjeObj.file_set(filePath, "e/desktop/background")
     edjeObj.show()
     
     self.previewBox.content_set(edjeObj)
     self.currentPreview = edjeObj
     self.selectedWall = filePath
Ejemplo n.º 3
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
Ejemplo n.º 4
0
    def connection_add(self, col1, row1, col2, row2):
        # print ("CONNECTION", col1, row1, col2, row2)
        if col1 == col2:
            # a stright line
            l = Edje(self.evas, file=self.themef, size_hint_align=FILL_BOTH,
                    group='egitu/graph/connection/vert',
                    color=self.color_for_column(col1))
            self.pack(l, col1, row1, col2 - col1 + 1, row2 - row1 + 1)

        elif col1 > col2:
            # a "fork"
            l = Edje(self.evas, file=self.themef, size_hint_align=FILL_BOTH,
                    group='egitu/graph/connection/vert_fork',
                    color=self.color_for_column(col1))
            self.pack(l, col2, row1, col1 - col2 + 1, row2 - row1 + 1)
        else:
            # a "merge"
            l = Edje(self.evas, file=self.themef, size_hint_align=FILL_BOTH,
                    group='egitu/graph/connection/vert_merge',
                    color=self.color_for_column(col2))
            self.pack(l, col1, row1, col2 - col1 + 1, row2 - row1 + 1)

        l.lower()
        l.show()

        return l
Ejemplo n.º 5
0
    def themeSelected(self, obj, item):
        #self.previewBox.clear()

        edjeObj = Edje(self.evas,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
        filePath = item.data["filePath"]

        try:
            edjeObj.file_set(filePath, "moksha/preview")
        except:
            edjeObj.file_set(filePath, "e/desktop/background")

        edjeObj.show()

        self.previewBox.content_set(edjeObj)
        self.currentPreview = edjeObj
        self.selectedTheme = filePath
Ejemplo n.º 6
0
 def themeSelected(self, obj, item):
     #self.previewBox.clear()
     
     edjeObj = Edje(self.evas, size_hint_weight=EXPAND_BOTH, 
             size_hint_align=FILL_BOTH)
     filePath = item.data["filePath"]
     
     try:
         edjeObj.file_set(filePath, "moksha/preview")
     except:
         edjeObj.file_set(filePath, "e/desktop/background")
     
     edjeObj.show()
     
     self.previewBox.content_set(edjeObj)
     self.currentPreview = edjeObj
     self.selectedTheme = filePath
Ejemplo n.º 7
0
 def addTheme(self, themeFile, ourPath):
     edjeObj = Edje(self.evas, size_hint_weight=EXPAND_BOTH, 
                     size_hint_align=FILL_BOTH)
     
     try:
         edjeObj.file_set("%s/%s"%(ourPath, themeFile), "moksha/preview")
     except:
         edjeObj.file_set("%s/%s"%(ourPath, themeFile), "e/desktop/background")
     
     edjeObj.show()
     
     listItem = self.themeList.item_append("%s"%themeFile, edjeObj, callback=self.themeSelected)
     listItem.data["filePath"] = "%s%s"%(ourPath, themeFile)
     listItem.selected_set(True)
     
     self.foundThemes.append("%s%s"%(ourPath, themeFile))
     
     self.themeSelected(None, listItem)
Ejemplo n.º 8
0
    def addTheme(self, themeFile, ourPath):
        edjeObj = Edje(self.evas,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)

        try:
            edjeObj.file_set("%s/%s" % (ourPath, themeFile), "moksha/preview")
        except:
            edjeObj.file_set("%s/%s" % (ourPath, themeFile),
                             "e/desktop/background")

        edjeObj.show()

        listItem = self.themeList.item_append("%s" % themeFile,
                                              edjeObj,
                                              callback=self.themeSelected)
        listItem.data["filePath"] = "%s%s" % (ourPath, themeFile)
        listItem.selected_set(True)

        self.foundThemes.append("%s%s" % (ourPath, themeFile))

        self.themeSelected(None, listItem)
Ejemplo n.º 9
0
    def wallSelected(self, obj, item):
        #self.previewBox.clear()

        #edjeObj = Layout(self.previewBox, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        edjeObj = Edje(self.previewBox.evas,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)

        filePath = item.data["filePath"]
        edjeObj.file_set(filePath, "e/desktop/background")
        edjeObj.show()

        self.previewBox.content_set(edjeObj)
        self.currentPreview = edjeObj
        self.selectedWall = filePath
 def __init__(self, canvas):
     Edje.__init__(self, canvas, file=theme_file, group="main")
 def __init__(self, canvas):
     Edje.__init__(self, canvas, file=theme_file, group="main")