codeallyadvanced 1.1.0__tar.gz → 1.3.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 (87) hide show
  1. {codeallyadvanced-1.1.0/src/codeallyadvanced.egg-info → codeallyadvanced-1.3.0}/PKG-INFO +8 -8
  2. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/README.md +6 -6
  3. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/pyproject.toml +1 -1
  4. codeallyadvanced-1.3.0/src/codeallyadvanced/_version.py +1 -0
  5. codeallyadvanced-1.3.0/src/codeallyadvanced/ui/widgets/DialSelector.py +192 -0
  6. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/DualSpinnerControl.py +1 -0
  7. codeallyadvanced-1.3.0/src/codeallyadvanced/ui/widgets/MinMaxControl.py +73 -0
  8. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/PositionControl.py +3 -2
  9. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0/src/codeallyadvanced.egg-info}/PKG-INFO +8 -8
  10. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced.egg-info/SOURCES.txt +2 -0
  11. codeallyadvanced-1.3.0/src/codeallyadvanced.egg-info/requires.txt +2 -0
  12. codeallyadvanced-1.1.0/src/codeallyadvanced/_version.py +0 -1
  13. codeallyadvanced-1.1.0/src/codeallyadvanced.egg-info/requires.txt +0 -2
  14. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/LICENSE +0 -0
  15. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/setup.cfg +0 -0
  16. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/__init__.py +0 -0
  17. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/py.typed +0 -0
  18. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/__init__.py +0 -0
  19. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/DefaultPreferences.py +0 -0
  20. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/__init__.py +0 -0
  21. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/__init__.py +0 -0
  22. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxActor.py +0 -0
  23. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxArrow.py +0 -0
  24. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxClass.py +0 -0
  25. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxNewClassDiagram.py +0 -0
  26. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxNewProject.py +0 -0
  27. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxNewSequenceDiagram.py +0 -0
  28. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxNewUseCaseDiagram.py +0 -0
  29. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxNote.py +0 -0
  30. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxOpenFile.py +0 -0
  31. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRedo.py +0 -0
  32. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipAggregation.py +0 -0
  33. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipAssociation.py +0 -0
  34. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipComposition.py +0 -0
  35. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipInheritance.py +0 -0
  36. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipNote.py +0 -0
  37. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxRelationshipRealization.py +0 -0
  38. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxSaveDiagram.py +0 -0
  39. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxSequenceDiagramInstance.py +0 -0
  40. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxSequenceDiagramMessage.py +0 -0
  41. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxText.py +0 -0
  42. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxUndo.py +0 -0
  43. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxUseCase.py +0 -0
  44. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxZoomIn.py +0 -0
  45. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/ImgToolboxZoomOut.py +0 -0
  46. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/__init__.py +0 -0
  47. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded16/py.typed +0 -0
  48. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxActor.py +0 -0
  49. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxArrow.py +0 -0
  50. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxClass.py +0 -0
  51. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxNewClassDiagram.py +0 -0
  52. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxNewProject.py +0 -0
  53. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxNewSequenceDiagram.py +0 -0
  54. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxNewUseCaseDiagram.py +0 -0
  55. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxNote.py +0 -0
  56. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxOpenFile.py +0 -0
  57. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRedo.py +0 -0
  58. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipAggregation.py +0 -0
  59. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipAssociation.py +0 -0
  60. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipComposition.py +0 -0
  61. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipInheritance.py +0 -0
  62. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipNote.py +0 -0
  63. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxRelationshipRealization.py +0 -0
  64. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxSaveDiagram.py +0 -0
  65. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxSequenceDiagramInstance.py +0 -0
  66. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxSequenceDiagramMessage.py +0 -0
  67. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxText.py +0 -0
  68. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxUndo.py +0 -0
  69. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxUseCase.py +0 -0
  70. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxZoomIn.py +0 -0
  71. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/ImgToolboxZoomOut.py +0 -0
  72. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/__init__.py +0 -0
  73. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/embedded32/py.typed +0 -0
  74. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/icons/sourceimages/__init__.py +0 -0
  75. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/images/py.typed +0 -0
  76. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/resources/py.typed +0 -0
  77. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/AttachmentSide.py +0 -0
  78. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/Common.py +0 -0
  79. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/UnitTestBaseW.py +0 -0
  80. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/__init__.py +0 -0
  81. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/py.typed +0 -0
  82. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/DimensionsControl.py +0 -0
  83. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/DirectionEnum.py +0 -0
  84. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/__init__.py +0 -0
  85. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced/ui/widgets/py.typed +0 -0
  86. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced.egg-info/dependency_links.txt +0 -0
  87. {codeallyadvanced-1.1.0 → codeallyadvanced-1.3.0}/src/codeallyadvanced.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codeallyadvanced
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: Humberto`s Common UI Stuff
5
5
  Author-email: "Humberto A. Sanchez II" <Humbert.A.Sanchez.II@gmail.com>
6
6
  Maintainer-email: "Humberto A. Sanchez II" <Humbert.A.Sanchez.II@gmail.com>
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/hasii2011/code-ally-advanced
9
9
  Keywords: pyut,python
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: codeallybasic>=1.1.0
12
+ Requires-Dist: codeallybasic>=1.2.0
13
13
  Requires-Dist: wxPython~=4.2.1
14
14
 
15
15
  ![](https://github.com/hasii2011/code-ally-basic/blob/master/developer/agpl-license-web-badge-version-2-256x48.png "AGPL")
@@ -24,11 +24,11 @@ Common UI artifacts for various projects I am developing
24
24
  Written by <a href="mailto:email@humberto.a.sanchez.ii@gmail.com?subject=Hello Humberto">Humberto A. Sanchez II</a> (C) 2023
25
25
 
26
26
  ## Note
27
- For all kind of problems, requests, enhancements, bug reports, etc.,
28
- please drop me an e-mail.
27
+ For all kinds of problems, requests, enhancements, bug reports, etc.,
28
+ drop me an e-mail.
29
29
 
30
30
  ## Developer Notes
31
- This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day to day development builds
31
+ This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day-to-day development builds
32
32
 
33
33
  ---
34
34
 
@@ -42,11 +42,11 @@ I urge you to read about the
42
42
  [Give up GitHub](https://GiveUpGitHub.org) campaign from
43
43
  [the Software Freedom Conservancy](https://sfconservancy.org).
44
44
 
45
- While I do not advocate for all the issues listed there I do not like that
45
+ While I do not advocate for all the issues listed there, I do not like that
46
46
  a company like Microsoft may profit from open source projects.
47
47
 
48
- I continue to use GitHub because it offers the services I need for free. But, I continue
49
- to monitor their terms of service.
48
+ I continue to use GitHub because it offers the services I need for free.
49
+ I continue to monitor their terms of service.
50
50
 
51
51
  Any use of this project's code by GitHub Copilot, past or present, is done
52
52
  without our permission. We do not consent to GitHub's use of this project's
@@ -10,11 +10,11 @@ Common UI artifacts for various projects I am developing
10
10
  Written by <a href="mailto:email@humberto.a.sanchez.ii@gmail.com?subject=Hello Humberto">Humberto A. Sanchez II</a> (C) 2023
11
11
 
12
12
  ## Note
13
- For all kind of problems, requests, enhancements, bug reports, etc.,
14
- please drop me an e-mail.
13
+ For all kinds of problems, requests, enhancements, bug reports, etc.,
14
+ drop me an e-mail.
15
15
 
16
16
  ## Developer Notes
17
- This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day to day development builds
17
+ This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day-to-day development builds
18
18
 
19
19
  ---
20
20
 
@@ -28,11 +28,11 @@ I urge you to read about the
28
28
  [Give up GitHub](https://GiveUpGitHub.org) campaign from
29
29
  [the Software Freedom Conservancy](https://sfconservancy.org).
30
30
 
31
- While I do not advocate for all the issues listed there I do not like that
31
+ While I do not advocate for all the issues listed there, I do not like that
32
32
  a company like Microsoft may profit from open source projects.
33
33
 
34
- I continue to use GitHub because it offers the services I need for free. But, I continue
35
- to monitor their terms of service.
34
+ I continue to use GitHub because it offers the services I need for free.
35
+ I continue to monitor their terms of service.
36
36
 
37
37
  Any use of this project's code by GitHub Copilot, past or present, is done
38
38
  without our permission. We do not consent to GitHub's use of this project's
@@ -13,7 +13,7 @@ maintainers = [{name = 'Humberto A. Sanchez II', email = 'Humbert.A.Sanchez.II@g
13
13
  keywords = ['pyut', 'python',]
14
14
 
15
15
  dependencies = [
16
- 'codeallybasic>=1.1.0',
16
+ 'codeallybasic>=1.2.0',
17
17
  'wxPython~=4.2.1'
18
18
  ]
19
19
 
@@ -0,0 +1 @@
1
+ __version__: str = '1.3.0'
@@ -0,0 +1,192 @@
1
+ from typing import Any
2
+ from typing import Callable
3
+ from typing import List
4
+
5
+ from dataclasses import dataclass
6
+
7
+ from math import ceil
8
+
9
+ from logging import Logger
10
+ from logging import getLogger
11
+ from typing import cast
12
+
13
+ from wx import ALIGN_LEFT
14
+ from wx import ID_ANY
15
+ from wx import StaticText
16
+
17
+ from wx.lib.agw.knobctrl import EVT_KC_ANGLE_CHANGED
18
+ from wx.lib.agw.knobctrl import KnobCtrl
19
+ from wx.lib.agw.knobctrl import KnobCtrlEvent
20
+
21
+ from wx.lib.sized_controls import SizedStaticBox
22
+
23
+ FormatValueCallback = Callable[[Any], str]
24
+ ValueChangeCallback = Callable[[Any], None]
25
+
26
+ NO_FORMAT_CALLBACK: FormatValueCallback = cast(FormatValueCallback, None)
27
+ NO_VALUE_CALLBACK: ValueChangeCallback = cast(ValueChangeCallback, None)
28
+
29
+
30
+ @dataclass
31
+ class DialSelectorParameters:
32
+ minValue: int | float = 0
33
+ maxValue: int | float = 0
34
+ dialLabel: str = ''
35
+ formatValueCallback: FormatValueCallback = NO_FORMAT_CALLBACK
36
+ valueChangedCallback: ValueChangeCallback = NO_VALUE_CALLBACK
37
+
38
+
39
+ OPINIONATED_TICK_FREQUENCY: int = 10
40
+ OPINIONATED_TICK_VALUE: int = 10
41
+ KNOB_CTRL_GRANULARITY: int = 100
42
+
43
+
44
+ class DialSelector(SizedStaticBox):
45
+ """
46
+ Using the Adapter pattern. I don't care what PyBites says
47
+ The wrapped knob control reports 100 positions; We will put
48
+ tick marks (tags) every 10 positions and coerce the reported
49
+ values to align on those marks
50
+ """
51
+
52
+ def __init__(self, parent, parameters: DialSelectorParameters):
53
+
54
+ super().__init__(parent, label=parameters.dialLabel)
55
+ self.logger: Logger = getLogger(__name__)
56
+
57
+ self._parameters: DialSelectorParameters = parameters
58
+
59
+ self._tickFrequency: int = OPINIONATED_TICK_FREQUENCY
60
+ self._tickValue: int | float = OPINIONATED_TICK_VALUE
61
+ self._value: int | float = parameters.minValue
62
+
63
+ self.SetSizerType('vertical')
64
+ # noinspection PyUnresolvedReferences
65
+ self.SetSizerProps(expand=True, proportion=1)
66
+
67
+ self._knobCtrl: KnobCtrl = KnobCtrl(self, size=(100, 100))
68
+
69
+ self._knobCtrl.SetAngularRange(-45, 225)
70
+ self._knobCtrl.SetKnobRadius(4)
71
+ self._setTicksOnKnob()
72
+
73
+ self._knobTracker: StaticText = StaticText(parent=self, id=ID_ANY, label=f'{parameters.dialLabel}: 0', style=ALIGN_LEFT)
74
+
75
+ self._displayValue(value=parameters.minValue)
76
+
77
+ self.Bind(EVT_KC_ANGLE_CHANGED, self._onKnobChanged, self._knobCtrl)
78
+
79
+ @property
80
+ def tickFrequency(self) -> int | float:
81
+ return self._tickFrequency
82
+
83
+ @tickFrequency.setter
84
+ def tickFrequency(self, value: int):
85
+ """
86
+ The underlying control has a tick granularity of 100. Set a
87
+ value between 1 and 100
88
+
89
+ The underlying control computes the value of each tick
90
+
91
+ Args:
92
+ value: Indicates how to space out the tick marks
93
+ """
94
+ assert 1 <= value <= 100
95
+ self._tickFrequency = value
96
+ self._setTicksOnKnob()
97
+
98
+ @property
99
+ def tickValue(self) -> int | float:
100
+ return self._tickValue
101
+
102
+ @tickValue.setter
103
+ def tickValue(self, value: int | float):
104
+ self._tickValue = value
105
+ self._displayValue(value=value)
106
+
107
+ @property
108
+ def value(self) -> int | float:
109
+ """
110
+ The returned value is between the min/max values specified in the
111
+ dial range; It is modulo the specified tick frequency.
112
+ Returns: The current control value
113
+ """
114
+ return self._value
115
+
116
+ @value.setter
117
+ def value(self, newValue: int | float):
118
+
119
+ self._value = newValue
120
+
121
+ tickNumber: int = self._valueToTick(value=newValue)
122
+
123
+ self.logger.debug(f'{newValue=} {tickNumber=}')
124
+
125
+ self._knobCtrl.SetValue(tickNumber)
126
+ self._displayValue(newValue)
127
+
128
+ def _onKnobChanged(self, event: KnobCtrlEvent):
129
+
130
+ knobValue: int = event.GetValue()
131
+ roundedKnobValue: int = self._alignKnobToTick(knobValue=knobValue)
132
+ self._knobCtrl.SetValue(roundedKnobValue)
133
+
134
+ realValue = self._calculateRealValue(roundedKnobValue=roundedKnobValue,
135
+ tickValue=self._tickValue,
136
+ tickFrequency=self._tickFrequency)
137
+
138
+ self.logger.debug(f'realValue={realValue:.2f}')
139
+ self._displayValue(value=realValue)
140
+
141
+ self._value = realValue
142
+
143
+ self._parameters.valueChangedCallback(self._value)
144
+
145
+ event.Skip(skip=True)
146
+
147
+ def _alignKnobToTick(self, knobValue: int):
148
+
149
+ # TODO: This will be moved to codeallybasic
150
+ # Including the unit tests
151
+ #
152
+ def roundUpToNearestTick(valueToRound, boundaryValue: int) -> int:
153
+ return int(ceil(valueToRound / boundaryValue)) * boundaryValue
154
+
155
+ roundToIncrement: int = KNOB_CTRL_GRANULARITY // self._tickFrequency
156
+
157
+ roundedKnobValue: int = roundUpToNearestTick(valueToRound=knobValue, boundaryValue=roundToIncrement)
158
+
159
+ self.logger.info(f'{knobValue=} {roundedKnobValue=}')
160
+
161
+ return roundedKnobValue
162
+
163
+ def _setTicksOnKnob(self):
164
+ assert self._parameters is not None, 'Developer Error'
165
+ assert self._tickFrequency != 0, 'Developer Error'
166
+ assert self._knobCtrl is not None, 'Developer Error'
167
+
168
+ integerList: List[int] = list(range(1, self._tickFrequency, 1))
169
+
170
+ self.logger.debug(f'{integerList=}')
171
+ self._knobCtrl.SetTags(integerList)
172
+
173
+ def _displayValue(self, value: int | float):
174
+
175
+ label: str = self._parameters.formatValueCallback(value)
176
+
177
+ self._knobTracker.SetLabel(label)
178
+ self._knobTracker.Refresh()
179
+
180
+ def _calculateRealValue(self, roundedKnobValue: int, tickValue: int | float, tickFrequency: int):
181
+
182
+ tickPosition: int = int((roundedKnobValue / KNOB_CTRL_GRANULARITY) * tickFrequency)
183
+ self.logger.debug(f'{tickPosition=}')
184
+ realValue = tickValue * tickPosition
185
+
186
+ return realValue
187
+
188
+ def _valueToTick(self, value: int | float) -> int:
189
+
190
+ tickNumber: int = int(value // self._tickValue)
191
+
192
+ return tickNumber
@@ -98,6 +98,7 @@ class DualSpinnerControl(SizedStaticBox):
98
98
  self._spinner1.SetValue(spinnerValues.value1)
99
99
  self.dscLogger.info(f'range: {self._spinner0.GetRange()} - {self._spinner0.GetValue()=} {self._spinner1.GetValue()=}')
100
100
 
101
+ # noinspection PyTypeChecker
101
102
  spinnerValues = property(fset=_setSpinnerValues, doc='Write only property to initialize spinner values')
102
103
 
103
104
  def enableControls(self, value: bool):
@@ -0,0 +1,73 @@
1
+
2
+ from typing import Callable
3
+ from typing import List
4
+
5
+ from logging import Logger
6
+ from logging import getLogger
7
+
8
+ from dataclasses import dataclass
9
+
10
+ from wx.lib.sized_controls import SizedPanel
11
+
12
+ from codeallyadvanced.ui.widgets.DualSpinnerControl import DualSpinnerControl
13
+ from codeallyadvanced.ui.widgets.DualSpinnerControl import SpinnerValues
14
+
15
+
16
+ @dataclass
17
+ class MinMax:
18
+ minValue: int = 0
19
+ maxValue: int = 0
20
+
21
+ @classmethod
22
+ def deSerialize(cls, value: str) -> 'MinMax':
23
+
24
+ minMax: MinMax = MinMax()
25
+
26
+ values: List[str] = value.split(sep=',')
27
+
28
+ assert len(values) == 2, 'Incorrectly formatted min/max values'
29
+
30
+ try:
31
+ minMax.minValue = int(values[0])
32
+ minMax.maxValue = int(values[1])
33
+ except ValueError as ve:
34
+ print(f'MinMax - {ve}.')
35
+ minMax.minValue = 0
36
+ minMax.maxValue = 0
37
+
38
+ return minMax
39
+
40
+ def __str__(self):
41
+ return f'{self.minValue},{self.maxValue}'
42
+
43
+ def __repr__(self):
44
+ return self.__str__()
45
+
46
+
47
+ class MinMaxControl(DualSpinnerControl):
48
+ def __init__(self, sizedPanel: SizedPanel, displayText: str,
49
+ valueChangedCallback: Callable,
50
+ minValue: int, maxValue: int,
51
+ setControlsSize: bool = True):
52
+
53
+ self.logger: Logger = getLogger(__name__)
54
+
55
+ self._valuesChangedCallback: Callable = valueChangedCallback
56
+ self._minMax: MinMax = MinMax()
57
+
58
+ super().__init__(sizedPanel, displayText, self._onSpinValueChangedCallback, minValue, maxValue, setControlsSize)
59
+
60
+ def _setMinMax(self, newValue: MinMax):
61
+ self._position = newValue
62
+ self.spinnerValues = SpinnerValues(value0=newValue.minValue, value1=newValue.maxValue)
63
+
64
+ # noinspection PyTypeChecker
65
+ minMax = property(fdel=None, fget=None, fset=_setMinMax, doc='Write only property to set values')
66
+
67
+ def _onSpinValueChangedCallback(self, spinnerValues: SpinnerValues):
68
+
69
+ self.logger.info(f'{spinnerValues}')
70
+ self._minMax.minValue = spinnerValues.value0
71
+ self._minMax.maxValue = spinnerValues.value1
72
+
73
+ self._valuesChangedCallback(self._minMax)
@@ -14,7 +14,7 @@ from codeallyadvanced.ui.widgets.DualSpinnerControl import SpinnerValues
14
14
 
15
15
  class PositionControl(DualSpinnerControl):
16
16
  """
17
- A facade around the basic dual spinner control; Essentially
17
+ A facade around the basic dual-spinner control; Essentially
18
18
  * Converts the spinner values to and from the Position type;
19
19
  * Handles the spinner callback
20
20
  * Forwards the spinner values as Position values
@@ -47,7 +47,8 @@ class PositionControl(DualSpinnerControl):
47
47
  self._position = newValue
48
48
  self.spinnerValues = SpinnerValues(value0=newValue.x, value1=newValue.y)
49
49
 
50
- position = property(fset=_setPosition, doc='Write only property to set values')
50
+ # noinspection PyTypeChecker
51
+ position = property(fdel=None, fget=None, fset=_setPosition, doc='Write only property to set values')
51
52
 
52
53
  def _onSpinValueChangedCallback(self, spinnerValues: SpinnerValues):
53
54
  self.logger.info(f'{spinnerValues}')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codeallyadvanced
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: Humberto`s Common UI Stuff
5
5
  Author-email: "Humberto A. Sanchez II" <Humbert.A.Sanchez.II@gmail.com>
6
6
  Maintainer-email: "Humberto A. Sanchez II" <Humbert.A.Sanchez.II@gmail.com>
@@ -9,7 +9,7 @@ Project-URL: Repository, https://github.com/hasii2011/code-ally-advanced
9
9
  Keywords: pyut,python
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: codeallybasic>=1.1.0
12
+ Requires-Dist: codeallybasic>=1.2.0
13
13
  Requires-Dist: wxPython~=4.2.1
14
14
 
15
15
  ![](https://github.com/hasii2011/code-ally-basic/blob/master/developer/agpl-license-web-badge-version-2-256x48.png "AGPL")
@@ -24,11 +24,11 @@ Common UI artifacts for various projects I am developing
24
24
  Written by <a href="mailto:email@humberto.a.sanchez.ii@gmail.com?subject=Hello Humberto">Humberto A. Sanchez II</a> (C) 2023
25
25
 
26
26
  ## Note
27
- For all kind of problems, requests, enhancements, bug reports, etc.,
28
- please drop me an e-mail.
27
+ For all kinds of problems, requests, enhancements, bug reports, etc.,
28
+ drop me an e-mail.
29
29
 
30
30
  ## Developer Notes
31
- This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day to day development builds
31
+ This project uses [buildlackey](https://github.com/hasii2011/buildlackey) for day-to-day development builds
32
32
 
33
33
  ---
34
34
 
@@ -42,11 +42,11 @@ I urge you to read about the
42
42
  [Give up GitHub](https://GiveUpGitHub.org) campaign from
43
43
  [the Software Freedom Conservancy](https://sfconservancy.org).
44
44
 
45
- While I do not advocate for all the issues listed there I do not like that
45
+ While I do not advocate for all the issues listed there, I do not like that
46
46
  a company like Microsoft may profit from open source projects.
47
47
 
48
- I continue to use GitHub because it offers the services I need for free. But, I continue
49
- to monitor their terms of service.
48
+ I continue to use GitHub because it offers the services I need for free.
49
+ I continue to monitor their terms of service.
50
50
 
51
51
  Any use of this project's code by GitHub Copilot, past or present, is done
52
52
  without our permission. We do not consent to GitHub's use of this project's
@@ -73,9 +73,11 @@ src/codeallyadvanced/ui/Common.py
73
73
  src/codeallyadvanced/ui/UnitTestBaseW.py
74
74
  src/codeallyadvanced/ui/__init__.py
75
75
  src/codeallyadvanced/ui/py.typed
76
+ src/codeallyadvanced/ui/widgets/DialSelector.py
76
77
  src/codeallyadvanced/ui/widgets/DimensionsControl.py
77
78
  src/codeallyadvanced/ui/widgets/DirectionEnum.py
78
79
  src/codeallyadvanced/ui/widgets/DualSpinnerControl.py
80
+ src/codeallyadvanced/ui/widgets/MinMaxControl.py
79
81
  src/codeallyadvanced/ui/widgets/PositionControl.py
80
82
  src/codeallyadvanced/ui/widgets/__init__.py
81
83
  src/codeallyadvanced/ui/widgets/py.typed
@@ -0,0 +1,2 @@
1
+ codeallybasic>=1.2.0
2
+ wxPython~=4.2.1
@@ -1 +0,0 @@
1
- __version__: str = '1.1.0'
@@ -1,2 +0,0 @@
1
- codeallybasic>=1.1.0
2
- wxPython~=4.2.1