The Following User Says Thank You to doksng For This Useful Post: | ||
![]() |
2010-06-11
, 07:31
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#622
|
NICEThis is amazing.
Are you no longer sticking with the green theme?
I was wondering if it is possible to make the signal strength measurement on the comms tab to be dynamic so that it varies with signal level changes.
Would it be possible to have a widget version
Thanks
![]() |
2010-06-11
, 07:52
|
|
Posts: 105 |
Thanked: 47 times |
Joined on Sep 2009
|
#623
|
The Following User Says Thank You to doksng For This Useful Post: | ||
![]() |
2010-06-11
, 08:51
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#624
|
![]() |
2010-06-11
, 09:02
|
|
Posts: 1,296 |
Thanked: 1,773 times |
Joined on Aug 2009
@ Budapest, Hungary
|
#625
|
But if anyone has useful tips for threading in pyqt, please let me know!
The Following User Says Thank You to Venemo For This Useful Post: | ||
![]() |
2010-06-11
, 09:06
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#626
|
Well, of course we have!
The easiest way is using QThreadPool with a custom QRunnable implementation.
Your QRunnable's run() method would check the necessary values and refresh the UI.
The main UI window should have a QTimer and on a predefined interval, it would create a new instance of your own QRunnable and make the thread pool execute it.
Note that the thread pool has a static "global instance", so you don't have to create an instance of that, just access the global instance and make that do things for you.
The Following User Says Thank You to noobmonkey For This Useful Post: | ||
![]() |
2010-06-11
, 09:08
|
|
Posts: 1,296 |
Thanked: 1,773 times |
Joined on Aug 2009
@ Budapest, Hungary
|
#627
|
Ahaaaaaaa - thats actually the first explanation that i have understood!hehehe
I did see THP did something here, that looked similar to threading / updating - but may not be suitable.
Will see if i can get some basic versions running, assuming it all works, i can't see it being too difficult to do it for all updatable values
The Following User Says Thank You to Venemo For This Useful Post: | ||
![]() |
2010-06-11
, 09:13
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#628
|
Thanks!
Well, I don't know a thing about Python, so I'm not sure.
You just have to do a single QRunnable implementation for yourself that updates all the values.
No need to do it separately for all the updatable values.
(As this is not a quad core monster processor, there is no point in launching that many threads at once. The usual good practice is to keep one thread for the UI, and do all the other stuff that would otherwise slow it down in separate threads.)
a = gn_functions.getaValue() self.listWidget.currentItem().setText("Value Name \t\t\t" + a)
![]() |
2010-06-11
, 09:34
|
|
Posts: 1,296 |
Thanked: 1,773 times |
Joined on Aug 2009
@ Budapest, Hungary
|
#629
|
The Qrunnable idea is interesting, as now all of my values (Ate least in system) are retrieved via functions
ie
So in theory i should be able to just put those calls into that qrunnable idea/format....Code:a = gn_functions.getaValue() self.listWidget.currentItem().setText("Value Name \t\t\t" + a)
The Following User Says Thank You to Venemo For This Useful Post: | ||
![]() |
2010-06-11
, 09:37
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#630
|
I would do it the following way:
- Create a method in the UI that calls those functions you're talking about
Then, create a class that derives from QRunnable (Let's call it Updater) and has a reference to the UI class, and in its run() method calls the method that you created above
- Create a QTimer in the UI class and in its timeout(), create a new instance of the Updater class you created above, and make the global instance of QThreadPool execute it.
I would gladly post code examples, but I don't know a thing about Python, and I'm not sure whether my C++ example would be of any use to you.
The Following User Says Thank You to noobmonkey For This Useful Post: | ||
![]() |
Tags |
check, faulty, front camera, gps, hardware, healthcheck, test |
|
Are you no longer sticking with the green theme?
I was wondering if it is possible to make the signal strength measurement on the comms tab to be dynamic so that it varies with signal level changes.
Would it be possible to have a widget version
Thanks