From 8c50df8ea0f0cf3b597d6e51d034f15630a02b48 Mon Sep 17 00:00:00 2001 From: Denis Fomin Date: Fri, 17 Sep 2010 17:08:03 +0400 Subject: First commit --- set_location/__init__.py | 1 + set_location/config_dialog.ui | 487 +++++++++++++++++++++ set_location/locales/ru/LC_MESSAGES/setlocation.mo | Bin 0 -> 3780 bytes set_location/po/Makefile | 34 ++ set_location/po/setlocation.po | 154 +++++++ set_location/po/setlocation.pot | 155 +++++++ set_location/set_location.py | 98 +++++ 7 files changed, 929 insertions(+) create mode 100644 set_location/__init__.py create mode 100644 set_location/config_dialog.ui create mode 100644 set_location/locales/ru/LC_MESSAGES/setlocation.mo create mode 100644 set_location/po/Makefile create mode 100644 set_location/po/setlocation.po create mode 100644 set_location/po/setlocation.pot create mode 100644 set_location/set_location.py (limited to 'set_location') diff --git a/set_location/__init__.py b/set_location/__init__.py new file mode 100644 index 0000000..2e080ea --- /dev/null +++ b/set_location/__init__.py @@ -0,0 +1 @@ +from set_location import SetLocationPlugin diff --git a/set_location/config_dialog.ui b/set_location/config_dialog.ui new file mode 100644 index 0000000..4f71c45 --- /dev/null +++ b/set_location/config_dialog.ui @@ -0,0 +1,487 @@ + + + + + + + + True + 6 + 17 + 2 + 7 + 5 + + + True + 0 + alt: + + + GTK_FILL + GTK_FILL + + + + + True + 0 + area: + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 0 + building: + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + 0 + country: + + + 3 + 4 + + + + + True + 0 + countrycode: + + + 4 + 5 + + + + + True + 0 + description: + + + 5 + 6 + + + + + True + 0 + floor: + + + 6 + 7 + + + + + True + 0 + locality: + + + 7 + 8 + + + + + True + 0 + lat: + + + 8 + 9 + + + + + True + 0 + lon: + + + 9 + 10 + + + + + True + 0 + postalcode: + + + 10 + 11 + + + + + True + 0 + region: + + + 11 + 12 + + + + + True + 0 + room: + + + 12 + 13 + + + + + True + 0 + street: + + + 13 + 14 + + + + + True + 0 + text: + + + 14 + 15 + + + + + True + 0 + uri: + + + 15 + 16 + + + + + True + True + Altitude in meters above or below sea level + + + + + 1 + 2 + + + + + True + True + A named area such as a campus or neighborhood + + + + + 1 + 2 + 1 + 2 + + + + + True + True + A specific building on a street or in an area + + + + + 1 + 2 + 2 + 3 + + + + + True + True + The nation where the user is located + + + + + 1 + 2 + 3 + 4 + + + + + True + True + The ISO 3166 two-letter country code + + + + + 1 + 2 + 4 + 5 + + + + + True + True + A natural-language name for or description of the location + + + + + 1 + 2 + 5 + 6 + + + + + True + True + A particular floor in a building + + + + + 1 + 2 + 6 + 7 + + + + + True + True + A locality within the administrative region, such as a town or city + + + + + 1 + 2 + 7 + 8 + + + + + True + True + Latitude in decimal degrees North + + + + + 1 + 2 + 8 + 9 + + + + + True + True + Longitude in decimal degrees East + + + + + 1 + 2 + 9 + 10 + + + + + True + True + A code used for postal delivery + + + + + 1 + 2 + 10 + 11 + + + + + True + True + An administrative region of the nation, such as a state or province + + + + + 1 + 2 + 11 + 12 + + + + + True + True + A particular room in a building + + + + + 1 + 2 + 12 + 13 + + + + + True + True + A thoroughfare within the locality, or a crossing of two thoroughfares + + + + + 1 + 2 + 13 + 14 + + + + + True + True + A catch-all element that captures any other information about the location + + + + + 1 + 2 + 14 + 15 + + + + + True + True + A URI or URL pointing to information about the location + + + + + 1 + 2 + 15 + 16 + + + + + True + 0 + none + 1 + + + True + True + True + False + 1 + + + + True + + + True + gtk-apply + + + 0 + + + + + True + Apply + + + 1 + + + + + + + + + 1 + 2 + 16 + 17 + GTK_FILL + + + + + + + + + + diff --git a/set_location/locales/ru/LC_MESSAGES/setlocation.mo b/set_location/locales/ru/LC_MESSAGES/setlocation.mo new file mode 100644 index 0000000..827c044 Binary files /dev/null and b/set_location/locales/ru/LC_MESSAGES/setlocation.mo differ diff --git a/set_location/po/Makefile b/set_location/po/Makefile new file mode 100644 index 0000000..4acc40b --- /dev/null +++ b/set_location/po/Makefile @@ -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 diff --git a/set_location/po/setlocation.po b/set_location/po/setlocation.po new file mode 100644 index 0000000..3572c67 --- /dev/null +++ b/set_location/po/setlocation.po @@ -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 , 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 \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:" + diff --git a/set_location/po/setlocation.pot b/set_location/po/setlocation.pot new file mode 100644 index 0000000..0b385c5 --- /dev/null +++ b/set_location/po/setlocation.pot @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 "" diff --git a/set_location/set_location.py b/set_location/set_location.py new file mode 100644 index 0000000..522201b --- /dev/null +++ b/set_location/set_location.py @@ -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 '] + 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() -- cgit v1.2.3