1
0
Fork 0
mirror of https://github.com/Athemis/PyDSF.git synced 2025-04-04 22:36:02 +00:00

Prepare for translation

Made strings translatable and generated first translation template.
This commit is contained in:
Alexander Minges 2015-07-08 01:30:06 +02:00
parent 35b2920d34
commit abe85f323e
3 changed files with 285 additions and 21 deletions

239
i18n/template.ts Normal file
View file

@ -0,0 +1,239 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="2.0">
<context>
<name>CustomNavigationToolbar</name>
<message>
<location filename="mplwidget.py" line="32"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mplwidget.py" line="32"/>
<source>Save the figure</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mplwidget.py" line="32"/>
<source>Subplots</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mplwidget.py" line="32"/>
<source>Configure subplots</source>
<translation type="unfinished"></translation>
</message>
</context>
<context encoding="UTF-8">
<name>MainWindow</name>
<message>
<location filename="mainwindow.py" line="119"/>
<source>&amp;Start Processing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="132"/>
<source>Open data file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="132"/>
<source>Text files (*.txt *.csv)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="191"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="191"/>
<source>No data file loaded!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="199"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="199"/>
<source>Signal threshold is currently set to zero.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="207"/>
<source>Processing...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="219"/>
<source>Save data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="219"/>
<source>Calculations are finished. Save results?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="227"/>
<source>Choose path for results</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="mainwindow.py" line="257"/>
<source>Finished!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="251"/>
<source>PyDSF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="252"/>
<source>Experimental Setup</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="253"/>
<source>Instrument</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="254"/>
<source>Analytik Jena qTOWER 2.0/2.2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="255"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add data files to the experiment. If multiple files are loaded, they are treated as replicates.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="256"/>
<source>Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="257"/>
<source>Replicates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="258"/>
<source>Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="259"/>
<source>Processing Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="260"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Temperature range of the data points. Only applies, if the data file does not contain any temperature information.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="261"/>
<source>Temperature settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="262"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;T&lt;span style=&quot; vertical-align:sub;&quot;&gt;min&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message encoding="UTF-8">
<location filename="Ui_mainwindow.py" line="281"/>
<source> °C</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="264"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;T&lt;span style=&quot; vertical-align:sub;&quot;&gt;max&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="266"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;Delta;T&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="268"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Only T&lt;span style=&quot; vertical-align:sub;&quot;&gt;m&lt;/span&gt; values within this limit are considered valid.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="269"/>
<source>&amp;Cutoff</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="270"/>
<source>&amp;Upper</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="272"/>
<source>Lower</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="274"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If the signal exceeds this threshold, the coresponding well is assumed to be denatured.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="275"/>
<source>Signal &amp;Threshold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="276"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Defines the range of the colorbar used for the T&lt;span style=&quot; vertical-align:sub;&quot;&gt;m&lt;/span&gt; heatmap.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="277"/>
<source>&amp;Colorbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="278"/>
<source>S&amp;tart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="280"/>
<source>En&amp;d</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="282"/>
<source>Fi&amp;le</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="283"/>
<source>Hel&amp;p</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="284"/>
<source>&amp;Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="285"/>
<source>&amp;About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Ui_mainwindow.py" line="286"/>
<source>About &amp;Qt</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -3,7 +3,7 @@
Module implementing MainWindow.
"""
from PyQt5.QtCore import (pyqtSlot, QObject, pyqtSignal, QThreadPool,
QRunnable, )
QRunnable, QCoreApplication)
from PyQt5.QtWidgets import (QMainWindow, QProgressBar, QDialogButtonBox,
QFileDialog, QMessageBox, QApplication)
@ -116,8 +116,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.statusBar.addPermanentWidget(self.progressBar)
self.statusBar.showMessage("Welcome to PyDSF")
self.buttonBox_process.addButton("&Start Processing",
QDialogButtonBox.AcceptRole)
self.buttonBox_process.addButton(
QCoreApplication.translate("MainWindow", "&Start Processing"),
QDialogButtonBox.AcceptRole)
self.tasks = Tasks()
self.worker = Worker(self)
@ -129,7 +130,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""
if button == self.buttonBox_open_reset.button(QDialogButtonBox.Open):
filenames = QFileDialog.getOpenFileNames(
self, 'Open data file', '', "Text files (*.txt *.csv)")
self,
QCoreApplication.translate("MainWindow", "Open data file"), '',
QCoreApplication.translate("MainWindow",
"Text files (*.txt *.csv)"))
self.listWidget_data.addItems(filenames[0])
if self.listWidget_data.count() > 1:
self.groupBox_replicates.setChecked(True)
@ -158,19 +162,23 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if id != 'average':
tab = self.generate_plot_tab("tab_heatmap_{}".format(id))
self.tabWidget.addTab(tab, "Heatmap #{}".format(plate.id))
self.tabWidget.addTab(tab, QCoreApplication.translate(
"MainWindow", "Heatmap #{}".format(plate.id)))
plotter.plot_tm_heatmap_single(plate, tab)
tab = self.generate_plot_tab("tab_raw_{}".format(id))
self.tabWidget.addTab(tab, "Raw Data #{}".format(plate.id))
self.tabWidget.addTab(tab, QCoreApplication.translate(
"MainWindow", "Raw Data #{}".format(plate.id)))
plotter.plot_raw(plate, tab)
tab = self.generate_plot_tab("tab_derivative_{}".format(id))
self.tabWidget.addTab(tab, "Derivatives #{}".format(plate.id))
self.tabWidget.addTab(tab, QCoreApplication.translate(
"MainWindow", "Derivatives #{}".format(plate.id)))
plotter.plot_derivative(plate, tab)
else:
tab = self.generate_plot_tab("tab_heatmap_{}".format(id))
self.tabWidget.addTab(tab, "Heatmap ({})".format(plate.id))
self.tabWidget.addTab(tab, QCoreApplication.translate(
"MainWindow", "Heatmap ({})".format(plate.id)))
plotter.plot_tm_heatmap_single(plate, tab)
@pyqtSlot()
@ -180,17 +188,24 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""
if self.listWidget_data.count() < 1:
QMessageBox.critical(self, 'Error', "No data file loaded!",
QMessageBox.Close, QMessageBox.Close)
QMessageBox.critical(
self, QCoreApplication.translate("MainWindow", "Error"),
QCoreApplication.translate("MainWindow",
"No data file loaded!"),
QMessageBox.Close, QMessageBox.Close)
return
if self.spinBox_signal_threshold.value(
) == 0 and self.groupBox_signal_threshold.isChecked():
QMessageBox.warning(self, 'Warning',
"Signal threshold is currently set to zero.",
QMessageBox.Ok, QMessageBox.Ok)
QMessageBox.warning(
self, QCoreApplication.translate("MainWindow", "Warning"),
QCoreApplication.translate(
"MainWindow",
"Signal threshold is currently set to zero."),
QMessageBox.Ok, QMessageBox.Ok)
self.progressBar.setEnabled(True)
self.statusBar.showMessage("Processing...")
self.statusBar.showMessage(QCoreApplication.translate("MainWindow",
"Processing..."))
self.tasks.signals.finished.connect(self.on_processing_finished)
self.tasks.add_task(self.worker)
@ -202,13 +217,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
exp = self.tasks.data[0]
save_data = QMessageBox.question(
self, 'Save data', "Calculations are finished. Save results?",
self, QCoreApplication.translate("MainWindow", "Save data"),
QCoreApplication.translate(
"MainWindow", "Calculations are finished. Save results?"),
QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
if save_data == QMessageBox.Yes:
dialog = QFileDialog()
dialog.setFileMode(QFileDialog.Directory)
folder = dialog.getExistingDirectory(self,
'Choose path for results')
folder = dialog.getExistingDirectory(
self, QCoreApplication.translate("MainWindow",
"Choose path for results"))
for plate in exp.plates:
plate.write_tm_table(
'{}/plate_{}_04_tm.csv'.format(folder, str(plate.id)))
@ -236,7 +254,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.generate_plate_tabs(plate)
self.progressBar.setEnabled(False)
self.statusBar.showMessage("Finished!")
self.statusBar.showMessage(QCoreApplication.translate("MainWindow",
"Finished!"))
@pyqtSlot()
def on_buttonBox_process_rejected(self):

View file

@ -1,4 +1,5 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import QCoreApplication
from matplotlib.backends.backend_qt5agg import (FigureCanvasQTAgg as
FigureCanvas)
from matplotlib.backends.backend_qt5agg import (NavigationToolbar2QT as
@ -29,9 +30,14 @@ class MplCanvas(FigureCanvas):
class CustomNavigationToolbar(NavigationToolbar):
toolitems = (
('Save', 'Save the figure', 'filesave', 'save_figure'),
('Subplots', 'Configure subplots', 'subplots', 'configure_subplots'),
(None, None, None, None), )
(QCoreApplication.translate("CustomNavigationToolbar", 'Save'),
QCoreApplication.translate("CustomNavigationToolbar",
'Save the figure'), 'filesave',
'save_figure'),
(QCoreApplication.translate("CustomNavigationToolbar", 'Subplots'),
QCoreApplication.translate("CustomNavigationToolbar",
'Configure subplots'), 'subplots',
'configure_subplots'), (None, None, None, None), )
def __init__(self, canvas, parent, coordinates=True):
NavigationToolbar.__init__(self, canvas, parent,