Commit cff4f762 authored by Félix Hartmann's avatar Félix Hartmann
Browse files

Cleaning.

parent 36ffffbf
......@@ -8,6 +8,7 @@ Petite interface graphique pour traiter les tiges ou les racines
@authors: Hugo Chauvet and Félix Hartmann
Changes:
09/04/2021: [Félix] Multilingual support for English, Esperanto and French + bufixes.
05/10/2020: [Félix] A lot of changes: bugfixes for Py2/3 compatibility
+ multilingual support with gettext (English-only for now)
+ partial refactoring, for the multilingual support
......@@ -814,9 +815,7 @@ def update_tk_progress(infos, root):
im_num = infos['inum']
old_num = infos['old_inum']
tot = infos['tot']
#print im_num, old_num, tot
start_msg = _("Treating image")
#start_msg = _("Traitement de l'image")
start_msg = _("Image processing")
msg = start_msg + " %i / %i"%(int(im_num),int(tot))
root.wm_title("Interekt | %s"%msg)
root.update_idletasks()
......@@ -869,7 +868,6 @@ def process_data(display_message=True):
#On affiche que l'on fait la sauvegarde
if display_message:
interekt.display_message(_("Saving data into the .h5 file"))
#interekt.display_message(_("Sauvegarde des données dans le fichier .h5"))
for idt in range(len(base_tiges)):
# Recup l'id dans le fichier hdf
idhdf = get_hdf5_tigeid(hdf5file, idt)
......@@ -883,8 +881,7 @@ def process_data(display_message=True):
# On lance le traitement et on le sauvegarde dans le fichier hdf5
if display_message:
interekt.display_message(_("Treating extracted data"))
#interekt.display_message(_("Traitement des données extraites"))
interekt.display_message(_("Processing extracted data"))
Traite_data(save_to_hdf5=True)
# Recharge les données des tiges a partir du fichier hdf5
......@@ -1324,7 +1321,6 @@ def show_time_series(tige_id=None):
axAngle.grid(True)
axAngle.xaxis.set_major_locator(MultipleLocator(graduation))
axAngle.set_ylabel(strings["tip angle"] + " " + strings["degree"])
#axAngle.set_ylabel(_("angle au bout (deg)"))
if interekt.angle_0_360.get():
tip_angles = convert_angle(tip_angles)
......@@ -1406,7 +1402,6 @@ def show_angle_and_curvature(tige_id=None):
# Create the figure with the tige name
tige_name = h5store.get_tiges_names(hdf5file, tige_hdf_id)
start_title = _("Angles and curvatures for organ")
#start_title = _("Angles et courbures pour l'organe")
fig_curvature = mpl.figure(start_title + " %s"%(tige_name), figsize=(12, 10))
# Scaling
......@@ -1868,7 +1863,6 @@ def show_growth_length():
# Creating the figure
start_title = _("Estimation of the growth length for organ")
#start_title = _("Estimation de la longueur de croissance pour l'organe")
fig_growth_length = mpl.figure(start_title + " %i"%(cur_tige+1), figsize=(12, 10))
# grid = mpl.GridSpec(2, 2, wspace=.2, hspace=.2)
......@@ -1975,7 +1969,6 @@ def show_growth_length():
dLdt = growth_data["dLdt"]
except:
msg = _("The growth rate has to be estimated before the growth length.")
#msg = _("Le taux de croissance doit être estimé avant la longueur de croissance.")
messagebox.showerror(strings["Missing data"], msg)
mpl.close(fig_growth_length)
return
......@@ -2012,7 +2005,6 @@ def show_growth_length():
'm--', lw=3, picker=10)
dlines = DraggableLines([pl_s_curvaturemap, pl_t_curvaturemap], directions=["h", "v"])
# linked=[pl_s_angle, pl_s_curvaturemap])
# big red dot on the tige image at s_gz0
pl_s_gz0, = axProfiles.plot(xc[initial_image, i_gz0] - imgxmin,
......@@ -2201,7 +2193,6 @@ def show_beta(tige_id=None):
line_label = strings["photo"] + " %i"%time
start_title = _("Estimation of beta for organ")
#start_title = _("Estimation de beta pour l'organe")
fig_beta = mpl.figure(start_title + ' %s'%str(tige_name), figsize=(10, 8))
# grid = mpl.GridSpec(2, 3, wspace=.4, hspace=.4)
......@@ -2478,10 +2469,6 @@ def show_gamma(tige_id=None, pas=0.3):
_("""No times associated with photographs"""),
_("""Without time data, the computation of gamma will be meaningless. """
"""The computation of gamma_tilde is still possible."""))
# messagebox.showerror(
# _("""Aucun temps associé aux photos"""),
# _("""En l'absence de données temporelles, le calcul de gamma n'aura """
# """pas de sens. Le calcul de gamma_tilde reste possible."""))
# Time = photo number
time_unit = strings["photo"]
gamma_unit = "photo-1"
......@@ -2513,7 +2500,6 @@ def show_gamma(tige_id=None, pas=0.3):
time = image + 1
start_title = _("Estimation of gamma for organ")
#start_title = _("Estimation de gamma pour l'organe")
fig_gamma = mpl.figure(start_title + ' %s'%str(tige_name), figsize=(10, 8))
# grid = mpl.GridSpec(6, 3, wspace=.4, hspace=.4)
......@@ -2782,9 +2768,6 @@ def show_B(tige_id=None):
messagebox.showerror(
_("No steady-state image selected"),
_("Please select first the steady-state image."))
# messagebox.showerror(
# "Pas d'image à l'état stationnaire sélectionnée",
# "Veuillez d'abord sélectionner une image à l'état stationnaire.")
return
# Scaling factor (conversion from pixels to cm)
......@@ -2816,7 +2799,6 @@ def show_B(tige_id=None):
smooth_angles_deg = rad2deg(smooth_angles)
if interekt.angle_0_360.get():
#angles = convert_angle(angles)
smooth_angles_deg = convert_angle(smooth_angles)
# The growth length is stored in growth_data
......@@ -2828,7 +2810,6 @@ def show_B(tige_id=None):
messagebox.showerror(
strings["Missing data"],
_("The growth length has to be estimated before B."))
# """La longueur de croissance doit être estimée avant B.""")
return
# Check if the value of i_gz is possible, otherwise set it at a bound
......@@ -3297,7 +3278,6 @@ def _export_tige_id_mapper_to_csv(summary=True):
parent=root,
filetypes=[("Comma Separated Value, csv","*.csv")],
title=_("Export phenotyping data"),
# title=_("Export des données de phénotypage"),
initialfile=proposed_filename,
initialdir=base_dir_path)
......@@ -3454,8 +3434,9 @@ class Interekt:
self.master = master
self.master.style = Style()
self.master.style.theme_use("clam")
self.master.wm_title("Interekt -- version: %s" % (__version__))
print("Interekt -- version: %s" % (__version__))
title = "Interekt -- " + _("version") + ": %s"%(__version__)
self.master.wm_title(title)
print(title)
#TOP MENU BAR
menubar = Tk.Menu(self.master)
......@@ -3493,7 +3474,7 @@ class Interekt:
#Plot menu
plotmenu = Tk.Menu(menubar, tearoff=0)
plotmenu.add_command(label=_("Time series"), command=plot_moyenne)
menubar.add_cascade(label=_("Figures"), menu=plotmenu)
menubar.add_cascade(label=_("Plots"), menu=plotmenu)
#Options menu
options_menu = Tk.Menu(menubar)
......@@ -3597,7 +3578,7 @@ class Interekt:
master=buttonFrame, text=_("Suppress all bases"), # 'Supprimer les bases'
command=self._suppr_all_tiges, state=Tk.DISABLED)
self.button_traiter = Button(
master=buttonFrame, text=_('Treat'), # 'Traiter'
master=buttonFrame, text=_('Process'), # 'Traiter'
command=launch_process, state=Tk.DISABLED)
self.button_addmark = Button(
master=buttonFrame, text=_("Add a mark"), # 'Ajouter une marque'
......@@ -4444,15 +4425,11 @@ class Interekt:
#todo filetypes=ftypes
files = filedialog.askopenfilenames(parent=root,
title=_("Choose image to treat"))
# title='Choisir les images a traiter')
title=_("Choose images to process"))
if files != '' and len(files) > 0:
#base_dir_path = os.path.abspath(files[0]).replace(os.path.basename(files[0]),'')
base_dir_path = os.path.dirname(files[0]) + '/'
# ENCODING POUR LES NOMS de dossiers avec de l'utf8
# base_dir_path = base_dir_path.encode(sys.getfilesystemencoding())
#Test si c'est un fichier de traitement ou des images qui sont chargées
......@@ -4663,7 +4640,6 @@ def set_lang(lang):
class LanguageSelector:
def __init__(self, master):
print("init of LanguageSelector")
self.master = master
self.tk_lang = Tk.StringVar()
self.language_selector = Tk.Toplevel(self.master, takefocus=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment