diff -Nru m2l-pyqt-1.1/debian/changelog m2l-pyqt-1.2/debian/changelog --- m2l-pyqt-1.1/debian/changelog 2014-05-21 17:09:09.000000000 +0000 +++ m2l-pyqt-1.2/debian/changelog 2014-09-28 16:39:26.000000000 +0000 @@ -1,3 +1,9 @@ +m2l-pyqt (1.2-1) unstable; urgency=medium + + * upgraded to the newest upstream version, adds i18n and French l10n support. + + -- Georges Khaznadar Sun, 28 Sep 2014 18:38:25 +0200 + m2l-pyqt (1.1-1) unstable; urgency=low * Initial release (Closes: #748868) diff -Nru m2l-pyqt-1.1/debian/patches/Makefile.patch m2l-pyqt-1.2/debian/patches/Makefile.patch --- m2l-pyqt-1.1/debian/patches/Makefile.patch 1970-01-01 00:00:00.000000000 +0000 +++ m2l-pyqt-1.2/debian/patches/Makefile.patch 2014-09-28 17:25:23.000000000 +0000 @@ -0,0 +1,44 @@ +Index: m2l-pyqt-1.2/src/Makefile +=================================================================== +--- m2l-pyqt-1.2.orig/src/Makefile ++++ m2l-pyqt-1.2/src/Makefile +@@ -1,3 +1,4 @@ ++DESTDIR = + UI_SOURCES = $(shell ls *.ui) + UI_PYTHON = $(patsubst %.ui, Ui_%.py, $(UI_SOURCES)) + +@@ -5,18 +6,18 @@ Ui_%.py : %.ui + pyuic4 $< > $@ + + all: $(UI_PYTHON) +- make -C lang $@ ++ make -C lang $@ DESTDIR="$(DESTDIR)" + + clean: + rm -rf *~ __pycache__ $(UI_PYTHON) +- make -C lang $@ ++ make -C lang $@ DESTDIR="$(DESTDIR)" + + install: all + mkdir -p $(DESTDIR)/usr/bin/ + install -m755 mediawiki2latex-pyqt $(DESTDIR)/usr/bin/ + mkdir -p $(DESTDIR)/usr/share/mediawiki2latex + install -m644 *.py $(DESTDIR)/usr/share/mediawiki2latex +- make -C lang $@ ++ make -C lang $@ DESTDIR="$(DESTDIR)" + + .PHONY: all clean install + +Index: m2l-pyqt-1.2/src/lang/Makefile +=================================================================== +--- m2l-pyqt-1.2.orig/src/lang/Makefile ++++ m2l-pyqt-1.2/src/lang/Makefile +@@ -19,7 +19,7 @@ clean: + install: all + install -d $(DESTDIR)/usr/share/mediawiki2latex/translations + for l in $(QMFILES); do \ +- install-m 644 $$l $(DESTDIR)/usr/share/mediawiki2latex/translations ;\ ++ install -m 644 $$l $(DESTDIR)/usr/share/mediawiki2latex/translations ;\ + done + + .PHONY: all clean install diff -Nru m2l-pyqt-1.1/debian/patches/series m2l-pyqt-1.2/debian/patches/series --- m2l-pyqt-1.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ m2l-pyqt-1.2/debian/patches/series 2014-09-28 16:41:18.000000000 +0000 @@ -0,0 +1 @@ +Makefile.patch diff -Nru m2l-pyqt-1.1/debian/rules m2l-pyqt-1.2/debian/rules --- m2l-pyqt-1.1/debian/rules 2014-05-11 19:57:24.000000000 +0000 +++ m2l-pyqt-1.2/debian/rules 2014-09-28 16:45:12.000000000 +0000 @@ -4,5 +4,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +export DESTDIR = debian/mediawiki2latexguipyqt %: dh $@ --with python3 diff -Nru m2l-pyqt-1.1/src/lang/Makefile m2l-pyqt-1.2/src/lang/Makefile --- m2l-pyqt-1.1/src/lang/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ m2l-pyqt-1.2/src/lang/Makefile 2014-09-28 16:36:44.000000000 +0000 @@ -0,0 +1,25 @@ +DESTDIR = +SOURCES = $(shell ls ../*.py) ../mediawiki2latex-pyqt +TSFILES = $(shell ls translations/*.ts) +QMFILES = $(patsubst translations/%.ts, translations/%.qm, $(TSFILES)) +LANG = $(patsubst translations/mediawiki2latex-gui-%.ts, %, $(TSFILES)) + +all: $(QMFILES) + +translations/%.qm : translations/%.ts + lrelease $< -qm $@ + +$(TSFILES): $(SOURCES) + pylupdate4 -verbose translation.pro + + +clean: + rm -rf *~ $(QMFILES) + +install: all + install -d $(DESTDIR)/usr/share/mediawiki2latex/translations + for l in $(QMFILES); do \ + install-m 644 $$l $(DESTDIR)/usr/share/mediawiki2latex/translations ;\ + done + +.PHONY: all clean install diff -Nru m2l-pyqt-1.1/src/lang/translation.pro m2l-pyqt-1.2/src/lang/translation.pro --- m2l-pyqt-1.1/src/lang/translation.pro 1970-01-01 00:00:00.000000000 +0000 +++ m2l-pyqt-1.2/src/lang/translation.pro 2014-09-28 16:36:44.000000000 +0000 @@ -0,0 +1,8 @@ +SOURCES = ../processes.py\ + ../processTimer.py\ + ../Ui_MainWindow.py\ + ../mediawiki2latex-pyqt + + + +TRANSLATIONS = translations/mediawiki2latex-gui-fr_FR.ts diff -Nru m2l-pyqt-1.1/src/lang/translations/mediawiki2latex-gui-fr_FR.ts m2l-pyqt-1.2/src/lang/translations/mediawiki2latex-gui-fr_FR.ts --- m2l-pyqt-1.1/src/lang/translations/mediawiki2latex-gui-fr_FR.ts 1970-01-01 00:00:00.000000000 +0000 +++ m2l-pyqt-1.2/src/lang/translations/mediawiki2latex-gui-fr_FR.ts 2014-09-28 16:36:44.000000000 +0000 @@ -0,0 +1,253 @@ + + + + MainWindow + + + downloading article and contributor information + téléchargement des informations pour l'article et les contributeurs + + + + parsing article text + analyse du texte de l'article + + + + forking threads to download of images and contributor information on them + lancement de threads pour télécharger les images et les information légales qui s'y appliquent + + + + precompiling table columns + précompilation des colonnes de la table + + + + joining threads to download the images and contributor information on them + attente de la fin des threads pour télécharger les images et les information légales qui s'y appliquent + + + + preparing for PDF generation + préparation de la génération de PDF + + + + preparing images for LaTeX document + préparation des images pour le document LaTeX + + + + generating PDF file. LaTeX run 1 of 4 + génération du fichier PDF. Compilation LaTeX 1/4 + + + + generating PDF file. LaTeX run 2 of 4 + génération du fichier PDF. Compilation LaTeX 2/4 + + + + generating PDF file. LaTeX run 3 of 4 + génération du fichier PDF. Compilation LaTeX 3/4 + + + + generating PDF file. LaTeX run 4 of 4 + génération du fichier PDF. Compilation LaTeX 4/4 + + + + finished + terminé + + + + echo 'default message; you should not see it' + echo 'message par défaut ; vous ne devriez pas le voir' + + + + File still open + Fichier encore ouvert + + + + Please close your PDF viewer before pressing the run button! +This program need writing permission on the PDF file! + Veuillez fermer votre visionneuse PDF avant d'appuyer sur le bouton de lancement ! +Ce programme a besoin du droit d'écriture sur le fichier PDF ! + + + + Mediawiki to Latex started... + Démarrage de Mediawiki to LaTeX ... + + + + MediaWiki + MediaWiki + + + + Normal + Normal + + + + Rasterize + Rastériser + + + + running mediawiki2latex + mediawiki2latex lancé + + + + The sequence of processes is finished. You can close the window. + La séquences de procédures est terminée. Vous pouvez fermer la fenêtre. + + + + Mediawiki to LaTeX + Mediawiki to LaTeX + + + + Wiki source + Source dans le wiki + + + + Template expansion + Développement des modèles + + + + Print + Print + + + + Mediawiki + Mediawiki + + + + Paper + Papier + + + + A4 + A4 + + + + A5 + A5 + + + + B5 + B5 + + + + letter + letter + + + + legal + legal + + + + executive + executive + + + + Vector graphics + Graphismes vectoriels + + + + Keep vector form + Laisser en forme vectorielle + + + + LaTeX output + Sortie LaTeX + + + + excluded + exclue + + + + Preferences + Préférences + + + + Logs + Journaux + + + + Errors + Erreurs + + + + Run + Lancer + + + + File + Fichier + + + + About + À propos + + + + Save preferences + Enregistrer les préférences + + + + &Quit (Ctrl-Q) + &Quitter (Ctrl-Q) + + + + Ctrl+Q + Ctrl+Q + + + + Help + Aide + + + + About ... (F1) + À propos ... (F1) + + + + F1 + F1 + + + Binary files /tmp/csfFqBGS9x/m2l-pyqt-1.1/src/main.pdf and /tmp/nIO8gIVNYK/m2l-pyqt-1.2/src/main.pdf differ diff -Nru m2l-pyqt-1.1/src/Makefile m2l-pyqt-1.2/src/Makefile --- m2l-pyqt-1.1/src/Makefile 2014-05-19 17:35:38.000000000 +0000 +++ m2l-pyqt-1.2/src/Makefile 2014-09-28 16:36:44.000000000 +0000 @@ -5,15 +5,18 @@ pyuic4 $< > $@ all: $(UI_PYTHON) + make -C lang $@ clean: rm -rf *~ __pycache__ $(UI_PYTHON) + make -C lang $@ install: all mkdir -p $(DESTDIR)/usr/bin/ install -m755 mediawiki2latex-pyqt $(DESTDIR)/usr/bin/ mkdir -p $(DESTDIR)/usr/share/mediawiki2latex install -m644 *.py $(DESTDIR)/usr/share/mediawiki2latex + make -C lang $@ .PHONY: all clean install diff -Nru m2l-pyqt-1.1/src/mediawiki2latex-pyqt m2l-pyqt-1.2/src/mediawiki2latex-pyqt --- m2l-pyqt-1.1/src/mediawiki2latex-pyqt 2014-05-21 15:54:18.000000000 +0000 +++ m2l-pyqt-1.2/src/mediawiki2latex-pyqt 2014-09-28 16:36:44.000000000 +0000 @@ -26,27 +26,72 @@ """ import sys -from PyQt4.QtGui import QLabel, QApplication, QMainWindow, QLineEdit, QProgressBar -from PyQt4.QtGui import QPushButton, QGridLayout, QComboBox, QMessageBox, QIcon +from PyQt4.QtGui import QLabel, QApplication, QMainWindow, QLineEdit +from PyQt4.QtGui import QProgressBar, QPushButton, QGridLayout, QComboBox +from PyQt4.QtGui import QMessageBox, QIcon from PyQt4.QtCore import QObject, SIGNAL, QTimer, pyqtSignal, QProcess +from PyQt4.QtCore import QTranslator, QLibraryInfo import webbrowser import os import tempfile import time import math # access custom modules -sys.path = ['/usr/share/mediawiki2latex'] + sys.path +sys.path = sys.path + ['/usr/share/mediawiki2latex'] from Ui_MainWindow import Ui_MainWindow from processes import bashProcess from processTimer import processTimer +# i18n and l10n stuff +from locale import getdefaultlocale +locale = getdefaultlocale() + +try: + from PyQt4 import QtCore + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + + try: + _encoding = QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QApplication.translate(context, text, disambig, _encoding) + except AttributeError: + def _translate(context, text, disambig): + return QApplication.translate(context, text, disambig) class Progressor: def __init__(self): self.expectedRuntime=60.0 self.lastReachedKnownRelativeProgress=0.0 self.timeOfLastReachedKnownRelativeProgress=time.time() - self.expectedRealiveProgresses=[('downloading article and contributor information', 0.02540431143798292),('parsing article text', 0.057625916241286344),('forking threads to download of images and contributor information on them', 0.058045207449988465),('precompiling table columns', 0.08075814224942594),('joining threads to download the images and contributor information on them', 0.37003149457779727),('preparing for PDF generation', 0.5479855803098518),('preparing images for LaTeX document', 0.637605216120732),('generating PDF file. LaTeX run 1 of 4', 0.6911489294291799),('generating PDF file. LaTeX run 2 of 4', 0.7673758195622185),('generating PDF file. LaTeX run 3 of 4', 0.8463397892914045),('generating PDF file. LaTeX run 4 of 4', 0.9231746180088297),('finished', 1.0)] + self.expectedRealiveProgresses=[ + (_translate("MainWindow",'downloading article and contributor information'), + 0.02540431143798292), + (_translate("MainWindow",'parsing article text'), + 0.057625916241286344), + (_translate("MainWindow",'forking threads to download of images and contributor information on them'), + 0.058045207449988465), + (_translate("MainWindow",'precompiling table columns'), + 0.08075814224942594), + (_translate("MainWindow",'joining threads to download the images and contributor information on them'), + 0.37003149457779727), + (_translate("MainWindow",'preparing for PDF generation'), + 0.5479855803098518), + (_translate("MainWindow",'preparing images for LaTeX document'), + 0.637605216120732), + (_translate("MainWindow",'generating PDF file. LaTeX run 1 of 4'), + 0.6911489294291799), + (_translate("MainWindow",'generating PDF file. LaTeX run 2 of 4'), + 0.7673758195622185), + (_translate("MainWindow",'generating PDF file. LaTeX run 3 of 4'), + 0.8463397892914045), + (_translate("MainWindow",'generating PDF file. LaTeX run 4 of 4'), + 0.9231746180088297), + (_translate("MainWindow",'finished'), + 1.0) + ] self.startTime=time.time() self.progressBarValue=0.0 self.estimatedRelativeProgress=0.0 @@ -55,10 +100,12 @@ def __call__(self,line): for (k,v) in self.expectedRealiveProgresses: if k in line: - if k=='finished': return 100 + if k=='finished': + self.progressBarValue=1.0 + return 100 self.lastReachedKnownRelativeProgress=v - for i,x in enumerate(self.expectedRealiveProgresses): - if (k,v): n=i + for i,(kk,vv) in enumerate(self.expectedRealiveProgresses): + if kk==k: n=i n=min(max(0,n+1),len(self.expectedRealiveProgresses)-1) self.nextKnownRelativeProgressToBeReached=self.expectedRealiveProgresses[n][1] self.timeOfLastReachedKnownRelativeProgress=time.time() @@ -66,6 +113,7 @@ self.runtime=time.time()-self.startTime self.p=self.lastReachedKnownRelativeProgress+(1-math.exp(-(time.time()-self.timeOfLastReachedKnownRelativeProgress)/(self.expectedRuntime*(self.nextKnownRelativeProgressToBeReached-self.lastReachedKnownRelativeProgress))))*(self.nextKnownRelativeProgressToBeReached-self.lastReachedKnownRelativeProgress) self.progressBarValue=self.progressBarValue+(max((self.p-self.progressBarValue)*(self.runtime-self.lastRuntime)/5.0,0.0)) + self.progressBarValue=self.p self.lastRuntime=self.runtime return int(self.progressBarValue*100.0) @@ -95,7 +143,6 @@ abstract function to overload. Should update a progress bar. @param n a numeric value between 0 and 100 """ - print ("grr inside registerProgress") self.pbar.setValue(n) return None @@ -132,7 +179,7 @@ def registerProgress(self,n): """ - abstract function to overload. Should update a progress bar. + Update the progress bar. @param n a numeric value between 0 and 100 """ n=float(n) # might be something more complex @@ -143,11 +190,13 @@ self.pbar.setValue(n) return - def nextProcess(self, finished="echo 'default message; you should not see it'"): + def nextProcess(self, finished=None): """ increments the pointer to the list of processes to deal with @param finished the text of a shell command line which was processed """ + if finished==None: + finished=_translate("MainWindow","echo 'default message; you should not see it'") self.pending = self.pending +1 message = "`{0}' done.".format(finished) self.ui.statusbar.showMessage(message,1000) @@ -199,16 +248,16 @@ mainfile = open(self.pdfFile(), "ab") mainfile.close() except: - QMessageBox.about(self, "File still open", - "Please close your PDF viewer before pressing the run button!\n" + - " This program need writing permission on the PDF file!") + QMessageBox.about(self, _translate("MainWindow","File still open"), + _translate("MainWindow","""Please close your PDF viewer before pressing the run button! +This program need writing permission on the PDF file!""")) return self.pending = 0 self.processList=[] self.button.setEnabled(False) logBrowserTab=1 # displays stdout - self.outBrowser().appendPlainText("Mediawiki to Latex started...") + self.outBrowser().appendPlainText(_translate("MainWindow","Mediawiki to Latex started...")) self.ui.tabWidget.setCurrentIndex(logBrowserTab) self.scheduleM2L() # more processes can be scheduled, the module processes.py allows it. @@ -230,11 +279,11 @@ self.bailOut() def getSwitch(self, switch): - if switch=="MediaWiki": return " -m " - if switch=="Normal": return " -i " + if switch==_translate("MainWindow","MediaWiki"): return " -m " + if switch==_translate("MainWindow","Normal"): return " -i " return "" def getVector(self, switch): - if switch=="Rasterize": return "" + if switch==_translate("MainWindow","Rasterize"): return "" return "-g" def scheduleM2L(self): @@ -251,7 +300,7 @@ # the parameter expect=10000 means that 10000 lines are expected in # stdout. This parameter can be also a pattern compiled as a regular # expression or a callable to filter lines of stdout. - bp=bashProcess(self, cmd=cmd, message="running mediawiki2latex", + bp=bashProcess(self, cmd=cmd, message=_translate("MainWindow","running mediawiki2latex"), expect=Progressor()) self.processList.append(bp) return @@ -274,7 +323,7 @@ Notifies the end of the sequence of processes. Launches a viewer for the output PDF file. """ - self.ui.statusbar.showMessage("The sequence of processes is finished. You can close the window.") + self.ui.statusbar.showMessage(_translate("MainWindow","The sequence of processes is finished. You can close the window.")) self.t.stop() # end of tick service self.button.setEnabled(True) self.pbar.setValue(100) @@ -297,16 +346,26 @@ #--------------- main ------------------ if __name__ == '__main__': - - APP = QApplication(sys.argv) - # style = QStyleFactory.create('Cleanlooks') - # APP.setStyle(style) + APP = QApplication(sys.argv) + translationPaths=[QLibraryInfo.location(QLibraryInfo.TranslationsPath), + '/usr/share/mediawiki2latex/translations', + 'lang/translations'] + for transFile in ("qt_{locale}", "mediawiki2latex-gui-{locale}"): + transFile=transFile.format(locale=locale[0]) + translator = QTranslator() + for path in translationPaths: + if translator.load(transFile, path): + APP.installTranslator(translator) + break - preferences = Preferences() # should read some user config file - MAINWINDOW = MainWindow (preferences) - MAINWINDOW.setWindowIcon(QIcon('logo.ico')) - MAINWINDOW.show () - APP.exec_ () + # style = QStyleFactory.create('Cleanlooks') + # APP.setStyle(style) + + preferences = Preferences() # should read some user config file + MAINWINDOW = MainWindow (preferences) + MAINWINDOW.setWindowIcon(QIcon('logo.ico')) + MAINWINDOW.show () + APP.exec_ () ### for Emacs ### # Local Variables: