[PyQt] Patch for pylupdate4 / sourcelanguage attribute
Current (QT 4.7.1) .ts file header keeps track of target and source languages and looks like this: ?xml version=1.0 encoding=utf-8? !DOCTYPE TS TS version=2.0 language=en_US sourcelanguage=it_IT Meanwhile pylupdate4 from pyqt 4.8.3 does not keep track of the sourcelanguage attribute that was introduced in QT 4.5. Attached patch loads and saves the sourcelanguage, plus it bumps the version attribute to 2.0 (not sure if this is a good idea :-) don't want to keep a nonstandard tree. -- Giuseppe Corbelli WASP Software Engineer, Copan Italia S.p.A Phone: +390303666104 Fax: +390302659932 E-mail: giuseppe.corbe...@copanitalia.com --- PyQt-x11-gpl-4.8.3/pylupdate/merge.cpp 2011-01-23 11:08:28.0 +0100 +++ pylupdate/merge.cpp 2011-03-03 15:32:04.05010 +0100 @@ -50,6 +50,7 @@ TML all = tor-messages(); TML::Iterator it; outTor-setLanguageCode(tor-languageCode()); +outTor-setSourceLanguageCode(tor-sourceLanguageCode()); /* The types of all the messages from the vernacular translator --- PyQt-x11-gpl-4.8.3/pylupdate/metatranslator.h 2011-01-23 11:08:28.0 +0100 +++ pylupdate/metatranslator.h 2011-03-03 15:30:42.35410 +0100 @@ -119,8 +119,10 @@ QString toUnicode( const char *str, bool utf8 ) const; QString languageCode() const; +QString sourceLanguageCode() const; static void languageAndCountry(const QString languageCode, QLocale::Language *lang, QLocale::Country *country); void setLanguageCode(const QString languageCode); +void setSourceLanguageCode(const QString languageCode); QListMetaTranslatorMessage messages() const; QListMetaTranslatorMessage translatedMessages() const; static int grammaticalNumerus(QLocale::Language language, QLocale::Country country); @@ -144,6 +146,7 @@ // 'pt' portuguese, assumes portuguese from portugal // 'pt_BR' Brazilian portuguese (ISO 639-1 language code) // 'por_BR' Brazilian portuguese (ISO 639-2 language code) +QString m_sourceLanguage; }; /* --- PyQt-x11-gpl-4.8.3/pylupdate/metatranslator.cpp 2011-01-23 11:08:28.0 +0100 +++ pylupdate/metatranslator.cpp 2011-03-03 15:38:44.34810 +0100 @@ -71,12 +71,14 @@ virtual bool characters( const QString ch ); virtual bool fatalError( const QXmlParseException exception ); QString language() const { return m_language; } +QString sourceLanguage() const { return m_sourceLanguage; } private: MetaTranslator *tor; MetaTranslatorMessage::Type type; bool inMessage; QString m_language; +QString m_sourceLanguage; QString context; QString source; QString comment; @@ -113,6 +115,7 @@ } else { if ( qName == QString(TS) ) { m_language = atts.value(QLatin1String(language)); +m_sourceLanguage = atts.value(QLatin1String(sourcelanguage)); } else if ( qName == QString(context) ) { context.truncate( 0 ); source.truncate( 0 ); @@ -394,6 +397,7 @@ reader.setErrorHandler( 0 ); m_language = hand-language(); +m_sourceLanguage = hand-sourceLanguage(); makeFileNamesAbsolute(QFileInfo(filename).absoluteDir()); delete hand; @@ -413,9 +417,10 @@ //### The xml prolog allows processors to easily detect the correct encoding t ?xml version=\1.0\; t encoding=\utf-8\; -t ?\n!DOCTYPE TSTS version=\1.1\; +t ?\n!DOCTYPE TSTS version=\2.0\; if (!languageCode().isEmpty() languageCode() != QLatin1String(C)) -t language=\ languageCode() \; +t language=\ languageCode() \ \ + sourcelanguage=\ sourceLanguageCode() \; t \n; if ( codecName != ISO-8859-1 ) t defaultcodec codecName /defaultcodec\n; @@ -580,11 +585,21 @@ return m_language; } +QString MetaTranslator::sourceLanguageCode() const +{ +return m_sourceLanguage; +} + void MetaTranslator::setLanguageCode(const QString languageCode) { m_language = languageCode; } +void MetaTranslator::setSourceLanguageCode(const QString languageCode) +{ +m_sourceLanguage = languageCode; +} + bool MetaTranslator::contains( const char *context, const char *sourceText, const char *comment ) const { ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] phonon videoplayer stopped working going from pyqt 4.7 to 4.8
Nokia fixed this with their 4.7.2 update, which was released March 1st. Now we just have to wait for a PyQt update. Thanks for the info; much appreciated. -mark ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Failure to compile PyQt4 Python3.2
Hi, I want to upgrade from Python 2.6 to Python 3.2, including PyQt. So far I used PyQt installed as binaries from ubuntu 10.10 repositories as well as Qt4 : 4.7.0ubuntu4.2. I did not re-install Qt, available from nokia as source package: qt-everywhere-opensource-src-4.7.2.tar.gz. If that is the cause of the problem, please tell me and I will install it first. The steps of installation in detail were: The first step, installation of python3.2 appeared to be ok - ./configure.py make make test sudo make install completed satisfactorily. Next step, sip-4.12.1.tar.gz was expanded and installed in the 3 steps: python3 configure.py make sudo make install Installation seemed to proceed without complaints. The python3 script invokes python 3.2. PyQt-x11-gpl-4.8.3.tar.gz expanded ok. After python3 configure.py was satisfactorily complete, make failed with the following tail of messages: /usr/local/include/python3.2m/pyatomic.h:59: warning: unused parameter ‘address’ g++ -c -pipe -fPIC -O2 -fno-optimize-sibling-calls -fno- optimize-sibling-calls -Wall -W -D_REENTRANT -DNDEBUG - DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG - DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/include/python3.2m - I/usr/mkspecs/linux-g++ -I/usr/include/qt4/QtHelp - I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore - I/usr/include/qt4 -I/usr/X11R6/include -o sipQtHelpQHelpContentModel.o sipQtHelpQHelpContentModel.cpp In file included from /usr/local/include/python3.2m/Python.h:52, from /usr/local/include/python3.2m/sip.h:32, from sipAPIQtHelp.h:38, from sipQtHelpQHelpContentModel.cpp:34: /usr/local/include/python3.2m/pyatomic.h:59: warning: unused parameter ‘address’ g++ -c -pipe -fPIC -O2 -fno-optimize-sibling-calls -fno- optimize-sibling-calls -Wall -W -D_REENTRANT -DNDEBUG - DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_DEBUG - DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/include/python3.2m - I/usr/mkspecs/linux-g++ -I/usr/include/qt4/QtHelp - I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore - I/usr/include/qt4 -I/usr/X11R6/include -o sipQtHelpQHelpContentItem.o sipQtHelpQHelpContentItem.cpp In file included from /usr/local/include/python3.2m/Python.h:52, from /usr/local/include/python3.2m/sip.h:32, from sipAPIQtHelp.h:38, from sipQtHelpQHelpContentItem.cpp:34: /usr/local/include/python3.2m/pyatomic.h:59: warning: unused parameter ‘address’ g++ -shared -Wl,-O1 -Wl,-rpath,/usr/lib -Wl,--version- script=QtHelp.exp -o QtHelp.so sipQtHelpcmodule.o sipQtHelpQList0100QHelpSearchQuery.o sipQtHelpQMap0100QString0100QUrl.o sipQtHelpQList0100QStringList.o sipQtHelpQHelpSearchResultWidget.o sipQtHelpQHelpSearchQueryWidget.o sipQtHelpQHelpSearchEngine.o sipQtHelpQHelpSearchQuery.o sipQtHelpQHelpIndexWidget.o sipQtHelpQHelpIndexModel.o sipQtHelpQHelpEngine.o sipQtHelpQHelpEngineCore.o sipQtHelpQHelpContentWidget.o sipQtHelpQHelpContentModel.o sipQtHelpQHelpContentItem.o - L/usr/lib -L/usr/X11R6/lib -lQtHelp -lQtGui -lQtCore -lXext - lX11 -lm -lpthread /usr/bin/ld: cannot find -lXext collect2: ld returned 1 exit status make[1]: *** [QtHelp.so] Error 1 make[1]: Leaving directory `/home/ak/PyQt/PyQt-x11- gpl-4.8.3/QtHelp' make: *** [all] Error 2 ak@amd64:~/PyQt/PyQt-x11-gpl-4.8.3$ All of the tail listing is too deep for me to fathom. Your help will be greatly appreciated! OldAl. -- Algis http://akabaila.pcug.org.au/StructuralAnalysis.pdf ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Odd key press behavior in PyQt app
Just wondering whether this is the wrong place to ask and if so what might be a better list to ask this question on. Thanks, Umang On 02/13/2011 09:42 PM, Umang Varma wrote: Hi, I would like some help in fixing a bug in my application. The application is a game that reads user input using keyPressEvent to solve a word game. Occasionally, a very strange behavior occurs. When the user hits the 'g' or the 'h' keys, the Alt+G or Alt+H key press behavior is observed (my menu captions are Game and Help). This makes it impossible to play the letters g and h should they exist on one of the anagrams. However, this happens very rarely and usually 'g' and 'h' key presses are accepted, which makes me believe that this is not a bug in my code. Does anyone know what might be causing it and whether there is anything I can do to fix this in my code? If not, is this a bug in Qt/PyQt and has it already been reported? Thanks, Umang PS: The bug I'm trying to fix is https://bugs.launchpad.net/bugs/718462 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Odd key press behavior in PyQt app
On Thursday, March 03, 2011 08:57:31 pm Umang Varma wrote: Just wondering whether this is the wrong place to ask and if so what might be a better list to ask this question on. Yes this would be the right place to ask. *disclaimer I'm not a PyQt maintainer or involved outside of being a user of the lib* A few things missing, pyqt version, sip version, qt version (I think these are required to figure out where/how this bug was introduced or if a simple upgrade will remove the bugs, phil, pete and the rest do a lot of updates/fixes constantly). Also some Ideas. I'm not sure if this is a Qt or PyQt problem. I would suggest building a Qt program and see if it's reproducable in Qt. If it's a problem in Qt then this would go to nokia. I'm not sure how to work around this with 100% success or breaking the menus, without playing with it, but I would start with catching the event and checking if there is an active game and the keypress is a g/h in it and then pass it to the game, This breaks the menu keypresses though, It might be acceptable, if you only do this explicitly during an active game. Which is probably better than what you have now. I'm not familiar with the internal details of the keypress event enough to tell if this would work like it sounds. But hopefully this gets you started. Mike -- Tobacco is a filthy weed, That from the devil does proceed; It drains your purse, it burns your clothes, And makes a chimney of your nose. -- B. Waterhouse ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt