missed translations fix, travis fix, updates

This commit is contained in:
ingvar1995 2017-04-11 21:38:00 +03:00
parent e4998cd5b5
commit 972a073cb9
10 changed files with 61 additions and 112 deletions

View file

@ -1,14 +1,14 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"
before_install:
- sudo apt-get update
- sudo apt-get install -y checkinstall build-essential
- sudo apt-get install portaudio19-dev
- sudo apt-get install libconfig-dev libvpx-dev check -qq
- sudo apt-get install python3-pyqt5
install:
- pip install PySide --no-index --find-links https://parkin.github.io/python-wheelhouse/;
- python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install
- pip install pyaudio
before_script:
# OPUS

View file

@ -11,7 +11,7 @@ version = program_version + '.0'
MODULES = []
if system() in ('Windows', 'Darwin'):
MODULES = ['PyAudio', 'PySide']
MODULES = ['PyAudio', 'PyQt5']
else:
try:
import pyaudio
@ -58,7 +58,8 @@ setup(name='Toxygen',
include_package_data=True,
classifiers=[
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
entry_points={
'console_scripts': ['toxygen=toxygen.main:main'],

View file

@ -120,8 +120,7 @@ class AudioMessageRecorder(widgets.CenteredWidget):
self.record = QtWidgets.QPushButton(self)
self.record.setGeometry(QtCore.QRect(20, 100, 150, 150))
self.record.setText(QtWidgets.QApplication.translate("MenuWindow", "Start recording", None,
QtWidgets.QApplication.UnicodeUTF8))
self.record.setText(QtWidgets.QApplication.translate("MenuWindow", "Start recording"))
self.record.clicked.connect(self.start_or_stop_recording)
self.recording = False
self.friend_num = friend_number
@ -129,8 +128,7 @@ class AudioMessageRecorder(widgets.CenteredWidget):
def start_or_stop_recording(self):
if not self.recording:
self.recording = True
self.record.setText(QtWidgets.QApplication.translate("MenuWindow", "Stop recording", None,
QtWidgets.QApplication.UnicodeUTF8))
self.record.setText(QtWidgets.QApplication.translate("MenuWindow", "Stop recording"))
else:
self.close()

View file

@ -534,8 +534,7 @@ class InlineImageItem(QtWidgets.QScrollArea):
elif event.button() == QtCore.Qt.RightButton: # save inline
directory = QtWidgets.QFileDialog.getExistingDirectory(self,
QtWidgets.QApplication.translate("MainWindow",
'Choose folder', None,
QtWidgets.QApplication.UnicodeUTF8),
'Choose folder'),
curr_directory(),
QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
if directory:

View file

@ -494,8 +494,7 @@ class MainWindow(QtWidgets.QMainWindow, Singleton):
msgBox.setWindowTitle(
QtWidgets.QApplication.translate("MainWindow", "Cannot lock app"))
msgBox.setText(
QtWidgets.QApplication.translate("MainWindow", 'Error. Profile password is not set.', None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("MainWindow", 'Error. Profile password is not set.'))
msgBox.exec_()
def show_menu(self):

View file

@ -331,51 +331,39 @@ class WelcomeScreen(CenteredWidget):
self.text.setOpenExternalLinks(True)
self.checkbox = QtWidgets.QCheckBox(self)
self.checkbox.setGeometry(QtCore.QRect(5, 170, 240, 30))
self.checkbox.setText(QtWidgets.QApplication.translate('WelcomeScreen', "Don't show again",
None, QtWidgets.QApplication.UnicodeUTF8))
self.setWindowTitle(QtWidgets.QApplication.translate('WelcomeScreen', 'Tip of the day',
None, QtWidgets.QApplication.UnicodeUTF8))
self.checkbox.setText(QtWidgets.QApplication.translate('WelcomeScreen', "Don't show again"))
self.setWindowTitle(QtWidgets.QApplication.translate('WelcomeScreen', 'Tip of the day'))
import random
num = random.randint(0, 10)
if num == 0:
text = QtWidgets.QApplication.translate('WelcomeScreen', 'Press Esc if you want hide app to tray.',
None, QtWidgets.QApplication.UnicodeUTF8)
text = QtWidgets.QApplication.translate('WelcomeScreen', 'Press Esc if you want hide app to tray.')
elif num == 1:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Right click on screenshot button hides app to tray during screenshot.',
None, QtWidgets.QApplication.UnicodeUTF8)
'Right click on screenshot button hides app to tray during screenshot.')
elif num == 2:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'You can use Tox over Tor. For more info read <a href="https://wiki.tox.chat/users/tox_over_tor_tot">this post</a>',
None, QtWidgets.QApplication.UnicodeUTF8)
'You can use Tox over Tor. For more info read <a href="https://wiki.tox.chat/users/tox_over_tor_tot">this post</a>')
elif num == 3:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Use Settings -> Interface to customize interface.',
None, QtWidgets.QApplication.UnicodeUTF8)
'Use Settings -> Interface to customize interface.')
elif num == 4:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Set profile password via Profile -> Settings. Password allows Toxygen encrypt your history and settings.',
None, QtWidgets.QApplication.UnicodeUTF8)
'Set profile password via Profile -> Settings. Password allows Toxygen encrypt your history and settings.')
elif num == 5:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Since v0.1.3 Toxygen supports plugins. <a href="https://github.com/xveduk/toxygen/blob/master/docs/plugins.md">Read more</a>',
None, QtWidgets.QApplication.UnicodeUTF8)
'Since v0.1.3 Toxygen supports plugins. <a href="https://github.com/xveduk/toxygen/blob/master/docs/plugins.md">Read more</a>')
elif num in (6, 7):
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Toxygen supports faux offline messages and file transfers. Send message or file to offline friend and he will get it later.',
None, QtWidgets.QApplication.UnicodeUTF8)
'Toxygen supports faux offline messages and file transfers. Send message or file to offline friend and he will get it later.')
elif num == 8:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Delete single message in chat: make right click on spinner or message time and choose "Delete" in menu',
None, QtWidgets.QApplication.UnicodeUTF8)
'Delete single message in chat: make right click on spinner or message time and choose "Delete" in menu')
elif num == 9:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Use right click on inline image to save it',
None, QtWidgets.QApplication.UnicodeUTF8)
'Use right click on inline image to save it')
else:
text = QtWidgets.QApplication.translate('WelcomeScreen',
'Set new NoSpam to avoid spam friend requests: Profile -> Settings -> Set new NoSpam.',
None, QtWidgets.QApplication.UnicodeUTF8)
'Set new NoSpam to avoid spam friend requests: Profile -> Settings -> Set new NoSpam.')
self.text.setHtml(text)
self.checkbox.stateChanged.connect(self.not_show)
QtCore.QTimer.singleShot(1000, self.show)
@ -455,8 +443,7 @@ class SearchScreen(QtWidgets.QWidget):
self.retranslateUi()
def retranslateUi(self):
self.search_text.setPlaceholderText(QtWidgets.QApplication.translate("MainWindow", "Search", None,
QtWidgets.QApplication.UnicodeUTF8))
self.search_text.setPlaceholderText(QtWidgets.QApplication.translate("MainWindow", "Search"))
def show(self):
super().show()
@ -514,13 +501,9 @@ class SearchScreen(QtWidgets.QWidget):
def not_found(text):
mbox = QtWidgets.QMessageBox()
mbox_text = QtWidgets.QApplication.translate("MainWindow",
'Text "{}" was not found',
None,
QtWidgets.QApplication.UnicodeUTF8)
'Text "{}" was not found')
mbox.setText(mbox_text.format(text))
mbox.setWindowTitle(QtWidgets.QApplication.translate("MainWindow",
'Not found',
None,
QtWidgets.QApplication.UnicodeUTF8))
'Not found'))
mbox.exec_()

View file

@ -141,12 +141,12 @@ class ProfileSettings(CenteredWidget):
self.profilepass.setFont(font)
self.password = LineEdit(self)
self.password.setGeometry(QtCore.QRect(40, 380, 300, 30))
self.password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.password.setEchoMode(QtWidgets.QLineEdit.Password)
self.leave_blank = QtWidgets.QLabel(self)
self.leave_blank.setGeometry(QtCore.QRect(350, 380, 300, 30))
self.confirm_password = LineEdit(self)
self.confirm_password.setGeometry(QtCore.QRect(40, 420, 300, 30))
self.confirm_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.confirm_password.setEchoMode(QtWidgets.QLineEdit.Password)
self.set_password = QtWidgets.QPushButton(self)
self.set_password.setGeometry(QtCore.QRect(40, 470, 300, 30))
self.set_password.clicked.connect(self.new_password)
@ -202,12 +202,10 @@ class ProfileSettings(CenteredWidget):
Settings.set_auto_profile(ProfileHelper.get_path(), Settings.get_instance().name)
self.auto = not self.auto
if self.auto:
self.default.setText(QtWidgets.QApplication.translate("ProfileSettingsForm", "Mark as not default profile", None,
QtWidgets.QApplication.UnicodeUTF8))
self.default.setText(QtWidgets.QApplication.translate("ProfileSettingsForm", "Mark as not default profile"))
else:
self.default.setText(
QtWidgets.QApplication.translate("ProfileSettingsForm", "Mark as default profile", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("ProfileSettingsForm", "Mark as default profile"))
def new_password(self):
if self.password.text() == self.confirm_password.text():
@ -217,12 +215,10 @@ class ProfileSettings(CenteredWidget):
self.close()
else:
self.not_match.setText(
QtWidgets.QApplication.translate("ProfileSettingsForm", "Password must be at least 8 symbols", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("ProfileSettingsForm", "Password must be at least 8 symbols"))
self.not_match.setVisible(True)
else:
self.not_match.setText(QtWidgets.QApplication.translate("ProfileSettingsForm", "Passwords do not match", None,
QtWidgets.QApplication.UnicodeUTF8))
self.not_match.setText(QtWidgets.QApplication.translate("ProfileSettingsForm", "Passwords do not match"))
self.not_match.setVisible(True)
def copy(self):
@ -686,21 +682,19 @@ class InterfaceSettings(CenteredWidget):
def new_font(self):
settings = Settings.get_instance()
font, ok = QtGui.QFontDialog.getFont(QtGui.QFont(settings['font'], 10), self)
font, ok = QtWidgets.QFontDialog.getFont(QtGui.QFont(settings['font'], 10), self)
if ok:
settings['font'] = font.family()
settings.save()
msgBox = QtWidgets.QMessageBox()
text = QtWidgets.QApplication.translate("interfaceForm", 'Restart app to apply settings', None,
QtWidgets.QApplication.UnicodeUTF8)
msgBox.setWindowTitle(QtWidgets.QApplication.translate("interfaceForm", 'Restart required', None,
QtWidgets.QApplication.UnicodeUTF8))
text = QtWidgets.QApplication.translate("interfaceForm", 'Restart app to apply settings')
msgBox.setWindowTitle(QtWidgets.QApplication.translate("interfaceForm", 'Restart required'))
msgBox.setText(text)
msgBox.exec_()
def select_color(self):
settings = Settings.get_instance()
col = QtGui.QColorDialog.getColor(settings['unread_color'])
col = QtWidgets.QColorDialog.getColor(QtGui.QColor(settings['unread_color']))
if col.isValid():
name = col.name()

View file

@ -1,8 +1,5 @@
from widgets import CenteredWidget, LineEdit
try:
from PyQt5 import QtCore, QtGui
except ImportError:
from PyQt4 import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets
class PasswordArea(LineEdit):
@ -10,7 +7,7 @@ class PasswordArea(LineEdit):
def __init__(self, parent):
super(PasswordArea, self).__init__(parent)
self.parent = parent
self.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.setEchoMode(QtWidgets.QLineEdit.Password)
def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Return:
@ -116,10 +113,10 @@ class SetProfilePasswordScreen(CenteredWidget):
self.setMaximumSize(QtCore.QSize(700, 200))
self.password = LineEdit(self)
self.password.setGeometry(QtCore.QRect(40, 10, 300, 30))
self.password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.password.setEchoMode(QtWidgets.QLineEdit.Password)
self.confirm_password = LineEdit(self)
self.confirm_password.setGeometry(QtCore.QRect(40, 50, 300, 30))
self.confirm_password.setEchoMode(QtWidgets.QLineEdit.EchoMode.Password)
self.confirm_password.setEchoMode(QtWidgets.QLineEdit.Password)
self.set_password = QtWidgets.QPushButton(self)
self.set_password.setGeometry(QtCore.QRect(40, 100, 300, 30))
self.set_password.clicked.connect(self.new_password)
@ -132,21 +129,16 @@ class SetProfilePasswordScreen(CenteredWidget):
self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
def retranslateUi(self):
self.setWindowTitle(QtWidgets.QApplication.translate("PasswordScreen", "Profile password", None,
QtWidgets.QApplication.UnicodeUTF8))
self.setWindowTitle(QtWidgets.QApplication.translate("PasswordScreen", "Profile password"))
self.password.setPlaceholderText(
QtWidgets.QApplication.translate("PasswordScreen", "Password (at least 8 symbols)", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("PasswordScreen", "Password (at least 8 symbols)"))
self.confirm_password.setPlaceholderText(
QtWidgets.QApplication.translate("PasswordScreen", "Confirm password", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("PasswordScreen", "Confirm password"))
self.set_password.setText(
QtWidgets.QApplication.translate("PasswordScreen", "Set password"))
self.not_match.setText(QtWidgets.QApplication.translate("PasswordScreen", "Passwords do not match", None,
QtWidgets.QApplication.UnicodeUTF8))
self.not_match.setText(QtWidgets.QApplication.translate("PasswordScreen", "Passwords do not match"))
self.warning.setText(
QtWidgets.QApplication.translate("PasswordScreen", "There is no way to recover lost passwords", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("PasswordScreen", "There is no way to recover lost passwords"))
def new_password(self):
if self.password.text() == self.confirm_password.text():
@ -155,10 +147,8 @@ class SetProfilePasswordScreen(CenteredWidget):
self.close()
else:
self.not_match.setText(
QtWidgets.QApplication.translate("PasswordScreen", "Password must be at least 8 symbols", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("PasswordScreen", "Password must be at least 8 symbols"))
self.not_match.setVisible(True)
else:
self.not_match.setText(QtWidgets.QApplication.translate("PasswordScreen", "Passwords do not match", None,
QtWidgets.QApplication.UnicodeUTF8))
self.not_match.setText(QtWidgets.QApplication.translate("PasswordScreen", "Passwords do not match"))
self.not_match.setVisible(True)

View file

@ -96,8 +96,7 @@ class Profile(basecontact.BaseContact, Singleton):
tmp = self.name
super(Profile, self).set_name(value.encode('utf-8'))
self._tox.self_set_name(self._name.encode('utf-8'))
message = QtWidgets.QApplication.translate("MainWindow", 'User {} is now known as {}', None,
QtWidgets.QApplication.UnicodeUTF8)
message = QtWidgets.QApplication.translate("MainWindow", 'User {} is now known as {}')
message = message.format(tmp, value)
for friend in self._contacts:
friend.append_message(InfoMessage(message, time.time()))
@ -663,12 +662,10 @@ class Profile(basecontact.BaseContact, Singleton):
friend = self._contacts[num]
name = friend.name
dialog = QtWidgets.QApplication.translate('MainWindow',
"Enter new alias for friend {} or leave empty to use friend's name:",
None, QtWidgets.QApplication.UnicodeUTF8)
"Enter new alias for friend {} or leave empty to use friend's name:")
dialog = dialog.format(name)
title = QtWidgets.QApplication.translate('MainWindow',
'Set alias',
None, QtWidgets.QApplication.UnicodeUTF8)
'Set alias')
text, ok = QtGui.QInputDialog.getText(None,
title,
dialog,
@ -1204,11 +1201,9 @@ class Profile(basecontact.BaseContact, Singleton):
self._call(num, audio, video)
self._screen.active_call()
if video:
text = QtWidgets.QApplication.translate("incoming_call", "Outgoing video call", None,
QtWidgets.QApplication.UnicodeUTF8)
text = QtWidgets.QApplication.translate("incoming_call", "Outgoing video call")
else:
text = QtWidgets.QApplication.translate("incoming_call", "Outgoing audio call", None,
QtWidgets.QApplication.UnicodeUTF8)
text = QtWidgets.QApplication.translate("incoming_call", "Outgoing audio call")
self.get_curr_friend().append_message(InfoMessage(text, time.time()))
self.create_message_item(text, time.time(), '', MESSAGE_TYPE['INFO_MESSAGE'])
self._messages.scrollToBottom()
@ -1223,11 +1218,9 @@ class Profile(basecontact.BaseContact, Singleton):
return
friend = self.get_friend_by_number(friend_number)
if video:
text = QtWidgets.QApplication.translate("incoming_call", "Incoming video call", None,
QtWidgets.QApplication.UnicodeUTF8)
text = QtWidgets.QApplication.translate("incoming_call", "Incoming video call")
else:
text = QtWidgets.QApplication.translate("incoming_call", "Incoming audio call", None,
QtWidgets.QApplication.UnicodeUTF8)
text = QtWidgets.QApplication.translate("incoming_call", "Incoming audio call")
friend.append_message(InfoMessage(text, time.time()))
self._incoming_calls.add(friend_number)
if friend_number == self.get_active_number():

View file

@ -85,29 +85,21 @@ def create_menu(menu):
text = action.text()
if 'Link Location' in text:
text = text.replace('Copy &Link Location',
QtWidgets.QApplication.translate("MainWindow", "Copy link location", None,
QtWidgets.QApplication.UnicodeUTF8))
QtWidgets.QApplication.translate("MainWindow", "Copy link location"))
elif '&Copy' in text:
text = text.replace('&Copy', QtWidgets.QApplication.translate("MainWindow", "Copy", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('&Copy', QtWidgets.QApplication.translate("MainWindow", "Copy"))
elif 'All' in text:
text = text.replace('Select All', QtWidgets.QApplication.translate("MainWindow", "Select all", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('Select All', QtWidgets.QApplication.translate("MainWindow", "Select all"))
elif 'Delete' in text:
text = text.replace('Delete', QtWidgets.QApplication.translate("MainWindow", "Delete", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('Delete', QtWidgets.QApplication.translate("MainWindow", "Delete"))
elif '&Paste' in text:
text = text.replace('&Paste', QtWidgets.QApplication.translate("MainWindow", "Paste", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('&Paste', QtWidgets.QApplication.translate("MainWindow", "Paste"))
elif 'Cu&t' in text:
text = text.replace('Cu&t', QtWidgets.QApplication.translate("MainWindow", "Cut", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('Cu&t', QtWidgets.QApplication.translate("MainWindow", "Cut"))
elif '&Undo' in text:
text = text.replace('&Undo', QtWidgets.QApplication.translate("MainWindow", "Undo", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('&Undo', QtWidgets.QApplication.translate("MainWindow", "Undo"))
elif '&Redo' in text:
text = text.replace('&Redo', QtWidgets.QApplication.translate("MainWindow", "Redo", None,
QtWidgets.QApplication.UnicodeUTF8))
text = text.replace('&Redo', QtWidgets.QApplication.translate("MainWindow", "Redo"))
else:
menu.removeAction(action)
continue