spiceitup 1.3.3__tar.gz → 2.0.0__tar.gz

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 (72) hide show
  1. {spiceitup-1.3.3 → spiceitup-2.0.0}/PKG-INFO +7 -10
  2. {spiceitup-1.3.3 → spiceitup-2.0.0}/README.md +5 -3
  3. {spiceitup-1.3.3 → spiceitup-2.0.0}/pyproject.toml +0 -0
  4. {spiceitup-1.3.3 → spiceitup-2.0.0}/setup.py +3 -18
  5. spiceitup-2.0.0/spiceitup/__main__.py +6 -0
  6. spiceitup-1.3.3/spiceitup/__main__.py → spiceitup-2.0.0/spiceitup/main_call.py +11 -9
  7. {spiceitup-1.3.3 → spiceitup-2.0.0}/spiceitup/run.py +43 -33
  8. {spiceitup-1.3.3 → spiceitup-2.0.0}/spiceitup.egg-info/PKG-INFO +7 -10
  9. spiceitup-2.0.0/spiceitup.egg-info/SOURCES.txt +12 -0
  10. spiceitup-2.0.0/spiceitup.egg-info/requires.txt +1 -0
  11. spiceitup-1.3.3/spiceitup/__init__.py +0 -0
  12. spiceitup-1.3.3/spiceitup/docs/__init__.py +0 -0
  13. spiceitup-1.3.3/spiceitup/images/__init__.py +0 -0
  14. spiceitup-1.3.3/spiceitup/layout/__init__.py +0 -0
  15. spiceitup-1.3.3/spiceitup/layout/flow_layout.py +0 -91
  16. spiceitup-1.3.3/spiceitup/layout/flow_layout_edited.py +0 -98
  17. spiceitup-1.3.3/spiceitup/layout/flow_layout_old.py +0 -96
  18. spiceitup-1.3.3/spiceitup/logs/__init__.py +0 -0
  19. spiceitup-1.3.3/spiceitup/logs/log.py +0 -41
  20. spiceitup-1.3.3/spiceitup/main/__init__.py +0 -0
  21. spiceitup-1.3.3/spiceitup/main/footer.py +0 -229
  22. spiceitup-1.3.3/spiceitup/main/header.py +0 -153
  23. spiceitup-1.3.3/spiceitup/main/menu.py +0 -624
  24. spiceitup-1.3.3/spiceitup/main/menu_bar.py +0 -183
  25. spiceitup-1.3.3/spiceitup/main/w.py +0 -28
  26. spiceitup-1.3.3/spiceitup/main/winc.py +0 -508
  27. spiceitup-1.3.3/spiceitup/plot/__init__.py +0 -0
  28. spiceitup-1.3.3/spiceitup/plot/plot_line.py +0 -182
  29. spiceitup-1.3.3/spiceitup/plot/plot_map.py +0 -537
  30. spiceitup-1.3.3/spiceitup/processing/__init__.py +0 -0
  31. spiceitup-1.3.3/spiceitup/processing/dh.py +0 -376
  32. spiceitup-1.3.3/spiceitup/processing/fit.py +0 -55
  33. spiceitup-1.3.3/spiceitup/processing/threads/__init__.py +0 -0
  34. spiceitup-1.3.3/spiceitup/processing/threads/run_thread.py +0 -137
  35. spiceitup-1.3.3/spiceitup/processing/threads/thread_worker.py +0 -20
  36. spiceitup-1.3.3/spiceitup/processing/threads/workers/__init__.py +0 -0
  37. spiceitup-1.3.3/spiceitup/processing/threads/workers/compute_average.py +0 -34
  38. spiceitup-1.3.3/spiceitup/processing/threads/workers/generate_fit_maps.py +0 -65
  39. spiceitup-1.3.3/spiceitup/processing/threads/workers/load_plot_map.py +0 -21
  40. spiceitup-1.3.3/spiceitup/processing/threads/workers/make_process_available.py +0 -17
  41. spiceitup-1.3.3/spiceitup/processing/threads/workers/out_of_sync.py +0 -30
  42. spiceitup-1.3.3/spiceitup/processing/threads/workers/update_levels.py +0 -37
  43. spiceitup-1.3.3/spiceitup/processing/threads/workers/update_profile.py +0 -77
  44. spiceitup-1.3.3/spiceitup/settings/__init__.py +0 -0
  45. spiceitup-1.3.3/spiceitup/settings/const.py +0 -134
  46. spiceitup-1.3.3/spiceitup/settings/states/__init__.py +0 -0
  47. spiceitup-1.3.3/spiceitup/style/__init__.py +0 -0
  48. spiceitup-1.3.3/spiceitup/toolbox/__init__.py +0 -0
  49. spiceitup-1.3.3/spiceitup/toolbox/binning.py +0 -60
  50. spiceitup-1.3.3/spiceitup/toolbox/clickable_qlabel.py +0 -9
  51. spiceitup-1.3.3/spiceitup/toolbox/filter2D_tests.py +0 -27
  52. spiceitup-1.3.3/spiceitup/toolbox/images/__init__.py +0 -0
  53. spiceitup-1.3.3/spiceitup/toolbox/level_methods.py +0 -23
  54. spiceitup-1.3.3/spiceitup/toolbox/multithreading.py +0 -22
  55. spiceitup-1.3.3/spiceitup/toolbox/pyqtgraph_examples.py +0 -10
  56. spiceitup-1.3.3/spiceitup/toolbox/pyqtgraph_plot_example.py +0 -104
  57. spiceitup-1.3.3/spiceitup/toolbox/scipy_fit.py +0 -29
  58. spiceitup-1.3.3/spiceitup/toolbox/scipy_fit_gaussian.py +0 -39
  59. spiceitup-1.3.3/spiceitup/toolbox/show_icons.py +0 -29
  60. spiceitup-1.3.3/spiceitup/toolbox/signal_thread_ex.py +0 -16
  61. spiceitup-1.3.3/spiceitup/toolbox/small_pyqtgraph.py +0 -91
  62. spiceitup-1.3.3/spiceitup/toolbox/small_pyqtgraph2.py +0 -94
  63. spiceitup-1.3.3/spiceitup/toolbox/test.py +0 -63
  64. spiceitup-1.3.3/spiceitup/utils/__init__.py +0 -0
  65. spiceitup-1.3.3/spiceitup/utils/internal_utils.py +0 -188
  66. spiceitup-1.3.3/spiceitup/utils/special_chars.py +0 -5
  67. spiceitup-1.3.3/spiceitup.egg-info/SOURCES.txt +0 -67
  68. spiceitup-1.3.3/spiceitup.egg-info/requires.txt +0 -6
  69. {spiceitup-1.3.3 → spiceitup-2.0.0}/setup.cfg +0 -0
  70. {spiceitup-1.3.3 → spiceitup-2.0.0}/spiceitup.egg-info/dependency_links.txt +0 -0
  71. {spiceitup-1.3.3 → spiceitup-2.0.0}/spiceitup.egg-info/entry_points.txt +0 -0
  72. {spiceitup-1.3.3 → spiceitup-2.0.0}/spiceitup.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spiceitup
3
- Version: 1.3.3
3
+ Version: 2.0.0
4
4
  Summary: Quicklook tool for level 2 SPICE imaging
5
5
  Home-page: https://git.ias.u-psud.fr/spice/data_quicklook
6
6
  Author: David Picard
@@ -9,12 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Requires-Python: >=3.7
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: PyQt5
13
- Requires-Dist: sunraster
14
- Requires-Dist: pyqtgraph
15
- Requires-Dist: qdarkgraystyle
16
- Requires-Dist: scipy
17
- Requires-Dist: opencv-python-headless
12
+ Requires-Dist: requirements.txt
18
13
  Dynamic: author
19
14
  Dynamic: author-email
20
15
  Dynamic: classifier
@@ -25,7 +20,7 @@ Dynamic: requires-dist
25
20
  Dynamic: requires-python
26
21
  Dynamic: summary
27
22
 
28
- # SPICE data quicklook in PyQt5 / PyQtGraph
23
+ # SPICE data quicklook in PyQt6 / PyQtGraph
29
24
 
30
25
  This graphical user interface (GUI) allows you to have a quick look in the SPICE data (provide level 2 '.fits' files in input). You will be able to navigate dynamically in the data thanks to sliders which update the maps I(x,y) ; I(lambda,y), the curve I(lambda) and more.
31
26
 
@@ -58,7 +53,9 @@ Run with `spiceitup`
58
53
  `pip install numpy --upgrade`
59
54
 
60
55
  #### B.2) Run the app
61
- `python3 spiceitup/main.py` or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
56
+ `cd spiceitup`
57
+ `python3 run.py`
58
+ or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
62
59
 
63
60
  #### B.3) Troubleshooting
64
61
  Error known:
@@ -68,7 +65,7 @@ In this case, try to do: `sudo apt-get install --reinstall libxcb-xinerama0`
68
65
 
69
66
  **spiceitup: command not found**
70
67
  In this case check if spiceitup is here: `$(python -m site --user-base)/bin"`
71
- Then add it to $PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
68
+ Then add it to \$PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
72
69
  Run again `spiceitup`
73
70
 
74
71
  **No module spiceitup**
@@ -1,4 +1,4 @@
1
- # SPICE data quicklook in PyQt5 / PyQtGraph
1
+ # SPICE data quicklook in PyQt6 / PyQtGraph
2
2
 
3
3
  This graphical user interface (GUI) allows you to have a quick look in the SPICE data (provide level 2 '.fits' files in input). You will be able to navigate dynamically in the data thanks to sliders which update the maps I(x,y) ; I(lambda,y), the curve I(lambda) and more.
4
4
 
@@ -31,7 +31,9 @@ Run with `spiceitup`
31
31
  `pip install numpy --upgrade`
32
32
 
33
33
  #### B.2) Run the app
34
- `python3 spiceitup/main.py` or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
34
+ `cd spiceitup`
35
+ `python3 run.py`
36
+ or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
35
37
 
36
38
  #### B.3) Troubleshooting
37
39
  Error known:
@@ -41,7 +43,7 @@ In this case, try to do: `sudo apt-get install --reinstall libxcb-xinerama0`
41
43
 
42
44
  **spiceitup: command not found**
43
45
  In this case check if spiceitup is here: `$(python -m site --user-base)/bin"`
44
- Then add it to $PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
46
+ Then add it to \$PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
45
47
  Run again `spiceitup`
46
48
 
47
49
  **No module spiceitup**
File without changes
@@ -3,32 +3,17 @@ import os
3
3
  from importlib_metadata import entry_points
4
4
  from setuptools import setup, find_packages
5
5
 
