New release
authorkibergus <kibergus@gmail.com>
Sun, 31 Jan 2010 09:14:09 +0000 (09:14 +0000)
committerkibergus <kibergus@gmail.com>
Sun, 31 Jan 2010 09:14:09 +0000 (09:14 +0000)
git-svn-id: file:///svnroot/ussd-widget/trunk@19 d197f4d6-dc93-42ad-8354-0da1f58e353f

ussd-common/build_ussd-common.py
ussd-widget/build_ussd-widget.py
ussd-widget/ru.po
ussd-widget/src/usr/lib/hildon-desktop/ussd-widget.py
ussd-widget/src/usr/share/locale/ru/LC_MESSAGES/ussd-widget.mo

index 4c4684f..2b6e350 100644 (file)
@@ -38,9 +38,9 @@ if __name__ == "__main__":
 chmod +s /usr/bin/pnatd
 """ #Set here your post install script
 
 chmod +s /usr/bin/pnatd
 """ #Set here your post install script
 
-    version = "0.0.1"
+    version = "0.0.3"
     build = "0" 
     build = "0" 
-    changeloginformation = "More robust" 
+    changeloginformation = "Language selection support, line break in reply bug fixed." 
    
     dir_name = "src"     
 
    
     dir_name = "src"     
 
index d2748c8..0a3af93 100644 (file)
@@ -20,10 +20,10 @@ if __name__ == "__main__":
     print
 
     p=py2deb.Py2deb("ussd-widget")
     print
 
     p=py2deb.Py2deb("ussd-widget")
-    p.description="Widget, that executes USSD query and displays response text\nThe main purpose is viewing your balance. In Russia all operators provide balace information via USSD queries andmost part of contracts are prepaid. Ability to see your balance on desktop can be useful in such case.\nAnyway, you can configure widget to any other USSD query."
+    p.description="Widget, that executes USSD query and displays response text\nThe main purpose is viewing your balance. In Russia all operators provide balace information via USSD queries and most part of contracts are prepaid. Ability to see your balance on desktop can be useful in such case.\nAnyway, you can configure widget to any other USSD query."
     p.author="Alexey Guseynov"
     p.mail="kibergus@gmail.com"
     p.author="Alexey Guseynov"
     p.mail="kibergus@gmail.com"
-    p.depends = "python2.5, ussd-common, python-hildondesktop (>=0.1.0-1maemo2), hildon-desktop-python-loader (>=0.1.0-1maemo2), python-gtk2, python-gobject, python-hildon, python-cairo"
+    p.depends = "python2.5, ussd-common (>=0.0.3), python-hildondesktop (>=0.1.0-1maemo2), hildon-desktop-python-loader (>=0.1.0-1maemo2), python-gtk2, python-gobject, python-hildon, python-cairo"
     p.section="user/desktop"
     p.icon = "./ussd-widget.png"
     p.arch="all"                #should be all for python, any for all arch
     p.section="user/desktop"
     p.icon = "./ussd-widget.png"
     p.arch="all"                #should be all for python, any for all arch
@@ -34,9 +34,9 @@ if __name__ == "__main__":
 #    p.postinstall="""#!/bin/sh
 #""" #Set here your post install script
 
 #    p.postinstall="""#!/bin/sh
 #""" #Set here your post install script
 
-    version = "0.0.4"
+    version = "0.1.0"
     build = "0" 
     build = "0" 
-    changeloginformation = "Non blocking queries, code cleanup, better interface." 
+    changeloginformation = "Banner support." 
    
     dir_name = "src"   
 
    
     dir_name = "src"   
 
index 5b26fd9..86f19c3 100644 (file)
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: 0.0.6\n"
 "Report-Msgid-Bugs-To: \n"
 msgstr ""
 "Project-Id-Version: 0.0.6\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-01-29 17:51+0300\n"
+"POT-Creation-Date: 2010-01-31 11:57+0300\n"
 "PO-Revision-Date: 2010-01-29 17:51+0300\n"
 "Last-Translator: Alexey Guseunov <kibergusBarkBarkgmail.com>\n"
 "Language-Team: Russian\n"
 "PO-Revision-Date: 2010-01-29 17:51+0300\n"
 "Last-Translator: Alexey Guseunov <kibergusBarkBarkgmail.com>\n"
 "Language-Team: Russian\n"
@@ -14,7 +14,7 @@ msgstr ""
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: utf-8\n"
 
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: utf-8\n"
 
-#: ussd-widget.py:35 ussd-widget.py:284
+#: ussd-widget.py:35 ussd-widget.py:289
 msgid "Click to update"
 msgstr "Обновить"
 
 msgid "Click to update"
 msgstr "Обновить"
 
@@ -22,158 +22,205 @@ msgstr "Обновить"
 msgid "Couldn't read previous config"
 msgstr "Не удается прочитать предыдущий конфигурационный файл"
 
 msgid "Couldn't read previous config"
 msgstr "Не удается прочитать предыдущий конфигурационный файл"
 
-#: ussd-widget.py:119
+#: ussd-widget.py:120
 #, python-format
 msgid "Error reading config on line %(line)d. = or # expected."
 #, python-format
 msgid "Error reading config on line %(line)d. = or # expected."
-msgstr "Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось = или #."
+msgstr ""
+"Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось = или #."
 
 
-#: ussd-widget.py:132 ussd-widget.py:141 ussd-widget.py:158 ussd-widget.py:199
+#: ussd-widget.py:135 ussd-widget.py:144 ussd-widget.py:161 ussd-widget.py:202
 #, python-format
 msgid "Error reading config on line %(line)d. Integer expected."
 #, python-format
 msgid "Error reading config on line %(line)d. Integer expected."
-msgstr "Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось целое число."
+msgstr ""
+"Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось целое "
+"число."
 
 
-#: ussd-widget.py:169
+#: ussd-widget.py:172
 #, python-format
 msgid "Error reading config on line %(line)d. Pango font description expected."
 #, python-format
 msgid "Error reading config on line %(line)d. Pango font description expected."
-msgstr "Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось pango описание шрифта"
+msgstr ""
+"Ошибка чтения конфигурационного файла на %(line)d строке. Ожидалось pango "
+"описание шрифта."
 
 
-#: ussd-widget.py:176 ussd-widget.py:182
+#: ussd-widget.py:179 ussd-widget.py:185
 #, python-format
 msgid "Error reading config on line %(line)d. Expected color definition."
 #, python-format
 msgid "Error reading config on line %(line)d. Expected color definition."
-msgstr ""
+msgstr "Ошибка чтения конфигурационного файла на строке %(line)d. Ожидалось описание цвета."
 
 
-#: ussd-widget.py:196
+#: ussd-widget.py:199
 #, python-format
 msgid "Error reading config on line %(line)d. Unknown language code."
 #, python-format
 msgid "Error reading config on line %(line)d. Unknown language code."
-msgstr "Ошибка чтения конфигурационного файла на %(line)d строке. Неизвестный код языка."
+msgstr ""
+"Ошибка чтения конфигурационного файла на %(line)d строке. Неизвестный код "
+"языка."
 
 
-#: ussd-widget.py:202
+#: ussd-widget.py:205
 #, python-format
 msgid "Error reading config on line %(line)d. Unexpected variable: "
 #, python-format
 msgid "Error reading config on line %(line)d. Unexpected variable: "
-msgstr "Ошибка чтения конфигурационного файла на %(line)d строке. Неизвестная переменная: "
+msgstr ""
+"Ошибка чтения конфигурационного файла на %(line)d строке. Неизвестная "
+"переменная: "
 
 
-#: ussd-widget.py:209 ussd-widget.py:214
+#: ussd-widget.py:212 ussd-widget.py:217
 msgid "Config error"
 msgstr "Ошибка конфигурации"
 
 msgid "Config error"
 msgstr "Ошибка конфигурации"
 
-#: ussd-widget.py:215
+#: ussd-widget.py:218
 msgid "IO error while reading config"
 msgstr "Ошибка ввода/вывода при чтении конфигурационного файла"
 
 msgid "IO error while reading config"
 msgstr "Ошибка ввода/вывода при чтении конфигурационного файла"
 
-#: ussd-widget.py:302
+#: ussd-widget.py:307
 msgid "serious problems in program logic"
 msgstr "серьезная проблема в логике программы"
 
 msgid "serious problems in program logic"
 msgstr "серьезная проблема в логике программы"
 
-#: ussd-widget.py:320
+#: ussd-widget.py:325
 msgid "Processing"
 msgstr "Обрабатываю"
 
 msgid "Processing"
 msgstr "Обрабатываю"
 
-#: ussd-widget.py:325
+#: ussd-widget.py:330
 msgid "No config"
 msgstr "Нет конфигурации"
 
 msgid "No config"
 msgstr "Нет конфигурации"
 
-#: ussd-widget.py:332
+#: ussd-widget.py:337
 msgid "Error"
 msgstr "Ошибка"
 
 msgid "Error"
 msgstr "Ошибка"
 
-#: ussd-widget.py:353
+#: ussd-widget.py:352
 msgid "Regexp Error: "
 msgstr "Ошибка в регулярном выражении: "
 
 msgid "Regexp Error: "
 msgstr "Ошибка в регулярном выражении: "
 
-#: ussd-widget.py:381
+#: ussd-widget.py:361
+msgid "Couldn't exec banner parser:"
+msgstr "Не удалось запустить обработчик для баннера:"
+
+#: ussd-widget.py:369
+msgid "Couldn't exec widget parser:"
+msgstr "Не удалось запустить обработчик для виджета:"
+
+#: ussd-widget.py:376
+msgid "Couldn't exec chain:"
+msgstr "Не удалось запустить следующее звено:"
+
+#: ussd-widget.py:406
 msgid "OK"
 msgstr "OK"
 
 msgid "OK"
 msgstr "OK"
 
