#pyqt | Logs for 2018-10-08

Back
[02:31:05] -!- anqxyr has joined #pyqt
[03:15:30] -!- anqxyr has quit [Ping timeout: 264 seconds]
[06:02:02] -!- kallesbar has joined #pyqt
[06:05:51] <_val_> Writing QT apps that run on Centos machines. Would I better go for pyqt5 or 4?
[06:18:42] -!- mintograde has joined #pyqt
[06:57:11] -!- mintograde has quit [Ping timeout: 260 seconds]
[07:54:01] -!- frispete_ has joined #pyqt
[07:57:18] -!- frispete has quit [Ping timeout: 252 seconds]
[08:51:51] <altendky> _val_: I don't know centos but I'd say py3 and pyqt5 regardless. Py2 is all but dead and qt4 has been for awhile.
[08:52:42] <altendky> _val_: are you making RPMs? Or just python programs to be installed into virtualenvs or venvs
[09:12:08] <_val_> altendky: I am going to make an rpm eventually
[09:12:57] <_val_> altendky: I am using pyqt5 on fedora but since fedora is far ahead centos when it comes to newest and latest packages/libs, I thought pyqt4 might be suited for centos7
[09:14:23] <altendky> _val_: but are you developing an rpm? If not, or maybe even if you are, just include pyqt5 from the wheels
[09:14:58] <altendky> _val_: do you really want to be starting development with multiple dead libraries?
[09:14:59] <_val_> altendky: I actually want to run the app on centos
[09:15:10] <altendky> _val_: that hasn't been my question
[09:15:28] <altendky> _val_: how do you plan to distribute the app?
[09:16:39] <_val_> altendky: Using rpm :)
[09:16:48] <_val_> But this will have to run on centos7
[09:18:09] <altendky> _val_: yes, I've heard that...
[09:18:37] <altendky> _val_: does centos7 have python3 pyqt5 packages?
[09:19:00] <_val_> altendky: no. That's why I said , Centos7 is quite conservative
[09:19:08] <altendky> If not, maybe just package pyqt5 yourself inside your rpm
[09:19:10] <_val_> It uses python 2.7 out of the box
[09:19:19] <altendky> _val_: that doesn't matter?
[09:20:08] <altendky> _val_: are you seriously considering starting a new application in three layers of dead support code? (Py2, pyqt4, qt4)
[09:20:38] <altendky> _val_: there's conservative, then there's massively outdated
[09:20:58] <_val_> altendky: well I think I'll add requirements for pyqt5 :)
[09:21:08] <_val_> That is a good idea. Thanks!
[09:24:29] <altendky> _val_: does centos provide a python3 package?
[09:25:47] <_val_> altendky: yes. python36 is in epel release
[09:27:19] <altendky> _val_: maybe you want to contact the pyqt4 package maintainers about providing a pyqt5 package
[09:30:10] <altendky> _val_: regardless start by making your project so anyone can install it in a virtualenv or venv on any os
[09:41:50] <_val_> altendky: this is a very specific app
[09:42:32] <altendky> _val_: I stand by my suggestion.
[09:42:35] <_val_> It should run on a machine which will restore backups.. so it is not going to widely used
[09:43:08] <altendky> _val_: tools meant to build an rpm from a python package will likely expect what I suggested anyways
[09:48:57] <_val_> altendky: thanks for the suggestions. I'll exploroe some options
[09:51:01] <altendky> It's also useful during development when you presumably don't want to rebuild and reinstall the rpm for every typo fix you make
[10:25:03] <altendky> _val_: since this came up over in #python, https://docs.python.org
[10:25:31] <altendky> note how it is a setup.py command, so, you first make a proper python project, then you create an rpm from it
[10:52:31] <_val_> altendky: thanks for the effort! Appreciate it!
[12:02:18] -!- frispete_ has quit [Ping timeout: 264 seconds]
[12:38:20] -!- kgj6k has joined #pyqt
[12:41:55] <kgj6k> Is there a minimal best practice example for executing something asynchronously (so that the GUI does not freeze)? I implemented a QThread, but that still makes the GUI freeze: https://pastebin.com
[12:48:12] <kgj6k> My code is adapted from this post: https://nikolak.com
[13:08:12] <altendky> kgj6k: it depends what you are doing
[13:08:30] <altendky> kgj6k: I use twisted and qt5reactor
[13:13:21] <altendky> kgj6k: I'm also not a fan of inheriting from qthread. It's usually done out of laziness not understanding.
[13:24:29] <kgj6k> altendky: never said I did it because of understanding :p just because this post I saw used it and it looked worth a try
[13:30:09] <altendky> kgj6k: so what made you consider threads?
[13:30:51] <kgj6k> altendky: looking for ways to asynchronously execute something slow, and quite a few examples were with QThread
[13:31:27] <altendky> kgj6k: 'slow'?
[13:31:49] <kgj6k> altendky: load and render web page to pdf, >2 s
[13:32:37] <kgj6k> 'slow' -> execute function that takes a significant time
[13:32:42] <altendky> kgj6k: how much time just for the render?
[13:32:50] <altendky> kgj6k: it matters why it takes time
[13:36:23] <altendky> kgj6k: and what are you using for the load and render?
[13:39:45] <kgj6k> not sure to be honest. I use an external command that is called with subprocess.run (wkhtmltoimage). My first try was using a normal python thread - that led to the UI not freezing, but sometimes crashing :x
[13:40:07] <altendky> kgj6k: to async a subprocess in pyqt use qprocess
[13:40:24] <altendky> kgj6k: but, pyqt has the web engine stuff so you could do it internally
[13:41:09] <altendky> kgj6k: of all the options i had in my head, qprocess hadn't even popped up because i didn't assume you had a subprocess. the solution really does depend on the task
[13:42:12] <kgj6k> thanks!
[13:42:32] <altendky> kgj6k: in pure python, you can subprocess.Popen() instead and then .poll() the result occasionally if you wanted.
[13:42:41] <altendky> but qprocess really is slick
[13:43:19] <altendky> kgj6k: also, did you find the quit() slot on the qapplication instance the other day?
[13:43:27] <altendky> kgj6k: you logged out before i got to respond
[13:44:39] <kgj6k> altendky: Actually, .quit() also did not work - but the problem was that I tried to quit()/close() my main window before ever calling app.exec_(). After I changed the supposed workflow a little, it now works as expected
[13:45:04] <altendky> kgj6k: yes, you kinda have to exec otherwise you won't have an event loop
[13:45:05] -!- kallesbar has quit [Remote host closed the connection]
[13:45:27] -!- kallesbar has joined #pyqt
[13:45:41] <altendky> kgj6k: it'd be similar to the situation that inheriting qthread usually creates. you can run your code and emit signals, but they are never received.
[13:50:15] <kgj6k> altendky: Nice. QProcess indeed does the trick quite well
[14:21:02] -!- frispete_ has joined #pyqt
[14:28:48] -!- frispete_ has quit [Ping timeout: 252 seconds]
[14:48:37] -!- frispete_ has joined #pyqt
[14:58:13] -!- kgj6k has quit [Ping timeout: 256 seconds]
[14:58:26] -!- kgj6k has joined #pyqt
[14:59:30] <kgj6k> altendky: What would be your recommended alternative to QProcess for executing a command like this (2nd code box): https://medium.com ?
[15:00:21] <altendky> kgj6k: you are switching to selenium? what does your program do, big picture?
[15:02:18] <kgj6k> altendky: Thinking about it. You can enter a URL, it renders the URL to an image file and displays that image. Afterwards you can select an area of interest in that image. With that, the idea is that you can create a cronjob that checks for changes in that specific area of the page. Similar to http://visualping.io
[15:02:58] <altendky> kgj6k: maybe look into the qt web stuff if you are working in qt.
[15:03:33] <kgj6k> altendky: I'm thinking about switching to selenium as I might try to integrate part of my application into another project, and using a dedicated python interface might be cleaner than calling some binary that needs to be installed
[15:07:59] <altendky> kgj6k: why you using an image rather than page content?
[15:08:09] <altendky> just for user selection ease?
[15:09:14] <kgj6k> altendky: To offer an alternative to html parsing (e.g. if the area you want is not in a unique element)
[15:10:19] <altendky> kgj6k: so you either find an async thing (like the qt web stuff) or you take a sync thing and make it async (thread + interfacing, qprocess, etc)
[15:10:26] <altendky> kgj6k: i'd take a look at the qt stuff
[15:12:16] <kgj6k> altendky: Will do. I was just assuming that a dedicated browser engine might be necessary to render quite a lot of websites correctly, but I will try the QWebView
[15:14:11] <altendky> kgj6k: i though qwebengine was the recent one
[15:14:29] <altendky> kgj6k: qutebrowser is a full browser as far as i know and is based on the qt web stuff
[15:25:15] -!- frispete has joined #pyqt
[15:27:06] -!- frispete_ has quit [Ping timeout: 252 seconds]
[15:41:06] -!- frispete_ has joined #pyqt
[15:41:22] -!- frispete has quit [Ping timeout: 252 seconds]
[17:13:14] -!- kgj6k has quit [Quit: Page closed]
[17:20:58] -!- mintograde has joined #pyqt
[18:32:56] -!- kushal has quit [Remote host closed the connection]
[18:33:54] -!- kushal has joined #pyqt
[22:32:34] -!- mintograde has quit [Read error: Connection reset by peer]