def output(outputable):
	if format.get_selected() == "html" or format.get_selected() == "htmlembedded":
		outputable.output_html()
	elif format.get_selected() == "text":
		outputable.output_text()
	else:
		outputable.output_xml()
def output(outputable):
	if format.get_selected() == "html":
		outputable.output_html()
	elif format.get_selected() == "text":
		outputable.output_text()
	else:
		outputable.output_xml()
Exemple #3
0
def get_url(email, size=20):
    md5hash = hashlib.md5(email.encode("utf-8").lower().strip()).hexdigest()
    base_url = "http://www.gravatar.com/avatar/" + md5hash
    params = None

    if format.get_selected() == "html":
        params = {"default": "identicon", "size": size}
    elif format.get_selected() == "xml":
        params = {"default": "identicon"}

    return base_url + "?" + urlencode(params)
def get_url(email, size=20):
    md5hash = hashlib.md5(email.encode("utf-8").lower().strip()).hexdigest()
    base_url = "http://www.gravatar.com/avatar/" + md5hash
    params = None

    if format.get_selected() == "html":
        params = {"default": "identicon", "size": size}
    elif format.get_selected() == "xml":
        params = {"default": "identicon"}

    return base_url + "?" + urlencode(params)
    def output_html(self):
        resp_xml = "<div><div class=\"box\" id=\"responsibilities\">"
        resp_xml += "<p>" + _(RESPONSIBILITIES_INFO_TEXT) + ".</p>"

        for i in sorted(
                set(i[0] for i in blame.get(self.hard, self.changes).blames)):
            responsibilities = sorted(
                ((i[1], i[0]) for i in Responsibilities.get(self.hard, i)),
                reverse=True)
            if responsibilities:
                resp_xml += "<div>"

                if format.get_selected() == "html":
                    author_email = self.changes.get_latest_email_by_author(i)
                    resp_xml += "<h3><img src=\"{0}\"/>{1} {2}</h3>".format(
                        gravatar.get_url(author_email, size=32), i,
                        _(MOSTLY_RESPONSIBLE_FOR_TEXT))
                else:
                    resp_xml += "<h3>{0} {1}</h3>".format(
                        i, _(MOSTLY_RESPONSIBLE_FOR_TEXT))

                for j, entry in enumerate(responsibilities):
                    resp_xml += "<div" + (" class=\"odd\">" if j % 2 == 1 else ">") + entry[1] + \
                                " (" + str(entry[0]) + " eloc)</div>"
                    if j >= 9:
                        break

                resp_xml += "</div>"
        resp_xml += "</div></div>"
        print(resp_xml)
	def output_html(self):
		resp_xml = "<div><div class=\"box\" id=\"responsibilities\">"
		resp_xml += "<p>" + _(RESPONSIBILITIES_INFO_TEXT) + ".</p>"

		for i in sorted(set(i[0] for i in blame.get(self.hard, self.useweeks, self.changes).blames)):
			responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, self.useweeks, i)), reverse=True)
			if responsibilities:
				resp_xml += "<div>"

				if format.get_selected() == "html":
					author_email = self.changes.get_latest_email_by_author(i)
					resp_xml += "<h3><img src=\"{0}\"/>{1} {2}</h3>".format(gravatar.get_url(author_email, size=32),
					            i, _(MOSTLY_RESPONSIBLE_FOR_TEXT))
				else:
					resp_xml += "<h3>{0} {1}</h3>".format(i, _(MOSTLY_RESPONSIBLE_FOR_TEXT))

				for j, entry in enumerate(responsibilities):
					resp_xml += "<div" + (" class=\"odd\">" if j % 2 == 1 else ">") + entry[1] + \
					            " (" + str(entry[0]) + " eloc)</div>"
					if j >= 9:
						break

				resp_xml += "</div>"
		resp_xml += "</div></div>"
		print(resp_xml)
