From 5c5de2dd674ca47b2a83fd63c14dfbd4b989977e Mon Sep 17 00:00:00 2001
From: anwinged <anwinged@c733b785-2984-70f4-63a9-da4130069974>
Date: Tue, 15 May 2012 07:46:49 +0000
Subject: [PATCH] same bugfixes

---
 forms.py                         |  23 ++-
 locale/ru_RU/LC_MESSAGES/opal.po | 334 +++++++++++++++++++++++++++++++
 opal.py                          |  15 +-
 server.py                        |   3 +
 tasks.conf                       |   2 +-
 tasks/setup.py                   |  13 ++
 6 files changed, 374 insertions(+), 16 deletions(-)
 create mode 100644 locale/ru_RU/LC_MESSAGES/opal.po
 create mode 100644 tasks/setup.py

diff --git a/forms.py b/forms.py
index 89037d6..5b4c196 100644
--- a/forms.py
+++ b/forms.py
@@ -95,7 +95,7 @@ class MainFrame(wx.Frame):
         Lang.install(unicode=True)
         global _
         _ = Lang.ugettext
-        self.gettext = Lang.ugettext
+        self.lang = Lang
 
         self.auimgr = aui.AuiManager()
         self.auimgr.SetManagedWindow(self)
@@ -111,8 +111,7 @@ class MainFrame(wx.Frame):
         # self.m_specs.SetMinSize(wx.Size(200,-1))
 
         self.auimgr.AddPane(self.m_specs,
-            aui.AuiPaneInfo().Name("m_specs").Caption(_("Templates")).
-            Left().Layer(1).CloseButton(False))
+            aui.AuiPaneInfo().Name("m_specs").Left().Layer(1).CloseButton(False))
 
         # Пользовательские модели
 
@@ -127,15 +126,14 @@ class MainFrame(wx.Frame):
         self.m_user_models.SetImageList(self.ilist)
 
         self.auimgr.AddPane(self.m_user_models,
-            aui.AuiPaneInfo().Name("m_user_models").Caption(_("Models")).
-            CenterPane().Position(1))
+            aui.AuiPaneInfo().Name("m_user_models").CenterPane().Position(1))
 
         # Параметры модели
 
         self.m_params = PropertyCtrl(self, size = (-1, 300))
 
         self.auimgr.AddPane(self.m_params,
-            aui.AuiPaneInfo().Name("m_params").Caption(_("Parameters")).CloseButton(False).
+            aui.AuiPaneInfo().Name("m_params").CloseButton(False).
             CenterPane().Bottom().Position(2))
 
         # Быстрые результаты
@@ -143,7 +141,7 @@ class MainFrame(wx.Frame):
         self.m_quick_result = PropertyCtrl(self, size = (200, -1))
 
         self.auimgr.AddPane(self.m_quick_result,
-            aui.AuiPaneInfo().Name("m_quick_result").Caption(_("Quick results")).CloseButton(False).
+            aui.AuiPaneInfo().Name("m_quick_result").CloseButton(False).
             Right().Position(1).Layer(1))
 
         # Графики
@@ -153,7 +151,7 @@ class MainFrame(wx.Frame):
         self.m_plots.SetImageList(self.ilist)
 
         self.auimgr.AddPane(self.m_plots,
-            aui.AuiPaneInfo().Name("m_plots").Caption(_("Plots")).CloseButton(False).
+            aui.AuiPaneInfo().Name("m_plots").CloseButton(False).
             Right().Position(2).Layer(1))
 
         # Меню, панель инструментов и панель статуса
@@ -170,7 +168,13 @@ class MainFrame(wx.Frame):
         layout = self.settings['layout']
         if layout:
             self.auimgr.LoadPerspective(layout, False)
-            print 'layout loaded'
+            # print 'layout loaded'
+
+        self.auimgr.GetPane('m_specs').Caption(_("Templates"))
+        self.auimgr.GetPane('m_user_models').Caption(_("Models"))
+        self.auimgr.GetPane("m_params").Caption(_("Parameters"))
+        self.auimgr.GetPane("m_quick_result").Caption(_("Quick results"))
+        self.auimgr.GetPane("m_plots").Caption(_("Plots"))
 
         self.auimgr.Update()
 
@@ -230,7 +234,6 @@ class MainFrame(wx.Frame):
         submenu.Append(ID_ENGLISH_LANG, _('English'))
         submenu.Append(ID_RUSSIAN_LANG, _('Russian'))
         menu.AppendSubMenu(submenu, _('Language'))
-        menu.AppendSeparator()
         # menu.Append(ID_SHOW_PLOT, _('Layout'))
         # menu.Append(ID_ADD_PLOT, _('Options'))
         #menu.Append(ID_ADD_LINE, _('Add line'))
diff --git a/locale/ru_RU/LC_MESSAGES/opal.po b/locale/ru_RU/LC_MESSAGES/opal.po
new file mode 100644
index 0000000..1fe4ff1
--- /dev/null
+++ b/locale/ru_RU/LC_MESSAGES/opal.po
@@ -0,0 +1,334 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Opal Aurora\n"
+"POT-Creation-Date: 2012-05-12 13:57+0400\n"
+"PO-Revision-Date: 2012-05-12 13:58+0400\n"
+"Last-Translator: anwinged <anwinged@ya.ru>\n"
+"Language-Team: Anton \"anwinged\" Vakhrushev <anwinged@ya.ru>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
+"X-Poedit-Basepath: C:\\Projects\n"
+"X-Poedit-Language: Russian\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: Opal\n"
+
+#: Opal/forms.py:114
+msgid "Templates"
+msgstr "Шаблоны"
+
+#: Opal/forms.py:122
+msgid "Model name"
+msgstr "Имя модели"
+
+#: Opal/forms.py:123
+msgid "Status"
+msgstr "Статус"
+
+#: Opal/forms.py:124
+msgid "Progress"
+msgstr "Прогресс"
+
+#: Opal/forms.py:125
+msgid "Comment"
+msgstr "Комментарий"
+
+#: Opal/forms.py:130
+msgid "Models"
+msgstr "Модели"
+
+#: Opal/forms.py:138
+msgid "Parameters"
+msgstr "Параметры"
+
+#: Opal/forms.py:146
+msgid "Quick results"
+msgstr "Быстрый просмотр"
+
+#: Opal/forms.py:156
+msgid "Plots"
+msgstr "Графики"
+
+#: Opal/forms.py:198
+msgid "&New\tCtrl+N"
+msgstr "&Новый\tCtrl+N"
+
+#: Opal/forms.py:199
+msgid "&Open\tCtrl+O"
+msgstr "&Открыть\tCtrl+O"
+
+#: Opal/forms.py:200
+msgid "&Save\tCtrl+S"
+msgstr "&Сохранить\tCtrl+S"
+
+#: Opal/forms.py:201
+msgid "&Project"
+msgstr "&Проект"
+
+#: Opal/forms.py:204
+#: Opal/forms.py:248
+msgid "Add model to root"
+msgstr "Добавить модель в корень"
+
+#: Opal/forms.py:205
+msgid "Append model to selected"
+msgstr "Добавить модель к выбранной"
+
+#: Opal/forms.py:207
+msgid "&Duplicate\tCtrl+D"
+msgstr "&Дублировать\tCtrl+D"
+
+#: Opal/forms.py:208
+msgid "&Duplicate with subitems\tCtrl+Shift+D"
+msgstr "&Дублировать с поддеревом\tCtrl+Shift+D"
+
+#: Opal/forms.py:209
+msgid "Delete\tCtrl+E"
+msgstr "Удалить\tCtrl+E"
+
+#: Opal/forms.py:211
+msgid "&Test\tCtrl+T"
+msgstr ""
+
+#: Opal/forms.py:212
+msgid "&Model"
+msgstr "&Модель"
+
+#: Opal/forms.py:215
+msgid "Process\tF5"
+msgstr "Запустить\tF5"
+
+#: Opal/forms.py:216
+msgid "Stop\tF6"
+msgstr "Остановить\tF6"
+
+#: Opal/forms.py:218
+msgid "&Run"
+msgstr "&Выполнить"
+
+#: Opal/forms.py:221
+msgid "Show report\tF7"
+msgstr "Показать отчет\tF7"
+
+#: Opal/forms.py:223
+msgid "Show plot\tF8"
+msgstr "Показать график\tF8"
+
+#: Opal/forms.py:224
+#: Opal/forms.py:254
+msgid "Add plot"
+msgstr "Добавить график"
+
+#: Opal/forms.py:226
+msgid "&Result"
+msgstr "&Результат"
+
+#: Opal/forms.py:230
+msgid "English"
+msgstr "Английский"
+
+#: Opal/forms.py:231
+msgid "Russian"
+msgstr "Русский"
+
+#: Opal/forms.py:232
+msgid "Language"
+msgstr "Язык"
+
+#: Opal/forms.py:237
+msgid "&Settings"
+msgstr "Настройки"
+
+#: Opal/forms.py:241
+msgid "&About\tF1"
+msgstr "&О программе\tF1"
+
+#: Opal/forms.py:242
+msgid "&Help"
+msgstr "&Помощь"
+
+#: Opal/forms.py:249
+msgid "Add model to selected"
+msgstr "Добавить модель к выбранной"
+
+#: Opal/forms.py:256
+#: Opal/forms.py:264
+msgid "Add curves"
+msgstr "Добавить линии"
+
+#: Opal/forms.py:257
+#: Opal/forms.py:265
+msgid "Add markers"
+msgstr "Добавить маркеры"
+
+#: Opal/forms.py:262
+msgid "Show report"
+msgstr "Показать отчет"
+
+#: Opal/forms.py:275
+msgid "Add specification to selected model"
+msgstr "Добавить спецификацию к выбранной модели"
+
+#: Opal/forms.py:277
+msgid "Duplicate selected model"
+msgstr "Дублировать выделенную модель"
+
+#: Opal/forms.py:279
+msgid "Duplicate selected model and all submodels"
+msgstr "Дублировать выбранную модель со всеми спецификациями"
+
+#: Opal/forms.py:281
+msgid "Delete selected model"
+msgstr "Удалить выбранную модель"
+
+#: Opal/forms.py:284
+msgid "Start processing of selected models"
+msgstr "Начать обработку выбранных моделей"
+
+#: Opal/forms.py:286
+msgid "Stop processing of selected models"
+msgstr "Остановить обработку выбранных моделей"
+
+#: Opal/forms.py:289
+msgid "Show quick plot for selected model"
+msgstr "Построить график для выбранных моделей"
+
+#: Opal/forms.py:291
+msgid "Show result data and table for selected model"
+msgstr "Покаразть результаты вычислений для выбранной модели"
+
+#: Opal/forms.py:294
+msgid "Show infomation about application"
+msgstr "Показать информацию о приложении"
+
+#: Opal/forms.py:297
+msgid "Toolbar"
+msgstr ""
+
+#: Opal/forms.py:320
+msgid "Select model"
+msgstr "Выбрать модель"
+
+#: Opal/forms.py:361
+msgid "CSV\tCtrl+E"
+msgstr "CSV\tCtrl+E"
+
+#: Opal/forms.py:363
+msgid "Export to"
+msgstr "Экспортировать как"
+
+#: Opal/forms.py:391
+msgid "Image size"
+msgstr "Размер изображения"
+
+#: Opal/forms.py:447
+msgid "Save to file\tCtrl+S"
+msgstr "Сохранить\tCtrl+S"
+
+#: Opal/forms.py:448
+#: Opal/opal.py:984
+msgid "Plot"
+msgstr "График"
+
+#: Opal/forms.py:479
+msgid "About Opal"
+msgstr "О программе Opal"
+
+#: Opal/opal.py:242
+msgid "Information"
+msgstr "Информация"
+
+#: Opal/opal.py:242
+msgid "Locale changed. Restart application to apply settings"
+msgstr "Локаль изменена. Перезапустите приложение, чтобы настройки вступили в силу"
+
+#: Opal/opal.py:293
+msgid "Unknown"
+msgstr "Неизвестно"
+
+#: Opal/opal.py:376
+msgid "Model \"{}\" selected"
+msgstr "Модель \"{}\" выбрана"
+
+#: Opal/opal.py:433
+msgid "Select file to load project"
+msgstr "Выбрать файл с проектом"
+
+#: Opal/opal.py:472
+msgid "Can't load saved file"
+msgstr "Невозможно загрузить сохраненный файл"
+
+#: Opal/opal.py:472
+#: Opal/opal.py:569
+#: Opal/opal.py:694
+msgid "Error"
+msgstr "Ошибка"
+
+#: Opal/opal.py:534
+msgid "Select file to save project"
+msgstr "Выбрать файл для проекта"
+
+#: Opal/opal.py:569
+msgid "Can't save the project"
+msgstr "Невозможно сохранить прокт"
+
+#: Opal/opal.py:610
+msgid "Ready"
+msgstr "Ожидает"
+
+#: Opal/opal.py:614
+msgid "Running"
+msgstr "Выполняется"
+
+#: Opal/opal.py:618
+msgid "Completed"
+msgstr "Завершено"
+
+#: Opal/opal.py:622
+msgid "Stopped"
+msgstr "Остановлено"
+
+#: Opal/opal.py:626
+msgid "No executable"
+msgstr "Не выполнимая"
+
+#: Opal/opal.py:694
+msgid "It's impossible to append model"
+msgstr "Невозможно добавить модель"
+
+#: Opal/opal.py:789
+msgid "Invalid item"
+msgstr "Неверный элемент"
+
+#: Opal/opal.py:796
+#: Opal/opal.py:803
+msgid "Empty data"
+msgstr "Нет данных"
+
+#: Opal/opal.py:883
+msgid "Result for model \"{}\""
+msgstr "Результат для моделиl \"{}\""
+
+#: Opal/opal.py:891
+msgid "New plot"
+msgstr "Новый график"
+
+#: Opal/opal.py:937
+msgid "Line(s) for \"{}\" ({}/{})"
+msgstr "Линии для \"{}\" ({}/{})"
+
+#: Opal/opal.py:941
+msgid "There is no any result data for model!"
+msgstr "Для модели нет результата!"
+
+#: Opal/opal.py:1098
+msgid "Save table to CSV"
+msgstr "Сохранить таблицу как CSV"
+
+#: Opal/opal.py:1200
+msgid "Save plot"
+msgstr "Сохранить график"
+
+#~ msgid "Locale"
+#~ msgstr "Язык"
diff --git a/opal.py b/opal.py
index 6ba1bab..90ef827 100644
--- a/opal.py
+++ b/opal.py
@@ -137,7 +137,7 @@ class MainFrame(forms.MainFrame):
         forms.MainFrame.__init__(self, None)
 
         global _
