From 09c1a83f0b4278e9074121052b2dc6adc5f45fc0 Mon Sep 17 00:00:00 2001 From: Sam Bradshaw Date: Fri, 8 Dec 2023 11:03:43 +1100 Subject: [PATCH] Fix buttons not glowing in config for some users --- contanki/buttons/Other/Glow.png | Bin 8870 -> 0 bytes contanki/buttons/Other/background.png | Bin 0 -> 13585 bytes contanki/config.py | 3 +- contanki/controller.js | 5 +- contanki/icons.py | 117 ++++++++++++-------------- contanki/overlay.py | 1 - contanki/tests/test_icons.py | 4 +- 7 files changed, 61 insertions(+), 69 deletions(-) delete mode 100644 contanki/buttons/Other/Glow.png create mode 100644 contanki/buttons/Other/background.png diff --git a/contanki/buttons/Other/Glow.png b/contanki/buttons/Other/Glow.png deleted file mode 100644 index cad0f6dc4e16fcf34c953c13ba2f0d8803472987..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8870 zcmeHrXH-*L&~`#IQj}f|k4iUJ}X z>>x#&fPf$fSU^O1gL>Qg-amJ(@BMd^bx!u#d*+#$XJ*ejJF(`b$GO-Kumb=9E@L#( zg7Hh(y+CY?J7qfE3IJeQ54N)PwZH~|DO7I~*@Fo74Wbai#6U6$00hg=F5C+qgZ8& z@N`LPj9e#Pq_{6>RYSi|&)r>qaCwRM%go}?H=6^i1+LY{qQ5WKNQ4-^Ii9&+V&qv| zDL_ix^aYH&Rtdy@Le*N{wdP1hT;%<}mre?ht2}P!OFkjria!qt3ci&dbf^1dO5b=( zy6lT9dmFy5+B_W@in;Mt=E|Mg2ZUqSb)uir9^0b&SnsH~pH94$ExE8v;VIXBcxHq% zu`M#^ZXUwlughB4VbXuVG+nq}hInAW^@Y!u9E3stIVnxf%)@>1zN+P8(wlFK)JF<> zx%Uj6$31NeQ1Wdob1*B^ik{auCx)xWg|5B4dVZ@d+lN0!vxOE_pD8&4lI%utXmHj4JPY3!bz z9!PWnv$^4dQdR&r7$Xi!sX+rp=P8$L5==4H7q#^-_bELQcycAoB%RGxNAXJ{u}j=d z;VR~C(H-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2*&QK62qwS=ah`jnN$kN#FQJ=JZ~ZdLDdleN)b7b+^w&sV&>aXw%}vFtcONAXld zO>0GRCi6_~CaAY^j=IGr?9M_y+{U$9!U;^#c}?TF z!Wnql%_*CcJ zv2mEg4u$getS7L)^~*7uo@7Te5n~+(6#@;D8%IsLjStSUaMyg7e=aKs51?t-W2I?*oqHL^WxKO-E{@?0YK^*_*()tnn2S-b?kRM%pY_O79rP z3V=Nff54iBX+y+7gVpz^K2HXn(?Wh4T;r0X36Tlfx^p12Hf(wC82}+=G#0Yqtur;T ze64wfoG}h`PUs%AlNhWjkrf5p&#TMp_S8+YI@eVnDhl44xoCUDPuQm>7%K2ZEiTOj zwNgWIG8>x23LInaW*l?3`EybqSPnGHyU#QhE8w=dz~{x1W;-h*oEj7cKMd|$xe#!> z(Y{(Qq`tXN_q(57WJh3fiyM?J%9_8}fA)t8-?pXTnma&Z_Cj@hU1+O;|H@*{(w4FN zW;&glLTy?&4z!cHcgtF+qJ^uif;Ezkzx`B2{pGh%Wr?sI`r0+UO&b6eFu((D@tYbP ax&S!;kV&Gd7?HdC*M%|46j^TI9R5FpKf#Lt diff --git a/contanki/buttons/Other/background.png b/contanki/buttons/Other/background.png new file mode 100644 index 0000000000000000000000000000000000000000..d8805d951d2219c2a152c968c040c1df4c1b2a0c GIT binary patch literal 13585 zcmaKT1zc18_dlU@h@f|>*WLZxbKmcC&gY!-IrrYZwlHl?6;dKPA}lN{QZ-dY-K#z9=SF~c_35~f z_z(*VyVOQOL0e5hfkoTd!OF(Y5(|qf&O1&<)mVqB+czv+j*ZNfYi$Q_3#OQ*KtV)@ zPeCPLmGQYPDXH}7USp%8q9c{b_3J~qkMPHItzA$(Mm$t4_i~IWQm7iJJks9e-_bv4 zUA{PO*_Zv^h-__v^CT8;`=yvVTAWirQFc=W=L)e{E+}mWBact?QDkhpj2PxV$(8*`;%>BZz5FZZ7#A4wC?QRJ|>xGx(|Hu?G05l`c}e<;D=HM8};`E zz^&b|mG|9AxhZjvn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z3I}cy@{UlgH!fQ=t?BEu(OJ}|!QDOIqDr)h@45Zr{#2f8>h~j~@#r&YM1oH;e#X>` z@!gp~d+#WM>}3ok{Nk3Zf%3P#I@36uy|#33UOb|XI2-ElT7)IqbgSI0h^YHZH0jr;f>V_PMu@(af2sk=KM( zA$*5*o9Ev&3o6eJzuS-5*HhhYhXk9+(Mcu|7z zk-_IIHot?znB5nGD{f+=BK7dKdSp5AB7@C>%MHvb;qub7=t{Jx;{%3F1#j*)haYn- za8eKL1Jk$PX>Z|2FkYB8JXL8PJW{JlX4^NH5VP2{eUh3bD)d+YtM%yFhLP;9PWRdk zmugvMGHI94t|Tp7Td!1%#5q6-9vZ+O@;-Wvm~cUwccz^ow`(rpX7pEwuaL2%+aW2SdxlKI z<|y^o;?hKK53)(jZ_BL$YT?ncB6iolFmryX;#*~?- 80) { mock_index = 0; } if (mock_index < 20) { diff --git a/contanki/icons.py b/contanki/icons.py index 168d941..8f74b6e 100644 --- a/contanki/icons.py +++ b/contanki/icons.py @@ -5,10 +5,8 @@ from weakref import WeakSet from aqt import mw -from aqt import ( - QComboBox, +from aqt.qt import ( QFont, - QHBoxLayout, QLabel, QSizePolicy, QWidget, @@ -16,69 +14,59 @@ QPixmap, QPainter, QColor, - QIcon, + QGraphicsColorizeEffect, ) from aqt.utils import tooltip from .controller import Controller -def get_button_icon( - controller: Controller | str, button: str, glow: bool = False -) -> QPixmap: +directions = [ + "Left", + "Right", + "Up", + "Down", + "Horizontal", + "Vertical", + "Diagonal", + "UpLeft", + "UpRight", + "DownLeft", + "DownRight", + "HorizontalVertical", +] + + +def icon_path(folder, file): + return join(dirname(abspath(__file__)), "buttons", folder, file) + + +def get_button_icon(controller: Controller, button: str) -> QPixmap: """Fetches the icon for a button, and applies glow effect.""" - controller = str(controller) - if "(" in controller: - controller = controller.split(" (")[0] - directions = [ - "Left", - "Right", - "Up", - "Down", - "Horizontal", - "Vertical", - "Diagonal", - "UpLeft", - "UpRight", - "DownLeft", - "DownRight", - "HorizontalVertical", - ] - - def path(folder, file): - return join(dirname(abspath(__file__)), "buttons", folder, file) - - pixmap = QPixmap(path(controller, button)) - if ( - pixmap.isNull() - and button - and button != "Not Assigned" - and button.split(" ")[-1] in directions - ): - direction = button.split(" ")[-1] - button = " ".join(button.split(" ")[:-1]) - pixmap = QPixmap(path(controller, button)) - if not pixmap.isNull(): - dpixmap = QPixmap(path("Arrows", direction)) - with QPainter(pixmap) as painter: - painter.drawPixmap(pixmap.rect(), dpixmap, dpixmap.rect()) - if pixmap.isNull(): - pixmap = QPixmap(100, 100) - # not sure how or why, but the last icon will still be there, so we clear it - pixmap.fill(QColor(255, 255, 255, 255)) - with QPainter(pixmap) as painter: + controller_name = str(controller.parent) + if "(" in controller_name: + controller_name = controller_name.split(" (")[0] + pixmap = QPixmap(icon_path("Other", "background.png")) + with QPainter(pixmap) as painter: + if not (icon := QPixmap(icon_path(controller_name, button))).isNull(): + painter.drawPixmap(pixmap.rect(), icon, icon.rect()) + elif ( + button + and button != "Not Assigned" + and (direction := button.split(" ")[-1]) in directions + and (button := " ".join(button.split(" ")[:-1])) + and not (icon := QPixmap(icon_path(controller_name, button))).isNull() + and not (dpixmap := QPixmap(icon_path("Arrows", direction))).isNull() + ): + painter.drawPixmap(pixmap.rect(), icon, icon.rect()) + painter.drawPixmap(pixmap.rect(), dpixmap, dpixmap.rect()) + else: painter.setFont(QFont("Arial", 20)) painter.drawText( pixmap.rect(), Qt.AlignmentFlag.AlignCenter, button.replace(" ", "\n") ) - if button and button != "Not Assigned": - tooltip(f"Error: Couldn't load {button} icon for {controller}.") - - if glow: - gpixmap = QPixmap(path("Other", "glow")) - with QPainter(pixmap) as painter: - painter.drawPixmap(pixmap.rect(), gpixmap, gpixmap.rect()) - + if button and button != "Not Assigned": + tooltip(f"Error: Couldn't load {button} icon for {controller_name}.") return pixmap @@ -89,7 +77,7 @@ def __init__( self, parent: QWidget | None, button: str, - controller: Controller | str, + controller: Controller, index: int | None = None, is_large=False, ) -> None: @@ -99,16 +87,21 @@ def __init__( self.setMaximumHeight(120 if is_large else 60) self.setContentsMargins(0, 0, 0, 0) self._pixmap = get_button_icon(controller, button) - self._pixmap_glow = get_button_icon(controller, button, glow=True) if index is not None: IconHighlighter.register_icon(index, self) - self.refresh() + self.colorize_effect = QGraphicsColorizeEffect() + self.colorize_effect.setColor(QColor(255, 255, 255, 128)) + self.setGraphicsEffect(self.colorize_effect) + self.glow(False) + self.resizeEvent(None) - def refresh(self, glow=False): + def glow(self, glow=False): """Updates the icon for size and glow.""" - pixmap = self._pixmap_glow if glow else self._pixmap + self.colorize_effect.setEnabled(glow) + + def resizeEvent(self, event): self.setPixmap( - pixmap.scaled( + self._pixmap.scaled( self.height(), self.height(), Qt.AspectRatioMode.KeepAspectRatio, @@ -131,4 +124,4 @@ def set_highlight(self, index: int, highlight: bool) -> None: """Sets the highlight for an icon.""" if index in self.icons: for icon in self.icons[index]: - icon.refresh(highlight) + icon.glow(highlight) diff --git a/contanki/overlay.py b/contanki/overlay.py index e606878..790275f 100644 --- a/contanki/overlay.py +++ b/contanki/overlay.py @@ -159,6 +159,5 @@ def appear(self, state: State): if self.width() - 300 < len(text) * 8: text = text.replace(" ", "\n") self.action.setText(text) - self.icon.refresh() self.update() self.show() diff --git a/contanki/tests/test_icons.py b/contanki/tests/test_icons.py index be3bef3..19fa348 100644 --- a/contanki/tests/test_icons.py +++ b/contanki/tests/test_icons.py @@ -8,5 +8,5 @@ def test_can_get_all_button_icons(): for controller in get_controller_list(): for button in Controller(controller).buttons.values(): - get_button_icon(controller, button) - ButtonIcon(None, button, controller) + get_button_icon(Controller(controller), button) + ButtonIcon(None, button, Controller(controller))