Exemple #7
0
    def output_html(self):
        blame_xml = "<div><div class=\"box\">"
        blame_xml += "<p>" + _(
            BLAME_INFO_TEXT) + ".</p><div><table id=\"blame\" class=\"git\">"
        blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> </tr></thead>".format(
            _("Author"), _("Rows"), _("% in comments"))
        blame_xml += "<tbody>"
        chart_data = ""
        blames = sorted(__blame__.get_summed_blames().items())
        total_blames = 0

        for i in blames:
            total_blames += i[1].rows

        for i, entry in enumerate(blames):
            work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows /
                                                   total_blames))
            blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")

            if format.get_selected() == "html":
                author_email = self.changes.get_latest_email_by_author(
                    entry[0])
                blame_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
                    gravatar.get_url(author_email), entry[0])
            else:
                blame_xml += "<td>" + entry[0] + "</td>"

            blame_xml += "<td>" + str(entry[1].rows) + "</td>"
            blame_xml += "<td>" + "{0:.2f}".format(
                100.0 * entry[1].comments / entry[1].rows) + "</td>"
            blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
            blame_xml += "</tr>"
            chart_data += "{{label: \"{0}\", data: {1}}}".format(
                entry[0], work_percentage)

            if blames[-1] != entry:
                chart_data += ", "

        blame_xml += "<tfoot><tr> <td colspan=\"3\">&nbsp;</td> </tr></tfoot></tbody></table>"
        blame_xml += "<div class=\"chart\" id=\"blame_chart\"></div></div>"
        blame_xml += "<script type=\"text/javascript\">"
        blame_xml += "    $.plot($(\"#blame_chart\"), [{0}], {{".format(
            chart_data)
        blame_xml += "        series: {"
        blame_xml += "            pie: {"
        blame_xml += "                innerRadius: 0.4,"
        blame_xml += "                show: true,"
        blame_xml += "                combine: {"
        blame_xml += "                    threshold: 0.01,"
        blame_xml += "                    label: \"" + _(
            "Minor Authors") + "\""
        blame_xml += "                }"
        blame_xml += "            }"
        blame_xml += "        }, grid: {"
        blame_xml += "            hoverable: true"
        blame_xml += "        }"
        blame_xml += "    });"
        blame_xml += "</script></div></div>"

        print(blame_xml)
Exemple #8
0
    def output_html(self):
        blame_xml = '<div><div class="box">'
        blame_xml += "<p>" + _(BLAME_INFO_TEXT) + '.</p><div><table id="blame" class="git">'
        blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th> </tr></thead>".format(
            _("Author"), _("Rows"), _("Stability"), _("Age"), _("% in comments")
        )
        blame_xml += "<tbody>"
        chart_data = ""
        blames = sorted(__blame__.get_summed_blames().items())
        total_blames = 0

        for i in blames:
            total_blames += i[1].rows

        for i, entry in enumerate(blames):
            work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
            blame_xml += "<tr " + ('class="odd">' if i % 2 == 1 else ">")

            if format.get_selected() == "html":
                author_email = self.changes.get_latest_email_by_author(entry[0])
                blame_xml += '<td><img src="{0}"/>{1}</td>'.format(gravatar.get_url(author_email), entry[0])
            else:
                blame_xml += "<td>" + entry[0] + "</td>"

            blame_xml += "<td>" + str(entry[1].rows) + "</td>"
            blame_xml += "<td>" + (
                "{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>"
            )
            blame_xml += "<td>" + "{0:.1f}".format(float(entry[1].skew) / entry[1].rows) + "</td>"
            blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
            blame_xml += '<td style="display: none">' + work_percentage + "</td>"
            blame_xml += "</tr>"
            chart_data += '{{label: "{0}", data: {1}}}'.format(entry[0], work_percentage)

            if blames[-1] != entry:
                chart_data += ", "

        blame_xml += '<tfoot><tr> <td colspan="5">&nbsp;</td> </tr></tfoot></tbody></table>'
        blame_xml += '<div class="chart" id="blame_chart"></div></div>'
        blame_xml += '<script type="text/javascript">'
        blame_xml += '    blame_plot = $.plot($("#blame_chart"), [{0}], {{'.format(chart_data)
        blame_xml += "        series: {"
        blame_xml += "            pie: {"
        blame_xml += "                innerRadius: 0.4,"
        blame_xml += "                show: true,"
        blame_xml += "                combine: {"
        blame_xml += "                    threshold: 0.01,"
        blame_xml += '                    label: "' + _("Minor Authors") + '"'
        blame_xml += "                }"
        blame_xml += "            }"
        blame_xml += "        }, grid: {"
        blame_xml += "            hoverable: true"
        blame_xml += "        }"
        blame_xml += "    });"
        blame_xml += "</script></div></div>"

        print(blame_xml)
Exemple #9
0
	def output_html(self):
		get(self.hard)

		blame_xml = "<div><div class=\"box\">"
		blame_xml += "<p>" + _(BLAME_INFO_TEXT) + ".</p><div><table id=\"blame\" class=\"git\">"
		blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> </tr></thead>".format(_("Author"),
		             _("Rows"), _("% in comments"))
		blame_xml += "<tbody>"
		chart_data = ""
		blames = sorted(__blame__.get_summed_blames().items())
		total_blames = 0

		for i in blames:
			total_blames += i[1].rows

		for i, entry in enumerate(blames):
			work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
			blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")

			if format.get_selected() == "html":
				author_email = self.changes.get_author_email(entry[0])
				blame_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(author_email), entry[0])
			else:
				blame_xml += "<td>" + entry[0] + "</td>"

			blame_xml += "<td>" + str(entry[1].rows) + "</td>"
			blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
			blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
			blame_xml += "</tr>"
			chart_data += "{{label: \"{0}\", data: {1}}}".format(entry[0], work_percentage)

			if blames[-1] != entry:
				chart_data += ", "

		blame_xml += "<tfoot><tr> <td colspan=\"3\">&nbsp;</td> </tr></tfoot></tbody></table>"
		blame_xml += "<div class=\"chart\" id=\"blame_chart\"></div></div>"
		blame_xml += "<script type=\"text/javascript\">"
		blame_xml += "    $.plot($(\"#blame_chart\"), [{0}], {{".format(chart_data)
		blame_xml += "        series: {"
		blame_xml += "            pie: {"
		blame_xml += "                innerRadius: 0.4,"
		blame_xml += "                show: true,"
		blame_xml += "                combine: {"
		blame_xml += "                    threshold: 0.01,"
		blame_xml += "                    label: \"" + _("Minor Authors") + "\""
		blame_xml += "                }"
		blame_xml += "            }"
		blame_xml += "        }, grid: {"
		blame_xml += "            hoverable: true"
		blame_xml += "        }"
		blame_xml += "    });"
		blame_xml += "</script></div></div>"

		print(blame_xml)
Exemple #10
0
def __output_row__html__(timeline_data, periods, names):
    timeline_xml = "<table class=\"git full\"><thead><tr><th>" + _(
        "Author") + "</th>"

    for period in periods:
        timeline_xml += "<th>" + str(period) + "</th>"

    timeline_xml += "</tr></thead><tbody>"
    i = 0

    for name in names:
        if timeline_data.is_author_in_periods(periods, name[0]):
            timeline_xml += "<tr" + (" class=\"odd\">" if i % 2 == 1 else ">")

            if format.get_selected() == "html":
                timeline_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
                    gravatar.get_url(name[1]), name[0])
            else:
                timeline_xml += "<td>" + name[0] + "</td>"

            for period in periods:
                multiplier = timeline_data.get_multiplier(period, 18)
                signs = timeline_data.get_author_signs_in_period(
                    name[0], period, multiplier)
                signs_str = (signs[1] * "<div class=\"remove\">&nbsp;</div>" +
                             signs[0] * "<div class=\"insert\">&nbsp;</div>")

                timeline_xml += "<td>" + (
                    "." if timeline_data.is_author_in_period(period, name[0])
                    and len(signs_str) == 0 else signs_str)
                timeline_xml += "</td>"
            timeline_xml += "</tr>"
            i = i + 1

    timeline_xml += "<tfoot><tr><td><strong>" + _(
        MODIFIED_ROWS_TEXT) + "</strong></td>"

    for period in periods:
        total_changes = timeline_data.get_total_changes_in_period(period)
        timeline_xml += "<td>" + str(total_changes[2]) + "</td>"

    timeline_xml += "</tr></tfoot></tbody></table>"
    print(timeline_xml)
def __output_row__html__(timeline_data, periods, names):
	timeline_xml = "<table class=\"git full\"><thead><tr><th>" + _("Author") + "</th>"

	for period in periods:
		timeline_xml += "<th>" + str(period) + "</th>"

	timeline_xml += "</tr></thead><tbody>"
	i = 0

	for name in names:
		if timeline_data.is_author_in_periods(periods, name[0]):
			timeline_xml += "<tr" + (" class=\"odd\">" if i % 2 == 1 else ">")

			if format.get_selected() == "html":
				timeline_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(name[1]), name[0])
			else:
				timeline_xml += "<td>" + name[0] + "</td>"

			for period in periods:
				multiplier = timeline_data.get_multiplier(period, 18)
				signs = timeline_data.get_author_signs_in_period(name[0], period, multiplier)
				signs_str = (signs[1] * "<div class=\"remove\">&nbsp;</div>" + signs[0] * "<div class=\"insert\">&nbsp;</div>")

				timeline_xml += "<td>" + ("." if timeline_data.is_author_in_period(period, name[0]) and len(signs_str) == 0 else signs_str)
				timeline_xml += "</td>"
			timeline_xml += "</tr>"
			i = i + 1

	timeline_xml += "<tfoot><tr><td><strong>" + _(MODIFIED_ROWS_TEXT) + "</strong></td>"

	for period in periods:
		total_changes = timeline_data.get_total_changes_in_period(period)
		timeline_xml += "<td>" + str(total_changes[2]) + "</td>"

	timeline_xml += "</tr></tfoot></tbody></table>"
	print(timeline_xml)
	def output_html(self):
		authorinfo_list = self.changes.get_authorinfo_list()
		total_changes = 0.0
		changes_xml = "<div><div class=\"box\">"
		chart_data = ""

		for i in authorinfo_list:
			total_changes += authorinfo_list.get(i).insertions
			total_changes += authorinfo_list.get(i).deletions

		if authorinfo_list:
			changes_xml += "<p>" + _(HISTORICAL_INFO_TEXT) + ".</p><div><table id=\"changes\" class=\"git\">"
			changes_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th>".format(
			               _("Author"), _("Commits"), _("Insertions"), _("Deletions"), _("% of changes"))
			changes_xml += "</tr></thead><tbody>"

			for i, entry in enumerate(sorted(authorinfo_list)):
				authorinfo = authorinfo_list.get(entry)
				percentage = 0 if total_changes == 0 else (authorinfo.insertions + authorinfo.deletions) / total_changes * 100

				changes_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")

				if format.get_selected() == "html":
					changes_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
					               gravatar.get_url(self.changes.get_latest_email_by_author(entry)), entry)
				else:
					changes_xml += "<td>" + entry + "</td>"

				changes_xml += "<td>" + str(authorinfo.commits) + "</td>"
				changes_xml += "<td>" + str(authorinfo.insertions) + "</td>"
				changes_xml += "<td>" + str(authorinfo.deletions) + "</td>"
				changes_xml += "<td>" + "{0:.2f}".format(percentage) + "</td>"
				changes_xml += "</tr>"
				chart_data += "{{label: \"{0}\", data: {1}}}".format(entry, "{0:.2f}".format(percentage))

				if sorted(authorinfo_list)[-1] != entry:
					chart_data += ", "

			changes_xml += ("<tfoot><tr> <td colspan=\"5\">&nbsp;</td> </tr></tfoot></tbody></table>")
			changes_xml += "<div class=\"chart\" id=\"changes_chart\"></div></div>"
			changes_xml += "<script type=\"text/javascript\">"
			changes_xml += "    changes_plot = $.plot($(\"#changes_chart\"), [{0}], {{".format(chart_data)
			changes_xml += "        series: {"
			changes_xml += "            pie: {"
			changes_xml += "                innerRadius: 0.4,"
			changes_xml += "                show: true,"
			changes_xml += "                combine: {"
			changes_xml += "                    threshold: 0.01,"
			changes_xml += "                    label: \"" + _("Minor Authors") + "\""
			changes_xml += "                }"
			changes_xml += "            }"
			changes_xml += "        }, grid: {"
			changes_xml += "            hoverable: true"
			changes_xml += "        }"
			changes_xml += "    });"
			changes_xml += "</script>"
		else:
			changes_xml += "<p>" + _(NO_COMMITED_FILES_TEXT) + ".</p>"

		changes_xml += "</div></div>"
		print(changes_xml)
Exemple #13
0
    def output_html(self):
        authorinfo_list = self.changes.get_authorinfo_list()
        total_changes = 0.0
        changes_xml = "<div><div class=\"box\">"
        chart_data = ""

        for i in authorinfo_list:
            total_changes += authorinfo_list.get(i).insertions
            total_changes += authorinfo_list.get(i).deletions

        if authorinfo_list:
            changes_xml += "<p>" + _(
                HISTORICAL_INFO_TEXT
            ) + ".</p><div><table id=\"changes\" class=\"git\">"
            changes_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th>".format(
                _("Author"), _("Commits"), _("Insertions"), _("Deletions"),
                _("% of changes"))
            changes_xml += "</tr></thead><tbody>"

            for i, entry in enumerate(sorted(authorinfo_list)):
                authorinfo = authorinfo_list.get(entry)
                percentage = 0 if total_changes == 0 else (
                    authorinfo.insertions +
                    authorinfo.deletions) / total_changes * 100

                changes_xml += "<tr " + ("class=\"odd\">" if i %
                                         2 == 1 else ">")

                if format.get_selected() == "html":
                    changes_xml += "<td><img src=\"{0}\"/>{1}</td>".format(
                        gravatar.get_url(self.changes.get_author_email(entry)),
                        entry)
                else:
                    changes_xml += "<td>" + entry + "</td>"

                changes_xml += "<td>" + str(authorinfo.commits) + "</td>"
                changes_xml += "<td>" + str(authorinfo.insertions) + "</td>"
                changes_xml += "<td>" + str(authorinfo.deletions) + "</td>"
                changes_xml += "<td>" + "{0:.2f}".format(percentage) + "</td>"
                changes_xml += "</tr>"
                chart_data += "{{label: \"{0}\", data: {1}}}".format(
                    entry, "{0:.2f}".format(percentage))

                if sorted(authorinfo_list)[-1] != entry:
                    chart_data += ", "

            changes_xml += (
                "<tfoot><tr> <td colspan=\"5\">&nbsp;</td> </tr></tfoot></tbody></table>"
            )
            changes_xml += "<div class=\"chart\" id=\"changes_chart\"></div></div>"
            changes_xml += "<script type=\"text/javascript\">"
            changes_xml += "    $.plot($(\"#changes_chart\"), [{0}], {{".format(
                chart_data)
            changes_xml += "        series: {"
            changes_xml += "            pie: {"
            changes_xml += "                innerRadius: 0.4,"
            changes_xml += "                show: true,"
            changes_xml += "                combine: {"
            changes_xml += "                    threshold: 0.01,"
            changes_xml += "                    label: \"" + _(
                "Minor Authors") + "\""
            changes_xml += "                }"
            changes_xml += "            }"
            changes_xml += "        }, grid: {"
            changes_xml += "            hoverable: true"
            changes_xml += "        }"
            changes_xml += "    });"
            changes_xml += "</script>"
        else:
            changes_xml += "<p>" + _(NO_COMMITED_FILES_TEXT) + ".</p>"

        changes_xml += "</div></div>"
        print(changes_xml)