code coverage

pull/14/head
sezanzeb 4 years ago
parent a62b13043a
commit a9cd8a9107

@ -1,5 +1,9 @@
# Key Mapper # Key Mapper
<p align="center">
<img src="data/coverage.svg"/>
</p>
Tool to change the mapping of your input device buttons. Tool to change the mapping of your input device buttons.
<p align="center"> <p align="center">

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# https://github.com/dbrgn/coverage-badge
coverage run --branch --source=/usr/lib/python3.8/site-packages/keymapper tests/test.py
python3 -m coverage_badge > data/coverage.svg

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="a">
<rect width="99" height="20" rx="3" fill="#fff"/>
</mask>
<g mask="url(#a)">
<path fill="#555" d="M0 0h63v20H0z"/>
<path fill="#a4a61d" d="M63 0h36v20H63z"/>
<path fill="url(#b)" d="M0 0h99v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
<text x="31.5" y="14">coverage</text>
<text x="80" y="15" fill="#010101" fill-opacity=".3">82%</text>
<text x="80" y="14">82%</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 904 B

@ -1,52 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
# Copyright (C) 2020 sezanzeb <proxima@hip70890b.de>
#
# This file is part of key-mapper.
#
# key-mapper is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# key-mapper is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
"""Error dialog."""
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GLib', '2.0')
from gi.repository import Gtk
from keymapper.data import get_data_path
from keymapper.logger import logger
class ErrorDialog:
"""An Error that closes the application afterwards."""
def __init__(self, primary, secondary):
"""
Parameters
----------
primary : string
secondary : string
"""
logger.error(secondary)
gladefile = get_data_path('key-mapper.glade')
builder = Gtk.Builder()
builder.add_from_file(gladefile)
error_dialog = builder.get_object('error_dialog')
error_dialog.show()
builder.get_object('primary_error_label').set_text(primary)
builder.get_object('secondary_error_label').set_text(secondary)
error_dialog.run()
error_dialog.hide()
Loading…
Cancel
Save