Re: Development tools and practices for Pythonistas
On Sunday 01 May 2011 18:11, Dietmar Schwertberger wrote: Am 01.05.2011 02:47, schrieb Shawn Milochik: Look at the big two sites for open-source repositories -- github and bitbucket. One's git, the other Mercurial. I don't think you can go wrong picking either one. Can any of those be used from Python as a library, i.e. something like import Hg r = Hg.open(path) When I had a look at Mercurial, which is implemented in Python, it was implemented in a way that I could not do that. It was implemented as rather monolithic program which could be used from os.system(...) only. After noting the warnings it contains, see the following page for a description of the Python API for Mercurial: http://mercurial.selenic.com/wiki/MercurialApi Git also has a Python API, which is fairly reasonable to use, though a bit different to the Mercurial one: http://www.samba.org/~jelmer/dulwich/ I've used both with some success. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python users in Stavanger, Norway?
On Sunday 03 April 2011 09:32, Austin Bingham wrote: I'm a Python developer in Stavanger, Norway looking for other Python users/developers/etc. who might be interested in starting a local user group. Anyone interested? This group might actually evolve into a general programming/computer group, depending on the mix of people, but I think that's probably a good thing. I know there are a lot of computer types in the area, but there doesn't seem to be much of a community. I'd like to change that if we can, so let me know if you're interested. If you manage to get something started, please update the list on the Python Wiki: http://wiki.python.org/moin/LocalUserGroups#Norway David (not in Stavanger) -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT: QWebView with custom QNetworkAccessManager
On Wednesday 02 February 2011 00:31, Gelonida wrote: I would like to subclass QNetworkAccessManager and create a subclass of QWebView, that will use the subclassed QNetworkAccessManager for all accesses. Is this possible? I have really no idea when and how I could achieve this. Thanks in advance for any suggestions / pointers See this page for an example: http://www.diotavelli.net/PyQtWiki/Using_a_Custom_Protocol_with_QtWebKit Try subclassing the NetworkAccessManager.createRequest method as in the example and returning custom replies for each access. That might do what you want. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Use the Source Luke
On Sunday 30 January 2011 05:21, Steven D'Aprano wrote: If I *wanted* to index my files, I could do so, although in fairness I'm not aware of any Linux tools which do this -- I know of `locate`, which indexes file *names* but not content, and `grep`, which searches file content but doesn't index what it finds. You might find this page useful: http://www.wikinfo.org/index.php/Comparison_of_desktop_search_software David -- http://mail.python.org/mailman/listinfo/python-list
Re: WxPython versus Tkinter.
On Sunday 23 January 2011 17:57, rantingrick wrote: On Jan 22, 9:39 pm, Terry Reedy tjre...@udel.edu wrote: On 1/22/2011 7:07 PM, rantingrick wrote: Near the beginning of this thread, I gently challenged you to produce a concrete, practical proposal for an stdlib addition that could be critiqued and improved. When you asked for problems with wxwidgets/wxpython, I gave some. Still waiting. You may have done this however i do not remember. With all the trolling that was going on (not you) i may have missed it. ^^^ +1 QOTW David -- http://mail.python.org/mailman/listinfo/python-list
Re: After C++, what with Python?
On Sunday 16 January 2011 08:35, geremy condra wrote: On Sat, Jan 15, 2011 at 9:30 PM, Aman aman.6...@gmail.com wrote: It would be great if you people could guide me as to what to proceed with and how. Here's what I would do: [Snip advice] Maybe it would be good to expand the Getting Started material in the Python Wiki with your advice, Geremy. It would save you the trouble of having to type it all over again the next time a similar question is asked. David -- http://mail.python.org/mailman/listinfo/python-list
Re: How suitable is Python to write system utilities?
On Thursday 06 January 2011 12:08, Alice Bevan?McGregor wrote: Python does include libraries (and has available third-party libraries) to interface with external low-level libraries of every kind, has Python-native third-party libraries to do things like examine ELF object files / executables, manipulate raw IP datagrams, etc, and it is possible to access glib (and other C libraries or even Windows DLLs) directly from within Python without creating wrapper interfaces. Just out of interest, which module/package are you using to examine ELF files? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Generating PDF file in Python
On Saturday 30 October 2010 04:27, Lawrence D'Oliveiro wrote: In message mailman.256.1288099490.2218.python-l...@python.org, Ed Keith wrote: I need to generate PDF files and I'm exploring what tools to use. I was planing on using ReportLab, but recently found some references to pango (http://www.pango.org/) and ciaro (http://cairographics.org/) being able to generate PDF files. But am having difficulty finding details. [...] Are there other options I have overlooked? How about Poppler? Poppler is first and foremost a rendering library, not a PDF generator, though it's very good at what it does: http://poppler.freedesktop.org/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: pyqt4 Table Widget deleting c/c++ object
On Monday 18 October 2010 23:26, Andrew wrote: I have two issues dealing with the table widget, though they may be interconnected. I'm not sure. Both delete the cell widgets off of my table but leave the rows, and then when I have the table update, it complains the c++ object has been deleted. # self.tableData.setCellWidget(rowCount, 0, trackItem) # RuntimeError: underlying C/C++ object has been deleted This is because you pass your widgets to this method and later ask the table to clear the contents of the table. When it does so, it deletes the underlying widgets, leaving only Python wrappers. The documentation mentions that the table takes ownership of the widget: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qtablewidget.html#setCellWidget I have a list of a custom widget class that keeps track of several directories. Each class gets put into a row on the table. I have a set of radio buttons that will show me different views of the data: All, New, Done, Errors, Warnings. When I switch views, I clear my table, set the row count to 0, and then add back in only the widgets I want to see. Error 1: I load in the data initially, and then repopulate the table, and then re-size the window, instantly all listed rows are cleared, but the rows stay. This only happened on the diagonal re-size (bottom left corner); not the up and down, or side to side re-size. Attempting to repopulate the table, resulted in: underlying C/C++ object has been deleted. Though it will put in the correct number of rows required. Everything worked fine as long as I did not re-size the window. This may only be a symptom of the behaviour and not a guarantee that the code was working correctly up until the point when the resize occurred. Error 2: I load in the data initially, and then repopulate the table, the table clears and then nothing happens. No error messages or even visible rows. After several more repopulates it with either crash or tell me: underlying C/C++ object has been deleted. I had error 1 two days ago, then without changing the code, I now get error 2. I do not have to re-size the window for it to break now. I recommend that you create a list of non-widget data structures in your parsePath() method and create widgets on the fly in your addToTable() method. If you need to retain information when you repopulate the table then update the data structures that correspond to the widgets just before you clear the table. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Deleting widgets from PyQt4 QFormWidget
On Wednesday 15 September 2010 18:53, Andrew wrote: I'm trying to remove the widgets from the QFormLayout widget from PyQt4. According to the documentation I should be able to use the command .takeAt(int) which will delete the widget from the layout and then return to me the QLayoutWidget. It will remove the widget from the layout but it won't delete it because it doesn't own it. The widget will still remain within its parent widget. You have to either reparent it to another widget, or delete it manually. [...] Am I missing a step or is this just broken? I haven't been able to find anything else on this issue yet. If it's broke, is there any potential workaround? Try calling deleteLater() on each widget when you take it from the layout. Does that work? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross Compiling Python for ARM
On Tuesday 14 September 2010 21:19, Thomas Jollans wrote: On Tuesday 14 September 2010, it occurred to Neil Benn to exclaim: # ./python -sh: ./python: not found I'm guessing either there is no file ./python, or /bin/sh is fundamentally broken. Yes, it may be instructive to use the file command to see what ./python actually is: file ./python David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt Ram Usage
On Monday 03 May 2010 22:49, Country Boy wrote: I am new to Python (and programming so pardon my ignorance) I have a small PyQt program that lives in windows system tray. I am using Suds ElemetTree to do webservices call and parse XML. I have a QTimer that runs every 30 seconds and fetches the updated data from the server. Finally, the python script is frozen into exe using CX_FREEZE. When I run the exe, it starts with 18MB (which i think i high for an app that just fetches info from webserver and creates a menu full of web url shortcuts, but thats besides the point). It's the price you pay for features. There are ways to cut out features you don't want if you're prepared to use a specialised version of Qt. After every 30 seconds (as my QTimer timeout()), my RAM usage goes up by 400KB. So after an hour or two of running the application almost uses ~60MB or more, which is ridiculous. I think my application has some memory leaks and I think every time I create an instance of the WebService class (its a QThread that fetches information using WSDL) the RAM goes up but doesn't get released once Class's work is done. Can somebody pls direct me into the things that I should be looking into to troubleshooting this issue... Qt has its own way of managing memory that usually plays well with Python's own memory management, but there are ways to accidentally create objects that will stay alive until the application exits. In particular, beware of creating objects with a parent QObject if you really want to manage them from Python because Qt will keep the underlying C++ object around, even if you delete the object in Python. This might not be the reason for the memory usage you see, but it's one thing to look at. You might also need to show us some code if the problem turns out to be more complicated than this. David -- http://mail.python.org/mailman/listinfo/python-list
Re: highlight words by regex in pdf files using python
On Wednesday 17 March 2010 00:47, Aahz wrote: In article af0830ae-1d24-4db9-b721-d6602fedd...@15g2000yqi.googlegroups.com, Peng Yu pengyu...@gmail.com wrote: I don't find a general pdf library in python that can do any operations on pdfs. I want to automatically highlight certain words (using regex) in a pdf. Could somebody let me know if there is a tool to do so in python? Did you Google at all? python pdf finds this as the first link, though I have no clue whether it does what you want: http://pybrary.net/pyPdf/ The original poster might also be interested in displaying the highlighted words without modifying the original file. In which case, the Poppler library is worth investigating: http://poppler.freedesktop.org/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Some PyCon videos won't play
On Saturday 13 March 2010 20:01, Terry Reedy wrote: On 3/13/2010 11:23 AM, Lee Harr wrote: I am having a great time watching videos from PyCon. Thanks to everyone who presented, and to those who did such a great job putting the videos up at: http://pycon.blip.tv/ My trouble is that, although most of the videos play perfectly, there are a few that refuse to play at all. Like: [...] Is anyone else having trouble with these? Yes, 'spinner' spins indefinitely, while others load and play. You should still be able to get at the videos themselves by inspecting the page contents, looking for download links like this one: http://blip.tv/file/get/Pycon-PyCon2010UsingPythonToCreateRoboticSimulationsForPlaneta894.ogv In this case, it's an Ogg Theora video file, so you may want to use a player like VLC to view it: http://www.videolan.org/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem creating executable, with PyQwt
On Tuesday 23 February 2010 05:32, Gib Bogle wrote: David Boddie wrote: I have previously referred people with py2exe/PyQt issues to this page on the PyQt Wiki: http://www.py2exe.org/index.cgi/Py2exeAndPyQt If you can somehow convince py2exe to include the QtSvg module (and presumably the libQtSvg library as well) then perhaps that will solve this problem. David Thanks David, that worked a treat. :-) If you could update the Wiki (or maybe the py2exe Wiki, if they have one) to say what you did, that would be useful for others in the future. Then they'll only be one search away from the answer. :-) David -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem creating executable, with PyQwt
On Monday 22 February 2010 01:17, Gib Bogle wrote: quote Traceback (most recent call last): File ABM15.pyw, line 15, in module File PyQt4\Qwt5\__init__.pyc, line 32, in module File PyQt4\Qwt5\Qwt.pyc, line 12, in module File PyQt4\Qwt5\Qwt.pyc, line 10, in __load ImportError: No module named QtSvg If you Google this last line, you'll find that I've posted this to a forum, but no one answered me. Someone has also had this problem before, although I think they were using PyInstaller and not py2exe. They say that its because Qwt has a hidden import for QtSvg. If I can turn this off, maybe it'll work, but I don't know how. I have downloaded py2exe and I run the attached setup.py file in my working directory. It creates two directories: 'dist' and 'build'. An executable is created in the 'dist' directory along with other things. When I tried running it, it produces a log file, in which I find the error messages. \quote Perhaps someone can recognize these symptoms. Someone asked this question on the PyQt mailing list, too: http://www.riverbankcomputing.com/pipermail/pyqt/2010-February/025827.html I believe it was also asked on the #pyqt IRC channel on freenode. I think I have previously referred people with py2exe/PyQt issues to this page on the PyQt Wiki: http://www.py2exe.org/index.cgi/Py2exeAndPyQt If you can somehow convince py2exe to include the QtSvg module (and presumably the libQtSvg library as well) then perhaps that will solve this problem. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 designer custom properties - combo box style
On Saturday 06 February 2010 10:32, Andrew wrote: I'm attempting to create a drop down property for a custom widget I'm creating. So when in designer and you scroll down to the custom properties, under the regular widget properties, one of them would be a drop down menu. The data to populate it will be coming from our API and currently is a list of string-items. Yes, it would be treated specially by Designer, since it's the only place it would be seen. Right. The drop down menus in the property editor usually contain values defined for C++ enums which have been declared to Qt's meta-object system when a C++ library or plugin is compiled. I'm not sure that PyQt can expose lists of Python values in the same way. An example of this is the alignment property in QLineEdit. In the PyQt4\examples\designer folder, it carries a number of custom widgets that will load into designer. The datetimeedit widget creates a custom drop down menu property. The plugin pulls its information from the QtCore libraries and from the QCalander Widget. Though I am unable to find a better example or even explanation of how it's actually creating that drop down menu. Each of the individual properties are just single values, aren't they, not collections of values? Have you seen this article? http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html No, I haven't, thanks. That might step in the right direction. I can't run it right now, so I'm not sure if it is putting a spinbox as it's property or just the value from the spin box. The value from each spin box is turned into a property, so there are latitude and longitude properties, though each of these only holds a double precision floating point number. It sounds like you want to be able to select from a list of values, or possibly change the values themselves. If it turns out you can't add a property to Qt Designer in the way you want, you can still add a custom editor to the widget so that users can open a context menu and select an item to configure it. This is similar to the way you can open a dialog to edit the text inside QTextEdit widgets. The article I referred to also covers this: http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html#makingamenu David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 designer custom properties - combo box style
On Tuesday 02 February 2010 22:25, Andrew wrote: I am creating custom widgets for the PyQt4 Designer. I can create custom properties, but I'm looking for how to create a custom property that has a combo box drop down. I've seen them in the example widgets and tried following them, but they are using pre-defined items to populate their property, so it's not a very clear example of how to get the combo box property to work. Can you explain a bit more about what you have seen and what you are trying to do. Are you trying to create a property that is treated specially by Designer or do you want to get the data for the combo box from somewhere else? Is there any other examples or help for this kind of setup? Have you seen this article? http://qt.nokia.com/doc/qq/qq26-pyqtdesigner.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: Undo/Redo in PyQt
On Wednesday 13 January 2010 02:20, Zabin wrote: I am trying to implement the undo and redo facility in pyqt. I have gone through some sites and was wondering whether iyou always need to create subclasses and their definitions for the undo/redo action. My program currently has a single window in which the user enters information which is used to update a text file as soon as the user leaves the field- so i essentially need to undo the text in that field as well as the file. I am puzzled as to how to approach this. Any help will be much appreciated! From memory and a quick glance at the documentation for QUndoCommand, I'd say the answer to your question is yes, you do need to subclass QUndoCommand for each kind of command you want to make undoable. You need to derive a subclass because you need to implement undo() and redo() methods that perform the work of adding the text to the file (redo) and removing it (undo). You might optionally write text back to the field when performing an undo command, as well. I've put some example code on this page: http://www.diotavelli.net/PyQtWiki/Undo_and_redo_with_line_edits It's not ideal because the commands are invoked when the window itself loses focus, but perhaps you can use it as a starting point. David -- http://mail.python.org/mailman/listinfo/python-list
Re: pyZui - anyone know about this?
On Monday 14 December 2009 20:02, Donn wrote: On Monday 14 December 2009 00:10:52 David Boddie wrote: Doesn't the author give his e-mail address at the end of the video? (Maybe I'm thinking of a different video.) Yes, in a quick and garbled way :) I have yet to try to contact the author or the youtube poster -- been too busy. I managed to catch his address and sent him a message saying that people were discussing PyZUI in this thread. David -- http://mail.python.org/mailman/listinfo/python-list
Re: pyZui - anyone know about this?
On Friday 11 December 2009 05:41, Donn wrote: I happened upon this youtube link: http://www.youtube.com/watch?v=57nWm984wdY It fairly blew my socks off. In it a fellow by the name of David Roberts demos a zui written in Python. Aside from the zooming (which is impressive enough) it show embedding of images, pdf files, web pages and text. He says nothing about what toolkits were used or how it might have been done. It's Linux-based, but no other info. On some googling, I can only find a few bug reports on pypi related to pyQt. I would really like to find out how that ZUI was done, it's simply amazing. Any clues out there? Doesn't the author give his e-mail address at the end of the video? (Maybe I'm thinking of a different video.) David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 4.4.4 : a bug with highlightBlock ?
On Wednesday 18 November 2009 11:47, Snouffy wrote: I've been trying to do some syntax highlighting using PyQt4. I ported the example given in the documentation of Qt4 to Python. It works fine on my computer at work (which has PyQt4 version 4.3.3) but doesn't on my home computer (which has version 4.4.4) : it gets stuck in an infinite loop. This is a known issue. There are examples distributed with PyQt that should have been updated to use a slightly different approach. Here is the code : class MyHighlighter(QtGui.QSyntaxHighlighter): def __init__(self, edit): QtGui.QSyntaxHighlighter.__init__(self,edit) def highlightBlock(self, text): myClassFormat = QtGui.QTextCharFormat() myClassFormat.setFontWeight(QtGui.QFont.Bold) myClassFormat.setForeground(QtCore.Qt.darkMagenta) pattern = \\b[A-Z_]+\\b expression = QtCore.QRegExp(pattern) index = text.indexOf(expression); while (index = 0): length = expression.matchedLength() self.setFormat(index, length, myClassFormat) index = text.indexOf(expression, index + length) You need to change the indexOf() calls to indexIn() calls on the QRegExp object: index = expression.indexIn(text, index + length) What am I missing ? Is this a known bug of version 4.4.4 ? I think there was a behavioural change at some point that affected regular expression searching in QStrings. David -- http://mail.python.org/mailman/listinfo/python-list
Re: python gui builders
On Thursday 19 November 2009 11:50, Simon Hibbs wrote: I don't think a list like this is a great way to do that. There are plenty of examples and tutorials available for each option. This site has a selection of tutorials that can be used to compare API and code styles: http://zetcode.com/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt processEvents not processing
On Saturday 07 November 2009 05:12, DarkBlue wrote: qt 4.5.3 pyqt 4.6.1 python 2.6 I have this QtTable widget which I want to refresh once about every 2 seconds with new data. so I do : def updateSchedule(self): for j in range(0,10): doUpdate() QtCore.processEvents() sleep(2) unfortunately QT appears to wait until the for loop finishes and only then paints the QtTable widget on the screen showing only the latest updated result. It's difficult to know exactly why this is without more context. Calling the application's processEvents() method should give the user interface the chance to update itself, but perhaps you need to explicitly call update() on the QTableView or QTableWidget instance to ensure that it is refreshed. An alternative way to do this is to use a timer to update the table every two seconds. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT4 user group
On Thursday 29 October 2009 17:15, Diez B. Roggisch wrote: Chris wrote: I'm starting to learn and use PyQT4 at work. Is there a good user group or forum out there that I should know about? The PyQt Mailinglist. There's a #pyqt IRC channel on Freenode: irc://irc.freenode.net/pyqt The Wiki is also a fairly useful resource: http://www.diotavelli.net/PyQtWiki David -- http://mail.python.org/mailman/listinfo/python-list
Re: Substitute for KConfig in Qt4
On Sat Sep 19 12:18:40 CEST 2009, nusch wrote: On Sep 19, 3:53 am, David Boddie da... at boddie.org.uk wrote: On Thursday 17 September 2009 13:04, nusch wrote: I want to remove pyKDE dependencies from my app to make it pure PyQt. What will be the best substitute for KConfig? What exactly do you use KConfig for in your application? David e.g storing dock window positions, fields choosen in QComboBox etc. But I Dont want to use normal config files for it Then you would use QSettings. Although that may use configuration files behind the scenes, they should at least be stored in a standard place. http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qsettings.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: Substitute for KConfig in Qt4
On Thursday 17 September 2009 13:04, nusch wrote: I want to remove pyKDE dependencies from my app to make it pure PyQt. What will be the best substitute for KConfig? What exactly do you use KConfig for in your application? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross platform TTF font render from Python [was: Load TTF from pycairo under Windows]
On Friday 18 September 2009 08:54, Laszlo Nagy wrote: I need to render antialiased PNG images using TTF font files and UTF-8 text. It needs to be available at least on Linux and Windows. This is what I have tried: [...] #4. pygame - documentation looks great, it is cross platform. But the first example program I had tried has been terminated, printing out memory dump and complaining about double freeing some memory location. I'm surprised this doesn't work. I've seen games that are distributed with TrueType fonts, so I would expect them to work, or people would probably say something. :-) What other options do we have? PyQt4 can render Unicode text to all sorts of paint devices, and it supports TrueType fonts, too. You basically do all the painting via a single API: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qpainter.html Here's a quick example of how it could be done: http://www.diotavelli.net/PyQtWiki/Paint%20on%20an%20image All the relevant stuff happens in the updateImage() method. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt QCompleter model
On Thursday 17 September 2009 01:14, nusch wrote: The following code: strings=[asdad, baasd, casd, caxd] completer = QCompleter(strings) model = completer.model() print model.rowCount() model.stringList().append(test) This may not work as you expect. Although it may actually modify the list, the model won't know about the change. print model.rowCount() prints 4 before and after appending test to stringList. What should I do to let the model know about new data? I can save reference to model.stringList() append keyword and after pass this reference as an argument to setStringList then last model.rowCount() increases, but it is not efficient when operating with e.g 2 words in such list. Ideally, you would call setStringList(), but I can see why that isn't a good solution for you. Is there better way to do this? Or is there any other method with simply allow to add word to Qcompleter without using .stringList() Use the model API to append new rows and set new data. Something like this should get you started: rows = model.rowCount() if model.insertRow(rows): index = model.index(rows) model.setData(index, QVariant(test)) David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT Qthread stuck main app
On Tue Sep 15 12:59:35 CEST 2009, daved170 wrote: my problem is that when start is pusshed the entire window stuck and it's impossible to push the STOP button and even when it looks like it's been pushed it actually don't do anything. any idea how to fix it? Does adding a call to the base class's __init__() method help? class myThread(QtCore.QThread): def__init__(self): QtCore.QThread.__init__(self) self.alive = 1 David -- http://mail.python.org/mailman/listinfo/python-list
Re: Rapid GUI Programming with Python and Qt source code
On Thursday 10 September 2009, Steven Woody wrote: On Wed, Sep 9, 2009 at 9:33 PM, David Boddie dbod...@trolltech.com wrote: See this page for the links: http://www.qtrac.eu/pyqtbook.html but the URL is not reachable from here. is there another URL? thanks. Can't you access anything from qtrac.eu from where you are? Here are two links to archives for the Python 2.6 versions of the examples: http://www.qtrac.eu/pyqtbook26.tar.gz http://www.qtrac.eu/pyqtbook26.zip If you can't reach those, maybe Mark will send you the examples directly. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Rapid GUI Programming with Python and Qt source code
On Wed Sep 9 07:11:26 CEST 2009, Steven Woody wrote: *I've searched google and cannot find a valid link for the source code of the book Rapid GUI Programming with Python and Qt. Could anyone please give me a non-broken URL?* See this page for the links: http://www.qtrac.eu/pyqtbook.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: Flowcharting in Python?
On Tuesday 08 September 2009 00:09, Grant Edwards wrote: Have you looked at Skencil (nee Sketch)? It's a vector/object-oriented drawing program written in Python: http://www.skencil.org/ It's not really optimized for flowcharts or block diagrams (IIRC, it doens't have any concept of connecting arcs between polygrams), but you might be able to extend it. Or maybe Dia is worth looking at, since it is aimed at diagram creation: http://live.gnome.org/Dia/Python I'm beginning to think I'll have to create something from scratch. I wouldn't think you'd have to start from scratch. You should at least use one of the GUI frameworks that has some sort of canvas widget. PyQt4 contains an example called diagramscene.py which does simple flowcharting. It might be useful to look at it to get some ideas. Personally, I had thought about adapting it to create statecharts. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Qstrings to Strings
On Thursday 03 September 2009 21:01, Stefan Behnel wrote: Helvin wrote: Just wanted to say, to convert qstrings (or integers for that matter) to strings, use the str() function. http://learnwithhelvin.blogspot.com/2009/09/qstrings-and-strings.html Hmmm, will that return a Unicode string? A byte string would be rather inappropriate in most cases. I guess the unicode() function is the right thing to use here (or the str() function in Py3 - no idea if that's supported by Qt by now). PyQt4.5 supports Python 3, so I imagine that str() will be what you would use with that combination. For Python 2, unicode() is probably what most people want. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for professsional Windows GUI apps?
On Tuesday 25 August 2009 13:24, Wolfgang Keller wrote: The area of _desktop_ database application development indeed looks like a vast and very hostile desert in the Python landscape. The only framework that seems to be worth trying is Dabo. Unfortunately there's little documentation, and that's mostly outdated. There's also Kiwi, but that's even less well documented. And GNU Enterprise essentially seems to be dead. There's also Camelot, if that's the kind of thing you're after: http://www.conceptive.be/projects/camelot David -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyserial and pyQt
On Tuesday 21 July 2009 21:37, Seth wrote: I have used pyserial in the past but this is my first experience with pyQt. I am using the Python xy package for windows current but might move to linux. I have a small device that is outputting a basic text string. I want to be able to read this string(from the comm port) and update a text box and eventually a graph in pyQt. I can't find any documentation or tutorials on how to do this. If anyone can point me in the right direction or give me some tips I would be grateful. It seems that someone has already asked a similar question on Stack Overflow, though perhaps you should start with a simpler solution and look at more advanced ones later: http://stackoverflow.com/questions/771988/pyqt4-and-pyserial One starting point is this list of tutorials on the PyQt and PyKDE Wiki: http://www.diotavelli.net/PyQtWiki/Tutorials Later, when you want to draw graphs, you might find PyQwt useful: http://pyqwt.sourceforge.net/ You may already be aware that there's also a mailing list for PyQt and PyKDE: http://www.riverbankcomputing.com/pipermail/pyqt/ Another way to get answers to questions is to join the #pyqt IRC channel at freenode.net: irc://irc.freenode.net/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 + WebKit
On Friday 05 June 2009 21:33, dudekks...@gmail.com wrote: On 1 Cze, 22:05, David Boddie da...@boddie.org.uk wrote: I experimented a little and added an example to the PyQt Wiki: http://www.diotavelli.net/PyQtWiki/Usinga Custom Protocol with QtWebKit I hope it helps to get you started with your own custom protocol. David Thank You David for Your help. You made a piece of good work :) No problem. I've since found some issues with another example I've been working on, so I may well update that page soon. :-) David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 + WebKit
On Monday 01 June 2009 16:16, dudekks...@gmail.com wrote: On 31 Maj, 02:32, David Boddie da...@boddie.org.uk wrote: So, you only want to handle certain links, and pass on to WebKit those which you can't handle? Is that correct? Yes, I want to handle external links (out of my host) and links starting with download://... (my specific protocol). If you want to handle them in a different way to normal Web pages, it seems that calling setForwardUnsupportedContent(True) on the QWebPage is the way to do it. However, if you want to handle those links and present the content for the browser to render then you may need to override the browser's network access manager, as discussed in this message: http://lists.trolltech.com/pipermail/qt-interest/2009-March/004279.html I experimented a little and added an example to the PyQt Wiki: http://www.diotavelli.net/PyQtWiki/Using a Custom Protocol with QtWebKit I hope it helps to get you started with your own custom protocol. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt4 + WebKit
On Saturday 30 May 2009 17:39, dudekks...@gmail.com wrote: I need to grab clicked links in QWebView. Everything is fine when I use linkClicked() signal. LinkDelegationPolicy is set to DelegateAllLinks and there is a problem. If some site has Javascript my procedure receives QUrl from linkClicked, next calls: webView.setUrl(url) #Where url is received QUrl Certainly this method doesn't work. Site loads again (in most cases it's called http://mywwwsite.net/#). OK, so if I understand correctly, you don't know how to handle these special links if you use a delegation policy, and you would prefer it if they were handled by WebKit. As I use QWebPage::DelegateExternalLinks it happens the same, because my procedure grabs links with Javascript. I don't know how to cope with this problem. Maybe it's possible to set own policy in QWebPage.LinkDelegationPolicy? Or maybe some other method to grab protocol, host(if external or not) when user clicks link in webView? So, you only want to handle certain links, and pass on to WebKit those which you can't handle? Is that correct? David -- http://mail.python.org/mailman/listinfo/python-list
Re: any lib to extract pages form pdf and then merge?
On Tuesday 26 May 2009 06:47, oyster wrote: I want to extract some pages from vary pdf files, then write them with/witout rotation into one new pdf file. something likes this [...] I have tried pypdf, but it errs and exits on some of my pdfs(no, the files have no password) Maybe you could get in touch with the author to try and work around these problems. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Can't run PyQt apps with MacPython
On Wednesday 13 May 2009 17:53, Morad wrote: I recently got a new MacBook Pro with Leopard, and would like to develop using Python and PyQt. I installed the latest Qt SDK, updated MacPython to V 2.5.4 and then proceeded to install SIP and PyQt as described in Mark Summerfield's book on PyQt Programming. Everything went fine and none of the scripts complained. However when I want to run a demo app, I get the error message Fatal Python error: Interpreter not initialized (version mismatch?) / Abort Trap. Anybody can help? This page suggests a possible conflict between installed Python interpreters: http://aralbalkan.com/1675/comment-page-1 A post to the PyQt mailing list talks about the correct way to build from source, but it may not be relevant in this case: http://www.riverbankcomputing.com/pipermail/pyqt/2006-July/013766.html It may just be worth checking that SIP and PyQt were built and installed for the interpreter you expected. Failing that, you might want to ask this again on the PyQt mailing list: http://www.riverbankcomputing.com/pipermail/pyqt/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: stuck with PyOBEX
On Sunday 03 May 2009 10:33, alejandro wrote: Yes! I'll send you an updated version to try if you would like to test it. My mails to you keep getting returned, so I've put it here: http://www.boddie.org.uk/david/Projects/Python/PyOBEX/Software/PyOBEX-0.21.zip Please let me know if it works on Windows, and feel free to get in touch if you have any problems. David -- http://mail.python.org/mailman/listinfo/python-list
Re: stuck with PyOBEX
On Saturday 02 May 2009 14:25, alejandro wrote: I am having problems with connect() it says that it doesn't have sendall atribute. Error: Traceback (most recent call last): File novi_pokusaj.py, line 25, in module client.connect() File C:\Python25\lib\PyOBEX\client.py, line 356, in connect return Client.connect(self, header_list = [headers.Target(uuid)]) File C:\Python25\lib\PyOBEX\client.py, line 127, in connect response = self._send_headers(request, header_list, max_length) File C:\Python25\lib\PyOBEX\client.py, line 81, in _send_headers self.socket.sendall(request.encode()) AttributeError: BluetoothSocket instance has no attribute 'sendall' Exit Code: 1 Did you manage to run it under windows? I haven't tried to run it under Windows. I just assumed that BluetoothSocket would have the same API on both Linux and Windows. Looking around, it seems that this is something we can work around: http://svn.navi.cx/misc/trunk/laserprop/client/BluetoothConduit.py I'll send you an updated version to try if you would like to test it. David -- http://mail.python.org/mailman/listinfo/python-list
Re: stuck with PyOBEX
On Wednesday 29 April 2009 07:42, alejandro wrote: So I should connect trough pybluez and send with obex?? Yes, or you could try lightblue: http://lightblue.sourceforge.net/ I've updated PyOBEX to try and be a bit more flexible when it comes to Bluetooth socket implementations, so you might want to give that a try: http://pypi.python.org/pypi/PyOBEX If you use PyOBEX, you find devices with the bluetooth module (from PyBluez) then connect and send using PyOBEX: # Find device addresses. devices = bluetooth.discover_devices() # List services provided by a device with the given address. bluetooth.find_service(address=device_address) # Find the port used for the file transfer service. port = bluetooth.find_service(uuid=E006, address=device_address)[0][port] # List the files in the device's root directory. from PyOBEX.client import BrowserClient client = BrowserClient(device_address, port) client.connect() client.listdir() client.disconnect() Good luck! David -- http://mail.python.org/mailman/listinfo/python-list
Re: stuck with PyOBEX
On Tuesday 28 April 2009 18:34, Diez B. Roggisch wrote: This module asks the socket module for AF_BLUETOOTH... in the socket module there is no such thing as AF_BLUETOOTH. Could it be that the person that made PyOBEX modified his socket module and forgot to give his socket module? Or am I missing something? Maybe AF_BLUETOOTH stands for something that a programmer would know but I am a beginner so... Is there a OBEX module for Python on windows? AF_BLUETOOTH seems to be specific to *nix-systems. At least under debian and ubuntu, I've got it defined. Yes, it appears to be compiled into the socket module if the relevant Bluetooth library (libbluetooth) and header file (bluetooth.h) were available when Python was built. So it seems it is not supported under windows - you should consider the author if that's a mistake, or by design. By design, though a previous, unreleased version used the bluetooth module provided by PyBluez (http://code.google.com/p/pybluez/) which contains its own BluetoothSocket class before I released that the socket module could also support Bluetooth sockets. I guess I could change the package to use BluetoothSocket if Bluetooth support isn't provided by the user's socket module. David -- http://mail.python.org/mailman/listinfo/python-list
Re: cross compile Python to Linux-ARM
On Thursday 19 March 2009 17:54, jefm wrote: We are looking to use Python on an embedded Linux ARM system. What I gather from googling the subject is that it is not that straight forward (a fair amount of patching hacking). Nobody out there that has done it claims it is easy, which makes me worried. I think the hard part is often getting a working cross-compiler. The changes to Python are just inconvenient, not difficult. I haven't seen a description on porting Python 2.6 or 3.0 yet. Is it much different than for the earlier versions (the latest I have seem is Python 2.5). Does it matter whether Python is cross compiled to Linux 2.4 or Linux 2.6 ? Unless Python has been changed to rely on features only provided by Linux 2.6, it shouldn't matter. Of course, you need to make sure your toolchain matches the kernel on your device, and that may be a constraint you can't easily change. Can anyone point to a howto they know works well ? Not really. There are plenty of sites that claim to have good recipes for cross-compiling, but many of them are out of date. What are the chances of an 'officially' supported ARM-Linux Python distribution ? (or is it safer to wait for industrial spec Intel Atom boards to avoid the cross compilation altogether ? What would it take for the Linux version of Python to be easily cross compiled (i.e. would the Linux-Python maintainers be willing to include and maintain cross-compilation specific functions) ? There are tickets and patches in the Python bug tracker for this, waiting for people with enough time to review them. Here's a recent submission: http://bugs.python.org/issue1006238 Let's say we can get it done. How is the performance and stability of a working Python on an embedded ARM-Linux system ? It seemed OK to me the last time I tried this, but then I used to use Python on a non-Linux, 48MHz ARM system in the late 1990s and performance wasn't really a serious problem then, either. Does cross compiling Python automatically include the standard Python library, or is that yet another adventure ? Parts of it. I had problems with one or two modules, so I just excluded them from the build. David -- http://mail.python.org/mailman/listinfo/python-list
Re: HOWTO for setting up a PyQt project in Eclipse ?
On Thursday 05 February 2009 18:13, Linuxguy123 wrote: Does anyone know of a HOWTO for setting up a PyQt project in Eclipse ? I know about setting up a PyDev project, just wondering how to integrate the QtDesigner parts. For example, should I save the QtDesigner project in the root PyDev directory ? I'm not an Eclipse user, but I recently noticed that the Python(x,y) project uses (or at least refers to) both PyQt and PyDev. Maybe there's some useful information, or useful starting points, on these pages: http://pythonxy.com/help.php http://pythonxy.com/discussions.php David -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross platform compilation?
On Tuesday 03 February 2009 03:59, John Harper wrote: Before I try to reverse engineer completely setup.py, is there something obvious that needs to be done to get it to use the right tool chain? I think it's more complicated than that, though in an ideal world it wouldn't have to be that way. I created some patches for Python 2.4.4 a while ago to make it slightly easier to cross-compile it: http://chaos.troll.no/~dboddie/Python/Greenphone/ There were patches to solve similar issues with the build system floating around in the Python bug tracker. I had intended to help push those along a bit, but lack of time prevented me from doing so. The magic incantation that worked for me was this: export HOST_PLATFORM=i386 export TARGET_TOOLS=$SOME_DIR/gcc-4.1.1-glibc-2.3.6/arm-linux/bin export TARGET_PLATFORM=arm-linux CC=$TARGET_TOOLS/$TARGET_PLATFORM-gcc \ CXX=$TARGET_TOOLS/$TARGET_PLATFORM-g++ \ ./configure --prefix=$TARGETDIR --enable-shared --enable-unicode=ucs4 \ --build=$TARGET_PLATFORM --host=$HOST_PLATFORM where SOME_DIR and TARGETDIR are appropriately set, of course. I did experience issues with some extension modules, though. More generally, it seems like this would be something that lots of people would want to do. I'm surprised there isn't support for it built into the distributed version of Python, without having to hack all the setup files...? I suppose people don't explicitly configure projects for cross-compilation anymore, especially now that things like Scratchbox are used to fake the build environment: http://www.scratchbox.org/ That might also be worth looking at, but you really have to buy in to its way of working to use it fully, in my experience. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling Python-tk code from C/C++
On Tuesday 27 January 2009 18:29, Gabriel Genellina wrote: En Tue, 27 Jan 2009 07:42:01 -0200, Rajorshi Biswas rajor...@in.com escribió: Hello all, This is my first post to this mailing list. Our requirement is to invoke a Tkinter python panel from a C++ GUI app where both GUI windows would run in 2 separate threads. We have written a sample PyQt application which calls this Tk panel using something like this:class TkPanel(threading.Thread):def run(self): # call showPaneldef showPanel():# create window = Tk.Tk() window.mainloop()def start():t = TkPanel()t.start()Now we call this from our main python code:def startPanel(self): import tkPanel tkPanel.start() # this calls tkwindow.mainloop() in a separate thread.This works absolutely fine when the invoking app is Python. From the above description I don't see where PyQt is involved. Do you really want to mix Qt and Tk in the same application? I don't think they could coexist... It's been made to work before: http://www.froglogic.com/pg?id=Productscategory=tqsub=overview Since Rajorshi has posted this to the PyQt list and qt-interest, in addition to this list, maybe it's time to take a look at the problem more closely: http://www.riverbankcomputing.com/pipermail/pyqt/2009-January/021649.html Without being able to see behind the scenes at what is happening with each framework, we can only say that it looks like some threading issue (possibly just an implementation detail of either framework) is causing control to be returned to the interpreter from within the wrong thread. Maybe it's just an issue of competing event loops and Python C API usage in the extension modules. I found that, using Ubuntu 7.10, the windows stopped receiving repaint events, making it look like the application had frozen. Basically, I think some kind of Qt-Tk event loop integration is required if widgets from both frameworks are going to coexist within the same process. David -- http://mail.python.org/mailman/listinfo/python-list
Re: how to dock another application under Linux ?
On Thursday 18 December 2008 20:09, Stef Mientki wrote: Under windows it's fairly easy to capture an application and dock in to your own wxPython application, something like this: - start the external application from within wxPython - give the caption of the application a special name - find de windows handler of the applications mainform - tell the applications mainform, that some wxpanel is the parent I use this to dock VPython in wxPython. Is there a similar solution for Linux ( and Mac) ? On X11 systems, you can use the X11Embed protocol to do this. I would be surprised if wxWidgets doesn't have a component for this given that there's one for GTK+: http://library.gnome.org/devel/gtk/stable/GtkSocket.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.
On Friday 12 December 2008 02:05, Mudcat wrote: The drag is working up until the point I try to actually retrieve the data. At that point I get an unhandled Runtime Error saying no access to protected functions or signals for objects not created in Python. That's correct, retrieveData() is a protected function in C++ and the QMimeData object was created by the framework, not you, in this case. Obviously I am not retrieving them in the correct format. Does anyone know how to convert/retrieve the information into a Python list? You could use the data() method to get the serialized data then try to extract the list item-by-item using the QDataStream class, or perhaps PyQt has a convenience function to unpack the items. Alternatively - and this is a bit speculative - perhaps you can copy the data to another QMimeData object which you have created, and use its retrieveData() method to retrieve the items. You might get a more detailed response by asking on the PyQt mailing list: http://www.riverbankcomputing.com/mailman/listinfo/pyqt Hope this helps, David -- http://mail.python.org/mailman/listinfo/python-list
Re: is there really no good gui builder
On Sunday 09 November 2008 13:45, Ben Finney wrote: Duncan Booth [EMAIL PROTECTED] writes: Mr.SpOOn wrote: What's the problem with qt licence? You must purchase a Qt Commercial License from Qt Software or from one of its authorized resellers before you start developing commercial software. The Commercial license does not allow the incorporation of code developed with the Open Source Edition of Qt into a commercial product. This text is at URL:http://trolltech.com/products/appdev/licensing, for those following along at home. The above statement is confusing and misleading. There is nothing about the GPL that prevents commercial software; in fact, selling software to support development is positively encouraged. I agree that it's misleading, but it doesn't say anything about the GPL preventing commercial software. It's easy to read something into it that isn't there, though you could argue that it's implied somehow. Ideally, it would say, You must purchase a Qt Commercial License from Qt Software or from one of its authorized resellers before you start developing closed source software for distribution. [...] What that page says could be correct if, instead of falsely claiming that *commercial* software requires a separate license, it rather said that if you want to redistribute Qt with *restrictions* on the recipient additional to those in the GPL, you cannot use the GPL as the license. They offer a separate license (the confusingly-named ?commercial license?) that permits some additional restrictions on the recipient of your software. Probably. That page has been a source of controversy for some time. [...] It is a novel interpretation of the GPL. Qt Software have every right to impose this sort of condition, but it makes me want to avoid them. No, they have no such right to interpret the GPL this way; it would be entirely incompatible with the GPL since it would be an imposition of additional restrictions, resulting in work that could not legally be redistributed at all. If we're talking about the second sentence, it's not an interpretation of the GPL. It is a restriction of the commercial license. In fact, I don't think they are making such an interpretation, though their poorly-worded web page that you quoted certainly encourages readers to make such a false interpretation. Agreed. The compromise in the terms used (commercial vs. proprietary or closed source) is designed to encourage adoption of commercial licenses rather than explain the situation, perhaps because there's the fear that some developers won't pay attention to anything less than a strongly-worded warning. David -- http://mail.python.org/mailman/listinfo/python-list
Re: is there really no good gui builder
On Sunday 09 November 2008 20:08, Duncan Booth wrote: So are the references to 'Qt Open Source License' on the website misleading? It depends on whether you assume that there's a separate license by that name. In practice, it's a placeholder for the licenses it's available under: The Open Source Edition is freely available for the development of Open Source software governed by the GNU General Public License versions 2 and 3 (?GPL?). The Qt Commercial Editions must be used for proprietary, commercial development. -- http://trolltech.com/products/appdev/licensing However, quickly skimming that page, I can see how you could reach the following conclusion: It seems to me that the claims on the website are very carefully worded to say that you have to develop code under the GPL (or other open source license), not that Qt itself is released under the GPL, and given the additional conditions they impose I would have said at best it is GPL + lots of other restrictions. No, the Qt Open Source Edition is GPL version 2 or version 3 (your choice) with exceptions (additional permissions) that let you link things to it that you couldn't if it was pure GPL. It it was GPL + restrictions, it wouldn't be GPL compatible (you can't add restrictions to the GPL, as I understand it). More information can be found here: http://doc.trolltech.com/4.4/gpl.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGUI as a standard GUI API for Python?
On Tuesday 14 October 2008 12:55, lkcl wrote: hello_loader.py is the main err um i just double- checked, so i'd be able to advise you and... err... the problem i described (with the GridTest) seems to have... gone away!! There are lots of references to PyGTK classes in there. Is there a way to select Qt instead of GTK? however, clicking too fast _did_ end up with fifty little windows of text (!) and the respect for text boundaries is definitely broken - shrink the window to 300 x 400 with the kitchensink example (which is where i stopped and moved to webkit, so all the _other_ examples prior to that will work) and you'll see that the text in a column down the left hand side end up all overlapping each other. so, you get to see the top few pixels of each word. Hacking the code a bit, I can run the hello_loader.py example. The items on the left do indeed overlap. It looks like the minimum size of the labels aren't being respected for some reason. if there's a way to enforce the displaying of text - for the _text_ to say i need to be a total area of X in order to display my words. if you make my width too small, i will _force_ my height to be larger as i wrap the text. Yes, there are ways to relate the height of a widget to its width, and there may well be a way to do that for a standard text widget, but it might involve some experimentation with the underlying text document. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGUI as a standard GUI API for Python?
On Monday 13 October 2008 11:42, lkcl wrote: i don't know if it _was_ detached from the layout, but it was definitely still visible. see http://pyjs.org/examples/gridtest/output/GridTest.html for the example i was porting to pyqt4. each time i clicked Next, a new set of N,N would be _overlaid_ on top of the old ones, even though i was doing removeItem(). Yes, it just sounds like you needed to delete the layouts after removing them. the code's at http://lkcl.net/pyjamas-desktop/pyqt4.tgz I might take a look later in the week if the code in there is runnable. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGUI as a standard GUI API for Python?
On Saturday 11 October 2008 11:19, lkcl wrote: pyqt4 has the concept of layouts. a layout can be a horizontal layout, vertical, grid, and you can even specify the percentage or ratio of the width (or height) that individual cells can use. you attach a layout to a widget; you can attach layouts to layouts. you can remove layouts from widgets. what you _can't_ do is _remove_ layouts from layouts. You can remove layouts from layouts with the QLayout.removeItem() method. disappointingly, this was the killer, for me. it was just getting... too complicated. i had already encountered advice that, in order to implement the means to move widgets around, i should remove *everything* and redo the layout. it just... wasn't happening. You'll need to delete the contents of those layouts yourself - maybe that's the real problem. You shouldn't need to redo the whole layout structure, though. plus, i think also that there are problems, again, with the HTML layout: you can't _entirely_ stop text-squashing. so, although pyqt4 was _better_, it still wasn't _enough_. These days, you'd probably use PyQt4's WebKit integration for HTML rendering, anyway, though I imagine that it doesn't help you much if you're already using WebKit directly. [...] QT4 lacks crucial layout management (layouts not being deletable from layouts), flow-layout, and variable-sized rich text. they _do_ have proportional subdivision of layouts (allowing you to specify a fixed width on one cell and a percentage width on others) but it is very clumsy. You can write your own layouts as well, but maybe that's more work than you're prepared to do, especially now that you seem to have settled on WebKit as your toolkit. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGUI as a standard GUI API for Python?
On Saturday 11 October 2008 21:40, lkcl wrote: On Oct 11, 3:31 pm, David Boddie [EMAIL PROTECTED] wrote: You can remove layouts from layouts with the QLayout.removeItem() method. yes... it didn't work. a layout within a layout - i think it was a QHorizontalLayout within a QGridLayout - didn't want to be removed. it's probably a bug. Was it detached from the layout, but still visible? [...] in order to pull in flash plugins and other material, the accepted method in pygtk2 is to use python-gtk-mozplugger. that's crazy. embed an _entire_ web browser, just to pull in a flash component. likewise, for doing a single bit of HTML, in pyqt4 and/or pygtk2, pull in a 17mb binary dependency using python-webkit-qt4 and/or pywebkitgtk, _just_ to display _one_ bit of HTML text?? _that's_ crazy. Sure, if all you want to do is display one bit of HTML text. It always helps if you choose the most appropriate libraries for each task. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Open Office
On Wednesday 17 September 2008 21:59, Terry Reedy wrote: Hartmut Goebel wrote: Terry Reedy schrieb: The API docs are a bit hidden on the webpage. Here is the link: http://opendocumentfellowship.com/files/api-for-odfpy_2.odt I wrote my comment *after* looking at the above, which I found easily enough. After 7 pages of (helpful) explanatory text, there follow 88 pages with hundreds of entries like this: [...] which are translated to a more readable form from the Relax-NG schema (formal specs) in the standard. But I have no idea what a Ruby property is in this context. It would be much like reading the grammar entries in the Python Reference without the explanatory text that follows. I started using odfpy for a project, and I found that I spent a lot of time flicking back and forth in the API manual and cross-referencing it with the specification. The simple examples were useful enough to get started with, but I could have used more information about how to use certain classes and what elements and attributes they required. I also wanted to add equations to the documents I was producing and that requires some knowledge of MathML. Certainly, it's not a very high level API for documentation creation - you need to know something about the format to be able to construct documents. David -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI programming with python
On Saturday 13 September 2008 01:04, sturlamolden wrote: On Sep 12, 8:33 pm, [EMAIL PROTECTED] (Al Dykes) wrote: OK, what are my choices for an IDE/GUI development tool that runs on XP? [...] Cpython with PyQt: BlackAdder People using this combination apparently prefer Eric, these days: http://www.die-offenbachs.de/eric/index.html More suggestions can be found on this page: http://wiki.python.org/moin/IntegratedDevelopmentEnvironments David -- http://mail.python.org/mailman/listinfo/python-list
Re: configure kdevelop for python
On Sunday 31 August 2008 10:29, Sindhu wrote: am a newbie to python language and kdevelop, so i would like to know how to configure kdevelop for python programming? complete with a debugger? Maybe asking on the kdevelop mailing list will yield a helpful answer: http://lists.kde.org/?l=kdevelopr=1w=2 David -- http://mail.python.org/mailman/listinfo/python-list
Re: Genetic programming: pygene, pygp, AST, or (gasp) Lisp?
On Sunday 20 July 2008 09:52, John Ladasky wrote: Is there a way to interface Lisp to Python, so that I can do all the interface programming in the language I already know best -- and just do the genetic parts in Lisp? I haven't seen exception handling in Lisp, a feature I've come to love in Python. Since it is fairly easy for a randomly-generated program to generate illegal output (I already know this from my initial experiments in Python), I don't think I can live without exception handling. Just searching the Web for Python and Lisp yielded some interesting projects: http://www.biostat.wisc.edu/~annis/creations/PyLisp/ http://www.livelogix.net/logix/ I've no idea if they're really that relevant to your problem, but they might lead somewhere useful. David -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe, PyQT, QtWebKit and jpeg problem
On Monday 23 June 2008 15:02, Carbonimax wrote: If I copy the dll in the dist directory, and I use QPluginLoader() and load(), it does work in the .py but it doesn't in .exe made with py2exe my code : dll = QPluginLoader(path_to_dll) res = dll.load() res == true in the .py res == false in the .exe :-/ Maybe py2exe builds executables that can't load DLLs in this way. In any case, it might be worth asking about this on the PyQt mailing list http://www.riverbankcomputing.com/mailman/listinfo/pyqt or on the py2exe mailing list https://lists.sourceforge.net/lists/listinfo/py2exe-users where there may well be people who have solved this problem independently. David -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe, PyQT, QtWebKit and jpeg problem
On Friday 20 June 2008 17:24, Phil Thompson wrote: On Fri, 20 Jun 2008 08:04:57 -0700 (PDT), Carbonimax [EMAIL PROTECTED] wrote: I have a problem with py2exe and QtWebKit : I make a program with a QtWebKit view. If I launch the .py directly, all images (jpg, png) are displayed but if I compile it with py2exe I have only png images. No jpg ! No error message, nothing. Have you a solution ? Thank you. At a guess, the JPEG support is implemented as a Qt plugin which you are not including. Yes, that would appear to the be most obvious cause. See here for another report about this: http://lists.trolltech.com/qt4-preview-feedback/2008-03/msg00064.html David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt - How to prevent a dialog being resized?
On Apr 1, 12:12 am, Kelie kf9... at gmail.com wrote: My question is as subject. I tried something like this and it doesn't work. def resizeEvent(self, event): self.size = event.oldSize() Any hint? If you use the Qt designer you can set the minimum- and maximum window size to the same value, which disables resize as well. Tested with Qt4 on Linux 2.6. But I'm pretty sure that there could be a much cleaner way to do this. You can give a window a fixed size by calling its setFixedSize() method, but this requires you to decide its exact size in pixels. A better alternative is to call setSizeConstraint() on the window's layout with a value of SetFixedSize: http://www.riverbankcomputing.com/Docs/PyQt4/html/qlayout.html#SizeConstraint-enum This way, the layout will figure out how much space the window requires and force it to remain at that size from then on. David -- David Boddie Lead Technical Writer, Trolltech ASA -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQT / QDate / QTableWidget
On Wed Mar 26 15:13:09 CET 2008, wrightee wrote: My server gives me a string y[0]: 20080327, which I convert to a QDateTime object using: x=QDateTime.fromString(y[0],mmdd) Printing x.toString(dd-mm-) gives me what I would expect - 27-03-2008 Strange. You should really be using dd-MM-. Maybe this is why QDate isn't behaving as you would expect - see below. What I'm trying to do though is add this to a QTableWidget item to create a date sortable column; I'm using this: if type(y)==QDateTime: item=QTableWidgetItem() item.setData(Qt.DisplayRole,QVariant(y)) This should work fine. BUT.. I'm adding 90 dates going back from today and getting values that look like this: 27/01/2007 00:12 28/01/2007 00:12 29/01/2007 00:12 30/01/2007 00:12 31/01/2007 00:12 01/01/2008 00:01 01/01/2008 00:02 01/01/2008 00:03 etc Right. You can see the date and time because you're using a QDateTime object. I tried using QDate but couldn't seem to be able to get QDate.fromString to create an object at all. This may have something to do with the format string you tried. Could someone please advise where I'm going wrong, the end result should be a column in my QTableWidget formatted dd/mm/ that can be sorted as dates, not strings, and originate from data formatted MMDD Just use QDate objects instead of QDateTime objects and it should all just work. Good luck! David -- David Boddie Lead Technical Writer, Trolltech ASA -- http://mail.python.org/mailman/listinfo/python-list
EuroPython 2008 - Any interest in tutorials?
As many of you may be aware, preparations for EuroPython 2008 - the European Python community conference - are under way. For the second year running, the event will be held in Vilnius, Lithuania, with the main programme taking place on Monday 7th, Tuesday 8th and Wednesday 9th July. Those of us involved with the conference are looking for ways in which we can make the event more interesting for beginners and experts alike. One way in which we could do this, particularly for people who are learning Python, is to allocate time for tutorials. This approach appears to be popular at conferences like PyCon and PyCon UK, but isn't something we normally do at EuroPython, though there are often talks are aimed at beginners in the schedule. What we'd like to know is: * Is this something that you would like to see? * Would you be interested in giving a tutorial? * Which subject would you be interested in hearing/talking about? If you answered yes to either of the first two questions, please feel free to add suggestions for tutorials, either as a participant or as a speaker, to this page on the EuroPython Wiki: http://www.europython.org/community/Talk_Suggestions If you're interested in participating in EuroPython this year in any way, please come and join us on the europython mailing list http://mail.python.org/mailman/listinfo/europython or visit this page on the EuroPython Web site: http://www.europython.org/community/Participants Hope to see some of you there! David Boddie - EuroPython 2008 participant :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt, Cannot send events to objects owned by a different thread?
On Sun Nov 25 15:22:24 CET 2007, Alexander Tuchacek wrote: i try to adress an qt object self.statusbar.showMessage(rtt %s % (n.rtt)) in an callback function, comming from a shared lib importet by ctypes, on osx this works wonderfull when i run the same code on linux (ubuntu gutsy), i get this core dump, ok, i understand that the problem is, that i cant speak to the qt thread, but why does it work on osx? Maybe the implementation of the library is different on OS X. You need to give us more enough information to work with. shall i recompile python? pyqt or sip? without threads? could somebody give me a hint what to do best? how can i call a qt object in an c-lib callback? You can either construct some sort of event handling mechanism or use signals and slots. Personally, I'd use signals and slots for this, if possible. The idea would be to set up a connection between your callback code and the status bar's showMessage() slot. Then you would only have to emit that signal to update the status bar. David -- http://mail.python.org/mailman/listinfo/python-list
Re: OPLC purchase period extended
On Sat Nov 24 19:30:03 CET 2007, Grant Edwards wrote: The XO laptop comes with a built-in Python IDE, so everybody on c.l.p ought to have one... A nice idea in theory, but... 2. XO laptops will be shipped only to G1G1 participants and only to the street addresses they provide for themselves in the fifty United States, Puerto Rico, Guam, the U.S. Virgin Islands, the District of Columbia and Canada. [http://laptopgiving.org/en/terms-and-conditions.php] David :-( -- http://mail.python.org/mailman/listinfo/python-list
Re: Contextmenu in a QTreeWidget with PyQT
On Wed Nov 21 19:46:48 CET 2007, blaven wrote: I apologize in advance if this is not the correct forum to ask this and if someone knows a better place, please let me know. There is a mailing list for PyQt/PyKDE issues: http://www.riverbankcomputing.com/mailman/listinfo/pyqt It's not a problem to post questions here - some of the people on that list also read python-list/comp.lang.python. But, I am trying to create a Contextmenu (a right-click popup menu) from within a QTreeWidget. I tried setting the contextMenuPolicy to CustomContextMenu and then handling the signal customContextMenuRequested() but nothing seems to be happening. ie: self.tree = QTreeWidget() self.tree.setContextMenuPolicy(Qt.CustomContextMenu) self.connect(self.tree,SIGNAL('customContextMenuRequested()'), self.newContext) You need to specify the parameters that the signal passes in the signature: self.connect(self.tree,SIGNAL('customContextMenuRequested(QPoint)'), self.newContext) In this case, a QPoint object is passed; see the documentation for more details: http://www.riverbankcomputing.com/Docs/PyQt4/html/qwidget.html#customContextMenuRequested Does anyone have a sample or tutorial on how to do this? One other question, whe I right click, it changes the selection in the TreeWidget, would I need to remove the handler for right clicks to get the menu? With your custom context menu enabled, you may find that right clicks no longer cause the selection to change. If it does, post another question, either here or on the PyQt/PyKDE list, and I'm sure someone will help you out. Good luck! David -- http://mail.python.org/mailman/listinfo/python-list
Re: Drawing charts in Qt
On Tue Nov 6 15:46:07 CET 2007, Michel Albert wrote: [PyQwt and matplotlib] PyQwt looks much more interesting, but I have trouble installing it. On my machine it complains that sipconfig has no attribute '_pkg_config'. Is the configuration script finding the sipconfig file for SIP 3 or SIP 4? In the end the application should also run on Windows boxes. And I suppose as long as I use the right versions and use the precompiled binaries, I should get it at least installed. But the thing with the version numbers looks like some major lottery game to me. If one of the elements in the chain (be it Qt, or Qwt) release new versions and the available binary distributions get out of sync, future support for the written application becomes foggy. I'm not sure what you mean. Can you explain? Has anyone ever successfully used these graphing libraries with PyQt? Or are there other graphing libraries available? In fact, my needs are modest. A Line- and Bar-Chart would solve the majority of problems. I've installed PyQwt for PyQt4 and tried the examples, but only out of curiosity because I wasn't writing an application that needed those facilities at the time. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Low-overhead GUI toolkit for Linux w/o X11?
On Sat Nov 3 20:45:54 CET 2007, Grant Edwards wrote: I'm looking for GUI toolkits that work with directly with the Linux frambuffer (no X11). It's an embedded device with limited resources, and getting X out of the picture would be a big plus. The toolkit needs to be free and open-source. So far, I've found two options that will work without X11: 1) QTopia (nee QT/Embedded). I assume that I can probably get PyQT to work with the embedded version of QT? Qtopia Core (formerly known as Qt/Embedded) should be fairly painless to get working, though the embedded-specific features aren't supported by a plain PyQt4 build. However, it is possible to get bindings for it up and running - I've done it twice for different versions of Qtopia Core http://www.diotavelli.net/PyQtWiki/PyQt4_on_the_Qtopia_Greenphone so it should be possible to get something working for the latest version. You don't really have to worry too much about having all the bells and whistles wrapped for use from Python, anyway. 2) PySDL or PyGame. I'm not really sure what the differences are between those two. The latter seems to be a little more active. Are there any traditional GUI widgets available for these two? PyGame is definitely more visible than PySDL. You might find something you can use in the list of libraries for PyGame: http://www.pygame.org/tags/libraries There's also a list of gui tagged projects: http://www.pygame.org/tags/gui Google found me this thread from a few years ago: [...] Which mentions the same two choices and confirms that PyQt at worked at one time with Qt/E (which would lead one to believe it could be made to work with QTopia). I guess I should be pushing my patches for PyQt4 back upstream, or at least publishing them somewhere. I suppose it would also be useful if I looked at making them work with a recent version of PyQt4 and made sure that any new widgets in Qtopia Core 4.3 are handled by the configuration system. This lets you exclude features you don't need in order to reduce library sizes. If you're interested in using PyQt4, I'll add an item for these changes near the top of my to do list. If not, I'll probably get around to doing it, but it might not happen soon. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Low-overhead GUI toolkit for Linux w/o X11?
On Sun Nov 4 03:22:27 CET 2007, Grant Edwards wrote: I think we're definitely going to try to evaluate Qtopia on our platform to see if it's any quicker and smaller than wxWidgets/GTK+/X11. I guess that evaluation doesn't need to use Python -- in theory we sould be able to compare performance of equivalent C/C++ apps running on wxWidgets/GTK+/X11 and on QTopia. Good luck with that. Just remember to read the guide to configuring features in Qtopia Core so you don't build in things you don't need: http://doc.trolltech.com/4.3/qtopiacore-features.html The overview page might also be useful to you: http://doc.trolltech.com/4.3/qtopiacore.html David -- http://mail.python.org/mailman/listinfo/python-list
PyQt with embedded python in Qt App
On Fri Nov 2 12:59:48 CET 2007, Bart. wrote: Or I want to use PyQt in scripts to have similar gui for plugins written in python Or I want to extend application by scripts with PyQt. Or better question: How to easy add python scripting in Qt application and have almast all objects of app accesible in scripts? Kross could be good solution? You can use PyQt, Kross or PythonQt for this, but only PyQt will give you a comprehensive API out of the box. There is code in the PyQt source distribution that shows how to set up the Python interpreter inside a C++ plugin and import modules - it's used to load custom Python widgets into Qt Designer. Look at the designer/pluginloader.cpp file to get an idea of what you need to do. There are simpler ways to initialize Python, but this code should be helpful if you want to extend what you've done at a later time. David -- http://mail.python.org/mailman/listinfo/python-list
Re: fclient project seeking co-coders
On Sun Oct 28 11:49:17 CET 2007, Jürgen Urner wrote: I Just recently registered a project fclient to sourceforge.net [http://sourceforge.net/projects/fclient]. fclient is intended to become desktop client for the freenet [freenetproject.org] network written in python and Qt4. It sounds like an interesting project. fclient is very alpha, in fact only parts of the freenet client protocol are curently implementated and loads of work ahead. But I would appreciate very much finding interested co-coders to take part in the project. Me, I am no professional coder, but an enthusiast with one or the other year of python (and Qt) experience. If interested in the project (and freenet), feel free to drop a mail to the users mailing list at the project page. If you need advice on parts of the implementation, there are plenty of Python and Qt experts on the PyQt mailing list: http://www.riverbankcomputing.com/mailman/listinfo/pyqt If you're trying to avoid subscribing to additional mailing lists, don't worry: quite a few of us read python-list/comp.lang.python as well. Incidentally, you might find it useful to add your project to the list of application on the PyQt Wiki: http://www.diotavelli.net/PyQtWiki/SomeExistingApplications David -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt ProgressBar
On Mon Oct 15 14:24:09 CEST 2007, luca72 wrote: Hello i have made anly one test like this: from time import sleep barra = QtGui.QProgressBar() barra.setMinimum(0) barra.setMaximum(10) for a in range(10): sleep(1) barra.setValue(a) app.processEvents() But the bar remain fix to 0% don't increase. can you tell me how to prooced Can you post a complete runnable code example, either here (if it's short enough) or to the PyQt mailing list? Thanks, David -- David Boddie Lead Technical Writer, Trolltech ASA -- http://mail.python.org/mailman/listinfo/python-list
Re: Cross-platform GUI development
On Fri Oct 12 12:30:13 CEST 2007, Nick Craig-Wood wrote: I'd recommend wxPython over those becase 1) native look and feel on all platforms 2) doesn't require expensive licensing for non-commercial apps (QT) Expensive licensing is not required if you use the GNU General Public License (version 2) for your software, or a license that falls under the Trolltech GPL Exception: http://doc.trolltech.com/4.3/gpl.html 3) Isn't a pain to install on windows (GTK) That said, times change and 1-3 may have changed since I last looked at it! Yes, times have changed. (Other people in this thread have addressed points 1 and 3.) David -- http://mail.python.org/mailman/listinfo/python-list
Re: How to display a videostream in the PyQt GUI by a efficient way
On Sun Sep 30 09:10:40 CEST 2007, Kivilaya wrote: I read the method in the given link and learn a lot from it. I'll try to display the data inside a QWidget directly instead of the current way. But I still have a question, is there any way to make the displaying of RGB data in a QWidget more quickly. You can set certain flags to ensure that the widget isn't being updated or painted on too often. See the WA_OpaquePaintEvent and WA_NoSystemBackground flags: http://www.riverbankcomputing.com/Docs/PyQt4/html/qt.html#WidgetAttribute-enum The problem may be related to the conversion process rather than the time it takes to display the image. You mentioned that you were obtaining the images as PIL Image objects, but these need to be converted to QImage or QPixmap objects, so the raw data from the camera is being converted at least twice before it reaches the screen! In fact, my work is to make a gui for displaying my partners'experimental results to our teacher, the source video is no need to be encoded to mpeg or h264 format, so I get the video from camera in the raw format and display them without encodeing or decoding process. Which operating system is this on? (I'm guessing that it's Windows because you mentioned the videocapture module.) As my partners will do some experiments on the raw data, maybe add a mark to label some area in the current frame, or change some part of it, I get every frame as a picture before they process the picture data, and then display the picture after their process. So, do you intend to process the video and store it in a file, or do you want to make these changes on a live video stream? But displaying the pictures one by one in my current way is so slow, I'm afraid that time spend on it is too long and the displaying of results will be discontinuous. So I think maybe there is another way to show these pictures. Is there another way of getting the data from the camera? Perhaps the author of videocapture has some ideas that can help you speed up the conversion and rendering process. Maybe the Device.getBuffer() function will provide data that can be passed directly to QPixmap.loadFromData(). David -- http://mail.python.org/mailman/listinfo/python-list
Re: How to display a videostream in the PyQt GUI by a efficient way
On Sat Sep 29 05:12:25 CEST 2007, kivilaya wrote: As required, I need to get a videostream from a camera, and process every frame to add some information on it, and then display the frame in a PyQt GUI. But I don't know how to display the videostream in the PyQt GUI by a efficient way. Currently, I do these like this: 1. Get the videostream by the videocapture module (a useful module written by Markus Gritsch) in the format of PIL images; This sounds interesting. I wasn't aware of that module. 2. Process every PIL image and add the information; 3. Convert every PIL image to QPixmap and display it using QLabel.setPixmap. This could be quite inefficient, though I think there's some support for Qt's image classes in PIL these days. I think it is a very inefficient way, but I don't known how to display the videostream in other ways, so I need your help, Thanks! PS:I do it with Windows XP, Python 2.5.1, PyQt4.3.0 If you're using a commercially-licensed Qt library, you'll have access to the ActiveQt classes that can be used to embed ActiveX controls: http://doc.trolltech.com/4.3/activeqt.html Otherwise, you might find this recent thread on qt-interest to be of interest: http://lists.trolltech.com/qt-interest/2007-09/msg00806.html I also tried to document ways to do this on the PyQt/PyKDE Wiki: http://www.diotavelli.net/PyQtWiki/Multimedia_Resources David -- http://mail.python.org/mailman/listinfo/python-list
Script to extract text from PDF files
On Wed Sep 26 15:06:54 CEST 2007, byte8bits wrote: On Sep 25, 10:19 pm, Lawrence D'Oliveiro l... at geek- central.gen.new_zealand wrote: This is inherent in the nature of PDF: it's a page-description language, not a document-interchange language. Each text-drawing command can put a block of text anywhere on the page, so you have no idea, just from parsing the PDF content, how to join these blocks up into lines, paragraphs, columns etc. So (I'm not being a wise guy) how does pdftotext do it so well? There's a little information on that online: http://www.glyphandcog.com/textext.html You would need to look at the source code to see exactly what it does. The text I can extract from PDFs is extracted as it appears in the doc. Although there are various ways to insert and encode text in PDFs, it's also well documented in the PDF specifications (http:// www.adobe.com/devnet/pdf/pdf_reference.html). Just because inserting and encoding is well documented doesn't mean that the reverse processes are easy. :-/ Going back to pdftotext... it works well at extracting text from PDF. I'd like a native Python library that does the same. Maybe you should look at the source code for pdftotext, if that's an option. This can be done. And, it can be done in Python. I've made a small start, my hope was that others would be interested in helping, but I can do it on my own too... it'll just take a lot longer :) Can I suggest that you approach one or more authors of the existing Python PDF solutions and work with them on this? There are at least four PDF parsers written in Python out there. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Script to extract text from PDF files
On Wed Sep 26 23:50:16 CEST 2007, byte8bits wrote: On Sep 26, 4:49 pm, Svenn Are Bjerkem svenn.bjer... at googlemail.com wrote: I have downloaded this package and installed it and found that the text-extraction is more or less useless. Looking into the code and comparing with the PDF spec show a very early implementation of text extraction. Luckily it is possible to overwrite the textextraction method in the base class without having to fiddle with the original code. I tried to contact the developer to offer some help on implementing text extraction, but he didn't answer my emails. That's disappointing to hear, but it's understandable. I must have one or two outstanding requests to add features to pdftools from a year ago. I keep meaning to look into making the necessary changes, but it's not something I'm looking forward to. Well, feel free to send any ideas or help to me! It seems simple... Do a binary read. Find 'stream' and 'endstream' sections. zlib.decompress() all the streams. Assuming that they're FlateEncoded... Find BT and ET markers (Begin Text End Text) and finally locate the parens within those and string the text together. Which works fine if the generator put in space characters. Otherwise, it seems to me that you need to figure out where any spaces should go. This works great on 3 out of 10 PDF documents, but my main issue seems to be the zlib compressed streams. Some of them don't seem to be FlateDecodeable (although they claim to be) or the header is somehow incorrect. But, once I get a good stream and decompress it, things are OK from that point on. Seriously, if you have ideas, please let me know. I'll be glad to share what I've got so far. You need to take a good parser and work on a higher level text extraction library. Not many people seem to be interested. I'll stop adding to this thread... I don't want to beat a dead horse. Anyone interested in helping, can contact me via emial. On the contrary, lots of people are interested in this sort of thing: http://phaseit.net/claird/comp.text.pdf/PDF_converters.html http://sourceforge.net/projects/pdfplayground http://www.adaptive-enterprises.com.au/~d/software/pdffile/ http://pybrary.net/pyPdf/ http://www.boddie.org.uk/david/Projects/Python/pdftools/ I discussed working with the author of pdfplayground, but things never really got going. I'd like to be part of a team working on a PDF library for Python, but my views on software licensing mean that I'd prefer to use a strong copyleft license rather than the permissive licenses found attached to most of the above libraries. David -- http://mail.python.org/mailman/listinfo/python-list
Re: building a GUI
On Mon Sep 24 00:08:09 CEST 2007, stef mientki wrote: Phil Thompson wrote: On Sunday 23 September 2007, stef mientki wrote: Could well be, but I never looked at PyQt seriously, because of their weird license. It's not weird. It's either GPL or proprietary. Your choice. That's as complicated as it gets. This is what I find weird: == quote == Trolltech's commercial license terms do not allow you to start developing proprietary software using the Open Source edition. == end quote == Well, if you know you're going to be developing proprietary software, what on earth are you doing with the Open Source edition? OK, perhaps by asking that rhetorical question I'm simplifying people's reasons and motives for using Open Source (and in this case Free/Libre) software to develop tools or solutions that they later want to release as closed, proprietary products. There are lots of ways people can end up in that position, of course. Some people find their way there by accident; others know what the situation is going to be well in advance... In any case, I think it's useful to be clear about what each license does or does not allow, especially if this leads to people making informed decisions well before they learn about the consequences. In this case, the terms of the commercial license place certain demands on the licensee, just as with many other commercial licenses. If someone develops a product using a GPL-licensed library, they can always release that product under the GPL, even if that's not what they had in mind when they started. ;-) David -- http://mail.python.org/mailman/listinfo/python-list
QPicture and Qpainter PyQt4
On Mon Sep 17 09:29:43 CEST 2007, luca72 wrote: class PictureFrame(QtGui.QFrame): def __init__(self, parent = None): QFrame.__init__(self, parent) picture = QtGui.QPicture() def paintEvent(self, event): picture.load('dis.pic') gr = QtGui.QPainter() gr.begin(self.frame) gr.drawPicture(0, 0, picture) gr.end() But nothing is paint. Can you give me some help You should probably be painting on self instead of self.frame. It may not be related to your problem, but why don't you store the picture in self.picture rather than the local picture variable? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Co-developers wanted: document markup language
On Fri Aug 24 11:04:33 CEST 2007, Torsten Bronger wrote: Paul Rubin writes: TeX/LateX have been around forever and are well established standards, as awful as they are. Why do we want ANOTHER markup language? Well, because they are awful. ;-) I don't see that there is a bunch of already existing projects, in fact, I don't see anyone challenging LaTeX at all. However, competition is a good thing, and I think there are enough aspects about LaTeX that can be done better so that this project is worth being done. There are alternatives to LaTeX if you are prepared to look for them. One of these is Lout: http://lout.sourceforge.net/ Another option is to use TeX, but with Python as an alternative macro language: http://www.pytex.org/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Adventure-Engines in Python
On Mon Aug 13 11:33:14 CEST 2007, Wildemar Wildenburger wrote: Are there any? I've set out to make an adventure game and now I'm trying to find a set of python-modules to help me do that. I know of the usual non-python suspects (AGAST, AGS, Wintermute, ...) and while I they are really good, I'd like one that is cross platform. I've found pyScumm and pyAdv but both don't seem to be ready for use yet. So are there any usable engines written in python? It's been a while since I looked at anything like this, but I seem to remember two Python powered engines: PAWS and PUB. http://py-universe.sourceforge.net/ http://members.nuvox.net/~zt.wolf/PAWS.htm If you want to write adventures with more graphics and less text, you could do worse than looking at existing projects and solutions written with Pygame: http://www.pygame.org/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Best programs written completly in Python
On Sun Aug 5 14:44:55 CEST 2007, Franz Steinhäusler wrote: I'm only interested to have a list, or even help to extend an existing one. If the main criterion is that the programs are written in Python then surely the PythonInfo Wiki is the place for such a list: http://wiki.python.org/moin/Applications May I suggest that you extend this one? David -- http://mail.python.org/mailman/listinfo/python-list
Re: [python-list] pdf read write
On Fri Jul 27 15:35:02 CEST 2007, Hyunchul Kim wrote: How can I read a pdf file and add invisible comment? I want to make a script which read a pdf file and add tags inside the file invisibly. Then, I will make a script for managing tags of given pdf files. I know referencer can manage tags for pdf file but it seems store tag information to additional file outside pdf file. Any suggestion are welcome. pyPdf may do some or all of what you are asking for: http://pybrary.net/pyPdf/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Scope or PyQt question
On Thu Jul 26 18:00:44 CEST 2007, dittonamed wrote: On Jul 26, 10:15 pm, Stargaming stargam... at gmail.com wrote: Answering from a non-Qt point of view (ie. I don't know if there were cleaner ways using Qt stuff), you have to bind p somewhere not local to the function. Any attribute of `self` (that's hopefully not used by QMainWindow) should be fine. [...] I was having trouble getting that to work and thought it because of event driven nature of gui/qt programming. But i'll give it another go anyway .. any examples? ;-) from qt import * class Form2(QMainWindow): def __init__(self,parent = None,name = None,fl = 0): QMainWindow.__init__(self,parent,name,fl) self.statusBar() def playAudio(self): self.p = QProcess(self, 'player') playcmd = '/usr/bin/play' filename = 'song.ogg' self.p.addArgument(playcmd) self.p.addArgument(filename) self.p.start() def stopAudio(self): self.p.kill() Im wondering what the right way to do this is - the Qt way, or is what you mentioned in fact the right way? Can i access the QObject another way or am i barking up the wrong tree? If you store the process in the instance of Form2, you don't need to access it via the object tree. Most Qt programs (in C++) would also use the same approach. You _can_ access the process via the object tree, as you discovered - it's just less convenient to do it that way. Just to satisfy your curiosity, let's look at your code again: ''' #This is just to show that i can see the object, though i #dont know how to access it #the output shows the QProcess object by name... # but how do i reference it?? allobjs = list(QObject.objectTrees()) for obj in allobjs: objName = QObject.name(obj) if objName == 'Form2': print QObject.children(obj) ''' When you obtain the Form2 instance, you could inspect its children, testing whether each one is a QProcess object with either Python's isinstance() function or QObject's inherits() method. Alternatively, you could use QObject's queryList() method or the qt_find_obj_child() function. With PyQt4, QObject has a findChild() method to perform these kinds of searches. Still, I'd recommend just keeping a reference to the process in your Form2 instance. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-URL! - weekly Python news and links (Jul 16)
On Wed Jul 18 23:20:51 CEST 2007, Cameron Laird wrote: Kay Schluehr kay.schluehr at gmx.net wrote: Not sure if it's important enough to be mentioned in weekly Python news but Europython 2007 actually happened and took place in Vilnius. *I* sure think it's important; is there a summary or narrative from the event you recommend? I've started to collect reports, photos and videos from the conference on the relevant PythonInfo Wiki page: http://wiki.python.org/moin/EuroPython2007 There's no definitive report out there, as far as I can tell. I imagine that everyone is getting their strength back after a week of talks, hacking, sightseeing and socialising. :-) David -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory leak in PyQt application
On Thu Jun 28 19:21:36 CEST 2007, Alexander Eisenhuth wrote: I've a memory leak in a PyQt application and no idea how to find it. What happens in the application ? From QWindow a QDialog is called on a button pressed() signal, that instantiate a QThread and waits for it. If the thread has finished, the QDialog closes. Do you delete the dialog when you close it? Did you create it with a parent object? I've stipped down everything that nothing more happens (to me obviously). Boost.Python is used to wrap a C++ Lib (used in the thread). Every time memory usage increases for ~70 KB. Sometimes the application crash on closing QWindow. (QtCore.dll) - One thing I ask me is weather garbage collection is done in the PyQt main loop? Some objects will be garbage collected but others may will be kept around if they are used from C++. What hints do you have to find the leak? You may need to show us some of your code so that we can see exactly what you're doing. If you can post the stripped down example you have here, we can take a look at it. David -- http://mail.python.org/mailman/listinfo/python-list
Re: how to query/test the state of a qt widget?
On Sun Jun 24 02:20:55 CEST 2007, raacampbell wrote: I'm writing a simple Python/Qt3 application and I am trying to write some code in which the user presses a button and the program performs action A or B depending upon the state of a pair of radio buttons. You would typically connect the button's clicked() signal to a function or method and perform the actions there. Since I don't know exactly what you are doing, I can't give you an exact answer, but you probably want to write something like this: self.connect(self.pushButton, SIGNAL(clicked()), self.perform_action) This assumes that you're calling connect() from a QObject subclass. If not, you could call connect() on the button itself. I would therefore like Python to read the state of the buttons. I was expecting this to be straightforward but I've not been able to work out how to do it and searching on Google hasn't helped. Surely there's a one-liner that will do what I want? It seems like an every-day sort of problem. I'm after something like: if self.polPlotRadioButton.enabled==1: print BLAH This is more or less what you would write in the method that gets invoked when the clicked() signal is emitted, though you would need to call enabled() since it's a method and not an attribute. I've found squish from www.froglogic.com but that seems over the top. Possibly pythonqt.sourceforge.net has something that will solve my problem but that wants Qt4 and at the moment I'm making heavy use of matplotlib widgets and I've not worked out how to get them to incorporate into a Qt4 app so I'm stuck with Qt3. It's been a while since I've looked at using matplotlib with PyQt. Looking at the 0.90.1 release, it seems that there is support for PyQt4, so maybe you'll get what you need if you upgrade to that. I don't think you need Squish for this - it's a tool for automated user interface testing, and you're not doing that as far as I can tell. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions about mathematical and statistical functionality in Python
On Fri Jun 15 03:08:08 CEST 2007, Josh Gilbert wrote: In a similar vein, I wish there was a reasonable Free Software equivalent to Spotfire. The closest I've found (and they're nowhere near as good) are Orange (http://www.ailab.si/orange) and WEKA (http://www.cs.waikato.ac.nz/ml/weka/). Orange is written in Python, but its tied to QT 2.x as the 3.x series was not available on Windows under the GPL. It should be possible to get Orange working with Qt 4, which is available under the GPL on Windows, but it could take some work to update some of the more specialized components to use the latest classes. On a positive note, there should be enough information available to help with the porting process, and the updated components would be able to take advantage of the improvements made to Qt and PyQt since Qt 2 was released! David -- http://mail.python.org/mailman/listinfo/python-list
Re: No Python for Blackberry?
On Saturday 19 May 2007 03:19, walterbyrd wrote: I could not find a version of Python that runs on a Blackberrry. I'm just amazed. A fairly popular platform, and no Python implementation? If you can get the hardware into the hands of capable developers, they'll put Python on it. ;-) David -- http://mail.python.org/mailman/listinfo/python-list
Re: Distributing programs depending on third party modules.
On May 16, 7:44 am, Tina I [EMAIL PROTECTED] wrote: A binary would be ideal. I'll look into the freeze modules and Pyinstaller. Even if they don't handle huge things like Qt it would be a step in the right direction if it handles smaller third part modules. And maybe the smartest thing to do would be to dump PyQt and just go for tkinter, however ugly it is :/ It's may be worth reading this message before making such a drastic decision: http://www.riverbankcomputing.com/pipermail/pyqt/2007-May/016092.html David ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: GUI tutorial
On May 14, 2:57 am, BartlebyScrivener [EMAIL PROTECTED] wrote: On May 13, 12:51 pm, John K Masters [EMAIL PROTECTED] wrote: Can someone point me in the direction of a good tutorial on programming python with a GUI? Alan Gauld added a gui programming tutorial to his main course. http://www.freenetpages.co.uk/hp/alan.gauld/ It's a frame page so I can't link directly, but select GUI Programming under Advanced Topics on the left. It may be worth pointing out that the information about licensing on that page is a little vague and inaccurate in places. PyGTK is actually licensed under the GNU LGPL, not the GPL, and both PyQt and PyGTK can be used to create commercial applications as long as those applications are not closed source. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Generate report containing pdf or ps figures?
On Tuesday 24 April 2007 20:42, Cameron Laird wrote: I want to make sure we're all keeping up with each other, so I'll make explicit a couple of points, despite the risk of redundancy: A. Bundling GS is a little touchy, depending on what you mean by that. Check out its license. My summary: it's feasible, but not as trans- parent as the technology in isolation might suggest. I'm surprised you don't have more suggestions, Cameron, given that you collect links to PDF convertors. ;-) http://phaseit.net/claird/comp.text.pdf/PDF_converters.html B. As Steve's already noted, the for-fee ReportLab *does* (at least some of) the things you want. Another interesting approach might be to look at other members of ReportLab's family tree: http://sping.sourceforge.net/ http://sping.sourceforge.net/notesPDF/index.html However, it doesn't seem that either are capable of inserting the kinds of vector files you are using. It may be worth writing a quick and dirty PDF writer using an existing backend library, though I can imagine that the hard work would involve reading the different input formats you want to use. Anyway, for future reference, the following projects might prove to be inspiring: http://pyx.sourceforge.net/ http://pybrary.net/pyPdf/ David -- http://mail.python.org/mailman/listinfo/python-list
Re: Do other Python GUI toolkits require this?
On Monday 23 April 2007 15:55, Kevin Walzer wrote: I had originally thought that learning PyObjC might preclude me from having to learn Objective-C, but that seems not to be the case. I have previously found the same to be true with PyQt and wxPython--not knowing the toolkits as they are implemented in C++ is a serious handicap. I'm not so sure about that. Certainly, it's useful to be able to read C++ example code, but none of the examples you see should require more than a basic proficiency in C++. I started using PyQt before I had more than basic C++ skills, and I don't think it slowed me down too much. I've even found this to be the case with Tkinter: understanding the Tcl implementation of Tk (which I do, because I am also a Tcl developer) is a huge advantage. Am I wrong to conclude that, if you want to do GUI programming in Python, then some level of proficiency with another language is not just recommended, but almost required? This is the case at least in my experience. When I first started learning Python a couple of years ago, I spun my wheels with it for months, because I couldn't figure out where to get started with GUI programming. Of the common toolkits and frameworks, I started using Tkinter because that's what came with Python, but I can't say that I'm comfortable with it. Once I started using PyQt, I started to forget Tkinter, and now I don't have a reason to go back to using it. Finally I set Python aside and took up Tcl/Tk for awhile--its simplicity in building GUI's is more beginner-friendly. (No there's more than one way to do it--there's only one way to do it, and that's Tk.) Now, coming back to Python with the Tk model of GUI development burned in my brain, I appreciate the breadth of functions that Python supports--but I still find myself dropping down into Tcl (!) to assemble elements of my GUI's--either to write a Python wrapper, or figure out how to implement something in pure Python. While this is one of the strengths of Tcl/Tk/Tkinter, I think this is a relatively rare thing to do with other toolkits and frameworks. For example, there are people writing wrappers around Qt-based classes, but the only people writing wrappers for Qt or KDE classes are the bindings authors themselves. I understand the argument for Python having lots of bindings to different GUI toolkits. If you are already proficient with a GUI toolkit in a compiled language (Gtk, wxWidgets, Cocoa, Qt) then presumably switching to Python will speed up your development--learning Python is easy if you already know C++, for instance, and usually the Python bindings are just a thin wrapper over the compiled bits. Yes and no. The bindings may be thin, but there are often other advantages that make the bindings subtly different/better to use than the underlying toolkit/framework. :-) From memory, PyGTK is more natural to use the GTK+ on its own because Python provides the object-oriented features that you don't get in C, though there are C++ bindings to GTK+ as well. Another example would be the way PyQt handles Qt's signals and slots. In C++ you need to declare these with specific signatures at compile time, but that would be a bit restrictive in Python. The result is that PyQt lets you define and connect arbitrary signals, slots and normal Python methods at run-time. (Actually, you don't even need to define signals.) So, even the thin wrappers contain some value other than simply enabling you to use Python. :-) But if you come to Python from the other direction--you're a relative beginner and you want to learn GUI programming without the complexities of compiled languages--then it's a lot harder to get started, ironically. Even Tkinter is a challenge for someone who doesn't know Tcl. The basics are easy enough--buttons, menus, labels, images--but doing anything sophisticated, such as trees, column views, drag-and-drop, and so on, requires extensions that may or may not be implemented in Python. I think that's a specific Tkinter problem in many ways. However, the expectations of many new users have also increased since I wrote my first GUI program in Python, and that also influences the way people respond to the different solutions on offer. David -- http://mail.python.org/mailman/listinfo/python-list
Re: PYQT 3 communication with 2 windows
On Thursday 19 April 2007 22:38, Marcpp wrote: Hi, I'm introducing to program in python + pyqt. I have a main window that call a second window (to introduce a info with textedit) when press the second window button I need to return to the main window the info introduced in the second window. I've seek in the pyqt doc examples but i don't find it. Have you any example? You could connect the button to a slot in the second window that sends the text back to the first window. Here's an example that sends the text to a function. You could substitute a class for the function to get what you want. import sys from qt import * class Window(QWidget): def __init__(self, parent = None): QWidget.__init__(self, parent) self.textEdit = QTextEdit(self) okButton = QPushButton(self.tr(OK), self) self.connect(okButton, SIGNAL(clicked()), self.sendText) layout = QVBoxLayout(self) layout.addWidget(self.textEdit) layout.addWidget(okButton) def sendText(self): self.emit(PYSIGNAL(textEntered(QString)), (self.textEdit.text(),)) def fn(text): print text if __name__ == __main__: app = QApplication(sys.argv) window = Window() window.connect(window, PYSIGNAL(textEntered(QString)), fn) window.show() app.setMainWidget(window) sys.exit(app.exec_loop()) Note the use of PYSIGNAL() instead of SIGNAL(). With PyQt4 you would be able to use SIGNAL() and write the emit() call in a simpler form. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Beginner: Formatting text output (PyQt4)
On Thursday 19 April 2007 00:50, Glen wrote: What seems to be happening is that the font that pyqt is using is not fixed width, so I did this: qTxtFormat = QTextCharFormat() qTxtFormat.setFontFixedPitch(True) ui.textEdit.setCurrentCharFormat(qTxtFormat) It may be that the font you're using isn't actually a monospaced font. The result of this is that the font used to display the text won't be a fixed pitch font. To test this, try specifying a known monospaced font and see if you get the output you expect. David -- http://mail.python.org/mailman/listinfo/python-list
Re: Beginner: Simple Output to a Dialog PyQt4
On Tuesday 17 April 2007 07:42, Glen wrote: I've written a script in python and put together a simple QFrame with a QTextBrowser with Designer. I've translated the C++ into python using puic4. Just to avoid any misunderstanding: the form is actually stored as XML. You can create C++ code with uic or Python code with pyuic4. The .py file is called outputWin.py. My Script and its functions are in cnt.py. OK. Ideally, your window will contain a button (or some other control) that the user can click to execute the functions. Finally, my main is in pball.py which follows here: import sys from PyQt4 import Qt, QtCore from outputWin import * from cnt import * if __name__ == __main__: app = Qt.QApplication(sys.argv) window = Qt.QDialog() ui = Ui_Dialog() ui.setupUi(window) window.show() app.exec_() I want to call my functions in cnt and have an output to my QDialog. Can somebody give me a clue as to how to proceed? I can't find good an easy tutorial for PyQt4 and I've never used Qt before. If, for example, you included a push button (QPushButton) in the form you created with Qt Designer, and called it executeButton, you could connect its clicked() signal to a function in cnt by including the following line after setting up the user interface: window.connect(ui.executeButton, SIGNAL(clicked()), cnt.myFunction) This assumes that your function is called myFunction(), of course. However, you wouldn't be able to get the output from this function back to the dialog just by using a signal-slot connection like this. One way to solve this would be to wrap the function using another function or instance that is able to modify the contents of the dialog. Another cleaner approach would be to subclass the user interface class (Ui_Dialog) and implement a custom slot that can both call the function and modify the dialog. For example: class Dialog(QDialog, Ui_Dialog) def __init__(self, parent = None): QDialog.__init__(self, parent) self.setupUi(self) self.connect(self.executeButton, SIGNAL(clicked()), self.callFunction) def callFunction(self): data = cnt.myFunction() # Do something with the data. Hope this gets you started, David -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyqt calling a custom dialog and returning the vars
On Monday 16 April 2007 22:06, Marcpp wrote: I call a dialog from a principal program but cannot return the value of the variables (text box's). Here is a example... [...] class ag (Agenda): ... ... def _slotAddClicked(self): d=dialogo1() d.exec_() d.connect(d.buttonOk,SIGNAL(clicked()),self._procesadialog1) def _procesadialog1(): d=dialogo1() drempresa = d.dempresa.text() print drempresa # Without seeing more of what you've done, it's difficult to tell, but you are just creating a new dialog in _procesadialog1() and reading the default text in its dempresa attribute which I presume is a QLineEdit widget. Assuming everything else is working correctly, I think you should remove the second method and rewrite the first one in the following way: class ag (Agenda): ... ... def _slotAddClicked(self): d=dialogo1() if d.exec_() == QDialog.Accepted: drempresa = d.dempresa.text() print drempresa # David -- http://mail.python.org/mailman/listinfo/python-list