set_location. ability to specify a location on the built-in card
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
<requires lib="gtk+" version="2.16"/>
|
<requires lib="gtk+" version="2.16"/>
|
||||||
<!-- interface-naming-policy toplevel-contextual -->
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
<object class="GtkWindow" id="window1">
|
<object class="GtkWindow" id="window1">
|
||||||
|
<child>
|
||||||
|
<object class="GtkHBox" id="hbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTable" id="config_table">
|
<object class="GtkTable" id="config_table">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@@ -195,7 +198,6 @@
|
|||||||
<object class="GtkEntry" id="alt">
|
<object class="GtkEntry" id="alt">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">Altitude in meters above or below sea level</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -207,7 +209,6 @@
|
|||||||
<object class="GtkEntry" id="area">
|
<object class="GtkEntry" id="area">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A named area such as a campus or neighborhood</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -221,7 +222,6 @@
|
|||||||
<object class="GtkEntry" id="building">
|
<object class="GtkEntry" id="building">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A specific building on a street or in an area</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -235,7 +235,6 @@
|
|||||||
<object class="GtkEntry" id="country">
|
<object class="GtkEntry" id="country">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">The nation where the user is located</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -249,7 +248,6 @@
|
|||||||
<object class="GtkEntry" id="countrycode">
|
<object class="GtkEntry" id="countrycode">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">The ISO 3166 two-letter country code</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -263,7 +261,6 @@
|
|||||||
<object class="GtkEntry" id="description">
|
<object class="GtkEntry" id="description">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A natural-language name for or description of the location</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -277,7 +274,6 @@
|
|||||||
<object class="GtkEntry" id="floor">
|
<object class="GtkEntry" id="floor">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A particular floor in a building</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -291,7 +287,6 @@
|
|||||||
<object class="GtkEntry" id="locality">
|
<object class="GtkEntry" id="locality">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A locality within the administrative region, such as a town or city</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -305,7 +300,6 @@
|
|||||||
<object class="GtkEntry" id="lat">
|
<object class="GtkEntry" id="lat">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">Latitude in decimal degrees North</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -319,7 +313,6 @@
|
|||||||
<object class="GtkEntry" id="lon">
|
<object class="GtkEntry" id="lon">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">Longitude in decimal degrees East</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -333,7 +326,6 @@
|
|||||||
<object class="GtkEntry" id="postalcode">
|
<object class="GtkEntry" id="postalcode">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A code used for postal delivery</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -347,7 +339,6 @@
|
|||||||
<object class="GtkEntry" id="region">
|
<object class="GtkEntry" id="region">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">An administrative region of the nation, such as a state or province</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -361,7 +352,6 @@
|
|||||||
<object class="GtkEntry" id="room">
|
<object class="GtkEntry" id="room">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A particular room in a building</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -375,7 +365,6 @@
|
|||||||
<object class="GtkEntry" id="street">
|
<object class="GtkEntry" id="street">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A thoroughfare within the locality, or a crossing of two thoroughfares</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -389,7 +378,6 @@
|
|||||||
<object class="GtkEntry" id="text">
|
<object class="GtkEntry" id="text">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A catch-all element that captures any other information about the location</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -403,7 +391,6 @@
|
|||||||
<object class="GtkEntry" id="uri">
|
<object class="GtkEntry" id="uri">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="tooltip_text" translatable="yes">A URI or URL pointing to information about the location</property>
|
|
||||||
<property name="invisible_char">●</property>
|
<property name="invisible_char">●</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@@ -414,6 +401,41 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkVBox" id="vbox1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="extension_events">all</property>
|
||||||
|
<property name="resize_mode">immediate</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<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>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">6</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
23
set_location/layers.py
Normal file
23
set_location/layers.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
import osmgpsmap
|
||||||
|
import gobject
|
||||||
|
|
||||||
|
|
||||||
|
class DummyLayer(gobject.GObject, osmgpsmap.GpsMapLayer):
|
||||||
|
def __init__(self):
|
||||||
|
gobject.GObject.__init__(self)
|
||||||
|
|
||||||
|
def do_draw(self, gpsmap, gdkdrawable):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_render(self, gpsmap):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def do_busy(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def do_button_press(self, gpsmap, gdkeventbutton):
|
||||||
|
return False
|
||||||
|
|
||||||
|
gobject.type_register(DummyLayer)
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Set Location
|
name: Set Location
|
||||||
short_name: set_location
|
short_name: set_location
|
||||||
version: 0.1
|
version: 0.2
|
||||||
description: Set information about the current geographical or physical location.
|
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
|
||||||
authors: Denis Fomin <fominde@gmail.com>
|
authors: Denis Fomin <fominde@gmail.com>
|
||||||
homepage: http://trac-plugins.gajim.org/wiki/SetLocalitionPlugin
|
homepage: http://trac-plugins.gajim.org/wiki/SetLocalitionPlugin
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,41 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
|
|||||||
self.xml = gtk.Builder()
|
self.xml = gtk.Builder()
|
||||||
self.xml.set_translation_domain('setlocation')
|
self.xml.set_translation_domain('setlocation')
|
||||||
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
|
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH,
|
||||||
['config_table'])
|
['hbox1'])
|
||||||
config_table = self.xml.get_object('config_table')
|
config_table = self.xml.get_object('config_table')
|
||||||
self.child.pack_start(config_table)
|
hbox = self.xml.get_object('hbox1')
|
||||||
|
self.child.pack_start(hbox)
|
||||||
self.xml.connect_signals(self)
|
self.xml.connect_signals(self)
|
||||||
self.connect('hide', self.on_hide)
|
self.connect('hide', self.on_hide)
|
||||||
|
|
||||||
def on_run(self):
|
def on_run(self):
|
||||||
|
no_map = None
|
||||||
|
try:
|
||||||
|
import osmgpsmap
|
||||||
|
except:
|
||||||
|
no_map = True
|
||||||
|
if not no_map:
|
||||||
|
from layers import DummyLayer
|
||||||
|
import gtkgui_helpers
|
||||||
|
|
||||||
|
vbox = self.xml.get_object('vbox1')
|
||||||
|
vbox.set_size_request(400, -1)
|
||||||
|
|
||||||
|
self.osm = osmgpsmap.GpsMap()
|
||||||
|
self.osm.layer_add(osmgpsmap.GpsMapOsd(show_dpad=True,
|
||||||
|
show_zoom=True))
|
||||||
|
self.osm.layer_add(DummyLayer())
|
||||||
|
lat = float(self.plugin.config['lat'])
|
||||||
|
lon = float(self.plugin.config['lon'])
|
||||||
|
self.osm.set_center_and_zoom(lat, lon, 12)
|
||||||
|
self.path_to_image = os.path.abspath(gtkgui_helpers.get_icon_path(
|
||||||
|
'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:
|
for name in self.plugin.config_default_values:
|
||||||
widget = self.xml.get_object(name)
|
widget = self.xml.get_object(name)
|
||||||
widget.set_text(str(self.plugin.config[name]))
|
widget.set_text(str(self.plugin.config[name]))
|
||||||
@@ -88,3 +116,11 @@ class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
|
|||||||
widget = self.xml.get_object(name)
|
widget = self.xml.get_object(name)
|
||||||
self.plugin.config[name] = widget.get_text()
|
self.plugin.config[name] = widget.get_text()
|
||||||
self.plugin.activate()
|
self.plugin.activate()
|
||||||
|
|
||||||
|
def map_clicked(self, osm, event):
|
||||||
|
lat, lon = self.osm.get_event_location(event).get_degrees()
|
||||||
|
if event.button == 3:
|
||||||
|
self.osm.image_remove(self.osm_image)
|
||||||
|
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user