pyqttoolkit 0.9.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.
Files changed (133) hide show
  1. pyqttoolkit/__init__.py +20 -0
  2. pyqttoolkit/_version.py +21 -0
  3. pyqttoolkit/application/__init__.py +18 -0
  4. pyqttoolkit/application/application.py +86 -0
  5. pyqttoolkit/application/garbage_collector.py +65 -0
  6. pyqttoolkit/colors/__init__.py +84 -0
  7. pyqttoolkit/config/__init__.py +20 -0
  8. pyqttoolkit/config/base.py +22 -0
  9. pyqttoolkit/config/composite.py +31 -0
  10. pyqttoolkit/config/default.py +27 -0
  11. pyqttoolkit/config/environment.py +35 -0
  12. pyqttoolkit/config/multi_json_file.py +93 -0
  13. pyqttoolkit/config/with_signal.py +30 -0
  14. pyqttoolkit/config/with_value_changed.py +31 -0
  15. pyqttoolkit/data/__init__.py +21 -0
  16. pyqttoolkit/data/bits.py +23 -0
  17. pyqttoolkit/data/cache.py +64 -0
  18. pyqttoolkit/data/interval.py +26 -0
  19. pyqttoolkit/data/message.py +29 -0
  20. pyqttoolkit/data/names.py +24 -0
  21. pyqttoolkit/datetime/__init__.py +16 -0
  22. pyqttoolkit/datetime/datetime.py +51 -0
  23. pyqttoolkit/datetime/qdatetime.py +53 -0
  24. pyqttoolkit/dependencies/__init__.py +56 -0
  25. pyqttoolkit/errors/__init__.py +19 -0
  26. pyqttoolkit/exceptions/__init__.py +18 -0
  27. pyqttoolkit/filesystem/__init__.py +24 -0
  28. pyqttoolkit/logs/__init__.py +140 -0
  29. pyqttoolkit/metadata/__init__.py +23 -0
  30. pyqttoolkit/metadata/dataframe_metadata_manager.py +105 -0
  31. pyqttoolkit/metadata/dict_metadata_manager.py +63 -0
  32. pyqttoolkit/metadata/id_generator.py +20 -0
  33. pyqttoolkit/metadata/metadata_manager_base.py +54 -0
  34. pyqttoolkit/models/__init__.py +26 -0
  35. pyqttoolkit/models/code_text.py +43 -0
  36. pyqttoolkit/models/dataframetable.py +135 -0
  37. pyqttoolkit/models/dictpropertytree.py +155 -0
  38. pyqttoolkit/models/dicttable.py +140 -0
  39. pyqttoolkit/models/json_text.py +52 -0
  40. pyqttoolkit/models/list_model.py +52 -0
  41. pyqttoolkit/models/module.py +26 -0
  42. pyqttoolkit/models/roles.py +23 -0
  43. pyqttoolkit/models/series_data.py +68 -0
  44. pyqttoolkit/models/span.py +36 -0
  45. pyqttoolkit/models/validation.py +27 -0
  46. pyqttoolkit/modules/__init__.py +18 -0
  47. pyqttoolkit/modules/events/__init__.py +19 -0
  48. pyqttoolkit/modules/events/add_signal.py +31 -0
  49. pyqttoolkit/modules/events/module_opening.py +21 -0
  50. pyqttoolkit/modules/events/rejectable.py +29 -0
  51. pyqttoolkit/modules/launcher_config.py +55 -0
  52. pyqttoolkit/modules/module.py +111 -0
  53. pyqttoolkit/properties/__init__.py +18 -0
  54. pyqttoolkit/properties/auto.py +221 -0
  55. pyqttoolkit/properties/throttled.py +77 -0
  56. pyqttoolkit/scripting/__init__.py +19 -0
  57. pyqttoolkit/scripting/script_context.py +36 -0
  58. pyqttoolkit/scripting/script_runner.py +132 -0
  59. pyqttoolkit/scripting/script_template.py +42 -0
  60. pyqttoolkit/services/__init__.py +32 -0
  61. pyqttoolkit/services/autosave.py +41 -0
  62. pyqttoolkit/services/email.py +25 -0
  63. pyqttoolkit/services/event_registry.py +52 -0
  64. pyqttoolkit/services/file_dialog.py +71 -0
  65. pyqttoolkit/services/hotkey_manager.py +137 -0
  66. pyqttoolkit/services/link_manager.py +135 -0
  67. pyqttoolkit/services/message_board.py +90 -0
  68. pyqttoolkit/services/module_service.py +154 -0
  69. pyqttoolkit/services/object_converter.py +45 -0
  70. pyqttoolkit/services/project_updater.py +149 -0
  71. pyqttoolkit/services/task_runner.py +281 -0
  72. pyqttoolkit/services/theme_manager.py +46 -0
  73. pyqttoolkit/services/tool_window_service.py +46 -0
  74. pyqttoolkit/viewmanagers/__init__.py +17 -0
  75. pyqttoolkit/viewmanagers/tool.py +23 -0
  76. pyqttoolkit/views/__init__.py +50 -0
  77. pyqttoolkit/views/bulk_value_selector.py +112 -0
  78. pyqttoolkit/views/check_box.py +36 -0
  79. pyqttoolkit/views/code/__init__.py +18 -0
  80. pyqttoolkit/views/code/code_edit.py +268 -0
  81. pyqttoolkit/views/code/python_syntax.py +226 -0
  82. pyqttoolkit/views/combo_box.py +101 -0
  83. pyqttoolkit/views/count_selector.py +59 -0
  84. pyqttoolkit/views/datetime.py +111 -0
  85. pyqttoolkit/views/datetime_range_selector.py +231 -0
  86. pyqttoolkit/views/default_text_line_edit.py +50 -0
  87. pyqttoolkit/views/delegates.py +117 -0
  88. pyqttoolkit/views/dtype_edit.py +117 -0
  89. pyqttoolkit/views/editable_combo_box.py +45 -0
  90. pyqttoolkit/views/file_selector.py +51 -0
  91. pyqttoolkit/views/icon.py +67 -0
  92. pyqttoolkit/views/icon_button.py +129 -0
  93. pyqttoolkit/views/json_edit.py +21 -0
  94. pyqttoolkit/views/labelled.py +29 -0
  95. pyqttoolkit/views/layout/__init__.py +21 -0
  96. pyqttoolkit/views/layout/collabsible.py +59 -0
  97. pyqttoolkit/views/layout/group_box.py +48 -0
  98. pyqttoolkit/views/layout/group_panel.py +188 -0
  99. pyqttoolkit/views/layout/lines.py +30 -0
  100. pyqttoolkit/views/layout/link.py +38 -0
  101. pyqttoolkit/views/line_edit.py +61 -0
  102. pyqttoolkit/views/linkable.py +49 -0
  103. pyqttoolkit/views/list_view.py +43 -0
  104. pyqttoolkit/views/main_window.py +91 -0
  105. pyqttoolkit/views/metadata_selector.py +84 -0
  106. pyqttoolkit/views/modulewindow.py +81 -0
  107. pyqttoolkit/views/plot/__init__.py +26 -0
  108. pyqttoolkit/views/plot/legend_control.py +121 -0
  109. pyqttoolkit/views/plot/matplotlib/__init__.py +23 -0
  110. pyqttoolkit/views/plot/matplotlib/base.py +1056 -0
  111. pyqttoolkit/views/plot/matplotlib/colorbar.py +75 -0
  112. pyqttoolkit/views/plot/matplotlib/colormap.py +48 -0
  113. pyqttoolkit/views/plot/matplotlib/font.py +55 -0
  114. pyqttoolkit/views/plot/plot_options.py +211 -0
  115. pyqttoolkit/views/plot/plot_toolbar_options.py +133 -0
  116. pyqttoolkit/views/plot/size.py +41 -0
  117. pyqttoolkit/views/plot/tool_type.py +26 -0
  118. pyqttoolkit/views/plot/toolbar.py +100 -0
  119. pyqttoolkit/views/popout.py +41 -0
  120. pyqttoolkit/views/popup.py +41 -0
  121. pyqttoolkit/views/property_tree.py +26 -0
  122. pyqttoolkit/views/shrunk_push_button.py +34 -0
  123. pyqttoolkit/views/steppable_combo_box.py +67 -0
  124. pyqttoolkit/views/styleable.py +37 -0
  125. pyqttoolkit/views/table.py +146 -0
  126. pyqttoolkit/views/text_edit.py +31 -0
  127. pyqttoolkit/views/tool_window.py +35 -0
  128. pyqttoolkit-0.9.1.dist-info/METADATA +69 -0
  129. pyqttoolkit-0.9.1.dist-info/RECORD +133 -0
  130. pyqttoolkit-0.9.1.dist-info/WHEEL +5 -0
  131. pyqttoolkit-0.9.1.dist-info/licenses/LICENSE.txt +674 -0
  132. pyqttoolkit-0.9.1.dist-info/licenses/LICENSE_SHORT +16 -0
  133. pyqttoolkit-0.9.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,52 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import Qt, QAbstractListModel, QStringListModel
