SetLocationPlugin.coding style

This commit is contained in:
Denis Fomin
2013-02-05 18:36:58 +04:00
parent 6d9ad5fc4a
commit 2e0037bef4

View File

@@ -12,6 +12,7 @@ from plugins import GajimPlugin
from plugins.helpers import log_calls from plugins.helpers import log_calls
from common import gajim from common import gajim
from common import ged from common import ged
from common import helpers
import gtkgui_helpers import gtkgui_helpers
from dialogs import InputDialog, WarningDialog from dialogs import InputDialog, WarningDialog
@@ -224,7 +225,6 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
def show_contacts(self): def show_contacts(self):
from gi.repository import Champlain from gi.repository import Champlain
if not self.markers_is_visible:
data = {} data = {}
accounts = gajim.contacts._accounts accounts = gajim.contacts._accounts
for account in accounts: for account in accounts:
@@ -241,16 +241,17 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
name = accounts[account].contacts.get_first_contact_from_jid( name = accounts[account].contacts.get_first_contact_from_jid(
contact).name contact).name
data[contact] = (lat, lon, name) data[contact] = (lat, lon, name)
self.contacts_layer = Champlain.MarkerLayer()
for jid in data: for jid in data:
path = self.get_path_to_generic_or_avatar(self.path_to_image, path = self.get_path_to_generic_or_avatar(self.path_to_image,
jid=jid, suffix='') jid=jid, suffix='')
marker = Champlain.Label.new_from_file(path) marker = Champlain.Label.new_from_file(path)
marker.set_text(data[jid][2]) marker.set_text(data[jid][2])
self.contacts_layer = Champlain.MarkerLayer()
marker.set_location(float(data[jid][0]), float(data[jid][1])) marker.set_location(float(data[jid][0]), float(data[jid][1]))
self.view.add_layer(self.contacts_layer)
self.contacts_layer.add_marker(marker) self.contacts_layer.add_marker(marker)
self.view.add_layer(self.contacts_layer)
self.contacts_layer.animate_in_all_markers() self.contacts_layer.animate_in_all_markers()
self.markers_is_visible = True self.markers_is_visible = True
@@ -262,7 +263,6 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
path to the image. generic must be with extension and suffix without path to the image. generic must be with extension and suffix without
""" """
if jid: if jid:
from common import helpers
# we want an avatar # we want an avatar
puny_jid = helpers.sanitize_filename(jid) puny_jid = helpers.sanitize_filename(jid)
path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix