Active Topics

 



Notices


Reply
Thread Tools
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#631
In case of Qt and Python vs C++, the code is translatable almost line by line, especially if the C++ original uses Qt constructs like foreach() for looping. There are a few caveats regarding variable scope and garbage collection, but in general it should not be an issue. Python to C++ is a bit more nasty (as C++ simply lacks a lot of the built-in goodies Python has, even with Qt - f.e. list comprehension).
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 

The Following 2 Users Say Thank You to attila77 For This Useful Post:
Posts: 16 | Thanked: 6 times | Joined on Mar 2010 @ Germany
#632
application crash after starting...
When I start the programm from the xterm, I have this messages:
Nokia-N900:~# python /opt/healthcheck/healthcheck.py
***** Start Imports *****
** Importing qtcore & gui **
** Importing ui.touchstub - accuracy tool **
** Importing sys **
** Importing commands **
** Importing os **
** Importing os.path **
** Importing subprocess **
** Importing dbus.glib **
** Importing Start location**
** Importing Cellinfo **
** Importing Hildon **
** Importing Functions **
** Importing Time **
** Importing GTK **
** Initialize Threads(GTK) **
** Importing Gobject **
***** Finish Imports *****
** Seting global variables **
** Starting Main **
** app = QtGui App** - Running app = QtGui.QApplication(sys.argv) **
/opt/healthcheck/healthcheck.py:1053: GtkWarning: gtk_widget_set_sensitive: assertion `GTK_IS_WIDGET (widget)' failed
app = QtGui.QApplication(sys.argv)
** Setting Main Window**
** Setting tool window #1**
** Starting healthcheckWindow Class **
** Set basic color on rectangle **
** Setting window details and loading form**
** Completed healthcheckWindow Class load **
** Setting tool window #2**
** Setting Video window**
** Set basic color on rectangle **
** Setting window details and loading form**
** Declare the UI**
** Draw everything and start the main function**
** start SetupUi**
Could not parse stylesheet of widget 0x6ff8b8
** Run retranslateUi **
** Show tab1 (0) **
** Show everything**
** Waiting for quit signal - healthcheck loaded **
** Running Update ALL**
** Running tab1 update **
** Start Function - rootfs % used **
** Start Function - rootfs free MB **
** Start Function - MyDocs % Used **
** Start Function - myDocs MB Free **
** Start Function - App Used **
** Start Function - App Free **
** Start Function - Memory Card Used **
** Start Function - Memory Card Free **
** Start Function - CPU Frequency **
** Start Function - Backlight Info **
** Start Function - Backlight Info MAX **
** Start Function - Kernel Core Info **
** Start Function - MMC Cover/latch **
** Start Function - CPU Frequency File **
** Adding CPUQ Frequencies **
** Start Function - Processor Information **
** Start Function - N900 Board Information **
** Start Function - Board Version **
** Start Function - System Locale **
** Start Function - boot count**
** Start Function - FM Transmitter power level **
** Start Function - Boot Reason**
** Start Function - Cam Shutter State **
** Start Function - Keyboard Slider State **
** Start Function - proximity sensor state**
** Start Function - Headphone State **
** Start Function - Battery Current **
** Start Function - battery last charge**
** Start Function - Battery Charge **
** Start Function - system uptime**
** Start Function - load from uptime **
** Start Function - firmware version **
Traceback (most recent call last):
File "/opt/healthcheck/healthcheck.py", line 1076, in <module>
ui.funcUpdateAll()
File "/opt/healthcheck/healthcheck.py", line 890, in funcUpdateAll
self.funcSystemTab()
File "/opt/healthcheck/healthcheck.py", line 848, in funcSystemTab
g = gn_functions.funcMaemoVersion()
File "/opt/healthcheck/gn_functions.py", line 196, in funcMaemoVersion
g = s[2].strip()
IndexError: list index out of range

What is wrong?
 

The Following User Says Thank You to bonsai009 For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#633
Oooooooooooooooo That's interesting!

Originally Posted by bonsai009 View Post
application crash after starting...

g = gn_functions.funcMaemoVersion()
File "/opt/healthcheck/gn_functions.py", line 196, in funcMaemoVersion
g = s[2].strip()
IndexError: list index out of range

What is wrong?
Can you confirm what version of healthcheck please?
It seems to be struggling whilst looking at this command
Code:
dpkg -l mp-fremantle-* | grep ii
If you fancy trying that in terminal, it will be interesting to see how your version string looks.
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -

Last edited by noobmonkey; 2010-06-12 at 08:38.
 
Posts: 16 | Thanked: 6 times | Joined on Mar 2010 @ Germany
#634
Nokia-N900:~# dpkg -l mp-fremantle-* | grep ii
Nokia-N900:~#

soryy, i see nothing.
 
Posts: 16 | Thanked: 6 times | Joined on Mar 2010 @ Germany
#635
Nokia-N900:~# dpkg -l mp-fremantle-*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=============================-=============================-================================================== ========================
pn mp-fremantle-generic-pr <none> (no description available)

sorry for bad english, I´m a german-people
 
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#636
Originally Posted by noobmonkey View Post
Any examples will help - i'm getting used to translating examples from GTK and c++!
Okay, I'm sold!
I don't guarantee syntax rightness, though, because I'm typing it rigt in here, not into my IDE.

I also only write my idea, I guess the "..."s will make sense.

MainWindow.h
Code:
...

//include whatever...

class MainWindow
{
    ...
private:
    QTimer *timer;
    ...    
public:
    MainWindow(...); // constructor
    void updateAll(); // method that updates all
    ...
private slots:
    void on_timer_timeout(); // the method
    ...
}
UpdaterRunnable.h
Code:
#include "MainWindow.h"

class UpdaterRunnable : private QRunnable
{
private:
    MainWindow *myWindow;
public:
    UpdaterRunnable(MainWindow *window);
    void run();
}
MainWindow.cpp
Code:
#include "MainWindow.h"
#include "UpdaterRunnable.h"

MainWindow::MainWindow(...)
{
    // creating a new timer instance on the heap
    timer = new QTimer(this);
    // connecting to its signal
    connect(timer, SIGNAL(timeout()), this, SLOT(on_timer_timeout()));
    // running the timeout method - to fill up values on the beginning
    on_timer_timeout();
    // starting the timer with a nice interval
    timer->start(3000);
    
    ...
}

void MainWindow::updateAll()
{
    // This is the method in which you update all your labels
}

void MainWindow::on_timer_timeout()
{
    // makes the thread pool start updating asynchronously
    // note that the QRunnable instance will be deleted by the thread pool, so this is not a memory leak
    QThreadPool::globalInstance()->start(new UpdaterRunnable(this));
}
UpdaterRunnable.cpp
Code:
#include "UpdaterRunnable.h"

UpdaterRunnable::UpdaterRunnable(MainWindow *window)
    : QRunnable(), myWindow(window)
{
}

void UpdaterRunnable::run()
{
    myWindow->updateAll();
}
Rougly this is what I was speaking about - I really hope it helps.

I also recommend setting the default caption of all labels to "Updating...", and start updating them asynchonously. It just adds a feeling of responsiveness to the UI. (This is why there is a call to the timeout method in the constructor of my example.)

Last edited by Venemo; 2010-06-12 at 08:52.
 

The Following 2 Users Say Thank You to Venemo For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#637
Originally Posted by bonsai009 View Post
Nokia-N900:~# dpkg -l mp-fremantle-*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=============================-=============================-================================================== ========================
pn mp-fremantle-generic-pr <none> (no description available)

sorry for bad english, I´m a german-people
thank you very much! don't worry, i can understand you.

it is very odd though. it looks like you do not have maemo installed! never expected no value being returned! anyone else got any suggestions?
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#638
Originally Posted by noobmonkey View Post
it is very odd though. it looks like you do not have maemo installed! never expected no value being returned! anyone else got any suggestions?
If you break some dependencies, the first thing apt-get is going to do is uninstalling the "mp-fremantle-*" package.

Eg. install some apps from the debian repos or the SDK repo, and there you go with it.
 

The Following User Says Thank You to Venemo For This Useful Post:
mikec's Avatar
Posts: 1,366 | Thanked: 1,185 times | Joined on Jan 2006
#639
Originally Posted by Venemo View Post
Okay, I'm sold!
I don't guarantee syntax rightness, though, because I'm typing it rigt in here, not into my IDE.

I also only write my idea, I guess the "..."s will make sense.

MainWindow.h
Code:
...

//include whatever...

class MainWindow
{
    ...
private:
    QTimer *timer;
    ...    
public:
    MainWindow(...); // constructor
    void updateAll(); // method that updates all
    ...
private slots:
    void on_timer_timeout(); // the method
    ...
}
UpdaterRunnable.h
Code:
#include "MainWindow.h"

class UpdaterRunnable : private QRunnable
{
private:
    MainWindow *myWindow;
public:
    UpdaterRunnable(MainWindow *window);
    void run();
}
MainWindow.cpp
Code:
#include "MainWindow.h"
#include "UpdaterRunnable.h"

MainWindow::MainWindow(...)
{
    // creating a new timer instance on the heap
    timer = new QTimer(this);
    // connecting to its signal
    connect(timer, SIGNAL(timeout()), this, SLOT(on_timer_timeout()));
    // running the timeout method - to fill up values on the beginning
    on_timer_timeout();
    // starting the timer with a nice interval
    timer->start(3000);
    
    ...
}

void MainWindow::updateAll()
{
    // This is the method in which you update all your labels
}

void MainWindow::on_timer_timeout()
{
    // makes the thread pool start updating asynchronously
    // note that the QRunnable instance will be deleted by the thread pool, so this is not a memory leak
    QThreadPool::globalInstance()->start(new UpdaterRunnable(this));
}
UpdaterRunnable.cpp
Code:
#include "UpdaterRunnable.h"

UpdaterRunnable::UpdaterRunnable(MainWindow *window)
    : QRunnable(), myWindow(window)
{
}

void UpdaterRunnable::run()
{
    myWindow->updateAll();
}
Rougly this is what I was speaking about - I really hope it helps.

I also recommend setting the default caption of all labels to "Updating...", and start updating them asynchonously. It just adds a feeling of responsiveness to the UI. (This is why there is a call to the timeout method in the constructor of my example.)
Very Timely as I am struggling with a performance problem with Maesynth where I think I need to move to a threading solution. Too many sounds playing at the same time
__________________
N900_Email_Options Wiki Page
 

The Following 2 Users Say Thank You to mikec For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#640
mike, got a python version working with threading, will copy the code when i get near a pc. bit laggy, as i am calling so many functions! hehe
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following User Says Thank You to noobmonkey For This Useful Post:
Reply

Tags
check, faulty, front camera, gps, hardware, healthcheck, test


 
Forum Jump


All times are GMT. The time now is 21:47.