Esempio n. 1
0
# pylint: disable=invalid-name
# I hate seeing caps everywhere, I refuse to allcaps my constants!
config = ConfigParser.SafeConfigParser()
config.read('config.cfg')

commands = ConfigParser.SafeConfigParser()
config.read('commands.cfg')

# Set the third, optional argument of get to 1 if you wish to use raw mode.
port = config.get('General', 'port')
clientip = config.get('General', 'clientip')
username = config.get('General', 'username')
key = config.get('General', 'key')
pidfile = config.get('General', 'pidfile')
log_level = config.get('General', 'log_level')
LOGLEVEL.set_level(log_level)

stdin = config.get('General', 'stdin')
stdout = config.get('General', 'stdout')
stderr = config.get('General', 'stderr')


def execute_command(cmd):
    """Fetch key combos from config and execute them."""
    # see if exists in one-press, other wise look at sequence
    # if it's not there at all, throw error!

    # TODO: consider if it's not simpeler to see all commands as sequenses
    keys = []
    try:
        keys.append(config.get('one-press', cmd))
import tkFont
import os

from config.config import CONFIG
from tools.colorlog import LOGLEVEL, log
from tools.localize import _

from tabs.home import Home
from tabs.learn import Learn
from tabs.review import Review
from tabs.stats import Stats
from tabs.settings import Settings
from tabs.help import Help

# pylint: disable=invalid-name
LOGLEVEL.set_level(CONFIG.log_level)
localepath = os.path.join(os.getcwd(), "locale")


class AsetniopTrainer(object):

    """Train chord typing."""

    def __init__(self, master):
        """Draw main window."""
        self.master = master

        # current tab
        self.active_tab = Home(master)

        # menu frame + buttons
#!/usr/bin/python
"""Keep track of window title of the window currently in focus."""
import sys
import i3ipc
import unicodedata
from daemon import daemon
from tools.colorlog import log, LOGLEVEL

LOGLEVEL.set_level("verbose")

# pylint: disable=invalid-name

stdin = "/dev/null"
stdout = "/dev/null"
stderr = "/dev/null"
pidfile = "/home/nihlaeth/pyi3windowtitle/pyi3windowtitle.pid"


def on_window_focus(i3, _):
    """Callback for window focus event."""
    focused = i3.get_tree().find_focused()
    window_class = focused.window_class
    window_name = focused.name
    info_string = "class= %s title= %s" % (window_class, window_name)
    info_string = unicodedata.normalize(
        'NFKD',
        info_string).encode('ascii', 'ignore')
    with open("/home/nihlaeth/.i3/windowfocus", "w") as focus_file:
        focus_file.write(info_string)