Language versions texts added

This commit is contained in:
Olek Bojda 2018-11-26 18:40:23 +01:00
parent 504000d496
commit 7b35eaf9f8
4 changed files with 183 additions and 25 deletions

View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
# coding=utf-8
from language import LanguageTexts
class EnglishTexts(LanguageTexts):
# Warning popup for robot unlocking
warning_text_1 = "ATTENTION"
warning_text_2 = "Are You sure You want to unlock the robot?"
# Button texts
select_text = 'Select'
stop_robot_text = "STOP robot"
unlock_robot_text = "UNLOCK robot"
disengage_clutch_text = "Disengage clutch"
engage_clutch_text = "Engage clutch"
release_robot_text = 'Release robot'
# Logger info texts
robot_selected_text = 'PIONIER{0} selected!'
robot_released_text = 'Robot released'
stopped_and_engaged_text = "Robot will be stopped and clutch engaged"
master_stop_clicked_text = 'MasterSTOP button pressed. Stopping the robots'
master_stop_released_text = 'MasterSTOP button released. Robot can be unlocked'
robot_stopped_text = 'Robot stopped'
robot_started_text = 'Robot started'
clutch_disengaged_text = 'Disengaging the clutch'
clutch_engaged_text = 'Engaging the clutch'
obstacle_detected_text = 'Obstacle detected. Robot stopped'
obstacle_removed_text = 'Obstacle removed'
# Logger error/problem messages
selection_error_text = 'Select the PIONEER from robots list first'
cannot_start_masterstop_text = "Robot can't be started. MasterSTOP pressed!"
cannot_start_obstacle_text = "Robot can't be started. Obstacle detected!"
cannot_select_robot_text = "Robot can't be selected. It is already selected by another group"
connection_to_robot_lost_text = 'Connection lost with robot PIONIER{0}'
connection_to_master_lost_text = 'Connection lost with masterSTOP. Ask the teacher to run it'
def __init__(self):
pass

View File

@ -0,0 +1,48 @@
class LanguageTexts:
# Warning popup for robot unlocking
warning_text_1 = "Text not reimplemented!"
warning_text_2 = "Text not reimplemented!"
# Button texts
select_text = "Text not reimplemented!"
stop_robot_text = "Text not reimplemented!"
unlock_robot_text = "Text not reimplemented!"
disengage_clutch_text = "Text not reimplemented!"
engage_clutch_text = "Text not reimplemented!"
release_robot_text = "Text not reimplemented!"
# Logger info texts
robot_selected_text = "Text not reimplemented!"
robot_released_text = "Text not reimplemented!"
stopped_and_engaged_text = "Text not reimplemented!"
master_stop_clicked_text = "Text not reimplemented!"
master_stop_released_text = "Text not reimplemented!"
robot_stopped_text = "Text not reimplemented!"
robot_started_text = "Text not reimplemented!"
clutch_disengaged_text = "Text not reimplemented!"
clutch_engaged_text = "Text not reimplemented!"
obstacle_detected_text = "Text not reimplemented!"
obstacle_removed_text = "Text not reimplemented!"
# Logger error/problem messages
selection_error_text = "Text not reimplemented!"
cannot_start_masterstop_text = "Text not reimplemented!"
cannot_start_obstacle_text = "Text not reimplemented!"
cannot_select_robot_text = "Text not reimplemented!"
connection_to_robot_lost_text = "Text not reimplemented!"
connection_to_master_lost_text = "Text not reimplemented!"
def __init__(self):
pass

View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
# coding=utf-8
from language import LanguageTexts
class PolishTexts(LanguageTexts):
# Warning popup for robot unlocking
warning_text_1 = "UWAGA"
warning_text_2 = "Na pewno chcesz odblokować robota?"
# Button texts
select_text = 'Wybierz'
stop_robot_text = "Zatrzymaj robota"
unlock_robot_text = "Odblokuj robota"
disengage_clutch_text = "Rozłącz sprzęgło"
engage_clutch_text = "Połącz sprzęgło"
release_robot_text = 'Zwolnij robota'
# Logger info texts
robot_selected_text = 'PIONIER{0} wybrany!'
robot_released_text = 'Odłączam robota'
stopped_and_engaged_text = "Robot zostanie zatrzymany i sprzęgnięty"
master_stop_clicked_text = 'Przycisk masterSTOP został naciśnięty. Zatrzymuje roboty'
master_stop_released_text = 'Przycisk masterSTOP odciśnięty. Mozesz uruchomić robota'
robot_stopped_text = 'Robot zatrzymany'
robot_started_text = 'Robot wystartował'
clutch_disengaged_text = 'Rozprzęgam sprzęgło'
clutch_engaged_text = 'Sprzęgam sprzegło'
obstacle_detected_text = 'Przeszkoda wykryta. Zatrzymuję robota'
obstacle_removed_text = 'Przeszkoda usunięta'
# Logger error/problem messages
selection_error_text = 'Najpierw wybierz PIONIERA z listy robotów'
cannot_start_masterstop_text = 'Nie można wystartować robota. MasterSTOP wciśnięty!'
cannot_start_obstacle_text = 'Nie mozna wystartować. Przeszkoda w polu działania robota'
cannot_select_robot_text = 'Nie mozna wybrać robota. Robot został już wybrany przez inną grupę'
connection_to_robot_lost_text = 'Utrata połączenia z robotem PIONIER{0}'
connection_to_master_lost_text = 'Utrata połączenia z masterstopem. Poproś prowadzącego o jego uruchomienie'
def __init__(self):
pass

View File

@ -15,6 +15,8 @@ from python_qt_binding.QtGui import QPixmap
from python_qt_binding.QtGui import QTextCursor
from python_qt_binding.QtWidgets import QMessageBox
from polish import PolishTexts as PT
from english import EnglishTexts as ET
class QtWrapper:
@ -22,6 +24,8 @@ class QtWrapper:
self.widget = widget
self.displayed_robots_id_list = []
self.language = ET
self.clear_robot_info()
ui_directory_path = '{0}/ui'.format(rospkg.RosPack().get_path('safety_user_plugin'))
@ -68,7 +72,7 @@ class QtWrapper:
if self.robot_state == SS.RUNNING:
self.handle_stopButton_clicked_callback()
else:
reply = QMessageBox.warning(self.widget,"UWAGA","Na pewno chcesz odblokować robota?",QMessageBox.Yes,QMessageBox.No)
reply = QMessageBox.warning(self.widget,self.language.warning_text_1,self.language.warning_text_2,QMessageBox.Yes,QMessageBox.No)
if reply == QMessageBox.Yes:
self.handle_stopButton_clicked_callback()
@ -85,27 +89,27 @@ class QtWrapper:
def display_clutch_on(self):
# self.widget.clutchLabel.setPixmap(self.ok_pixmap.scaled(40,40))
self.widget.clutchButton.setStyleSheet("QPushButton { color: black; background-color: green; font: bold 20px}")
self.widget.clutchButton.setText('Rozłącz sprzęgło')
self.widget.clutchButton.setText(self.language.disengage_clutch_text)
def display_clutch_off(self):
# self.widget.clutchLabel.setPixmap(self.cancel_pixmap.scaled(40,40))
self.widget.clutchButton.setStyleSheet("QPushButton { color: black; background-color: red; font: bold 20px}")
self.widget.clutchButton.setText('Połącz sprzęgło')
self.widget.clutchButton.setText(self.language.engage_clutch_text)
def display_state_on(self):
self.widget.stateLabel.setPixmap(self.ok_pixmap.scaled(40,40))
self.widget.stopButton.setStyleSheet("QPushButton { color: black; background-color: green; font: bold 20px}")
self.widget.stopButton.setText('Zatrzymaj robota')
self.widget.stopButton.setText(self.language.stop_robot_text)
self.robot_state = SS.RUNNING
def display_state_off(self):
self.widget.stateLabel.setPixmap(self.cancel_pixmap.scaled(40,40))
self.widget.stopButton.setStyleSheet("QPushButton { color: black; background-color: red; font: bold 20px}")
self.widget.stopButton.setText('Odblokuj robota')
self.widget.stopButton.setText(self.language.unlock_robot_text)
self.robot_state = SS.STOPPED
def handle_not_selected_error(self):
self.log_error('Najpierw wybierz PIONIERA z listy robotów')
self.log_error(self.language.selection_error_text)
def handle_openButton_clicked(self):
selected_robot_id = self.get_selected_robot_id()
@ -113,7 +117,7 @@ class QtWrapper:
if selected_robot_id != None:
self.handle_openButton_clicked_callback(selected_robot_id)
else:
self.log_error('Najpierw wybierz PIONIERA z listy robotów')
self.log_error(self.language.selection_error_text)
def handle_closeButton_clicked(self):
self.handle_closeButton_clicked_callback()
@ -133,15 +137,15 @@ class QtWrapper:
def select_robot(self,robot_id):
self.disconnect_signals()
self.connect_robot_signals()
self.log_info('PIONIER{0} wybrany!'.format(robot_id))
self.log_info('Robot zostanie zatrzymany i sprzęgnięty')
self.log_info(self.language.robot_selected_text.format(robot_id))
self.log_info(self.language.stopped_and_engaged_text)
self.widget.choiceButton.setText('Zwolnij robota')
self.widget.choiceButton.setText(self.language.release_robot_text)
def release_robot(self):
self.disconnect_signals()
self.connect_signals()
self.log_info('Odłączam robota')
self.log_info(self.language.robot_released_text)
self.clear_robot_info()
def update_robots_list_gui(self,robots_id_list):
@ -208,36 +212,36 @@ class QtWrapper:
def master_stopped(self):
self.widget.masterstopLabel.setPixmap(self.cancel_pixmap.scaled(40,40))
self.log_info('Przycisk masterSTOP został naciśnięty. Zatrzymuje roboty')
self.log_info(self.language.master_stop_clicked_text)
def master_started(self):
self.widget.masterstopLabel.setPixmap(self.ok_pixmap.scaled(40,40))
self.log_info('Przycisk masterSTOP odciśnięty. Mozesz uruchomić robota')
self.log_info(self.language.master_stop_released_text)
def user_stopped(self):
self.log_info('Robot zatrzymany')
self.log_info(self.language.robot_stopped_text)
self.display_state_off()
def user_started(self):
self.log_info('Robot wystartował')
self.log_info(self.language.robot_started_text)
self.display_state_on()
def disengage_clutch(self):
self.log_info('Rozprzęgam sprzęgło')
self.log_info(self.language.clutch_disengaged_text)
self.display_clutch_off()
def engage_clutch(self):
self.log_info('Sprzęgam sprzegło')
self.log_info(self.language.clutch_engaged_text)
self.display_clutch_on()
def master_is_stopped_notify(self):
self.log_error('Nie można wystartować robota. MasterSTOP wciśnięty!')
self.log_error(self.language.cannot_start_masterstop_text)
def obstacle_is_detected_notify(self):
self.log_error('Nie mozna wystartować. Przeszkoda w polu działania robota')
self.log_error(self.language.cannot_start_obstacle_text)
def robot_selected_by_another_group_notify(self):
self.log_error('Nie mozna wybrać robota. Robot został już wybrany przez inną grupę')
self.log_error(self.language.cannot_select_robot_text)
def update_restrictions_gui(self,restrictions):
self.widget.distanceRestrictionLabel.setText("{:.2f}".format(restrictions.distance))
@ -280,17 +284,17 @@ class QtWrapper:
self.clear_robot_info()
self.disconnect_signals()
self.connect_signals()
self.log_info('Utrata połączenia z robotem PIONIER{0}'.format(lost_robot_id))
self.log_info(self.language.connection_to_robot_lost_text.format(lost_robot_id))
def connection_to_master_lost(self):
self.log_error('Utrata połączenia z masterstopem. Poproś prowadzącego o jego uruchomienie')
self.log_error(self.language.connection_to_master_lost_text)
def obstacle_detected(self):
self.log_error('Przeszkoda wykryta. Zatrzymuję robota')
self.log_error(self.language.obstacle_detected_text)
# TODO Zmiana
def obstacle_removed(self):
self.log_info('Przeszkoda usunięta')
self.log_info(self.language.obstacle_removed_text)
def scroll_to_bottom(self):
scrollbar = self.widget.logsBrowser.verticalScrollBar()
@ -306,7 +310,7 @@ class QtWrapper:
self.widget.masterstopLabel.setText('-')
self.widget.obstaclestopLabel.setText('-')
self.widget.choiceButton.setText('Wybierz')
self.widget.choiceButton.setText(self.language.select_text)
self.widget.stopButton.setText('-')
self.widget.stopButton.setStyleSheet("")