Active Topics

 


Reply
Thread Tools
Posts: 16 | Thanked: 8 times | Joined on Jun 2010 @ England
#1
Hi guys, I've owned a Nokia N900 for a few months now and I'd like to develop python applications for it, either for private use or public.

I used the sticky here to get started and I understand the basics of bringing Qt Designer and Python together. I managed to successfully run the hello world application on my phone!

I recently took an application I made in PyGTK+ and re-made it with PyQt (Designer and Eric4). The application itself runs perfectly and does exactly what it should, however it does not display very nicely at all.

It looks how I want it to look in Windows (when previewing): Link

However on my N900 it doesn't look so nice: Link

The Clear and Submit buttons become small and unreadable, the Server IP, Port and RCON Password lines become too short (in height) to tell what was typed in.

The Output text box is also cramped in and should scroll when overfilled, which it does not.

Could anyone with more experience in PyQT development give me a bit more insight into this?

I'll provide the UI file (zipped) if that helps somewhat.

Thanks for reading!
Attached Files
File Type: zip srcrcon_UI.zip (1.4 KB, 119 views)

Last edited by TajB; 2010-06-20 at 17:49. Reason: Problem Solved!
 
Posts: 13 | Thanked: 20 times | Joined on Jun 2010
#2
I used .setMinimumSize(QtCore.QSize(0, 40)) on the objects to fix this in one of my apps. I don't know if this is the 'right way', but it works.

You might also be running into a problem where there's just not enough room on one screen to display all the information you're trying. You might want to try using a QScrollArea. To make it work right in Qt Designer is to set the height of the scrollAreaWidgetContents to hold all of your widgets.
 

The Following User Says Thank You to timconradinc For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#3
My suggestion is to load the UI into QTDesigner, resize your main window in QT Designer to 800x480 ish, and make it fit in there.

I suggest moving some things to separate dialog windows like settings. For example the two password boxes, make a menu item for "Password Settings" that popups a QDialog and put those items into the QDialog.

Stuff like that.
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following User Says Thank You to fatalsaint For This Useful Post:
Posts: 16 | Thanked: 8 times | Joined on Jun 2010 @ England
#4
Ok setting the minimum height to 40 appears to have helped some of the issues.

I've managed to create the menu item for password editing (i've created a whole new project for this) and placed the check boxes in a new dialog UI.

I can make the menu do something when the items are pressed but I'm having issues with getting the new Dialog to show. It shows up for a split second then disappears.

What's the right way to display a dialog window from the main window?
 
w00t's Avatar
Posts: 1,055 | Thanked: 4,107 times | Joined on Oct 2009 @ Norway
#5
Create a QDialog (either by subclassing or just instantiate one and shove widgets onto it) and display using show() or exec() methods.

Re: your original problem.. there is only so much screen room, and your UI really needs more than that.

You could put everything inside a QScrollArea, or, as others have suggested - try move some of it off to menus or other dialogs.

Hope this helps!
__________________
i'm a Qt expert and former Jolla sailor (forever sailing, in spirit).
if you like, read more about me.
if you find me entertaining, or useful, thank me. if you don't, then tell me why.
 

The Following User Says Thank You to w00t For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#6
Take a look at my example I did in another thread here.

As well the corresponding blog link I have in my post explains it all in comments.
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following User Says Thank You to fatalsaint For This Useful Post:
Posts: 16 | Thanked: 8 times | Joined on Jun 2010 @ England
#7
Thanks guys! I wouldn't have gotten it working if it weren't for that example!

With a few bits of tweaking here and there I managed to get the dialog boxes to work! The output also auto scrolls on its own now, so no issues with things not fitting.

There are a couple more questions I would like to ask:

I use a QTextEdit for the output, how would I force the cursor to the bottom of that widget? I'm having some issues with scrolling and accidentally placing the cursor somewhere I shouldn't be.

I want to create an application shortcut ( .desktop ) but so far my attempts have been fruitless!

I used this code:
Code:
[Desktop Entry]
Version=1.0.0
Encoding=UTF-8
Name=Source RCON
Comment=Python Application which sends queries to Source Servers
Exec=/opt/srcrcon/srcrcon.py
Type=Application
X-Osso-Type=application/x-executable
But it doesn't successfully run the application. It starts to load it but never finishes. What I copied

So any insight into how I can fix that? (Ok more than a couple )

Thank you again for all your help!
 
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#8
run that command from xterm and note output:

Code:
/opt/srcrcon/srcrcon.py
Do it from a different directory than the python file is in (to debug any file reading calls in the app point to the right place) and make sure srcrcon.py is +x (executable). If it's not executable you can set it that way, or you can prefix your app with "python /opt/srcrcon/srcrcon.py".

On the exec line:
Code:
Exec=/usr/bin/python /opt/srcrcon/srcrcon.py
For the Cursor issue:

Code:
te=QTextEdit()
te.setText("testing \n \
1 \n \
2 \n \
3 \n \
3 \n \
2 \n \
1 \n \
asdljhgjhalksjdh")
te.moveCursor(QTextCursor.End)
Seems to work for me..
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!

Last edited by fatalsaint; 2010-06-20 at 04:20.
 

The Following User Says Thank You to fatalsaint For This Useful Post:
Posts: 16 | Thanked: 8 times | Joined on Jun 2010 @ England
#9
Perfect! Thanks again!

Xterm said no file or directory found, but the other method works just fine and now it all works as it should!
 
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#10
Originally Posted by TajB View Post
Perfect! Thanks again!

Xterm said no file or directory found, but the other method works just fine and now it all works as it should!
That means the file isn't executable.

Code:
chmod +x /opt/srcrcon/srcrcon.py
Would have fixed it as well. Either way works fine though, so no need to fix anything again now that it's working for you .
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:18.