-        _ = self.gettext
+        _ = self.lang.ugettext
 
         self.model = None
         self.name_id = 1
@@ -240,6 +240,9 @@ class MainFrame(forms.MainFrame):
     def ChangeLocale(self, locale):
         self.settings['locale'] = locale
         wx.MessageBox(_('Locale changed. Restart application to apply settings'), _('Information'))
+        self.lang = gettext.translation('opal', './locale', languages=[locale], fallback=True)
+        self.lang.install(unicode=True)
+
 
     def OnClose(self, event):
         self.server.Stop()
@@ -384,6 +387,8 @@ class MainFrame(forms.MainFrame):
             model = f.GetSelectedModel()
             if model:
                 self.NewProject(model)
+            else:
+                print 'Empty model'
 
         self.do_nothing = False
 
@@ -1030,17 +1035,17 @@ class SelectModelDialog(forms.SelectModelDialog):
         self.mlist.SetImageList(self.ilist, wx.IMAGE_LIST_NORMAL)
         self.data_list = {}
 
-        for model in models:
+        for index, model in enumerate(models):
             item = wx.ListItem()
+            item.SetId(index)
             item.SetText(model.GetTitle())
-            #item.Data = model
+            self.data_list[index] = model
             img_data = model.GetImage()
             if img_data:
                 img = PyEmbeddedImage(img_data)
                 index = self.ilist.Add(img.GetBitmap())
                 item.SetImage(index)
