QT-PyQt-PySide-Custom-Widgets 0.2.7__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -493,7 +493,7 @@ You can customize the animations using a JSon file or Python statements
493
493
  class QCustomStackedWidget(QtWidgets.QStackedWidget):
494
494
  def __init__(self, parent=None):
495
495
  super(QCustomStackedWidget, self).__init__(parent)
496
-
496
+
497
497
  ########################################################################
498
498
  ## Initialize Default Values
499
499
  ########################################################################
@@ -766,8 +766,8 @@ class QMainWindow(QMainWindow):
766
766
  if hasattr(self, "floatingWidgets"):
767
767
  for x in self.floatingWidgets:
768
768
  x.collapseMenu()
769
-
770
-
769
+
770
+
771
771
  #######################################################################
772
772
  #######################################################################
773
773
 
@@ -820,6 +820,22 @@ class QMainWindow(QMainWindow):
820
820
  else:
821
821
  self.showMaximized()
822
822
 
823
+ ########################################################################
824
+ ## Check Button Groups
825
+ ########################################################################
826
+ def checkButtonGroup(self):
827
+ btn = self.sender()
828
+ group = btn.group
829
+ groupBtns = getattr(self, "group_btns_"+str(group))
830
+ active = getattr(self, "group_active_"+str(group))
831
+ notActive = getattr(self, "group_not_active_"+str(group))
832
+
833
+ for x in groupBtns:
834
+ if not x == btn:
835
+ x.setStyleSheet(notActive)
836
+
837
+ btn.setStyleSheet(active)
838
+
823
839
  #######################################################################
824
840
 
825
841
 
@@ -851,7 +867,7 @@ class QCustomSlideMenu(QWidget):
851
867
 
852
868
  self.collapsed = False
853
869
  self.expanded = True
854
-
870
+
855
871
  self.float = False
856
872
  self.floatPosition = ""
857
873
 
@@ -931,19 +947,19 @@ class QCustomSlideMenu(QWidget):
931
947
  if "expandedStyle" in customValues and len(str(customValues["expandedStyle"])) > 0:
932
948
  self.expandedStyle = str(customValues["expandedStyle"])
933
949
  if self.expanded:
934
- self.setStyleSheet(str(customValues["expandedStyle"]))
935
-
950
+ self.setStyleSheet(str(customValues["expandedStyle"]))
951
+
936
952
  if "floatMenu" in customValues and customValues["floatMenu"] == True:
937
953
  self.float = True
938
- if "relativeTo" in customValues and len(str(customValues["relativeTo"])) > 0:
954
+ if "relativeTo" in customValues and len(str(customValues["relativeTo"])) > 0:
939
955
  if "position" in customValues and len(str(customValues["position"])) > 0:
940
956
  self.floatPosition = str(customValues["position"])
941
-
957
+
942
958
  effect = QtWidgets.QGraphicsDropShadowEffect(self)
943
959
  if "shadowColor" in customValues and len(str(customValues["shadowColor"])) > 0:
944
- effect.setColor(QColor(str(customValues["shadowColor"])))
960
+ effect.setColor(QColor(str(customValues["shadowColor"])))
945
961
  else:
946
- effect.setColor(QColor(0,0,0,0))
962
+ effect.setColor(QColor(0,0,0,0))
947
963
  if "shadowBlurRadius" in customValues and int(customValues["shadowBlurRadius"]) > 0:
948
964
  effect.setBlurRadius(int(customValues["shadowBlurRadius"]))
949
965
  else:
@@ -955,32 +971,32 @@ class QCustomSlideMenu(QWidget):
955
971
  if "shadowYOffset" in customValues and int(customValues["shadowYOffset"]) > 0:
956
972
  effect.setYOffset(int(customValues["shadowYOffset"]))
957
973
  else:
958
- effect.setYOffset(0)
959
-
960
-
961
- self.setGraphicsEffect(effect)
974
+ effect.setYOffset(0)
975
+
976
+
977
+ self.setGraphicsEffect(effect)
962
978
 
963
979
 
964
980
  self.refresh()
965
-
981
+
966
982
  ########################################################################
967
983
  # Float menu
968
984
  ########################################################################
969
985
  def floatMenu(self):
970
- if self.float:
986
+ if self.float:
971
987
  if len(str(self.floatPosition)) > 0:
972
988
  position = str(self.floatPosition)
973
-
989
+
974
990
  if position == "top-left":
975
991
  self.setGeometry(QRect(self.parent().x(), self.parent().y(), self.width(), self.height()))
976
-
992
+
977
993
  if position == "top-right":
978
994
  self.setGeometry(QRect(self.parent().width() - self.width(), self.parent().y(), self.width(), self.height()))
979
-
995
+
980
996
  if position == "bottom-right":
981
997
  self.setGeometry(QRect(self.parent().width() - self.width(), self.parent().height() - self.height(), self.width(), self.height()))
982
-
983
-
998
+
999
+
984
1000
  if position == "bottom-left":
985
1001
  self.setGeometry(QRect(self.parent().x(), self.parent().height() - self.height(), self.width(), self.height()))
986
1002
 
@@ -1195,7 +1211,7 @@ class QCustomSlideMenu(QWidget):
1195
1211
  self.applyWidgetStyle()
1196
1212
  if hasattr(self, "targetBtn"):
1197
1213
  self.applyButtonStyle()
1198
-
1214
+
1199
1215
 
1200
1216
  def isExpanded(self):
1201
1217
  if self.width() > self.getCollapsedWidth() or self.width() > self.getCollapsedHeight():
@@ -1288,7 +1304,7 @@ class QCustomSlideMenu(QWidget):
1288
1304
 
1289
1305
  except Exception as e:
1290
1306
  print(e)
1291
-
1307
+
1292
1308
  self.floatMenu()
1293
1309
 
1294
1310
 
@@ -1296,9 +1312,11 @@ class QCustomSlideMenu(QWidget):
1296
1312
 
1297
1313
  def mouseReleaseEvent(self, QMouseEvent):
1298
1314
  cursor = QtGui.QCursor()
1299
- print(cursor.pos(), self.ui.pushButton.geometry().x())
1315
+ # print(cursor.pos(), self.ui.pushButton.geometry().x())
1300
1316
  # self.ui.frame.setGeometry(QRect(cursor.pos().x(), cursor.pos().y(), 151, 111))
1301
1317
 
1318
+
1319
+
1302
1320
  ########################################################################
1303
1321
  ## Read JSon stylesheet
1304
1322
  ########################################################################
@@ -1308,6 +1326,45 @@ def loadJsonStyle(self, ui):
1308
1326
 
1309
1327
  self.ui = ui
1310
1328
 
1329
+ ########################################################################
1330
+ ## BUTTON GROUPS
1331
+ ########################################################################
1332
+ if "QPushButtonGroup" in data:
1333
+ grp_count = 0
1334
+ for QPushButtonGroup in data['QPushButtonGroup']:
1335
+ if "Buttons" in QPushButtonGroup:
1336
+ grp_count += 1
1337
+ for button in QPushButtonGroup["Buttons"]:
1338
+ if hasattr(self.ui, str(button)):
1339
+ btn = getattr(self.ui, str(button))
1340
+ if not btn.metaObject().className() == "QPushButton":
1341
+ raise Exception("Error: "+str(button)+" is not a QPushButton object.")
1342
+ return
1343
+ setattr(btn, "group", grp_count)
1344
+ if not hasattr(self, "group_btns_"+str(grp_count)):
1345
+ setattr(self, "group_btns_"+str(grp_count), [])
1346
+
1347
+ getattr(self, "group_btns_"+str(grp_count)).append(btn)
1348
+
1349
+ btn.clicked.connect(self.checkButtonGroup)
1350
+ else:
1351
+ raise Exception("Error: Button named"+str(button)+" was not found.")
1352
+ return
1353
+
1354
+
1355
+ activeStyle = ""
1356
+ notActiveStyle = ""
1357
+ if "Style" in QPushButtonGroup:
1358
+ for style in QPushButtonGroup["Style"]:
1359
+ if "Active" in style:
1360
+ activeStyle = style['Active']
1361
+ if "NotActive" in style:
1362
+ notActiveStyle = style['NotActive']
1363
+
1364
+ setattr(self, "group_active_"+str(grp_count), activeStyle)
1365
+ setattr(self, "group_not_active_"+str(grp_count), notActiveStyle)
1366
+
1367
+
1311
1368
  ########################################################################
1312
1369
  ## ANALOG GAUGE WIDGET
1313
1370
  ########################################################################
@@ -1632,7 +1689,7 @@ def loadJsonStyle(self, ui):
1632
1689
  if "name" in QCustomSlideMenu and len(str(QCustomSlideMenu["name"])) > 0:
1633
1690
  if hasattr(self.ui, str(QCustomSlideMenu["name"])):
1634
1691
  containerWidget = getattr(self.ui, str(QCustomSlideMenu["name"]))
1635
-
1692
+
1636
1693
 
1637
1694
  if not containerWidget.metaObject().className() == "QCustomSlideMenu":
1638
1695
  raise Exception("Error: "+str(QCustomSlideMenu["name"])+" is not a QCustomSlideMenu object")
@@ -1683,23 +1740,23 @@ def loadJsonStyle(self, ui):
1683
1740
  if "relativeTo" in floatPosition:
1684
1741
  if hasattr(self.ui, floatPosition["relativeTo"]):
1685
1742
  relativeTo = getattr(self.ui, str(floatPosition["relativeTo"]))
1686
-
1743
+
1687
1744
  relativeTo = containerWidget.setParent(relativeTo)
1688
1745
  else:
1689
1746
  relativeTo = floatPosition["relativeTo"]
1690
-
1747
+
1691
1748
  if "position" in floatPosition:
1692
1749
  position = floatPosition["position"]
1693
-
1750
+
1694
1751
  if "shadow" in floatPosition:
1695
1752
  for shadow in floatPosition["shadow"]:
1696
- if "color" in shadow:
1753
+ if "color" in shadow:
1697
1754
  shadowColor = shadow["color"]
1698
- if "blurRadius" in shadow:
1755
+ if "blurRadius" in shadow:
1699
1756
  shadowBlurRadius = shadow["blurRadius"]
1700
- if "xOffset" in shadow:
1757
+ if "xOffset" in shadow:
1701
1758
  shadowXOffset = shadow["xOffset"]
1702
- if "yOffset" in shadow:
1759
+ if "yOffset" in shadow:
1703
1760
  shadowYOffset = shadow["yOffset"]
1704
1761
 
1705
1762
  if "defaultSize" in QCustomSlideMenu:
@@ -1710,7 +1767,7 @@ def loadJsonStyle(self, ui):
1710
1767
 
1711
1768
  if "height" in defaultSize:
1712
1769
  defaultHeight = defaultSize["height"]
1713
-
1770
+
1714
1771
 
1715
1772
  if "collapsedSize" in QCustomSlideMenu:
1716
1773
  for collapsedSize in QCustomSlideMenu["collapsedSize"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QT-PyQt-PySide-Custom-Widgets
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Custom widgets and widget animations made for QT applications
5
5
  Home-page: https://github.com/KhamisiKibet/QT-PyQt-PySide-Custom-Widgets
6
6
  Author: Khamisi Kibet