<commit_before># -*- coding=utf-8 -*-
# The current version of this file partly comes from:
#   http://code.google.com/p/python-webqq/
# Copyright 2012 <NAME> (<EMAIL>)
# Licensed under the terms of the BSD 3-Clause.

import gtk
import keybinder
import utils
from utils import _


class Tray():
    def __init__(self, app):
        self.window = app.window
        self.webview = app.webview
        self.config = app.config
        self.app = app
        self.blinking = False

        self.icon = self.app.get_app_icon()
        self.icon_alt = self.app.get_app_icon(get_alt=True)

        self.makePopup()

        self.isUnity = utils.is_unity()
        if self.isUnity:
            self.makeUnityTray()
        else:
            self.makeTray()
        if self.config["hot_key"]:
            keybinder.bind(self.config["hot_key"], self.keybind_callback)

    def makeTray(self):
        self.tray = gtk.StatusIcon()
        self.tray.set_from_file(self.icon)
        self.tray.set_tooltip(self.app.appInfo["name"])
        self.tray.connect('activate', self.click_tray)
        self.tray.connect('popup-menu',
            lambda statusicon, button, activate_time: \
                self.pop_menu.popup(
                    None, None, None, 0, gtk.get_current_event_time()))

    def makeUnityTray(self):
        import appindicator
        self.tray = appindicator.Indicator(
                "example-simple-client",
                self.app.appInfo["name"],
                appindicator.CATEGORY_APPLICATION_STATUS)
        self.tray.set_status(appindicator.STATUS_ACTIVE)
        self.change_icon(self.icon)
        self.tray.set_menu(self.pop_menu)

    def makePopup(self):
        pop_menu = gtk.Menu()
        item1 = gtk.MenuItem(_('Show/Hide Window'))<commit_msg>Keybinder not imported globaly for now.<commit_after># -*- coding=utf-8 -*-
# The current version of this file partly comes from:
#   http://code.google.com/p/python-webqq/
# Copyright 2012 <NAME> (<EMAIL>)
# Licensed under the terms of the BSD 3-Clause.

import gtk
import utils
from utils import _


class Tray():
    def __init__(self, app):
        self.window = app.window
        self.webview = app.webview
        self.config = app.config
        self.app = app
        self.blinking = False

        self.icon = self.app.get_app_icon()
        self.icon_alt = self.app.get_app_icon(get_alt=True)

        self.makePopup()

        self.isUnity = utils.is_unity()
        if self.isUnity:
            self.makeUnityTray()
        else:
            self.makeTray()
        if self.config["hot_key"]:
            import keybinder
            keybinder.bind(self.config["hot_key"], self.keybind_callback)

    def makeTray(self):
        self.tray = gtk.StatusIcon()
        self.tray.set_from_file(self.icon)
        self.tray.set_tooltip(self.app.appInfo["name"])
        self.tray.connect('activate', self.click_tray)
        self.tray.connect('popup-menu',
            lambda statusicon, button, activate_time: \
                self.pop_menu.popup(
                    None, None, None, 0, gtk.get_current_event_time()))

    def makeUnityTray(self):
        import appindicator
        self.tray = appindicator.Indicator(
                "example-simple-client",
                self.app.appInfo["name"],
                appindicator.CATEGORY_APPLICATION_STATUS)
        self.tray.set_status(appindicator.STATUS_ACTIVE)
        self.change_icon(self.icon)
        self.tray.set_menu(self.pop_menu)

    def makePopup(self):
        pop_menu = gtk.Menu()
        item1 = gtk.MenuItem(_('Show/Hide Window'))
{'fraction_non_alphanumeric': 0.11442093541202672, 'fraction_numerical': 0.004454342984409799, 'mean_word_length': 2.222421524663677, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7099553', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1133, 'n_words': 208}