tryton 6.6.8__py3-none-any.whl → 6.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tryton might be problematic. Click here for more details.

Files changed (92) hide show
  1. tryton/__init__.py +1 -1
  2. tryton/action/main.py +32 -43
  3. tryton/bus.py +2 -0
  4. tryton/client.py +3 -0
  5. tryton/common/button.py +3 -1
  6. tryton/common/common.py +55 -43
  7. tryton/common/datetime_.py +14 -2
  8. tryton/common/domain_inversion.py +10 -10
  9. tryton/common/domain_parser.py +5 -2
  10. tryton/common/popup_menu.py +7 -0
  11. tryton/common/selection.py +3 -1
  12. tryton/config.py +22 -5
  13. tryton/data/locale/bg/LC_MESSAGES/tryton.mo +0 -0
  14. tryton/data/locale/bg/LC_MESSAGES/tryton.po +45 -39
  15. tryton/data/locale/ca/LC_MESSAGES/tryton.mo +0 -0
  16. tryton/data/locale/ca/LC_MESSAGES/tryton.po +41 -35
  17. tryton/data/locale/cs/LC_MESSAGES/tryton.mo +0 -0
  18. tryton/data/locale/cs/LC_MESSAGES/tryton.po +46 -39
  19. tryton/data/locale/de/LC_MESSAGES/tryton.mo +0 -0
  20. tryton/data/locale/de/LC_MESSAGES/tryton.po +41 -35
  21. tryton/data/locale/es/LC_MESSAGES/tryton.mo +0 -0
  22. tryton/data/locale/es/LC_MESSAGES/tryton.po +41 -35
  23. tryton/data/locale/es_419/LC_MESSAGES/tryton.mo +0 -0
  24. tryton/data/locale/es_419/LC_MESSAGES/tryton.po +171 -167
  25. tryton/data/locale/et/LC_MESSAGES/tryton.mo +0 -0
  26. tryton/data/locale/et/LC_MESSAGES/tryton.po +47 -39
  27. tryton/data/locale/fa/LC_MESSAGES/tryton.mo +0 -0
  28. tryton/data/locale/fa/LC_MESSAGES/tryton.po +46 -38
  29. tryton/data/locale/fi/LC_MESSAGES/tryton.mo +0 -0
  30. tryton/data/locale/fi/LC_MESSAGES/tryton.po +38 -32
  31. tryton/data/locale/fr/LC_MESSAGES/tryton.mo +0 -0
  32. tryton/data/locale/fr/LC_MESSAGES/tryton.po +42 -36
  33. tryton/data/locale/hu/LC_MESSAGES/tryton.mo +0 -0
  34. tryton/data/locale/hu/LC_MESSAGES/tryton.po +44 -34
  35. tryton/data/locale/id/LC_MESSAGES/tryton.mo +0 -0
  36. tryton/data/locale/id/LC_MESSAGES/tryton.po +40 -34
  37. tryton/data/locale/it/LC_MESSAGES/tryton.mo +0 -0
  38. tryton/data/locale/it/LC_MESSAGES/tryton.po +44 -34
  39. tryton/data/locale/ja_JP/LC_MESSAGES/tryton.mo +0 -0
  40. tryton/data/locale/lo/LC_MESSAGES/tryton.mo +0 -0
  41. tryton/data/locale/lo/LC_MESSAGES/tryton.po +46 -38
  42. tryton/data/locale/lt/LC_MESSAGES/tryton.mo +0 -0
  43. tryton/data/locale/lt/LC_MESSAGES/tryton.po +47 -37
  44. tryton/data/locale/nl/LC_MESSAGES/tryton.mo +0 -0
  45. tryton/data/locale/nl/LC_MESSAGES/tryton.po +41 -35
  46. tryton/data/locale/pl/LC_MESSAGES/tryton.mo +0 -0
  47. tryton/data/locale/pl/LC_MESSAGES/tryton.po +45 -35
  48. tryton/data/locale/pt/LC_MESSAGES/tryton.mo +0 -0
  49. tryton/data/locale/pt/LC_MESSAGES/tryton.po +46 -38
  50. tryton/data/locale/ro/LC_MESSAGES/tryton.mo +0 -0
  51. tryton/data/locale/ro/LC_MESSAGES/tryton.po +50 -48
  52. tryton/data/locale/ru/LC_MESSAGES/tryton.mo +0 -0
  53. tryton/data/locale/ru/LC_MESSAGES/tryton.po +45 -39
  54. tryton/data/locale/sl/LC_MESSAGES/tryton.mo +0 -0
  55. tryton/data/locale/sl/LC_MESSAGES/tryton.po +47 -38
  56. tryton/data/locale/tr/LC_MESSAGES/tryton.mo +0 -0
  57. tryton/data/locale/tr/LC_MESSAGES/tryton.po +39 -33
  58. tryton/data/locale/uk/LC_MESSAGES/tryton.mo +0 -0
  59. tryton/data/locale/uk/LC_MESSAGES/tryton.po +43 -35
  60. tryton/data/locale/zh_CN/LC_MESSAGES/tryton.mo +0 -0
  61. tryton/data/locale/zh_CN/LC_MESSAGES/tryton.po +45 -35
  62. tryton/data/pixmaps/tryton/tryton-icon.svg +1 -0
  63. tryton/gui/main.py +54 -61
  64. tryton/gui/window/dblogin.py +27 -10
  65. tryton/gui/window/form.py +21 -53
  66. tryton/gui/window/infobar.py +9 -4
  67. tryton/gui/window/log.py +95 -0
  68. tryton/gui/window/view_board/action.py +0 -4
  69. tryton/gui/window/view_form/model/field.py +36 -14
  70. tryton/gui/window/view_form/model/record.py +22 -9
  71. tryton/gui/window/view_form/screen/screen.py +45 -76
  72. tryton/gui/window/view_form/view/calendar_.py +24 -11
  73. tryton/gui/window/view_form/view/calendar_gtk/toolbar.py +6 -5
  74. tryton/gui/window/view_form/view/form.py +14 -5
  75. tryton/gui/window/view_form/view/form_gtk/many2many.py +10 -1
  76. tryton/gui/window/view_form/view/form_gtk/many2one.py +1 -0
  77. tryton/gui/window/view_form/view/form_gtk/one2many.py +7 -7
  78. tryton/gui/window/view_form/view/form_gtk/textbox.py +0 -2
  79. tryton/gui/window/view_form/view/form_gtk/widget.py +8 -10
  80. tryton/gui/window/view_form/view/list_form.py +61 -5
  81. tryton/gui/window/view_form/view/list_gtk/editabletree.py +13 -3
  82. tryton/gui/window/view_form/view/list_gtk/widget.py +97 -27
  83. tryton/gui/window/win_form.py +6 -5
  84. tryton/rpc.py +13 -15
  85. tryton/tests/test_common.py +46 -0
  86. tryton/tests/test_common_domain_parser.py +24 -24
  87. {tryton-6.6.8.dist-info → tryton-6.8.1.dist-info}/METADATA +6 -6
  88. {tryton-6.6.8.dist-info → tryton-6.8.1.dist-info}/RECORD +92 -89
  89. {tryton-6.6.8.data → tryton-6.8.1.data}/scripts/tryton +0 -0
  90. {tryton-6.6.8.dist-info → tryton-6.8.1.dist-info}/LICENSE +0 -0
  91. {tryton-6.6.8.dist-info → tryton-6.8.1.dist-info}/WHEEL +0 -0
  92. {tryton-6.6.8.dist-info → tryton-6.8.1.dist-info}/top_level.txt +0 -0
