notifications and audio settings views converted
This commit is contained in:
parent
370716015b
commit
13b2d17786
@ -29,9 +29,9 @@ class CreateProfileScreen(CenteredWidget, DialogWithResult):
|
||||
uic.loadUi(util.get_views_path('create_profile_screen'), self)
|
||||
self.center()
|
||||
self.createProfile.clicked.connect(self._create_profile)
|
||||
self.retranslateUi()
|
||||
self._retranslate_ui()
|
||||
|
||||
def retranslateUi(self):
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr('New profile settings'))
|
||||
self.defaultFolder.setText(util_ui.tr('Save in default folder'))
|
||||
self.programFolder.setText(util_ui.tr('Save in program folder'))
|
||||
|
@ -11,11 +11,14 @@ class CreateGroupScreen(CenteredWidget):
|
||||
self._groups_service = groups_service
|
||||
uic.loadUi(util.get_views_path('create_group_screen'), self)
|
||||
self.center()
|
||||
self.retranslateUi()
|
||||
self._update_ui()
|
||||
|
||||
def _update_ui(self):
|
||||
self._retranslate_ui()
|
||||
self.addGroupButton.clicked.connect(self._create_group)
|
||||
self.groupNameLineEdit.textChanged.connect(self._group_name_changed)
|
||||
|
||||
def retranslateUi(self):
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr('Create new group chat'))
|
||||
self.groupNameLabel.setText(util_ui.tr('Group name:'))
|
||||
self.groupTypeLabel.setText(util_ui.tr('Group type:'))
|
||||
@ -42,11 +45,13 @@ class JoinGroupScreen(CenteredWidget):
|
||||
self._groups_service = groups_service
|
||||
uic.loadUi(util.get_views_path('join_group_screen'), self)
|
||||
self.center()
|
||||
self.retranslateUi()
|
||||
|
||||
def _update_ui(self):
|
||||
self._retranslate_ui()
|
||||
self.chatIdLineEdit.textChanged.connect(self._chat_id_changed)
|
||||
self.joinGroupButton.clicked.connect(self._join_group)
|
||||
|
||||
def retranslateUi(self):
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr('Join public group chat'))
|
||||
self.chatIdLabel.setText(util_ui.tr('Group ID:'))
|
||||
self.passwordLabel.setText(util_ui.tr('Password:'))
|
||||
|
@ -41,15 +41,6 @@ class LoginScreen(CenteredWidget, DialogWithResult):
|
||||
self._profiles = []
|
||||
self._update_ui()
|
||||
|
||||
def retranslateUi(self):
|
||||
self.setWindowTitle(util_ui.tr('Log in'))
|
||||
self.profileNameLineEdit.setPlaceholderText(util_ui.tr('Profile name'))
|
||||
self.createProfilePushButton.setText(util_ui.tr('Create'))
|
||||
self.loadProfilePushButton.setText(util_ui.tr('Load profile'))
|
||||
self.defaultProfileCheckBox.setText(util_ui.tr('Use as default'))
|
||||
self.existingProfileGroupBox.setTitle(util_ui.tr('Load existing profile'))
|
||||
self.newProfileGroupBox.setTitle(util_ui.tr('Create new profile'))
|
||||
|
||||
def update_select(self, profiles):
|
||||
profiles = sorted(profiles, key=lambda p: p[1])
|
||||
self._profiles = list(profiles)
|
||||
@ -59,7 +50,7 @@ class LoginScreen(CenteredWidget, DialogWithResult):
|
||||
def _update_ui(self):
|
||||
self.profileNameLineEdit = LineEditWithEnterSupport(self._create_profile, self)
|
||||
self.profileNameLineEdit.setGeometry(QtCore.QRect(20, 100, 170, 30))
|
||||
self.retranslateUi()
|
||||
self._retranslate_ui()
|
||||
self.createProfilePushButton.clicked.connect(self._create_profile)
|
||||
self.loadProfilePushButton.clicked.connect(self._load_existing_profile)
|
||||
|
||||
@ -75,3 +66,12 @@ class LoginScreen(CenteredWidget, DialogWithResult):
|
||||
path = util.join_path(self._profiles[index][0], self._profiles[index][1] + '.tox')
|
||||
result = LoginScreenResult(path, load_as_default)
|
||||
self.close_with_result(result)
|
||||
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr('Log in'))
|
||||
self.profileNameLineEdit.setPlaceholderText(util_ui.tr('Profile name'))
|
||||
self.createProfilePushButton.setText(util_ui.tr('Create'))
|
||||
self.loadProfilePushButton.setText(util_ui.tr('Load profile'))
|
||||
self.defaultProfileCheckBox.setText(util_ui.tr('Use as default'))
|
||||
self.existingProfileGroupBox.setTitle(util_ui.tr('Load existing profile'))
|
||||
self.newProfileGroupBox.setTitle(util_ui.tr('Create new profile'))
|
||||
|
@ -1,4 +1,4 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets, uic
|
||||
from user_data.settings import *
|
||||
from utils.util import *
|
||||
from ui.widgets import CenteredWidget, DataLabel, LineEdit, RubberBandWindow
|
||||
@ -493,50 +493,31 @@ class NotificationsSettings(CenteredWidget):
|
||||
def __init__(self, setttings):
|
||||
super().__init__()
|
||||
self._settings = setttings
|
||||
self.initUI()
|
||||
uic.loadUi(get_views_path('notifications_settings_screen'), self)
|
||||
self._update_ui()
|
||||
self.center()
|
||||
|
||||
def initUI(self):
|
||||
self.setObjectName("notificationsForm")
|
||||
self.resize(350, 210)
|
||||
self.setMinimumSize(QtCore.QSize(350, 210))
|
||||
self.setMaximumSize(QtCore.QSize(350, 210))
|
||||
self.enableNotifications = QtWidgets.QCheckBox(self)
|
||||
self.enableNotifications.setGeometry(QtCore.QRect(10, 20, 340, 18))
|
||||
self.callsSound = QtWidgets.QCheckBox(self)
|
||||
self.callsSound.setGeometry(QtCore.QRect(10, 170, 340, 18))
|
||||
self.soundNotifications = QtWidgets.QCheckBox(self)
|
||||
self.soundNotifications.setGeometry(QtCore.QRect(10, 70, 340, 18))
|
||||
self.groupNotifications = QtWidgets.QCheckBox(self)
|
||||
self.groupNotifications.setGeometry(QtCore.QRect(10, 120, 340, 18))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily(self._settings['font'])
|
||||
font.setPointSize(12)
|
||||
self.callsSound.setFont(font)
|
||||
self.soundNotifications.setFont(font)
|
||||
self.enableNotifications.setFont(font)
|
||||
self.groupNotifications.setFont(font)
|
||||
self.enableNotifications.setChecked(self._settings['notifications'])
|
||||
self.soundNotifications.setChecked(self._settings['sound_notifications'])
|
||||
self.groupNotifications.setChecked(self._settings['group_notifications'])
|
||||
self.callsSound.setChecked(self._settings['calls_sound'])
|
||||
self.retranslateUi()
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.setWindowTitle(util_ui.tr("Notification settings"))
|
||||
self.enableNotifications.setText(util_ui.tr("Enable notifications"))
|
||||
self.groupNotifications.setText(util_ui.tr("Notify about all messages in groups"))
|
||||
self.callsSound.setText(util_ui.tr("Enable call\'s sound"))
|
||||
self.soundNotifications.setText(util_ui.tr("Enable sound notifications"))
|
||||
|
||||
def closeEvent(self, *args, **kwargs):
|
||||
self._settings['notifications'] = self.enableNotifications.isChecked()
|
||||
self._settings['sound_notifications'] = self.soundNotifications.isChecked()
|
||||
self._settings['group_notifications'] = self.groupNotifications.isChecked()
|
||||
self._settings['calls_sound'] = self.callsSound.isChecked()
|
||||
self._settings['notifications'] = self.notificationsCheckBox.isChecked()
|
||||
self._settings['sound_notifications'] = self.soundNotificationsCheckBox.isChecked()
|
||||
self._settings['group_notifications'] = self.groupNotificationsCheckBox.isChecked()
|
||||
self._settings['calls_sound'] = self.callsSoundCheckBox.isChecked()
|
||||
self._settings.save()
|
||||
|
||||
def _update_ui(self):
|
||||
self.notificationsCheckBox.setChecked(self._settings['notifications'])
|
||||
self.soundNotificationsCheckBox.setChecked(self._settings['sound_notifications'])
|
||||
self.groupNotificationsCheckBox.setChecked(self._settings['group_notifications'])
|
||||
self.callsSoundCheckBox.setChecked(self._settings['calls_sound'])
|
||||
self._retranslate_ui()
|
||||
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr("Notifications settings"))
|
||||
self.notificationsCheckBox.setText(util_ui.tr("Enable notifications"))
|
||||
self.groupNotificationsCheckBox.setText(util_ui.tr("Notify about all messages in groups"))
|
||||
self.callsSoundCheckBox.setText(util_ui.tr("Enable call\'s sound"))
|
||||
self.soundNotificationsCheckBox.setText(util_ui.tr("Enable sound notifications"))
|
||||
|
||||
|
||||
class InterfaceSettings(CenteredWidget):
|
||||
"""Interface settings form"""
|
||||
@ -729,52 +710,35 @@ class AudioSettings(CenteredWidget):
|
||||
def __init__(self, settings):
|
||||
super().__init__()
|
||||
self._settings = settings
|
||||
self.initUI()
|
||||
self.retranslateUi()
|
||||
self._in_indexes = self._out_indexes = None
|
||||
uic.loadUi(get_views_path('audio_settings_screen'), self)
|
||||
self._update_ui()
|
||||
self.center()
|
||||
|
||||
def initUI(self):
|
||||
self.setObjectName("audioSettingsForm")
|
||||
self.resize(400, 150)
|
||||
self.setMinimumSize(QtCore.QSize(400, 150))
|
||||
self.setMaximumSize(QtCore.QSize(400, 150))
|
||||
self.in_label = QtWidgets.QLabel(self)
|
||||
self.in_label.setGeometry(QtCore.QRect(25, 5, 350, 20))
|
||||
self.out_label = QtWidgets.QLabel(self)
|
||||
self.out_label.setGeometry(QtCore.QRect(25, 65, 350, 20))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(16)
|
||||
font.setBold(True)
|
||||
font.setFamily(self._settings['font'])
|
||||
self.in_label.setFont(font)
|
||||
self.out_label.setFont(font)
|
||||
self.input = QtWidgets.QComboBox(self)
|
||||
self.input.setGeometry(QtCore.QRect(25, 30, 350, 30))
|
||||
self.output = QtWidgets.QComboBox(self)
|
||||
self.output.setGeometry(QtCore.QRect(25, 90, 350, 30))
|
||||
def closeEvent(self, event):
|
||||
self._settings.audio['input'] = self._in_indexes[self.inputDeviceComboBox.currentIndex()]
|
||||
self._settings.audio['output'] = self._out_indexes[self.outputDeviceComboBox.currentIndex()]
|
||||
self._settings.save()
|
||||
|
||||
def _update_ui(self):
|
||||
p = pyaudio.PyAudio()
|
||||
self.in_indexes, self.out_indexes = [], []
|
||||
self._in_indexes, self._out_indexes = [], []
|
||||
for i in range(p.get_device_count()):
|
||||
device = p.get_device_info_by_index(i)
|
||||
if device["maxInputChannels"]:
|
||||
self.input.addItem(str(device["name"]))
|
||||
self.in_indexes.append(i)
|
||||
self.inputDeviceComboBox.addItem(str(device["name"]))
|
||||
self._in_indexes.append(i)
|
||||
if device["maxOutputChannels"]:
|
||||
self.output.addItem(str(device["name"]))
|
||||
self.out_indexes.append(i)
|
||||
self.input.setCurrentIndex(self.in_indexes.index(self._settings.audio['input']))
|
||||
self.output.setCurrentIndex(self.out_indexes.index(self._settings.audio['output']))
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
self.outputDeviceComboBox.addItem(str(device["name"]))
|
||||
self._out_indexes.append(i)
|
||||
self.inputDeviceComboBox.setCurrentIndex(self._in_indexes.index(self._settings.audio['input']))
|
||||
self.outputDeviceComboBox.setCurrentIndex(self._out_indexes.index(self._settings.audio['output']))
|
||||
self._retranslate_ui()
|
||||
|
||||
def retranslateUi(self):
|
||||
def _retranslate_ui(self):
|
||||
self.setWindowTitle(util_ui.tr("Audio settings"))
|
||||
self.in_label.setText(util_ui.tr("Input device:"))
|
||||
self.out_label.setText(util_ui.tr("Output device:"))
|
||||
|
||||
def closeEvent(self, event):
|
||||
self._settings.audio['input'] = self.in_indexes[self.input.currentIndex()]
|
||||
self._settings.audio['output'] = self.out_indexes[self.output.currentIndex()]
|
||||
self._settings.save()
|
||||
self.inputDeviceLabel.setText(util_ui.tr("Input device:"))
|
||||
self.outputDeviceLabel.setText(util_ui.tr("Output device:"))
|
||||
|
||||
|
||||
class DesktopAreaSelectionWindow(RubberBandWindow):
|
||||
|
87
toxygen/ui/views/audio_settings_screen.ui
Normal file
87
toxygen/ui/views/audio_settings_screen.ui
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>315</width>
|
||||
<height>218</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>315</width>
|
||||
<height>218</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>315</width>
|
||||
<height>218</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="inputDeviceLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>10</y>
|
||||
<width>261</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="outputDeviceLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<width>261</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="inputDeviceComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>50</y>
|
||||
<width>255</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="outputDeviceComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>140</y>
|
||||
<width>255</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -7,19 +7,19 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>380</height>
|
||||
<height>340</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>380</height>
|
||||
<height>340</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>380</height>
|
||||
<height>340</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -29,7 +29,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>290</y>
|
||||
<y>270</y>
|
||||
<width>341</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
@ -42,7 +42,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>190</y>
|
||||
<y>170</y>
|
||||
<width>341</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -55,7 +55,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>140</y>
|
||||
<y>120</y>
|
||||
<width>341</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -68,7 +68,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>100</y>
|
||||
<y>80</y>
|
||||
<width>330</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
@ -97,7 +97,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>50</y>
|
||||
<y>40</y>
|
||||
<width>330</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -110,7 +110,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>250</y>
|
||||
<y>220</y>
|
||||
<width>341</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
|
71
toxygen/ui/views/notifications_settings_screen.ui
Normal file
71
toxygen/ui/views/notifications_settings_screen.ui
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QCheckBox" name="notificationsCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>271</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="soundNotificationsCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>271</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="groupNotificationsCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>100</y>
|
||||
<width>271</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="callsSoundCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>271</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user