← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~alisonken1/openlp/projector-2.1 into lp:openlp

 

<snip>
>> +        self.waitForReadyRead(5000)  # % seconds should be more than enough
>> +        read = self.readLine(self.maxSize)
>> +        dontcare = self.readLine(self.maxSize)  # Clean out the trailing \r\n
>
> not clear why!
>
As noted, it's used to clean out extraneous \r\n characters that
Windows likes to add. Expanded with extra comment line.

<snip>
>> +    def process_avmt(self, data):
>
> avmt???? what is this.
>
Expanded in the block comment further up.

<snip>
>> +        widget.setData(QtCore.Qt.UserRole, item)
>> +        item.widget = widget
>> +        thread = QThread(parent=self)
>
> should the thread not be it's own class like image manager and be running in the background.
> If you had 2 projector then you would have 2 threads?
>
>> +        thread.my_parent = self
>> +        item.moveToThread(thread)
>> +        thread.started.connect(item.link.thread_started)
>> +        thread.finished.connect(item.link.thread_stopped)
>> +        thread.finished.connect(thread.deleteLater)

After doing several days of reading on QtThread I gathered the following:
- Subclass QtThread() and do some extra fiddling in your subclass
- Create a thread instance and attach it where it's needed.

The general consensus was in order to keep the thread from hanging the
GUI, it needs to be attached to the main thread of the program. The
way it's accomplished is create a thread, then use .moveToThread() to
attach it to the main GUI thread.

Since 'thread = QtThread()' is a local instance, I attach it to the
projector instance to keep it local to that projector, so every time
this method is called, a new thread instance is created for each
projector while maintaining GUI responsiveness and giving each
projector their own thread.

By putting the code here, it also reduces the complexity of having to
determine if I need to create the thread in the ProjectorPJLink1()
class when it's used in a different application area, like
ProjectorWizard() (future function i s to retrieve information from
the projector if it's available during the add projector option in the
wizard).

After about a week of testing, this way kept the GUI responsive while
still maintaining communications going with other projectors already
running.

<snip>

Other issues should be taken care of now.


-- 
- Ken
Registered Linux user 296561
Slackin' since 1993
Slackware Linux (http://www.slackware.com)

https://code.launchpad.net/~alisonken1/openlp/projector-2.1/+merge/236753
Your team OpenLP Core is subscribed to branch lp:openlp.


Follow ups

References