├── LICENSE
├── PySide2extn.egg-info
├── PKG-INFO
├── SOURCES.txt
├── dependency_links.txt
├── requires.txt
└── top_level.txt
├── PySide2extn
├── RoundProgressBar.py
├── SpiralProgressBar.py
├── __init__.py
├── demo
│ ├── __init__.py
│ └── demo.py
└── examples
│ ├── __init__.py
│ ├── rpb
│ ├── default.py
│ ├── direction.py
│ ├── initPos.py
│ ├── line.py
│ ├── maxRange.py
│ ├── path.py
│ ├── style.py
│ └── textAll.py
│ └── spb
│ ├── default.py
│ ├── direction.py
│ ├── hiddenpath.py
│ ├── initialPos.py
│ ├── linecolor,style,e.t.c.py
│ ├── main.py
│ ├── max,min,range.py
│ └── varWidthGap.py
├── README.md
├── assets
├── demo
│ └── rpb.PNG
├── fav
│ ├── android-chrome-192x192.png
│ ├── android-chrome-256x256.png
│ ├── apple-touch-icon.png
│ ├── browserconfig.xml
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── favicon.ico
│ ├── mstile-150x150.png
│ ├── safari-pinned-tab.svg
│ └── site.webmanifest
├── getstart
│ ├── qtdes1.PNG
│ ├── qtdes2.PNG
│ ├── qtdes3.PNG
│ ├── qtdes4.PNG
│ ├── qtdes5.PNG
│ └── qtdes6.PNG
├── logo.png
├── rpb.png
├── rpb
│ ├── 96.PNG
│ ├── circlecolor.PNG
│ ├── dashline.PNG
│ ├── defa.PNG
│ ├── dotline.PNG
│ ├── font.PNG
│ ├── hybrid2.PNG
│ ├── linecolor.PNG
│ ├── linwwidth.PNG
│ ├── pathcolor.PNG
│ ├── pathwidth.PNG
│ ├── pie.PNG
│ ├── pizza.PNG
│ ├── rpb.png
│ ├── rpb_cap.png
│ ├── rpb_circle.PNG
│ ├── rpb_demo.PNG
│ ├── rpb_demo2.PNG
│ ├── rpb_dir.png
│ ├── rpb_direction.PNG
│ ├── rpb_fifty.PNG
│ ├── rpb_fig.png
│ ├── rpb_initPos.png
│ ├── rpb_lineAll.PNG
│ ├── rpb_maxRange.PNG
│ ├── rpb_name.png
│ ├── rpb_pathAll.PNG
│ ├── rpb_percent.PNG
│ ├── rpb_pie.png
│ ├── rpb_sfifty.PNG
│ ├── rpb_strPos.PNG
│ ├── rpb_textall1.PNG
│ ├── rpb_textall2.PNG
│ ├── rpb_typ.png
│ ├── rpb_value.PNG
│ ├── south.PNG
│ └── textcolor.PNG
├── spb.png
└── spb
│ ├── spb_defEx.PNG
│ ├── spb_default.PNG
│ ├── spb_demo.png
│ ├── spb_direction.PNG
│ ├── spb_initialPos.PNG
│ ├── spb_initpod.png
│ ├── spb_line.PNG
│ ├── spb_minmaxrange.PNG
│ ├── spb_norm.png
│ ├── spb_order.png
│ ├── spb_pathvisible.PNG
│ ├── spb_schem.png
│ ├── spb_type.png
│ └── spb_variable.PNG
├── build
└── lib
│ └── PySide2extn
│ ├── RoundProgressBar.py
│ ├── SpiralProgressBar.py
│ ├── __init__.py
│ ├── demo
│ ├── __init__.py
│ └── demo.py
│ └── examples
│ └── __init__.py
├── dist
├── PySide2extn-1.0.0-py3-none-any.whl
└── PySide2extn-1.0.0.tar.gz
└── setup.py
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Anjal.P
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/PySide2extn.egg-info/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 2.1
2 | Name: PySide2extn
3 | Version: 1.0.0
4 | Summary: PySide2extn is an Open Source Python Programming language extension for PySide2, which greatly enhances the capability of the PySide2 library with extra widgets and more.
5 | Home-page: https://github.com/anjalp/PySide2extn
6 | Author: ANJAL.P
7 | Author-email: opensource.anj.official@gmail.com
8 | License: UNKNOWN
9 | Description: # PySide2extn
10 |
11 | An extension for the Python PySide2 Qt Framework which expands the scope of the PySide2 package with many different modern widgets. Current release is occupied with two widget which are not natively present in the PySide2 package.
12 |
13 | *RoundProgressBar*
14 |
15 |
16 |
17 |
18 |
19 | *SpiralProgressBar*
20 |
21 |
22 |
23 |
24 |
25 | :point_right: ​Go to [Home Page]() of Documentation for further Help
26 |
27 | ## Getting Started
28 |
29 | * Install PySide2extn using `pip`
30 |
31 | ``` python
32 | pip install PySide2extn
33 | ```
34 |
35 | * Build from source: After cloning the repo, go to the directory and open `cmd` or `terminal`
36 |
37 | ``` bash
38 | $ python3 setup.py sdist bdist_wheel
39 | ```
40 |
41 | * Install from `.whl` file.
42 |
43 | ```python
44 | pip install file
45 | ```
46 |
47 | To verify that installation is complete, print out the `pip list` and search for the PySide2extn package.
48 |
49 | :point_right: ​For more details go to the [Official PySide2extn Documentation Getting Started]()
50 |
51 | ## Quick Demo
52 |
53 | Quick demo help you to check weather you have successfully installed the Python Package. It comes with a UI loaded with all the widgets in this package with its different customized views. Users can easily differentiate the different styling elements used by widgets.
54 |
55 | After installing the PySide2extn/PyQt5extn the users can try out quick demo by:
56 |
57 | 1. Open the `cmd` or `terminal`. Open `Python`
58 |
59 | ```python
60 | >> from PySide2extn.demo import demo
61 | >> demo.main() #PRESS ENTER AND YOU WILL GET A DEMO APPLICATION
62 | ```
63 |
64 |
65 |
66 |
67 |
68 | ## Documentation
69 |
70 | Official Documentation for PySide2extn is detailed in: [PySide2extn Documentation]().
71 |
72 | :point_right: [Getting Started](​)
73 |
74 | :point_right: ​[Examples]()
75 |
76 | :point_right: [​Classes]()
77 |
78 | :point_right: [Errors and Exceptions](​)
79 |
80 | :point_right: [Version History]()
81 |
82 | :point_right: [FAQ's]()
83 |
84 | :point_right: [Official PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA)
85 |
86 | ## Examples
87 |
88 | * **Default Round Progress Bar**
89 |
90 | ```python
91 | import sys
92 | from PySide2 import QtCore, QtWidgets, QtGui
93 |
94 | from PySide2extn.RoundProgressBar import roundProgressBar #IMPORT THE EXTENSION LIBRARY
95 |
96 | x = 0
97 | p = 1
98 |
99 | class MyWidget(QtWidgets.QWidget):
100 | def __init__(self):
101 | QtWidgets.QWidget.__init__(self)
102 |
103 | self.hello = 'Round Progress Bar'
104 | self.button = QtWidgets.QPushButton("Click me to change Value")
105 | self.text = QtWidgets.QLabel("Round Progress Bar")
106 | self.text.setAlignment(QtCore.Qt.AlignCenter)
107 |
108 | #CREATING THE ROUND PROGRESS BAR OBJECT
109 | self.rpb = roundProgressBar()
110 |
111 | self.layout = QtWidgets.QVBoxLayout()
112 | self.layout.addWidget(self.text)
113 | self.layout.addWidget(self.button)
114 |
115 | # ADDING THE ROUND PROGRESS BAR OBJECT TO THE # BOTTOM OF THE LAYOUT
116 | self.layout.addWidget(self.rpb)
117 |
118 | self.setLayout(self.layout)
119 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
120 |
121 | def magic(self):
122 | global x, p
123 | x = x + 10*p
124 | if x==100:
125 | p = -1
126 | elif x==0:
127 | p = 1
128 | self.rpb.rpb_setValue(x) #CHANGING THE VALUE OF THE PROGRESS BAR
129 | out_text = 'Round Progress Bar: ' + str(x) + '%'
130 | self.text.setText(out_text)
131 |
132 | if __name__ == "__main__":
133 | app = QtWidgets.QApplication(sys.argv)
134 | widget = MyWidget()
135 | widget.show()
136 | sys.exit(app.exec_())
137 | ```
138 |
139 |
140 |
141 |
142 |
143 | In this demo, we first created an object of the Round Progress Bar:
144 |
145 | ```python
146 | self.rpb = roundProgressBar() #CREATING THE ROUND PROGRESS BAR OBJECT
147 | ```
148 |
149 | After that calling the Round Progress Bar object to display the value of progress using:
150 |
151 | ```python
152 | self.rpb.rpb_setValue(x) #CHANGING THE VALUE OF THE PROGRESS BAR
153 | ```
154 |
155 | The `rpb_setValue(value)` takes an `int` as an argument and updates to change the value of the progress bar to the value given.
156 |
157 | :point_right: ​For More examples on Round Progress Bar go to: [Official PySide2extn Documentation Examples]()
158 |
159 | * **Default Spiral Progress Bar**
160 |
161 | ```python
162 | import sys
163 | from PySide2 import QtCore, QtWidgets, QtGui
164 |
165 | #IMPORT THE EXTENSION LIBRARY
166 | from PySide2extn.SpiralProgressBar import spiralProgressBar
167 |
168 | x = 0
169 | p = 1
170 |
171 | class MyWidget(QtWidgets.QWidget):
172 | def __init__(self):
173 | QtWidgets.QWidget.__init__(self)
174 |
175 | self.hello = 'Spiral Progress Bar'
176 | self.button = QtWidgets.QPushButton("Click me to change Value")
177 | self.text = QtWidgets.QLabel("Spiral Progress Bar")
178 | self.text.setAlignment(QtCore.Qt.AlignCenter)
179 |
180 | #CREATING THE SPIRAL PROGRESS BAR OBJECT
181 | self.spb = spiralProgressBar()
182 |
183 | #ADDING WIDGETS TO THE VERTICAL LAYOUT
184 | self.layout = QtWidgets.QVBoxLayout()
185 | self.layout.addWidget(self.text)
186 | self.layout.addWidget(self.button)
187 |
188 | # ADDING THE SPIRAL PROGRESS BAR OBJECT TO THE LAYOUT
189 | self.layout.addWidget(self.spb)
190 |
191 | self.setLayout(self.layout)
192 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
193 |
194 | def magic(self):
195 | global x, p
196 | x = x + 10*p
197 | if x==100:
198 | p = -1
199 | elif x==0:
200 | p = 1
201 |
202 | #CHANGING THE VALUE OF THE 3 DEFAULT PROGRESS BAR
203 | self.spb.spb_setValue((x, x*2, x*3))
204 |
205 | out_text = 'Spiral Progress Bar: '
206 | out_text = out_text + str(x) + '%, ' + str(2*x) + '%, ' + str(3*x) + '%'
207 | self.text.setText(out_text)
208 |
209 | if __name__ == "__main__":
210 | app = QtWidgets.QApplication(sys.argv)
211 | widget = MyWidget()
212 | widget.show()
213 | sys.exit(app.exec_())
214 | ```
215 |
216 |
217 |
218 |
219 |
220 | - Here first create a spiralProgressBar object and then add the progress bar to a layout and control the steps of the progress bar by the clicking of the button.
221 |
222 | ```python
223 | self.spb = spiralProgressBar()
224 | ```
225 |
226 | - Here we create a spiralProgressBar object instance and then use the `self.spb` as the spiral progress bar to influence its charactor like:
227 |
228 | ```python
229 | self.spb.spb_setValue((x, x*2, x*3))
230 | ```
231 |
232 | - Since the default progress bar has 3 individual concentric circle, where each can be controlled individually, we pass a tuple containing the individual value for manipulating each concentric progress bar, to the function `spb_setValue()` , which only accepts a tuple of length equal to the number of concentric progress bar. Every function which can manipulate the properties of the Spiral Progress Bar uses the same idea. The order of entering the value are shown below:
233 |
234 |
235 |
236 |
237 |
238 | :point_right: ​For More examples on Spiral Progress Bar go to: [Official PySide2extn Documentation Examples]()
239 |
240 | ## Help
241 |
242 | - **PySide2extn/PyQt5extn is not working in my setup**: Go to Github [PySide2extn](http://localhost:4000/pages/help&support) repo. and raise an issue or just fill the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA).
243 | - **Unknown errors**: Raise a GitHub issue or fill the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA)
244 |
245 | ## Support
246 |
247 | - Please feel free to contribute to the project by sharing the idea you have, which is not natively present in the PySide2/PyQt5 but essential for your workflow.
248 | - You can fill up the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA) where you just Brief the idea you have and also provide an active email address which is required for us to connect you.
249 | - If your idea worth the use, then definitely it will be available in the next update of the PySide2extn/PyQt5extn.
250 | - If this package made your life easy, then please share your experience with us [Here](https://forms.gle/yfKVK85sLLMJMCfJA)
251 |
252 | :smiley: Support my work by forking or downloading this project, check it out, and [share the experience](https://forms.gle/yfKVK85sLLMJMCfJA).
253 |
254 | :smiley: Support like this motivates me to do more creative, work for Open Source.
255 |
256 |
257 | Platform: UNKNOWN
258 | Classifier: Development Status :: 5 - Production/Stable
259 | Classifier: Intended Audience :: Developers
260 | Classifier: Programming Language :: Python :: 3.5
261 | Classifier: Programming Language :: Python :: 3.6
262 | Classifier: Programming Language :: Python :: 3.7
263 | Classifier: Programming Language :: Python :: 3.8
264 | Classifier: Programming Language :: Python :: 3.9
265 | Classifier: License :: OSI Approved :: MIT License
266 | Classifier: Operating System :: OS Independent
267 | Requires-Python: >=3.6
268 | Description-Content-Type: text/markdown
269 |
--------------------------------------------------------------------------------
/PySide2extn.egg-info/SOURCES.txt:
--------------------------------------------------------------------------------
1 | README.md
2 | setup.py
3 | PySide2extn/RoundProgressBar.py
4 | PySide2extn/SpiralProgressBar.py
5 | PySide2extn/__init__.py
6 | PySide2extn.egg-info/PKG-INFO
7 | PySide2extn.egg-info/SOURCES.txt
8 | PySide2extn.egg-info/dependency_links.txt
9 | PySide2extn.egg-info/requires.txt
10 | PySide2extn.egg-info/top_level.txt
11 | PySide2extn/demo/__init__.py
12 | PySide2extn/demo/demo.py
13 | PySide2extn/examples/__init__.py
--------------------------------------------------------------------------------
/PySide2extn.egg-info/dependency_links.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/PySide2extn.egg-info/requires.txt:
--------------------------------------------------------------------------------
1 | PySide2
2 |
--------------------------------------------------------------------------------
/PySide2extn.egg-info/top_level.txt:
--------------------------------------------------------------------------------
1 | PySide2extn
2 |
--------------------------------------------------------------------------------
/PySide2extn/RoundProgressBar.py:
--------------------------------------------------------------------------------
1 | #############################################################################################
2 | # CREATOR: ANJAL.P #
3 | # ON: 2020 SEP. #
4 | # AIM: To Extend the capability of the PySide2 and PyQt5 Python library with easy to #
5 | # use extension containing commonly used widgets which is not natively supported #
6 | # by the Qt Frame work (or atleast for Python version of Qt). #
7 | # VERSION: v1.0.0 #
8 | # NOTES: CLASS : RoundProgressBar : Can be accessed by : importing #
9 | # from PySide2extn.RoundProgressBar import roundProgressBar #
10 | # REFER: Github: https://github.com/anjalp/PySide2extn #
11 | #############################################################################################
12 |
13 |
14 | from PySide2 import QtWidgets, QtCore
15 | from PySide2.QtCore import Qt, QSize
16 | from PySide2.QtGui import QBrush, QColor, QPainter, QPen, QPaintEvent, QFont
17 |
18 |
19 | class roundProgressBar(QtWidgets.QWidget):
20 |
21 | def __init__(self, parent=None):
22 | super(roundProgressBar, self).__init__(parent)
23 |
24 | self.positionX = 0
25 | self.positionY = 0
26 | self.posFactor = 0
27 |
28 | self.rpb_minimumSize = (0, 0)
29 | self.rpb_maximumSize = (0, 0)
30 | self.rpb_dynamicMin = True
31 | self.rpb_dynamicMax = True
32 | self.rpb_Size = 0
33 | self.sizeFactor = 0
34 |
35 | self.rpb_maximum = 100
36 | self.rpb_minimum = 0
37 |
38 | self.rpb_type = self.barStyleFlags.Donet
39 | self.startPosition = self.startPosFlags.North
40 | self.rpb_direction = self.rotationFlags.Clockwise
41 |
42 | self.rpb_textType = self.textFlags.Percentage
43 | self.rpb_textColor = (0, 159, 227)
44 | self.rpb_textWidth = self.rpb_Size/8
45 | self.rpb_textFont = 'Segoe UI'
46 | self.rpb_textValue = '12%'
47 | self.rpb_textRatio = 8
48 | self.textFactorX = 0
49 | self.textFactorY = 0
50 | self.dynamicText = True
51 | self.rpb_textActive = True
52 |
53 | self.lineWidth = 5
54 | self.pathWidth = 5
55 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
56 | self.rpb_lineCap = self.lineCapFlags.SquareCap
57 | self.lineColor = (0, 159, 227)
58 | self.pathColor = (218, 218, 218)
59 |
60 | self.rpb_circleColor = (218, 218, 218)
61 | self.rpb_circleRatio = 0.8
62 | self.rpb_circlePosX = 0
63 | self.rpb_circlePosY = 0
64 |
65 | self.rpb_pieColor = (200, 200, 200)
66 | self.rpb_pieRatio = 1
67 | self.rpb_piePosX = 0
68 | self.rpb_piePosY = 0
69 |
70 | self.rpb_value = -45*16
71 |
72 | if self.rpb_dynamicMin:
73 | self.setMinimumSize(QSize(self.lineWidth*6 + self.pathWidth*6, self.lineWidth*6 + self.pathWidth*6))
74 |
75 | #------------------------------------------------------CLASS ENUMERATORS
76 | class lineStyleFlags:
77 | SolidLine = Qt.SolidLine
78 | DotLine = Qt.DotLine
79 | DashLine = Qt.DashLine
80 |
81 | class lineCapFlags:
82 | SquareCap = Qt.SquareCap
83 | RoundCap = Qt.RoundCap
84 |
85 | class barStyleFlags:
86 | Donet = 0
87 | Line = 1
88 | Pie = 2
89 | Pizza = 3
90 | Hybrid1 = 4
91 | Hybrid2 = 5
92 |
93 | class rotationFlags:
94 | Clockwise = -1
95 | AntiClockwise = 1
96 |
97 | class textFlags:
98 | Value = 0
99 | Percentage = 1
100 |
101 | class startPosFlags:
102 | North = 90*16
103 | South = -90*16
104 | East = 0*16
105 | West = 180*16
106 |
107 | #------------------------------------------------------METHODS FOR CHANGING THE PROPERTY OF THE ROUNDPROGRESSBAR :SOLTS
108 |
109 | def rpb_setMinimumSize(self, width, height):
110 | """
111 | Minimum Size of the Widget
112 | ...
113 |
114 | Parameters
115 | --------------
116 |
117 | width : int
118 | width of the Widget
119 |
120 | height : int
121 | height of the Widget
122 |
123 | Raises
124 | --------------
125 | Exception : Sorry Width/Height should be an int
126 | """
127 |
128 | if type(width)!=type(5) or type(height)!=type(5):
129 | raise Exception('Sorry Width/Height should be an int')
130 | return
131 | self.rpb_dynamicMin = False
132 | self.setMinimumSize(width, height)
133 | self.rpb_minimumSize = (width, height)
134 | self.update()
135 |
136 | def rpb_setMaximumSize(self, width, height):
137 | """
138 | Maximum Size of the Widget
139 | ...
140 |
141 | Parameters
142 | --------------
143 |
144 | width : int
145 | width of the Widget
146 |
147 | height : int
148 | height of the Widget
149 |
150 | Raises
151 | --------------
152 | Exception : Sorry Width/Height should be an int
153 | """
154 |
155 | if type(width)!=type(5) or type(height)!=type(5):
156 | raise Exception('Sorry Width/Height should be an int')
157 | return
158 | self.rpb_dynamicMax = False
159 | self.setMaximumSize(width, height)
160 | self.rpb_maximumSize = (width, height)
161 | self.update()
162 |
163 |
164 | def rpb_setMaximum(self, maximum):
165 | """
166 | Maximum Value of the Progressbar
167 | ...
168 |
169 | Parameters
170 | --------------
171 |
172 | maximum : int
173 | Maximum value of the round progress bar
174 |
175 | Raises
176 | --------------
177 | Exception : Maximum and Minimum cannot be the Same
178 | """
179 |
180 | if self.rpb_minimum==maximum: #FOR AVOIDING DIVISION BY ZERO ERROR IN FUTURE
181 | raise Exception("Maximum and Minimum cannot be the Same")
182 | return
183 | if self.rpb_maximum != maximum:
184 | self.rpb_maximum = maximum
185 | self.update()
186 |
187 | def rpb_setMinimum(self, minimum):
188 | """
189 | Minimum Value of the Progressbar
190 | ...
191 |
192 | Parameters
193 | --------------
194 |
195 | minimum : int
196 | Minimum value of the round progress bar
197 |
198 | Raises
199 | --------------
200 | Exception : Maximum and Minimum cannot be the Same
201 | """
202 |
203 | if self.rpb_minimum==maximum: #FOR AVOIDING DIVISION BY ZERO ERROR IN FUTURE
204 | raise Exception("Maximum and Minimum cannot be the Same")
205 | return
206 | if self.rpb_minimum != minimum:
207 | self.rpb_minimum = minimum
208 | self.update()
209 |
210 | def rpb_setRange(self, maximum, minimum):
211 | """
212 | Range include the maximum and the minimum in one go.
213 | ...
214 |
215 | Parameters
216 | --------------
217 |
218 | maximum : int
219 | Maximum value of the round progress bar
220 |
221 | minimum : int
222 | Minimum value for the round progress bar
223 |
224 | Raises
225 | --------------
226 | none
227 | """
228 |
229 | if minimum > maximum:
230 | maximum, minimum = minimum, maximum
231 | if self.rpb_maximum != maximum:
232 | self.rpb_maximum = maximum
233 | if self.rpb_minimum != minimum:
234 | self.rpb_minimum = minimum
235 | self.update()
236 |
237 | def rpb_setInitialPos(self, pos):
238 | """
239 | Starting position of the round progress bar
240 | ...
241 |
242 | Parameters
243 | --------------
244 |
245 | pos : String
246 | Position string: 'North', 'South', 'East' and 'West'
247 |
248 | Raises
249 | --------------
250 | ValueError : Maximum and Minimum cannot be the Same
251 | """
252 |
253 | if pos=='North':
254 | self.startPosition = self.startPosFlags.North
255 | elif pos=='South':
256 | self.startPosition = self.startPosFlags.South
257 | elif pos=='East':
258 | self.startPosition = self.startPosFlags.East
259 | elif pos=='West':
260 | self.startPosition = self.startPosFlags.West
261 | else:
262 | raise Exception("Initial Position String can be: 'South', 'North'")
263 | return
264 |
265 | def rpb_setValue(self, value):
266 | """
267 | Set progress value
268 | ...
269 |
270 | Parameters
271 | --------------
272 |
273 | value : int
274 | The value of the progress bar in int. The value should be: min<=value<=max
275 |
276 | Raises
277 | --------------
278 | none
279 | """
280 |
281 | if self.rpb_value != value:
282 | if value >= self.rpb_maximum:
283 | roundProgressBar.convertInputValue(self, self.rpb_maximum)
284 | elif value < self.rpb_minimum:
285 | roundProgressBar.convertInputValue(self, self.rpb_minimum)
286 | else:
287 | roundProgressBar.convertInputValue(self, value)
288 | self.update()
289 |
290 | def rpb_reset(self):
291 | """
292 | Reset the progress bar to 0%
293 | ...
294 |
295 | Parameters
296 | --------------
297 | none
298 |
299 | Raises
300 | --------------
301 | none
302 | """
303 |
304 | roundProgressBar.convertInputValue(self, self.rpb_minimum)
305 | self.update()
306 |
307 | def rpb_setGeometry(self, posX, posY):
308 | """
309 | Set the X and Y position of the round progress bar.
310 | ...
311 |
312 | Parameters
313 | --------------
314 |
315 | posX : int
316 | The position of the round progress bar in int for X axis.
317 |
318 | posY : int
319 | The position of the round progress bar in int for Y axis.
320 |
321 | Raises
322 | --------------
323 | none
324 | """
325 |
326 | if self.positionX != posX:
327 | self.positionX = posX
328 | if self.positionY != posY:
329 | self.positionY = posY
330 | self.update()
331 |
332 | def rpb_setLineWidth(self, width):
333 | """
334 | Line Width of the line in round progress bar.
335 | ...
336 |
337 | Parameters
338 | --------------
339 |
340 | width: int
341 | Line width corresponding to the width in px.
342 |
343 | Raises
344 | --------------
345 | Exception: Line Width should be in int
346 | """
347 |
348 | if type(width)!=type(5):
349 | raise Exception('Line Width should be in int')
350 | return
351 | if self.lineWidth != width:
352 | self.lineWidth = width
353 | self.update()
354 |
355 | def rpb_setLineColor(self, rgb):
356 | """
357 | Line Color of the progress bar.
358 | ...
359 |
360 | Parameters
361 | --------------
362 |
363 | rgb: tuple: (R, G, B)
364 | Color is passed as a tuple of values for red, blue and green in the order: (R, G, B)
365 |
366 | Raises
367 | --------------
368 | Exception: Line Color accepts a tuple: (R, G, B).
369 | """
370 |
371 | if type(rgb)!=type(()):
372 | raise Exception("Line Color accepts a tuple: (R, G, B).")
373 | return
374 | if self.lineColor != rgb:
375 | self.lineColor = rgb
376 | self.update()
377 |
378 | def rpb_setPathColor(self, rgb):
379 | """
380 | Path Color settings.
381 | ...
382 |
383 | Parameters
384 | --------------
385 |
386 | rgb: tuple: (R, G, B)
387 | Color is passed as a tuple of values for red, blue and green in the order: (R, G, B)
388 |
389 | Raises
390 | --------------
391 | Exception: Path Color accepts a tuple: (R, G, B).
392 | """
393 |
394 | if type(rgb)!=type(()):
395 | raise Exception("Path Color accepts a tuple: (R, G, B).")
396 | return
397 | if self.pathColor != rgb:
398 | self.pathColor = rgb
399 | self.update()
400 |
401 | def rpb_setPathWidth(self, width):
402 | """
403 | Path width settings.
404 | ...
405 |
406 | Parameters
407 | --------------
408 |
409 | width: int
410 | Width of the path in px
411 |
412 | Raises
413 | --------------
414 | Exception: Line Width should be in int
415 | """
416 |
417 | if type(width)!=type(5):
418 | raise Exception('Path Width should be in int')
419 | return
420 | if self.pathWidth != width:
421 | self.pathWidth = width
422 | self.update()
423 |
424 | def rpb_setDirection(self, direction):
425 | """
426 | Direction of rotation of the progress bar.
427 | ...
428 |
429 | Parameters
430 | --------------
431 |
432 | direction: string
433 | string can be: 'AntiClockwise' or 'Clockwise'. Default: 'Clockwise'.
434 |
435 | Raises
436 | --------------
437 | Exception: Direction can only be: 'Clockwise' and 'AntiClockwise'
438 | """
439 |
440 | if direction == 'Clockwise' or direction == -1:
441 | self.rpb_direction = self.rotationFlags.Clockwise
442 | elif direction == 'AntiClockwise' or direction == 1:
443 | self.rpb_direction = self.rotationFlags.AntiClockwise
444 | else:
445 | raise Exception("Direction can only be: 'Clockwise' and 'AntiClockwise' and Not: " + str(direction))
446 | return
447 | self.update()
448 |
449 | def rpb_setBarStyle(self, style):
450 | """
451 | Bar Style of the progress bar.
452 | ...
453 |
454 | Parameters
455 | --------------
456 |
457 | style: String
458 | String of the styles of the progress bar: 'Donet', 'Pie', 'line', 'Hybrid1', 'Hybrid2', 'Pizza'
459 |
460 | Raises
461 | --------------
462 | Exception: Round Progress Bar has only the following styles: 'Line', 'Donet', 'Hybrid1', 'Pizza', 'Pie' and 'Hybrid2'
463 | """
464 |
465 | if style=='Donet':
466 | self.rpb_type = self.barStyleFlags.Donet
467 | elif style=='Line':
468 | self.rpb_type = self.barStyleFlags.Line
469 | elif style=='Pie':
470 | self.rpb_type = self.barStyleFlags.Pie
471 | elif style=='Pizza':
472 | self.rpb_type = self.barStyleFlags.Pizza
473 | elif style=='Hybrid1':
474 | self.rpb_type = self.barStyleFlags.Hybrid1
475 | elif style=='Hybrid2':
476 | self.rpb_type = self.barStyleFlags.Hybrid2
477 | else:
478 | raise Exception("Round Progress Bar has only the following styles: 'Line', 'Donet', 'Hybrid1', 'Pizza', 'Pie' and 'Hybrid2'")
479 | return
480 | self.update()
481 |
482 | def rpb_setLineStyle(self, style):
483 | """
484 | Line Style setting.
485 | ...
486 |
487 | Parameters
488 | --------------
489 |
490 | style: String
491 | Line style: 'DotLine', 'DashLine', 'SolidLine', passed as a string.
492 |
493 | Raises
494 | --------------
495 | none
496 | """
497 |
498 | if style == 'SolidLine':
499 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
500 | elif style == 'DotLine':
501 | self.rpb_lineStyle = self.lineStyleFlags.DotLine
502 | elif style == 'DashLine':
503 | self.rpb_lineStyle = self.lineStyleFlags.DashLine
504 | else:
505 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
506 |
507 | def rpb_setLineCap(self, cap):
508 | """
509 | Line Cap setting.
510 | ...
511 |
512 | Parameters
513 | --------------
514 |
515 | cap: String
516 | Cap is the end point of a stroke. It can be: 'RoundCap' or 'SquareCap'
517 |
518 | Raises
519 | --------------
520 | none
521 | """
522 |
523 | if cap=='SquareCap':
524 | self.rpb_lineCap = self.lineCapFlags.SquareCap
525 | elif cap == 'RoundCap':
526 | self.rpb_lineCap = self.lineCapFlags.RoundCap
527 |
528 | def rpb_setTextColor(self, rgb):
529 | """
530 | Text color of the text inside the progress bar
531 | ...
532 |
533 | Parameters
534 | --------------
535 |
536 | rgb: tuple
537 | Color of the text in the format: (R, G, B)
538 |
539 | Raises
540 | --------------
541 | none
542 | """
543 |
544 | if self.rpb_textColor != rgb:
545 | self.rpb_textColor = rgb
546 | self.update()
547 |
548 | def rpb_setTextFont(self, font):
549 | """
550 | Font of the text inside the round progress bar
551 | ...
552 |
553 | Parameters
554 | --------------
555 |
556 | font: str
557 | Name of the font in string
558 |
559 | Raises
560 | --------------
561 | none
562 | """
563 |
564 | if self.rpb_textFont != font:
565 | self.rpb_textFont = font
566 | self.update()
567 |
568 | def rpb_setTextFormat(self, textTyp):
569 | """
570 | Text formatter i.e. the value or the percentage.
571 | ...
572 |
573 | Parameters
574 | --------------
575 |
576 | textTyp: str
577 | 'value', 'percentage'
578 |
579 | Raises
580 | --------------
581 | none
582 | """
583 |
584 | if textTyp == 'Value':
585 | self.rpb_textType = self.textFlags.Value
586 | elif textTyp == 'Percentage':
587 | self.rpb_textType = self.textFlags.Percentage
588 | else:
589 | self.rpb_textType = self.textFlags.Percentage
590 |
591 | def rpb_setTextRatio(self, ratio):
592 | """
593 | Text ratio with respect to the size of the progress bar.
594 | ...
595 |
596 | Parameters
597 | --------------
598 |
599 | ratio: int
600 | In number from 3 to 50 corresponding to 1/3 or 1/50 the size of the roundprogressbar.
601 |
602 | Raises
603 | --------------
604 | none
605 | """
606 |
607 | if self.rpb_textRatio != ratio:
608 | if ratio < 3:
609 | ratio = 3
610 | elif ratio > 50:
611 | ratio = 50
612 | self.rpb_textRatio = ratio
613 | self.update()
614 |
615 | def rpb_setTextWidth(self, width):
616 | """
617 | Text Width.
618 | ...
619 |
620 | Parameters
621 | --------------
622 |
623 | font: int
624 | Text constant width. Will not change during the widget resize.
625 |
626 | Raises
627 | --------------
628 | none
629 | """
630 |
631 | self.dynamicText = False
632 | if width > 0:
633 | self.rpb_textWidth = width
634 | self.update()
635 |
636 | def rpb_setCircleColor(self, rgb):
637 | """
638 | Circle color fill inside the circle.
639 | ...
640 |
641 | Parameters
642 | --------------
643 |
644 | font: tuple
645 | The color of the circle in the tuple corresponding to the (R, G, B).
646 |
647 | Raises
648 | --------------
649 | none
650 | """
651 |
652 | if self.rpb_circleColor != rgb:
653 | self.rpb_circleColor = rgb
654 | self.update()
655 |
656 | def rpb_setCircleRatio(self, ratio):
657 | """
658 | Circle ration corresponding to the round progress bar.
659 | ...
660 |
661 | Parameters
662 | --------------
663 |
664 | font: int
665 | Integer corresponding to the size of the progress bar to that of the round progress bar.
666 |
667 | Raises
668 | --------------
669 | none
670 | """
671 |
672 | if self.rpb_circleRatio != ratio:
673 | self.rpb_circleRatio = ratio
674 | self.update()
675 |
676 | def rpb_setPieColor(self, rgb):
677 | """
678 | Pie color inside the fill.
679 | ...
680 |
681 | Parameters
682 | --------------
683 |
684 | font: tuple
685 | Tuple consist in format (R, G, B). Same as color setting to Line.
686 |
687 | Raises
688 | --------------
689 | none
690 | """
691 |
692 | if self.rpb_pieColor != rgb:
693 | self.rpb_pieColor = rgb
694 | self.update()
695 |
696 | def rpb_setPieRatio(self, ratio):
697 | """
698 | Pie Ratio
699 | ...
700 |
701 | Parameters
702 | --------------
703 |
704 | font: int
705 | Ratio corresponding to the size between the roundprogressbar and the pie size.
706 |
707 | Raises
708 | --------------
709 | none
710 | """
711 |
712 | if self.rpb_pieRatio != ratio:
713 | self.rpb_pieRatio = ratio
714 | self.update()
715 |
716 | def rpb_enableText(self, enable):
717 | """
718 | Makes the Text visible/Hidden
719 | ...
720 |
721 | Parameters
722 | --------------
723 |
724 | font: bool
725 | True: Text visible, False: Text invisible.
726 |
727 | Raises
728 | --------------
729 | none
730 | """
731 |
732 | if enable:
733 | self.rpb_textActive = enable
734 | else:
735 | self.rpb_textActive = enable
736 | self.update()
737 |
738 |
739 | #------------------------------------------------------METHODS FOR GETTING THE PROPERTY OF ROUNDPROGRESSBAR SLOTS
740 |
741 | def rpb_getSize(self):
742 | """
743 | Get the present size of the progress bar.
744 | ...
745 |
746 | Returns
747 | --------------
748 | Return the size of the round progress bar in int.
749 | """
750 |
751 | return self.rpb_Size
752 |
753 | def rpb_getValue(self):
754 | """
755 | Present value of the progress bar.
756 | ...
757 |
758 | Returns
759 | --------------
760 | int corresponding to the present progress bar value.
761 | """
762 |
763 | return self.rpb_value/16
764 |
765 | def rpb_getRange(self):
766 | """
767 | Progress bar range.
768 | ...
769 |
770 | Returns
771 | --------------
772 | tuple consisting of minimu and maximum as elements.
773 | """
774 |
775 | return (self.rpb_minimum, self.rpb_maximum)
776 |
777 | def rpb_getTextWidth(self):
778 | """
779 | Text width of the present text in the central of the widget.
780 | ...
781 |
782 | Returns
783 | --------------
784 | int corresponding to the width of the text
785 | """
786 |
787 | return self.rpb_textWidth
788 |
789 | #------------------------------------------------------ENGINE: WHERE ALL THE REAL STUFF TAKE PLACE: WORKING OF THE ROUNDPROGRESSBA
790 |
791 | def rpb_MinimumSize(self, dynamicMax, minimum, maximum):
792 | """
793 | Minimum size calculating code: Takes consideration of the width of the line/path/circle/pie and the user defined
794 | width and also the size of the frame/window of the application.
795 |
796 | """
797 |
798 | rpb_Height = self.height()
799 | rpb_Width = self.width()
800 | if dynamicMax:
801 | if rpb_Width >= rpb_Height and rpb_Height >= minimum[1]:
802 | self.rpb_Size = rpb_Height
803 | elif rpb_Width < rpb_Height and rpb_Width >= minimum[0]:
804 | self.rpb_Size = rpb_Width
805 | else:
806 | if rpb_Width >= rpb_Height and rpb_Height <= maximum[1]:
807 | self.rpb_Size = rpb_Height
808 | elif rpb_Width < rpb_Height and rpb_Width <= maximum[0]:
809 | self.rpb_Size = rpb_Width
810 |
811 | def convertInputValue(self, value):
812 | """
813 | CONVERTS ANY INPUT VALUE TO THE 0*16-360*16 DEGREE REFERENCE OF THE QPainter.drawArc NEEDED.
814 |
815 | """
816 |
817 | self.rpb_value = ((value - self.rpb_minimum)/(self.rpb_maximum - self.rpb_minimum))*360*16
818 | self.rpb_value = self.rpb_direction*self.rpb_value
819 | if self.rpb_textType==roundProgressBar.textFlags.Percentage:
820 | self.rpb_textValue = str(round(((value - self.rpb_minimum)/(self.rpb_maximum - self.rpb_minimum))*100)) + "%"
821 | else:
822 | self.rpb_textValue = str(value)
823 |
824 | #SINCE THE THICKNESS OF THE LINE OR THE PATH CAUSES THE WIDGET TO WRONGLY FIT INSIDE THE SIZE OF THE WIDGET DESIGNED IN THE
825 | #QTDESIGNER, THE CORRECTION FACTOR IS NECESSERY CALLED THE GEOMETRYFACTOR, WHICH CALCULATE THE TWO FACTORS CALLED THE
826 | #self.posFactor AND THE self.sizeFactor, CALCULATION THIS IS NECESSERY AS THE
827 | def geometryFactor(self):
828 | if self.lineWidth > self.pathWidth:
829 | self.posFactor = self.lineWidth/2 + 1
830 | self.sizeFactor = self.lineWidth + 1
831 | else:
832 | self.posFactor = self.pathWidth/2 + 1
833 | self.sizeFactor = self.pathWidth + 1
834 |
835 | def rpb_textFactor(self):
836 | if self.dynamicText:
837 | self.rpb_textWidth = self.rpb_Size/self.rpb_textRatio
838 | self.textFactorX = self.posFactor + (self.rpb_Size - self.sizeFactor)/2 - self.rpb_textWidth*0.75*(len(self.rpb_textValue)/2)
839 | self.textFactorY = self.rpb_textWidth/2 + self.rpb_Size/2
840 |
841 | def rpb_circleFactor(self):
842 | self.rpb_circlePosX = self.positionX + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_circleRatio))/2
843 | self.rpb_circlePosY = self.positionY + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_circleRatio))/2
844 |
845 | def rpb_pieFactor(self):
846 | self.rpb_piePosX = self.positionX + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_pieRatio))/2
847 | self.rpb_piePosY = self.positionY + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_pieRatio))/2
848 |
849 |
850 |
851 | def paintEvent(self, event: QPaintEvent):
852 |
853 | #THIS BELOW CODE AMKE SURE THAT THE SIZE OF THE ROUNDPROGRESSBAR DOESNOT REDUCES TO ZERO WHEN THE USER RESIZES THE WINDOW
854 | if self.rpb_dynamicMin:
855 | self.setMinimumSize(QSize(self.lineWidth*6 + self.pathWidth*6, self.lineWidth*6 + self.pathWidth*6))
856 |
857 | roundProgressBar.rpb_MinimumSize(self, self.rpb_dynamicMax, self.rpb_minimumSize, self.rpb_maximumSize)
858 | roundProgressBar.geometryFactor(self)
859 | roundProgressBar.rpb_textFactor(self)
860 | roundProgressBar.rpb_circleFactor(self)
861 | roundProgressBar.rpb_pieFactor(self)
862 |
863 | if self.rpb_type==0: #DONET TYPE
864 | roundProgressBar.pathComponent(self)
865 | roundProgressBar.lineComponent(self)
866 | roundProgressBar.textComponent(self)
867 | elif self.rpb_type==1: #LINE TYPE
868 | roundProgressBar.lineComponent(self)
869 | roundProgressBar.textComponent(self)
870 | elif self.rpb_type==2: #Pie
871 | roundProgressBar.pieComponent(self)
872 | roundProgressBar.textComponent(self)
873 | elif self.rpb_type==3: #PIZZA
874 | roundProgressBar.circleComponent(self)
875 | roundProgressBar.lineComponent(self)
876 | roundProgressBar.textComponent(self)
877 | elif self.rpb_type==4: #HYBRID1
878 | roundProgressBar.circleComponent(self)
879 | roundProgressBar.pathComponent(self)
880 | roundProgressBar.lineComponent(self)
881 | roundProgressBar.textComponent(self)
882 | elif self.rpb_type==5: #HYBRID2
883 | roundProgressBar.pieComponent(self)
884 | roundProgressBar.lineComponent(self)
885 | roundProgressBar.textComponent(self)
886 |
887 |
888 | def lineComponent(self):
889 | linePainter = QPainter(self)
890 | linePainter.setRenderHint(QPainter.Antialiasing)
891 | penLine = QPen()
892 | penLine.setStyle(self.rpb_lineStyle)
893 | penLine.setWidth(self.lineWidth)
894 | penLine.setBrush(QColor(self.lineColor[0], self.lineColor[1], self.lineColor[2]))
895 | penLine.setCapStyle(self.rpb_lineCap)
896 | penLine.setJoinStyle(Qt.RoundJoin)
897 | linePainter.setPen(penLine)
898 | linePainter.drawArc(self.positionX + self.posFactor, self.positionY + self.posFactor, self.rpb_Size - self.sizeFactor, self.rpb_Size - self.sizeFactor, self.startPosition, self.rpb_value)
899 | linePainter.end()
900 |
901 | def pathComponent(self):
902 | pathPainter = QPainter(self)
903 | pathPainter.setRenderHint(QPainter.Antialiasing)
904 | penPath = QPen()
905 | penPath.setStyle(Qt.SolidLine)
906 | penPath.setWidth(self.pathWidth)
907 | penPath.setBrush(QColor(self.pathColor[0], self.pathColor[1], self.pathColor[2]))
908 | penPath.setCapStyle(Qt.RoundCap)
909 | penPath.setJoinStyle(Qt.RoundJoin)
910 | pathPainter.setPen(penPath)
911 | pathPainter.drawArc(self.positionX + self.posFactor, self.positionY + self.posFactor, self.rpb_Size - self.sizeFactor, self.rpb_Size - self.sizeFactor, 0, 360*16)
912 | pathPainter.end()
913 |
914 | def textComponent(self):
915 | if self.rpb_textActive:
916 | textPainter = QPainter(self)
917 | penText = QPen()
918 | penText.setColor(QColor(self.rpb_textColor[0], self.rpb_textColor[1], self.rpb_textColor[2]))
919 | textPainter.setPen(penText)
920 | fontText = QFont()
921 | fontText.setFamily(self.rpb_textFont)
922 | fontText.setPointSize(self.rpb_textWidth)
923 | textPainter.setFont(fontText)
924 | textPainter.drawText(self.positionX + self.textFactorX, self.positionY + self.textFactorY, self.rpb_textValue)
925 | textPainter.end()
926 |
927 | def circleComponent(self):
928 | circlePainter = QPainter(self)
929 | penCircle = QPen()
930 | penCircle.setWidth(0)
931 | penCircle.setColor(QColor(self.rpb_circleColor[0], self.rpb_circleColor[1], self.rpb_circleColor[2]))
932 | circlePainter.setRenderHint(QPainter.Antialiasing)
933 | circlePainter.setPen(penCircle)
934 | circlePainter.setBrush(QColor(self.rpb_circleColor[0], self.rpb_circleColor[1], self.rpb_circleColor[2]))
935 | circlePainter.drawEllipse(self.rpb_circlePosX, self.rpb_circlePosY, (self.rpb_Size - self.sizeFactor)*self.rpb_circleRatio, (self.rpb_Size - self.sizeFactor)*self.rpb_circleRatio)
936 |
937 | def pieComponent(self):
938 | piePainter = QPainter(self)
939 | penPie = QPen()
940 | penPie.setWidth(0)
941 | penPie.setColor(QColor(self.rpb_pieColor[0], self.rpb_pieColor[1], self.rpb_pieColor[2]))
942 | piePainter.setRenderHint(QPainter.Antialiasing)
943 | piePainter.setPen(penPie)
944 | piePainter.setBrush(QColor(self.rpb_pieColor[0], self.rpb_pieColor[1], self.rpb_pieColor[2]))
945 | piePainter.drawPie(self.rpb_piePosX, self.rpb_piePosY, (self.rpb_Size - self.sizeFactor)*self.rpb_pieRatio, (self.rpb_Size - self.sizeFactor)*self.rpb_pieRatio, self.startPosition, self.rpb_value)
946 |
947 |
948 | #------------------------------------------------------
949 |
950 | if __name__=="__main__":
951 | print("Try Import.")
--------------------------------------------------------------------------------
/PySide2extn/SpiralProgressBar.py:
--------------------------------------------------------------------------------
1 | #############################################################################################
2 | # CREATOR: ANJAL.P #
3 | # ON: 2020 NOV. #
4 | # AIM: To Extend the capability of the PySide2 and PyQt5 Python library with easy to #
5 | # use extension containing commonly used widgets which is not natively supported #
6 | # by the Qt Frame work (or atleast for Python version of Qt). #
7 | # VERSION: v1.0.0 #
8 | # NOTES: CLASS : SpiralProgressBar : Can be accessed by : importing #
9 | # from PySide2extn.SpiralProgressBar import spiralProgressBar #
10 | # REFER: Github: https://github.com/anjalp/PySide2extn #
11 | #############################################################################################
12 |
13 |
14 | from PySide2 import QtWidgets, QtCore
15 | from PySide2.QtCore import Qt, QSize
16 | from PySide2.QtGui import QBrush, QColor, QPainter, QPen, QPaintEvent, QFont
17 |
18 | class spiralProgressBar(QtWidgets.QWidget):
19 |
20 | def __init__(self, parent=None):
21 | super(spiralProgressBar, self).__init__(parent)
22 |
23 | self.positionX = 0
24 | self.positionY = 0
25 | self.spb_Size = 0
26 | self.posFactor = 0
27 | self.sizeFactor = 0
28 |
29 | self.spb_maximSize = (0, 0)
30 | self.spb_minimSize = (0, 0)
31 |
32 | self.spb_dynamicMin = True
33 | self.spb_dynamicMax = True
34 |
35 | self.noProgBar = 3
36 |
37 | self.spb_value = [-48*16, -24*16, -12*16]
38 | self.spb_minimValue = [0, 0, 0]
39 | self.spb_maximValue = [100, 100, 100]
40 | self.spb_startPos = [self.startPosFlags.North, self.startPosFlags.North, self.startPosFlags.North]
41 | self.spb_direction = [self.rotationFlags.Clockwise, self.rotationFlags.Clockwise, self.rotationFlags.Clockwise]
42 |
43 | self.lineWidth = 5
44 | self.lineColor = [[0, 159, 227], [0, 159, 227], [0, 159, 227]]
45 | self.lineStyle = [self.lineStyleFlags.SolidLine, self.lineStyleFlags.SolidLine, self.lineStyleFlags.SolidLine]
46 | self.lineCap = [self.lineCapFlags.RoundCap, self.lineCapFlags.RoundCap, self.lineCapFlags.RoundCap]
47 | self.varWidth = False
48 | self.widthIncr = 1
49 |
50 | self.pathWidth = 5
51 | self.pathColor = [[179, 241, 215], [179, 241, 215], [179, 241, 215]]
52 | self.pathPresent = True
53 | self.pathStyle = [self.lineStyleFlags.SolidLine, self.lineStyleFlags.SolidLine, self.lineStyleFlags.SolidLine]
54 | self.pathIndepend = False
55 |
56 | self.spb_gap = self.lineWidth*2 #GAP BETWEEN THE ROUNDPROGRESS BAR MAKING A SPIRAL PROGRESS BAR.
57 | self.gapCngd = False
58 | self.spb_cngSize = 1
59 |
60 | #------------------------------------------------------CLASS ENUMERATORS
61 | class lineStyleFlags:
62 | SolidLine = Qt.SolidLine
63 | DotLine = Qt.DotLine
64 | DashLine = Qt.DashLine
65 |
66 | class lineCapFlags:
67 | SquareCap = Qt.SquareCap
68 | RoundCap = Qt.RoundCap
69 |
70 | class rotationFlags:
71 | Clockwise = -1
72 | AntiClockwise = 1
73 |
74 | class startPosFlags:
75 | North = 90*16
76 | South = -90*16
77 | East = 0*16
78 | West = 180*16
79 |
80 | #------------------------------------------------------METHODS FOR CHANGING THE PROPERTY OF THE SPIRALPROGRESSBAR :SOLTS
81 |
82 | def spb_setMinimumSize(self, width, height):
83 | """
84 | Minimum Size of the Widget
85 | ...
86 |
87 | Parameters
88 | --------------
89 |
90 | width : int
91 | width of the Widget
92 |
93 | height : int
94 | height of the Widget
95 |
96 | Raises
97 | --------------
98 | none
99 | """
100 | self.spb_dynamicMin = False
101 | self.setMinimumSize(width, height)
102 | self.spb_minimSize = (width, height)
103 | self.update()
104 |
105 |
106 | def spb_setMaximumSize(self, width, height):
107 | """
108 | Maximum Size of the Widget
109 | ...
110 |
111 | Parameters
112 | --------------
113 |
114 | width : int
115 | width of the Widget
116 |
117 | height : int
118 | height of the Widget
119 |
120 | Raises
121 | --------------
122 | none
123 | """
124 | self.spb_dynamicMax = False
125 | self.setMaximumSize(width, height)
126 | self.spb_maximSize = (width, height)
127 | self.update()
128 |
129 |
130 | def spb_setNoProgressBar(self, num):
131 | """
132 | By default the Number of progress bar in spiralProgressBar is: 3,
133 | Users can increase the number of progress bar upto 6.(min: 2), this function
134 | is used to do exactly that.
135 | ...
136 |
137 | Parameters
138 | --------------
139 | num : int
140 | Number of progress bar.
141 |
142 | Raises
143 | --------------
144 | Exception : "Supported Format: int and not: " + type(num)
145 | raised when the user passes a non-int 'num' to the method.
146 | """
147 | if type(num)!=type(5): #MAKING SURE THAT THE ENTERED IS A NUMBER AND NOT A STRING OR OTHERS
148 | raise Exception("Supported Format: int and not: " + str(type(num)))
149 | if num<=6 and num>=2:
150 | self.noProgBar = num
151 | self.spb_value = []
152 | self.spb_maximValue = []
153 | self.spb_minimValue = []
154 | self.spb_startPos = []
155 | self.spb_direction = []
156 | self.lineColor = []
157 | self.lineStyle = []
158 | self.lineCap = []
159 | for each in range(0, self.noProgBar, 1):
160 | self.spb_value.append(-12*self.noProgBar*16/(each+1))
161 | self.spb_maximValue.append(100)
162 | self.spb_minimValue.append(0)
163 | self.spb_startPos.append(self.startPosFlags.North)
164 | self.spb_direction.append(self.rotationFlags.Clockwise)
165 | self.lineColor.append([0, 159, 227])
166 | self.lineStyle.append(self.lineStyleFlags.SolidLine)
167 | self.lineCap.append(self.lineCapFlags.RoundCap)
168 | self.pathColor.append([179, 241, 215])
169 | self.pathStyle.append(self.lineStyleFlags.SolidLine)
170 | self.update()
171 |
172 |
173 | def spb_setValue(self, value): #value: TUPLE OF (value1, value2, value3)
174 | """
175 | Set the current value of the Progress Bar. maximum value >= Value >= minimum Value
176 | The user can set the value of each progress bar within the spiralprogressbar independely.
177 | The 'value' tuple element order corresponds to the outer to inner most progressbar.
178 | ...
179 |
180 | Parameters
181 | --------------
182 | value : tuple
183 | Ex: value = (0, 50, 22), this means value of outermost progress bar has the value of 0,
184 | midden one to 50, and innermost to 22.
185 |
186 | Raises
187 | --------------
188 | Exception : "Value should be a tuple and not " + type(value)
189 | Rasied when the user passes a non-tuple data type to the module.
190 |
191 | ValueError : "Tuple length more than number of Progress Bars"
192 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
193 |
194 | ValueError : "Tuple length less than the number of Progress Bars"
195 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
196 | """
197 |
198 | if type(value)!=type(()): #IF INPUT IS NOT A TUPLE
199 | raise Exception("Value should be a Tuple and not " + str(type(value)))
200 | elif len(value) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
201 | raise ValueError("Tuple length more than number of Progress Bars")
202 | elif len(value) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
203 | raise ValueError("Tuple length less than the number of Progress Bars")
204 | elif self.spb_value!=value: #IF EVERY THING GOES RIGHT
205 | for each in range(0, self.noProgBar, 1):
206 | if value[each]!='nc': #nc: NOC CHANGE STRING FOR ELEIMINATING THE NO CHANGE PROGRESS VALUES
207 | if value[each] < self.spb_minimValue[each]:
208 | spiralProgressBar.convValue(self, self.spb_minimValue[each], each)
209 | elif value[each] > self.spb_maximValue[each]:
210 | spiralProgressBar.convValue(self, self.spb_maximValue[each], each)
211 | else:
212 | spiralProgressBar.convValue(self, value[each], each)
213 | self.update()
214 |
215 |
216 | def spb_setMaximum(self, maxVal):
217 | """
218 | Maximum Value of the progressbar, default is 100.
219 | ...
220 |
221 | Parameters
222 | --------------
223 | maxVal : tuple
224 | Maximum value of each progressbar, in tuple, with elements in order
225 | Ex: maxVal = (100, 200, 300) : corresponding to 100 for the outermost, 200
226 | for middle progress bar, 300 for innermost progressbar.
227 |
228 | Raises
229 | --------------
230 | Exception : "The Max. for should be in form of a Tuple and not: " + type(maxVal)
231 | Rasied when the user passes a non-tuple data type to the module.
232 |
233 | ValueError : "Tuple length more than number of Progress Bars"
234 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
235 |
236 | ValueError : "Tuple length less than the number of Progress Bars"
237 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
238 | """
239 |
240 | if type(maxVal)!=type(()): #IF INPUT IS NOT A TUPLE
241 | raise Exception("The Max. for should be in form of a Tuple and not: " + str(type(maxVal)))
242 | elif len(maxVal) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
243 | raise ValueError("Tuple length more than number of Progress Bars")
244 | elif len(maxVal) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
245 | raise ValueError("Tuple length less than the number of Progress Bars")
246 | elif self.spb_maximValue!=maxVal:
247 | for each in range(0, self.noProgBar, 1): #TO AVOID FUTURE DIVISION BY ZERO ERROR
248 | if maxVal[each]==self.spb_minimValue[each]:
249 | raise ValueError("Maximum and Minimum Value Cannot be the Same")
250 | self.spb_maximValue = list(maxVal)
251 | self.update()
252 |
253 |
254 | def spb_setMinimum(self, minVal):
255 | """
256 | Minimum Value of the progressbar, default is 0.
257 | ...
258 |
259 | Parameters
260 | --------------
261 | minVal : tuple
262 | Minimum value of each progressbar, in tuple, with elements in order
263 | Ex: minVal = (0, 10, 20) : corresponding to 0 for the outermost, 10
264 | for middle progress bar, 20 for innermost progressbar.
265 |
266 | Raises
267 | --------------
268 | Exception : "The Min. for should be in form of a Tuple and not: " + type(minVal)
269 | Rasied when the user passes a non-tuple data type to the module.
270 |
271 | ValueError : "Tuple length more than number of Progress Bars"
272 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
273 |
274 | ValueError : "Tuple length less than the number of Progress Bars"
275 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
276 | """
277 |
278 | if type(minVal)!=type(()): #IF INPUT IS NOT A TUPLE
279 | raise Exception("The Min. for should be in form of a Tuple and not: " + str(type(minVal)))
280 | elif len(minVal) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
281 | raise ValueError("Tuple length more than number of Progress Bars")
282 | elif len(minVal) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
283 | raise ValueError("Tuple length less than the number of Progress Bars")
284 | elif self.spb_minimValue!=minVal:
285 | for each in range(0, self.noProgBar, 1): #TO AVOID FUTURE DIVISION BY ZERO ERROR
286 | if minVal[each]==self.spb_maximValue[each]:
287 | raise ValueError("Maximum and Minimum Value Cannot be the Same")
288 | self.spb_minimValue = list(minVal)
289 | self.update()
290 |
291 |
292 | def spb_setRange(self, minTuple, maxTuple):
293 | """
294 | This function does the job of setting the Maximum value and Minimum value in one go.
295 | ...
296 |
297 | Parameters
298 | --------------
299 | maxTuple : tuple
300 | Maximum value of each progressbar, in tuple, with elements in order
301 | Ex: maxVal = (100, 200, 300) : corresponding to 100 for the outermost, 200
302 | for middle progress bar, 300 for innermost progressbar.
303 |
304 | minVal : tuple
305 | Minimum value of each progressbar, in tuple, with elements in order
306 | Ex: minVal = (0, 10, 20) : corresponding to 0 for the outermost, 10
307 | for middle progress bar, 20 for innermost progressbar.
308 |
309 | Raises
310 | --------------
311 | Exception : "The Minimum and Maximum should be a Tuple"
312 | Rasied when the user passes a non-tuple data type to the module.
313 |
314 | ValueError : "Tuple length more than number of Progress Bars"
315 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
316 |
317 | ValueError : "Tuple length less than the number of Progress Bars"
318 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
319 | """
320 |
321 | if type(minTuple)!=type(()) or type(maxTuple)!=type(()):
322 | raise Exception("The Minimum and Maximum should be a Tuple")
323 | elif len(minTuple) > self.noProgBar or len(maxTuple) > self.noProgBar:
324 | raise ValueError("Minimum/Maximum Tuple length exceeds the number of Progress Bar")
325 | elif len(minTuple) < self.noProgBar or len(maxTuple) < self.noProgBar:
326 | raise ValueError("Minimum/Maximum Tuple length is less than the number of Progress Bar")
327 | for each in range(0, self.noProgBar, 1):
328 | if minTuple[each]==maxTuple[each]:
329 | raise ValueError("Minimum and Maximum cannot be the Same")
330 | self.spb_minimValue = minTuple
331 | self.spb_maximValue = maxTuple
332 | self.update()
333 |
334 |
335 | def spb_setGap(self, gap):
336 | """
337 | Set the Gap between each concentric circle in the spiralProgressBar.
338 | Default is : gap = 2*line width
339 | ...
340 |
341 | Parameters
342 | --------------
343 | gap : int
344 | Try different settings by passing an int to the function: 'int' corresponds to the "px" seperation
345 | between the concentric circles.
346 |
347 | Raises
348 | --------------
349 | Exception : "Gap should be an integer and not: " + type(gap)
350 | Rasied when the user passes a non-tuple data type to the module.
351 | """
352 |
353 | if type(gap)!=type(5):
354 | raise ValueError("Gap should be an integer and not: " + str(type(gap)))
355 | else:
356 | self.spb_gap = gap
357 | self.gapCngd = True
358 | self.update()
359 |
360 |
361 | def spb_setInitialPos(self, position):
362 | """
363 | Sets the statring point of the progress bar or the 0% position.
364 | Default is 'North'
365 | ...
366 |
367 | Parameters
368 | --------------
369 | position : tuple
370 | The tuple elements accepts only string of : 'North', 'South', 'East' and 'West'.
371 | The order of arrangment matters i.e. the first element corresponds to the outer most concentric
372 | progress bar and the last element correspinds to the innermost circle.
373 | Ex : position = ('North', 'South', 'East')
374 |
375 | Raises
376 | --------------
377 | Exception : "Position should be a Tuple and not " + type(position)
378 | Rasied when the user passes a non-tuple data type to the module.
379 |
380 | ValueError : "Tuple length more than number of Progress Bars"
381 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
382 |
383 | ValueError : "Tuple length less than the number of Progress Bars"
384 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
385 | """
386 |
387 | if type(position)!=type(()): #IF INPUT IS NOT A TUPLE
388 | raise Exception("Position should be a Tuple and not " + str(type(position)))
389 | elif len(position) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
390 | raise ValueError("Tuple length more than number of Progress Bars")
391 | elif len(position) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
392 | raise ValueError("Tuple length less than the number of Progress Bars")
393 | else:
394 | for each in range(0, self.noProgBar, 1):
395 | if type(position[each])!=type("string"):
396 | raise Exception("Position Tuple elements should be String and not: " + str(type(position[each])))
397 | elif position[each]=='North':
398 | self.spb_startPos[each] = self.startPosFlags.North
399 | elif position[each]=='South':
400 | self.spb_startPos[each] = self.startPosFlags.South
401 | elif position[each]=='East':
402 | self.spb_startPos[each] = self.startPosFlags.East
403 | elif position[each]=='West':
404 | self.spb_startPos[each] = self.startPosFlags.West
405 | else:
406 | raise Exception("Position can hold Property: 'North', 'South', 'East' and 'West' and not: " + position[each])
407 | self.update()
408 |
409 |
410 | def spb_reset(self):
411 | """
412 | Resets the progress bar to the 0%.
413 | ...
414 |
415 | Parameters
416 | --------------
417 | none
418 |
419 | Raises
420 | --------------
421 | none
422 | """
423 |
424 | for each in range(0, self.noProgBar, 1):
425 | spiralProgressBar.convValue(self, self.spb_minimValue[each], each)
426 | self.update()
427 |
428 |
429 | def spb_setGeometry(self, posX, posY):
430 | """
431 | This module changes the position of the widget. Default it is : (0, 0).
432 | ...
433 |
434 | Parameters
435 | --------------
436 | posX : int
437 | The vertical position of the widget from the top of the window inside which the widget lies.
438 | By default it is 0. The user can change the position to better suite his style and positioning of the
439 | widget.
440 |
441 | posY : int
442 |
443 | Raises
444 | --------------
445 | Exception : Position should be an int
446 | If the user passes a non-int data type.
447 | """
448 |
449 | if type(posX)!=type(5) or type(posY)!=type(5):
450 | raise Exception("Position should be a int and not: X" + str(type(posX))) + ", Y: " + str(type(posY))
451 | return
452 | if self.positionX!=posX:
453 | self.positionX = posX
454 | if self.positionY!=posY:
455 | self.positionY = posY
456 | self.update()
457 |
458 |
459 | def spb_setDirection(self, direction):
460 | """
461 | Direction of rotation of the spiral progress bar.
462 | ...
463 |
464 | Parameters
465 | --------------
466 | direction : tuple
467 | Direction that the round progress bar can hold are : 'Clockwise' and 'AntiClockwise'
468 | Default is 'Clockwise'. The tuple take string as elements corresponding to the direction of
469 | each of the concentric circles.
470 |
471 | Raises
472 | --------------
473 | Exception : "Direction should be a Tuple"
474 | Rasied when the user passes a non-tuple data type to the module.
475 |
476 | ValueError : "Tuple length more than number of Progress Bars"
477 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
478 |
479 | ValueError : "Tuple length less than the number of Progress Bars"
480 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
481 |
482 | Exception : "Direction Tuple elements should be String"
483 | Rasies when the elements of the tuple is not a string.
484 | """
485 |
486 | if type(direction)!=type(()): #IF INPUT IS NOT A TUPLE
487 | raise Exception("Direction should be a Tuple and not " + str(type(direction)))
488 | elif len(direction) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
489 | raise ValueError("Tuple length more than number of Progress Bars")
490 | elif len(direction) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
491 | raise ValueError("Tuple length less than the number of Progress Bars")
492 | else:
493 | for each in range(0, self.noProgBar, 1):
494 | if type(direction[each])!=type("String"):
495 | raise Exception("Direction Tuple elements should be String and not: " + str(type(direction[each])))
496 | elif direction[each]=='Clockwise':
497 | self.spb_direction[each] = self.rotationFlags.Clockwise
498 | elif direction[each]=='AntiClockwise':
499 | self.spb_direction[each] = self.rotationFlags.AntiClockwise
500 | else:
501 | raise Exception("Direction can hold Property: 'Clockwise'/'AntiClockwise' and not: " + str(type(direction[each])))
502 | self.update()
503 |
504 |
505 | def variableWidth(self, inp):
506 | """
507 | A flag for varing the progress bar size.
508 | ...
509 |
510 | Parameters
511 | --------------
512 | inp : bool
513 | True : Changes the size of the width of line progressely.
514 |
515 | Raises
516 | --------------
517 | Exception : Variable width should be a bool : True/False
518 | Rasied when the user passes a non-bool data type to the module.
519 | """
520 |
521 | if type(inp)!=type(True):
522 | raise Exception("Variable Width should be a Bool and not " + str(type(inp)))
523 | else:
524 | self.varWidth = inp
525 | self.update()
526 |
527 |
528 | def spb_widthIncrement(self, increm):
529 | """
530 | Width increment for incrment in the line width. Default is 1px. User can sepcify the
531 | amount of px to increment form the outer to inner circle progressbar.
532 | ...
533 |
534 | Parameters
535 | --------------
536 | incrment : int
537 | Increment passed to the module as int px.
538 |
539 | Raises
540 | --------------
541 | Exception : Increment should be an integer
542 | Rasied when the user passes a non-int data type to the module.
543 | """
544 |
545 | if type(increm)!=type(5):
546 | raise Exception("Increment should be an integer and not " + str(type(increm)))
547 | else:
548 | self.widthIncr = increm
549 | self.update()
550 |
551 |
552 | def spb_lineWidth(self, width):
553 | """
554 | Line width of the circles in the spiral progress bar.
555 | ...
556 |
557 | Parameters
558 | --------------
559 | width : int
560 |
561 | Raises
562 | --------------
563 | Exception : Width should be an Integer
564 | Rasied when the user passes a non-int data type to the module.
565 | """
566 |
567 | if type(width)!=type(5):
568 | raise Exception("Width should be an Integer and not " + str(type(width)))
569 | else:
570 | self.lineWidth = width
571 | if self.gapCngd!=True:
572 | self.spb_gap = self.lineWidth*2
573 | self.update()
574 |
575 |
576 | def spb_lineColor(self, color):
577 | """
578 | Color of line in the spiral progress bar. Each concentric progress bar has its own color settings.
579 | ...
580 |
581 | Parameters
582 | --------------
583 | color : tuple
584 | Color tuple corresponds to the color of each line which is a tuple of (R, G, B).
585 | Ex : color = ((R, G, B), (R, G, B), (R, G, B))
586 | Elements of the color tuple is in correspondance with the order : outer to innermost circles in progress bar.
587 |
588 | Raises
589 | --------------
590 | Exception : Color should be a Tuple
591 | Rasied when the user passes a non-tuple data type to the module.
592 |
593 | ValueError : "Tuple length more than number of Progress Bars"
594 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
595 |
596 | ValueError : "Tuple length less than the number of Progress Bars"
597 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
598 | """
599 |
600 | if type(color)!=type(()):
601 | raise Exception("Color should be a Tuple and not " + str(type(Color)))
602 | elif type(color[0])!=type(()):
603 | raise Exception("Color should be in Format: ((R, G, B), (R, G, B), (R, G, B)) and not any other")
604 | elif len(color) > self.noProgBar:
605 | raise ValueError("Tuple length more than number of Progress Bars")
606 | elif len(color) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
607 | raise ValueError("Tuple length less than the number of Progress Bars")
608 | else:
609 | for each in range(0, self.noProgBar, 1):
610 | if len(color[each])!=3:
611 | raise Exception('Color should be in format (R, G, B)')
612 | elif self.lineColor[each]!=color[each]:
613 | self.lineColor[each] = color[each]
614 | self.update()
615 |
616 |
617 | def spb_lineStyle(self, style):
618 | """
619 | line style of the spiral progress bar.
620 | ...
621 |
622 | Parameters
623 | --------------
624 | style : tuple
625 | Style types : 'SolidLine', 'DotLine' and 'DashLine'.
626 | Users can pass the style for each progress bar in the order : first element corresponds
627 | to the styleof outermost progressbar and viceversa.
628 |
629 | Raises
630 | --------------
631 | Exception : Style should be a tuple
632 | Rasied when the user passes a non-tuple data type to the module.
633 |
634 | ValueError : "Tuple length more than number of Progress Bars"
635 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
636 |
637 | ValueError : "Tuple length less than the number of Progress Bars"
638 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
639 | """
640 |
641 | if type(style)!=type(()):
642 | raise Exception("Style should be a tuple and not: " + str(type(style)))
643 | elif len(style) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
644 | raise ValueError("Tuple length more than number of Progress Bars")
645 | elif len(style) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
646 | raise ValueError("Tuple length less than the number of Progress Bars")
647 | else:
648 | for each in range(0, self.noProgBar, 1):
649 | if type(style[each])!=type("String"):
650 | raise Exception("Style Tuple element should be a String and not: " + str(type(style[each])))
651 | elif style[each]=='SolidLine':
652 | self.lineStyle[each] = self.lineStyleFlags.SolidLine
653 | elif style[each]=='DotLine':
654 | self.lineStyle[each] = self.lineStyleFlags.DotLine
655 | elif style[each]=='DashLine':
656 | self.lineStyle[each] = self.lineStyleFlags.DashLine
657 | else:
658 | raise Exception("Style can hold 'SolidLine', DotLine' and 'DashLine' only.")
659 | self.update()
660 |
661 |
662 | def spb_lineCap(self, cap):
663 | """
664 | Cap i.e. the end of the line : to be Round or Square.
665 | ...
666 |
667 | Parameters
668 | --------------
669 | cap : tuple
670 | Cap : 'RoundCap' and 'SquareCap'.
671 | Users can pass the desired cap of the line as a string passed in the following order of :
672 | Outer progress bar : first element in the tuple and viceversa.
673 |
674 | Raises
675 | --------------
676 | Exception : Cap should be a tuple
677 | Rasied when the user passes a non-tuple data type to the module.
678 |
679 | ValueError : "Tuple length more than number of Progress Bars"
680 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
681 |
682 | ValueError : "Tuple length less than the number of Progress Bars"
683 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
684 | """
685 |
686 | if type(cap)!=type(()):
687 | raise Exception("Cap should be a tuple and not: " + str(type(cap)))
688 | elif len(cap) > self.noProgBar: #IF TUPLE LENGTH IS MORE THAN THE NUMBER OF PROGRESS BAR
689 | raise ValueError("Tuple length more than number of Progress Bars")
690 | elif len(cap) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
691 | raise ValueError("Tuple length less than the number of Progress Bars")
692 | else:
693 | for each in range(0, self.noProgBar, 1):
694 | if type(cap[each])!=type("String"):
695 | raise Exception('Cap Tuple element should be a String and not a: ' + str(type(cap[each])))
696 | elif cap[each]=='SquareCap':
697 | self.lineCap[each] = self.lineCapFlags.SquareCap
698 | elif cap[each]=='RoundCap':
699 | self.lineCap[each] = self.lineCapFlags.RoundCap
700 | else:
701 | raise Exception("Cap can hold 'SquareCap' and 'RoundCap' only")
702 | self.update()
703 |
704 |
705 | def spb_setPathHidden(self, hide):
706 | """
707 | Hides the path in the spiral progress bar.
708 | ...
709 |
710 | Parameters
711 | --------------
712 | hide : bool
713 |
714 | Raises
715 | --------------
716 | Exception : Hidden accept a bool
717 | Rasied when the user passes a non-bool data type to the module.
718 | """
719 |
720 | if type(hide)!=type(True):
721 | raise Exception("Hidden accept a bool and not: " + str(type(hide)))
722 | elif hide==True:
723 | self.pathPresent = False
724 | else:
725 | self.pathPresent = True
726 |
727 | def spb_pathColor(self, color):
728 | """
729 | Color of path in the spiral progress bar. Each concentric progress bar has its own color settings.
730 | ...
731 |
732 | Parameters
733 | --------------
734 | color : tuple
735 | Color tuple corresponds to the color of each path which is a tuple of (R, G, B).
736 | Ex : color = ((R, G, B), (R, G, B), (R, G, B))
737 | Elements of the color tuple is in correspondance with the order : outer to innermost circles in progress bar.
738 |
739 | Raises
740 | --------------
741 | Exception : Color should be a Tuple
742 | Rasied when the user passes a non-tuple data type to the module.
743 |
744 | ValueError : "Tuple length more than number of Progress Bars"
745 | Raised when the tuple contains more element than the number of concentric progress bar in the spiralProgressBar widget.
746 |
747 | ValueError : "Tuple length less than the number of Progress Bars"
748 | Raised when the tuple contains less element than the number of concentric progress bar in the spiralProgressBar widget.
749 | """
750 |
751 | if type(color)!=type(()):
752 | raise Exception("Color should be a Tuple and not " + str(type(Color)))
753 | elif type(color[0])!=type(()):
754 | raise Exception("Color should be in Format: ((R, G, B), (R, G, B), (R, G, B)) and not any other")
755 | elif len(color) > self.noProgBar:
756 | raise ValueError("Tuple length more than number of Progress Bars")
757 | elif len(color) < self.noProgBar: #IF INPUT TUPLE LENGTH IS LESS THAN THE NUMBER OF PROGRESS BAR
758 | raise ValueError("Tuple length less than the number of Progress Bars")
759 | else:
760 | for each in range(0, self.noProgBar, 1):
761 | if len(color[each])!=3:
762 | raise Exception('Color should be in format (R, G, B)')
763 | elif self.pathColor[each]!=color[each]:
764 | self.pathColor[each] = color[each]
765 | self.update()
766 |
767 |
768 | #------------------------------------------------------METHODS FOR GETTING THE PROPERTY OF SPIRALPROGRESSBAR SLOTS
769 |
770 | #------------------------------------------------------ENGINE: WHERE ALL THE REAL STUFF TAKE PLACE: WORKING OF THE SPIRALPROGRESSBAR
771 |
772 |
773 | def spb_MinimumSize(self, dynMax, minim, maxim):
774 | """
775 | Realtime automatic minimum size determiner for the spiral progress bar.
776 | For this to achieve the function first checks the size of the layout, where the spiralprogressbar lies.
777 | From that info the, it calculate the minimum size for the spiral progressbar so that all the circles in the spiral
778 | progress bar is clearly visible.
779 |
780 | ...
781 | Parameters
782 | --------------
783 | none.
784 |
785 | Return
786 | --------------
787 | none.
788 | """
789 |
790 | spb_Height = self.height()
791 | spb_Width = self.width()
792 |
793 | if dynMax:
794 | if spb_Width >= spb_Height and spb_Height >= minim[1]:
795 | self.spb_Size = spb_Height
796 | elif spb_Width < spb_Height and spb_Width >= minim[0]:
797 | self.spb_Size = spb_Width
798 | else:
799 | if spb_Width >= spb_Height and spb_Height <= maxim[1]:
800 | self.spb_Size = spb_Height
801 | elif spb_Width < spb_Height and spb_Width <= maxim[0]:
802 | self.spb_Size = spb_Width
803 |
804 |
805 | def geometricFactor(self):
806 | """
807 | Width of the line should be subrtracted from the size of the progrress bar, inorder to properly
808 | fit inot the layout properly without any cut in the widget margins.
809 |
810 | ...
811 | Parameters
812 | --------------
813 | none.
814 |
815 | Return
816 | --------------
817 | none.
818 | """
819 | self.posFactor = self.lineWidth/2 + 1
820 | self.sizeFactor = self.lineWidth + 1
821 |
822 |
823 | def convValue(self, value, pos):
824 | """
825 | Convert the value from the user entered to the percentage depending on the maximum and minimum value.
826 | Calculagted by the relation : (value - minimum)/(maximum - minimum)
827 |
828 | ...
829 | Parameters
830 | --------------
831 | none.
832 |
833 | Return
834 | --------------
835 | none.
836 | """
837 |
838 | self.spb_value[pos] = ((value - self.spb_minimValue[pos])/(self.spb_maximValue[pos] - self.spb_minimValue[pos]))*360*16
839 | self.spb_value[pos] = self.spb_direction[pos]*self.spb_value[pos]
840 |
841 |
842 |
843 | def paintEvent(self, event: QPaintEvent):
844 | """
845 | The place where the drawing takes palce.
846 |
847 | ...
848 | Parameters
849 | --------------
850 | none.
851 |
852 | Return
853 | --------------
854 | none.
855 | """
856 |
857 | if self.spb_dynamicMin:
858 | self.setMinimumSize(QSize(self.lineWidth*6 + self.pathWidth*6, self.lineWidth*6 + self.pathWidth*6))
859 |
860 | spiralProgressBar.spb_MinimumSize(self, self.spb_dynamicMax, self.spb_minimSize, self.spb_maximSize)
861 | spiralProgressBar.geometricFactor(self)
862 | spiralIncrem = 0
863 | spiralIncrem2 = 0
864 |
865 |
866 | if self.pathIndepend!=True:
867 | self.pathWidth = self.lineWidth
868 | self.tempWidth = self.pathWidth
869 | if self.pathPresent:
870 | for path in range(0, self.noProgBar, 1):
871 | if self.varWidth==True: #CREAETS A INCREASING OR DECREASING TYPE OF WITH
872 | self.tempWidth = self.tempWidth + self.widthIncr
873 | if self.gapCngd!=True:
874 | self.spb_gap = self.tempWidth*2
875 | self.pathPainter = QPainter(self)
876 | self.pathPainter.setRenderHint(QPainter.Antialiasing)
877 | self.penPath = QPen()
878 | self.penPath.setStyle(self.pathStyle[path])
879 | self.penPath.setWidth(self.tempWidth)
880 | self.penPath.setBrush(QColor(self.pathColor[path][0], self.pathColor[path][1], self.pathColor[path][2]))
881 | self.pathPainter.setPen(self.penPath)
882 | self.pathPainter.drawArc(self.positionX + self.posFactor + self.spb_cngSize*spiralIncrem2, self.positionY + self.posFactor + self.spb_cngSize*spiralIncrem2, self.spb_Size - self.sizeFactor - 2*self.spb_cngSize*spiralIncrem2, self.spb_Size - self.sizeFactor - 2*self.spb_cngSize*spiralIncrem2, self.spb_startPos[path], 360*16)
883 | self.pathPainter.end()
884 | spiralIncrem2 = spiralIncrem2 + self.spb_gap
885 |
886 |
887 | self.tempWidth = self.lineWidth #TEMPWIDTH TEMPORARLY STORES THE LINEWIDTH, USEFUL IN VARIABLE WIDTH OPTION.
888 | for bar in range(0, self.noProgBar, 1):
889 | if self.varWidth==True: #CREAETS A INCREASING OR DECREASING TYPE OF WITH
890 | self.tempWidth = self.tempWidth + self.widthIncr
891 | if self.gapCngd!=True:
892 | self.spb_gap = self.tempWidth*2
893 | self.linePainter = QPainter(self)
894 | self.linePainter.setRenderHint(QPainter.Antialiasing)
895 | self.penLine = QPen()
896 | self.penLine.setStyle(self.lineStyle[bar])
897 | self.penLine.setWidth(self.tempWidth)
898 | self.penLine.setCapStyle(self.lineCap[bar])
899 | self.penLine.setBrush(QColor(self.lineColor[bar][0], self.lineColor[bar][1], self.lineColor[bar][2]))
900 | self.linePainter.setPen(self.penLine)
901 | self.linePainter.drawArc(self.positionX + self.posFactor + self.spb_cngSize*spiralIncrem, self.positionY + self.posFactor + self.spb_cngSize*spiralIncrem, self.spb_Size - self.sizeFactor - 2*self.spb_cngSize*spiralIncrem, self.spb_Size - self.sizeFactor - 2*self.spb_cngSize*spiralIncrem, self.spb_startPos[bar], self.spb_value[bar])
902 | self.linePainter.end()
903 | spiralIncrem = spiralIncrem + self.spb_gap
904 |
905 |
906 | #------------------------------------------------------
907 |
908 | if __name__=="__main__":
909 | print("Try Import.")
--------------------------------------------------------------------------------
/PySide2extn/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/PySide2extn/__init__.py
--------------------------------------------------------------------------------
/PySide2extn/demo/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/PySide2extn/demo/__init__.py
--------------------------------------------------------------------------------
/PySide2extn/demo/demo.py:
--------------------------------------------------------------------------------
1 | #############################################################################################
2 | # CREATOR: ANJAL.P #
3 | # ON: 2020 NOV. #
4 | # AIM: To Extend the capability of the PySide2 and PyQt5 Python library with easy to #
5 | # use extension containing commonly used widgets which is not natively supported #
6 | # by the Qt Frame work (or atleast for Python version of Qt). #
7 | # VERSION: v1.0.0 #
8 | # NOTES: Demo Application #
9 | # REFER: Github: https://github.com/anjalp/PySide2extn #
10 | #############################################################################################
11 |
12 |
13 | from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
14 | QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
15 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
16 | QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
17 | QPixmap, QRadialGradient)
18 | from PySide2.QtWidgets import *
19 |
20 | from PySide2extn.RoundProgressBar import roundProgressBar
21 | from PySide2extn.SpiralProgressBar import spiralProgressBar
22 |
23 |
24 | class Ui_MainWindow(object):
25 | def setupUi(self, MainWindow):
26 | if not MainWindow.objectName():
27 | MainWindow.setObjectName(u"MainWindow")
28 | MainWindow.resize(800, 415)
29 | MainWindow.setMinimumSize(QSize(800, 415))
30 | self.centralwidget = QWidget(MainWindow)
31 | self.centralwidget.setObjectName(u"centralwidget")
32 | self.gridLayout = QGridLayout(self.centralwidget)
33 | self.gridLayout.setSpacing(0)
34 | self.gridLayout.setObjectName(u"gridLayout")
35 | self.gridLayout.setContentsMargins(0, 0, 0, 0)
36 | self.tabWidget = QTabWidget(self.centralwidget)
37 | self.tabWidget.setObjectName(u"tabWidget")
38 | self.tab = QWidget()
39 | self.tab.setObjectName(u"tab")
40 | self.verticalLayout = QVBoxLayout(self.tab)
41 | self.verticalLayout.setSpacing(0)
42 | self.verticalLayout.setObjectName(u"verticalLayout")
43 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
44 | self.widget = QWidget(self.tab)
45 | self.widget.setObjectName(u"widget")
46 | self.gridLayout_2 = QGridLayout(self.widget)
47 | self.gridLayout_2.setSpacing(0)
48 | self.gridLayout_2.setObjectName(u"gridLayout_2")
49 | self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
50 | self.b1 = QPushButton(self.widget)
51 | self.b1.setObjectName(u"b1")
52 | self.b1.setMinimumSize(QSize(20, 20))
53 | self.b1.setMaximumSize(QSize(20, 20))
54 |
55 | self.gridLayout_2.addWidget(self.b1, 0, 1, 1, 1)
56 |
57 | self.b3 = QPushButton(self.widget)
58 | self.b3.setObjectName(u"b3")
59 | self.b3.setMinimumSize(QSize(20, 20))
60 | self.b3.setMaximumSize(QSize(20, 20))
61 |
62 | self.gridLayout_2.addWidget(self.b3, 0, 5, 1, 1)
63 |
64 | self.rpb4 = roundProgressBar(self.widget)
65 | self.rpb4.setObjectName(u"rpb4")
66 |
67 | self.gridLayout_2.addWidget(self.rpb4, 0, 6, 3, 1)
68 |
69 | self.rpb3 = roundProgressBar(self.widget)
70 | self.rpb3.setObjectName(u"rpb3")
71 |
72 | self.gridLayout_2.addWidget(self.rpb3, 0, 4, 3, 1)
73 |
74 | self.rpb2 = roundProgressBar(self.widget)
75 | self.rpb2.setObjectName(u"rpb2")
76 | self.rpb2.setStyleSheet(u"")
77 |
78 | self.gridLayout_2.addWidget(self.rpb2, 0, 2, 3, 1)
79 |
80 | self.rpb1 = roundProgressBar(self.widget)
81 | self.rpb1.setObjectName(u"rpb1")
82 |
83 | self.gridLayout_2.addWidget(self.rpb1, 0, 0, 3, 1)
84 |
85 | self.b2 = QPushButton(self.widget)
86 | self.b2.setObjectName(u"b2")
87 | self.b2.setMinimumSize(QSize(20, 20))
88 | self.b2.setMaximumSize(QSize(20, 20))
89 |
90 | self.gridLayout_2.addWidget(self.b2, 2, 1, 1, 1)
91 |
92 | self.vs1 = QSlider(self.widget)
93 | self.vs1.setObjectName(u"vs1")
94 | self.vs1.setOrientation(Qt.Vertical)
95 |
96 | self.gridLayout_2.addWidget(self.vs1, 0, 3, 3, 1)
97 |
98 | self.b4 = QPushButton(self.widget)
99 | self.b4.setObjectName(u"b4")
100 | self.b4.setMinimumSize(QSize(20, 20))
101 | self.b4.setMaximumSize(QSize(20, 20))
102 |
103 | self.gridLayout_2.addWidget(self.b4, 2, 5, 1, 1)
104 |
105 |
106 | self.verticalLayout.addWidget(self.widget)
107 |
108 | self.hs1 = QSlider(self.tab)
109 | self.hs1.setObjectName(u"hs1")
110 | self.hs1.setOrientation(Qt.Horizontal)
111 |
112 | self.verticalLayout.addWidget(self.hs1)
113 |
114 | self.widget_2 = QWidget(self.tab)
115 | self.widget_2.setObjectName(u"widget_2")
116 | self.gridLayout_3 = QGridLayout(self.widget_2)
117 | self.gridLayout_3.setSpacing(0)
118 | self.gridLayout_3.setObjectName(u"gridLayout_3")
119 | self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
120 | self.vs2 = QSlider(self.widget_2)
121 | self.vs2.setObjectName(u"vs2")
122 | self.vs2.setOrientation(Qt.Vertical)
123 | self.vs2.setInvertedAppearance(True)
124 |
125 | self.gridLayout_3.addWidget(self.vs2, 0, 3, 4, 1)
126 |
127 | self.b6 = QPushButton(self.widget_2)
128 | self.b6.setObjectName(u"b6")
129 | self.b6.setMinimumSize(QSize(20, 20))
130 | self.b6.setMaximumSize(QSize(20, 20))
131 |
132 | self.gridLayout_3.addWidget(self.b6, 3, 5, 1, 1)
133 |
134 | self.b5 = QPushButton(self.widget_2)
135 | self.b5.setObjectName(u"b5")
136 | self.b5.setMinimumSize(QSize(20, 20))
137 | self.b5.setMaximumSize(QSize(20, 20))
138 |
139 | self.gridLayout_3.addWidget(self.b5, 0, 5, 1, 1)
140 |
141 | self.b8 = QPushButton(self.widget_2)
142 | self.b8.setObjectName(u"b8")
143 | self.b8.setMinimumSize(QSize(20, 20))
144 | self.b8.setMaximumSize(QSize(20, 20))
145 |
146 | self.gridLayout_3.addWidget(self.b8, 3, 1, 1, 1)
147 |
148 | self.rpb5 = roundProgressBar(self.widget_2)
149 | self.rpb5.setObjectName(u"rpb5")
150 |
151 | self.gridLayout_3.addWidget(self.rpb5, 0, 0, 4, 1)
152 |
153 | self.b7 = QPushButton(self.widget_2)
154 | self.b7.setObjectName(u"b7")
155 | self.b7.setMinimumSize(QSize(20, 20))
156 | self.b7.setMaximumSize(QSize(20, 20))
157 |
158 | self.gridLayout_3.addWidget(self.b7, 0, 1, 1, 1)
159 |
160 | self.rpb7 = roundProgressBar(self.widget_2)
161 | self.rpb7.setObjectName(u"rpb7")
162 |
163 | self.gridLayout_3.addWidget(self.rpb7, 0, 4, 4, 1)
164 |
165 | self.rpb8 = roundProgressBar(self.widget_2)
166 | self.rpb8.setObjectName(u"rpb8")
167 |
168 | self.gridLayout_3.addWidget(self.rpb8, 0, 6, 4, 1)
169 |
170 | self.rpb6 = roundProgressBar(self.widget_2)
171 | self.rpb6.setObjectName(u"rpb6")
172 |
173 | self.gridLayout_3.addWidget(self.rpb6, 0, 2, 4, 1)
174 |
175 |
176 | self.verticalLayout.addWidget(self.widget_2)
177 |
178 | self.tabWidget.addTab(self.tab, "")
179 | self.tab_2 = QWidget()
180 | self.tab_2.setObjectName(u"tab_2")
181 | self.verticalLayout_2 = QVBoxLayout(self.tab_2)
182 | self.verticalLayout_2.setSpacing(0)
183 | self.verticalLayout_2.setObjectName(u"verticalLayout_2")
184 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
185 | self.widget_3 = QWidget(self.tab_2)
186 | self.widget_3.setObjectName(u"widget_3")
187 | self.gridLayout_4 = QGridLayout(self.widget_3)
188 | self.gridLayout_4.setSpacing(0)
189 | self.gridLayout_4.setObjectName(u"gridLayout_4")
190 | self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
191 | self.pushButton_9 = QPushButton(self.widget_3)
192 | self.pushButton_9.setObjectName(u"pushButton_9")
193 | self.pushButton_9.setMinimumSize(QSize(20, 20))
194 | self.pushButton_9.setMaximumSize(QSize(20, 20))
195 |
196 | self.gridLayout_4.addWidget(self.pushButton_9, 0, 1, 1, 1)
197 |
198 | self.pushButton_11 = QPushButton(self.widget_3)
199 | self.pushButton_11.setObjectName(u"pushButton_11")
200 | self.pushButton_11.setMinimumSize(QSize(20, 20))
201 | self.pushButton_11.setMaximumSize(QSize(20, 20))
202 |
203 | self.gridLayout_4.addWidget(self.pushButton_11, 0, 5, 1, 1)
204 |
205 | self.pushButton_10 = QPushButton(self.widget_3)
206 | self.pushButton_10.setObjectName(u"pushButton_10")
207 | self.pushButton_10.setMinimumSize(QSize(20, 20))
208 | self.pushButton_10.setMaximumSize(QSize(20, 20))
209 |
210 | self.gridLayout_4.addWidget(self.pushButton_10, 3, 1, 1, 1)
211 |
212 | self.vs3 = QSlider(self.widget_3)
213 | self.vs3.setObjectName(u"vs3")
214 | self.vs3.setOrientation(Qt.Vertical)
215 |
216 | self.gridLayout_4.addWidget(self.vs3, 0, 3, 4, 1)
217 |
218 | self.spb2 = spiralProgressBar(self.widget_3)
219 | self.spb2.setObjectName(u"spb2")
220 |
221 | self.gridLayout_4.addWidget(self.spb2, 0, 2, 4, 1)
222 |
223 | self.spb1 = spiralProgressBar(self.widget_3)
224 | self.spb1.setObjectName(u"spb1")
225 |
226 | self.gridLayout_4.addWidget(self.spb1, 0, 0, 4, 1)
227 |
228 | self.spb3 = spiralProgressBar(self.widget_3)
229 | self.spb3.setObjectName(u"spb3")
230 |
231 | self.gridLayout_4.addWidget(self.spb3, 0, 4, 4, 1)
232 |
233 | self.pushButton_12 = QPushButton(self.widget_3)
234 | self.pushButton_12.setObjectName(u"pushButton_12")
235 | self.pushButton_12.setMinimumSize(QSize(20, 20))
236 | self.pushButton_12.setMaximumSize(QSize(20, 20))
237 |
238 | self.gridLayout_4.addWidget(self.pushButton_12, 3, 5, 1, 1)
239 |
240 | self.spb4 = spiralProgressBar(self.widget_3)
241 | self.spb4.setObjectName(u"spb4")
242 |
243 | self.gridLayout_4.addWidget(self.spb4, 0, 6, 4, 1)
244 |
245 |
246 | self.verticalLayout_2.addWidget(self.widget_3)
247 |
248 | self.hs2 = QSlider(self.tab_2)
249 | self.hs2.setObjectName(u"hs2")
250 | self.hs2.setOrientation(Qt.Horizontal)
251 |
252 | self.verticalLayout_2.addWidget(self.hs2)
253 |
254 | self.widget_4 = QWidget(self.tab_2)
255 | self.widget_4.setObjectName(u"widget_4")
256 | self.gridLayout_5 = QGridLayout(self.widget_4)
257 | self.gridLayout_5.setSpacing(0)
258 | self.gridLayout_5.setObjectName(u"gridLayout_5")
259 | self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
260 | self.pushButton_15 = QPushButton(self.widget_4)
261 | self.pushButton_15.setObjectName(u"pushButton_15")
262 | self.pushButton_15.setMinimumSize(QSize(20, 20))
263 | self.pushButton_15.setMaximumSize(QSize(20, 20))
264 |
265 | self.gridLayout_5.addWidget(self.pushButton_15, 0, 5, 1, 1)
266 |
267 | self.pushButton_13 = QPushButton(self.widget_4)
268 | self.pushButton_13.setObjectName(u"pushButton_13")
269 | self.pushButton_13.setMinimumSize(QSize(20, 20))
270 | self.pushButton_13.setMaximumSize(QSize(20, 20))
271 |
272 | self.gridLayout_5.addWidget(self.pushButton_13, 0, 1, 1, 1)
273 |
274 | self.pushButton_16 = QPushButton(self.widget_4)
275 | self.pushButton_16.setObjectName(u"pushButton_16")
276 | self.pushButton_16.setMinimumSize(QSize(20, 20))
277 | self.pushButton_16.setMaximumSize(QSize(20, 20))
278 |
279 | self.gridLayout_5.addWidget(self.pushButton_16, 3, 5, 1, 1)
280 |
281 | self.pushButton_14 = QPushButton(self.widget_4)
282 | self.pushButton_14.setObjectName(u"pushButton_14")
283 | self.pushButton_14.setMinimumSize(QSize(20, 20))
284 | self.pushButton_14.setMaximumSize(QSize(20, 20))
285 |
286 | self.gridLayout_5.addWidget(self.pushButton_14, 3, 1, 1, 1)
287 |
288 | self.spb5 = spiralProgressBar(self.widget_4)
289 | self.spb5.setObjectName(u"spb5")
290 |
291 | self.gridLayout_5.addWidget(self.spb5, 0, 0, 4, 1)
292 |
293 | self.spb6 = spiralProgressBar(self.widget_4)
294 | self.spb6.setObjectName(u"spb6")
295 |
296 | self.gridLayout_5.addWidget(self.spb6, 0, 2, 4, 1)
297 |
298 | self.spb7 = spiralProgressBar(self.widget_4)
299 | self.spb7.setObjectName(u"spb7")
300 |
301 | self.gridLayout_5.addWidget(self.spb7, 0, 4, 4, 1)
302 |
303 | self.spb8 = spiralProgressBar(self.widget_4)
304 | self.spb8.setObjectName(u"spb8")
305 |
306 | self.gridLayout_5.addWidget(self.spb8, 0, 6, 4, 1)
307 |
308 | self.vs4 = QSlider(self.widget_4)
309 | self.vs4.setObjectName(u"vs4")
310 | self.vs4.setOrientation(Qt.Vertical)
311 | self.vs4.setInvertedAppearance(True)
312 |
313 | self.gridLayout_5.addWidget(self.vs4, 0, 3, 4, 1)
314 |
315 |
316 | self.verticalLayout_2.addWidget(self.widget_4)
317 |
318 | self.tabWidget.addTab(self.tab_2, "")
319 |
320 | self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
321 |
322 | MainWindow.setCentralWidget(self.centralwidget)
323 |
324 | self.retranslateUi(MainWindow)
325 |
326 | self.tabWidget.setCurrentIndex(0)
327 |
328 |
329 | QMetaObject.connectSlotsByName(MainWindow)
330 | # setupUi
331 |
332 | def retranslateUi(self, MainWindow):
333 | MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Demo Application PySide2extn", None))
334 | self.b1.setText(QCoreApplication.translate("MainWindow", u"S", None))
335 | self.b3.setText(QCoreApplication.translate("MainWindow", u"D", None))
336 | self.b2.setText(QCoreApplication.translate("MainWindow", u"I", None))
337 | self.b4.setText(QCoreApplication.translate("MainWindow", u"R", None))
338 | self.b6.setText(QCoreApplication.translate("MainWindow", u"I", None))
339 | self.b5.setText(QCoreApplication.translate("MainWindow", u"S", None))
340 | self.b8.setText(QCoreApplication.translate("MainWindow", u"D", None))
341 | self.b7.setText(QCoreApplication.translate("MainWindow", u"R", None))
342 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"RoundProgressBar", None))
343 | self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"R", None))
344 | self.pushButton_11.setText(QCoreApplication.translate("MainWindow", u"S", None))
345 | self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"D", None))
346 | self.pushButton_12.setText(QCoreApplication.translate("MainWindow", u"I", None))
347 | self.pushButton_15.setText(QCoreApplication.translate("MainWindow", u"R", None))
348 | self.pushButton_13.setText(QCoreApplication.translate("MainWindow", u"I", None))
349 | self.pushButton_16.setText(QCoreApplication.translate("MainWindow", u"D", None))
350 | self.pushButton_14.setText(QCoreApplication.translate("MainWindow", u"S", None))
351 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"SpiralProgressBar", None))
352 |
353 | self.addDesignTothis()
354 |
355 |
356 | def addDesignTothis(self):
357 | self.widget_rpb()
358 | self.widget_spb()
359 |
360 |
361 | def widget_rpb(self):
362 |
363 | self.rpb1.rpb_setValue(55)
364 | self.rpb2.rpb_setValue(84)
365 | self.rpb3.rpb_setValue(0)
366 | self.rpb4.rpb_setValue(46)
367 | self.rpb5.rpb_setValue(75)
368 | self.rpb6.rpb_setValue(66)
369 | self.rpb7.rpb_setValue(5)
370 | self.rpb8.rpb_setValue(95)
371 |
372 |
373 | self.rpb2.rpb_setBarStyle("Line")
374 | self.rpb2.rpb_setLineColor((0, 10, 15))
375 | self.rpb2.rpb_setTextColor((0, 10, 15))
376 |
377 |
378 | self.rpb3.rpb_setBarStyle("Pie")
379 | self.rpb3.rpb_setMaximum(360)
380 | self.rpb3.rpb_setTextFormat('Value')
381 | self.rpb3.rpb_setTextColor((210, 240, 210))
382 | self.rpb3.rpb_setPieColor((0, 125, 125))
383 |
384 |
385 | self.rpb4.rpb_setBarStyle("Pizza")
386 | self.rpb4.rpb_setRange(0, 200)
387 | self.rpb4.rpb_setCircleColor((210, 100, 0))
388 | self.rpb4.rpb_setLineColor((160, 50, 0))
389 | self.rpb4.rpb_setTextColor((250, 250, 250))
390 | self.rpb4.rpb_setCircleRatio(1)
391 |
392 |
393 | self.rpb5.rpb_setBarStyle("Hybrid1")
394 | self.rpb5.rpb_setRange(0, 360)
395 | self.rpb5.rpb_setTextFormat('Value')
396 | self.rpb5.rpb_setPathWidth(2)
397 | self.rpb5.rpb_setLineWidth(8)
398 | self.rpb5.rpb_setPathColor((100, 100, 100))
399 | self.rpb5.rpb_setCircleColor((100, 100, 100))
400 | self.rpb5.rpb_setTextColor((250, 250, 250))
401 |
402 |
403 | self.rpb6.rpb_setBarStyle("Hybrid2")
404 |
405 |
406 | self.rpb8.rpb_setBarStyle("Hybrid1")
407 | self.rpb8.rpb_setRange(0, 360)
408 |
409 |
410 | self.rpb7.rpb_setLineWidth(2)
411 | self.rpb7.rpb_setLineColor((20, 20, 20))
412 | self.rpb7.rpb_setMaximum(200)
413 | self.rpb7.rpb_enableText(False)
414 | self.rpb7.rpb_setPathWidth(8)
415 |
416 | self.hs1.valueChanged.connect(lambda: self.rpb1.rpb_setValue(self.hs1.value()))
417 | self.hs1.valueChanged.connect(lambda: self.rpb8.rpb_setValue(100 - self.hs1.value()))
418 | self.hs1.valueChanged.connect(lambda: self.rpb4.rpb_setValue(200 - self.hs1.value()))
419 | self.hs1.valueChanged.connect(lambda: self.rpb5.rpb_setValue(2*self.hs1.value()))
420 |
421 | self.vs1.valueChanged.connect(lambda: self.rpb2.rpb_setValue(self.vs1.value()))
422 | self.vs1.valueChanged.connect(lambda: self.rpb3.rpb_setValue(360 - self.vs1.value()))
423 |
424 | self.vs2.valueChanged.connect(lambda: self.rpb6.rpb_setValue(self.vs2.value()))
425 | self.vs2.valueChanged.connect(lambda: self.rpb7.rpb_setValue(self.vs2.value()))
426 |
427 |
428 | self.b1.clicked.connect(lambda: self.rpb1.rpb_setLineColor((128, 40, 152)))
429 | self.b2.clicked.connect(lambda: self.rpb8.rpb_setCircleColor((0, 192, 175)))
430 | self.b5.clicked.connect(lambda: self.rpb6.rpb_setTextColor((0, 192, 175)))
431 | self.b3.clicked.connect(lambda: self.rpb3.rpb_setValue(0))
432 | self.b4.clicked.connect(lambda: self.rpb3.rpb_setValue(100))
433 | self.b6.clicked.connect(lambda: self.rpb5.rpb_setValue(0))
434 | self.b7.clicked.connect(lambda: self.rpb6.rpb_setValue(100))
435 | self.b8.clicked.connect(lambda: self.rpb8.rpb_setValue(360))
436 |
437 |
438 | def widget_spb(self):
439 |
440 | self.spb1.spb_setValue((82, 56, 5))
441 |
442 | self.spb2.spb_setNoProgressBar(2)
443 | self.spb2.spb_lineWidth(15)
444 | self.spb2.spb_setGap(18)
445 | self.spb2.spb_setValue((65, 60))
446 | self.spb2.spb_lineColor(((28, 129, 196), (90, 193, 211)))
447 | self.spb2.spb_pathColor(((195, 225, 242), (208, 234, 244)))
448 |
449 | self.spb3.spb_setRange((0, 0, 0), (360, 360, 360))
450 | self.spb3.spb_lineWidth(15)
451 | self.spb3.spb_setGap(17)
452 | self.spb3.spb_setInitialPos(('East', 'East', 'East'))
453 | self.spb3.spb_setValue((246, 315, 198))
454 | self.spb3.spb_setPathHidden(True)
455 |
456 | self.spb4.spb_setNoProgressBar(6)
457 | self.spb4.spb_lineWidth(10)
458 | self.spb4.spb_setGap(11)
459 | self.spb4.spb_setValue((59, 16, 27, 65, 84, 95))
460 |
461 | self.spb5.spb_lineStyle(('DotLine', 'DotLine', 'DotLine'))
462 | self.spb5.spb_setValue((65, 90, 25))
463 |
464 | self.spb6.spb_setNoProgressBar(5)
465 | self.spb6.spb_lineWidth(10)
466 | self.spb6.spb_setGap(11)
467 | self.spb6.spb_setDirection(('Clockwise', 'AntiClockwise', 'AntiClockwise', 'Clockwise', 'Clockwise'))
468 | self.spb6.spb_setValue((65, 25, 86, 45, 75))
469 |
470 | self.spb7.spb_setGap(12)
471 | self.spb7.variableWidth(True)
472 | self.spb7.spb_widthIncrement(2)
473 |
474 | self.spb8.spb_lineWidth(8)
475 | self.spb8.spb_setGap(9)
476 | self.spb8.spb_lineCap(('RoundCap', 'SquareCap', 'SquareCap'))
477 | self.spb8.spb_setValue((65, 23, 95))
478 |
479 | self.hs2.valueChanged.connect(lambda: self.spb1.spb_setValue((self.hs2.value(), self.hs2.value()*1.5, self.hs2.value()*1.75)))
480 | self.hs2.valueChanged.connect(lambda: self.spb4.spb_setValue((self.hs2.value()*1.25, self.hs2.value()*1.35, self.hs2.value()*1, self.hs2.value()*1.75, self.hs2.value()*1.55, self.hs2.value()*0.45)))
481 | self.hs2.valueChanged.connect(lambda: self.spb5.spb_setValue((360 - self.hs2.value()*3.6, 360 - self.hs2.value()*4, 360 - self.hs2.value()*4.2)))
482 | self.hs2.valueChanged.connect(lambda: self.spb8.spb_setValue((self.hs2.value(), self.hs2.value()*1.26, self.hs2.value()*2)))
483 |
484 | self.vs3.valueChanged.connect(lambda: self.spb2.spb_setValue((100 - self.vs3.value()*1.2, 100 - self.vs3.value())))
485 | self.vs3.valueChanged.connect(lambda: self.spb3.spb_setValue((self.vs3.value()*3.6, 3.6*0.75*self.vs3.value(), 3.6*0.5*self.vs3.value())))
486 |
487 | self.vs4.valueChanged.connect(lambda: self.spb6.spb_setValue((self.vs4.value(), self.vs4.value()*0.9, self.vs4.value()*0.7, self.vs4.value()*0.6, self.vs4.value()*0.5)))
488 | self.vs4.valueChanged.connect(lambda: self.spb7.spb_setValue((self.vs4.value(), self.vs4.value(), self.vs4.value())))
489 |
490 |
491 | def main():
492 | import sys
493 | app = QApplication(sys.argv)
494 | MainWindow = QMainWindow()
495 | ui = Ui_MainWindow()
496 | ui.setupUi(MainWindow)
497 | MainWindow.show()
498 | sys.exit(app.exec_())
499 |
500 |
--------------------------------------------------------------------------------
/PySide2extn/examples/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/PySide2extn/examples/__init__.py
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/default.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.RoundProgressBar import roundProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | x = 0
7 | p = 1
8 |
9 | class MyWidget(QtWidgets.QWidget):
10 | def __init__(self):
11 | QtWidgets.QWidget.__init__(self)
12 |
13 | self.hello = 'Round Progress Bar'
14 | self.button = QtWidgets.QPushButton("Click me to change Value")
15 | self.text = QtWidgets.QLabel("Round Progress Bar")
16 | self.text.setAlignment(QtCore.Qt.AlignCenter)
17 |
18 | self.rpb = roundProgressBar() #CREATING THE ROUND PROGRESS BAR OBJECT
19 |
20 | self.layout = QtWidgets.QVBoxLayout()
21 | self.layout.addWidget(self.text)
22 | self.layout.addWidget(self.button)
23 |
24 | self.layout.addWidget(self.rpb) # ADDING THE ROUND PROGRESS BAR OBJECT TO THE # BOTTOM OF THE LAYOUT
25 |
26 | self.setLayout(self.layout)
27 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
28 |
29 | def magic(self):
30 | global x, p
31 | x = x + 10*p
32 | if x==100:
33 | p = -1
34 | elif x==0:
35 | p = 1
36 | self.rpb.rpb_setValue(x) #CHANGING THE VALUE OF THE PROGRESS BAR
37 | out_text = 'Round Progress Bar: ' + str(x) + '%'
38 | self.text.setText(out_text)
39 |
40 | if __name__ == "__main__":
41 | app = QtWidgets.QApplication(sys.argv)
42 | widget = MyWidget()
43 | widget.show()
44 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/direction.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | #IMPORTING THE MODULE
4 | from PySide2extn.RoundProgressBar import roundProgressBar
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | #CLASS INSTANCE
11 | self.rpb = roundProgressBar()
12 | self.rpb2 = roundProgressBar()
13 |
14 | #CHANGING THE DIRECTION
15 | self.rpb.rpb_setDirection('Clockwise')
16 | self.rpb2.rpb_setDirection('AntiClockwise')
17 |
18 | #SETTING THE VALUE
19 | self.rpb.rpb_setValue(56)
20 | self.rpb2.rpb_setValue(88)
21 |
22 | self.layout = QtWidgets.QHBoxLayout()
23 | self.layout.addWidget(self.rpb)
24 | self.layout.addWidget(self.rpb2)
25 | self.setLayout(self.layout)
26 |
27 | if __name__ == "__main__":
28 | app = QtWidgets.QApplication(sys.argv)
29 | widget = MyWidget()
30 | widget.show()
31 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/initPos.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | from PySide2extn.RoundProgressBar import roundProgressBar
4 |
5 | class MyWidget(QtWidgets.QWidget):
6 | def __init__(self):
7 | QtWidgets.QWidget.__init__(self)
8 |
9 | self.rpb = roundProgressBar()
10 | self.rpb2 = roundProgressBar()
11 | self.rpb.rpb_setInitialPos('South')
12 | self.rpb2.rpb_setInitialPos('East')
13 |
14 | self.layout = QtWidgets.QHBoxLayout()
15 | self.layout.addWidget(self.rpb)
16 | self.layout.addWidget(self.rpb2)
17 | self.setLayout(self.layout)
18 |
19 | if __name__ == "__main__":
20 | app = QtWidgets.QApplication(sys.argv)
21 | widget = MyWidget()
22 | widget.show()
23 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/line.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | #IMPORTING THE MODULE
4 | from RoundProgressBar import roundProgressBar
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | #CLASS INSTANCE
11 | self.rpb = roundProgressBar()
12 | self.rpb2 = roundProgressBar()
13 | self.rpb3 = roundProgressBar()
14 |
15 | #LINE WIDTH
16 | self.rpb.rpb_setLineWidth(10)
17 |
18 | #LINE CAP
19 | self.rpb.rpb_setLineCap('RoundCap')
20 | self.rpb2.rpb_setLineCap('SquareCap')
21 | self.rpb3.rpb_setLineCap('RoundCap')
22 |
23 | #LINE STYLE
24 | self.rpb3.rpb_setLineStyle('DotLine')
25 | self.rpb2.rpb_setLineStyle('DashLine')
26 |
27 | #SETTING THE VALUE
28 | self.rpb.rpb_setValue(85)
29 | self.rpb2.rpb_setValue(85)
30 | self.rpb3.rpb_setValue(85)
31 |
32 | self.layout = QtWidgets.QHBoxLayout()
33 | self.layout.addWidget(self.rpb)
34 | self.layout.addWidget(self.rpb2)
35 | self.layout.addWidget(self.rpb3)
36 | self.setLayout(self.layout)
37 |
38 | if __name__ == "__main__":
39 | app = QtWidgets.QApplication(sys.argv)
40 | widget = MyWidget()
41 | widget.show()
42 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/maxRange.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | #IMPORTING THE MODULE
4 | from PySide2extn.RoundProgressBar import roundProgressBar
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | #CLASS INSTANCE
11 | self.rpb = roundProgressBar()
12 | self.rpb2 = roundProgressBar()
13 | self.rpb3 = roundProgressBar()
14 |
15 | #SETTING THE RANGE : MIN-0 & MAX:360
16 | self.rpb.rpb_setMaximum(720)
17 | self.rpb2.rpb_setRange(0, 720)
18 | self.rpb3.rpb_setRange(0, 1000)
19 |
20 | #SETTING THE VALUE
21 | self.rpb.rpb_setValue(456)
22 | self.rpb2.rpb_setValue(456)
23 | self.rpb3.rpb_setValue(890)
24 |
25 | self.layout = QtWidgets.QHBoxLayout()
26 | self.layout.addWidget(self.rpb)
27 | self.layout.addWidget(self.rpb2)
28 | self.layout.addWidget(self.rpb3)
29 | self.setLayout(self.layout)
30 |
31 | if __name__ == "__main__":
32 | app = QtWidgets.QApplication(sys.argv)
33 | widget = MyWidget()
34 | widget.show()
35 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/path.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | #IMPORTING THE MODULE
4 | from PySide2extn.RoundProgressBar import roundProgressBar
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | #CLASS INSTANCE
11 | self.rpb = roundProgressBar()
12 | self.rpb2 = roundProgressBar()
13 |
14 | #CHANGING THE PROGRESSABR STYLE
15 | self.rpb.rpb_setBarStyle('Hybrid1')
16 |
17 | #CHANGING THE LINE COLOR AND WIDTH
18 | self.rpb.rpb_setLineWidth(3)
19 | self.rpb2.rpb_setLineWidth(8)
20 |
21 | #PATH WIDTH
22 | self.rpb.rpb_setPathWidth(15)
23 | self.rpb2.rpb_setPathWidth(2)
24 |
25 | #CHANGING THE PATH COLOR
26 | self.rpb.rpb_setPathColor((125, 255, 255))
27 | self.rpb2.rpb_setPathColor((0, 0, 0))
28 |
29 | #SETTING THE VALUE
30 | self.rpb.rpb_setValue(85)
31 | self.rpb2.rpb_setValue(85)
32 |
33 |
34 | self.layout = QtWidgets.QHBoxLayout()
35 | self.layout.addWidget(self.rpb)
36 | self.layout.addWidget(self.rpb2)
37 |
38 | self.setLayout(self.layout)
39 |
40 | if __name__ == "__main__":
41 | app = QtWidgets.QApplication(sys.argv)
42 | widget = MyWidget()
43 | widget.show()
44 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/style.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | from PySide2extn.RoundProgressBar import roundProgressBar
4 |
5 | class MyWidget(QtWidgets.QWidget):
6 | def __init__(self):
7 | QtWidgets.QWidget.__init__(self)
8 |
9 | self.rpb = roundProgressBar()
10 | self.rpb.rpb_setBarStyle('Pizza') #CHANGE THE BAR STYLE TO : 'Pizza'
11 |
12 | self.layout = QtWidgets.QVBoxLayout()
13 | self.layout.addWidget(self.rpb)
14 | self.setLayout(self.layout)
15 |
16 | if __name__ == "__main__":
17 | app = QtWidgets.QApplication(sys.argv)
18 | widget = MyWidget()
19 | widget.show()
20 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/rpb/textAll.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 | #IMPORTING THE MODULE
4 | from PySide2extn.RoundProgressBar import roundProgressBar
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | #CLASS INSTANCE
11 | self.rpb = roundProgressBar()
12 | self.rpb2 = roundProgressBar()
13 | self.rpb3 = roundProgressBar()
14 |
15 | #SETTING THE RANGE : MIN-0 & MAX:360
16 | self.rpb.rpb_setRange(0, 360)
17 | self.rpb2.rpb_setRange(0, 360)
18 | self.rpb3.rpb_setRange(0, 360)
19 |
20 | #CHANGING THE STYLE
21 | self.rpb.rpb_setBarStyle('Pizza')
22 | self.rpb2.rpb_setBarStyle('Hybrid2')
23 |
24 | #CHANGING THE TEXT TYPE : VALUE OR PERCENTAGE
25 | self.rpb.rpb_setTextFormat('Value')
26 | self.rpb2.rpb_setTextFormat('Percentage')
27 |
28 | #CHANGING THE TEXT SIZE
29 | self.rpb.rpb_setTextRatio(3)
30 | self.rpb2.rpb_setTextRatio(9)
31 |
32 | #CHANGING THE FONT
33 | self.rpb.rpb_setTextFont('Arial')
34 | self.rpb2.rpb_setTextFont('Times New Roman')
35 |
36 | #TEXT HIDDEN
37 | self.rpb3.rpb_enableText(False)
38 |
39 | #SETTING THE VALUE
40 | self.rpb.rpb_setValue(156)
41 | self.rpb2.rpb_setValue(156)
42 |
43 | self.layout = QtWidgets.QHBoxLayout()
44 | self.layout.addWidget(self.rpb)
45 | self.layout.addWidget(self.rpb2)
46 | self.layout.addWidget(self.rpb3)
47 | self.setLayout(self.layout)
48 |
49 | if __name__ == "__main__":
50 | app = QtWidgets.QApplication(sys.argv)
51 | widget = MyWidget()
52 | widget.show()
53 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/default.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | x = 0
7 | p = 1
8 |
9 | class MyWidget(QtWidgets.QWidget):
10 | def __init__(self):
11 | QtWidgets.QWidget.__init__(self)
12 |
13 | self.hello = 'Spiral Progress Bar'
14 | self.button = QtWidgets.QPushButton("Click me to change Value")
15 | self.text = QtWidgets.QLabel("Spiral Progress Bar")
16 | self.text.setAlignment(QtCore.Qt.AlignCenter)
17 |
18 | self.spb = spiralProgressBar() #CREATING THE SPIRAL PROGRESS BAR OBJECT
19 |
20 | self.layout = QtWidgets.QVBoxLayout()
21 | self.layout.addWidget(self.text)
22 | self.layout.addWidget(self.button)
23 |
24 | self.layout.addWidget(self.spb) # ADDING THE SPIRAL PROGRESS BAR OBJECT TO THE LAYOUT
25 |
26 | self.setLayout(self.layout)
27 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
28 |
29 | def magic(self):
30 | global x, p
31 | x = x + 10*p
32 | if x==100:
33 | p = -1
34 | elif x==0:
35 | p = 1
36 | self.spb.spb_setValue((x, x*2, x*3)) #CHANGING THE VALUE OF THE 3 DEFAULT PROGRESS BAR
37 | out_text = 'Spiral Progress Bar: ' + str(x) + '%, ' + str(2*x) + '%, ' + str(3*x) + '%'
38 | self.text.setText(out_text)
39 |
40 | if __name__ == "__main__":
41 | app = QtWidgets.QApplication(sys.argv)
42 | widget = MyWidget()
43 | widget.show()
44 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/direction.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbN = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 | self.spbN.spb_setNoProgressBar(2)
14 |
15 | #SETING THE INITIAL POSITION OF THE PROGRESS BAR: FROM OUTER-INWARDS
16 | self.spbN.spb_setDirection(('Clockwise', 'AntiClockwise'))
17 |
18 | self.spbN.spb_setValue((55, 55))
19 |
20 | self.layout = QtWidgets.QHBoxLayout()
21 | self.layout.addWidget(self.spbN)
22 | self.setLayout(self.layout)
23 |
24 | if __name__ == "__main__":
25 | app = QtWidgets.QApplication(sys.argv)
26 | widget = MyWidget()
27 | widget.show()
28 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/hiddenpath.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbN = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 |
14 | self.spbN.spb_lineWidth(15)
15 |
16 | self.spbN.spb_setPathHidden(True)
17 |
18 | self.spbN.spb_setValue((55, 15, 69))
19 |
20 | self.layout = QtWidgets.QHBoxLayout()
21 | self.layout.addWidget(self.spbN)
22 | self.setLayout(self.layout)
23 |
24 | if __name__ == "__main__":
25 | app = QtWidgets.QApplication(sys.argv)
26 | widget = MyWidget()
27 | widget.show()
28 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/initialPos.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbN = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 | self.spbN.spb_setNoProgressBar(4)
14 |
15 | #SETING THE INITIAL POSITION OF THE PROGRESS BAR: FROM OUTER-INWARDS
16 | self.spbN.spb_setInitialPos(('North', 'South', 'East', 'West'))
17 |
18 | self.spbN.spb_setValue((55, 65, 75, 85))
19 |
20 | self.layout = QtWidgets.QHBoxLayout()
21 | self.layout.addWidget(self.spbN)
22 | self.setLayout(self.layout)
23 |
24 | if __name__ == "__main__":
25 | app = QtWidgets.QApplication(sys.argv)
26 | widget = MyWidget()
27 | widget.show()
28 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/linecolor,style,e.t.c.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbN = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 | self.spbN.spb_setNoProgressBar(4)
14 |
15 | #LINE WIDTH: 15px
16 | self.spbN.spb_lineWidth(15)
17 | self.spbN.spb_setGap(17)
18 |
19 | #LINE COLOR
20 | self.spbN.spb_lineColor(((0, 125, 125), (125, 0, 125), (125, 255, 0), (125, 125, 125)))
21 |
22 | #LINE STYLE
23 | self.spbN.spb_lineStyle(('SolidLine', 'DotLine', 'DashLine', 'SolidLine'))
24 |
25 | #LINE CAP
26 | self.spbN.spb_lineCap(('SquareCap', 'RoundCap', 'RoundCap', 'SquareCap'))
27 |
28 | self.spbN.spb_setValue((55, 55, 55, 55))
29 |
30 | self.layout = QtWidgets.QHBoxLayout()
31 | self.layout.addWidget(self.spbN)
32 | self.setLayout(self.layout)
33 |
34 | if __name__ == "__main__":
35 | app = QtWidgets.QApplication(sys.argv)
36 | widget = MyWidget()
37 | widget.show()
38 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/main.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | #IMPORT THE EXTENSION LIBRARY
5 | from PySide2extn.SpiralProgressBar import spiralProgressBar
6 |
7 | x = 0
8 | p = 1
9 |
10 | class MyWidget(QtWidgets.QWidget):
11 | def __init__(self):
12 | QtWidgets.QWidget.__init__(self)
13 |
14 | self.hello = 'Spiral Progress Bar'
15 | self.button = QtWidgets.QPushButton("Click me to change Value")
16 | self.text = QtWidgets.QLabel("Spiral Progress Bar")
17 | self.text.setAlignment(QtCore.Qt.AlignCenter)
18 |
19 | #CREATING THE SPIRAL PROGRESS BAR OBJECT
20 | self.spb = spiralProgressBar()
21 |
22 | #ADDING WIDGETS TO THE VERTICAL LAYOUT
23 | self.layout = QtWidgets.QVBoxLayout()
24 | self.layout.addWidget(self.text)
25 | self.layout.addWidget(self.button)
26 |
27 | # ADDING THE SPIRAL PROGRESS BAR OBJECT TO THE LAYOUT
28 | self.layout.addWidget(self.spb)
29 |
30 | self.setLayout(self.layout)
31 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
32 |
33 | def magic(self):
34 | global x, p
35 | x = x + 10*p
36 | if x==100:
37 | p = -1
38 | elif x==0:
39 | p = 1
40 |
41 | #CHANGING THE VALUE OF THE 3 DEFAULT PROGRESS BAR
42 | self.spb.spb_setValue((x, x*2, x*3))
43 |
44 | out_text = 'Spiral Progress Bar: '
45 | out_text = out_text + str(x) + '%, ' + str(2*x) + '%, ' + str(3*x) + '%'
46 | self.text.setText(out_text)
47 |
48 | if __name__ == "__main__":
49 | app = QtWidgets.QApplication(sys.argv)
50 | widget = MyWidget()
51 | widget.show()
52 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/max,min,range.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbMinMax = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 | self.spbRange = spiralProgressBar() #SPIRAL PROGRESS BAR OBJECT
14 |
15 | #SPIRAL PROGRESS BAR spbMinMax : GREEN COLOR
16 | self.spbMinMax.spb_setMinimum((0, 0, 0)) #SETTING THE MINIMUM VALUE
17 | self.spbMinMax.spb_setMaximum((360, 360, 360)) #SETTING THE MAXIMUM VALUE
18 | self.spbMinMax.spb_lineColor(((0, 255, 0), (0, 255, 0), (0, 255, 0))) #GREEN COLOR
19 | self.spbMinMax.spb_setValue((300, 350, 289)) #SET THE CURRENT VALUE
20 |
21 | #SPIRAL PROGRESS BAR spbRange :BLUE COLOR
22 | self.spbRange.spb_setRange((0, 0, 0), (360, 360, 360)) #SETTING THE RANGE
23 | self.spbRange.spb_setValue((300, 350, 289)) #SETTING CURRENT VALUE
24 |
25 | self.layout = QtWidgets.QHBoxLayout()
26 | self.layout.addWidget(self.spbMinMax)
27 | self.layout.addWidget(self.spbRange)
28 | self.setLayout(self.layout)
29 |
30 | if __name__ == "__main__":
31 | app = QtWidgets.QApplication(sys.argv)
32 | widget = MyWidget()
33 | widget.show()
34 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/PySide2extn/examples/spb/varWidthGap.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from PySide2 import QtCore, QtWidgets, QtGui
3 |
4 | from PySide2extn.SpiralProgressBar import spiralProgressBar #IMPORT THE EXTENSION LIBRARY
5 |
6 | class MyWidget(QtWidgets.QWidget):
7 | def __init__(self):
8 | QtWidgets.QWidget.__init__(self)
9 |
10 | self.hello = 'Spiral Progress Bar'
11 |
12 | self.spbN = spiralProgressBar() #SPIRAL PROGRESSBAR OBJECT
13 |
14 | self.spbN.spb_lineWidth(15)
15 |
16 | #VARIABLE WIDTH AND WIDTH INCREMENT
17 | self.spbN.variableWidth(True)
18 | self.spbN.spb_widthIncrement(5)
19 |
20 | self.spbN.spb_setValue((55, 55, 55))
21 |
22 | self.layout = QtWidgets.QHBoxLayout()
23 | self.layout.addWidget(self.spbN)
24 | self.setLayout(self.layout)
25 |
26 | if __name__ == "__main__":
27 | app = QtWidgets.QApplication(sys.argv)
28 | widget = MyWidget()
29 | widget.show()
30 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PySide2extn
2 |
3 | An extension for the Python PySide2 Qt Framework which expands the scope of the PySide2 package with many different modern widgets. Current release is occupied with two widget which are not natively present in the PySide2 package.
4 |
5 | *RoundProgressBar*
6 |
7 |
8 |
9 |
10 |
11 | *SpiralProgressBar*
12 |
13 |
14 |
15 |
16 |
17 | :point_right: Go to [Home Page](https://anjalp.github.io/PySide2extn/) of Documentation for further Help
18 |
19 | ## Getting Started
20 |
21 | * Install PySide2extn using `pip`
22 |
23 | ``` python
24 | pip install PySide2extn
25 | ```
26 |
27 | * Build from source: After cloning the repo, go to the directory and open `cmd` or `terminal`
28 |
29 | ``` bash
30 | $ python3 setup.py sdist bdist_wheel
31 | ```
32 |
33 | * Install from `.whl` file.
34 |
35 | ```python
36 | pip install file
37 | ```
38 |
39 | To verify that installation is complete, print out the `pip list` and search for the PySide2extn package.
40 |
41 | :point_right: For more details go to the [Official PySide2extn Documentation Getting Started](https://anjalp.github.io/PySide2extn/pages/get_started)
42 |
43 | ## Quick Demo
44 |
45 | Quick demo help you to check weather you have successfully installed the Python Package. It comes with a UI loaded with all the widgets in this package with its different customized views. Users can easily differentiate the different styling elements used by widgets.
46 |
47 | After installing the PySide2extn/PyQt5extn the users can try out quick demo by:
48 |
49 | 1. Open the `cmd` or `terminal`. Open `Python`
50 |
51 | ```python
52 | >> from PySide2extn.demo import demo
53 | >> demo.main() #PRESS ENTER AND YOU WILL GET A DEMO APPLICATION
54 | ```
55 |
56 |
57 |
58 |
59 |
60 | ## Documentation
61 |
62 | Official Documentation for PySide2extn is detailed in: [PySide2extn Documentation](https://anjalp.github.io/PySide2extn/).
63 |
64 | :point_right: [Getting Started](https://anjalp.github.io/PySide2extn/pages/get_started)
65 |
66 | :point_right: [Examples](https://anjalp.github.io/PySide2extn/pages/example)
67 |
68 | :point_right: [Classes](https://anjalp.github.io/PySide2extn/pages/classes)
69 |
70 | :point_right: [Errors and Exceptions](https://anjalp.github.io/PySide2extn/pages/error&exception)
71 |
72 | :point_right: [Version History](https://anjalp.github.io/PySide2extn/pages/version)
73 |
74 | :point_right: [FAQ's](https://anjalp.github.io/PySide2extn/pages/faqs)
75 |
76 | :point_right: [Official PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA)
77 |
78 | ## Examples
79 |
80 | * **Default Round Progress Bar**
81 |
82 | ```python
83 | import sys
84 | from PySide2 import QtCore, QtWidgets, QtGui
85 |
86 | from PySide2extn.RoundProgressBar import roundProgressBar #IMPORT THE EXTENSION LIBRARY
87 |
88 | x = 0
89 | p = 1
90 |
91 | class MyWidget(QtWidgets.QWidget):
92 | def __init__(self):
93 | QtWidgets.QWidget.__init__(self)
94 |
95 | self.hello = 'Round Progress Bar'
96 | self.button = QtWidgets.QPushButton("Click me to change Value")
97 | self.text = QtWidgets.QLabel("Round Progress Bar")
98 | self.text.setAlignment(QtCore.Qt.AlignCenter)
99 |
100 | #CREATING THE ROUND PROGRESS BAR OBJECT
101 | self.rpb = roundProgressBar()
102 |
103 | self.layout = QtWidgets.QVBoxLayout()
104 | self.layout.addWidget(self.text)
105 | self.layout.addWidget(self.button)
106 |
107 | # ADDING THE ROUND PROGRESS BAR OBJECT TO THE # BOTTOM OF THE LAYOUT
108 | self.layout.addWidget(self.rpb)
109 |
110 | self.setLayout(self.layout)
111 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
112 |
113 | def magic(self):
114 | global x, p
115 | x = x + 10*p
116 | if x==100:
117 | p = -1
118 | elif x==0:
119 | p = 1
120 | self.rpb.rpb_setValue(x) #CHANGING THE VALUE OF THE PROGRESS BAR
121 | out_text = 'Round Progress Bar: ' + str(x) + '%'
122 | self.text.setText(out_text)
123 |
124 | if __name__ == "__main__":
125 | app = QtWidgets.QApplication(sys.argv)
126 | widget = MyWidget()
127 | widget.show()
128 | sys.exit(app.exec_())
129 | ```
130 |
131 |
132 |
133 |
134 |
135 | In this demo, we first created an object of the Round Progress Bar:
136 |
137 | ```python
138 | self.rpb = roundProgressBar() #CREATING THE ROUND PROGRESS BAR OBJECT
139 | ```
140 |
141 | After that calling the Round Progress Bar object to display the value of progress using:
142 |
143 | ```python
144 | self.rpb.rpb_setValue(x) #CHANGING THE VALUE OF THE PROGRESS BAR
145 | ```
146 |
147 | The `rpb_setValue(value)` takes an `int` as an argument and updates to change the value of the progress bar to the value given.
148 |
149 | :point_right: For More examples on Round Progress Bar go to: [Official PySide2extn Documentation Examples](https://anjalp.github.io/PySide2extn/pages/examples/rpbExamples)
150 |
151 | * **Default Spiral Progress Bar**
152 |
153 | ```python
154 | import sys
155 | from PySide2 import QtCore, QtWidgets, QtGui
156 |
157 | #IMPORT THE EXTENSION LIBRARY
158 | from PySide2extn.SpiralProgressBar import spiralProgressBar
159 |
160 | x = 0
161 | p = 1
162 |
163 | class MyWidget(QtWidgets.QWidget):
164 | def __init__(self):
165 | QtWidgets.QWidget.__init__(self)
166 |
167 | self.hello = 'Spiral Progress Bar'
168 | self.button = QtWidgets.QPushButton("Click me to change Value")
169 | self.text = QtWidgets.QLabel("Spiral Progress Bar")
170 | self.text.setAlignment(QtCore.Qt.AlignCenter)
171 |
172 | #CREATING THE SPIRAL PROGRESS BAR OBJECT
173 | self.spb = spiralProgressBar()
174 |
175 | #ADDING WIDGETS TO THE VERTICAL LAYOUT
176 | self.layout = QtWidgets.QVBoxLayout()
177 | self.layout.addWidget(self.text)
178 | self.layout.addWidget(self.button)
179 |
180 | # ADDING THE SPIRAL PROGRESS BAR OBJECT TO THE LAYOUT
181 | self.layout.addWidget(self.spb)
182 |
183 | self.setLayout(self.layout)
184 | self.button.clicked.connect(self.magic) #BUTTON PRESSED EVENT
185 |
186 | def magic(self):
187 | global x, p
188 | x = x + 10*p
189 | if x==100:
190 | p = -1
191 | elif x==0:
192 | p = 1
193 |
194 | #CHANGING THE VALUE OF THE 3 DEFAULT PROGRESS BAR
195 | self.spb.spb_setValue((x, x*2, x*3))
196 |
197 | out_text = 'Spiral Progress Bar: '
198 | out_text = out_text + str(x) + '%, ' + str(2*x) + '%, ' + str(3*x) + '%'
199 | self.text.setText(out_text)
200 |
201 | if __name__ == "__main__":
202 | app = QtWidgets.QApplication(sys.argv)
203 | widget = MyWidget()
204 | widget.show()
205 | sys.exit(app.exec_())
206 | ```
207 |
208 |
209 |
210 |
211 |
212 | - Here first create a spiralProgressBar object and then add the progress bar to a layout and control the steps of the progress bar by the clicking of the button.
213 |
214 | ```python
215 | self.spb = spiralProgressBar()
216 | ```
217 |
218 | - Here we create a spiralProgressBar object instance and then use the `self.spb` as the spiral progress bar to influence its charactor like:
219 |
220 | ```python
221 | self.spb.spb_setValue((x, x*2, x*3))
222 | ```
223 |
224 | - Since the default progress bar has 3 individual concentric circle, where each can be controlled individually, we pass a tuple containing the individual value for manipulating each concentric progress bar, to the function `spb_setValue()` , which only accepts a tuple of length equal to the number of concentric progress bar. Every function which can manipulate the properties of the Spiral Progress Bar uses the same idea. The order of entering the value are shown below:
225 |
226 |
227 |
228 |
229 |
230 | :point_right: For More examples on Spiral Progress Bar go to: [Official PySide2extn Documentation Examples](https://anjalp.github.io/PySide2extn/pages/examples/spbExamples)
231 |
232 | ## Help
233 |
234 | - **PySide2extn/PyQt5extn is not working in my setup**: Go to Github [PySide2extn](https://github.com/anjalp/PySide2extn) repo. and raise an issue or just fill the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA).
235 | - **Unknown errors**: Raise a GitHub issue or fill the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA)
236 |
237 | ## Support
238 |
239 | - Please feel free to contribute to the project by sharing the idea you have, which is not natively present in the PySide2/PyQt5 but essential for your workflow.
240 | - You can fill up the official [PySide2extn/PyQt5extn Form](https://forms.gle/yfKVK85sLLMJMCfJA) where you just Brief the idea you have and also provide an active email address which is required for us to connect you.
241 | - If your idea worth the use, then definitely it will be available in the next update of the PySide2extn/PyQt5extn.
242 | - If this package made your life easy, then please share your experience with us [Here](https://forms.gle/yfKVK85sLLMJMCfJA)
243 |
244 | :smiley: Support my work by forking or downloading this project, check it out, and [share the experience](https://forms.gle/yfKVK85sLLMJMCfJA).
245 |
246 | :smiley: Support like this motivates me to do more creative, work for Open Source.
247 |
248 |
--------------------------------------------------------------------------------
/assets/demo/rpb.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/demo/rpb.PNG
--------------------------------------------------------------------------------
/assets/fav/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/android-chrome-192x192.png
--------------------------------------------------------------------------------
/assets/fav/android-chrome-256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/android-chrome-256x256.png
--------------------------------------------------------------------------------
/assets/fav/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/apple-touch-icon.png
--------------------------------------------------------------------------------
/assets/fav/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #2b5797
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/assets/fav/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/favicon-16x16.png
--------------------------------------------------------------------------------
/assets/fav/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/favicon-32x32.png
--------------------------------------------------------------------------------
/assets/fav/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/favicon.ico
--------------------------------------------------------------------------------
/assets/fav/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/fav/mstile-150x150.png
--------------------------------------------------------------------------------
/assets/fav/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
34 |
--------------------------------------------------------------------------------
/assets/fav/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "short_name": "",
4 | "icons": [
5 | {
6 | "src": "/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/android-chrome-256x256.png",
12 | "sizes": "256x256",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/assets/getstart/qtdes1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes1.PNG
--------------------------------------------------------------------------------
/assets/getstart/qtdes2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes2.PNG
--------------------------------------------------------------------------------
/assets/getstart/qtdes3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes3.PNG
--------------------------------------------------------------------------------
/assets/getstart/qtdes4.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes4.PNG
--------------------------------------------------------------------------------
/assets/getstart/qtdes5.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes5.PNG
--------------------------------------------------------------------------------
/assets/getstart/qtdes6.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/getstart/qtdes6.PNG
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/logo.png
--------------------------------------------------------------------------------
/assets/rpb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb.png
--------------------------------------------------------------------------------
/assets/rpb/96.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/96.PNG
--------------------------------------------------------------------------------
/assets/rpb/circlecolor.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/circlecolor.PNG
--------------------------------------------------------------------------------
/assets/rpb/dashline.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/dashline.PNG
--------------------------------------------------------------------------------
/assets/rpb/defa.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/defa.PNG
--------------------------------------------------------------------------------
/assets/rpb/dotline.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/dotline.PNG
--------------------------------------------------------------------------------
/assets/rpb/font.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/font.PNG
--------------------------------------------------------------------------------
/assets/rpb/hybrid2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/hybrid2.PNG
--------------------------------------------------------------------------------
/assets/rpb/linecolor.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/linecolor.PNG
--------------------------------------------------------------------------------
/assets/rpb/linwwidth.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/linwwidth.PNG
--------------------------------------------------------------------------------
/assets/rpb/pathcolor.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/pathcolor.PNG
--------------------------------------------------------------------------------
/assets/rpb/pathwidth.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/pathwidth.PNG
--------------------------------------------------------------------------------
/assets/rpb/pie.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/pie.PNG
--------------------------------------------------------------------------------
/assets/rpb/pizza.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/pizza.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_cap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_cap.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_circle.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_circle.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_demo.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_demo.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_demo2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_demo2.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_dir.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_dir.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_direction.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_direction.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_fifty.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_fifty.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_fig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_fig.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_initPos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_initPos.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_lineAll.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_lineAll.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_maxRange.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_maxRange.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_name.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_pathAll.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_pathAll.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_percent.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_percent.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_pie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_pie.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_sfifty.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_sfifty.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_strPos.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_strPos.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_textall1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_textall1.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_textall2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_textall2.PNG
--------------------------------------------------------------------------------
/assets/rpb/rpb_typ.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_typ.png
--------------------------------------------------------------------------------
/assets/rpb/rpb_value.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/rpb_value.PNG
--------------------------------------------------------------------------------
/assets/rpb/south.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/south.PNG
--------------------------------------------------------------------------------
/assets/rpb/textcolor.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/rpb/textcolor.PNG
--------------------------------------------------------------------------------
/assets/spb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb.png
--------------------------------------------------------------------------------
/assets/spb/spb_defEx.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_defEx.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_default.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_default.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_demo.png
--------------------------------------------------------------------------------
/assets/spb/spb_direction.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_direction.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_initialPos.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_initialPos.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_initpod.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_initpod.png
--------------------------------------------------------------------------------
/assets/spb/spb_line.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_line.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_minmaxrange.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_minmaxrange.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_norm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_norm.png
--------------------------------------------------------------------------------
/assets/spb/spb_order.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_order.png
--------------------------------------------------------------------------------
/assets/spb/spb_pathvisible.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_pathvisible.PNG
--------------------------------------------------------------------------------
/assets/spb/spb_schem.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_schem.png
--------------------------------------------------------------------------------
/assets/spb/spb_type.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_type.png
--------------------------------------------------------------------------------
/assets/spb/spb_variable.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/assets/spb/spb_variable.PNG
--------------------------------------------------------------------------------
/build/lib/PySide2extn/RoundProgressBar.py:
--------------------------------------------------------------------------------
1 | #############################################################################################
2 | # CREATOR: ANJAL.P #
3 | # ON: 2020 SEP. #
4 | # AIM: To Extend the capability of the PySide2 and PyQt5 Python library with easy to #
5 | # use extension containing commonly used widgets which is not natively supported #
6 | # by the Qt Frame work (or atleast for Python version of Qt). #
7 | # VERSION: v1.0.0 #
8 | # NOTES: CLASS : RoundProgressBar : Can be accessed by : importing #
9 | # from PySide2extn.RoundProgressBar import roundProgressBar #
10 | # REFER: Github: https://github.com/anjalp/PySide2extn #
11 | #############################################################################################
12 |
13 |
14 | from PySide2 import QtWidgets, QtCore
15 | from PySide2.QtCore import Qt, QSize
16 | from PySide2.QtGui import QBrush, QColor, QPainter, QPen, QPaintEvent, QFont
17 |
18 |
19 | class roundProgressBar(QtWidgets.QWidget):
20 |
21 | def __init__(self, parent=None):
22 | super(roundProgressBar, self).__init__(parent)
23 |
24 | self.positionX = 0
25 | self.positionY = 0
26 | self.posFactor = 0
27 |
28 | self.rpb_minimumSize = (0, 0)
29 | self.rpb_maximumSize = (0, 0)
30 | self.rpb_dynamicMin = True
31 | self.rpb_dynamicMax = True
32 | self.rpb_Size = 0
33 | self.sizeFactor = 0
34 |
35 | self.rpb_maximum = 100
36 | self.rpb_minimum = 0
37 |
38 | self.rpb_type = self.barStyleFlags.Donet
39 | self.startPosition = self.startPosFlags.North
40 | self.rpb_direction = self.rotationFlags.Clockwise
41 |
42 | self.rpb_textType = self.textFlags.Percentage
43 | self.rpb_textColor = (0, 159, 227)
44 | self.rpb_textWidth = self.rpb_Size/8
45 | self.rpb_textFont = 'Segoe UI'
46 | self.rpb_textValue = '12%'
47 | self.rpb_textRatio = 8
48 | self.textFactorX = 0
49 | self.textFactorY = 0
50 | self.dynamicText = True
51 | self.rpb_textActive = True
52 |
53 | self.lineWidth = 5
54 | self.pathWidth = 5
55 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
56 | self.rpb_lineCap = self.lineCapFlags.SquareCap
57 | self.lineColor = (0, 159, 227)
58 | self.pathColor = (218, 218, 218)
59 |
60 | self.rpb_circleColor = (218, 218, 218)
61 | self.rpb_circleRatio = 0.8
62 | self.rpb_circlePosX = 0
63 | self.rpb_circlePosY = 0
64 |
65 | self.rpb_pieColor = (200, 200, 200)
66 | self.rpb_pieRatio = 1
67 | self.rpb_piePosX = 0
68 | self.rpb_piePosY = 0
69 |
70 | self.rpb_value = -45*16
71 |
72 | if self.rpb_dynamicMin:
73 | self.setMinimumSize(QSize(self.lineWidth*6 + self.pathWidth*6, self.lineWidth*6 + self.pathWidth*6))
74 |
75 | #------------------------------------------------------CLASS ENUMERATORS
76 | class lineStyleFlags:
77 | SolidLine = Qt.SolidLine
78 | DotLine = Qt.DotLine
79 | DashLine = Qt.DashLine
80 |
81 | class lineCapFlags:
82 | SquareCap = Qt.SquareCap
83 | RoundCap = Qt.RoundCap
84 |
85 | class barStyleFlags:
86 | Donet = 0
87 | Line = 1
88 | Pie = 2
89 | Pizza = 3
90 | Hybrid1 = 4
91 | Hybrid2 = 5
92 |
93 | class rotationFlags:
94 | Clockwise = -1
95 | AntiClockwise = 1
96 |
97 | class textFlags:
98 | Value = 0
99 | Percentage = 1
100 |
101 | class startPosFlags:
102 | North = 90*16
103 | South = -90*16
104 | East = 0*16
105 | West = 180*16
106 |
107 | #------------------------------------------------------METHODS FOR CHANGING THE PROPERTY OF THE ROUNDPROGRESSBAR :SOLTS
108 |
109 | def rpb_setMinimumSize(self, width, height):
110 | """
111 | Minimum Size of the Widget
112 | ...
113 |
114 | Parameters
115 | --------------
116 |
117 | width : int
118 | width of the Widget
119 |
120 | height : int
121 | height of the Widget
122 |
123 | Raises
124 | --------------
125 | Exception : Sorry Width/Height should be an int
126 | """
127 |
128 | if type(width)!=type(5) or type(height)!=type(5):
129 | raise Exception('Sorry Width/Height should be an int')
130 | return
131 | self.rpb_dynamicMin = False
132 | self.setMinimumSize(width, height)
133 | self.rpb_minimumSize = (width, height)
134 | self.update()
135 |
136 | def rpb_setMaximumSize(self, width, height):
137 | """
138 | Maximum Size of the Widget
139 | ...
140 |
141 | Parameters
142 | --------------
143 |
144 | width : int
145 | width of the Widget
146 |
147 | height : int
148 | height of the Widget
149 |
150 | Raises
151 | --------------
152 | Exception : Sorry Width/Height should be an int
153 | """
154 |
155 | if type(width)!=type(5) or type(height)!=type(5):
156 | raise Exception('Sorry Width/Height should be an int')
157 | return
158 | self.rpb_dynamicMax = False
159 | self.setMaximumSize(width, height)
160 | self.rpb_maximumSize = (width, height)
161 | self.update()
162 |
163 |
164 | def rpb_setMaximum(self, maximum):
165 | """
166 | Maximum Value of the Progressbar
167 | ...
168 |
169 | Parameters
170 | --------------
171 |
172 | maximum : int
173 | Maximum value of the round progress bar
174 |
175 | Raises
176 | --------------
177 | Exception : Maximum and Minimum cannot be the Same
178 | """
179 |
180 | if self.rpb_minimum==maximum: #FOR AVOIDING DIVISION BY ZERO ERROR IN FUTURE
181 | raise Exception("Maximum and Minimum cannot be the Same")
182 | return
183 | if self.rpb_maximum != maximum:
184 | self.rpb_maximum = maximum
185 | self.update()
186 |
187 | def rpb_setMinimum(self, minimum):
188 | """
189 | Minimum Value of the Progressbar
190 | ...
191 |
192 | Parameters
193 | --------------
194 |
195 | minimum : int
196 | Minimum value of the round progress bar
197 |
198 | Raises
199 | --------------
200 | Exception : Maximum and Minimum cannot be the Same
201 | """
202 |
203 | if self.rpb_minimum==maximum: #FOR AVOIDING DIVISION BY ZERO ERROR IN FUTURE
204 | raise Exception("Maximum and Minimum cannot be the Same")
205 | return
206 | if self.rpb_minimum != minimum:
207 | self.rpb_minimum = minimum
208 | self.update()
209 |
210 | def rpb_setRange(self, maximum, minimum):
211 | """
212 | Range include the maximum and the minimum in one go.
213 | ...
214 |
215 | Parameters
216 | --------------
217 |
218 | maximum : int
219 | Maximum value of the round progress bar
220 |
221 | minimum : int
222 | Minimum value for the round progress bar
223 |
224 | Raises
225 | --------------
226 | none
227 | """
228 |
229 | if minimum > maximum:
230 | maximum, minimum = minimum, maximum
231 | if self.rpb_maximum != maximum:
232 | self.rpb_maximum = maximum
233 | if self.rpb_minimum != minimum:
234 | self.rpb_minimum = minimum
235 | self.update()
236 |
237 | def rpb_setInitialPos(self, pos):
238 | """
239 | Starting position of the round progress bar
240 | ...
241 |
242 | Parameters
243 | --------------
244 |
245 | pos : String
246 | Position string: 'North', 'South', 'East' and 'West'
247 |
248 | Raises
249 | --------------
250 | ValueError : Maximum and Minimum cannot be the Same
251 | """
252 |
253 | if pos=='North':
254 | self.startPosition = self.startPosFlags.North
255 | elif pos=='South':
256 | self.startPosition = self.startPosFlags.South
257 | elif pos=='East':
258 | self.startPosition = self.startPosFlags.East
259 | elif pos=='West':
260 | self.startPosition = self.startPosFlags.West
261 | else:
262 | raise Exception("Initial Position String can be: 'South', 'North'")
263 | return
264 |
265 | def rpb_setValue(self, value):
266 | """
267 | Set progress value
268 | ...
269 |
270 | Parameters
271 | --------------
272 |
273 | value : int
274 | The value of the progress bar in int. The value should be: min<=value<=max
275 |
276 | Raises
277 | --------------
278 | none
279 | """
280 |
281 | if self.rpb_value != value:
282 | if value >= self.rpb_maximum:
283 | roundProgressBar.convertInputValue(self, self.rpb_maximum)
284 | elif value < self.rpb_minimum:
285 | roundProgressBar.convertInputValue(self, self.rpb_minimum)
286 | else:
287 | roundProgressBar.convertInputValue(self, value)
288 | self.update()
289 |
290 | def rpb_reset(self):
291 | """
292 | Reset the progress bar to 0%
293 | ...
294 |
295 | Parameters
296 | --------------
297 | none
298 |
299 | Raises
300 | --------------
301 | none
302 | """
303 |
304 | roundProgressBar.convertInputValue(self, self.rpb_minimum)
305 | self.update()
306 |
307 | def rpb_setGeometry(self, posX, posY):
308 | """
309 | Set the X and Y position of the round progress bar.
310 | ...
311 |
312 | Parameters
313 | --------------
314 |
315 | posX : int
316 | The position of the round progress bar in int for X axis.
317 |
318 | posY : int
319 | The position of the round progress bar in int for Y axis.
320 |
321 | Raises
322 | --------------
323 | none
324 | """
325 |
326 | if self.positionX != posX:
327 | self.positionX = posX
328 | if self.positionY != posY:
329 | self.positionY = posY
330 | self.update()
331 |
332 | def rpb_setLineWidth(self, width):
333 | """
334 | Line Width of the line in round progress bar.
335 | ...
336 |
337 | Parameters
338 | --------------
339 |
340 | width: int
341 | Line width corresponding to the width in px.
342 |
343 | Raises
344 | --------------
345 | Exception: Line Width should be in int
346 | """
347 |
348 | if type(width)!=type(5):
349 | raise Exception('Line Width should be in int')
350 | return
351 | if self.lineWidth != width:
352 | self.lineWidth = width
353 | self.update()
354 |
355 | def rpb_setLineColor(self, rgb):
356 | """
357 | Line Color of the progress bar.
358 | ...
359 |
360 | Parameters
361 | --------------
362 |
363 | rgb: tuple: (R, G, B)
364 | Color is passed as a tuple of values for red, blue and green in the order: (R, G, B)
365 |
366 | Raises
367 | --------------
368 | Exception: Line Color accepts a tuple: (R, G, B).
369 | """
370 |
371 | if type(rgb)!=type(()):
372 | raise Exception("Line Color accepts a tuple: (R, G, B).")
373 | return
374 | if self.lineColor != rgb:
375 | self.lineColor = rgb
376 | self.update()
377 |
378 | def rpb_setPathColor(self, rgb):
379 | """
380 | Path Color settings.
381 | ...
382 |
383 | Parameters
384 | --------------
385 |
386 | rgb: tuple: (R, G, B)
387 | Color is passed as a tuple of values for red, blue and green in the order: (R, G, B)
388 |
389 | Raises
390 | --------------
391 | Exception: Path Color accepts a tuple: (R, G, B).
392 | """
393 |
394 | if type(rgb)!=type(()):
395 | raise Exception("Path Color accepts a tuple: (R, G, B).")
396 | return
397 | if self.pathColor != rgb:
398 | self.pathColor = rgb
399 | self.update()
400 |
401 | def rpb_setPathWidth(self, width):
402 | """
403 | Path width settings.
404 | ...
405 |
406 | Parameters
407 | --------------
408 |
409 | width: int
410 | Width of the path in px
411 |
412 | Raises
413 | --------------
414 | Exception: Line Width should be in int
415 | """
416 |
417 | if type(width)!=type(5):
418 | raise Exception('Path Width should be in int')
419 | return
420 | if self.pathWidth != width:
421 | self.pathWidth = width
422 | self.update()
423 |
424 | def rpb_setDirection(self, direction):
425 | """
426 | Direction of rotation of the progress bar.
427 | ...
428 |
429 | Parameters
430 | --------------
431 |
432 | direction: string
433 | string can be: 'AntiClockwise' or 'Clockwise'. Default: 'Clockwise'.
434 |
435 | Raises
436 | --------------
437 | Exception: Direction can only be: 'Clockwise' and 'AntiClockwise'
438 | """
439 |
440 | if direction == 'Clockwise' or direction == -1:
441 | self.rpb_direction = self.rotationFlags.Clockwise
442 | elif direction == 'AntiClockwise' or direction == 1:
443 | self.rpb_direction = self.rotationFlags.AntiClockwise
444 | else:
445 | raise Exception("Direction can only be: 'Clockwise' and 'AntiClockwise' and Not: " + str(direction))
446 | return
447 | self.update()
448 |
449 | def rpb_setBarStyle(self, style):
450 | """
451 | Bar Style of the progress bar.
452 | ...
453 |
454 | Parameters
455 | --------------
456 |
457 | style: String
458 | String of the styles of the progress bar: 'Donet', 'Pie', 'line', 'Hybrid1', 'Hybrid2', 'Pizza'
459 |
460 | Raises
461 | --------------
462 | Exception: Round Progress Bar has only the following styles: 'Line', 'Donet', 'Hybrid1', 'Pizza', 'Pie' and 'Hybrid2'
463 | """
464 |
465 | if style=='Donet':
466 | self.rpb_type = self.barStyleFlags.Donet
467 | elif style=='Line':
468 | self.rpb_type = self.barStyleFlags.Line
469 | elif style=='Pie':
470 | self.rpb_type = self.barStyleFlags.Pie
471 | elif style=='Pizza':
472 | self.rpb_type = self.barStyleFlags.Pizza
473 | elif style=='Hybrid1':
474 | self.rpb_type = self.barStyleFlags.Hybrid1
475 | elif style=='Hybrid2':
476 | self.rpb_type = self.barStyleFlags.Hybrid2
477 | else:
478 | raise Exception("Round Progress Bar has only the following styles: 'Line', 'Donet', 'Hybrid1', 'Pizza', 'Pie' and 'Hybrid2'")
479 | return
480 | self.update()
481 |
482 | def rpb_setLineStyle(self, style):
483 | """
484 | Line Style setting.
485 | ...
486 |
487 | Parameters
488 | --------------
489 |
490 | style: String
491 | Line style: 'DotLine', 'DashLine', 'SolidLine', passed as a string.
492 |
493 | Raises
494 | --------------
495 | none
496 | """
497 |
498 | if style == 'SolidLine':
499 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
500 | elif style == 'DotLine':
501 | self.rpb_lineStyle = self.lineStyleFlags.DotLine
502 | elif style == 'DashLine':
503 | self.rpb_lineStyle = self.lineStyleFlags.DashLine
504 | else:
505 | self.rpb_lineStyle = self.lineStyleFlags.SolidLine
506 |
507 | def rpb_setLineCap(self, cap):
508 | """
509 | Line Cap setting.
510 | ...
511 |
512 | Parameters
513 | --------------
514 |
515 | cap: String
516 | Cap is the end point of a stroke. It can be: 'RoundCap' or 'SquareCap'
517 |
518 | Raises
519 | --------------
520 | none
521 | """
522 |
523 | if cap=='SquareCap':
524 | self.rpb_lineCap = self.lineCapFlags.SquareCap
525 | elif cap == 'RoundCap':
526 | self.rpb_lineCap = self.lineCapFlags.RoundCap
527 |
528 | def rpb_setTextColor(self, rgb):
529 | """
530 | Text color of the text inside the progress bar
531 | ...
532 |
533 | Parameters
534 | --------------
535 |
536 | rgb: tuple
537 | Color of the text in the format: (R, G, B)
538 |
539 | Raises
540 | --------------
541 | none
542 | """
543 |
544 | if self.rpb_textColor != rgb:
545 | self.rpb_textColor = rgb
546 | self.update()
547 |
548 | def rpb_setTextFont(self, font):
549 | """
550 | Font of the text inside the round progress bar
551 | ...
552 |
553 | Parameters
554 | --------------
555 |
556 | font: str
557 | Name of the font in string
558 |
559 | Raises
560 | --------------
561 | none
562 | """
563 |
564 | if self.rpb_textFont != font:
565 | self.rpb_textFont = font
566 | self.update()
567 |
568 | def rpb_setTextFormat(self, textTyp):
569 | """
570 | Text formatter i.e. the value or the percentage.
571 | ...
572 |
573 | Parameters
574 | --------------
575 |
576 | textTyp: str
577 | 'value', 'percentage'
578 |
579 | Raises
580 | --------------
581 | none
582 | """
583 |
584 | if textTyp == 'Value':
585 | self.rpb_textType = self.textFlags.Value
586 | elif textTyp == 'Percentage':
587 | self.rpb_textType = self.textFlags.Percentage
588 | else:
589 | self.rpb_textType = self.textFlags.Percentage
590 |
591 | def rpb_setTextRatio(self, ratio):
592 | """
593 | Text ratio with respect to the size of the progress bar.
594 | ...
595 |
596 | Parameters
597 | --------------
598 |
599 | ratio: int
600 | In number from 3 to 50 corresponding to 1/3 or 1/50 the size of the roundprogressbar.
601 |
602 | Raises
603 | --------------
604 | none
605 | """
606 |
607 | if self.rpb_textRatio != ratio:
608 | if ratio < 3:
609 | ratio = 3
610 | elif ratio > 50:
611 | ratio = 50
612 | self.rpb_textRatio = ratio
613 | self.update()
614 |
615 | def rpb_setTextWidth(self, width):
616 | """
617 | Text Width.
618 | ...
619 |
620 | Parameters
621 | --------------
622 |
623 | font: int
624 | Text constant width. Will not change during the widget resize.
625 |
626 | Raises
627 | --------------
628 | none
629 | """
630 |
631 | self.dynamicText = False
632 | if width > 0:
633 | self.rpb_textWidth = width
634 | self.update()
635 |
636 | def rpb_setCircleColor(self, rgb):
637 | """
638 | Circle color fill inside the circle.
639 | ...
640 |
641 | Parameters
642 | --------------
643 |
644 | font: tuple
645 | The color of the circle in the tuple corresponding to the (R, G, B).
646 |
647 | Raises
648 | --------------
649 | none
650 | """
651 |
652 | if self.rpb_circleColor != rgb:
653 | self.rpb_circleColor = rgb
654 | self.update()
655 |
656 | def rpb_setCircleRatio(self, ratio):
657 | """
658 | Circle ration corresponding to the round progress bar.
659 | ...
660 |
661 | Parameters
662 | --------------
663 |
664 | font: int
665 | Integer corresponding to the size of the progress bar to that of the round progress bar.
666 |
667 | Raises
668 | --------------
669 | none
670 | """
671 |
672 | if self.rpb_circleRatio != ratio:
673 | self.rpb_circleRatio = ratio
674 | self.update()
675 |
676 | def rpb_setPieColor(self, rgb):
677 | """
678 | Pie color inside the fill.
679 | ...
680 |
681 | Parameters
682 | --------------
683 |
684 | font: tuple
685 | Tuple consist in format (R, G, B). Same as color setting to Line.
686 |
687 | Raises
688 | --------------
689 | none
690 | """
691 |
692 | if self.rpb_pieColor != rgb:
693 | self.rpb_pieColor = rgb
694 | self.update()
695 |
696 | def rpb_setPieRatio(self, ratio):
697 | """
698 | Pie Ratio
699 | ...
700 |
701 | Parameters
702 | --------------
703 |
704 | font: int
705 | Ratio corresponding to the size between the roundprogressbar and the pie size.
706 |
707 | Raises
708 | --------------
709 | none
710 | """
711 |
712 | if self.rpb_pieRatio != ratio:
713 | self.rpb_pieRatio = ratio
714 | self.update()
715 |
716 | def rpb_enableText(self, enable):
717 | """
718 | Makes the Text visible/Hidden
719 | ...
720 |
721 | Parameters
722 | --------------
723 |
724 | font: bool
725 | True: Text visible, False: Text invisible.
726 |
727 | Raises
728 | --------------
729 | none
730 | """
731 |
732 | if enable:
733 | self.rpb_textActive = enable
734 | else:
735 | self.rpb_textActive = enable
736 | self.update()
737 |
738 |
739 | #------------------------------------------------------METHODS FOR GETTING THE PROPERTY OF ROUNDPROGRESSBAR SLOTS
740 |
741 | def rpb_getSize(self):
742 | """
743 | Get the present size of the progress bar.
744 | ...
745 |
746 | Returns
747 | --------------
748 | Return the size of the round progress bar in int.
749 | """
750 |
751 | return self.rpb_Size
752 |
753 | def rpb_getValue(self):
754 | """
755 | Present value of the progress bar.
756 | ...
757 |
758 | Returns
759 | --------------
760 | int corresponding to the present progress bar value.
761 | """
762 |
763 | return self.rpb_value/16
764 |
765 | def rpb_getRange(self):
766 | """
767 | Progress bar range.
768 | ...
769 |
770 | Returns
771 | --------------
772 | tuple consisting of minimu and maximum as elements.
773 | """
774 |
775 | return (self.rpb_minimum, self.rpb_maximum)
776 |
777 | def rpb_getTextWidth(self):
778 | """
779 | Text width of the present text in the central of the widget.
780 | ...
781 |
782 | Returns
783 | --------------
784 | int corresponding to the width of the text
785 | """
786 |
787 | return self.rpb_textWidth
788 |
789 | #------------------------------------------------------ENGINE: WHERE ALL THE REAL STUFF TAKE PLACE: WORKING OF THE ROUNDPROGRESSBA
790 |
791 | def rpb_MinimumSize(self, dynamicMax, minimum, maximum):
792 | """
793 | Minimum size calculating code: Takes consideration of the width of the line/path/circle/pie and the user defined
794 | width and also the size of the frame/window of the application.
795 |
796 | """
797 |
798 | rpb_Height = self.height()
799 | rpb_Width = self.width()
800 | if dynamicMax:
801 | if rpb_Width >= rpb_Height and rpb_Height >= minimum[1]:
802 | self.rpb_Size = rpb_Height
803 | elif rpb_Width < rpb_Height and rpb_Width >= minimum[0]:
804 | self.rpb_Size = rpb_Width
805 | else:
806 | if rpb_Width >= rpb_Height and rpb_Height <= maximum[1]:
807 | self.rpb_Size = rpb_Height
808 | elif rpb_Width < rpb_Height and rpb_Width <= maximum[0]:
809 | self.rpb_Size = rpb_Width
810 |
811 | def convertInputValue(self, value):
812 | """
813 | CONVERTS ANY INPUT VALUE TO THE 0*16-360*16 DEGREE REFERENCE OF THE QPainter.drawArc NEEDED.
814 |
815 | """
816 |
817 | self.rpb_value = ((value - self.rpb_minimum)/(self.rpb_maximum - self.rpb_minimum))*360*16
818 | self.rpb_value = self.rpb_direction*self.rpb_value
819 | if self.rpb_textType==roundProgressBar.textFlags.Percentage:
820 | self.rpb_textValue = str(round(((value - self.rpb_minimum)/(self.rpb_maximum - self.rpb_minimum))*100)) + "%"
821 | else:
822 | self.rpb_textValue = str(value)
823 |
824 | #SINCE THE THICKNESS OF THE LINE OR THE PATH CAUSES THE WIDGET TO WRONGLY FIT INSIDE THE SIZE OF THE WIDGET DESIGNED IN THE
825 | #QTDESIGNER, THE CORRECTION FACTOR IS NECESSERY CALLED THE GEOMETRYFACTOR, WHICH CALCULATE THE TWO FACTORS CALLED THE
826 | #self.posFactor AND THE self.sizeFactor, CALCULATION THIS IS NECESSERY AS THE
827 | def geometryFactor(self):
828 | if self.lineWidth > self.pathWidth:
829 | self.posFactor = self.lineWidth/2 + 1
830 | self.sizeFactor = self.lineWidth + 1
831 | else:
832 | self.posFactor = self.pathWidth/2 + 1
833 | self.sizeFactor = self.pathWidth + 1
834 |
835 | def rpb_textFactor(self):
836 | if self.dynamicText:
837 | self.rpb_textWidth = self.rpb_Size/self.rpb_textRatio
838 | self.textFactorX = self.posFactor + (self.rpb_Size - self.sizeFactor)/2 - self.rpb_textWidth*0.75*(len(self.rpb_textValue)/2)
839 | self.textFactorY = self.rpb_textWidth/2 + self.rpb_Size/2
840 |
841 | def rpb_circleFactor(self):
842 | self.rpb_circlePosX = self.positionX + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_circleRatio))/2
843 | self.rpb_circlePosY = self.positionY + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_circleRatio))/2
844 |
845 | def rpb_pieFactor(self):
846 | self.rpb_piePosX = self.positionX + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_pieRatio))/2
847 | self.rpb_piePosY = self.positionY + self.posFactor + ((self.rpb_Size)*(1 - self.rpb_pieRatio))/2
848 |
849 |
850 |
851 | def paintEvent(self, event: QPaintEvent):
852 |
853 | #THIS BELOW CODE AMKE SURE THAT THE SIZE OF THE ROUNDPROGRESSBAR DOESNOT REDUCES TO ZERO WHEN THE USER RESIZES THE WINDOW
854 | if self.rpb_dynamicMin:
855 | self.setMinimumSize(QSize(self.lineWidth*6 + self.pathWidth*6, self.lineWidth*6 + self.pathWidth*6))
856 |
857 | roundProgressBar.rpb_MinimumSize(self, self.rpb_dynamicMax, self.rpb_minimumSize, self.rpb_maximumSize)
858 | roundProgressBar.geometryFactor(self)
859 | roundProgressBar.rpb_textFactor(self)
860 | roundProgressBar.rpb_circleFactor(self)
861 | roundProgressBar.rpb_pieFactor(self)
862 |
863 | if self.rpb_type==0: #DONET TYPE
864 | roundProgressBar.pathComponent(self)
865 | roundProgressBar.lineComponent(self)
866 | roundProgressBar.textComponent(self)
867 | elif self.rpb_type==1: #LINE TYPE
868 | roundProgressBar.lineComponent(self)
869 | roundProgressBar.textComponent(self)
870 | elif self.rpb_type==2: #Pie
871 | roundProgressBar.pieComponent(self)
872 | roundProgressBar.textComponent(self)
873 | elif self.rpb_type==3: #PIZZA
874 | roundProgressBar.circleComponent(self)
875 | roundProgressBar.lineComponent(self)
876 | roundProgressBar.textComponent(self)
877 | elif self.rpb_type==4: #HYBRID1
878 | roundProgressBar.circleComponent(self)
879 | roundProgressBar.pathComponent(self)
880 | roundProgressBar.lineComponent(self)
881 | roundProgressBar.textComponent(self)
882 | elif self.rpb_type==5: #HYBRID2
883 | roundProgressBar.pieComponent(self)
884 | roundProgressBar.lineComponent(self)
885 | roundProgressBar.textComponent(self)
886 |
887 |
888 | def lineComponent(self):
889 | linePainter = QPainter(self)
890 | linePainter.setRenderHint(QPainter.Antialiasing)
891 | penLine = QPen()
892 | penLine.setStyle(self.rpb_lineStyle)
893 | penLine.setWidth(self.lineWidth)
894 | penLine.setBrush(QColor(self.lineColor[0], self.lineColor[1], self.lineColor[2]))
895 | penLine.setCapStyle(self.rpb_lineCap)
896 | penLine.setJoinStyle(Qt.RoundJoin)
897 | linePainter.setPen(penLine)
898 | linePainter.drawArc(self.positionX + self.posFactor, self.positionY + self.posFactor, self.rpb_Size - self.sizeFactor, self.rpb_Size - self.sizeFactor, self.startPosition, self.rpb_value)
899 | linePainter.end()
900 |
901 | def pathComponent(self):
902 | pathPainter = QPainter(self)
903 | pathPainter.setRenderHint(QPainter.Antialiasing)
904 | penPath = QPen()
905 | penPath.setStyle(Qt.SolidLine)
906 | penPath.setWidth(self.pathWidth)
907 | penPath.setBrush(QColor(self.pathColor[0], self.pathColor[1], self.pathColor[2]))
908 | penPath.setCapStyle(Qt.RoundCap)
909 | penPath.setJoinStyle(Qt.RoundJoin)
910 | pathPainter.setPen(penPath)
911 | pathPainter.drawArc(self.positionX + self.posFactor, self.positionY + self.posFactor, self.rpb_Size - self.sizeFactor, self.rpb_Size - self.sizeFactor, 0, 360*16)
912 | pathPainter.end()
913 |
914 | def textComponent(self):
915 | if self.rpb_textActive:
916 | textPainter = QPainter(self)
917 | penText = QPen()
918 | penText.setColor(QColor(self.rpb_textColor[0], self.rpb_textColor[1], self.rpb_textColor[2]))
919 | textPainter.setPen(penText)
920 | fontText = QFont()
921 | fontText.setFamily(self.rpb_textFont)
922 | fontText.setPointSize(self.rpb_textWidth)
923 | textPainter.setFont(fontText)
924 | textPainter.drawText(self.positionX + self.textFactorX, self.positionY + self.textFactorY, self.rpb_textValue)
925 | textPainter.end()
926 |
927 | def circleComponent(self):
928 | circlePainter = QPainter(self)
929 | penCircle = QPen()
930 | penCircle.setWidth(0)
931 | penCircle.setColor(QColor(self.rpb_circleColor[0], self.rpb_circleColor[1], self.rpb_circleColor[2]))
932 | circlePainter.setRenderHint(QPainter.Antialiasing)
933 | circlePainter.setPen(penCircle)
934 | circlePainter.setBrush(QColor(self.rpb_circleColor[0], self.rpb_circleColor[1], self.rpb_circleColor[2]))
935 | circlePainter.drawEllipse(self.rpb_circlePosX, self.rpb_circlePosY, (self.rpb_Size - self.sizeFactor)*self.rpb_circleRatio, (self.rpb_Size - self.sizeFactor)*self.rpb_circleRatio)
936 |
937 | def pieComponent(self):
938 | piePainter = QPainter(self)
939 | penPie = QPen()
940 | penPie.setWidth(0)
941 | penPie.setColor(QColor(self.rpb_pieColor[0], self.rpb_pieColor[1], self.rpb_pieColor[2]))
942 | piePainter.setRenderHint(QPainter.Antialiasing)
943 | piePainter.setPen(penPie)
944 | piePainter.setBrush(QColor(self.rpb_pieColor[0], self.rpb_pieColor[1], self.rpb_pieColor[2]))
945 | piePainter.drawPie(self.rpb_piePosX, self.rpb_piePosY, (self.rpb_Size - self.sizeFactor)*self.rpb_pieRatio, (self.rpb_Size - self.sizeFactor)*self.rpb_pieRatio, self.startPosition, self.rpb_value)
946 |
947 |
948 | #------------------------------------------------------
949 |
950 | if __name__=="__main__":
951 | print("Try Import.")
--------------------------------------------------------------------------------
/build/lib/PySide2extn/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/build/lib/PySide2extn/__init__.py
--------------------------------------------------------------------------------
/build/lib/PySide2extn/demo/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/build/lib/PySide2extn/demo/__init__.py
--------------------------------------------------------------------------------
/build/lib/PySide2extn/demo/demo.py:
--------------------------------------------------------------------------------
1 | #############################################################################################
2 | # CREATOR: ANJAL.P #
3 | # ON: 2020 NOV. #
4 | # AIM: To Extend the capability of the PySide2 and PyQt5 Python library with easy to #
5 | # use extension containing commonly used widgets which is not natively supported #
6 | # by the Qt Frame work (or atleast for Python version of Qt). #
7 | # VERSION: v1.0.0 #
8 | # NOTES: Demo Application #
9 | # REFER: Github: https://github.com/anjalp/PySide2extn #
10 | #############################################################################################
11 |
12 |
13 | from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
14 | QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
15 | from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
16 | QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
17 | QPixmap, QRadialGradient)
18 | from PySide2.QtWidgets import *
19 |
20 | from PySide2extn.RoundProgressBar import roundProgressBar
21 | from PySide2extn.SpiralProgressBar import spiralProgressBar
22 |
23 |
24 | class Ui_MainWindow(object):
25 | def setupUi(self, MainWindow):
26 | if not MainWindow.objectName():
27 | MainWindow.setObjectName(u"MainWindow")
28 | MainWindow.resize(800, 415)
29 | MainWindow.setMinimumSize(QSize(800, 415))
30 | self.centralwidget = QWidget(MainWindow)
31 | self.centralwidget.setObjectName(u"centralwidget")
32 | self.gridLayout = QGridLayout(self.centralwidget)
33 | self.gridLayout.setSpacing(0)
34 | self.gridLayout.setObjectName(u"gridLayout")
35 | self.gridLayout.setContentsMargins(0, 0, 0, 0)
36 | self.tabWidget = QTabWidget(self.centralwidget)
37 | self.tabWidget.setObjectName(u"tabWidget")
38 | self.tab = QWidget()
39 | self.tab.setObjectName(u"tab")
40 | self.verticalLayout = QVBoxLayout(self.tab)
41 | self.verticalLayout.setSpacing(0)
42 | self.verticalLayout.setObjectName(u"verticalLayout")
43 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
44 | self.widget = QWidget(self.tab)
45 | self.widget.setObjectName(u"widget")
46 | self.gridLayout_2 = QGridLayout(self.widget)
47 | self.gridLayout_2.setSpacing(0)
48 | self.gridLayout_2.setObjectName(u"gridLayout_2")
49 | self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
50 | self.b1 = QPushButton(self.widget)
51 | self.b1.setObjectName(u"b1")
52 | self.b1.setMinimumSize(QSize(20, 20))
53 | self.b1.setMaximumSize(QSize(20, 20))
54 |
55 | self.gridLayout_2.addWidget(self.b1, 0, 1, 1, 1)
56 |
57 | self.b3 = QPushButton(self.widget)
58 | self.b3.setObjectName(u"b3")
59 | self.b3.setMinimumSize(QSize(20, 20))
60 | self.b3.setMaximumSize(QSize(20, 20))
61 |
62 | self.gridLayout_2.addWidget(self.b3, 0, 5, 1, 1)
63 |
64 | self.rpb4 = roundProgressBar(self.widget)
65 | self.rpb4.setObjectName(u"rpb4")
66 |
67 | self.gridLayout_2.addWidget(self.rpb4, 0, 6, 3, 1)
68 |
69 | self.rpb3 = roundProgressBar(self.widget)
70 | self.rpb3.setObjectName(u"rpb3")
71 |
72 | self.gridLayout_2.addWidget(self.rpb3, 0, 4, 3, 1)
73 |
74 | self.rpb2 = roundProgressBar(self.widget)
75 | self.rpb2.setObjectName(u"rpb2")
76 | self.rpb2.setStyleSheet(u"")
77 |
78 | self.gridLayout_2.addWidget(self.rpb2, 0, 2, 3, 1)
79 |
80 | self.rpb1 = roundProgressBar(self.widget)
81 | self.rpb1.setObjectName(u"rpb1")
82 |
83 | self.gridLayout_2.addWidget(self.rpb1, 0, 0, 3, 1)
84 |
85 | self.b2 = QPushButton(self.widget)
86 | self.b2.setObjectName(u"b2")
87 | self.b2.setMinimumSize(QSize(20, 20))
88 | self.b2.setMaximumSize(QSize(20, 20))
89 |
90 | self.gridLayout_2.addWidget(self.b2, 2, 1, 1, 1)
91 |
92 | self.vs1 = QSlider(self.widget)
93 | self.vs1.setObjectName(u"vs1")
94 | self.vs1.setOrientation(Qt.Vertical)
95 |
96 | self.gridLayout_2.addWidget(self.vs1, 0, 3, 3, 1)
97 |
98 | self.b4 = QPushButton(self.widget)
99 | self.b4.setObjectName(u"b4")
100 | self.b4.setMinimumSize(QSize(20, 20))
101 | self.b4.setMaximumSize(QSize(20, 20))
102 |
103 | self.gridLayout_2.addWidget(self.b4, 2, 5, 1, 1)
104 |
105 |
106 | self.verticalLayout.addWidget(self.widget)
107 |
108 | self.hs1 = QSlider(self.tab)
109 | self.hs1.setObjectName(u"hs1")
110 | self.hs1.setOrientation(Qt.Horizontal)
111 |
112 | self.verticalLayout.addWidget(self.hs1)
113 |
114 | self.widget_2 = QWidget(self.tab)
115 | self.widget_2.setObjectName(u"widget_2")
116 | self.gridLayout_3 = QGridLayout(self.widget_2)
117 | self.gridLayout_3.setSpacing(0)
118 | self.gridLayout_3.setObjectName(u"gridLayout_3")
119 | self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
120 | self.vs2 = QSlider(self.widget_2)
121 | self.vs2.setObjectName(u"vs2")
122 | self.vs2.setOrientation(Qt.Vertical)
123 | self.vs2.setInvertedAppearance(True)
124 |
125 | self.gridLayout_3.addWidget(self.vs2, 0, 3, 4, 1)
126 |
127 | self.b6 = QPushButton(self.widget_2)
128 | self.b6.setObjectName(u"b6")
129 | self.b6.setMinimumSize(QSize(20, 20))
130 | self.b6.setMaximumSize(QSize(20, 20))
131 |
132 | self.gridLayout_3.addWidget(self.b6, 3, 5, 1, 1)
133 |
134 | self.b5 = QPushButton(self.widget_2)
135 | self.b5.setObjectName(u"b5")
136 | self.b5.setMinimumSize(QSize(20, 20))
137 | self.b5.setMaximumSize(QSize(20, 20))
138 |
139 | self.gridLayout_3.addWidget(self.b5, 0, 5, 1, 1)
140 |
141 | self.b8 = QPushButton(self.widget_2)
142 | self.b8.setObjectName(u"b8")
143 | self.b8.setMinimumSize(QSize(20, 20))
144 | self.b8.setMaximumSize(QSize(20, 20))
145 |
146 | self.gridLayout_3.addWidget(self.b8, 3, 1, 1, 1)
147 |
148 | self.rpb5 = roundProgressBar(self.widget_2)
149 | self.rpb5.setObjectName(u"rpb5")
150 |
151 | self.gridLayout_3.addWidget(self.rpb5, 0, 0, 4, 1)
152 |
153 | self.b7 = QPushButton(self.widget_2)
154 | self.b7.setObjectName(u"b7")
155 | self.b7.setMinimumSize(QSize(20, 20))
156 | self.b7.setMaximumSize(QSize(20, 20))
157 |
158 | self.gridLayout_3.addWidget(self.b7, 0, 1, 1, 1)
159 |
160 | self.rpb7 = roundProgressBar(self.widget_2)
161 | self.rpb7.setObjectName(u"rpb7")
162 |
163 | self.gridLayout_3.addWidget(self.rpb7, 0, 4, 4, 1)
164 |
165 | self.rpb8 = roundProgressBar(self.widget_2)
166 | self.rpb8.setObjectName(u"rpb8")
167 |
168 | self.gridLayout_3.addWidget(self.rpb8, 0, 6, 4, 1)
169 |
170 | self.rpb6 = roundProgressBar(self.widget_2)
171 | self.rpb6.setObjectName(u"rpb6")
172 |
173 | self.gridLayout_3.addWidget(self.rpb6, 0, 2, 4, 1)
174 |
175 |
176 | self.verticalLayout.addWidget(self.widget_2)
177 |
178 | self.tabWidget.addTab(self.tab, "")
179 | self.tab_2 = QWidget()
180 | self.tab_2.setObjectName(u"tab_2")
181 | self.verticalLayout_2 = QVBoxLayout(self.tab_2)
182 | self.verticalLayout_2.setSpacing(0)
183 | self.verticalLayout_2.setObjectName(u"verticalLayout_2")
184 | self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
185 | self.widget_3 = QWidget(self.tab_2)
186 | self.widget_3.setObjectName(u"widget_3")
187 | self.gridLayout_4 = QGridLayout(self.widget_3)
188 | self.gridLayout_4.setSpacing(0)
189 | self.gridLayout_4.setObjectName(u"gridLayout_4")
190 | self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
191 | self.pushButton_9 = QPushButton(self.widget_3)
192 | self.pushButton_9.setObjectName(u"pushButton_9")
193 | self.pushButton_9.setMinimumSize(QSize(20, 20))
194 | self.pushButton_9.setMaximumSize(QSize(20, 20))
195 |
196 | self.gridLayout_4.addWidget(self.pushButton_9, 0, 1, 1, 1)
197 |
198 | self.pushButton_11 = QPushButton(self.widget_3)
199 | self.pushButton_11.setObjectName(u"pushButton_11")
200 | self.pushButton_11.setMinimumSize(QSize(20, 20))
201 | self.pushButton_11.setMaximumSize(QSize(20, 20))
202 |
203 | self.gridLayout_4.addWidget(self.pushButton_11, 0, 5, 1, 1)
204 |
205 | self.pushButton_10 = QPushButton(self.widget_3)
206 | self.pushButton_10.setObjectName(u"pushButton_10")
207 | self.pushButton_10.setMinimumSize(QSize(20, 20))
208 | self.pushButton_10.setMaximumSize(QSize(20, 20))
209 |
210 | self.gridLayout_4.addWidget(self.pushButton_10, 3, 1, 1, 1)
211 |
212 | self.vs3 = QSlider(self.widget_3)
213 | self.vs3.setObjectName(u"vs3")
214 | self.vs3.setOrientation(Qt.Vertical)
215 |
216 | self.gridLayout_4.addWidget(self.vs3, 0, 3, 4, 1)
217 |
218 | self.spb2 = spiralProgressBar(self.widget_3)
219 | self.spb2.setObjectName(u"spb2")
220 |
221 | self.gridLayout_4.addWidget(self.spb2, 0, 2, 4, 1)
222 |
223 | self.spb1 = spiralProgressBar(self.widget_3)
224 | self.spb1.setObjectName(u"spb1")
225 |
226 | self.gridLayout_4.addWidget(self.spb1, 0, 0, 4, 1)
227 |
228 | self.spb3 = spiralProgressBar(self.widget_3)
229 | self.spb3.setObjectName(u"spb3")
230 |
231 | self.gridLayout_4.addWidget(self.spb3, 0, 4, 4, 1)
232 |
233 | self.pushButton_12 = QPushButton(self.widget_3)
234 | self.pushButton_12.setObjectName(u"pushButton_12")
235 | self.pushButton_12.setMinimumSize(QSize(20, 20))
236 | self.pushButton_12.setMaximumSize(QSize(20, 20))
237 |
238 | self.gridLayout_4.addWidget(self.pushButton_12, 3, 5, 1, 1)
239 |
240 | self.spb4 = spiralProgressBar(self.widget_3)
241 | self.spb4.setObjectName(u"spb4")
242 |
243 | self.gridLayout_4.addWidget(self.spb4, 0, 6, 4, 1)
244 |
245 |
246 | self.verticalLayout_2.addWidget(self.widget_3)
247 |
248 | self.hs2 = QSlider(self.tab_2)
249 | self.hs2.setObjectName(u"hs2")
250 | self.hs2.setOrientation(Qt.Horizontal)
251 |
252 | self.verticalLayout_2.addWidget(self.hs2)
253 |
254 | self.widget_4 = QWidget(self.tab_2)
255 | self.widget_4.setObjectName(u"widget_4")
256 | self.gridLayout_5 = QGridLayout(self.widget_4)
257 | self.gridLayout_5.setSpacing(0)
258 | self.gridLayout_5.setObjectName(u"gridLayout_5")
259 | self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
260 | self.pushButton_15 = QPushButton(self.widget_4)
261 | self.pushButton_15.setObjectName(u"pushButton_15")
262 | self.pushButton_15.setMinimumSize(QSize(20, 20))
263 | self.pushButton_15.setMaximumSize(QSize(20, 20))
264 |
265 | self.gridLayout_5.addWidget(self.pushButton_15, 0, 5, 1, 1)
266 |
267 | self.pushButton_13 = QPushButton(self.widget_4)
268 | self.pushButton_13.setObjectName(u"pushButton_13")
269 | self.pushButton_13.setMinimumSize(QSize(20, 20))
270 | self.pushButton_13.setMaximumSize(QSize(20, 20))
271 |
272 | self.gridLayout_5.addWidget(self.pushButton_13, 0, 1, 1, 1)
273 |
274 | self.pushButton_16 = QPushButton(self.widget_4)
275 | self.pushButton_16.setObjectName(u"pushButton_16")
276 | self.pushButton_16.setMinimumSize(QSize(20, 20))
277 | self.pushButton_16.setMaximumSize(QSize(20, 20))
278 |
279 | self.gridLayout_5.addWidget(self.pushButton_16, 3, 5, 1, 1)
280 |
281 | self.pushButton_14 = QPushButton(self.widget_4)
282 | self.pushButton_14.setObjectName(u"pushButton_14")
283 | self.pushButton_14.setMinimumSize(QSize(20, 20))
284 | self.pushButton_14.setMaximumSize(QSize(20, 20))
285 |
286 | self.gridLayout_5.addWidget(self.pushButton_14, 3, 1, 1, 1)
287 |
288 | self.spb5 = spiralProgressBar(self.widget_4)
289 | self.spb5.setObjectName(u"spb5")
290 |
291 | self.gridLayout_5.addWidget(self.spb5, 0, 0, 4, 1)
292 |
293 | self.spb6 = spiralProgressBar(self.widget_4)
294 | self.spb6.setObjectName(u"spb6")
295 |
296 | self.gridLayout_5.addWidget(self.spb6, 0, 2, 4, 1)
297 |
298 | self.spb7 = spiralProgressBar(self.widget_4)
299 | self.spb7.setObjectName(u"spb7")
300 |
301 | self.gridLayout_5.addWidget(self.spb7, 0, 4, 4, 1)
302 |
303 | self.spb8 = spiralProgressBar(self.widget_4)
304 | self.spb8.setObjectName(u"spb8")
305 |
306 | self.gridLayout_5.addWidget(self.spb8, 0, 6, 4, 1)
307 |
308 | self.vs4 = QSlider(self.widget_4)
309 | self.vs4.setObjectName(u"vs4")
310 | self.vs4.setOrientation(Qt.Vertical)
311 | self.vs4.setInvertedAppearance(True)
312 |
313 | self.gridLayout_5.addWidget(self.vs4, 0, 3, 4, 1)
314 |
315 |
316 | self.verticalLayout_2.addWidget(self.widget_4)
317 |
318 | self.tabWidget.addTab(self.tab_2, "")
319 |
320 | self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
321 |
322 | MainWindow.setCentralWidget(self.centralwidget)
323 |
324 | self.retranslateUi(MainWindow)
325 |
326 | self.tabWidget.setCurrentIndex(0)
327 |
328 |
329 | QMetaObject.connectSlotsByName(MainWindow)
330 | # setupUi
331 |
332 | def retranslateUi(self, MainWindow):
333 | MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Demo Application PySide2extn", None))
334 | self.b1.setText(QCoreApplication.translate("MainWindow", u"S", None))
335 | self.b3.setText(QCoreApplication.translate("MainWindow", u"D", None))
336 | self.b2.setText(QCoreApplication.translate("MainWindow", u"I", None))
337 | self.b4.setText(QCoreApplication.translate("MainWindow", u"R", None))
338 | self.b6.setText(QCoreApplication.translate("MainWindow", u"I", None))
339 | self.b5.setText(QCoreApplication.translate("MainWindow", u"S", None))
340 | self.b8.setText(QCoreApplication.translate("MainWindow", u"D", None))
341 | self.b7.setText(QCoreApplication.translate("MainWindow", u"R", None))
342 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"RoundProgressBar", None))
343 | self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"R", None))
344 | self.pushButton_11.setText(QCoreApplication.translate("MainWindow", u"S", None))
345 | self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"D", None))
346 | self.pushButton_12.setText(QCoreApplication.translate("MainWindow", u"I", None))
347 | self.pushButton_15.setText(QCoreApplication.translate("MainWindow", u"R", None))
348 | self.pushButton_13.setText(QCoreApplication.translate("MainWindow", u"I", None))
349 | self.pushButton_16.setText(QCoreApplication.translate("MainWindow", u"D", None))
350 | self.pushButton_14.setText(QCoreApplication.translate("MainWindow", u"S", None))
351 | self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"SpiralProgressBar", None))
352 |
353 | self.addDesignTothis()
354 |
355 |
356 | def addDesignTothis(self):
357 | self.widget_rpb()
358 | self.widget_spb()
359 |
360 |
361 | def widget_rpb(self):
362 |
363 | self.rpb1.rpb_setValue(55)
364 | self.rpb2.rpb_setValue(84)
365 | self.rpb3.rpb_setValue(0)
366 | self.rpb4.rpb_setValue(46)
367 | self.rpb5.rpb_setValue(75)
368 | self.rpb6.rpb_setValue(66)
369 | self.rpb7.rpb_setValue(5)
370 | self.rpb8.rpb_setValue(95)
371 |
372 |
373 | self.rpb2.rpb_setBarStyle("Line")
374 | self.rpb2.rpb_setLineColor((0, 10, 15))
375 | self.rpb2.rpb_setTextColor((0, 10, 15))
376 |
377 |
378 | self.rpb3.rpb_setBarStyle("Pie")
379 | self.rpb3.rpb_setMaximum(360)
380 | self.rpb3.rpb_setTextFormat('Value')
381 | self.rpb3.rpb_setTextColor((210, 240, 210))
382 | self.rpb3.rpb_setPieColor((0, 125, 125))
383 |
384 |
385 | self.rpb4.rpb_setBarStyle("Pizza")
386 | self.rpb4.rpb_setRange(0, 200)
387 | self.rpb4.rpb_setCircleColor((210, 100, 0))
388 | self.rpb4.rpb_setLineColor((160, 50, 0))
389 | self.rpb4.rpb_setTextColor((250, 250, 250))
390 | self.rpb4.rpb_setCircleRatio(1)
391 |
392 |
393 | self.rpb5.rpb_setBarStyle("Hybrid1")
394 | self.rpb5.rpb_setRange(0, 360)
395 | self.rpb5.rpb_setTextFormat('Value')
396 | self.rpb5.rpb_setPathWidth(2)
397 | self.rpb5.rpb_setLineWidth(8)
398 | self.rpb5.rpb_setPathColor((100, 100, 100))
399 | self.rpb5.rpb_setCircleColor((100, 100, 100))
400 | self.rpb5.rpb_setTextColor((250, 250, 250))
401 |
402 |
403 | self.rpb6.rpb_setBarStyle("Hybrid2")
404 |
405 |
406 | self.rpb8.rpb_setBarStyle("Hybrid1")
407 | self.rpb8.rpb_setRange(0, 360)
408 |
409 |
410 | self.rpb7.rpb_setLineWidth(2)
411 | self.rpb7.rpb_setLineColor((20, 20, 20))
412 | self.rpb7.rpb_setMaximum(200)
413 | self.rpb7.rpb_enableText(False)
414 | self.rpb7.rpb_setPathWidth(8)
415 |
416 | self.hs1.valueChanged.connect(lambda: self.rpb1.rpb_setValue(self.hs1.value()))
417 | self.hs1.valueChanged.connect(lambda: self.rpb8.rpb_setValue(100 - self.hs1.value()))
418 | self.hs1.valueChanged.connect(lambda: self.rpb4.rpb_setValue(200 - self.hs1.value()))
419 | self.hs1.valueChanged.connect(lambda: self.rpb5.rpb_setValue(2*self.hs1.value()))
420 |
421 | self.vs1.valueChanged.connect(lambda: self.rpb2.rpb_setValue(self.vs1.value()))
422 | self.vs1.valueChanged.connect(lambda: self.rpb3.rpb_setValue(360 - self.vs1.value()))
423 |
424 | self.vs2.valueChanged.connect(lambda: self.rpb6.rpb_setValue(self.vs2.value()))
425 | self.vs2.valueChanged.connect(lambda: self.rpb7.rpb_setValue(self.vs2.value()))
426 |
427 |
428 | self.b1.clicked.connect(lambda: self.rpb1.rpb_setLineColor((128, 40, 152)))
429 | self.b2.clicked.connect(lambda: self.rpb8.rpb_setCircleColor((0, 192, 175)))
430 | self.b5.clicked.connect(lambda: self.rpb6.rpb_setTextColor((0, 192, 175)))
431 | self.b3.clicked.connect(lambda: self.rpb3.rpb_setValue(0))
432 | self.b4.clicked.connect(lambda: self.rpb3.rpb_setValue(100))
433 | self.b6.clicked.connect(lambda: self.rpb5.rpb_setValue(0))
434 | self.b7.clicked.connect(lambda: self.rpb6.rpb_setValue(100))
435 | self.b8.clicked.connect(lambda: self.rpb8.rpb_setValue(360))
436 |
437 |
438 | def widget_spb(self):
439 |
440 | self.spb1.spb_setValue((82, 56, 5))
441 |
442 | self.spb2.spb_setNoProgressBar(2)
443 | self.spb2.spb_lineWidth(15)
444 | self.spb2.spb_setGap(18)
445 | self.spb2.spb_setValue((65, 60))
446 | self.spb2.spb_lineColor(((28, 129, 196), (90, 193, 211)))
447 | self.spb2.spb_pathColor(((195, 225, 242), (208, 234, 244)))
448 |
449 | self.spb3.spb_setRange((0, 0, 0), (360, 360, 360))
450 | self.spb3.spb_lineWidth(15)
451 | self.spb3.spb_setGap(17)
452 | self.spb3.spb_setInitialPos(('East', 'East', 'East'))
453 | self.spb3.spb_setValue((246, 315, 198))
454 | self.spb3.spb_setPathHidden(True)
455 |
456 | self.spb4.spb_setNoProgressBar(6)
457 | self.spb4.spb_lineWidth(10)
458 | self.spb4.spb_setGap(11)
459 | self.spb4.spb_setValue((59, 16, 27, 65, 84, 95))
460 |
461 | self.spb5.spb_lineStyle(('DotLine', 'DotLine', 'DotLine'))
462 | self.spb5.spb_setValue((65, 90, 25))
463 |
464 | self.spb6.spb_setNoProgressBar(5)
465 | self.spb6.spb_lineWidth(10)
466 | self.spb6.spb_setGap(11)
467 | self.spb6.spb_setDirection(('Clockwise', 'AntiClockwise', 'AntiClockwise', 'Clockwise', 'Clockwise'))
468 | self.spb6.spb_setValue((65, 25, 86, 45, 75))
469 |
470 | self.spb7.spb_setGap(12)
471 | self.spb7.variableWidth(True)
472 | self.spb7.spb_widthIncrement(2)
473 |
474 | self.spb8.spb_lineWidth(8)
475 | self.spb8.spb_setGap(9)
476 | self.spb8.spb_lineCap(('RoundCap', 'SquareCap', 'SquareCap'))
477 | self.spb8.spb_setValue((65, 23, 95))
478 |
479 | self.hs2.valueChanged.connect(lambda: self.spb1.spb_setValue((self.hs2.value(), self.hs2.value()*1.5, self.hs2.value()*1.75)))
480 | self.hs2.valueChanged.connect(lambda: self.spb4.spb_setValue((self.hs2.value()*1.25, self.hs2.value()*1.35, self.hs2.value()*1, self.hs2.value()*1.75, self.hs2.value()*1.55, self.hs2.value()*0.45)))
481 | self.hs2.valueChanged.connect(lambda: self.spb5.spb_setValue((360 - self.hs2.value()*3.6, 360 - self.hs2.value()*4, 360 - self.hs2.value()*4.2)))
482 | self.hs2.valueChanged.connect(lambda: self.spb8.spb_setValue((self.hs2.value(), self.hs2.value()*1.26, self.hs2.value()*2)))
483 |
484 | self.vs3.valueChanged.connect(lambda: self.spb2.spb_setValue((100 - self.vs3.value()*1.2, 100 - self.vs3.value())))
485 | self.vs3.valueChanged.connect(lambda: self.spb3.spb_setValue((self.vs3.value()*3.6, 3.6*0.75*self.vs3.value(), 3.6*0.5*self.vs3.value())))
486 |
487 | self.vs4.valueChanged.connect(lambda: self.spb6.spb_setValue((self.vs4.value(), self.vs4.value()*0.9, self.vs4.value()*0.7, self.vs4.value()*0.6, self.vs4.value()*0.5)))
488 | self.vs4.valueChanged.connect(lambda: self.spb7.spb_setValue((self.vs4.value(), self.vs4.value(), self.vs4.value())))
489 |
490 |
491 | def main():
492 | import sys
493 | app = QApplication(sys.argv)
494 | MainWindow = QMainWindow()
495 | ui = Ui_MainWindow()
496 | ui.setupUi(MainWindow)
497 | MainWindow.show()
498 | sys.exit(app.exec_())
499 |
500 |
--------------------------------------------------------------------------------
/build/lib/PySide2extn/examples/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/build/lib/PySide2extn/examples/__init__.py
--------------------------------------------------------------------------------
/dist/PySide2extn-1.0.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/dist/PySide2extn-1.0.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/PySide2extn-1.0.0.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anjalp/PySide2extn/54e8533ebba1b299e843d06c2abb3746a044c6a9/dist/PySide2extn-1.0.0.tar.gz
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import setuptools
2 |
3 | with open("README.md", "r") as fh:
4 | long_description = fh.read()
5 |
6 | setuptools.setup(
7 | name="PySide2extn", # Replace with your own username
8 | version="1.0.0",
9 | author="ANJAL.P",
10 | author_email="opensource.anj.official@gmail.com",
11 | description="PySide2extn is an Open Source Python Programming language extension for PySide2, which greatly enhances the capability of the PySide2 library with extra widgets and more.",
12 | long_description=long_description,
13 | long_description_content_type="text/markdown",
14 | url="https://github.com/anjalp/PySide2extn",
15 | packages=setuptools.find_packages(),
16 | classifiers=[
17 | "Development Status :: 5 - Production/Stable",
18 | "Intended Audience :: Developers",
19 | "Programming Language :: Python :: 3.5",
20 | "Programming Language :: Python :: 3.6",
21 | "Programming Language :: Python :: 3.7",
22 | "Programming Language :: Python :: 3.8",
23 | "Programming Language :: Python :: 3.9",
24 | "License :: OSI Approved :: MIT License",
25 | "Operating System :: OS Independent",
26 | ],
27 | python_requires='>=3.6',
28 | install_requires=["PySide2"],
29 | )
--------------------------------------------------------------------------------