First commit

This commit is contained in:
Denis Fomin
2010-09-17 17:08:03 +04:00
commit 8c50df8ea0
18 changed files with 2599 additions and 0 deletions

1
set_location/__init__.py Normal file
View File

@@ -0,0 +1 @@
from set_location import SetLocationPlugin

View File

@@ -0,0 +1,487 @@
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="window1">
<child>
<object class="GtkTable" id="config_table">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="n_rows">17</property>
<property name="n_columns">2</property>
<property name="column_spacing">7</property>
<property name="row_spacing">5</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">alt:</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">area:</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">building:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">country:</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">countrycode:</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">description:</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">floor:</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">locality:</property>
</object>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">lat:</property>
</object>
<packing>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">lon:</property>
</object>
<packing>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">postalcode:</property>
</object>
<packing>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">region:</property>
</object>
<packing>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">room:</property>
</object>
<packing>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">street:</property>
</object>
<packing>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">text:</property>
</object>
<packing>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">uri:</property>
</object>
<packing>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="alt">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="area">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="building">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="country">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="countrycode">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="description">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="floor">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="locality">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="lat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Latitude in decimal degrees North</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="lon">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Longitude in decimal degrees East</property>
<property name="invisible_char">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="postalcode">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="region">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="room">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">12</property>
<property name="bottom_attach">13</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="street">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">13</property>
<property name="bottom_attach">14</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="text">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="uri">
<property name="visible">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">&#x25CF;</property>
<signal name="changed" handler="changed"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
</packing>
</child>
<child>
<object class="GtkAspectFrame" id="aspectframe2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<property name="xalign">1</property>
<child>
<object class="GtkButton" id="apply">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<property name="xalign">1</property>
<signal name="clicked" handler="on_apply_clicked"/>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="stock">gtk-apply</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="label" translatable="yes">Apply</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">16</property>
<property name="bottom_attach">17</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

34
set_location/po/Makefile Normal file
View File

@@ -0,0 +1,34 @@
PYFILES = $(shell find ../ -type f -name "*.py")
GLADEFILES = $(wildcard ../*.ui)
POFILES = $(wildcard *.po)
GLADEHFILES := $(GLADEFILES:.ui=.ui.h)
help:
@echo "USAGE:"
@echo "make update - updates messages.pot and .po files"
@echo "make sr.po - updates sr.po file OR creates new one"
@echo " (replace 'sr' with your language code)"
%.h: %
intltool-extract --type="gettext/glade" $*
messages.pot: $(GLADEHFILES) $(PYFILES)
xgettext -k_ -kN_ -o setlocation.pot $(PYFILES) $(GLADEHFILES) --from-code=utf-8
%.po: messages.pot
@if test -f $@; then \
echo -n "Updating '$*' language ";\
msgmerge -U $@ setlocation.pot;\
else \
msginit -l $*.UTF8 -o $@; \
fi
$(RM) $(GLADEHFILES)
update: $(POFILES)
clean:
$(RM) $(GLADEHFILES)
.PHONY: update

View File

@@ -0,0 +1,154 @@
# Language setlocation translations for PACKAGE package.
# Copyright (C) 2010 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# test <fominde@gmail.com>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: setlocation\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-09-05 22:11+0400\n"
"PO-Revision-Date: 2010-09-05 22:54+0300\n"
"Last-Translator: Fomin Denis <fominde@mail.ru>\n"
"Language-Team: ru\n"
"Language: setlocation\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../set_location.py:29
msgid "Set information about the current geographical or physical location."
msgstr "Позволяет установить текущее местоположение."
#: ../config_dialog.ui.h:1
msgid "A URI or URL pointing to information about the location"
msgstr "URI или URL, указывающих на информации о местонахождении"
#: ../config_dialog.ui.h:2
msgid "A catch-all element that captures any other information about the location"
msgstr "Всеобъемлющий элемент, который фиксирует любую другую информацию о местонахождении"
#: ../config_dialog.ui.h:3
msgid "A code used for postal delivery"
msgstr "Код, используемый для почтовых отправлений"
#: ../config_dialog.ui.h:4
msgid "A locality within the administrative region, such as a town or city"
msgstr "Населенный пункт в пределах административного района, например, деревни или города"
#: ../config_dialog.ui.h:5
msgid "A named area such as a campus or neighborhood"
msgstr "Именованый участок как студенческий городок или окресности"
#: ../config_dialog.ui.h:6
msgid "A natural-language name for or description of the location"
msgstr "Описание местоположения на родном языке"
#: ../config_dialog.ui.h:7
msgid "A particular floor in a building"
msgstr "Этаж в здании"
#: ../config_dialog.ui.h:8
msgid "A particular room in a building"
msgstr "Номер комнаты в здании"
#: ../config_dialog.ui.h:9
msgid "A specific building on a street or in an area"
msgstr "Конкретные здания на улице или в районе"
#: ../config_dialog.ui.h:10
msgid "A thoroughfare within the locality, or a crossing of two thoroughfares"
msgstr "Проезд в пределах местности, или пересечение двух улиц"
#: ../config_dialog.ui.h:11
msgid "Altitude in meters above or below sea level"
msgstr "Высота в метрах выше или ниже уровня моря"
#: ../config_dialog.ui.h:12
msgid "An administrative region of the nation, such as a state or province"
msgstr "Административный район страны, такой, как штат или область"
#: ../config_dialog.ui.h:13
msgid "Apply"
msgstr "Применить"
#: ../config_dialog.ui.h:14
msgid "Latitude in decimal degrees North"
msgstr "Широта в десятичных градусах"
#: ../config_dialog.ui.h:15
msgid "Longitude in decimal degrees East"
msgstr "Долгота в десятичных градусах"
#: ../config_dialog.ui.h:16
msgid "The ISO 3166 two-letter country code"
msgstr "ISO 3166 2-буквенный код страны"
#: ../config_dialog.ui.h:17
msgid "The nation where the user is located"
msgstr "Страна, в которой находится пользователь"
#: ../config_dialog.ui.h:18
msgid "alt:"
msgstr "высота:"
#: ../config_dialog.ui.h:19
msgid "area:"
msgstr "район:"
#: ../config_dialog.ui.h:20
msgid "building:"
msgstr "строение:"
#: ../config_dialog.ui.h:21
msgid "country:"
msgstr "страна:"
#: ../config_dialog.ui.h:22
msgid "countrycode:"
msgstr "код страны:"
#: ../config_dialog.ui.h:23
msgid "description:"
msgstr "описание:"
#: ../config_dialog.ui.h:24
msgid "floor:"
msgstr "этаж:"
#: ../config_dialog.ui.h:25
msgid "lat:"
msgstr "широта:"
#: ../config_dialog.ui.h:26
msgid "locality:"
msgstr "населенный пункт:"
#: ../config_dialog.ui.h:27
msgid "lon:"
msgstr "долгота:"
#: ../config_dialog.ui.h:28
msgid "postalcode:"
msgstr "индекс:"
#: ../config_dialog.ui.h:29
msgid "region:"
msgstr "область:"
#: ../config_dialog.ui.h:30
msgid "room:"
msgstr "комната(номер квартиры):"
#: ../config_dialog.ui.h:31
msgid "street:"
msgstr "улица:"
#: ../config_dialog.ui.h:32
msgid "text:"
msgstr "текст:"
#: ../config_dialog.ui.h:33
msgid "uri:"
msgstr "uri:"

View File

@@ -0,0 +1,155 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-09-05 22:11+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../set_location.py:29
msgid "Set information about the current geographical or physical location."
msgstr ""
#: ../config_dialog.ui.h:1
msgid "A URI or URL pointing to information about the location"
msgstr ""
#: ../config_dialog.ui.h:2
msgid ""
"A catch-all element that captures any other information about the location"
msgstr ""
#: ../config_dialog.ui.h:3
msgid "A code used for postal delivery"
msgstr ""
#: ../config_dialog.ui.h:4
msgid "A locality within the administrative region, such as a town or city"
msgstr ""
#: ../config_dialog.ui.h:5
msgid "A named area such as a campus or neighborhood"
msgstr ""
#: ../config_dialog.ui.h:6
msgid "A natural-language name for or description of the location"
msgstr ""
#: ../config_dialog.ui.h:7
msgid "A particular floor in a building"
msgstr ""
#: ../config_dialog.ui.h:8
msgid "A particular room in a building"
msgstr ""
#: ../config_dialog.ui.h:9
msgid "A specific building on a street or in an area"
msgstr ""
#: ../config_dialog.ui.h:10
msgid "A thoroughfare within the locality, or a crossing of two thoroughfares"
msgstr ""
#: ../config_dialog.ui.h:11
msgid "Altitude in meters above or below sea level"
msgstr ""
#: ../config_dialog.ui.h:12
msgid "An administrative region of the nation, such as a state or province"
msgstr ""
#: ../config_dialog.ui.h:13
msgid "Apply"
msgstr ""
#: ../config_dialog.ui.h:14
msgid "Latitude in decimal degrees North"
msgstr ""
#: ../config_dialog.ui.h:15
msgid "Longitude in decimal degrees East"
msgstr ""
#: ../config_dialog.ui.h:16
msgid "The ISO 3166 two-letter country code"
msgstr ""
#: ../config_dialog.ui.h:17
msgid "The nation where the user is located"
msgstr ""
#: ../config_dialog.ui.h:18
msgid "alt:"
msgstr ""
#: ../config_dialog.ui.h:19
msgid "area:"
msgstr ""
#: ../config_dialog.ui.h:20
msgid "building:"
msgstr ""
#: ../config_dialog.ui.h:21
msgid "country:"
msgstr ""
#: ../config_dialog.ui.h:22
msgid "countrycode:"
msgstr ""
#: ../config_dialog.ui.h:23
msgid "description:"
msgstr ""
#: ../config_dialog.ui.h:24
msgid "floor:"
msgstr ""
#: ../config_dialog.ui.h:25
msgid "lat:"
msgstr ""
#: ../config_dialog.ui.h:26
msgid "locality:"
msgstr ""
#: ../config_dialog.ui.h:27
msgid "lon:"
msgstr ""
#: ../config_dialog.ui.h:28
msgid "postalcode:"
msgstr ""
#: ../config_dialog.ui.h:29
msgid "region:"
msgstr ""
#: ../config_dialog.ui.h:30
msgid "room:"
msgstr ""
#: ../config_dialog.ui.h:31
msgid "street:"
msgstr ""
#: ../config_dialog.ui.h:32
msgid "text:"
msgstr ""
#: ../config_dialog.ui.h:33
msgid "uri:"
msgstr ""

View File

@@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
##
from datetime import datetime
import time
import gtk
import os
import locale
import gettext
from plugins.gui import GajimPluginConfigDialog
from plugins import GajimPlugin
from plugins.helpers import log_calls, log
from common import gajim
locale_path = os.path.dirname(__file__) + '/locales'
locale.bindtextdomain('setlocation', locale_path)
try:
gett = gettext.Catalog('setlocation', locale_path)
_ = gett.gettext
except:
pass
class SetLocationPlugin(GajimPlugin):
name = u'Set Location'
short_name = u'set_location'
version = u'0.1'
description = _(
u'''Set information about the current geographical or physical location.''')
authors = [u'Denis Fomin <fominde@gmail.com>']
homepage = u'http://bitbucket.org/dicson12/plugins/src/tip/set_location/'
@log_calls('SetLocationPlugin')
def init(self):
self.config_dialog = SetLocationPluginConfigDialog(self)
self.config_default_values = {
'alt': (1609,''),
'area': ('Central Park', ''),
'building': ('The Empire State Building',''),
'country': ('United States', ''),
'countrycode' : ('US', ''),
'description' : ('Bill\'s house', ''),
'floor' : ('102', ''),
'lat' : (39.75, ''),
'locality' : ('New York City', ''),
'lon' : (-104.99, ''),
'postalcode' : ('10027', ''),
'region' : ('New York', ''),
'room' : ('Observatory', ''),
'street' : ('34th and Broadway', ''),
'text' : ('Northwest corner of the lobby', ''),
'uri' : ('http://beta.plazes.com/plazes/1940:jabber_inc', ''),}
@log_calls('SetLocationPlugin')
def activate(self):
self._data = {}
timestamp = time.time()
timestamp = datetime.utcfromtimestamp(timestamp)
timestamp = timestamp.strftime('%Y-%m-%dT%H:%MZ')
self._data['timestamp'] = timestamp
for name in self.config_default_values:
self._data[name] = self.config[name]
for acct in gajim.connections:
if gajim.connections[acct].connected == 0:
gajim.connections[acct].to_be_sent_location = self._data
else:
gajim.connections[acct].send_location(self._data)
@log_calls('SetLocationPlugin')
def deactivate(self):
self._data = {}
for acct in gajim.connections:
gajim.connections[acct].send_location(self._data)
class SetLocationPluginConfigDialog(GajimPluginConfigDialog):
def init(self):
self.GTK_BUILDER_FILE_PATH = self.plugin.local_file_path(
'config_dialog.ui')
self.xml = gtk.Builder()
self.xml.set_translation_domain('setlocation')
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.xml.connect_signals(self)
def on_run(self):
for name in self.plugin.config_default_values:
widget = self.xml.get_object(name)
widget.set_text(str(self.plugin.config[name]))
def changed(self, entry):
name = gtk.Buildable.get_name(entry)
self.plugin.config[name] = entry.get_text()
def on_apply_clicked(self, widget):
self.plugin.activate()