Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Fomin <fominde@gmail.com>2010-09-28 19:29:50 +0400
committerDenis Fomin <fominde@gmail.com>2010-09-28 19:29:50 +0400
commitec6e0e704d71ac7d5442298f705170377944525c (patch)
treedb52b8cbb1f98b41d244258bdb3c10e24568feaf /set_location
parent560afe70af6b984b388505a16f322365e3862427 (diff)
set_location. some fix
Diffstat (limited to 'set_location')
-rw-r--r--set_location/config_dialog.ui12
-rw-r--r--set_location/manifest.ini4
-rw-r--r--set_location/set_location.py36
3 files changed, 32 insertions, 20 deletions
diff --git a/set_location/config_dialog.ui b/set_location/config_dialog.ui
index 8976fdc..6c7b659 100644
--- a/set_location/config_dialog.ui
+++ b/set_location/config_dialog.ui
@@ -417,17 +417,7 @@
<placeholder/>
</child>
<child>
- <object class="GtkLabel" id="help_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Click the right mouse button to specify the location</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="padding">6</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
+ <placeholder/>
</child>
</object>
<packing>
diff --git a/set_location/manifest.ini b/set_location/manifest.ini
index 29fce84..a840ecf 100644
--- a/set_location/manifest.ini
+++ b/set_location/manifest.ini
@@ -1,9 +1,9 @@
[info]
name: Set Location
short_name: set_location
-version: 0.2
+version: 0.3
description: Set information about the current geographical or physical location.
- To be able to specify a location on the built-in card, you must install python-osmgpsmap
+ To be able to specify a location on the built-in card, you must install python-osmgpsmap > 0.5
authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/SetLocalitionPlugin
diff --git a/set_location/set_location.py b/set_location/set_location.py
index b01c9ae..d593f79 100644
--- a/set_location/set_location.py
+++ b/set_location/set_location.py
@@ -78,14 +78,22 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
self.child.pack_start(hbox)
self.xml.connect_signals(self)
self.connect('hide', self.on_hide)
+ self.is_active = None
def on_run(self):
no_map = None
+
+ for name in self.plugin.config_default_values:
+ widget = self.xml.get_object(name)
+ widget.set_text(str(self.plugin.config[name]))
+
try:
import osmgpsmap
+ if osmgpsmap.__version__ < '0.6':
+ no_map = True
except:
no_map = True
- if not no_map:
+ if not no_map and not self.is_active:
from layers import DummyLayer
import gtkgui_helpers
@@ -103,13 +111,15 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
'gajim', 16))
self.icon = gtk.gdk.pixbuf_new_from_file_at_size(
self.path_to_image, 16, 16)
- self.osm_image = self.osm.image_add(lat, lon, self.icon)
self.osm.connect('button_release_event', self.map_clicked)
- vbox.pack_start(self.osm)
-
- for name in self.plugin.config_default_values:
- widget = self.xml.get_object(name)
- widget.set_text(str(self.plugin.config[name]))
+ vbox.pack_start(self.osm, expand=True, fill=True, padding=6)
+ label = gtk.Label(
+ 'Click the right mouse button to specify the location')
+ vbox.pack_start(label, expand=False, fill=False, padding=6)
+ self.is_active = True
+ self.osm_image = self.osm.image_add(lat, lon, self.icon)
+ self.xml.get_object('lat').connect('changed', self.on_lon_changed)
+ self.xml.get_object('lon').connect('changed', self.on_lon_changed)
def on_hide(self, widget):
for name in self.plugin.config_default_values:
@@ -124,3 +134,15 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
self.osm_image = self.osm.image_add(lat, lon, self.icon)
self.xml.get_object('lat').set_text(str(lat))
self.xml.get_object('lon').set_text(str(lon))
+
+ def on_lon_changed(self, widget):
+ try:
+ lat = float(self.xml.get_object('lat').get_text())
+ lon = float(self.xml.get_object('lon').get_text())
+ except ValueError,e:
+ return
+ if not -85 < lat < 85 or not -180 < lon < 180:
+ return
+ self.osm.image_remove(self.osm_image)
+ self.osm_image = self.osm.image_add(lat, lon, self.icon)
+ self.osm.set_center(lat, lon)