Active Topics

 



Notices


Reply
Thread Tools
robin92's Avatar
Posts: 476 | Thanked: 438 times | Joined on Nov 2010 @ Sweden
#1
Hi!
I have worked on an easy simpson sound app You find it in extras-devel.
Some bugs but this is my first pyqt I have only made some themes and icon pack before.

Hope you like it

btw I need some help with the sound so it work with hardware buttons. Now I onlye write set volume 0.3 in pyqt :/ You cant change the volume ;(
 

The Following 5 Users Say Thank You to robin92 For This Useful Post:
Posts: 1,086 | Thanked: 2,964 times | Joined on Jan 2010
#2
Ah so that's what you're working on I just noticed your pm, but let's try and answer it here so we can get everyone's input.

Well it should be quite simple to fix this as you've been following the maeFart tutorial. To help pinpoint the problem could you do us a favor, and run your Simpsons sound app from XTerm? If you're not sure how, open XTerm and navigate to the correct folder then type in:

Code:
python your_simpsons_main_filename.py
This should run your app. When it runs, any errors and output will appear on the XTerm window so please check the XTerm output for the following message:

Code:
"WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface."
Is it there? If so, it's a simple fix and by setting the application name within your app you'll find that pressing the hardware volume rocker switch will change the loudness of Homer's 'D'Oh!'s and Bart's "Eat my shorts" up and down automagically

So try adding that in your main.py file so it looks like below, and let me know if it works:

Code:
if __name__ == "__main__":
    app = QApplication(sys.argv)
    QApplication.setApplicationName("Simpsons Sounds")

... rest of the file... etc
__________________
Follow me on my neglected twitter @kojacker

Cybot950 - Control a robot with your N9/N950
SMSPetFeeder - Build a Bluetooth/SMS dog feeder with Qt, N950, and arduino
Nerf950 - Use your N9/N950 to fire a Nerf gun
 
robin92's Avatar
Posts: 476 | Thanked: 438 times | Joined on Nov 2010 @ Sweden
#3
Hi!
I get this after your command, It stand

Code:
Traceback (most recent call last):
  File "main.py", line 40, in <module>
    QApplication.setApplicationName("Simpsons sounds")
NameError: name 'QApplication' is not defined
And before I get
Code:
"WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface."
btw how i fix porttrait?

Last edited by robin92; 2011-06-13 at 03:31.
 
Posts: 1,086 | Thanked: 2,964 times | Joined on Jan 2010
#4
Originally Posted by robin92 View Post
Hi!
I get this after your command, It stand

Code:
Traceback (most recent call last):
  File "main.py", line 40, in <module>
    QApplication.setApplicationName("Simpsons sounds")
NameError: name 'QApplication' is not defined
And before I get
Code:
"WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface."
btw how i fix porttrait?
Try adding this import to the top of the same (main py) file
Code:
from PyQt4.QtGui import QApplication
I think that's right (trying to recall from the top of my head, it's been months - someone pls correct if wrong..).

When you say how to fix portrait, what do you mean exactly? You want your app to always be fixed in portrait mode, or you want to be able to switch between portrait and landscape? The first is slightly easier as you can design your UI form in Qt Creator to be vertically designed and then fix the orientation of the application so the UI is always displayed in portrait. The other way, being able to move between the two depending on how the phone is held, will probably require some extra work with layouts etc.
__________________
Follow me on my neglected twitter @kojacker

Cybot950 - Control a robot with your N9/N950
SMSPetFeeder - Build a Bluetooth/SMS dog feeder with Qt, N950, and arduino
Nerf950 - Use your N9/N950 to fire a Nerf gun
 
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#5
I downloaded the source code and I'm having a play with it atm. I noticed a few typos in the farts dictionary. I'll post some changes here later.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 

The Following 2 Users Say Thank You to marxian For This Useful Post:
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#6
OK. I made a few changes to the source code:

1. Changed the .wav file paths to relative paths, e.g sounds/example.wav.
2. Corrected some typos in the 'sounds' dictionary (renamed from 'farts').
3. Removed status bar (not needed).
4. Added a Homer Simpson icon to the push button.
5. Implemented auto-rotation.
6. Set application name to 'Simpson Sounds'. Volume can now be changed using the hardware volume controls.





I have attached the modified source code and icon.
Attached Files
File Type: gz Simpsons.tar.gz (50.9 KB, 107 views)
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub

Last edited by marxian; 2011-06-13 at 19:12.
 

The Following 2 Users Say Thank You to marxian For This Useful Post:
robin92's Avatar
Posts: 476 | Thanked: 438 times | Joined on Nov 2010 @ Sweden
#7
Originally Posted by marxian View Post
OK. I made a few changes to the source code:

1. Changed the .wav file paths to relative paths, e.g sounds/example.wav.
2. Corrected some typos in the 'sounds' dictionary (renamed from 'farts').
3. Removed status bar (not needed).
4. Added a Homer Simpson icon to the push button.
5. Implemented auto-rotation.
6. Set application name to 'Simpson Sounds'. Volume can now be changed using the hardware volume controls.





I have attached the modified source code and icon.
Thanks you are best Can you learn my little about pyqt or you have some good guide?
You can contact me at R.lundgren92@gmail.com
Cheer
 
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#8
I learned PyQt from this book: http://www.qtrac.eu/pyqtbook.html

However, I would probably recommend learning QML for coding user interfaces, at least for mobile platforms. You can still use PyQt for the backend stuff, although for something like Simpson Sounds, it would be just as easy to do everything in QtQuick using JavaScript. I can port your Simpsons Sounds using QtQuick, and post the code here, so you can observe the differences.
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 
robin92's Avatar
Posts: 476 | Thanked: 438 times | Joined on Nov 2010 @ Sweden
#9
Originally Posted by marxian View Post
I learned PyQt from this book: http://www.qtrac.eu/pyqtbook.html

However, I would probably recommend learning QML for coding user interfaces, at least for mobile platforms. You can still use PyQt for the backend stuff, although for something like Simpson Sounds, it would be just as easy to do everything in QtQuick using JavaScript. I can port your Simpsons Sounds using QtQuick, and post the code here, so you can observe the differences.
yea it should be nice

Update!
version 0.1-4 in extras-devel

Last edited by robin92; 2011-06-13 at 22:09.
 

The Following User Says Thank You to robin92 For This Useful Post:
Kevstacey's Avatar
Posts: 400 | Thanked: 76 times | Joined on Nov 2009 @ uk
#10
Originally Posted by marxian View Post
OK. I made a few changes to the source code:

1. Changed the .wav file paths to relative paths, e.g sounds/example.wav.
2. Corrected some typos in the 'sounds' dictionary (renamed from 'farts').
3. Removed status bar (not needed).
4. Added a Homer Simpson icon to the push button.
5. Implemented auto-rotation.
6. Set application name to 'Simpson Sounds'. Volume can now be changed using the hardware volume controls.





I have attached the modified source code and icon.
is this now in extras? cheers
 
Reply


 
Forum Jump


All times are GMT. The time now is 12:08.