6
- def load_requirements(filename):
7
- with open('/srv/data_quicklook/' + filename, 'r') as f:
8
- return [
9
- line.strip()
10
- for line in f
11
- if line.strip() and not line.startswith('#')
12
- ]
13
-
14
6
  setup(
15
7
  name='spiceitup',
16
- version='1.3.3',
8
+ version='2.0.0',
17
9
  description='Quicklook tool for level 2 SPICE imaging',
18
10
  long_description=open('README.md').read(),
19
11
  long_description_content_type='text/markdown',
20
12
  author='David Picard',
21
13
  author_email='david.picard@universite-paris-saclay.fr',
22
14
  url='https://git.ias.u-psud.fr/spice/data_quicklook',
23
- packages=find_packages(),
24
- install_requires=[
25
- "PyQt5",
26
- "sunraster",
27
- "pyqtgraph",
28
- "qdarkgraystyle",
29
- "scipy",
30
- "opencv-python-headless"
31
- ],
15
+ packages=['spiceitup'],
16
+ install_requires='requirements.txt',
32
17
  classifiers=[
33
18
  'Programming Language :: Python :: 3',
34
19
  'License :: OSI Approved :: MIT License',
@@ -0,0 +1,6 @@
1
+ # handles call from pip install
2
+
3
+ from main_call import main
4
+
5
+ if __name__ == '__main__':
6
+ main()
@@ -1,12 +1,15 @@
1
1
  import sys
2
2
  import warnings
3
- import os
4
- from .settings.const import Const
5
- from .run import Main
6
- from PyQt5.QtGui import *
7
- from PyQt5.QtWidgets import *
3
+ from pathlib import Path
4
+
5
+ from run import Main
6
+ from settings.const import Const
7
+ from PyQt6.QtGui import *
8
+ from PyQt6.QtWidgets import *
9
+
8
10
 
9
11
  def main():
12
+ project_path = str(Path(__file__).resolve().parent)
10
13
  warnings.filterwarnings("ignore")
11
14
  # Used to prevent to show All-NaN RuntimeWarning
12
15
  # Slices in the data cube can be filled with NaN
@@ -16,14 +19,13 @@ def main():
16
19
  app = QApplication(sys.argv)
17
20
  else:
18
21
  app = QApplication.instance()
19
-
20
- win = Main()
22
+ win = Main(project_path)
21
23
  win.applyStyle(app)
22
24
  win.resize(Const.window_width, Const.window_height)
23
- win.setWindowIcon(QIcon('images/icon.png'))
25
+ win.setWindowIcon(QIcon(win.project_path + '/images/icon.png'))
24
26
  win.show()
25
27
 
26
28
  sys.exit(app.exec())
27
29
 
28
30
  if __name__ == '__main__':
29
- main()
31
+ print('To run the app, run "python run.py"')
@@ -1,20 +1,24 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ import os
1
4
  import sys
2
5
  import warnings
3
6
 
4
7
  from os import path
5
- from .logs.log import Log
6
- from .plot.plot_map import PlotMap
7
- from .settings.const import *
8
- from .utils.internal_utils import *
9
- from PyQt5.QtGui import *
10
- from PyQt5.QtCore import *
11
- from PyQt5.QtWidgets import *
12
- from .main.footer import Footer
13
- from .main.header import Header
14
- from .main.menu_bar import MenuBar
8
+ from pathlib import Path
9
+
10
+ from logs.log import Log
11
+ from plot.plot_map import PlotMap
12
+ from utils.internal_utils import *
13
+ from PyQt6.QtGui import *
14
+ from PyQt6.QtCore import *
15
+ from PyQt6.QtWidgets import *
16
+ from main.footer import Footer
17
+ from main.header import Header
18
+ from main.menu_bar import MenuBar
15
19
  import qdarkgraystyle
16
- from .main.menu import Menu
17
- from .main.winc import WindowsContainer
20
+ from main.menu import Menu
21
+ from main.winc import WindowsContainer
18
22
 
19
23
  class Main(QMainWindow):
20
24
  windows = [] # list of Window objects, see Window.py
@@ -44,12 +48,13 @@ class Main(QMainWindow):
44
48
  lambda_I_bar_moves = False # avoid recursive behavior when moving I(lambda)'s vertical bar
45
49
  updating_levels = [] # contains RunThread instances related to running levels process
46
50
  lambda_unit = True # Angstrom otherwise cube index
47
- qs_fit_label = {} # {'win_key': {'fit_1': QLabel(), 'fit_2': QLabel(), 'fit_3': QLabel()}, ...}
51
+ qs_fit_label = {} # {'win_key': {'fit_1': QLabel(), 'fit_2': QLabel(), 'fit_3': QLabel()}, ...}
48
52
  nb_available_bin = {} # {'win_key': <nb>} in order to hide fit if nb < 4
49
53
  python_state = None # when not None, a state is being restored
50
54
 
51
- def __init__(self, parent=None):
55
+ def __init__(self, project_path, parent=None):
52
56
  super(QMainWindow, self).__init__(parent)
57
+ self.project_path = project_path
53
58
  Log.p('------------------------- Application was run')
54
59
  self.initialization()
55
60
  central_widget = QFrame()
@@ -64,29 +69,29 @@ class Main(QMainWindow):
64
69
  self.f_header = Header(self)
65
70
  self.m_menu_bar = MenuBar(self)
66
71
 
67
- s1 = QSplitter(Qt.Horizontal)
68
- # win_label.setStyleSheet("border: 1px solid black;")
69
-
72
+ s1 = QSplitter(Qt.Orientation.Horizontal)
73
+ #win_label.setStyleSheet("border: 1px solid black;")
74
+
70
75
  s1.addWidget(self.f_menu)
71
76
  s1.addWidget(self.f_winc)
72
77
  s1.setSizes(split_w_pc(0.2))
73
78
 
74
- s2 = QSplitter(Qt.Vertical)
79
+ s2 = QSplitter(Qt.Orientation.Vertical)
75
80
  s2.addWidget(s1)
76
81
  s2.addWidget(self.f_footer)
77
82
  s2.setSizes(split_h_pc(0.85))
78
-
79
- s0 = QSplitter(Qt.Vertical)
83
+
84
+ s0 = QSplitter(Qt.Orientation.Vertical)
80
85
  s0.addWidget(self.f_header)
81
86
  s0.addWidget(s2)
82
87
  s0.setSizes(split_h_pc(0.05))
83
-
88
+
84
89
  hbox.addWidget(s0)
85
90
 
86
91
  QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
87
92
 
88
- self.setWindowTitle('SPICE-IT Quicklook')
89
-
93
+ self.setWindowTitle('SPICE-IT-UP Quicklook')
94
+
90
95
  """def __del__(self):
91
96
  for th in self.th:
92
97
  th.quit()"""
@@ -131,7 +136,7 @@ class Main(QMainWindow):
131
136
  for plot_key, plot in plot_bloc.items():
132
137
  plots.append(plot)
133
138
  return plots # list of PlotMap and/or PlotLine
134
-
139
+
135
140
  def get_plots(self, given_plot_key):
136
141
  plots = []
137
142
  for win_key, plot_bloc in self.global_plots.items():
@@ -139,7 +144,7 @@ class Main(QMainWindow):
139
144
  if given_plot_key == plot_key:
140
145
  plots.append(plot)
141
146
  return plots # list of PlotMap or PlotLine
142
-
147
+
143
148
  def get_plot_bloc(self, given_plot):
144
149
  """plot_bloc is the parent element from a specific plot, it is a dict
145
150
  which is a value-element of global_plots and containing all the PlotMaps
@@ -156,16 +161,16 @@ class Main(QMainWindow):
156
161
  for key in keys:
157
162
  plot_bloc[key].main_plot_item.setXLink(None)
158
163
  plot_bloc[key].main_plot_item.setYLink(None)
159
-
164
+
160
165
  def link_axes(self, between_windows=False):
161
166
  previous_lambda_y = None
162
167
  previous_x_y = None
163
-
168
+
164
169
  self.unlink_axes()
165
170
  for win_key, plot_bloc in self.global_plots.items():
166
171
  # Zoom / Pane link
167
- # plot_bloc['x_y'].main_plot_item.setYLink(plot_bloc['lambda_y'].main_plot_item)
168
- # generates zoom issues
172
+ #plot_bloc['x_y'].main_plot_item.setYLink(plot_bloc['lambda_y'].main_plot_item)
173
+ #generates zoom issues
169
174
  if between_windows:
170
175
  if previous_lambda_y is not None: # not the first window
171
176
  PlotMap.link_maps(previous_x_y, plot_bloc['x_y'])
@@ -198,22 +203,27 @@ class Main(QMainWindow):
198
203
  elif plot_key == 'lambda_y':
199
204
  factor = self.f_menu.s_lambda_rescaling.value()
200
205
  return float(factor)
201
-
206
+
202
207
  def initialization(self):
203
208
  if not path.isdir(Const.default_data_path):
204
209
  Log.p(Const.default_data_path + ' does not exist.', 'warn')
205
210
  Const.default_data_path = ''
206
-
211
+
207
212
  def applyStyle(self, app):
208
213
  css_content = self.read_css()
209
214
  if Const.debug_mode:
210
215
  css_content += self.read_css(True)
211
216
  qdgs_css = qdarkgraystyle.load_stylesheet().replace('opacity: 100;', '') # Fix tooltip Windows issue
212
217
  app.setStyleSheet(qdgs_css + css_content)
213
-
218
+ #app.setStyleSheet(css_content)
219
+
214
220
  def read_css(self, debug=False):
215
221
  debug_str = '_debug' if debug else ''
216
- file = open(BASE_DIR + '/style/style' + debug_str + '.css', mode='r')
222
+ file = open(self.project_path + '/style/style' + debug_str + '.css', mode='r')
217
223
  css_content = file.read()
218
224
  file.close()
219
225
  return css_content
226
+
227
+ if __name__ == '__main__':
228
+ from main_call import main
229
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spiceitup
3
- Version: 1.3.3
3
+ Version: 2.0.0
4
4
  Summary: Quicklook tool for level 2 SPICE imaging
5
5
  Home-page: https://git.ias.u-psud.fr/spice/data_quicklook
6
6
  Author: David Picard
@@ -9,12 +9,7 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Requires-Python: >=3.7
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: PyQt5
13
- Requires-Dist: sunraster
14
- Requires-Dist: pyqtgraph
15
- Requires-Dist: qdarkgraystyle
16
- Requires-Dist: scipy
17
- Requires-Dist: opencv-python-headless
12
+ Requires-Dist: requirements.txt
18
13
  Dynamic: author
19
14
  Dynamic: author-email
20
15
  Dynamic: classifier
@@ -25,7 +20,7 @@ Dynamic: requires-dist
25
20
  Dynamic: requires-python
26
21
  Dynamic: summary
27
22
 
28
- # SPICE data quicklook in PyQt5 / PyQtGraph
23
+ # SPICE data quicklook in PyQt6 / PyQtGraph
29
24
 
30
25
  This graphical user interface (GUI) allows you to have a quick look in the SPICE data (provide level 2 '.fits' files in input). You will be able to navigate dynamically in the data thanks to sliders which update the maps I(x,y) ; I(lambda,y), the curve I(lambda) and more.
31
26
 
@@ -58,7 +53,9 @@ Run with `spiceitup`
58
53
  `pip install numpy --upgrade`
59
54
 
60
55
  #### B.2) Run the app
61
- `python3 spiceitup/main.py` or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
56
+ `cd spiceitup`
57
+ `python3 run.py`
58
+ or use an IDE like pycharm (which will install the requirements automatically), open this folder as a project and run `run.py`
62
59
 
63
60
  #### B.3) Troubleshooting
64
61
  Error known:
@@ -68,7 +65,7 @@ In this case, try to do: `sudo apt-get install --reinstall libxcb-xinerama0`
68
65
 
69
66
  **spiceitup: command not found**
70
67
  In this case check if spiceitup is here: `$(python -m site --user-base)/bin"`
71
- Then add it to $PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
68
+ Then add it to \$PATH: `export PATH="$PATH:$(python -m site --user-base)/bin"`
72
69
  Run again `spiceitup`
73
70
 
74
71
  **No module spiceitup**
@@ -0,0 +1,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ spiceitup/__main__.py
5
+ spiceitup/main_call.py
6
+ spiceitup/run.py
7
+ spiceitup.egg-info/PKG-INFO
8
+ spiceitup.egg-info/SOURCES.txt
9
+ spiceitup.egg-info/dependency_links.txt
10
+ spiceitup.egg-info/entry_points.txt
11
+ spiceitup.egg-info/requires.txt
12
+ spiceitup.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requirements.txt
File without changes
File without changes
File without changes
File without changes
@@ -1,91 +0,0 @@
1
- from PyQt5.QtCore import QPoint, QRect, QSize, Qt
2
- from PyQt5.QtWidgets import (QApplication, QLayout, QPushButton, QSizePolicy, QWidget, QGridLayout)
3
-
4
- class FlowLayout(QLayout):
5
-
6
- def __init__(self, parent = None, margin = 0, spacing = -1):
7
- super(FlowLayout, self).__init__(parent)
8
-
9
- if parent is not None:
10
- self.setContentsMargins(margin, margin, margin, margin)
11
-
12
- self.setSpacing(spacing)
13
-
14
- self.itemList = []
15
-
16
- def __del__(self):
17
- item = self.takeAt(0)
18
- while item:
19
- item = self.takeAt(0)
20
-
21
- def addItem(self, item):
22
- self.itemList.append(item)
23
-
24
- def count(self):
25
- return len(self.itemList)
26
-
27
- def itemAt(self, index):
28
- if index >= 0 and index < len(self.itemList):
29
- return self.itemList[index]
30
-
31
- return None
32
-
33
- def takeAt(self, index):
34
- if index >= 0 and index < len(self.itemList):
35
- return self.itemList.pop(index)
36
-
37
- return None
38
-
39
- def expandingDirections(self):
40
- return Qt.Orientations(Qt.Orientation(0))
41
-
42
- def hasHeightForWidth(self):
43
- return True
44
-
45
- def heightForWidth(self, width):
46
- height = self.doLayout(QRect(0, 0, width, 0), True)
47
- return height
48
-
49
- def setGeometry(self, rect):
50
- super(FlowLayout, self).setGeometry(rect)
51
- self.doLayout(rect, False)
52
-
53
- def sizeHint(self):
54
- return self.minimumSize()
55
-
56
- def minimumSize(self):
57
- size = QSize()
58
-
59
- for item in self.itemList:
60
- size = size.expandedTo(item.minimumSize())
61
-
62
- margin, _, _, _ = self.getContentsMargins()
63
-
64
- size += QSize(2 * margin, 2 * margin)
65
- return size
66
-
67
- def doLayout(self, rect, testOnly):
68
- x = rect.x()
69
- y = rect.y()
70
- lineHeight = 0
71
-
72
- for item in self.itemList:
73
- wid = item.widget()
74
- spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
75
- QSizePolicy.PushButton, Qt.Horizontal)
76
- spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
77
- QSizePolicy.PushButton, Qt.Vertical)
78
- nextX = x + item.sizeHint().width() + spaceX
79
- if nextX - spaceX > rect.right() and lineHeight > 0:
80
- x = rect.x()
81
- y = y + lineHeight + spaceY
82
- nextX = x + item.sizeHint().width() + spaceX
83
- lineHeight = 0
84
-
85
- if not testOnly:
86
- item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
87
-
88
- x = nextX
89
- lineHeight = max(lineHeight, item.sizeHint().height())
90
-
91
- return y + lineHeight - rect.y()
@@ -1,98 +0,0 @@
1
- from PyQt5.QtCore import QPoint, QRect, QSize, Qt
2
- from PyQt5.QtWidgets import (QApplication, QLayout, QPushButton, QSizePolicy, QWidget, QGridLayout)
3
-
4
- class FlowLayout(QLayout):
5
- q_plot_size = None
6
-
7
- def __init__(self, parent = None, margin = 0, spacing = -1, q_plot_size = None):
8
- # plot_size must be a QSize object
9
- super(FlowLayout, self).__init__(parent)
10
-
11
- if q_plot_size is not None:
12
- self.q_plot_size = q_plot_size
13
- self.q_plot_size.setHeight(int(self.q_plot_size.width() * 1.3)) # because of win title
14
- self.q_plot_size.setWidth(self.q_plot_size.width() * 2) # because 2 plots x,y and lambda,y
15
-
16
- if parent is not None:
17
- self.setContentsMargins(margin, margin, margin, margin)
18
-
19
- self.setSpacing(spacing)
20
-
21
- self.itemList = []
22
-
23
- def __del__(self):
24
- item = self.takeAt(0)
25
- while item:
26
- item = self.takeAt(0)
27
-
28
- def addItem(self, item):
29
- self.itemList.append(item)
30
-
31
- def count(self):
32
- return len(self.itemList)
33
-
34
- def itemAt(self, index):
35
- if index >= 0 and index < len(self.itemList):
36
- return self.itemList[index]
37
-
38
- return None
39
-
40
- def takeAt(self, index):
41
- if index >= 0 and index < len(self.itemList):
42
- return self.itemList.pop(index)
43
-
44
- return None
45
-
46
- def expandingDirections(self):
47
- return Qt.Orientations(Qt.Orientation(0))
48
-
49
- def hasHeightForWidth(self):
50
- return True
51
-
52
- def heightForWidth(self, width):
53
- height = self.doLayout(QRect(0, 0, width, 0), True)
54
- return height
55
-
56
- def setGeometry(self, rect):
57
- super(FlowLayout, self).setGeometry(rect)
58
- self.doLayout(rect, False)
59
-
60
- def sizeHint(self):
61
- return self.minimumSize()
62
-
63
- def minimumSize(self):
64
- size = QSize()
65
-
66
- for item in self.itemList:
67
- size = size.expandedTo(item.minimumSize())
68
-
69
- margin, _, _, _ = self.getContentsMargins()
70
-
71
- size += QSize(2 * margin, 2 * margin)
72
- return size
73
-
74
- def doLayout(self, rect, testOnly):
75
- x = rect.x()
76
- y = rect.y()
77
- lineHeight = 0
78
-
79
- for item in self.itemList:
80
- wid = item.widget()
81
- spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
82
- QSizePolicy.PushButton, Qt.Horizontal)
83
- spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton,
84
- QSizePolicy.PushButton, Qt.Vertical)
85
- nextX = x + self.q_plot_size.width() + spaceX #nextX = x + item.sizeHint().width() + spaceX
86
- if nextX - spaceX > rect.right() and lineHeight > 0:
87
- x = rect.x()
88
- y = y + lineHeight + spaceY
89
- nextX = x + self.q_plot_size.width() + spaceX #nextX = x + item.sizeHint().width() + spaceX
90
- lineHeight = 0
91
-
92
- if not testOnly:
93
- item.setGeometry(QRect(QPoint(x, y), self.q_plot_size)) #item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
94
-
95
- x = nextX
96
- lineHeight = max(lineHeight, self.q_plot_size.height()) #lineHeight = max(lineHeight, item.sizeHint().height())
97
-
98
- return y + lineHeight - rect.y()