# Compact Brush Toggler

**URL:** <https://krita-artists.org/t/compact-brush-toggler/33798>\
**Category:** Plugins and Scripts\
**Created:** [December 25, 2021, 12:39pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798 "2021-12-25T12:39:51Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![EyeOdin](https://krita-artists.org/user_avatar/krita-artists.org/eyeodin/32/2662_2.png) [@EyeOdin](https://krita-artists.org/u/EyeOdin)\
**Post date:** [January 8, 2023, 12:27am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/41 "2023-01-08T00:27:55Z")

</div>

Icons for button (self.layout.cmyk\_4\_lock) :

```auto
        self.icon_lock = self.Icon_Lock(self.gray_contrast)
        self.svg_lock_cmyk_4 = QtSvg.QSvgWidget(self.layout.cmyk_4_lock)
        self.svg_lock_cmyk_4.load(self.icon_lock)

```

```auto
    def Icon_Lock(self, hex):
        string = str(
        "<svg width=\"15\" height=\"15\" viewBox=\"0 0 3.9687499 3.9687501\" version=\"1.1\" id=\"svg8\"> \n" +
        " <defs id=\"defs2\" /> \n" +
        " <g \n" +
        " inkscape:label=\"Layer 1\" \n" +
        " inkscape:groupmode=\"layer\" \n" +
        " id=\"layer1\"> \n" +
        " <rect \n" +
        " style=\"display:inline;opacity:1;fill:"+hex+";fill-opacity:1;stroke-width:1.84699;stroke-dasharray:1.84699, 1.84699\" \n" +
        " id=\"rect833\" \n" +
        " width=\"1.8520833\" \n" +
        " height=\"1.0583333\" \n" +
        " x=\"1.0583333\" \n" +
        " y=\"1.8520834\" \n" +
        " inkscape:label=\"bot\" /> \n" +
        " <path \n" +
        " style=\"display:inline;fill:"+hex+";fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1\" \n" +
        " d=\"M 1.3229165,1.8520834 V 1.3229167 L 1.5874998,1.0583334 h 0.79375 L 2.6458331,1.3229167 V 1.8520834 H 2.3812498 l 10e-8,-0.419573 L 2.2716562,1.3229167 H 1.6970938 l -0.1095939,0.1095939 -1e-7,0.4195728 H 1.3229165\" \n" +
        " id=\"path846\" \n" +
        " sodipodi:nodetypes=\"ccccccccccccc\" \n" +
        " inkscape:label=\"top\" /> \n" +
        " </g> \n" +
        "</svg>"
        )
        array = bytearray(string, encoding='utf-8')
        return array

```

But yeah QtSvg module so people will have issues because Linux version if not an app image they can’t read it.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 8, 2023, 12:29am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/42 "2023-01-08T00:29:58Z")

</div>

Thank you, for this and ill take note of the issue. 🙂

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 8, 2023, 12:34am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/43 "2023-01-08T00:34:26Z")

</div>

as for the brush tip rotation by keyboard ; its fix. Thank you for the help. Talking to you help me get things more clearly. ^-^

[![](https://krita-artists.org/uploads/default/original/3X/8/6/866912ff73e4baa8f24b0d4544731c1c47d53f1a.jpeg "Brush Tip Rotation By Keyboard.") ](https://www.youtube.com/watch?v=tiJP4INT73w)

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 8, 2023, 1:53am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/44 "2023-01-08T01:53:28Z")

</div>

@tachiko @LunarKreatures

I just want to ask if you are experiencing a sudden brush resetting to 100 when a toggle is set?  
Specially for brushes with predefined brush tip?

---

<div class="post-metadata">

**Author:** ![tachiko](https://krita-artists.org/user_avatar/krita-artists.org/tachiko/32/30199_2.png) [@tachiko](https://krita-artists.org/u/tachiko)\
**Post date:** [January 8, 2023, 8:33pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/45 "2023-01-08T20:33:11Z")

</div>

yes I am, i notice it when I use shift increase brush size then when toggle off then back on, the size changes back but its weird because the brush size indicator still shows like where I increased it to prior to toggling

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 8, 2023, 10:05pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/46 "2023-01-08T22:05:47Z")

</div>

I merge a fix for it, yesterday.  
Can you try it, if it solves the issue?

> [@tachiko](#):
>
> the size changes back but its weird because the brush size indicator still shows like where I increased it to prior to toggling

For reason something stop working and i didnt notice it until was investigating rotation.

---

<div class="post-metadata">

**Author:** ![tachiko](https://krita-artists.org/user_avatar/krita-artists.org/tachiko/32/30199_2.png) [@tachiko](https://krita-artists.org/u/tachiko)\
**Post date:** [January 9, 2023, 1:45am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/47 "2023-01-09T01:45:11Z")

</div>

I have a buggy version of krita I think. I need to reinstall because I encounter other bugs that probably shouldnt occur.  
I did try your latest update and was buggy but its probably on my end.  
And I was not using your plugin enough to know if it was buggt before either

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 9, 2023, 1:46am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/48 "2023-01-09T01:46:38Z")

</div>

I will double check on my end as well.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 9, 2023, 2:42pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/49 "2023-01-09T14:42:32Z")

</div>

I pushed another fix.

You can try it and see if any issue about it occurs again ^-^

From time to time there’s a short time where the brush is force to go back to its actual whenever it gets reset to 100. its blink think. if the toggle is on the side its back before the cursor is in the canvas.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 14, 2023, 3:24pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/50 "2023-01-14T15:24:01Z")

</div>

![image](https://krita-artists.org/uploads/default/original/3X/d/4/d4939141bd3296dfe00c9aa3f71ddab76c5a3445.png)  
 ![image](https://krita-artists.org/uploads/default/original/3X/7/b/7bbe314eba46670586ad9852e745e4861250f5b2.png)

Trying to make some icon.

Top Row:  
Pressure-Size , Pressure-Opacity, Pressure-Soft, Pressure-Rotation, Pressure-Scatter,  
Bottom Row:  
Pressure Toggle Off, Pressure-Flow, Pressure-Color Rate, Overlay, Overlay Off.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 16, 2023, 5:28am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/51 "2023-01-16T05:28:51Z")

</div>

Change some of them;

 ![image](https://krita-artists.org/uploads/default/original/3X/c/b/cbedfd8c1f8e11a5a536a19f0dec818db07945fa.png)

I change color-rate and flow, they are easily confuse if someone colorblind and if its in small.

Right now I think the only one with issue at very small size is pressure-size. It can be confuse for pressure-toggle-off. Still studying how to add them to my plugin.

![image](https://krita-artists.org/uploads/default/original/3X/f/f/ff002f48209fdc9a9a7c9895a5afa163834a5e2a.png) ![image](https://krita-artists.org/uploads/default/original/3X/c/1/c185ecf03a0d4b887154587dcaaaad94a4a459f6.png)

---

<div class="post-metadata">

**Author:** ![EyeOdin](https://krita-artists.org/user_avatar/krita-artists.org/eyeodin/32/2662_2.png) [@EyeOdin](https://krita-artists.org/u/EyeOdin)\
**Post date:** [January 16, 2023, 11:00am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/52 "2023-01-16T11:00:53Z")

</div>

Your widget should have something like seticon and you need to give it a QIcon to it or maybe a QPixmap.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 19, 2023, 7:15am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/53 "2023-01-19T07:15:49Z")

</div>

Thank you, got busy stretch this week and I haven’t look into the code after finalizing my icons.  
I’ll try it once I can work on this again. For now I’m pretty happy with my icons, I think they represent their respective function well enough.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 20, 2023, 2:38pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/54 "2023-01-20T14:38:32Z")

</div>

![image](https://krita-artists.org/uploads/default/original/3X/6/8/68fb4701b996833f164ebeaf9ee96534c2004cc7.png)

I kinda made it work with QIcons, the dark icons [#373737] looks nice except for softness.  
I followed how Krita Icons are saved which are 22 x 22px svgs in two modes light and dark.

Soak Ink one is a pretty fun icon cause it dunks the brush 😂

softness needs work, a bit of adjustment to paintmode.

OTH dark theme light icon ver needs alot work.

![image](https://krita-artists.org/uploads/default/original/3X/6/5/65c464f555cd08ab19ea5265cfd1bb13d08a5cd0.png)

[idk how to work pixmap so i just qicon from file. I think i need a way to know if the theme is dark or light]

---

<div class="post-metadata">

**Author:** ![tachiko](https://krita-artists.org/user_avatar/krita-artists.org/tachiko/32/30199_2.png) [@tachiko](https://krita-artists.org/u/tachiko)\
**Post date:** [January 20, 2023, 3:25pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/55 "2023-01-20T15:25:12Z")

</div>

Love the icons, I feel like you could have the option to hide text and make icons larger and square. Since the Icons are very good on their own. maybe a hover 1 sec to see text toolbox.

---

<div class="post-metadata">

**Author:** ![EyeOdin](https://krita-artists.org/user_avatar/krita-artists.org/eyeodin/32/2662_2.png) [@EyeOdin](https://krita-artists.org/u/EyeOdin)\
**Post date:** [January 20, 2023, 3:47pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/56 "2023-01-20T15:47:03Z")

</div>

```auto
    def showEvent(self, event):
        # Window
        self.Window_Connect()

```

```auto
    def Window_Connect(self):
        # Window
        self.window = Krita.instance().activeWindow()
        if self.window != None:
            self.window.activeViewChanged.connect(self.View_Changed)
            self.window.themeChanged.connect(self.Theme_Changed)
            self.window.windowClosed.connect(self.Window_Closed)

    def Theme_Changed(self):
        theme = QApplication.palette().color(QPalette.Window).value()
        if theme > 128:
            self.color1 = QColor("#191919")
            self.color2 = QColor("#e5e5e5")
        else:
            self.color1 = QColor("#e5e5e5")
            self.color2 = QColor("#191919")
        self.color_alpha = QColor(0, 0, 0, 0)

```

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 20, 2023, 3:56pm UTC](https://krita-artists.org/t/compact-brush-toggler/33798/57 "2023-01-20T15:56:55Z")

</div>

> [@tachiko](#):
>
> ns larger and square. Since the Icons are very good on their own. maybe a hover 1 sec to see text toolbox.

yes - thats what i want. to have a tall layout or a thin layout with large icon only.

Still need lots to figure out.

Soak Ink is… pretty fun icon if I say so myself 😂

@EyeOdin  
I can’t express my gratitude enough, thank you for always helping me.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 21, 2023, 1:12am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/58 "2023-01-21T01:12:59Z")

</div>

![image](https://krita-artists.org/uploads/default/original/3X/e/c/ec128de2e367a6f74d928c1d94e288205b149a55.png)

We are getting there 😃 . figure out to size the icon - with the button.

Just need to do a bit of cleaning and make it figure out whats the proper view ;

1. Squarish → Icon only + Tool tip
2. Short Rectangle → 3 letter
3. Long Rectangle → Full

which just a lil bit more selection and calculations.

---

<div class="post-metadata">

**Author:** ![kaichi1342](https://krita-artists.org/user_avatar/krita-artists.org/kaichi1342/32/8174_2.png) [@kaichi1342](https://krita-artists.org/u/kaichi1342)\
**Post date:** [January 22, 2023, 1:21am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/59 "2023-01-22T01:21:32Z")

</div>

Hello,

I have tried this and Theme\_change work in toggling the dark and light mode.

```auto
if self.window != None:
            self.window.themeChanged.connect(self.Theme_Changed)

```

I just don’t seem to manage to fire it up when i changed theme if the docker is already open when krita opens. temporarily have it in resize for testing purpose.

This only happens when the docker is already running and showing upon opening.  
If I close it and open it again via show hide docker - it works perfectly.

I think in this case the docker shows up before the windows fully loaded.

Other than that thank you 🙂

---

<div class="post-metadata">

**Author:** ![EyeOdin](https://krita-artists.org/user_avatar/krita-artists.org/eyeodin/32/2662_2.png) [@EyeOdin](https://krita-artists.org/u/EyeOdin)\
**Post date:** [January 22, 2023, 2:10am UTC](https://krita-artists.org/t/compact-brush-toggler/33798/60 "2023-01-22T02:10:23Z")

</div>

theme is reacting to 128 so it only changes from light to dark there, but it is being triggered. but in either case place debug messages and see where it is breaking exactly.

[Previous page](https://krita-artists.org/t/compact-brush-toggler/33798.md?page=2)

[Next page](https://krita-artists.org/t/compact-brush-toggler/33798.md?page=4)