-#: ussd-widget.py:390
+#: ussd-widget.py:415
 msgid "USSD widget"
 msgstr "USSD виджет"
 
 msgid "USSD widget"
 msgstr "USSD виджет"
 
-#: ussd-widget.py:392
+#: ussd-widget.py:417
 msgid "Save"
 msgstr "Сохранить"
 
 msgid "Save"
 msgstr "Сохранить"
 
-#: ussd-widget.py:421
+#: ussd-widget.py:448
 msgid "USSD reply language"
 msgstr "Язык USSD ответа"
 
 msgid "USSD reply language"
 msgstr "Язык USSD ответа"
 
-#: ussd-widget.py:426
-msgid "Always show name"
-msgstr "Показывать имя"
+#: ussd-widget.py:453
+msgid "Enable banner. Parser:"
+msgstr "Включить баннер. Обработчик:"
 
 
-#: ussd-widget.py:436
+#: ussd-widget.py:463
 msgid "Execute query on start"
 msgstr "Выполнять запрос при старте"
 
 msgid "Execute query on start"
 msgstr "Выполнять запрос при старте"
 
-#: ussd-widget.py:439
+#: ussd-widget.py:466
 msgid "Font"
 msgstr "Шрифт"
 
 msgid "Font"
 msgstr "Шрифт"
 
-#: ussd-widget.py:442
+#: ussd-widget.py:469
 msgid "Background color"
 msgstr "Цвет фона"
 
 msgid "Background color"
 msgstr "Цвет фона"
 
-#: ussd-widget.py:444
+#: ussd-widget.py:471
 msgid "Text color"
 msgstr "Цвет шрифта"
 
 msgid "Text color"
 msgstr "Цвет шрифта"
 
-#: ussd-widget.py:465
+#: ussd-widget.py:495
 msgid "USSD number"
 msgstr "USSD номер"
 
 msgid "USSD number"
 msgstr "USSD номер"
 
-#: ussd-widget.py:485
-msgid "Parser"
-msgstr "Обработчик"
+#: ussd-widget.py:508
+msgid "Name"
+msgstr "Имя"
 
 
-#: ussd-widget.py:495
+#: ussd-widget.py:517
+msgid "Parser for widget"
+msgstr "Обработчик для виджета"
+
+#: ussd-widget.py:537
 msgid "Chain"
 msgstr "Следующее звено"
 
 msgid "Chain"
 msgstr "Следующее звено"
 
-#: ussd-widget.py:505
+#: ussd-widget.py:547
 msgid "RegExp"
 msgstr "Регулярное выражение"
 
 msgid "RegExp"
 msgstr "Регулярное выражение"
 
-#: ussd-widget.py:515
+#: ussd-widget.py:557
 msgid "Max. width"
 msgstr "Макс. ширина"
 
 msgid "Max. width"
 msgstr "Макс. ширина"
 
-#: ussd-widget.py:517
+#: ussd-widget.py:559
 msgid "symbols"
 msgstr "символов"
 
 msgid "symbols"
 msgstr "символов"
 
-#: ussd-widget.py:527
+#: ussd-widget.py:569
 msgid "Update every"
 msgstr "Обновлять каждые"
 
 msgid "Update every"
 msgstr "Обновлять каждые"
 
-#: ussd-widget.py:529
+#: ussd-widget.py:571
 msgid "minutes"
 msgstr "минут"
 
 msgid "minutes"
 msgstr "минут"
 
-#: ussd-widget.py:539
+#: ussd-widget.py:581
 msgid "Retry pattern"
 msgstr "Шаблон повторных запросов"
 
 msgid "Retry pattern"
 msgstr "Шаблон повторных запросов"
 
-#: ussd-widget.py:559 ussd-widget.py:564 ussd-widget.py:569 ussd-widget.py:574
+#: ussd-widget.py:601 ussd-widget.py:606 ussd-widget.py:611 ussd-widget.py:616
+#: ussd-widget.py:621
 msgid "Format help"
 msgstr "Справка по формату"
 
 msgid "Format help"
 msgstr "Справка по формату"
 
-#: ussd-widget.py:559
+#: ussd-widget.py:601
 msgid ""
 "Reply would be passed to specified utility, output of utility would be shown "
 msgid ""
 "Reply would be passed to specified utility, output of utility would be shown "
-"to you.\n"
+"to you on widget.\n"
 "       Format:\n"
 "% would be replaced by reply\n"
 "\\ invalidates special meaming of following symbol\n"
 "\" and ' work as usual\n"
 "       Format:\n"
 "% would be replaced by reply\n"
 "\\ invalidates special meaming of following symbol\n"
 "\" and ' work as usual\n"
-"space delimits command line parameters of utility"
+"space delimits command line parameters of utility\n"
+"      Hint: use echo \"Your string %\" to prepend your string to reply."
+msgstr ""
+"Ответ будет передан указанной утилите, а её вывод будет отображен на виджете.\n"
+"       Формат:\n"
+"% будет заменен ответом\n"
+"\\ отменяет особое значение следующего символа\n"
+"\" и ' работают как обычно\n"
+"пробелы разделяют аргументы командной строки утилиты\n"
+"      Подсказка: используйте echo \"Ваша строка %\" чтобы поместить вашу строку перед ответом."
+
+#: ussd-widget.py:606
+msgid ""
+"Reply would be passed to specified utility, output of utility would be shown "
+"to you on banner.\n"
+"       Format:\n"
+"% would be replaced by reply\n"
+"\\ invalidates special meaming of following symbol\n"
+"\" and ' work as usual\n"
+"space delimits command line parameters of utility\n"
+"      Hint: use echo \"Your string %\" to prepend your string to reply."
 msgstr ""
 msgstr ""
-"Ответ будет передан указанной утилите, а её вывод показан вам.\n"
+"Ответ будет передан указанной утилите, а её вывод будет отображен на баннере.\n"
 "       Формат:\n"
 "% будет заменен ответом\n"
 "\\ отменяет особое значение следующего символа\n"
 "\" и ' работают как обычно\n"
 "пробелы разделяют аргументы командной строки утилиты"
 "       Формат:\n"
 "% будет заменен ответом\n"
 "\\ отменяет особое значение следующего символа\n"
 "\" и ' работают как обычно\n"
 "пробелы разделяют аргументы командной строки утилиты"
+"      Подсказка: используйте echo \"Ваша строка %\" чтобы поместить вашу строку перед ответом."
 
 
-#: ussd-widget.py:564
+#: ussd-widget.py:611
 msgid ""
 "Reply would be passed to specified utility after parser utility. May be used "
 "for logging, statistics etc.\n"
 msgid ""
 "Reply would be passed to specified utility after parser utility. May be used "
 "for logging, statistics etc.\n"
@@ -183,14 +230,15 @@ msgid ""
 "\" and ' work as usual\n"
 "space delimits command line parameters of utility"
 msgstr ""
 "\" and ' work as usual\n"
 "space delimits command line parameters of utility"
 msgstr ""
-"Ответ будет передан указанной утилите. Может быть использовано для сбора статистики.\n"
+"Ответ будет передан указанной утилите. Может быть использовано для сбора "
+"статистики.\n"
 "       Формат:\n"
 "% будет заменен ответом\n"
 "\\ отменяет особое значение следующего символа\n"
 "\" и ' работают как обычно\n"
 "пробелы разделяют аргументы командной строки утилиты"
 
 "       Формат:\n"
 "% будет заменен ответом\n"
 "\\ отменяет особое значение следующего символа\n"
 "\" и ' работают как обычно\n"
 "пробелы разделяют аргументы командной строки утилиты"
 
-#: ussd-widget.py:569
+#: ussd-widget.py:616
 msgid ""
 "Standard python regexps. Use\n"
 " (.+?[\\d\\,\\.]+)\n"
 msgid ""
 "Standard python regexps. Use\n"
 " (.+?[\\d\\,\\.]+)\n"
@@ -200,44 +248,46 @@ msgstr ""
 " (.+?[\\d\\,\\.]+)\n"
 " чтобы удалить все после первого числа."
 
 " (.+?[\\d\\,\\.]+)\n"
 " чтобы удалить все после первого числа."
 
-#: ussd-widget.py:574
+#: ussd-widget.py:621
 msgid ""
 "Pauses between attemps (in seconds), delimited by -. For example 15-15-300 "
 "means \"In case of failure wait 15 seconds, try again, on failure wait 15 "
 "more secodns and try again, on failure make last attempt after 5 minutes\""
 msgstr ""
 "Промежутки между попытками (в секундах), разделенные -. Например, 15-15-300 "
 msgid ""
 "Pauses between attemps (in seconds), delimited by -. For example 15-15-300 "
 "means \"In case of failure wait 15 seconds, try again, on failure wait 15 "
 "more secodns and try again, on failure make last attempt after 5 minutes\""
 msgstr ""
 "Промежутки между попытками (в секундах), разделенные -. Например, 15-15-300 "
-"означает \"В случае ошибки ждать 15 секунд, пробовать снова, в случае ошибки ждать еще 15 секунд "
-"и снова пробовать, в случае ошибки сделать последнюю попытку еще через 5 минут\""
+"означает \"В случае ошибки ждать 15 секунд, пробовать снова, в случае ошибки "
+"ждать еще 15 секунд и снова пробовать, в случае ошибки сделать последнюю "
+"попытку еще через 5 минут\""
 
 
-#: ussd-widget.py:579
+#: ussd-widget.py:626
 msgid "Regexp syntax error"
 msgstr "Синтаксическая ошибка в регулярном выражении"
 
 msgid "Regexp syntax error"
 msgstr "Синтаксическая ошибка в регулярном выражении"
 
-#: ussd-widget.py:584
+#: ussd-widget.py:631
 msgid "Incorrect USSD number"
 msgstr "Неправильный USSD номер"
 
 msgid "Incorrect USSD number"
 msgstr "Неправильный USSD номер"
 
-#: ussd-widget.py:584
+#: ussd-widget.py:631
 msgid "USSD number should contain only digits, +, * or #"
 msgstr "USSD номер должен состоять только из цифр, +, * и #"
 
 msgid "USSD number should contain only digits, +, * or #"
 msgstr "USSD номер должен состоять только из цифр, +, * и #"
 
-#: ussd-widget.py:589
+#: ussd-widget.py:636
 msgid "Incorrect retry pattern"
 msgstr "Неправильный шаблон повторных запросов"
 
 msgid "Incorrect retry pattern"
 msgstr "Неправильный шаблон повторных запросов"
 
-#: ussd-widget.py:589
+#: ussd-widget.py:636
 msgid "Retry pattern should contain only numbers, delimited by -"
 msgstr "Шаблон повторных запросов должен состоять из чисер, разделенных -"
 
 msgid "Retry pattern should contain only numbers, delimited by -"
 msgstr "Шаблон повторных запросов должен состоять из чисер, разделенных -"
 
-#: ussd-widget.py:594
+#: ussd-widget.py:641
 msgid "Choose background color"
 msgstr "Выберите цвет фона"
 
 msgid "Choose background color"
 msgstr "Выберите цвет фона"
 
-#: ussd-widget.py:601
+#: ussd-widget.py:648
 msgid "Choose text color"
 msgstr "Выберите цвет текста"
 
 msgid "Choose text color"
 msgstr "Выберите цвет текста"
 
-#: ussd-widget.py:608
+#: ussd-widget.py:655
 msgid "Choose a font"
 msgstr "Выберите шрифт"
 msgid "Choose a font"
 msgstr "Выберите шрифт"
+
index 4854980..70f4512 100755 (executable)
@@ -26,13 +26,13 @@ ussd_languages = ["German", "English", "Italian", "French", "Spanish", "Dutch",
 
 # TODO Cutt off too long messages and show them in separate dialog
 # how TODO widget vertical minimum size policy
 
 # TODO Cutt off too long messages and show them in separate dialog
 # how TODO widget vertical minimum size policy
-# TODO interface for queryng from scripts. For example query from one widget can change color of another widget
+# TODO interface for queryng from scripts. For example query from one widget can change color of another widget 
 
 class USSD_Controller:
        def __init__( self, widget ) :
                self.widget = widget
 
 class USSD_Controller:
        def __init__( self, widget ) :
                self.widget = widget
-               # number, parser, chain, interval, regexp, width, execute_at_start, retry pattern, font, [name, always show], language 
-               self.default_config = ["", "", "", 0, "", 0, True, [], pango.FontDescription("Nokia Sans 18"), [_("Click to update"), False], 15]
+               # number, parser, chain, interval, regexp, width, execute_at_start, retry pattern, font, name, language, show_message_box, message_box_parser 
+               self.default_config = ["", "", "", 0, "", 0, True, [], pango.FontDescription("Nokia Sans 18"), _("Click to update"), 15, False, ""]
                self.config = self.default_config
                self.timeout_version = 0
                self.retry_version = 0
                self.config = self.default_config
                self.timeout_version = 0
                self.retry_version = 0
@@ -63,7 +63,8 @@ class USSD_Controller:
                fconfig.write(oldconfig)
                fconfig.write("%"+self.id+"\n");
                fconfig.writelines(["# USSD query to be run by widget\n", "number="+self.config[0], "\n"])
                fconfig.write(oldconfig)
                fconfig.write("%"+self.id+"\n");
                fconfig.writelines(["# USSD query to be run by widget\n", "number="+self.config[0], "\n"])
-               fconfig.writelines(["#Parser command\n", "parser="+self.config[1], "\n"])
+               fconfig.writelines(["#Parser command for widget\n", "parser="+self.config[1], "\n"])
+               fconfig.writelines(["#Parser command for banner\n", "parser_box="+self.config[12], "\n"])
                fconfig.writelines(["#Chain command\n", "chain="+self.config[2], "\n"])
                fconfig.writelines(["#Update interval in minutes\n", "interval="+str(self.config[3]), "\n"])
                fconfig.writelines(["#RegExp pattern\n", "regexp="+self.config[4], "\n"])
                fconfig.writelines(["#Chain command\n", "chain="+self.config[2], "\n"])
                fconfig.writelines(["#Update interval in minutes\n", "interval="+str(self.config[3]), "\n"])
                fconfig.writelines(["#RegExp pattern\n", "regexp="+self.config[4], "\n"])
@@ -81,8 +82,8 @@ class USSD_Controller:
                fconfig.writelines(["#Font description\n", "font="+self.config[8].to_string(), "\n"])
                fconfig.writelines(["#Font color\n", "text_color="+self.widget.get_text_color().to_string(), "\n"])
                fconfig.writelines(["#Background color\n", "bg_color="+self.widget.get_bg_color().to_string(), "\n"])
                fconfig.writelines(["#Font description\n", "font="+self.config[8].to_string(), "\n"])
                fconfig.writelines(["#Font color\n", "text_color="+self.widget.get_text_color().to_string(), "\n"])
                fconfig.writelines(["#Background color\n", "bg_color="+self.widget.get_bg_color().to_string(), "\n"])
-               fconfig.writelines(["#Widget name\n", "name="+self.config[9][0], "\n"])
-               fconfig.writelines(["#Always show widget name\n", "show_name="+str(self.config[9][1]), "\n"])
+               fconfig.writelines(["#Widget name\n", "name="+self.config[9], "\n"])
+               fconfig.writelines(["#Show banner\n", "show_box="+str(self.config[11]), "\n"])
                fconfig.writelines(["#USSD reply language\n", "language="+str(self.config[10]), "\n"])
                fconfig.close()
 
                fconfig.writelines(["#USSD reply language\n", "language="+str(self.config[10]), "\n"])
                fconfig.close()
 
@@ -122,6 +123,8 @@ class USSD_Controller:
                                        self.config[0] = line[1].strip()
                                elif line[0] == "parser" :
                                        self.config[1] = line[1].strip()
                                        self.config[0] = line[1].strip()
                                elif line[0] == "parser" :
                                        self.config[1] = line[1].strip()
+                               elif line[0] == "parser_box" :
+                                       self.config[12] = line[1].strip()
                                elif line[0] == "chain" :
                                        self.config[2] = line[1].strip()
                                elif line[0] == "interval" :
                                elif line[0] == "chain" :
                                        self.config[2] = line[1].strip()
                                elif line[0] == "interval" :
@@ -181,12 +184,12 @@ class USSD_Controller:
                                                error = True
                                                print _("Error reading config on line %(line)d. Expected color definition.")%{"line":i}
                                elif line[0] == "name" :
                                                error = True
                                                print _("Error reading config on line %(line)d. Expected color definition.")%{"line":i}
                                elif line[0] == "name" :
-                                       self.config[9][0] = line[1].strip()
-                               elif line[0] == "show_name" :
+                                       self.config[9] = line[1].strip()
+                               elif line[0] == "show_box" :
                                        if line[1].strip() == "True" :
                                        if line[1].strip() == "True" :
-                                               self.config[9][1] = True
+                                               self.config[11] = True
                                        else :
                                        else :
-                                               self.config[9][1] = False
+                                               self.config[11] = False
                                elif line[0] == "language" :
                                        try:
                                                if int(line[1].strip()) >=0 and int(line[1].strip()) < len(ussd_languages):
                                elif line[0] == "language" :
                                        try:
                                                if int(line[1].strip()) >=0 and int(line[1].strip()) < len(ussd_languages):
@@ -264,8 +267,10 @@ class USSD_Controller:
                        dialog.query_at_start.get_active(),
                        retry,
                        dialog.font,
                        dialog.query_at_start.get_active(),
                        retry,
                        dialog.font,
-                       [dialog.wname.get_text(), dialog.show_name.get_active()],
-                       dialog.language.get_active()
+                       dialog.wname.get_text(),
+                       dialog.language.get_active(),
+                       dialog.show_box.get_active(),
+                       dialog.b_parser.get_text()
                ]
 
                widget.set_bg_color(dialog.bg_color)
                ]
 
                widget.set_bg_color(dialog.bg_color)
@@ -338,23 +343,43 @@ class USSD_Controller:
                                self.retry_state += 1
                else :
                        self.widget.error = 0
                                self.retry_state += 1
                else :
                        self.widget.error = 0
-                       # Pass to parser
-                       if self.config[1] != "":
-                               p = Popen(smart_split_string(self.config[1], reply), stdout=PIPE)
-                               reply = p.communicate(reply+"\n")[0].strip()
-                       # Pass to chain
-                       if self.config[2] != "":
-                               p = Popen(smart_split_string(self.config[2], reply))
                        # Apply regexp
                        if self.config[4] != "":
                                try :
                        # Apply regexp
                        if self.config[4] != "":
                                try :
-                                       r = re.match( self.config[4], reply ).group( 1 )
+                                       reply = re.match( self.config[4], reply ).group( 1 )
                                except Exception, e:
                                except Exception, e:
