[PyQt] Instant translation on PyQt 4.8.6
Hi guys, I was using the following function for re-translate my application at runtime but after compiling my application with new PyQt version it became need to be restarted... do you know what's wrong? PS Layout changing works perfectly. def languageChange(self): translator = QTranslator(self) currentLangFile = QString(":/l10n/%1.qm").arg(self.getLang()) if not translator.load(currentLangFile): print QString("Couldn't load language file") widget = QWidget(self) if self.lang == 'ar': print 'isAr' qApp.setLayoutDirection(Qt.RightToLeft) QLocale.setDefault(QLocale(QLocale.Arabic, QLocale.SyrianArabRepublic)) for widget in qApp.allWidgets(): widget.setLayoutDirection(Qt.RightToLeft) else: print 'isEn' qApp.setLayoutDirection(Qt.LeftToRight) for widget in qApp.allWidgets(): widget.setLayoutDirection(Qt.LeftToRight) qApp.installTranslator(translator) self.retranslateUi(self) -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Instant translation on PyQt 4.8.6
On Sat, 10 Dec 2011 12:19:19 +0200, ad...@mbnoimi.net wrote: > Hi guys, > > I was using the following function for re-translate my application at > runtime but after compiling my application with new PyQt version it became > need to be restarted... do you know what's wrong? > > PS > > Layout changing works perfectly. > > def languageChange(self): > translator = QTranslator(self) > currentLangFile = QString(":/l10n/%1.qm").arg(self.getLang()) > if not translator.load(currentLangFile): > print QString("Couldn't load language file") > widget = QWidget(self) > if self.lang == 'ar': > print 'isAr' > qApp.setLayoutDirection(Qt.RightToLeft) > QLocale.setDefault(QLocale(QLocale.Arabic, QLocale.SyrianArabRepublic)) > for widget in qApp.allWidgets(): > widget.setLayoutDirection(Qt.RightToLeft) > else: > print 'isEn' > qApp.setLayoutDirection(Qt.LeftToRight) > for widget in qApp.allWidgets(): > widget.setLayoutDirection(Qt.LeftToRight) > qApp.installTranslator(translator) > self.retranslateUi(self) I think there might be a pyuic4 regression related to retranslation. What version were you using that seemed to work? Can you send me a .ui file that seems to have the problem? Thanks, Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Instant translation on PyQt 4.8.6
On 10/12/2011 12:47 م, Phil Thompson wrote: I think there might be a pyuic4 regression related to retranslation. What version were you using that seemed to work? Can you send me a .ui file that seems to have the problem? By the way, I didn't face this problem with C++/Qt for same Qt version -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net LoginDialog Qt::WindowModal 0 0 337 308 0 0 200 0 449 16777215 Login 1 1 0 1 1 :/ui/images/login.png true 5 6 0 0 &Password: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter uiPassword QLineEdit::Password 0 0 &Username: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter uiUserName QLayout::SetDefaultConstraint 0 0 &ط¹ظâ¬Ø¸â¬Ø·Â±Ø·Â¨Ø¸â¬Ø¸â¬Ø¸Ù¹ :/ui/images/flagsyria.png:/ui/images/flagsyria.png 56 56 true true Qt::ToolButtonIconOnly 0 0 &English :/ui/images/flagenglish.png:/ui/images/flagenglish.png 56 56 true true true Qt::ToolButtonIconOnly 0 0 Tأ¼rkأ§e :/ui/images/flagturkey.png:/ui/images/flagturkey.png 56 56 true true Qt::ToolButtonIconOnly 6 0 5 0 0 Login :/ui/images/ok.png:/ui/images/ok.png true Close :/ui/images/cancel.png:/ui/images/cancel.png Qt::Horizontal 40 20 Options :/ui/images/configure.png:/ui/images/configure.png &Server: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter pushChange false Qt::NoFocus true &Database: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter uiDat
Re: [PyQt] setCornerWidget for QMenuBar & build Snapshots
On Sat, 10 Dec 2011 13:38:56 +0200, ad...@mbnoimi.net wrote: > On 07/12/2011 01:33 م, Phil Thompson wrote: ...that's fairly self > explanatory - seems you have a PyQt app running at the time. > Thanks Phill, > > OH, my mistake I forgot to uninstall previous version. Any way I > successfully built SIP but now I faced PyQt build issue as following (you > can see full build details through the attachments) > > C:PyQt/sip/QtCore/qobject.sip: In function 'PyObject* > meth_QTranslator_receivers(PyObject*, PyObject*)': > C:PyQt/sip/QtCore/qobject.sip:675: error: expected type-specifier before > 'sipQObject' > C:PyQt/sip/QtCore/qobject.sip:675: error: expected '>' before 'sipQObject' > C:PyQt/sip/QtCore/qobject.sip:675: error: expected '(' before 'sipQObject' > C:PyQt/sip/QtCore/qobject.sip:675: error: 'sipQObject' was not declared in > this scope > C:PyQt/sip/QtCore/qobject.sip:675: error: expected primary-expression > before '>' token > mingw32-make[1]: *** [sipQtCoreQTranslator.o] Error 1 > mingw32-make: *** [all] Error 2 Probably still something hanging around from your previous installation. I have retested this specific case in the last day or two without problems. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setCornerWidget for QMenuBar & build Snapshots
On 10/12/2011 02:03 م, Phil Thompson wrote: Probably still something hanging around from your previous installation. I have retested this specific case in the last day or two without problems. I don't think this related to previous installation because I installed fresh Windows installation (thank to VirtualBox :-D ). -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Instant translation on PyQt 4.8.6
On Sat, 10 Dec 2011 12:55:09 +0200, ad...@mbnoimi.net wrote: > On 10/12/2011 12:47 م, Phil Thompson wrote: I think there might be a > pyuic4 regression related to retranslation. What version were you using > that seemed to work? Can you send me a .ui file that seems to have the > problem? > > By the way, I didn't face this problem with C++/Qt for same Qt version Thanks - will be fixed in tonight's snapshot. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setCornerWidget for QMenuBar & build Snapshots
On Sat, 10 Dec 2011 14:36:14 +0200, ad...@mbnoimi.net wrote: > On 10/12/2011 02:03 م, Phil Thompson wrote: Probably still something > hanging around from your previous installation. I have retested this > specific case in the last day or two without problems. I don't think this > related to previous installation because I installed fresh Windows > installation (thank to VirtualBox :-D ). Maybe not, but it's still related to your installation. There was one message that implied that the version of the Python header files did not match the version of the Python interpreter. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] setCornerWidget for QMenuBar & build Snapshots
On 10/12/2011 03:17 م, Phil Thompson wrote: Maybe not, but it's still related to your installation. There was one message that implied that the version of the Python header files did not match the version of the Python interpreter. I downloaded today's latest snapshot but I got same problem! Python 2.7.2 sip-4.13.1-snapshot-7ab562ae0e39 PyQt-win-gpl-snapshot-4.9-aea28dc027e5 Do you know what if PyQt folks want to create a new release fixing setCornerWidget issue? Or I've to build the snapshot by myself. -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt