[PyQt] desktop workspace
I am trying to save the geometry and and the workspace where the application has been closed. Is there a way with Python/Qt to get the info on the workspace number!? -- Emmanuel ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Please tell me if I have this straight...
On Fri Aug 5 19:27:51 BST 2011, David Cortesi wrote: > I present a document to a user in a QPlainTextEdit widget. The widget > nicely handles most editing functions, but there is a unique operation > I want to provide. When the user selects Edit > BLEEP, the app is > supposed to BLEEP the document. I presume that by BLEEP you do not mean beep, otherwise you could use this: http://doc.qt.nokia.com/4.7/qapplication.html#beep David :-) ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Please tell me if I have this straight...
On Friday 05 August 2011, 20:27:51 David Cortesi wrote: > I present a document to a user in a QPlainTextEdit widget. The widget > nicely handles most editing functions, but there is a unique > operation I want to provide. When the user selects Edit > BLEEP, the > app is supposed to BLEEP the document. > > BLEEPing is not something Qt does, I have to implement BLEEP with > native Python code. So when the user says BLEEP it, I must: > > 1. Use QPlainTextEdit toPlainText() to get the document text as a > QString > > 2. Use QString toUTF8() to get Utf-8 text that Python can use No, you just convert the QString to unicode. > 3. Apply my Python logic to BLEEP the text > > 4. Use QString fromUtf8() to return to a QString See above. > 5. Use QPlainTextEdit fromPlainText() to replace the document with > the BLEEPed contents. > > Does this sound right? > > Can PyQt do #2 and #4 automagically? Sure, just do import sip sip.setapi('QString', 2) before any PyQt imports, which does convert QString to unicode behind the scenes. Anyway, no need to encode/decode utf-8 strings here. > And what are the performance implications when a document might have > one or two megabytes of text? I guess, it mostly depends on the performance of your bleep algorithm. The rest is operating with compiled code, which should be sufficient. Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Please tell me if I have this straight...
I present a document to a user in a QPlainTextEdit widget. The widget nicely handles most editing functions, but there is a unique operation I want to provide. When the user selects Edit > BLEEP, the app is supposed to BLEEP the document. BLEEPing is not something Qt does, I have to implement BLEEP with native Python code. So when the user says BLEEP it, I must: 1. Use QPlainTextEdit toPlainText() to get the document text as a QString 2. Use QString toUTF8() to get Utf-8 text that Python can use 3. Apply my Python logic to BLEEP the text 4. Use QString fromUtf8() to return to a QString 5. Use QPlainTextEdit fromPlainText() to replace the document with the BLEEPed contents. Does this sound right? Can PyQt do #2 and #4 automagically? And what are the performance implications when a document might have one or two megabytes of text? Thanks for any insights, Dave C. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help with Login Dialog / QThread issues
Any takers? On Thu, Jul 7, 2011 at 12:38 PM, Eric Frederich wrote: > Hello, > > I am trying to create a login dialog for my application. > Logging in can take a couple of seconds so I wanted to show a progress > bar during the login process. > I think that for my QProgressBar to animate during this time, I need > to log in on a different thread. Is this true? > > So, below I have what I think is a working example. > Is there a better way to call QDialog's accept slot when the login > thread is finished than how I am doing it via functools.partial? > It seems a bit hacky. > > > > > from functools import partial > > class LoginThread(QThread): > def __init__(self, username, password, parent=None): > super(LoginThread, self).__init__(parent) > self.username = username > self.password = password > def run(self): > LOGIN( > self.username, > self.password, > ) > > class LoginDialog(QDialog, Ui_LoginDialog): > > def __init__(self, *args, **kwargs): > super(LoginDialog, self).__init__(*args, **kwargs) > self.setupUi(self) > self.progressbar.hide() > > def accept(self): > self.progressbar.setMinimum(0) > self.progressbar.setMaximum(0) > self.progressbar.show() > self.lt = LoginThread( > str(self.username_edit.text()), > str(self.password_edit.text()) > ) > self.connect(self.lt, SIGNAL('finished()'), > partial(QDialog.accept, self)) > self.lt.start() > ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt