update to py3
This commit is contained in:
@@ -1 +1 @@
|
|||||||
from flashing_keyboard import FlashingKeyboard
|
from .flashing_keyboard import FlashingKeyboard
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GObject
|
||||||
import subprocess
|
import subprocess
|
||||||
import gobject
|
|
||||||
|
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from plugins import GajimPlugin
|
from plugins import GajimPlugin
|
||||||
@@ -16,12 +16,12 @@ class FlashingKeyboard(GajimPlugin):
|
|||||||
self.description = _('Flashing keyboard led when there are unread messages.')
|
self.description = _('Flashing keyboard led when there are unread messages.')
|
||||||
self.config_dialog = FlashingKeyboardPluginConfigDialog(self)
|
self.config_dialog = FlashingKeyboardPluginConfigDialog(self)
|
||||||
self.config_default_values = {
|
self.config_default_values = {
|
||||||
'command1': ("xset led named 'Scroll Lock'", ''),
|
'command1': ("xset led named 'Scroll Lock'", ''),
|
||||||
'command2': ("xset -led named 'Scroll Lock'", '')}
|
'command2': ("xset -led named 'Scroll Lock'", '')}
|
||||||
|
|
||||||
self.is_active = None
|
self.is_active = None
|
||||||
self.timeout = 500
|
self.timeout = 500
|
||||||
self.timeout_off = self.timeout / 2
|
self.timeout_off = int(self.timeout / 2)
|
||||||
self.id_0 = None
|
self.id_0 = None
|
||||||
|
|
||||||
def on_event_added(self, event):
|
def on_event_added(self, event):
|
||||||
@@ -35,15 +35,15 @@ class FlashingKeyboard(GajimPlugin):
|
|||||||
if gajim.events.get_nb_systray_events():
|
if gajim.events.get_nb_systray_events():
|
||||||
if self.id_0:
|
if self.id_0:
|
||||||
return
|
return
|
||||||
self.id_0 = gobject.timeout_add(self.timeout, self.led_on)
|
self.id_0 = GObject.timeout_add(self.timeout, self.led_on)
|
||||||
else:
|
else:
|
||||||
if self.id_0:
|
if self.id_0:
|
||||||
gobject.source_remove(self.id_0)
|
GObject.source_remove(self.id_0)
|
||||||
self.id_0 = None
|
self.id_0 = None
|
||||||
|
|
||||||
def led_on(self):
|
def led_on(self):
|
||||||
subprocess.Popen('%s' % self.config['command1'], shell=True).wait()
|
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
|
return True
|
||||||
|
|
||||||
def led_off(self):
|
def led_off(self):
|
||||||
@@ -54,26 +54,26 @@ class FlashingKeyboard(GajimPlugin):
|
|||||||
gajim.events.event_added_subscribe(self.on_event_added)
|
gajim.events.event_added_subscribe(self.on_event_added)
|
||||||
gajim.events.event_removed_subscribe(self.on_event_removed)
|
gajim.events.event_removed_subscribe(self.on_event_removed)
|
||||||
if gajim.events.get_nb_systray_events():
|
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')
|
@log_calls('FlashingKeyboard')
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
gajim.events.event_added_unsubscribe(self.on_event_added)
|
gajim.events.event_added_unsubscribe(self.on_event_added)
|
||||||
gajim.events.event_removed_unsubscribe(self.on_event_removed)
|
gajim.events.event_removed_unsubscribe(self.on_event_removed)
|
||||||
if self.id_0:
|
if self.id_0:
|
||||||
gobject.source_remove(self.id_0)
|
GObject.source_remove(self.id_0)
|
||||||
|
|
||||||
|
|
||||||
class FlashingKeyboardPluginConfigDialog(GajimPluginConfigDialog):
|
class FlashingKeyboardPluginConfigDialog(GajimPluginConfigDialog):
|
||||||
def init(self):
|
def init(self):
|
||||||
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
|
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
|
||||||
'config_dialog.ui')
|
'config_dialog.ui')
|
||||||
self.xml = gtk.Builder()
|
self.xml = Gtk.Builder()
|
||||||
self.xml.set_translation_domain('gajim_plugins')
|
self.xml.set_translation_domain('gajim_plugins')
|
||||||
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
|
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
|
||||||
['config_table'])
|
['config_table'])
|
||||||
config_table = self.xml.get_object('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.xml.connect_signals(self)
|
||||||
self.connect('hide', self.on_close_button_clicked)
|
self.connect('hide', self.on_close_button_clicked)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Flashing Keyboard
|
name: Flashing Keyboard
|
||||||
short_name: flashing_keyboard
|
short_name: flashing_keyboard
|
||||||
version: 0.1.4
|
version: 0.2
|
||||||
description: Flashing keyboard led when there are unread messages.
|
description: Flashing keyboard led when there are unread messages.
|
||||||
authors: Denis Fomin <fominde@gmail.com>
|
authors: Denis Fomin <fominde@gmail.com>
|
||||||
homepage: http://trac-plugins.gajim.org/wiki/FlashingKeyboardPlugin
|
homepage: http://trac-plugins.gajim.org/wiki/FlashingKeyboardPlugin
|
||||||
max_gajim_version: 0.15.9
|
min_gajim_version: 0.15.10
|
||||||
|
|||||||
Reference in New Issue
Block a user