-            index = self.mlist.InsertItem(item)
-            self.data_list[index] = model
+            self.mlist.InsertItem(item)
 
     def GetSelectedModel(self):
         index = self.mlist.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
diff --git a/server.py b/server.py
index 64b2494..cdab088 100644
--- a/server.py
+++ b/server.py
@@ -73,6 +73,9 @@ class LocalServer:
         for line in open(self.conf, 'r'):
             try:
                 # нормализуем указанный путь
+                line = line.strip()
+                if not line:
+                    continue
                 line = os.path.normpath(line)
                 line = os.path.abspath(line)
                 # считываем данные через shell (важно для скриптовых языков)
diff --git a/tasks.conf b/tasks.conf
index 1ceed75..0c47a03 100644
--- a/tasks.conf
+++ b/tasks.conf
@@ -1 +1 @@
-tasks/testt.py
\ No newline at end of file
+tasks/testt.exe
diff --git a/tasks/setup.py b/tasks/setup.py
new file mode 100644
index 0000000..1b05778
--- /dev/null
+++ b/tasks/setup.py
@@ -0,0 +1,13 @@
+from distutils.core import setup
+import py2exe
+
+setup(
+    name = 'testt',
+    console = ['testt.py'],
+    options = { "py2exe": {
+        "compressed": 2,
+        "optimize": 2,
+        "bundle_files": 1,
+    } },
+    zipfile = None,
+)
\ No newline at end of file