@@ -23,9 +23,8 @@ msgstr "вкажіть логін користувача"
23
23
  msgid "specify the server hostname:port"
24
24
  msgstr "вкажіть ім'я сервера:порт"
25
25
 
26
- #, python-format
27
- msgid "Unable to write config file %s."
28
- msgstr "Неможливо записати конфігураційний файл %s."
26
+ msgid "disable thread usage"
27
+ msgstr ""
29
28
 
30
29
  #, python-format
31
30
  msgid "Unable to set locale %s"
@@ -62,12 +61,6 @@ msgstr "Гаразд"
62
61
  msgid "Your selection:"
63
62
  msgstr "Ваш вибір:"
64
63
 
65
- msgid "Select"
66
- msgstr "Вибрати"
67
-
68
- msgid "Save"
69
- msgstr "Зберегти"
70
-
71
64
  msgid "Save As..."
72
65
  msgstr "Зберегти як..."
73
66
 
@@ -199,6 +192,10 @@ msgstr "Шаблон"
199
192
  msgid "Edit..."
200
193
  msgstr "Редагувати..."
201
194
 
195
+ #, fuzzy
196
+ msgid "View Logs..."
197
+ msgstr "Перегляд _журналів..."
198
+
202
199
  msgid "Attachments..."
203
200
  msgstr "Вкладення..."
