update settings screen converted
This commit is contained in:
parent
13b2d17786
commit
238f7e367a
@ -361,7 +361,7 @@ class App:
|
|||||||
self._tray = tray.init_tray(self._profile, self._settings, self._ms, self._toxes)
|
self._tray = tray.init_tray(self._profile, self._settings, self._ms, self._toxes)
|
||||||
self._ms.set_dependencies(widgets_factory, self._tray, self._contacts_manager, self._messenger, self._profile,
|
self._ms.set_dependencies(widgets_factory, self._tray, self._contacts_manager, self._messenger, self._profile,
|
||||||
self._plugin_loader, self._file_transfer_handler, history, self._calls_manager,
|
self._plugin_loader, self._file_transfer_handler, history, self._calls_manager,
|
||||||
self._groups_service)
|
self._groups_service, self._toxes)
|
||||||
|
|
||||||
self._tray.show()
|
self._tray.show()
|
||||||
self._ms.show()
|
self._ms.show()
|
||||||
|
@ -17,13 +17,13 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self._plugins_loader = None
|
self._plugins_loader = None
|
||||||
self.setAcceptDrops(True)
|
self.setAcceptDrops(True)
|
||||||
self._saved = False
|
self._saved = False
|
||||||
self._profile = None
|
self._profile = self._toxes = None
|
||||||
self._file_transfer_handler = self._history_loader = self._groups_service = self._calls_manager = None
|
self._file_transfer_handler = self._history_loader = self._groups_service = self._calls_manager = None
|
||||||
self._should_show_group_peers_list = False
|
self._should_show_group_peers_list = False
|
||||||
self.initUI()
|
self.initUI()
|
||||||
|
|
||||||
def set_dependencies(self, widget_factory, tray, contacts_manager, messenger, profile, plugins_loader,
|
def set_dependencies(self, widget_factory, tray, contacts_manager, messenger, profile, plugins_loader,
|
||||||
file_transfer_handler, history_loader, calls_manager, groups_service):
|
file_transfer_handler, history_loader, calls_manager, groups_service, toxes):
|
||||||
self._widget_factory = widget_factory
|
self._widget_factory = widget_factory
|
||||||
self._tray = tray
|
self._tray = tray
|
||||||
self._contacts_manager = contacts_manager
|
self._contacts_manager = contacts_manager
|
||||||
@ -33,6 +33,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self._history_loader = history_loader
|
self._history_loader = history_loader
|
||||||
self._calls_manager = calls_manager
|
self._calls_manager = calls_manager
|
||||||
self._groups_service = groups_service
|
self._groups_service = groups_service
|
||||||
|
self._toxes = toxes
|
||||||
self._contacts_manager.active_contact_changed.add_callback(self._new_contact_selected)
|
self._contacts_manager.active_contact_changed.add_callback(self._new_contact_selected)
|
||||||
self.messageEdit.set_messenger(messenger)
|
self.messageEdit.set_messenger(messenger)
|
||||||
|
|
||||||
|
@ -946,55 +946,44 @@ class UpdateSettings(CenteredWidget):
|
|||||||
Updates settings form
|
Updates settings form
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, settings):
|
def __init__(self, settings, version):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._settings = settings
|
self._settings = settings
|
||||||
self.initUI()
|
self._version = version
|
||||||
|
uic.loadUi(get_views_path('update_settings_screen'), self)
|
||||||
|
self._update_ui()
|
||||||
self.center()
|
self.center()
|
||||||
|
|
||||||
def initUI(self):
|
|
||||||
self.setObjectName("updateSettingsForm")
|
|
||||||
self.resize(400, 150)
|
|
||||||
self.setMinimumSize(QtCore.QSize(400, 120))
|
|
||||||
self.setMaximumSize(QtCore.QSize(400, 120))
|
|
||||||
self.in_label = QtWidgets.QLabel(self)
|
|
||||||
self.in_label.setGeometry(QtCore.QRect(25, 5, 350, 20))
|
|
||||||
font = QtGui.QFont()
|
|
||||||
font.setPointSize(16)
|
|
||||||
font.setBold(True)
|
|
||||||
font.setFamily(self._settings['font'])
|
|
||||||
self.in_label.setFont(font)
|
|
||||||
self.autoupdate = QtWidgets.QComboBox(self)
|
|
||||||
self.autoupdate.setGeometry(QtCore.QRect(25, 30, 350, 30))
|
|
||||||
self.button = QtWidgets.QPushButton(self)
|
|
||||||
self.button.setGeometry(QtCore.QRect(25, 70, 350, 30))
|
|
||||||
self.button.setEnabled(self._settings['update'])
|
|
||||||
self.button.clicked.connect(self.update_client)
|
|
||||||
|
|
||||||
self.retranslateUi()
|
|
||||||
self.autoupdate.setCurrentIndex(self._settings['update'])
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(self)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
|
||||||
self.setWindowTitle(util_ui.tr("Update settings"))
|
|
||||||
self.in_label.setText(util_ui.tr("Select update mode:"))
|
|
||||||
self.button.setText(util_ui.tr("Update Toxygen"))
|
|
||||||
self.autoupdate.addItem(util_ui.tr("Disabled"))
|
|
||||||
self.autoupdate.addItem(util_ui.tr("Manual"))
|
|
||||||
self.autoupdate.addItem(util_ui.tr("Auto"))
|
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
self._settings['update'] = self.autoupdate.currentIndex()
|
self._settings['update'] = self.updateModeComboBox.currentIndex()
|
||||||
self._settings.save()
|
self._settings.save()
|
||||||
|
|
||||||
def update_client(self):
|
def _update_ui(self):
|
||||||
|
self.updatePushButton.clicked.connect(self._update_client)
|
||||||
|
self.updateModeComboBox.currentIndexChanged.connect(self._update_mode_changed)
|
||||||
|
self._retranslate_ui()
|
||||||
|
self.updateModeComboBox.setCurrentIndex(self._settings['update'])
|
||||||
|
|
||||||
|
def _update_mode_changed(self):
|
||||||
|
index = self.updateModeComboBox.currentIndex()
|
||||||
|
self.updatePushButton.setEnabled(index > 0)
|
||||||
|
|
||||||
|
def _retranslate_ui(self):
|
||||||
|
self.setWindowTitle(util_ui.tr("Update settings"))
|
||||||
|
self.updateModeLabel.setText(util_ui.tr("Select update mode:"))
|
||||||
|
self.updatePushButton.setText(util_ui.tr("Update Toxygen"))
|
||||||
|
self.updateModeComboBox.addItem(util_ui.tr("Disabled"))
|
||||||
|
self.updateModeComboBox.addItem(util_ui.tr("Manual"))
|
||||||
|
self.updateModeComboBox.addItem(util_ui.tr("Auto"))
|
||||||
|
|
||||||
|
def _update_client(self):
|
||||||
if not updater.connection_available():
|
if not updater.connection_available():
|
||||||
util_ui.message_box(util_ui.tr('Problems with internet connection'), util_ui.tr("Error"))
|
util_ui.message_box(util_ui.tr('Problems with internet connection'), util_ui.tr("Error"))
|
||||||
return
|
return
|
||||||
if not updater.updater_available():
|
if not updater.updater_available():
|
||||||
util_ui.message_box(util_ui.tr('Updater not found'), util_ui.tr("Error"))
|
util_ui.message_box(util_ui.tr('Updater not found'), util_ui.tr("Error"))
|
||||||
return
|
return
|
||||||
version = updater.check_for_updates()
|
version = updater.check_for_updates(self._version, self._settings)
|
||||||
if version is not None:
|
if version is not None:
|
||||||
updater.download(version)
|
updater.download(version)
|
||||||
util_ui.close_all_windows()
|
util_ui.close_all_windows()
|
||||||
|
67
toxygen/ui/views/update_settings_screen.ui
Normal file
67
toxygen/ui/views/update_settings_screen.ui
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?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>400</width>
|
||||||
|
<height>120</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>120</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>120</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="updateModeLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>25</x>
|
||||||
|
<y>5</y>
|
||||||
|
<width>350</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="updateModeComboBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>25</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>350</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="updatePushButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>25</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>350</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PushButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -38,7 +38,7 @@ class WidgetsFactory:
|
|||||||
return VideoSettings(self._settings)
|
return VideoSettings(self._settings)
|
||||||
|
|
||||||
def create_update_settings_window(self):
|
def create_update_settings_window(self):
|
||||||
return UpdateSettings(self._settings)
|
return UpdateSettings(self._settings, self._version)
|
||||||
|
|
||||||
def create_plugins_settings_window(self):
|
def create_plugins_settings_window(self):
|
||||||
return PluginsSettings(self._plugin_loader)
|
return PluginsSettings(self._plugin_loader)
|
||||||
|
Loading…
Reference in New Issue
Block a user