18
+
19
+ from pyqttoolkit.models.roles import DataRole
20
+
21
+ class ListModel(QAbstractListModel):
22
+ def __init__(self, parent, items, display_name_map=None):
23
+ QAbstractListModel.__init__(self, parent)
24
+ self._items = items
25
+ self._display_name_map = display_name_map or {}
26
+
27
+ def rowCount(self, _parent=None):
28
+ return len(self._items)
29
+
30
+ def data(self, index, role=Qt.DisplayRole):
31
+ if role in [Qt.DisplayRole, DataRole]:
32
+ item = self._items[index.row()]
33
+ return (self._display_name_map.get(item) or item.name) if role == Qt.DisplayRole else item
34
+ return None
35
+
36
+ @property
37
+ def items(self):
38
+ return self._items
39
+
40
+ class StringListModel(QStringListModel):
41
+ def __init__(self, values):
42
+ QStringListModel.__init__(self, values)
43
+
44
+ def data(self, index, role):
45
+ return QStringListModel.data(self, index, Qt.DisplayRole if role == DataRole else role)
46
+
47
+ class ToolTipStringListModel(StringListModel):
48
+ def __init__(self, values):
49
+ StringListModel.__init__(self, values)
50
+
51
+ def data(self, index, role):
52
+ return QStringListModel.data(self, index, Qt.DisplayRole if role == Qt.ToolTipRole else role)
@@ -0,0 +1,26 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject
18
+ #pylint: enable=no-name-in-module
19
+
20
+ class ModuleModel(QObject):
21
+ def __init__(self, parent):
22
+ QObject.__init__(self, parent)
23
+
24
+ def handle_view_closed(self, garbage_collector, view):
25
+ self.deleteLater()
26
+ garbage_collector.check()
@@ -0,0 +1,23 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ DataRole = 0x0100
18
+ UserDataRole = 0x0101
19
+ ValidationRole = 0x0102
20
+ ItemTypeRole = 0x0103
21
+ EditorAuxDataRole = 0x0104
22
+ RowSpanRole = 0x0110
23
+ ColumnSpanRole = 0x0111
@@ -0,0 +1,68 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ """:mod:`series_data`
18
+ Defines the SeriesDataModel
19
+ """
20
+
21
+ #pylint: disable=no-name-in-module
22
+ from PyQt5.QtCore import QObject
23
+ #pylint: enable=no-name-in-module
24
+
25
+ class SeriesDataModel(QObject):
26
+ """class::SeriesDataModel
27
+ Wraps a series to be displayed
28
+ """
29
+ #pylint: disable=too-many-arguments
30
+ def __init__(
31
+ self, parent,
32
+ x_axis_title, y_axis_title,
33
+ x_axis_extent, y_axis_extent,
34
+ zoom_flag, empty
35
+ ):
36
+ QObject.__init__(self, parent)
37
+
38
+ self._x_axis_title = x_axis_title
39
+ self._y_axis_title = y_axis_title
40
+ self._x_axis_extent = x_axis_extent
41
+ self._y_axis_extent = y_axis_extent
42
+ self._zoom_flag = zoom_flag
43
+ self._empty = empty
44
+
45
+ def get_xy_extents(self):
46
+ return self._x_axis_extent, self._y_axis_extent
47
+
48
+ @property
49
+ def is_empty(self):
50
+ return self._empty
51
+
52
+ @property
53
+ def zoom_flag(self):
54
+ return self._zoom_flag
55
+
56
+ @property
57
+ def xAxisTitle(self):
58
+ """function::xAxisTitle(self)
59
+ Property accessor for xAxisTitle
60
+ """
61
+ return self._x_axis_title
62
+
63
+ @property
64
+ def yAxisTitle(self):
65
+ """function::yAxisTitle(self)
66
+ Property accessor for yAxisTitle
67
+ """
68
+ return self._y_axis_title
@@ -0,0 +1,36 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject
18
+
19
+ class SpanModel(QObject):
20
+ def __init__(self, parent, left, right, radians=False):
21
+ QObject.__init__(self, parent)
22
+ self._left = left
23
+ self._right = right
24
+ self._radians = radians
25
+
26
+ @property
27
+ def left(self):
28
+ return self._left
29
+
30
+ @property
31
+ def right(self):
32
+ return self._right
33
+
34
+ @property
35
+ def radians(self):
36
+ return self._radians
@@ -0,0 +1,27 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject
18
+ #pylint: enable=no-name-in-module
19
+
20
+ class ValidationModel(QObject):
21
+ def __init__(self, parent, error):
22
+ QObject.__init__(self, parent)
23
+ self._error = error
24
+
25
+ @property
26
+ def error(self):
27
+ return self._error
@@ -0,0 +1,18 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from .module import Module, CompositeModule, CommandModule
18
+ from .launcher_config import LauncherConfig
@@ -0,0 +1,19 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from .rejectable import RejectableEvent
18
+ from .module_opening import ModuleOpeningEvent
19
+ from .add_signal import AddSignalEvent
@@ -0,0 +1,31 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from .rejectable import RejectableEvent
18
+
19
+ class AddSignalEvent(RejectableEvent):
20
+ def __init__(self, signal_id, signal_type):
21
+ RejectableEvent.__init__(self)
22
+ self._signal_id = signal_id
23
+ self._signal_type = signal_type
24
+
25
+ @property
26
+ def signal_id(self):
27
+ return self._signal_id
28
+
29
+ @property
30
+ def signal_type(self):
31
+ return self._signal_type
@@ -0,0 +1,21 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from .rejectable import RejectableEvent
18
+
19
+ class ModuleOpeningEvent(RejectableEvent):
20
+ def __init__(self):
21
+ RejectableEvent.__init__(self)
@@ -0,0 +1,29 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject
18
+
19
+ class RejectableEvent(QObject):
20
+ def __init__(self):
21
+ QObject.__init__(self)
22
+ self._accepted = True
23
+
24
+ @property
25
+ def accepted(self):
26
+ return self._accepted
27
+
28
+ def reject(self):
29
+ self._accepted = False
@@ -0,0 +1,55 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject, pyqtSignal
18
+
19
+ from pyqttoolkit.properties import AutoProperty
20
+
21
+ class LauncherConfig(QObject):
22
+ def __init__(self):
23
+ QObject.__init__(self)
24
+ self.enabled = False
25
+ self.checked = False
26
+
27
+ enabledChanged = pyqtSignal(bool)
28
+ checkedChanged = pyqtSignal(bool)
29
+
30
+ enabled = AutoProperty(bool)
31
+ checked = AutoProperty(bool)
32
+
33
+ @property
34
+ def buttonTitle(self):
35
+ return None
36
+
37
+ @property
38
+ def menuTitle(self):
39
+ return None
40
+
41
+ @property
42
+ def buttonIcon(self):
43
+ return None
44
+
45
+ @property
46
+ def menu(self):
47
+ return None
48
+
49
+ @property
50
+ def order(self):
51
+ return 0
52
+
53
+ @property
54
+ def alwaysEnabled(self):
55
+ return False
@@ -0,0 +1,111 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from PyQt5.QtCore import QObject, pyqtSignal
18
+
19
+ from .events import ModuleOpeningEvent
20
+
21
+ class ModuleBase(QObject):
22
+ def __init__(self, id_, launcher_config=None):
23
+ QObject.__init__(self)
24
+ self._id = id_
25
+ self._launcher_config = launcher_config
26
+ if self._launcher_config:
27
+ self._launcher_config.setParent(self)
28
+
29
+ opening = pyqtSignal(ModuleOpeningEvent)
30
+ opened = pyqtSignal()
31
+
32
+ @property
33
+ def id(self):
34
+ return self._id
35
+
36
+ @property
37
+ def title(self):
38
+ return self._id
39
+
40
+ @property
41
+ def launcher_config(self):
42
+ return self._launcher_config
43
+
44
+ @property
45
+ def enabled(self):
46
+ return True
47
+
48
+ @property
49
+ def is_root(self):
50
+ return False
51
+
52
+ def register(self, dependency_container):
53
+ if self.enabled:
54
+ self.register_dependencies(dependency_container)
55
+ self.register_module(dependency_container.get_instance('module_service'))
56
+ self.register_events(dependency_container.get_instance('event_registry'))
57
+ self.register_converters(dependency_container.get_instance('object_converter'))
58
+ self.register_metadata(dependency_container.get_instance('metadata_manager'))
59
+
60
+ def register_module(self, module_service):
61
+ module_service.register(self)
62
+
63
+ def register_dependencies(self, dependency_container):
64
+ pass
65
+
66
+ def register_events(self, event_registry):
67
+ pass
68
+
69
+ def register_converters(self, object_converter):
70
+ pass
71
+
72
+ def register_metadata(self, metadata_manager):
73
+ pass
74
+
75
+ def handle_project_updated(self, project):
76
+ pass
77
+
78
+ class Module(ModuleBase):
79
+ def __init__(self, id_, model_type, view_type, view_manager_type, launcher_config=None):
80
+ ModuleBase.__init__(self, id_, launcher_config)
81
+ self._model_type = model_type
82
+ self._view_type = view_type
83
+ self._view_manager_type = view_manager_type
84
+
85
+ @property
86
+ def model_type(self):
87
+ return self._model_type
88
+
89
+ @property
90
+ def view_type(self):
91
+ return self._view_type
92
+
93
+ @property
94
+ def view_manager_type(self):
95
+ return self._view_manager_type
96
+
97
+ class CompositeModule(QObject):
98
+ def __init__(self, *modules):
99
+ QObject.__init__(self)
100
+ self._modules = modules
101
+
102
+ def register(self, dependency_container):
103
+ for module in self._modules:
104
+ module.register(dependency_container)
105
+
106
+ class CommandModule(ModuleBase):
107
+ def __init__(self, id_, launcher_config=None):
108
+ ModuleBase.__init__(self, id_, launcher_config)
109
+
110
+ def execute(self):
111
+ raise NotImplementedError()
@@ -0,0 +1,18 @@
1
+ # pyqttoolkit
2
+ # Copyright (C) 2018-2019, Simmovation Ltd.
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software Foundation,
16
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ from .throttled import ThrottledSignal
18
+ from .auto import bind, unbind, one_way_bind, one_way_unbind, updater, auto_property, connect_all, disconnect_all, AutoProperty