204
201
 
@@ -595,6 +592,9 @@ msgstr "Вибрати файл"
595
592
  msgid "Remove File"
596
593
  msgstr "Видалити файл"
597
594
 
595
+ msgid "Select"
596
+ msgstr "Вибрати"
597
+
598
598
  msgid "Add..."
599
599
  msgstr "Додати..."
600
600
 
@@ -618,24 +618,6 @@ msgstr "Примітка (%d/%d)"
618
618
  msgid "You have to select one record."
619
619
  msgstr "Ви повинні вибрати один запис."
620
620
 
621
- msgid "ID:"
622
- msgstr "ID:"
623
-
624
- msgid "Created by:"
625
- msgstr "Ким створено:"
626
-
627
- msgid "Created at:"
628
- msgstr "Коли створено:"
629
-
630
- msgid "Edited by:"
631
- msgstr "Ким змінено:"
632
-
633
- msgid "Edited at:"
634
- msgstr "Коли змінено:"
635
-
636
- msgid "Model:"
637
- msgstr "Модель:"
638
-
639
621
  msgid "Are you sure to remove this record?"
640
622
  msgstr "Ви впевнені, що бажаєте видалити цей запис?"
641
623
 
@@ -700,6 +682,28 @@ msgstr "Налаштування обмеження пошуку"
700
682
  msgid "Limit:"
701
683
  msgstr "Кількість записів:"
702
684
 
685
+ #, python-format
686
+ msgid "Logs (%s)"
687
+ msgstr "колоди (%s)"
688
+
689
+ msgid "Model:"
690
+ msgstr "Модель:"
691
+
692
+ msgid "ID:"
693
+ msgstr "ID:"
694
+
695
+ msgid "Created by:"
696
+ msgstr "Ким створено:"
697
+
698
+ msgid "Created at:"
699
+ msgstr "Коли створено:"
700
+
701
+ msgid "Last Modified by:"
702
+ msgstr ""
703
+
704
+ msgid "Last Modified at:"
705
+ msgstr ""
706
+
703
707
  #, python-format
704
708
  msgid "Notes (%s)"
705
709
  msgstr "Примітки (%s)"
@@ -867,6 +871,9 @@ msgstr "Ім'я"
867
871
  msgid "Open"
868
872
  msgstr "Відкрити"
869
873
 
874
+ msgid "Save"
875
+ msgstr "Зберегти"
876
+
870
877
  msgid "Listed Records"
871
878
  msgstr "Записи списку"
872
879
 
@@ -1088,18 +1095,16 @@ msgstr "попередній рік"
1088
1095
  msgid "next year"
1089
1096
  msgstr "наступний рік"
1090
1097
 
1091
- msgid "Day View"
1092
- msgstr "Вид дня"
1093
-
1094
- msgid "Week View"
1095
- msgstr "Вид тижня"
1096
-
1097
- msgid "Month View"
1098
- msgstr "Вид місяця"
1098
+ msgid "Day"
1099
+ msgstr ""
1099
1100
 
1100
1101
  msgid "Week"
1101
1102
  msgstr "Тиждень"
1102
1103
 
1104
+ #, fuzzy
1105
+ msgid "Month"
1106
+ msgstr "Вид місяця"
1107
+
1103
1108
  msgid "Select..."
1104
1109
  msgstr "Вибрати..."
1105
1110
 
@@ -1165,5 +1170,8 @@ msgstr "Треба зберегти запис перед додаванням
1165
1170
  msgid "No other language available."
1166
1171
  msgstr "Немає іншої мови."
1167
1172
 
1173
+ msgid "#ERROR"
1174
+ msgstr ""
1175
+
1168
1176
  msgid "Translate view"
1169
1177
  msgstr "Переклад вкладки"
@@ -26,9 +26,8 @@ msgstr "设置登录用户"
26
26
  msgid "specify the server hostname:port"
27
27
  msgstr "设置服务器主机名:端口号"
28
28
 
29
- #, python-format
30
- msgid "Unable to write config file %s."
31
- msgstr "无法写入配置文件 %s."
29
+ msgid "disable thread usage"
30
+ msgstr ""
32
31
 
33
32
  #, python-format
34
33
  msgid "Unable to set locale %s"
@@ -65,12 +64,6 @@ msgstr "确定"
65
64
  msgid "Your selection:"
66
65
  msgstr "已选择:"
67
66
 
68
- msgid "Select"
69
- msgstr "选择"
70
-
71
- msgid "Save"
72
- msgstr "保存"
73
-
74
67
  msgid "Save As..."
75
68
  msgstr "另存为..."
76
69
 
@@ -202,6 +195,10 @@ msgstr "模板"
202
195
  msgid "Edit..."
203
196
  msgstr "编辑..."
204
197
 
198
+ #, fuzzy
199
+ msgid "View Logs..."
200
+ msgstr "日志(_V)..."
201
+
205
202
  msgid "Attachments..."
206
203
  msgstr "附件..."
207
204
 
@@ -598,6 +595,9 @@ msgstr "全选"
598
595
  msgid "Remove File"
599
596
  msgstr "删除 <Del>"
600
597
 
598
+ msgid "Select"
599
+ msgstr "选择"
600
+
601
601
  msgid "Add..."
602
602
  msgstr "添加..."
603
603
 
@@ -622,24 +622,6 @@ msgstr "批注 (%d/%d)"
622
622
  msgid "You have to select one record."
623
623
  msgstr "需要选择一条记录."
624
624
 
625
- msgid "ID:"
626
- msgstr "标识:"
627
-
628
- msgid "Created by:"
629
- msgstr "创建者:"
630
-
631
- msgid "Created at:"
632
- msgstr "创建日期:"
633
-
634
- msgid "Edited by:"
635
- msgstr "编辑者:"
636
-
637
- msgid "Edited at:"
638
- msgstr "编辑于:"
639
-
640
- msgid "Model:"
641
- msgstr "模型:"
642
-
643
625
  msgid "Are you sure to remove this record?"
644
626
  msgstr "确定要删除这条记录吗?"
645
627
 
@@ -704,6 +686,30 @@ msgstr "设置查询限制"
704
686
  msgid "Limit:"
705
687
  msgstr "限制:"
706
688
 
689
+ #, python-format
690
+ msgid "Logs (%s)"
691
+ msgstr "日志(%s)"
692
+
693
+ msgid "Model:"
694
+ msgstr "模型:"
695
+
696
+ msgid "ID:"
697
+ msgstr "标识:"
698
+
699
+ msgid "Created by:"
700
+ msgstr "创建者:"
701
+
702
+ msgid "Created at:"
703
+ msgstr "创建日期:"
704
+
705
+ #, fuzzy
706
+ msgid "Last Modified by:"
707
+ msgstr "最近更改:"
708
+
709
+ #, fuzzy
710
+ msgid "Last Modified at:"
711
+ msgstr "最近更改日期:"
712
+
707
713
  #, python-format
708
714
  msgid "Notes (%s)"
709
715
  msgstr "注释(%s)"
@@ -871,6 +877,9 @@ msgstr "名称"
871
877
  msgid "Open"
872
878
  msgstr "打开"
873
879
 
880
+ msgid "Save"
881
+ msgstr "保存"
882
+
874
883
  msgid "Listed Records"
875
884
  msgstr "已列出记录"
876
885
 
@@ -1093,18 +1102,16 @@ msgstr "上一年度"
1093
1102
  msgid "next year"
1094
1103
  msgstr "下一年度"
1095
1104
 
1096
- msgid "Day View"
1097
- msgstr "日视图"
1098
-
1099
- msgid "Week View"
1100
- msgstr "周视图"
1101
-
1102
- msgid "Month View"
1103
- msgstr "月视图"
1105
+ msgid "Day"
1106
+ msgstr ""
1104
1107
 
1105
1108
  msgid "Week"
1106
1109
  msgstr "周"
1107
1110
 
1111
+ #, fuzzy
1112
+ msgid "Month"
1113
+ msgstr "月视图"
1114
+
1108
1115
  msgid "Select..."
1109
1116
  msgstr "选择..."
1110
1117
 
@@ -1170,5 +1177,8 @@ msgstr "请先保存已翻译条目,然后再增加新翻译 ."
1170
1177
  msgid "No other language available."
1171
1178
  msgstr "没有其他可翻译语言."
1172
1179
 
1180
+ msgid "#ERROR"
1181
+ msgstr ""
1182
+
1173
1183
  msgid "Translate view"
1174
1184
  msgstr "翻译视图"
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" version="1.0"><path d="M256 196.25c0 40.122-21.534 60.038-64.603 59.747H67.495C22.498 255.997 0 236.663 0 197.994V60.184C0 20.06 22.016 0 66.049 0h124.384C234.144 0 256 20.206 256 60.62v135.63" style="text-align:start;line-height:125%;-inkscape-font-specification:Kimberley" font-size="108.872" font-weight="400" fill="#1b2019" font-family="Kimberley"/><path d="M19.006 169.515c5.949-3.124 17.076 1.966 22.115 10.12 4.518 7.31 27.406 14.114 35.516 10.558 5.412-2.372 6.779-5.378 7.202-15.844.798-19.685-3.636-35.098-17.99-62.536-7.205-13.77-14.753-29-16.775-33.835C47.052 73.14 41.601 64.6 36.961 59c-9.876-11.91-10.183-15.164-2.078-22.074C47.02 26.581 67.52 43.327 63.095 59.97c-2.178 8.191 2.003 20.14 15.85 45.295 16.431 29.85 33.084 41.94 43.03 31.243 2.57-2.763 5.759-18.178 8.698-42.04 4.421-35.889 4.399-38.037-.47-45.252-8.418-12.475-.48-25.42 12.84-20.943 13.43 4.513 22.192 22.778 13.775 28.714-3.735 2.633-4.942 10.29-6.636 42.097-2.173 40.785-.53 51.7 8.609 57.187 8.121 4.876 10.946 3.885 28.067-9.889 18.167-14.612 25.636-24.069 26.115-33.067.446-8.37 5.992-12.847 14.832-11.972 5.635.56 8.15 2.41 11.3 8.312 6.431 12.053 4.589 19.71-5.212 21.667-7.987 1.592-21.708 19.27-42.815 55.16-22.288 37.897-27.173 41.845-52.152 42.147-10.268.123-24.634-3.295-58.453-13.914-24.663-7.746-48.043-14.468-51.957-14.943-14.142-1.708-21.187-24.12-9.51-30.257z" fill="#ededed"/></svg>
tryton/gui/main.py CHANGED
@@ -9,6 +9,7 @@ import sys
9
9
  import threading
10
10
  import traceback
11
11
  import webbrowser
12
+ from functools import partial
12
13
  from urllib.parse import parse_qsl, unquote, urlparse
13
14
 
14
15
  from gi.repository import Gdk, GdkPixbuf, Gio, GLib, Gtk
@@ -125,7 +126,7 @@ class Main(Gtk.Application):
125
126
  return
126
127
 
127
128
  self.window = Gtk.ApplicationWindow(application=self, title="Tryton")
128
- self.window.set_default_size(960, 720)
129
+ self.window.set_default_size(1280, 960)
129
130
  self.window.maximize()
130
131
  self.window.set_position(Gtk.WindowPosition.CENTER)
131
132
  self.window.set_resizable(True)
@@ -175,9 +176,10 @@ class Main(Gtk.Application):
175
176
  Gtk.AccelMap.add_entry(
176
177
  '<tryton>/Form/Delete', Gdk.KEY_D, Gdk.ModifierType.CONTROL_MASK)
177
178
  Gtk.AccelMap.add_entry(
178
- '<tryton>/Form/Next', Gdk.KEY_Page_Down, 0)
179
+ '<tryton>/Form/Next', Gdk.KEY_Down, Gdk.ModifierType.CONTROL_MASK)
179
180
  Gtk.AccelMap.add_entry(
180
- '<tryton>/Form/Previous', Gdk.KEY_Page_Up, 0)
181
+ '<tryton>/Form/Previous',
182
+ Gdk.KEY_Up, Gdk.ModifierType.CONTROL_MASK)
181
183
  Gtk.AccelMap.add_entry(
182
184
  '<tryton>/Form/Switch View', Gdk.KEY_L,
183
185
  Gdk.ModifierType.CONTROL_MASK)
@@ -521,19 +523,25 @@ class Main(Gtk.Application):
521
523
  except RPCException:
522
524
  prefs = {}
523
525
 
524
- threads = []
525
- for target in (
526
- common.IconFactory.load_icons,
527
- common.MODELACCESS.load_models,
528
- common.MODELHISTORY.load_history,
529
- common.MODELNOTIFICATION.load_names,
530
- common.VIEW_SEARCH.load_searches,
531
- ):
532
- t = threading.Thread(target=target)
533
- threads.append(t)
534
- t.start()
535
- for t in threads:
536
- t.join()
526
+ targets = [
527
+ common.IconFactory.load_icons,
528
+ common.MODELACCESS.load_models,
529
+ common.MODELHISTORY.load_history,
530
+ common.MODELNOTIFICATION.load_names,
531
+ common.VIEW_SEARCH.load_searches,
532
+ ]
533
+ if CONFIG['thread']:
534
+ threads = []
535
+ for target in targets:
536
+ t = threading.Thread(target=target)
537
+ threads.append(t)
538
+ t.start()
539
+ for t in threads:
540
+ t.join()
541
+ else:
542
+ for target in targets:
543
+ target()
544
+
537
545
  if prefs and 'language_direction' in prefs:
538
546
  translate.set_language_direction(prefs['language_direction'])
539
547
  CONFIG['client.language_direction'] = \
@@ -953,6 +961,7 @@ class Main(Gtk.Application):
953
961
  dialog.show()
954
962
 
955
963
  def _open_url(self, url):
964
+ loads = partial(json.loads, object_hook=object_hook)
956
965
  urlp = urlparse(url)
957
966
  if not urlp.scheme == 'tryton':
958
967
  return
@@ -975,88 +984,72 @@ class Main(Gtk.Application):
975
984
  model, path = (path.split('/', 1) + [''])[:2]
976
985
  if not model:
977
986
  return
