#pyqt | Logs for 2019-03-19
Back
[01:00:10] -!- mandeep_ has quit [Remote host closed the connection]
[01:01:11] -!- mandeep has joined #pyqt
[02:12:35] -!- n1` has joined #pyqt
[02:42:52] -!- n1` has quit [Ping timeout: 272 seconds]
[04:33:44] -!- n1` has joined #pyqt
[04:48:25] -!- n1` has quit [Quit: WeeChat 2.3]
[04:49:00] -!- n1` has joined #pyqt
[05:31:41] -!- BPL has joined #pyqt
[05:58:19] -!- mandeep has quit [Ping timeout: 246 seconds]
[06:06:32] -!- mandeep has joined #pyqt
[06:50:09] -!- n1` has quit [Ping timeout: 244 seconds]
[07:44:28] -!- n1` has joined #pyqt
[08:17:52] -!- nsizemor has joined #pyqt
[08:20:07] -!- nsizemor has quit [Remote host closed the connection]
[08:38:01] -!- Siecje has joined #pyqt
[10:12:37] -!- Casper366 has joined #pyqt
[10:15:19] <Casper366> hi. I'm trying to learn pyqt, but i don't understand, why this example doesn't work.
[10:15:22] <Casper366> https://pastebin.com
[10:15:49] <altendky> Casper366: what doesn't work?
[10:16:02] <Casper366> i get an error: QObject::connect: Cannot connect QPushButton::clicked(bool) to (null)::on_quitButton_clicked()
[10:17:14] <Casper366> if i delete line 25 it opens, but on_okButton_clicked() doesn't execute
[10:18:00] <Casper366> s/ok/quit/
[10:18:18] <altendky> Casper366: button clicks emit a signal with a parameter for whether the button is 'checked' or not. most buttons aren't checked and so we usually don't care. it seems that the pyqtSlot decorator makes the connect picky about that. just delete the pyqtSlot decorator and it'll figure out to throw the checked parameter away.
[10:18:33] <altendky> Casper366: or, lemme see how to accept the parameter with the slto
[10:18:44] <altendky> (pyqtSlot is mostly optional)
[10:19:44] <Casper366> thanks. i readl @QtCore.pyqtSlot() is good to have, but it seems to make trouble :-S
[10:20:20] <altendky> Casper366: supposedly there's some minor performance difference, i think. it may be that i should change my ways but i mostly don't use it.
[10:22:05] <altendky> hmm, not sure why `@QtCore.pyqtSlot(bool); on_quitButton_clicked(self, checked):` doesn't work either. still `TypeError: connect() failed between clicked(bool) and on_quitButton_clicked()`
[10:22:31] <altendky> though it did decide to stop showing the `QPushButton::` for some reason :|
[10:23:15] <altendky> oh, Ui_MainWindow isn't a QObject. i don't think it can have a pyqtSlot on it.
[10:23:28] <altendky> Casper366: but, i'd drop the pyqtSlot rather than adding QObject inheritance, personally.
[10:23:40] <Casper366> yes, i'll do that for sure.
[10:24:04] <altendky> Casper366: yeah, it was the lack of QObject inheritance all along
[10:24:19] <altendky> but i don't really inherit from qobject much.
[10:24:30] <Casper366> my next step is to try to eliminate line 25 and use line 18
[10:24:54] <Casper366> but i think i'm running into trouble because qtdesigner called it self.okButton and not okButton
[10:25:30] <altendky> Casper366: yeah, maybe. i like my .ui files standing alone without any ties to the code. *shrug*
[10:26:25] <altendky> Casper366: but, i'm pretty sure i got this working (or someone did...) for someone here a couple months ago.
[10:26:29] <Casper366> as i understood i need to use pyuic5 to turn the .ui to .py
[10:26:59] <altendky> Casper366: i don't at this point. https://github.com
[10:28:11] <altendky> Casper366: but there's some funny business when loading like that triggers another load (custom widgets inside custom widgets... or somesuch) and you can't have code completion in your ide. so, i'm tempted to switch to some form of automatic building of the .py files (via pyuic5, but not manual command line calls).
[10:28:39] <altendky> for normal cases and if you don't need the code completion, above has been working well for me.
[10:29:30] <Casper366> thanks for the link
[10:30:18] <Casper366> i tried it with eric6 which gave me an idea of how to structure it smartly, but in the end i switched back to a normal editor
[10:30:41] <altendky> Casper366: i probably should but i've never looked at eric. i work in pycharm and designer when needed
[10:32:01] <Casper366> my idea is to use designer and an editor. in order to make the .ui and its .py independet from the rest of the code i need to put the slots in a different file
[10:32:20] <Casper366> and for that i need to use QtCore.QMetaObject.connectSlotsByName(MainWindow)
[10:33:34] <altendky> Casper366: i do really like having my ui as an attribute so as to avoid name collisions
[10:38:38] <Casper366> Any idea why the connectSlotsByName doesn't work in my example?
[10:38:39] <Casper366> https://pastebin.com
[10:39:47] <Avaris> Casper366: can you use another paste? dpaste.de perhaps, can't open pastebin here
[10:39:50] <altendky> Casper366: which slots would you want connected?
[10:40:21] <altendky> MainWindow will only have the 'standard' slots since it's not a custom instance
[10:42:27] <altendky> Avaris: https://dpaste.de
[10:42:40] <Avaris> altendky: thanks :)
[10:44:04] <Avaris> on_okButton_clicked doesn't belong to MainWindow
[10:45:06] <altendky> and i'm not a fan of 'names of some magic form happen to align'. meh implicit/explicit and all.
[10:47:53] <Casper366> qtdesigner gives me this file without line 36/37. I'd like to put these two lines in another file and not touch the output of qtdesigner. that way I can change things in the future
[10:48:12] <Casper366> do you know what i mean?
[10:48:13] <altendky> Casper366: certainly yes, don't edit the generated file :]
[10:48:27] <altendky> Casper366: did you see what i did?
[10:48:39] <Casper366> no
[10:48:49] <Casper366> the github link?
[10:49:17] <altendky> Casper366: yeah. i think you should be able to do the same even if you import. well, not the loading part but the use of the class
[10:50:38] <Casper366> to be honest, i didn't really understand what you did there :/
[10:51:22] <altendky> Casper366: sure. https://github.com is a lot like you will probably end up with an `import myuifile.py`.
[10:51:53] <altendky> Casper366: https://github.com is like 45/46 https://dpaste.de
[10:52:06] <altendky> Casper366: but, you need somewhere to put on_okButton_clicked().
[10:52:15] <Avaris> Casper366: https://dpaste.de
[10:52:32] <altendky> Casper366: i'd make a new class inheriting from QMainWindow and add that method. then inside another method do `self.ui = ...` etc
[10:53:39] <altendky> so, what Avaris pasted, though i `self.ui`. Avaris: since the widgets are created on the Ui_MainWindow instance, don't you want to keep it around?
[10:54:02] <altendky> self.okButton won't work as it is. if you self.ui then you could self.ui.okButton. if i'm reading correctly
[10:54:08] <Casper366> ok. trying to process all this info...
[10:54:11] <Avaris> yeah, i started with multiple inheritance and switched later :)
[10:54:29] <Avaris> not everything survived completely intact
[10:54:41] <altendky> meh, we're ending up the same place
[10:54:42] <Avaris> certainly `self.ui = ...`
[10:55:41] <altendky> Casper366: so ignore my example, at least for now. Avaris' paste covers the first important step. custom class where you can put your method/'slot' and having `self.ui` to hold all the ui attributes
[10:56:08] <altendky> what's left in my example is loading the .ui directly, but that can come later, if you choose to do so at all
[10:56:57] <Avaris> (and after that not using designer at all :P )
[10:57:11] <altendky> basically, the generated .py is just a utility you use to shove all the gui stuff into your QMainWindow instance
[11:01:19] <altendky> Avaris: you hold that opinion universally? or just for small stuff? or anything big should really be composed of smaller pieces so everything ends up being small?
[11:01:25] <Casper366> i think i'll need a bit more time to understand this working example, but it gives me a thing to fumble about with.
[11:01:45] <Casper366> the example from Avaris works, but the slot is execuded twice
[11:03:11] <Casper366> you two are great. Thank you for your time and help. I'll have to be afk for a while. Thanks again!
[11:03:31] <altendky> Casper366: i'm trying to recreate your issue
[11:04:10] <altendky> ok, got it... not sure what i did first
[11:05:11] -!- AbleBacon has joined #pyqt
[11:06:17] <altendky> huh, adding the checked as a parameter on the slot breaks it with a missing argument complaint. i guess the auto-connect assumes you don't want that :|
[11:07:54] <altendky> yeah, i don't know what to make of that
[11:08:03] <altendky> (the double trigger)
[11:08:45] <altendky> acts normally for a manually connected slot
[11:11:34] <altendky> same back through 5.9
[11:12:04] -!- n1` has quit [Ping timeout: 272 seconds]
[11:12:55] <altendky> same with multiple inheritance style
[11:15:12] <altendky> heh, even with them in a layout
[11:15:16] <altendky> *the buttons
[11:15:41] <Avaris> it connects both versions of the signal
[11:15:59] <Avaris> add a @pyqtSlot() at the method
[11:16:48] <altendky> quite so
[11:17:01] <altendky> that seems not good
[11:17:39] <Avaris> well... c++ side has well defined slots
[11:17:55] <altendky> but, the docs do start with exactly this issue :| http://pyqt.sourceforge.net
[11:17:57] <Avaris> python makes it optional so, kinda, confusing
[11:19:00] <altendky> i have no clue about the inner workings, but it seems like 'both' is not what people would want 99.99.. hmm, 9999% of the time :]
[11:19:56] <altendky> anyways, `self.ui.ok_button.clicked.connect(self.ok_clicked)` is fine by me.
[11:19:59] <Avaris> both is a side effect of qt signals being able to connect to slots with fewer arguments
[11:20:49] <altendky> Casper366: ^^^
[11:23:39] <Avaris> tbh, i'd stay away from connectSlotsByName. mainly because it results in ugly method names (reminds me too much of VB6 :) )
[12:48:03] -!- mandeep has quit [Ping timeout: 246 seconds]
[12:59:18] -!- mandeep has joined #pyqt
[13:10:21] -!- nsizemor has joined #pyqt
[13:12:40] -!- nsizemor has quit [Remote host closed the connection]
[13:45:41] -!- renatosilva has joined #pyqt
[13:46:00] <renatosilva> hi, I have a question regarding sip private module since pyqt 5.11
[13:47:42] <renatosilva> anyone here?
[13:47:51] <renatosilva> according to the docs: "all the generated modules must be built against a compatible version of SIP. If you do not have complete control over the Python installation then this may be difficult"
[13:47:55] <altendky> renatosilva: sure. it's always best to ask your question.
[13:48:34] <renatosilva> this is not the case when you manage a package repository where you do have control of all packages, including pyqt and sip...
[13:49:03] <renatosilva> ...so that whenever you update sip you can update all module packages against it, including pyqt...
[13:49:41] <renatosilva> ...this means that private sip module does not make sense in a package repository context, anyone disagree?
[13:50:06] <altendky> renatosilva: makes sense at first read, sure.
[13:52:48] <renatosilva> ok, so I'm a contributor of a package repository where the maintainer did not apply a proper solution, he simply moved sip module to PyQt5.sip, breaking all other applications using sip...
[13:54:46] <renatosilva> ...I'm thinking about the following solution: revert sip build to previous behaviour (sip not PyQt5.sip), then when building pyqt, it will always be built against the latest sip, so no need for any private module, except...
[13:55:51] <renatosilva> ..except that pyqt5 wants it that way, so I'm thinking about simply copying sip module from sip package to PyQt5.sip when building pyqt, any objection?
[13:57:15] <renatosilva> I find this kind of solution a bit pointless (they're creating a separate python-sip-pyqt package): https://git.archlinux.org
[14:21:21] <altendky> renatosilva: sorry, i'm a bit busy at the moment and i probably don't have much useful feedback for you anyways. maybe Avaris, otherwise the maillist i guess is your next stop.
[14:28:47] -!- Dave_Elec has joined #pyqt
[14:30:19] <Avaris> renatosilva: can't you have sip and PyQt5-sip at the same time?
[14:38:14] <Avaris> renatosilva: this looks all logical, except "copy sip to PyQt5.sip". doesn't building PyQt5 already do that?
[14:43:27] -!- AbleBacon_ has joined #pyqt
[14:43:29] -!- AbleBacon has quit [Read error: Connection reset by peer]
[14:43:42] AbleBacon_ is now known as AbleBacon
[14:47:47] <Casper366> hey, i'm back. Thanks for your info, i just read up on it.
[14:48:39] <Casper366> is there a way to manually connect without editing the file that pyuic5 outputs?
[14:50:21] <Avaris> Casper366: connect a signal?
[14:50:53] <Casper366> beg your pardon. connect a signal to a slot
[14:51:24] <Avaris> ui.button_name.clicked.connect(slot)
[14:52:47] <Casper366> as i understand i'd have to put that in the class of the mainwindow (where the button is), no?
[14:53:02] <renatosilva> doesn't building PyQt5 already do that? -- no, in the package repository I'm a contributor of they did not apply the arch linux solution, they simply broke sip: they _moved_ sip to PyQt5.sip _in the sip package_
[14:53:28] <Avaris> anywhere you can access button and slot is fine, but yeah usually it goes to where the button is
[14:55:14] <Avaris> renatosilva: so... no `python configure.py --sip-module PyQt5.sip` while building pyqt?
[14:56:04] <renatosilva> doesn't building PyQt5 already do that? -- the arch linux solution is a mess in my opinion, they create a separate useless python-sip-pyqt5 package, I'm thinking about simply copying sip module from the installed sip package to the pyqt5 packaging
[14:57:18] <renatosilva> Avaris: they (msys2) applied that line onto the sip package, not the pyqt package, result is import sip => no module named sip
[14:59:57] <Avaris> ok, that's pointless
[15:01:54] <renatosilva> I see that sip is actually a buildtime dependency as well, right? so pyqt5 needs PyQt5.sip *pre-installed before building it*?
[15:02:44] <Avaris> no, you install sip and configure pyqt with what I wrote above, then it creates a private PyQt5.sip copy out of it
[15:02:57] <renatosilva> in that case, I'm thinking about creating that PyQt5.sip private module during *pyqt* build then adding it to the *pyqt* package...
[15:03:45] <renatosilva> ... however what's the proper way to do this? is simply "cp sip PyQt5.sip" or something like that just ok, or do I need something more complex like "python configure.py --sip-module PyQt5.sip"?
[15:04:38] <Avaris> if you're building PyQt5 yourself, you'll be doing `python configure.py` regardless. might as well attach sip there
[15:08:46] <renatosilva> no, you install sip and configure pyqt with what I wrote above -- ah I see now, so that line is basically the same as my cp idea and is supposed to be used in pyqt build not sip build
[15:09:04] <Avaris> right
[15:09:44] <renatosilva> arch linux is using it in sip package in a weird way: https://git.archlinux.org
[15:11:02] <renatosilva> msys2 is doing it simply in the wrong place: https://github.com
[15:11:04] <renatosilva> :-/
[15:11:14] <Avaris> renatosilva: http://pyqt.sourceforge.net
[15:11:22] <Avaris> you can do the same with sip
[15:14:46] <renatosilva> thanks for the link, the package I'm developing depends on pyqt4 not pyqt5, will pyqt4 keep using the global sip?
[15:15:57] <Avaris> last time i checked pyqt4, it was like that. unless something changed recently, yeah
[15:20:27] <Avaris> i think arch way is weird but ok. having a python-sip-pyqt5 separately and python-pyqt5 depending on it.
[15:22:45] <renatosilva> I think it's a useless package because no package other than pyqt5 will use it at all, since it's supposed to be a *private* thing of pyqt5
[15:23:37] <Avaris> yeah, but having pyqt5 install a global sip, then make a private copy of it will leave a dummy global sip module
[15:24:34] <Avaris> unless you install sip inside pyqt5 too, which is an option i guess
[15:24:46] <Casper366> Yay, i did it! :-)
[15:25:01] <renatosilva> they could use your line in the pyqt package and have PyQt5.sip as part of pyqt package directly, instead of doing that in sip package
[15:25:57] <Avaris> renatosilva: yes but if you do that for PyQt5, you *need* a global sip installed.
[15:26:10] <renatosilva> why?
[15:26:49] <Avaris> why? ?
[15:27:01] <renatosilva> yes, why?
[15:27:10] <renatosilva> and when:? when building? in runtime?
[15:27:30] <Avaris> you have two options: you install global sip and configure PyQt5 with --sip-module
[15:28:18] <Avaris> or you install sip to PyQt5.sip with --sip-module and leave that part out of PyQt5 configuration
[15:28:34] <Avaris> when building
[15:28:47] <renatosilva> so your line depends on a global sip module installed in order to build pyqt5 with private sip? no problem, that means that sip is now just a buildtime dependency, not runtime anymore
[15:29:35] <renatosilva> yeah I think the first option makes more sense, then making the global sip a buildtime-only dep
[15:36:18] <Avaris> renatosilva: wait... no. i'm tired
[15:36:31] <Avaris> you need to the second option :S
[15:36:36] <Avaris> *need to do
[15:38:31] <renatosilva> omg why
[15:39:02] <Avaris> because pyqt5 configure doesn't do that
[15:39:31] <Avaris> (i must be misremembering things)
[15:57:36] -!- n1` has joined #pyqt
[16:16:04] <renatosilva> ok, gtg now, thanks for the help!
[16:16:11] -!- renatosilva has quit [Quit: http://renatosilva.net]
[16:27:58] -!- n1` has quit [Ping timeout: 250 seconds]
[16:30:16] -!- n1` has joined #pyqt
[16:37:56] -!- Avaris has quit [Quit: http://avar.is]
[16:38:07] -!- Avaris has joined #pyqt
[16:51:32] -!- kallesbar has quit [Ping timeout: 272 seconds]
[16:57:57] -!- Siecje has parted #pyqt
[16:58:47] -!- BPL has quit [Quit: Leaving]
[17:06:43] -!- Dave_Elec has quit [Ping timeout: 245 seconds]
[17:10:35] -!- Avaris has quit [Quit: http://avar.is]
[17:11:08] -!- Avaris has joined #pyqt
[17:23:23] -!- n1` has quit [Ping timeout: 245 seconds]
[17:25:43] -!- n1` has joined #pyqt
[17:37:07] -!- Avaris has quit [Quit: http://avar.is]
[17:37:45] -!- Avaris has joined #pyqt
[17:51:56] -!- mintograde has joined #pyqt
[17:58:21] -!- Avaris has quit [Quit: http://avar.is]
[17:58:55] -!- Avaris has joined #pyqt
[18:03:57] -!- milkii has joined #pyqt
[18:08:25] <milkii> Hey folks. I'm wondering about PyQt apps and wayland - https://github.com - the 'app_id' window property needs an extra step to correct, is that something that could be set by default?
[18:11:35] <milkii> https://github.com
[18:14:03] <The-Compiler> milkii: that's something you'd need to ask Qt - but how would Qt know your app ID, especially if it's suggested to use the name of the .desktop file?
[18:14:16] -!- n1` has quit [Ping timeout: 255 seconds]
[18:15:59] -!- mandeep has quit [Ping timeout: 246 seconds]
[18:16:52] <milkii> The-Compiler: fair point
[18:17:43] <The-Compiler> milkii: hah, that just made it clear to me that qutebrowser sets it to "qutebrowser" despite its desktop file recently being renamed to org.qutebrowser.qutebrowser.desktop
[18:19:01] <milkii> heh
[18:33:47] -!- Casper366 has quit [Quit: Lost terminal]
[18:52:38] -!- AbleBacon has quit [Quit: Leaving]
[19:01:46] -!- n1` has joined #pyqt
[19:35:36] -!- n1` has quit [Ping timeout: 250 seconds]
[19:37:49] -!- mandeep has joined #pyqt
[22:08:10] -!- mintograde has quit [Ping timeout: 246 seconds]
[22:17:52] -!- thomasross_ has joined #pyqt
[22:17:52] -!- thomasross has quit [Killed (barjavel.freenode.net (Nickname regained by services))]
[22:17:52] thomasross_ is now known as thomasross
[23:20:27] -!- kallesbar_ has joined #pyqt