#pyqt | Logs for 2019-02-22

Back
[01:41:12] -!- a-l-e has joined #pyqt
[08:39:51] -!- Siecje has joined #pyqt
[09:44:36] -!- TechSmurf has joined #pyqt
[10:40:40] -!- AbleBacon has joined #pyqt
[13:49:08] -!- Safa_[A_boy] has joined #pyqt
[13:50:23] <Safa_[A_boy]> Hi guys. I've opened a topic in the forums: https://forum.qt.io I tried this https://pastebin.com but the RAM hasn't changed a bit, and still increases.
[14:25:03] -!- AbleBacon has quit [Quit: Leaving]
[15:05:40] -!- mintograde has joined #pyqt
[16:22:06] -!- a-l-e has quit [Ping timeout: 264 seconds]
[16:41:37] -!- Storgance has joined #pyqt
[16:43:21] <Storgance> hello
[16:44:17] <Avaris> hey
[16:57:06] <Storgance> altendky: out of curiosity, why did you do text=text and index=index a bunch?
[16:57:18] -!- Siecje has parted #pyqt
[16:57:31] <Storgance> Or wait, the arguments are named that aren't they..
[16:58:03] <altendky> Storgance: :] I prefer passing with names, yes.
[16:58:36] -!- Safa_[A_boy] has quit [Quit: Leaving]
[16:58:50] <altendky> Having some shortcut for that could certainly be nice. index~= or... Who knows
[17:04:02] <Avaris> store in a dict and ** :)
[17:04:42] <altendky> `**{'index': index, 'text': text}`... hmm, not quite :]
[17:05:15] <altendky> `**{name: locals()[name] for name in ('index', 'text')}` meh
[17:10:40] <Avaris> point is to use dict instead of variables like index and text
[17:11:51] <altendky> `index = {'index': index}` and `do_it(**index)`. still, but i'll take the point that there is something related
[18:05:45] -!- Storgance has quit [Ping timeout: 256 seconds]
[18:33:04] -!- storgance has joined #pyqt
[18:34:38] <storgance> altendky: Given the example you gave me, where would I change the background color of one of the labels? Something is telling me in WidgetDelegate's paint(), but I don't see exactly how to access the labels from within there
[18:36:02] <storgance> Avaris: you might know the answer as well, so I am pinging you too
[18:36:16] <altendky> storgance: nope. In the widget. It's a perfectly normal widget that you treat like any other widget.
[18:36:47] <altendky> If it's dependent on the index being shown, then you would update it in that update method (I forget what I called it)
[18:37:12] <storgance> Oh, alright..I tried doing self.upper_label.palette().setColor(self.upper_label.backgroundRole(), Qt.yellow), but nothing happened.
[18:37:34] <storgance> Within setup_ui
[18:37:42] <altendky> storgance: you have to set the palette back onto the widget
[18:38:00] <storgance> I'm...not sure what you mean by that
[18:39:12] <altendky> storgance: if you ask me for my palette, then you change it, and don't give it back to me... How do I know what you want me to do?
[18:39:38] <storgance> Ohh, I assumed this was like passing the pointer to the widget, I see. Thank you
[18:39:51] <altendky> storgance: yeah, it's a bit unexpected
[18:39:52] <storgance> *pointer to the palette
[18:40:01] <altendky> Size policies are similar
[18:40:26] <storgance> I think I recall that happening with that too, yeah. Is this normal for Python?
[18:40:56] <altendky> storgance: I think it might be a qt thing
[18:41:04] <altendky> But really it's an API choice
[18:41:32] <storgance> I see
[18:45:32] <storgance> It looks like the background for the QLabel is being overridden somewhere...Changing background and foreground roles makes the characters change letter, but nothing behind them
[18:45:40] <storgance> *characters change color
[18:47:04] <altendky> storgance: did I make it translucent?
[18:47:44] <storgance> I don't see anything specifying that. What would the function call for that be?
[18:54:40] <storgance> altendky
[18:54:43] <Avaris> storgance: code somehere?
[18:55:26] <storgance> Avaris: https://pastebin.com
[18:57:02] <Avaris> hmm, pastebin isn't working for me. can you use another paste site?
[18:57:39] <storgance> https://hastebin.com
[18:59:55] <altendky> Auto fill background
[19:00:02] <Avaris> setAutoFillBackground(True)
[19:00:25] <altendky> I wanted the list to control the background, such as with the alternating row color
[19:00:44] <altendky> storgance: you want a per widget background color?
[19:00:48] <storgance> Yes
[19:00:57] <storgance> I wanted to see what space each widget took up exactly
[19:01:35] <Avaris> or use a stylesheet
[19:02:11] <altendky> I guess that setting gets inherited?
[19:02:13] <storgance> Hmm, okay
[19:03:08] <Avaris> it's false by default
[19:03:51] <Avaris> window type widgets bypass it and paint background
[19:05:52] <Avaris> this thing paints outside rect?
[19:06:59] <altendky> That sounds bad and I didn't mean it to
[19:07:07] <storgance> It was seemingly before, but now that I removed setAutoFillBackground and used stylesheets it's doing just fine
[19:08:09] <Avaris> either that or highlight is painted wrong. upper_label goes above highlight
[19:09:11] <altendky> Avaris: is there still a margin I should have applied :[
[19:10:48] <Avaris> hmm why don't you paint to painter directly?
[19:11:12] <Avaris> i should say, render actually
[19:12:22] <altendky> Avaris: why the paint device rather than the painter itself being passed to render?
[19:12:38] <Avaris> yeah
[19:13:20] * altendky cowers
[19:13:26] <altendky> An SO post
[19:13:45] <altendky> Not at my computer so I can't review that detail at the moment
[19:14:21] <Avaris> it's basically same thing, just the .device stuff is not needed :)
[19:15:26] <altendky> Avaris: I assume it didn't work
[19:15:54] <altendky> Maybe render wants to begin and end itself or something
[19:16:58] <Avaris> nah, works fine. but there are margin issues
[19:17:07] <storgance> Hmm...so, despite setting a horizontal and vertical size policy of MinimumExpanding to upper_label and setting the stretch for rows 0,1 and columns 0,1 to 1, the upper label (at 0,0) is only a tiny sliver. https://i.imgur.com
[19:17:09] <Avaris> (i think)
[19:18:15] <altendky> Avaris: hmm. Sure thought I got some icky error message. I'll have to try later
[19:19:17] <Avaris> it might be the fact that widget you create is top-level (i.e. a window) and it adds some extra margins
[19:20:04] <storgance> Oh, I'll check that
[19:20:28] <altendky> storgance: so the example worked for both of us. Did it not look sensible for you originally?
[19:20:30] * Avaris can't open imgur either
[19:21:28] <Avaris> storgance: also not sure about your current code, but your shared code has both labels in 1st column but 2 columnstretch for some reason
[19:21:40] <storgance> altendky: I wanted to move it so that there was one label that took the top half, and another which took the bottom half
[19:22:39] <storgance> (i.e. chat name and last message)
[19:23:07] <altendky> storgance: I thought it started that way
[19:23:19] <altendky> But maybe I forgot something
[19:23:26] <storgance> It was with a button and two labels, where the button took up the top left
[19:24:31] <altendky> I thought the button was the left with a vertical span and there was a top label and a bottom label on the right
[19:26:08] <storgance> Yes, with the top label in row 0 and the bottom label in row 1
[19:26:27] <altendky> Ok
[19:26:40] <altendky> So one above the other. Which is what you want?
[19:26:55] <storgance> Yes, and I want them to collectively take the entire space
[19:28:10] <storgance> It's strange to me how your example doesn't have stuff hitting the edge of the parent, but when I translated it to mine it did
[19:29:07] <altendky> storgance: what was mine not doing? the widgets would have filled 'the space' like normal
[19:30:43] <altendky> storgance: for one, you are still setting the second column to take all the space via the stretch, but not putting anything in it
[19:31:00] <storgance> For yours it only takes up the slice as well technically
[19:31:14] <altendky> storgance: what slice?
[19:32:26] <altendky> https://usercontent.irccloud-cdn.com
[19:32:27] <storgance> altendky: The widget is exactly the height of the text tall and...has the feature where there's some padding too
[19:32:30] <storgance> It has to be padding
[19:32:45] <altendky> https://usercontent.irccloud-cdn.com
[19:33:23] <altendky> for the left one i removed the column stretch from https://pastebin.com
[19:33:49] <storgance> altendky: https://i.imgur.com
[19:33:50] <altendky> storgance: so, you said 'mine' was still only showing in the 'slice'. what do you mean? what about the image above is 'only in the slice'
[19:34:11] <altendky> storgance: ok. that makes sense. layouts have spacing between widgets by default
[19:34:49] <storgance> Ok, I'll set the spacing to 0
[19:35:40] <Avaris> you probably also want setContentsMargins(0, 0, 0, 0)
[19:35:43] <altendky> https://doc.qt.io
[19:35:56] <altendky> i mean, if you literally want things bumping into each other...
[19:36:17] <altendky> which seems at least somewhat unlikely
[19:36:19] <Avaris> but, honestly i can't figure out why this thing paints outside
[19:36:36] <altendky> Avaris: i'm not sure what you are talking about. can you clarify in my screenshot?
[19:36:36] <storgance> altendky: I think I do, at least for now.
[19:36:55] <Avaris> put backgrounds to the labels, you'll se
[19:37:08] <Avaris> *see
[19:37:43] <Avaris> also amplify the effect with `setContentsMargins(0, 0, 0, 0)` as well
[19:39:59] <altendky> Avaris: not sure what i should see https://usercontent.irccloud-cdn.com
[19:41:59] <Avaris> altendky: how about this one: https://dpaste.de
[19:42:11] <altendky> Avaris: hmm, but i do agree that passing painter to render does seem to work ok right now
[19:42:16] <storgance> so...
[19:43:05] <altendky> Avaris: yeah, that looks a mess https://usercontent.irccloud-cdn.com
[19:44:03] <storgance> I set spacing to 0, content margins 0,0,0,0, and removed the column stretch for column 1
[19:44:23] <storgance> But, there's still like, 10 pixels of unclaimed space to the right of the labels
[19:47:27] <altendky> storgance: just keep getting my example and your example closer together and see when mine breaks or yours unbreaks
[19:54:27] <storgance> Yeah, I don't get it...yours is working perfectly
[19:54:49] <altendky> storgance: keep getting them closer. just delete stuff and check.
[19:54:57] <altendky> or change to match line by line and check
[19:55:05] <altendky> eventually they kinda have to do the same thing, right? :]
[20:00:16] <storgance> ...uhm
[20:00:21] <storgance> i wish they did
[20:00:57] <storgance> Ohh, perhaps it's the fact that your button has a sizepolicy
[20:02:02] <altendky> storgance: the button was one of the first things I deleted :]
[20:10:49] <storgance> aaaa
[20:12:02] <altendky> Avaris: back away from my computer again. I wonder if theres a local vs global coordinate mismatch
[20:12:48] <altendky> So the drawing rect needs to be shifted by the origin of the list view or such
[20:12:59] <altendky> Or really local to global or whatever
[20:17:48] <altendky> storgance: I'm guessing it's having your list view inside a layout and another widget
[20:18:10] <altendky> Put mine inside and I guess it will be offset as well
[20:20:45] <storgance> I don't understand why that would break it..
[20:21:09] <altendky> storgance: does it?
[20:21:29] <altendky> storgance: or, does showing your list view directly fix yours?
[20:45:25] <altendky> storgance: yep, showing your list view directly made stuff center up properly. https://usercontent.irccloud-cdn.com
[20:45:33] -!- storgance has quit [Ping timeout: 256 seconds]
[20:45:40] <altendky> storgance: so i've got a bug... hmm
[21:59:01] -!- storgance has joined #pyqt
[22:05:21] <altendky> storgance: i think imight have a fix. tweaking my example now
[22:21:20] <storgance> I found out the issue
[22:21:28] <storgance> Sorry I just noticed your message aaa
[22:21:46] <storgance> Setting the margins on the root layout to 0 fixed it
[22:21:54] <storgance> altendky:
[22:22:07] <altendky> storgance: hid it
[22:22:20] <storgance> What do you mean?
[22:22:42] <altendky> storgance: you should be able to have margins on layouts containing widgets without the widgets going haywire
[22:23:03] <altendky> storgance: or, try swapping your left and right widgets. it'll be more broken.
[22:23:41] <storgance> Ok, so what do you think was the issue?
[22:24:42] <altendky> storgance: i seem to need to tweak one of the points passed to render based on the parent offsets. i think i've got a first pass fix, though it seems hacky. i was about to commit and share, then maybe look briefly to see if i can tidy it.
[22:25:09] <storgance> hmm, okie
[22:25:24] <altendky> storgance: https://gist.github.com
[22:25:45] <altendky> so i added two layers of layouts with buttons in the upper left of each to expose the issue. also added the compensation for it.
[22:27:18] <storgance> Hmm...
[22:41:23] <altendky> storgance: pushed some more tweaks. nothing functionally different, just tidier i think. though i still don't love the looping to get the top level widget. doesn't seem like i should need to do that.
[22:41:58] <altendky> err, missed a tidy. pushed again...
[22:42:46] <altendky> storgance: sorry i didn't see this before you spent a bunch of time on it. hopefully it holds up a little longer this time before you find the next bug.
[22:46:01] <altendky> storgance: is it working for you?
[22:47:48] <storgance> Haven't had the chance to run it a lot, been trying to translate some of my other work and restructure my repo and such
[22:50:16] <storgance> Copy and pasted the code from the gist to a spaces to tabs converter, paste in notepad and save, run it....just completes, nothing opens
[22:51:31] <altendky> storgance: why are you converting? Or using notepad?
[22:52:06] <storgance> Because github stores things as spaces, which causes my system issues. I'm using notepad because pasting in vim is very strangely broken for some reason
[22:52:55] <altendky> storgance: you mean that you have files with tabs and when you paste in things with spaces there are problems?
[22:53:06] <storgance> Yep
[22:53:13] <altendky> storgance: anyways, you should be able to view raw and then save it some such
[22:53:31] <altendky> storgance: well, use spaces :] it's the python standard
[22:53:34] <storgance> I'm viewing raw, converting, then saving and running
[22:54:03] <storgance> aaa, i don't wanna have to spam my keyboard, plus github used 4 flippin spaces for some reason
[22:54:12] <storgance> *uses
[22:54:18] <altendky> storgance: that's the correct way
[22:54:29] <altendky> And nobody hits the space bar four times
[22:54:40] <altendky> Fix your editor to replace tabs with spaces
[22:54:51] <altendky> And a width of four
[22:55:09] <storgance> why is it the standard, though?
[22:55:23] <storgance> i've never gotten the spaces argument tbh
[22:55:46] <altendky> storgance: you'll get better answers in #python. But, trans aren't consistent so you can't actually expect stuff to align with them
[22:55:56] <altendky> *tabs aren't
[22:56:39] <altendky> storgance: regardless, you either continually fight with pretty much all code, or you give in
[22:56:58] <altendky> storgance: if you put 1/0 on the first line, do you get an error?
[22:57:50] <storgance> it did the same thing with spaces
[22:58:05] <storgance> What do you mean 1/0 on the first line?
[22:58:44] <altendky> storgance: add that text on the first line. It's division by zero. You should see an error
[22:59:09] <storgance> oh, yeah
[22:59:10] <storgance> I do
[23:04:40] <altendky> storgance: it'll be a few minutes before I can try again myself
[23:07:54] <storgance> okie
[23:10:41] <altendky> storgance: after import sys try adding import traceback and then sys.excepthook = lambda excType=None, excValue=None, tracebackobj=None: print(''.join(traceback.format_exception( etype=excType, value=excValue, tb=tracebackobj, )).strip()
[23:19:12] <storgance> It's not liking the format of that lambda
[23:20:10] <altendky> Needs a trailing )
[23:21:32] <storgance> yee I added that
[23:27:26] <altendky> storgance: is there an error?
[23:28:26] <storgance> It's just saying that the sys.excepthook = lambda line has invalid syntax
[23:29:19] <altendky> storgance: can you share the code and full output? Doesn't it usually have a ^ for syntax errors?
[23:31:16] <storgance> https://pastebin.com
[23:31:21] <storgance> error at the bottom
[23:32:05] <altendky> storgance: lambda can't be split over multiple lines like that unless it's in ()
[23:33:08] <storgance> Oh ok. It just runs and completes now
[23:34:24] <altendky> storgance: the sys.exit needs to be at the top level. No indentation
[23:35:03] <altendky> Otherwise it never calls main
[23:35:12] <storgance> Ohhh
[23:36:14] <storgance> So, I don't quite understand your fix...What does it do?
[23:37:08] <altendky> storgance: coordinates have to be used relative to the proper origin. Apparently my change makes that happen
[23:37:38] <storgance> Ohh, hmm...
[23:37:47] <altendky> But yeah, I'm not convinced I have it 'right', just working
[23:38:12] <storgance> I see
[23:38:31] <altendky> storgance: anyways, it looks ok when it runs?
[23:40:34] <storgance> with the exception of the fixable horizontal scrollbar, very much so!
[23:40:47] <altendky> storgance: what's wrong with the bar?
[23:41:24] <storgance> I'm just not going to want it for mine is all
[23:41:52] <altendky> storgance: alrighty. Bedtime here. Let me know if anything else comes up.
[23:42:06] <storgance> Okay, thank you for all your help! sleep well
[23:42:27] -!- mintograde has quit [Ping timeout: 244 seconds]