Commit 7f641a15 authored by Yann Leboulanger's avatar Yann Leboulanger

update to py3

parent cbddc755
from flashing_keyboard import FlashingKeyboard
from .flashing_keyboard import FlashingKeyboard
# -*- coding: utf-8 -*-
import gtk
from gi.repository import Gtk
from gi.repository import GObject
import subprocess
import gobject
from common import gajim
from plugins import GajimPlugin
......@@ -16,12 +16,12 @@ class FlashingKeyboard(GajimPlugin):
self.description = _('Flashing keyboard led when there are unread messages.')
self.config_dialog = FlashingKeyboardPluginConfigDialog(self)
self.config_default_values = {
'command1': ("xset led named 'Scroll Lock'", ''),
'command2': ("xset -led named 'Scroll Lock'", '')}
'command1': ("xset led named 'Scroll Lock'", ''),
'command2': ("xset -led named 'Scroll Lock'", '')}
self.is_active = None
self.timeout = 500
self.timeout_off = self.timeout / 2
self.timeout_off = int(self.timeout / 2)
self.id_0 = None
def on_event_added(self, event):
......@@ -35,15 +35,15 @@ class FlashingKeyboard(GajimPlugin):
if gajim.events.get_nb_systray_events():
if self.id_0:
return
self.id_0 = gobject.timeout_add(self.timeout, self.led_on)
self.id_0 = GObject.timeout_add(self.timeout, self.led_on)
else:
if self.id_0:
gobject.source_remove(self.id_0)
GObject.source_remove(self.id_0)
self.id_0 = None
def led_on(self):
subprocess.Popen('%s' % self.config['command1'], shell=True).wait()
gobject.timeout_add(self.timeout_off, self.led_off)
GObject.timeout_add(self.timeout_off, self.led_off)
return True
def led_off(self):
......@@ -54,26 +54,26 @@ class FlashingKeyboard(GajimPlugin):
gajim.events.event_added_subscribe(self.on_event_added)
gajim.events.event_removed_subscribe(self.on_event_removed)
if gajim.events.get_nb_systray_events():
self.id_0 = gobject.timeout_add(self.timeout, self.led_on)
self.id_0 = GObject.timeout_add(self.timeout, self.led_on)
@log_calls('FlashingKeyboard')
def deactivate(self):
gajim.events.event_added_unsubscribe(self.on_event_added)
gajim.events.event_removed_unsubscribe(self.on_event_removed)
if self.id_0:
gobject.source_remove(self.id_0)
GObject.source_remove(self.id_0)
class FlashingKeyboardPluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
'config_dialog.ui')
self.xml = gtk.Builder()
'config_dialog.ui')
self.xml = Gtk.Builder()
self.xml.set_translation_domain('gajim_plugins')
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
['config_table'])
config_table = self.xml.get_object('config_table')
self.child.pack_start(config_table)
self.get_child().pack_start(config_table, True, True, 0)
self.xml.connect_signals(self)
self.connect('hide', self.on_close_button_clicked)
......
[info]
name: Flashing Keyboard
short_name: flashing_keyboard
version: 0.1.4
version: 0.2
description: Flashing keyboard led when there are unread messages.
authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/FlashingKeyboardPlugin
max_gajim_version: 0.15.9
min_gajim_version: 0.15.10
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment