auto-options-python 0.1.4__tar.gz → 0.1.6__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 (41) hide show
  1. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/PKG-INFO +1 -1
  2. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/user/introduction.rst +3 -3
  3. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/auto_options_python.egg-info/PKG-INFO +1 -1
  4. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_version.py +3 -3
  5. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/widget.py +28 -16
  6. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/scratch/options.py +7 -2
  7. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/.github/workflows/create_doc.yml +0 -0
  8. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/.github/workflows/test_and_deploy.yml +0 -0
  9. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/.gitignore +0 -0
  10. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/LICENSE +0 -0
  11. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/README.md +0 -0
  12. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/Makefile +0 -0
  13. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/make.bat +0 -0
  14. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/auto-options-python.rst +0 -0
  15. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/autooptions.array_util.rst +0 -0
  16. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/autooptions.napari_util.rst +0 -0
  17. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/autooptions.options.rst +0 -0
  18. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/autooptions.qtutil.rst +0 -0
  19. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/autooptions.widget.rst +0 -0
  20. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/conf.py +0 -0
  21. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/index.rst +0 -0
  22. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/modules.rst +0 -0
  23. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/user/installation.rst +0 -0
  24. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/docs/source/user/user_documentation.rst +0 -0
  25. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/pyproject.toml +0 -0
  26. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/setup.cfg +0 -0
  27. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/auto_options_python.egg-info/SOURCES.txt +0 -0
  28. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/auto_options_python.egg-info/dependency_links.txt +0 -0
  29. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/auto_options_python.egg-info/requires.txt +0 -0
  30. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/auto_options_python.egg-info/top_level.txt +0 -0
  31. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/__init__.py +0 -0
  32. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/__init__.py +0 -0
  33. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/test_array_util.py +0 -0
  34. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/test_napari_util.py +0 -0
  35. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/test_options.py +0 -0
  36. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/test_qtutil.py +0 -0
  37. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/_tests/test_widget.py +0 -0
  38. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/array_util.py +0 -0
  39. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/napari_util.py +0 -0
  40. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/options.py +0 -0
  41. {auto_options_python-0.1.4 → auto_options_python-0.1.6}/src/autooptions/qtutil.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-options-python
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Mange command options in python and create QWidgets for them.
5
5
  Author: Volker Baecker
6
6
  Author-email: volker.baecker@mri.cnrs.fr
@@ -35,13 +35,13 @@ The code to create the options-dialog in Fig.1.1 is:
35
35
  from autooptions.options import Options
36
36
  from autooptions.widget import OptionsWidget
37
37
 
38
+ viewer = napari.Viewer()
38
39
  options = Options("3D Toolbox", "Convolution")
39
40
  options.addImage()
40
- option.addImage(name="kernel")
41
+ options.addImage(name="kernel")
41
42
  options.addChoice("mode", choices=["same", "valid", "full"])
42
43
  options.addChoice("method", choices=["auto", "direct", "fft"])
43
44
  options.load()
44
- widget = OptionsWidget(self.viewer, self.options, self)
45
+ widget = OptionsWidget(viewer, options, viewer)
45
46
  widget.addApplyButton(None)
46
- viewer = napari.Viewer()
47
47
  viewer.window.add_dock_widget(widget, name=options.optionsName)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto-options-python
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Mange command options in python and create QWidgets for them.
5
5
  Author: Volker Baecker
6
6
  Author-email: volker.baecker@mri.cnrs.fr
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.1.4'
22
- __version_tuple__ = version_tuple = (0, 1, 4)
21
+ __version__ = version = '0.1.6'
22
+ __version_tuple__ = version_tuple = (0, 1, 6)
23
23
 
24
- __commit_id__ = commit_id = 'g8103b82a3'
24
+ __commit_id__ = commit_id = 'g52deebf6d'
@@ -13,7 +13,7 @@ class OptionsWidget(QWidget):
13
13
  to the options file.
14
14
  """
15
15
 
16
- def __init__(self, viewer, options, client=None):
16
+ def __init__(self, viewer, options, client=None, sameRowMap=None):
17
17
  """
18
18
  Create a new options widget. Layer add and remove events are caught and
19
19
  the combo-boxes are updated accordingly, depending on the layer types.
@@ -41,6 +41,7 @@ class OptionsWidget(QWidget):
41
41
  self.labelComboBoxes = []
42
42
  self.pointComboBoxes = []
43
43
  self.widgets = {}
44
+ self._isSameRow = sameRowMap
44
45
  self.viewer.layers.events.inserted.connect(self._onLayerAddedOrRemoved)
45
46
  self.viewer.layers.events.removed.connect(self._onLayerAddedOrRemoved)
46
47
  self.input_layer = None
@@ -137,42 +138,55 @@ class OptionsWidget(QWidget):
137
138
  return func
138
139
 
139
140
 
141
+ def sameRow(self, name):
142
+ if self._isSameRow is None:
143
+ self._isSameRow = {}
144
+ self._isSameRow[name] = True
145
+
146
+
147
+ def isSameRow(self, name):
148
+ if self._isSameRow is None:
149
+ return False
150
+ if name in self._isSameRow.keys():
151
+ return self._isSameRow[name]
152
+ return False
153
+
154
+
140
155
  def _createLayout(self):
141
156
  self.mainLayout = QVBoxLayout()
157
+ layout = None
158
+ lastLayout = None
142
159
  for name, item in self.options.items.items():
143
160
  widget = None
144
161
  if item['type'] == 'image':
145
162
  layout, widget = self._getImageWidget(name, item)
146
- self.mainLayout.addLayout(layout)
147
163
  self.imageComboBoxes.append(widget)
148
164
  if item['type'] == 'labels':
149
165
  layout, widget = self._getLabelsWidget(name, item)
150
- self.mainLayout.addLayout(layout)
151
166
  self.labelComboBoxes.append(widget)
152
167
  if item['type'] == 'points':
153
168
  layout, widget = self._getPointsWidget(name, item)
154
- self.mainLayout.addLayout(layout)
155
169
  self.pointComboBoxes.append(widget)
156
170
  if item['type'] == 'fft':
157
171
  layout, widget = self._getFFTWidget(name, item)
158
- self.mainLayout.addLayout(layout)
159
172
  self.fftComboBoxes.append(widget)
160
173
  if item['type'] == 'int':
161
174
  layout, widget = self._getIntWidget(name, item)
162
- self.mainLayout.addLayout(layout)
163
175
  if item['type'] == 'float':
164
176
  layout, widget = self._getFloatWidget(name, item)
165
- self.mainLayout.addLayout(layout)
166
177
  if item['type'] == 'choice':
167
178
  layout, widget = self._getChoiceWidget(name, item)
168
- self.mainLayout.addLayout(layout)
169
179
  if item['type'] == 'str':
170
180
  layout, widget = self._getStrWidget(name, item)
171
- self.mainLayout.addLayout(layout)
172
181
  if item['type'] == 'bool':
173
182
  layout, widget = self._getBoolWidget(name, item)
183
+ if self.isSameRow(name):
184
+ lastLayout.addWidget(layout.itemAt(0).widget())
185
+ lastLayout.addWidget(layout.itemAt(1).widget())
186
+ else:
174
187
  self.mainLayout.addLayout(layout)
175
188
  self.widgets[name] = widget
189
+ lastLayout = layout
176
190
  self.setLayout(self.mainLayout)
177
191
 
178
192
 
@@ -291,26 +305,24 @@ class OptionsWidget(QWidget):
291
305
 
292
306
 
293
307
  def _createApplyButton(self, callback):
294
- button = self._createButton("&Apply", callback)
295
- button.clicked.connect(self._onApplyButtonClicked)
308
+ button = self._createButton("&Apply", callback, self._onApplyButtonClicked)
296
309
  return button
297
310
 
298
311
 
299
312
  def _createOKButton(self, callback):
300
- button = self._createButton("&Ok", callback)
301
- button.clicked.connect(self._onOKButtonClicked)
313
+ button = self._createButton("&Ok", callback, self._onOKButtonClicked)
302
314
  return button
303
315
 
304
316
 
305
317
  def _createCancelButton(self, callback):
306
- button = self._createButton("&Cancel", callback)
307
- button.clicked.connect(self._onCancelButtonClicked)
318
+ button = self._createButton("&Cancel", callback, self._onCancelButtonClicked)
308
319
  return button
309
320
 
310
321
 
311
322
  @classmethod
312
- def _createButton(cls, name, callback):
323
+ def _createButton(cls, name, callback, innerCallback):
313
324
  button = QPushButton(name)
325
+ button.clicked.connect(innerCallback)
314
326
  if callback:
315
327
  button.clicked.connect(callback)
316
328
  return button
@@ -4,12 +4,17 @@ from autooptions.widget import OptionsWidget
4
4
 
5
5
  class Client:
6
6
 
7
+
7
8
  def __init__(self):
8
9
  self.viewer = napari.Viewer()
9
10
  self.options = None
10
11
  self.widget = None
11
12
 
12
13
 
14
+ def onApplyButtonClicked(self):
15
+ print(self.options.items)
16
+
17
+
13
18
  def onInputChanged(self, value):
14
19
  if not value.isnumeric():
15
20
  self.widget.widgets["size xy"].setText(str(self.options.value("size xy")))
@@ -24,8 +29,8 @@ class Client:
24
29
  self.options.addChoice('footprint', value=None, choices=["none", "cube", "ball", "octahedron"])
25
30
  self.options.addInt('radius', value=1, widget="input")
26
31
  self.options.load()
27
- self.widget = OptionsWidget(self.viewer, self.options, self)
28
- self.widget.addApplyButton(None)
32
+ self.widget = OptionsWidget(self.viewer, self.options, self, sameRowMap={"size z": True})
33
+ self.widget.addApplyButton(self.onApplyButtonClicked)
29
34
  #self.widget.addOKButton(None)
30
35
  #self.widget.addCancelButton(None)
31
36
  self.viewer.window.add_dock_widget(self.widget, name=self.options.optionsName)