-                                       r = _("Regexp Error: ") + str( e ) + "\n" + reply
-
-                               if r :
-                                       reply = r
-                       self.widget.set_text(reply)
+                                       self.widget.error = 1
+                                       reply = _("Regexp Error: ") + str( e ) + "\n" + reply
+                       w_reply = b_reply = reply
+                       if self.widget.error == 0:
+                               # Pass to box parser
+                               if self.config[12] != "" and self.config[11]:
+                                       try:
+                                               p = Popen(smart_split_string(self.config[12], reply), stdout=PIPE)
+                                               b_reply = p.communicate()[0].strip()
+                                       except Exception, e:
+                                               print _("Couldn't exec banner parser:")+str(e)
+                                               self.widget.error = 1
+                               # Pass to widget parser
+                               if self.config[1] != "":
+                                       try:
+                                               p = Popen(smart_split_string(self.config[1], reply), stdout=PIPE)
+                                               w_reply = p.communicate()[0].strip()
+                                       except Exception, e:
+                                               print _("Couldn't exec widget parser:")+str(e)
+                                               self.widget.error = 1
+                               # Pass to chain
+                               if self.config[2] != "":
+                                       try:
+                                               p = Popen(smart_split_string(self.config[2], reply))
+                                       except Exception, e:
+                                               print _("Couldn't exec chain:")+str(e)
+                                               self.widget.error = 1
+                       if self.config[11]:
+                               banner = hildon.hildon_banner_show_information (self.widget, "", b_reply)
+                               banner.set_timeout (5000)
+                               b_reply
+                       self.widget.set_text(w_reply)
                self.widget.processing = 0
 
        def timed_renew(self, version):
                self.widget.processing = 0
 
        def timed_renew(self, version):
@@ -400,6 +425,9 @@ class UssdConfigDialog(gtk.Dialog):
                self.ussdNumber.set_text(config[0])
                self.parser = hildon.Entry(gtk.HILDON_SIZE_AUTO)
                self.parser.set_text(config[1])
                self.ussdNumber.set_text(config[0])
                self.parser = hildon.Entry(gtk.HILDON_SIZE_AUTO)
                self.parser.set_text(config[1])
+               self.b_parser = hildon.Entry(gtk.HILDON_SIZE_AUTO)
+               self.b_parser.set_text(config[12])
+
                self.chain = hildon.Entry(gtk.HILDON_SIZE_AUTO)
                self.chain.set_text(config[2])
                self.update_interval = hildon.NumberEditor(0, 9999)
                self.chain = hildon.Entry(gtk.HILDON_SIZE_AUTO)
                self.chain.set_text(config[2])
                self.update_interval = hildon.NumberEditor(0, 9999)
@@ -411,7 +439,6 @@ class UssdConfigDialog(gtk.Dialog):
                self.retryEdit = hildon.Entry(gtk.HILDON_SIZE_AUTO)
 
 
                self.retryEdit = hildon.Entry(gtk.HILDON_SIZE_AUTO)
 
 
-               #selector = hildon.hildon_touch_selector_new_text()
                selector = hildon.TouchSelector(text=True)
                for i in ussd_languages:
                        selector.append_text(i)
                selector = hildon.TouchSelector(text=True)
                for i in ussd_languages:
                        selector.append_text(i)
@@ -422,9 +449,9 @@ class UssdConfigDialog(gtk.Dialog):
                self.language.set_size_request(-1, -1)
 
                self.wname = hildon.Entry(gtk.HILDON_SIZE_AUTO)
                self.language.set_size_request(-1, -1)
 
                self.wname = hildon.Entry(gtk.HILDON_SIZE_AUTO)
-               self.wname.set_text(config[9][0])
-               self.show_name = gtk.CheckButton(_("Always show name"))
-               self.show_name.set_active(config[9][1])
+               self.wname.set_text(config[9])
+               self.show_box = gtk.CheckButton(_("Enable banner. Parser:"))
+               self.show_box.set_active(config[11])
 
                text = ""
                for i in config[7]:
 
                text = ""
                for i in config[7]:
@@ -446,6 +473,9 @@ class UssdConfigDialog(gtk.Dialog):
                
                phelp = gtk.Button("?")
                phelp.connect("clicked", self.on_show_phelp)
                
                phelp = gtk.Button("?")
                phelp.connect("clicked", self.on_show_phelp)
+               
+               bphelp = gtk.Button("?")
+               bphelp.connect("clicked", self.on_show_bphelp)
 
                chelp = gtk.Button("?")
                chelp.connect("clicked", self.on_show_chelp)
 
                chelp = gtk.Button("?")
                chelp.connect("clicked", self.on_show_chelp)
@@ -475,14 +505,16 @@ class UssdConfigDialog(gtk.Dialog):
                vbox.add(self.query_at_start)
 
                nameBox = gtk.HBox()
                vbox.add(self.query_at_start)
 
                nameBox = gtk.HBox()
-               self.show_name.set_size_request(100, -1)
-               self.wname.set_size_request(100, -1)
-               nameBox.add(self.show_name)
+               nameLabel = gtk.Label(_("Name"))
+               nameLabel.set_alignment(0,0)
+               nameLabel.set_size_request(100, -1)
+               self.wname.set_size_request(200, -1)
+               nameBox.add(nameLabel)
                nameBox.add(self.wname)
                vbox.add(nameBox)
 
                parserBox = gtk.HBox()
                nameBox.add(self.wname)
                vbox.add(nameBox)
 
                parserBox = gtk.HBox()
-               parserLabel = gtk.Label(_("Parser"))
+               parserLabel = gtk.Label(_("Parser for widget"))
                parserLabel.set_alignment(0,0)
                parserLabel.set_size_request(200, -1)
                phelp.set_size_request(10, -1)
                parserLabel.set_alignment(0,0)
                parserLabel.set_size_request(200, -1)
                phelp.set_size_request(10, -1)
@@ -490,6 +522,16 @@ class UssdConfigDialog(gtk.Dialog):
                parserBox.add(phelp)
                vbox.add(parserBox)
                vbox.add(self.parser)
                parserBox.add(phelp)
                vbox.add(parserBox)
                vbox.add(self.parser)
+               
+               b_parserBox = gtk.HBox()
+#              parserLabel = gtk.Label(_("Parser"))
+#              parserLabel.set_alignment(0,0)
+               self.show_box.set_size_request(200, -1)
+               bphelp.set_size_request(10, -1)
+               b_parserBox.add(self.show_box)
+               b_parserBox.add(bphelp)
+               vbox.add(b_parserBox)
+               vbox.add(self.b_parser)
 
                chainBox = gtk.HBox()
                chainLabel = gtk.Label(_("Chain"))
 
                chainBox = gtk.HBox()
                chainLabel = gtk.Label(_("Chain"))
@@ -556,10 +598,15 @@ class UssdConfigDialog(gtk.Dialog):
 
        #============ Dialog helper functions =============
        def on_show_phelp(self, widget):
 
        #============ Dialog helper functions =============
        def on_show_phelp(self, widget):
-               dialog = pHelpDialog(_("Format help"), _("Reply would be passed to specified utility, output of utility would be shown to you.\n       Format:\n% would be replaced by reply\n\\ invalidates special meaming of following symbol\n\" and ' work as usual\nspace delimits command line parameters of utility"))
+               dialog = pHelpDialog(_("Format help"), _("Reply would be passed to specified utility, output of utility would be shown to you on widget.\n       Format:\n% would be replaced by reply\n\\ invalidates special meaming of following symbol\n\" and ' work as usual\nspace delimits command line parameters of utility\n      Hint: use echo \"Your string %\" to prepend your string to reply."))
                dialog.run()
                dialog.destroy()
 
                dialog.run()
                dialog.destroy()
 
+       def on_show_bphelp(self, widget):
+               dialog = pHelpDialog(_("Format help"), _("Reply would be passed to specified utility, output of utility would be shown to you on banner.\n       Format:\n% would be replaced by reply\n\\ invalidates special meaming of following symbol\n\" and ' work as usual\nspace delimits command line parameters of utility\n      Hint: use echo \"Your string %\" to prepend your string to reply."))
+               dialog.run()
+               dialog.destroy()
+       
        def on_show_chelp(self, widget):
                dialog = pHelpDialog(_("Format help"), _("Reply would be passed to specified utility after parser utility. May be used for logging, statistics etc.\n       Format:\n% would be replaced by reply\n\\ invalidates special meaning of following symbol\n\" and ' work as usual\nspace delimits command line parameters of utility"))
                dialog.run()
        def on_show_chelp(self, widget):
                dialog = pHelpDialog(_("Format help"), _("Reply would be passed to specified utility after parser utility. May be used for logging, statistics etc.\n       Format:\n% would be replaced by reply\n\\ invalidates special meaning of following symbol\n\" and ' work as usual\nspace delimits command line parameters of utility"))
                dialog.run()
@@ -706,7 +753,7 @@ class UssdWidgetPlugin(hildondesktop.HomePluginItem):
        def do_show(self):
                config = self.controller.read_config(self.get_applet_id())
                self.set_width(config[5])
        def do_show(self):
                config = self.controller.read_config(self.get_applet_id())
                self.set_width(config[5])
-               self.set_text("")               
+               self.set_text(config[9])                
                if config[6]:
                        self.controller.ussd_renew(self, None)
 
                if config[6]:
                        self.controller.ussd_renew(self, None)
 
@@ -731,8 +778,6 @@ class UssdWidgetPlugin(hildondesktop.HomePluginItem):
                                self.text = text
                
                config = self.controller.get_config()
                                self.text = text
                
                config = self.controller.get_config()
-               if config[9][1] or text == "":
-                       text = config[9][0]+text
                self.label.set_text(text)
 
        def get_text(self):
                self.label.set_text(text)
 
        def get_text(self):
index 1ac628f..160c781 100644 (file)
Binary files a/ussd-widget/src/usr/share/locale/ru/LC_MESSAGES/ussd-widget.mo and b/ussd-widget/src/usr/share/locale/ru/LC_MESSAGES/ussd-widget.mo differ