[PyQt] problem in variable usage in sql statement
Hello all, I am a newbie in PyQt, just a simple question. I want to use a variable in my sql tatement. If I use string, following statment runs smoothly db.query(SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adresi='10.22.5.1') s = db.store_result() But I want to use the variable chosen and get the IP_Adresses equal to that variable such as: db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = chosen ) But it doesn't work ... thanks for the help -- * Ar.Gör.Enis Karaarslan * Ege Üniversitesi * Kampüs Network Yönetim Grubu * ULAK-CSIRT - http://csirt.ulakbim.gov.tr signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] problem in variable usage in sql statement
On Thursday 07 February 2008, Enis Karaarslan wrote: Hello all, I am a newbie in PyQt, just a simple question. I want to use a variable in my sql tatement. If I use string, following statment runs smoothly db.query(SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adresi='10.22.5.1') s = db.store_result() But I want to use the variable chosen and get the IP_Adresses equal to that variable such as: db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = chosen ) But it doesn't work ... thanks for the help Dynamically create the string you want... db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = '%s' % chosen) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] problem in variable usage in sql statement
thanks for the reply, But It still doesn't work. it gives error such: Traceback (most recent call last): File main.py, line 107, in on_listWidget_itemClicked %chosen) _mysql_exceptions.ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2' at line 4) I use MySQLdb, I take input from listWidget when clicked and convert to string and store it in chosen chosen= str(item.text()); print chosen# prints on command line for debugging and the error is on the last line db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = '%s' % chosen) thanks, On Thursday 07 February 2008 11:03:55 Phil Thompson wrote: On Thursday 07 February 2008, Enis Karaarslan wrote: Hello all, I am a newbie in PyQt, just a simple question. I want to use a variable in my sql tatement. If I use string, following statment runs smoothly db.query(SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adresi='10.22.5.1') s = db.store_result() But I want to use the variable chosen and get the IP_Adresses equal to that variable such as: db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = chosen ) But it doesn't work ... thanks for the help Dynamically create the string you want... db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = '%s' % chosen) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- * Ar.Gör.Enis Karaarslan * Ege University * Kampüs Network Yönetim Grubu * ULAK-CSIRT - http://csirt.ulakbim.gov.tr signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
solved - Re: [PyQt] problem in variable usage in sql statement
pardon just a line-break, special character problem solved. Thanks for your kind response Enis On Thursday 07 February 2008 11:23:43 Enis Karaarslan wrote: thanks for the reply, But It still doesn't work. it gives error such: Traceback (most recent call last): File main.py, line 107, in on_listWidget_itemClicked %chosen) _mysql_exceptions.ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\x c2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\x a0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2' at line 4) I use MySQLdb, I take input from listWidget when clicked and convert to string and store it in chosen chosen= str(item.text()); print chosen # prints on command line for debugging and the error is on the last line db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = '%s' % chosen) thanks, On Thursday 07 February 2008 11:03:55 Phil Thompson wrote: On Thursday 07 February 2008, Enis Karaarslan wrote: Hello all, I am a newbie in PyQt, just a simple question. I want to use a variable in my sql tatement. If I use string, following statment runs smoothly db.query(SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adresi='10.22.5.1') s = db.store_result() But I want to use the variable chosen and get the IP_Adresses equal to that variable such as: db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = chosen ) But it doesn't work ... thanks for the help Dynamically create the string you want... db.query( SELECT OS, IP_Adress FROM ServerDB WHERE IP_Adress = '%s' % chosen) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- * Ar.Gör.Enis Karaarslan * Ege Üniversitesi * Kampüs Network Yönetim Grubu * ULAK-CSIRT - http://csirt.ulakbim.gov.tr signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Missing ownership transfer in QStandardItem
On Wednesday 06 February 2008, Marius Kintel wrote: Hi, I think some of the wrapped methods of QStandardItem miss the ownership transfer, e.g.: qstandarditemmodel.sip:274: %If (Qt_4_3_0 -) void insertRows(int row, const QListQStandardItem* items); %End %If (Qt_4_3_0 -) void appendRows(const QListQStandardItem* aitems); %End Fixed in tonight's snapshot. Adding a /Transfer/ to these seem to fix my immediate issues. I guess the same might go for similar methods added in Qt-4.3. Do you have any in mind - I couldn't find anything. Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Event loop is already running warning message
On Tuesday 05 February 2008, Darren Dale wrote: Hello, A while back I inquired about some warning messages that appear in a threaded application at each timeout, which was addressed in a subsequent PyQt4 release: http://thread.gmane.org/gmane.comp.python.pyqt-pykde/9800/focus=9803 A similar problem occurs with QCoreApplication, it can be seen by starting ipython: $ ipython --q4thread cpaste QCoreApplication::exec: The event loop is already running QCoreApplication::exec: The event loop is already running ... That warning is also produced at each timeout. Is it possible to silence this message? Thank you, Darren It's not quite the same issue as before because if you change your original test to use QCoreApplication rather than QApplication then there is no problem. It would seem to be an ipython problem. PyQt now does some of what ipython does and the two implementations will conflict. PyQt allows its own implementation to be disabled - but I don't know if ipython takes advantage of that. The relevant functions are QtCore.pyqtRemoveInputHook() and QtCore.pyqtRestoreInputHook(). Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Missing ownership transfer in QStandardItem
On Feb 7, 2008, at 12:58 PM, Phil Thompson wrote: Adding a /Transfer/ to these seem to fix my immediate issues. I guess the same might go for similar methods added in Qt-4.3. Do you have any in mind - I couldn't find anything. No, I just assumed that there might be others. I didn't look at any related code in PyQt. ~/= Marius -- We are Elektropeople for a better living. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] methods with def on_
I am a newbie, so a simple question I guess. I am inheriting the design from the design file anasayfa.ui and using in my new class. I used the on_ method, instead of using signal-action way in the QlistWidget, and it works fine, def on_listWidget_itemClicked(self, item): but couldn't use it in the Qradiobutton and ComboBox, what am I doing wrong? def on_radiobutton_4_Clicked(self): def on_actionComboBox_itemSelected(self,item): any comment wil be appreciated. Thanks, -- * Ar.Gör.Enis Karaarslan * Ege University * Kampüs Network Yönetim Grubu * ULAK-CSIRT - http://csirt.ulakbim.gov.tr signature.asc Description: This is a digitally signed message part. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Wacom tablet support
On Tuesday 05 February 2008, Jake Richards wrote: Hello: I'm a little new to python and pyqt so please forgive any naive questions I might have :) But, what I am attempting to do is simply have my wacom tablet work similarly to my mouse in a pyqt application. It appears that left clicks, right clicks and tapping on the tablet all work fine, but when I try to drag, nothing happens. I've tried selecting multiple things in a treeview, using scrollbars, highlighting text, but it seems to only register the first tap and not mimic holding down the left mousebutton and then dragging. Here are some tech specs: Linux Kernel: 2.6.15-1.02 Python 2.4 Qt-4.3.1 Pyqt 4.3 The tablet seems to work fine in other applications (gimp/Shake/firefox) Would anyone have any help they can give me that might be obviously overlooked? Is there any special initialization I need to do? I can see tabletDown/tabletMove events being triggered so something is at least happening. Thanks in advance! B What about other Qt applications? Basically, PyQt knows nothing about tablets - it if works with Qt it should work with PyQt. Phil A good point. I tried out the Qt examples and those don't seem to work either. Basically the same issues. Could they be compiled wrong or perhaps our version of linux/X be causing problems? Or, is this more a topic for a different mailing list? Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Event loop is already running warning message
On Thursday 07 February 2008 07:14:41 am Phil Thompson wrote: On Tuesday 05 February 2008, Darren Dale wrote: Hello, A while back I inquired about some warning messages that appear in a threaded application at each timeout, which was addressed in a subsequent PyQt4 release: http://thread.gmane.org/gmane.comp.python.pyqt-pykde/9800/focus=9803 A similar problem occurs with QCoreApplication, it can be seen by starting ipython: $ ipython --q4thread cpaste QCoreApplication::exec: The event loop is already running QCoreApplication::exec: The event loop is already running ... That warning is also produced at each timeout. Is it possible to silence this message? Thank you, Darren It's not quite the same issue as before because if you change your original test to use QCoreApplication rather than QApplication then there is no problem. It would seem to be an ipython problem. PyQt now does some of what ipython does and the two implementations will conflict. PyQt allows its own implementation to be disabled - but I don't know if ipython takes advantage of that. The relevant functions are QtCore.pyqtRemoveInputHook() and QtCore.pyqtRestoreInputHook(). You are right, thank you for pointing this out. I spent some time this morning investigating whether ipython could use PyQt's implementation. For plotting with pylab the answer appears to be yes, but if you want to interact with PyQt4 after calling exec_, I think it is still necessary to use ipython's implementation. Thank you for providing pyqtRemoveInputHook. Darren ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] RegExp and QString
Hi, Following Assistant (for C++) documentation about QString split method I saw: str = Now: this sentence fragment.; list = str.split(QRegExp(\\b)); // list: [ , Now, : , this, , sentence, , fragment, . ] Now, I with python I tried, a simple example: line = p.readline() sline = line.split(QtCore.QRegExp([A-Z]+)) With this code I got: TypeError: PyQt expected a character buffer object. I don't know how to fix it, if I try a delimiter just line.slipt(',') it works. Some ideas? -- Tiago ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] RegExp and QString
On Monday 11 February 2008, Tiago Maluta wrote: Hi, Following Assistant (for C++) documentation about QString split method I saw: str = Now: this sentence fragment.; I assume that str is declared as a QString. list = str.split(QRegExp(\\b)); // list: [ , Now, : , this, , sentence, , fragment, . ] Now, I with python I tried, a simple example: line = p.readline() So line is a Python string, not a QString. sline = line.split(QtCore.QRegExp([A-Z]+)) With this code I got: TypeError: PyQt expected a character buffer object. Because a Python string knows nothing about QRegExp. I don't know how to fix it, if I try a delimiter just line.slipt(',') it works. Some ideas? Convert the result of readline() to a QString... line = QtCore.QString(p.readline()) Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A couple of question about PyKDE4
Jim Bublitz wrote: Before I start out with PyKDE4, I have a couple of questions: - what is the preferred build system? cmake or configure.py? Will any of these build system vanish in the future? I haven't looked lately, but I think Simon is using cmake with the KDE SVN version. I'll be continuing to use configure.py. I'm pretty sure Simon will want to go with/stay with cmake, and that I'll stay with the configure.py setup. cmake support is needed to make it possible for people to build the whole kde-bindings module in one (big) go. I've also pulled out parts of that cmake code and made it possible to install PyKDE programs with it. Using cmake for a Python program means you also get access to the existing cmake support for building other KDE related things like translation (.po) files, docs, and C++ modules if you want to do mixed development. - are you going to make separate releases of PyKDE4, or will everything be coordinated with the KDE releases? I'll probably do separate releases - I'm behind again and won't be releasing for a month or two. If you are adding bug fixes to the KDE 4.0, then you could probably just skip the extra releases and just release via KDE SVN. KDE bug fix releases come out once a month these days, and we don't even have to lift a finger for that to happen. ;-) There's also a better set of documentation and a documentation viewer (pykdedocs) that integrates tutorials, example programs, docs and will let you browse other docs (Python, PyQt, Qt, KDE, etc) locally or online. The Ply-based tools will make it a lot easier to develop docs from the KDE doc set and is a much easier to maintain bunch of code. Once the docs are updated, and if the viewer is stable/complete enough, then we can put it in KDE 4.1. The only thing missing in PyKDE4 is Phonon support, which is a little messy (or was last time I looked). IIRC, Phonon will be moving into Qt itself, possibly in Qt 4.4. In which case it'll become Phil's problem. ;-) cheers, -- Simon Edwards | KDE-NL, Guidance tools, Guarddog Firewall [EMAIL PROTECTED] | http://www.simonzone.com/software/ Nijmegen, The Netherlands | ZooTV? You made the right choice. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] RegExp and QString
On 2/11/2008 7:22 AM, Tiago Maluta wrote: Following Assistant (for C++) documentation about QString split method I saw: str = Now: this sentence fragment.; list = str.split(QRegExp(\\b)); // list: [ , Now, : , this, , sentence, , fragment, . ] Not really... there's a missing QString() construction somewhere. Now, I with python I tried, a simple example: line = p.readline() sline = line.split(QtCore.QRegExp([A-Z]+)) With this code I got: TypeError: PyQt expected a character buffer object. It would work if you first converted the output of readline() to QString. -- Giovanni Bajo ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] PyKDE4 on Windows
On Thursday 07 February 2008 06:12, Saro Engels wrote: Hello all, As some of you might already know KDE applications are ported to MS Windows. Since I am currently trying to port the module scripts, I came by the kdebindings module as well. I added some scripts for sip and PyQt4 which seem to work on the first glance (they are supposed to work with the Qt version we distribute). Then I tried to get PyKDE4 working and the build process already crashed while cmake'ing. I fixed some issues (some are still local here) but then I decided to ask here first. So are there any efforts in making PyKDE4 working on Windows (and/or Mac)? Where is development for PyKDE4 going on and how can we contribute (that means: is committing to KDE subversion the right way)? I was very impressed by PyQt and I hope PyKDE can get into a similar state in the near future. If someone wants to tackle PyKDE4 for Windows, feel free to have at it. The only other environment I have access to is Win98, and I don't think there's a lot of demand for that port (or interest on my part to code for Windows). No Macs here either. It should be possible to configure PyKDE4 for either of those platforms and incorporate the conditionals into either the KDE SVN version or my tarballs (if I ever get one put together). Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] methods with def on_
On Thursday 07 February 2008, Enis Karaarslan wrote: I am a newbie, so a simple question I guess. I am inheriting the design from the design file anasayfa.ui and using in my new class. I used the on_ method, instead of using signal-action way in the QlistWidget, and it works fine, def on_listWidget_itemClicked(self, item): but couldn't use it in the Qradiobutton and ComboBox, what am I doing wrong? def on_radiobutton_4_Clicked(self): The signal is called clicked, not Clicked. def on_actionComboBox_itemSelected(self,item): QComboBox doesn't have a signal called itemSelected. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A couple of question about PyKDE4
On Tue, Feb 05, 2008 at 12:13:28PM -0800, Jim Bublitz wrote: I'll probably do separate releases - I'm behind again and won't be releasing for a month or two. What Simon has put in KDE SVN should be current and reasonably complete, and will likely stay that way. hi Jim. next week we'll have a PyCamp in my region and I think I can gather 3 or 4 guys to hack on pykde. how can we start helping? also, I'm confused... why do you and Simon work separately? -- (Not so) Random fortune: 13:13 sensei_sacuyista los de la salita 1, Marge Simpson, son todos putos 13:15 @perrito666 sensei_sacuyista: se dice con capacidades sexuales diferentes ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Locale problem with dateEdit calendar popup
Hi there, I have dateEdit input widget with calendarPopup set to true. Underlying calendar widget shown and first comes Sunday,than Monday,then Tuesday etc.. here in Russia we counts weeks from Monday,Tuesday etc... I've discovered in docs this method: QCalendarWidget.setFirstDayOfWeek(Qt::DayOfWeek dayOfWeek). So this underlying popup calendar is tweakable. Question is: how get this object from dateEdit control? is there something like: mydateEdit = QtGui.dateEdit(bla bla bla) mydateEdit.getQCalendar.setFirstDayOfWeek(Monday) ^^ How can I access underlying Qcalendar popup in dateEdit in order to set his properties? Or may be there is global locale setup for Qt application by default? I have in my code those lines: from PyQt4 import QtCore, QtGui, uic import locale locale.setlocale(locale.LC_ALL,'Russian_Russia.1251') # setup global python locale for regexp etc... QtCore.QTextCodec.setCodecForLocale(QtCore.QTextCodec.codecForName(cp1251) ) QtCore.QTextCodec.setCodecForCStrings(QtCore.QTextCodec.codecForName(cp1251 )) QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec.codecForName(cp1251)) Please note that my popup calendar is localized - I mean I see cyrillic letters, everything is ok except this our Qt week starts from Sunday he-he. problem... :( Can anyone of subscribers of this list from countries where weeks starts from Monday (Europe?) check in designer how this widget is shown? Thank you in advance. My platform: python 2.5 pyqt 4.3.3 gpl, windows xp. --- [EMAIL PROTECTED] ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] PyKDE4 on Windows
Hello all, As some of you might already know KDE applications are ported to MS Windows. Since I am currently trying to port the module scripts, I came by the kdebindings module as well. I added some scripts for sip and PyQt4 which seem to work on the first glance (they are supposed to work with the Qt version we distribute). Then I tried to get PyKDE4 working and the build process already crashed while cmake'ing. I fixed some issues (some are still local here) but then I decided to ask here first. So are there any efforts in making PyKDE4 working on Windows (and/or Mac)? Where is development for PyKDE4 going on and how can we contribute (that means: is committing to KDE subversion the right way)? I was very impressed by PyQt and I hope PyKDE can get into a similar state in the near future. with kind regards, Saro Engels p.s.: I don't really want to discuss any errors now, but e.g. PyKDE4 is unaware of platforms in that it includes some X11-related KDE libraries in kdeui.sip which aren't existing on my system. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] A couple of question about PyKDE4
On 07.02.08 21:11:21, Simon Edwards wrote: The only thing missing in PyKDE4 is Phonon support, which is a little messy (or was last time I looked). IIRC, Phonon will be moving into Qt itself, possibly in Qt 4.4. In which case it'll become Phil's problem. ;-) Not exactly. As far as I've heard from people involved with phonon, its going to be in both Qt4.4 and also stay in kdelibs as well. The plugins for Win32/MacOS and gstreamer already where in kdebase sometime last year (but weren't ready for release and thus moved to extragear for now). The devs said they'll try that both versions stay in sync, but obviously there'll be small differences as KDE and Qt release cycles are not aligned. Of course if Phil provides bindings for phonon in the PyQt4.4 release, its probably easy for you or Jim to adapt the small changes that might happen in kdelibs :) Andreas -- You're at the end of the road again. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Wacom tablet support
On Thursday 07 February 2008, Jake Richards wrote: On Tuesday 05 February 2008, Jake Richards wrote: Hello: I'm a little new to python and pyqt so please forgive any naive questions I might have :) But, what I am attempting to do is simply have my wacom tablet work similarly to my mouse in a pyqt application. It appears that left clicks, right clicks and tapping on the tablet all work fine, but when I try to drag, nothing happens. I've tried selecting multiple things in a treeview, using scrollbars, highlighting text, but it seems to only register the first tap and not mimic holding down the left mousebutton and then dragging. Here are some tech specs: Linux Kernel: 2.6.15-1.02 Python 2.4 Qt-4.3.1 Pyqt 4.3 The tablet seems to work fine in other applications (gimp/Shake/firefox) Would anyone have any help they can give me that might be obviously overlooked? Is there any special initialization I need to do? I can see tabletDown/tabletMove events being triggered so something is at least happening. Thanks in advance! B What about other Qt applications? Basically, PyQt knows nothing about tablets - it if works with Qt it should work with PyQt. Phil A good point. I tried out the Qt examples and those don't seem to work either. Basically the same issues. Could they be compiled wrong or perhaps our version of linux/X be causing problems? Or, is this more a topic for a different mailing list? Thanks! Different mailing list. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] RegExp and QString
Tiago Maluta wrote On 11-02-2008 08:22: Hi, Following Assistant (for C++) documentation about QString split method I saw: str = Now: this sentence fragment.; list = str.split(QRegExp(\\b)); // list: [ , Now, : , this, , sentence, , fragment, . ] Now, I with python I tried, a simple example: line = p.readline() sline = line.split(QtCore.QRegExp([A-Z]+)) Hi, You're trying to use the split() method of the python core string type and this method needs a character buffer which contains the delimiter characters. But the example that you've found out in the documentation uses the split() method of the QString class. -- Ozan ÇAĞLAYAN http://cekirdek.pardus.org.tr/~ozan ozan_at_pardus.org.tr ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Model/View with multiple thread
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hallo everyone, I've started working with the Model/View concept and have some questions on implementing it in a multithreading environment. I hope that some of you have some ideas or advice on that and I'll highly appreciate any! So that's the basic structure: I'm working on an application that's processing data in a spreadsheet class. All processing in done in a separate thread and communicates with the GUI thread through multiple signals and slots. I now implemented a model in the GUI thread handling the exact same spreadsheet object, since the Model and View have to live in the same thread (is that right?). Thinking about how to keep the spreadsheet objects in worker and main thread synchronised I came up with two ideas: 1. Using signals and slots in both the worker and the model to update their spreadsheet objects whenever the other one changes. 2. Using a thread-safe singleton of the model to handle one single instance of the spreadsheet that are used in both threads. What would be considered a 'better' solution? Is there any other alternative that might work even better? I really appreciate any thoughts on this. Thanks in advance. Regards, Seb -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHrAmG/ZEwc0fz/xMRAhmwAJ9Z7N4Tja1ag9i1J40kuRFLLBCzFwCfY7mF TluK9BdA8xxpWY1I7nzzCWg= =1WoK -END PGP SIGNATURE- ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt