evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
10.91k stars 509 forks source link

resizing of QT popup window do not resize text in it #48

Closed MarkoShiva closed 7 years ago

MarkoShiva commented 7 years ago

resizing of QT pop-up window with the exec command of the process do not work. So the pop resize but not the content in it and usually whole area is covered with the name of the process and its arguments got from the exec line and that in case of chromium or Java based applications or IDE's like eclipse or pycharm will not allow you to see the IP where is trying to connect nor the port to which is trying to connect. I dunno that might be just QT issue or missing some library, but at least on my i3wm resizing of the window with the prompt do not resize text in it. So that is one nasty issue that I would like to see whether is confirmed on different DE's or wm's and it should be fixed so that we can always see the IP its trying to connect to and port. I'm attaching a picture of for example chromium run without TOR it makes a lot of connections but I can't see any of the IP's because window space is taken by the process name and passed arguments. 2017-05-09-141929_602x391_scrot

adisbladis commented 7 years ago

On most DEs/WMs you wouldn-t be able to resize the window (seemingly by design). I have hit this bug too, it just haven't really reached my list of priorities yet.

evilsocket commented 7 years ago

Ideally the whole dialog should resize in order to properly show the text ... problem is, I have no idea how to do it, my GUI-fu is weak :)

MarkoShiva commented 7 years ago

mine is not that good either but I think it would involve some tweaking of pyqt options for a qt windows that popup.

evilsocket commented 7 years ago

absolutely no idea, this is the very first time I see/use Qt in my life

melizeche commented 7 years ago

I'm playing right now with this, I think the actual layout is not the best for multiples resolutions, If I got it right I'm going to submit a PR

MarkoShiva commented 7 years ago

I'm gonna try to solve this too It was long time since I messed with QT but I do think that the problem is that in the ui.py we don't have setup resizable layout like gridlayout to be the basic layout which then should resize like in the normal qt apps. I'm just relearning QT syntax and I never played with the PyQt so I'm saying this as a suggestion to some of you who might implement it faster.

MarkoShiva commented 7 years ago

what ware you using to generate a code for the ui.py? pyuic5 resources/dialog.ui > ui.py or something else because I got the design right but the code end up messed up. If anyone of you do know pythonqt library you should only add gridlayout as the basic layout in window can be easily done in the qtcreator and after that the dialog should act as we want. I'm just really rusty now in Qt and never done a python3-qt project. But that should be way to go because I was back in the days making some Qt/Cpp apps.

melizeche commented 7 years ago

Just submmited a PR (#60), I think it can be a partial solution to this until we figure it out how to do proper scaling in PyQt

@in1t3r I'm not using pyuic 'cause the .ui file it's loaded with PyQt5.uic.loadUiType

adisbladis commented 7 years ago

@melizeche Cool! I noticed another problem (except for the UI being huge). If you resize the window too small things start being outside of the window. This is already a great improvement though!

opensnitch-resize-bug

Slightly tangential but related: If anyone tries to take a stab at improving the UI I would like to see QML evaluated as an option for us. This has some interesting properties like being able to run with the same UI code on platforms such as Sailfish OS and Plasma Mobile, just a modified QML file, this may also (I don't know yet) largely solve the scaling issues.

adisbladis commented 7 years ago

I just now also noticed another issue in an application with a huge command line.. There is still some problems seeing the whole thing..

MarkoShiva commented 7 years ago

I send a pull request that solve this issue completely you can resize it from as small to as big as you want and the text will follow and wrap. :)

evilsocket commented 7 years ago

@in1t3r any way to auto resize everything according to the text's length without having the user to do it manually? This huge dialog, when text is short, is very ugly imo

MarkoShiva commented 7 years ago

It does resize and its not big by default by default its only as much as you set it at first 490x220 and i set it as not prefered size but expandable and set the grid layout.

So I'm not sure on what do you mean with resizing like huge dialog?

Its better then previous solution which was just making window big and not really resized a text part.

I can try to work on adding a text field inside of the gridlayout on qdialog and if I work it out properly then it should resize. Dunno can I make auto resize. Anyway if you try to resize to a very small text will wrap and show everything including IP and port and full command until you make it too small. So I think it fixes the issue of too much arguments passed like with eclipse pycharm anything based on Java or chromium with a lot of parameters.

I'll try to work better version of qdialog if you explain to me what would you actually want to do?

evilsocket commented 7 years ago

If the text is not long, there's a huge empty space above the buttons, I'd love to have that space remove (thus the dialog height resized) accordingly.

MarkoShiva commented 7 years ago

Not a problem I'm actually working on changing few more things in design of that widget will submit once I make it sure it works on my system as it should. Probably in less then an hour.

evilsocket commented 7 years ago

no rush, take your time, and thanks! <3 :)

evilsocket commented 7 years ago

PS: @in1t3r I just sent u an email.

MarkoShiva commented 7 years ago

2017-05-11-174417_526x147_scrot Does this looks better? I still kept your defaults just make it smaller. i can make it wider and really small in height by default. If this looks better/

evilsocket commented 7 years ago

A little bigger, the minimum amount needed to correctly display the icon

melizeche commented 7 years ago

Much better now! Thanks @in1t3r