978
- res_id = None
979
- mode = None
987
+ attributes = {}
980
988
  try:
981
- view_ids = json.loads(params.get('views', '[]'))
989
+ attributes['view_ids'] = loads(params.get('views', '[]'))
982
990
  if 'limit' in params:
983
- attributes['limit'] = json.loads(
984
- params.get('limit', 'null'))
985
- name = json.loads(params.get('name', '""'))
986
- search_value = json.loads(params.get('search_value', '[]'),
987
- object_hook=object_hook)
988
- domain = json.loads(params.get('domain', '[]'),
989
- object_hook=object_hook)
990
- context = json.loads(params.get('context', '{}'),
991
- object_hook=object_hook)
992
- context_model = params.get('context_model')
993
- tab_domain = json.loads(params.get('tab_domain', '[]'),
994
- object_hook=object_hook)
991
+ attributes['limit'] = loads(params.get('limit', 'null'))
992
+ attributes['name'] = loads(params.get('name', '""'))
993
+ attributes['search_value'] = loads(
994
+ params.get('search_value', '[]'))
995
+ attributes['domain'] = loads(params.get('domain', '[]'))
996
+ attributes['context'] = loads(params.get('context', '{}'))
997
+ attributes['context_model'] = params.get('context_model')
998
+ attributes['tab_domain'] = loads(
999
+ params.get('tab_domain', '[]'))
995
1000
  except ValueError:
996
1001
  return
997
1002
  if path:
998
1003
  try:
999
- res_id = int(path)
1004
+ attributes['res_id'] = int(path)
1000
1005
  except ValueError:
1001
1006
  return
1002
- mode = ['form', 'tree']
1007
+ attributes['mode'] = ['form', 'tree']
1003
1008
  try:
1004
- Window.create(model,
1005
- view_ids=view_ids,
1006
- res_id=res_id,
1007
- domain=domain,
1008
- context=context,
1009
- context_model=context_model,
1010
- mode=mode,
1011
- name=name,
1012
- search_value=search_value,
1013
- tab_domain=tab_domain,
1014
- **attributes)
1009
+ Window.create(model, **attributes)
1015
1010
  except Exception:
1016
1011
  # Prevent crashing the client
1017
1012
  return
1018
1013
 
1019
1014
  def open_wizard(wizard):
1015
+ attributes = {}
1020
1016
  if not wizard:
1021
1017
  return
1022
1018
  try:
1023
- data = json.loads(params.get('data', '{}'),
1024
- object_hook=object_hook)
1025
- direct_print = json.loads(params.get('direct_print', 'false'))
1026
- name = json.loads(params.get('name', '""'))
1027
- window = json.loads(params.get('window', 'false'))
1028
- context = json.loads(params.get('context', '{}'),
1029
- object_hook=object_hook)
1019
+ attributes['data'] = loads(params.get('data', '{}'))
1020
+ attributes['direct_print'] = loads(
1021
+ params.get('direct_print', 'false'))
1022
+ attributes['name'] = loads(params.get('name', '""'))
1023
+ attributes['window'] = loads(params.get('window', 'false'))
1024
+ attributes['context'] = loads(params.get('context', '{}'))
1030
1025
  except ValueError:
1031
1026
  return
1032
1027
  try:
1033
- Window.create_wizard(
1034
- wizard, data, direct_print=direct_print, name=name,
1035
- context=context, window=window)
1028
+ Window.create_wizard(wizard, **attributes)
1036
1029
  except Exception:
1037
1030
  # Prevent crashing the client
1038
1031
  return
1039
1032
 
1040
1033
  def open_report(report):
1034
+ attributes = {}
1041
1035
  if not report:
1042
1036
  return
1043
1037
  try:
