Skip to content

Commit

Permalink
Simplify readme; adjust logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Oct 18, 2020
1 parent 121ea2e commit 3b4a128
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keyhint

**_Display context-sensitive keyboard shortcuts or other hints on Linux and Windows._**
**_Display keyboard shortcuts or other hints based on the **process name** and **window title** of the active window. (Linux/Windows)_**

<p align="center"><br>
<img alt="Tests passing" src="https://github.com/dynobo/keyhint/workflows/Test/badge.svg">
Expand All @@ -13,13 +13,11 @@

- Install: `pip install keyhint`
- Execute: `keyhint`
- Recommendation: Configure a **global hotkey** to start `keyhint` on demand.
- Tip: Configure a **global hotkey** to start `keyhint` on demand!

Based on the **process name** and **window title** of the active window, different sets of hints are displayed.
_Keyhint showing shortcuts for VS Code:_

_Screenshots of some hints:_

![General Firefox Shortcuts](assets/demo.gif)
![General Firefox Shortcuts](assets/vscode.png)

## Configuration

Expand Down
Binary file modified assets/vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion keyhint/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Standard
import logging
import sys
import traceback

# Own
from . import helpers
Expand Down Expand Up @@ -63,7 +64,7 @@ def main(testrun=False):
except Exception as error: # noqa
# Print useful information for reporting
logger.error("================ An error occured! ============")
logger.error("Stacktrace:\n%s", error)
logger.exception("Error: %s", error)
logger.error("Datamodel on Error:%s", data)
logger.error("keyhint Version: %s", __version__)
logger.error(
Expand Down
12 changes: 7 additions & 5 deletions keyhint/handlers/show_hints_handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Handler responsible for attaching screenshot(s) to session data."""

# default
from tkinter import Frame, Label, Tk, font # noqa
from tkinter import Frame, Label, Tk # noqa
from tkinter.font import nametofont # noqa

import logging

# Own
Expand Down Expand Up @@ -51,13 +53,13 @@ def _set_style(self):
self.style["background_color"] = background_color
self.config(bg=background_color)

title_font = font.nametofont("TkDefaultFont").copy()
title_font = nametofont("TkDefaultFont").copy()
title_font.configure(size=int(font_base_size * 1.4))

group_title_font = font.nametofont("TkDefaultFont").copy()
group_title_font = nametofont("TkDefaultFont").copy()
group_title_font.configure(size=int(font_base_size * 1.125))

statusbar_font = font.nametofont("TkDefaultFont").copy()
statusbar_font = nametofont("TkDefaultFont").copy()
statusbar_font.configure(size=int(font_base_size * 0.5))

# Font Styles
Expand Down Expand Up @@ -198,7 +200,7 @@ def handle(self, data: HintsData) -> HintsData:
# Default font
font_family = self.data.config["style"].get("font_family", "")
font_base_size = self.data.config["style"].get("font_base_size", 16)
default_font = font.nametofont("TkDefaultFont")
default_font = nametofont("TkDefaultFont")
default_font.configure(size=int(font_base_size * 0.85), family=font_family)
root.option_add("*Font", default_font)

Expand Down

0 comments on commit 3b4a128

Please sign in to comment.