1044
- data = json.loads(params.get('data'), object_hook=object_hook)
1045
- direct_print = json.loads(params.get('direct_print', 'false'))
1046
- context = json.loads(params.get('context', '{}'),
1047
- object_hook=object_hook)
1038
+ attributes['data'] = loads(params.get('data', '{}'))
1039
+ attributes['direct_print'] = loads(
1040
+ params.get('direct_print', 'false'))
1041
+ attributes['context'] = loads(params.get('context', '{}'))
1048
1042
  except ValueError:
1049
1043
  return
1050
1044
  try:
1051
- Action.exec_report(
1052
- report, data, direct_print=direct_print, context=context)
1045
+ Action.exec_report(report, **attributes)
1053
1046
  except Exception:
1054
1047
  # Prevent crashing the client
1055
1048
  return
1056
1049
 
1057
1050
  def open_url():
1058
1051
  try:
1059
- url = json.loads(params.get('url', 'false'))
1052
+ url = loads(params.get('url', 'false'))
1060
1053
  except ValueError:
1061
1054
  return
1062
1055
  if url:
@@ -5,6 +5,8 @@ import configparser
5
5
  import gettext
6
6
  import logging
7
7
  import os
8
+ import shutil
9
+ import tempfile
8
10
  import threading
9
11
 
10
12
  from gi.repository import GLib, GObject, Gtk
@@ -284,9 +286,13 @@ class DBListEditor(object):
284
286
 
285
287
  def refresh_databases(self, host, port):
286
288
  self.dbs_updated = threading.Event()
287
- threading.Thread(target=self.refresh_databases_start,
288
- args=(host, port)).start()
289
- GLib.timeout_add(100, self.refresh_databases_end, host, port)
289
+ if CONFIG['thread']:
290
+ threading.Thread(target=self.refresh_databases_start,
291
+ args=(host, port)).start()
292
+ GLib.timeout_add(100, self.refresh_databases_end, host, port)
293
+ else:
294
+ self.refresh_databases_start(host, port)
295
+ self.refresh_databases_end(host, port)
290
296
 
291
297
  def refresh_databases_start(self, host, port):
292
298
  dbs = None
@@ -482,20 +488,31 @@ class DBLogin(object):
482
488
  grid.attach(label_username, 0, 5, 1, 1)
483
489
 
484
490
  # Profile information
485
- self.profile_cfg = os.path.join(get_config_dir(), 'profiles.cfg')
491
+ config_dir = get_config_dir()
492
+ self.profile_cfg = os.path.join(config_dir, 'profiles.cfg')
486
493
  self.profiles = configparser.ConfigParser()
487
- if not os.path.exists(self.profile_cfg):
494
+ try:
495
+ self.profiles.read(self.profile_cfg)
496
+ except configparser.Error:
497
+ # reset self.profiles as parsing errors may leave wrong data in
498
+ # the parser
499
+ self.profiles = configparser.ConfigParser()
500
+ with tempfile.NamedTemporaryFile(
501
+ delete=False, prefix='profiles_', suffix='.cfg',
502
+ dir=config_dir) as temp_file:
503
+ temp_name = temp_file.name
504
+ shutil.copy(self.profile_cfg, temp_name)
505
+ logger.error(
506
+ f"Failed to parse {self.profiles_cfg}. "
507
+ f"A backup can be found at {temp_name}",
508
+ exc_info=True)
509
+ if not self.profiles.sections():
488
510
  short_version = '.'.join(__version__.split('.', 2)[:2])
489
511
  name = 'demo%s.tryton.org' % short_version
490
512
  self.profiles.add_section(name)
491
513
  self.profiles.set(name, 'host', name)
492
514
  self.profiles.set(name, 'database', 'demo%s' % short_version)
493
515
  self.profiles.set(name, 'username', 'demo')
494
- else:
495
- try:
496
- self.profiles.read(self.profile_cfg)
497
- except configparser.ParsingError:
498
- logger.error("Fail to parse profiles.cfg", exc_info=True)
499
516
  for section in self.profiles.sections():
500
517
  active = all(self.profiles.has_option(section, option)
501
518
  for option in ('host', 'database'))