network settings screen converted
This commit is contained in:
parent
a0cae14727
commit
595c35a6b8
6 changed files with 245 additions and 75 deletions
|
@ -46,6 +46,7 @@ before_script:
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
|
- echo '/usr/local/lib/' | sudo tee -a /etc/ld.so.conf.d/locallib.conf
|
||||||
- sudo ldconfig
|
- sudo ldconfig
|
||||||
|
- cd ..
|
||||||
script:
|
script:
|
||||||
- py.test tests/travis.py
|
- py.test tests/travis.py
|
||||||
- py.test tests/tests.py
|
- py.test tests/tests.py
|
||||||
|
|
|
@ -9,7 +9,7 @@ __version__ = '0.5.0'
|
||||||
|
|
||||||
|
|
||||||
def clean():
|
def clean():
|
||||||
"""Removes all windows libs from libs folder"""
|
"""Removes libs folder"""
|
||||||
directory = util.get_libs_directory()
|
directory = util.get_libs_directory()
|
||||||
util.remove(directory)
|
util.remove(directory)
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ def print_toxygen_version():
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--version', action='store_true', help='Prints Toxygen version')
|
parser.add_argument('--version', action='store_true', help='Prints Toxygen version')
|
||||||
parser.add_argument('--clean', action='store_true', help='Deletes toxcore libs from libs folder')
|
parser.add_argument('--clean', action='store_true', help='Delete toxcore libs from libs folder')
|
||||||
parser.add_argument('--reset', action='store_true', help='Resets default profile')
|
parser.add_argument('--reset', action='store_true', help='Reset default profile')
|
||||||
parser.add_argument('--uri', help='Adds specified TOX ID to friends')
|
parser.add_argument('--uri', help='Add specified Tox ID to friends')
|
||||||
parser.add_argument('profile', nargs='?', default=None, help='Path to TOX profile')
|
parser.add_argument('profile', nargs='?', default=None, help='Path to Tox profile')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.version:
|
if args.version:
|
||||||
|
|
|
@ -1322,3 +1322,8 @@ ClickableLabel:hover
|
||||||
{
|
{
|
||||||
background-color: #4A4949;
|
background-color: #4A4949;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warningLabel
|
||||||
|
{
|
||||||
|
color: #BC1C1C;
|
||||||
|
}
|
||||||
|
|
|
@ -27,3 +27,8 @@ MessageEdit
|
||||||
{
|
{
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warningLabel
|
||||||
|
{
|
||||||
|
color: #BC1C1C;
|
||||||
|
}
|
||||||
|
|
|
@ -254,82 +254,61 @@ class NetworkSettings(CenteredWidget):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._settings = settings
|
self._settings = settings
|
||||||
self._reset = reset
|
self._reset = reset
|
||||||
self.initUI()
|
uic.loadUi(get_views_path('network_settings_screen'), self)
|
||||||
self.center()
|
self._update_ui()
|
||||||
|
|
||||||
def initUI(self):
|
def _update_ui(self):
|
||||||
self.setObjectName("NetworkSettings")
|
self.ipLineEdit = LineEdit(self)
|
||||||
self.resize(300, 400)
|
self.ipLineEdit.setGeometry(100, 280, 270, 30)
|
||||||
self.setMinimumSize(QtCore.QSize(300, 400))
|
self.portLineEdit = LineEdit(self)
|
||||||
self.setMaximumSize(QtCore.QSize(300, 400))
|
self.portLineEdit.setGeometry(100, 325, 270, 30)
|
||||||
self.setBaseSize(QtCore.QSize(300, 400))
|
self.restartCorePushButton.clicked.connect(self._restart_core)
|
||||||
self.ipv = QtWidgets.QCheckBox(self)
|
self.ipv6CheckBox.setChecked(self._settings['ipv6_enabled'])
|
||||||
self.ipv.setGeometry(QtCore.QRect(20, 10, 97, 22))
|
self.udpCheckBox.setChecked(self._settings['udp_enabled'])
|
||||||
self.ipv.setObjectName("ipv")
|
self.proxyCheckBox.setChecked(self._settings['proxy_type'])
|
||||||
self.udp = QtWidgets.QCheckBox(self)
|
self.ipLineEdit.setText(self._settings['proxy_host'])
|
||||||
self.udp.setGeometry(QtCore.QRect(150, 10, 97, 22))
|
self.portLineEdit.setText(str(self._settings['proxy_port']))
|
||||||
self.udp.setObjectName("udp")
|
self.httpProxyRadioButton.setChecked(self._settings['proxy_type'] == 1)
|
||||||
self.proxy = QtWidgets.QCheckBox(self)
|
self.socksProxyRadioButton.setChecked(self._settings['proxy_type'] != 1)
|
||||||
self.proxy.setGeometry(QtCore.QRect(20, 40, 97, 22))
|
self.downloadNodesCheckBox.setChecked(self._settings['download_nodes_list'])
|
||||||
self.http = QtWidgets.QCheckBox(self)
|
self.lanCheckBox.setChecked(self._settings['lan_discovery'])
|
||||||
self.http.setGeometry(QtCore.QRect(20, 70, 97, 22))
|
self._retranslate_ui()
|
||||||
self.proxy.setObjectName("proxy")
|
self.proxyCheckBox.stateChanged.connect(lambda x: self._activate_proxy())
|
||||||
self.proxyip = LineEdit(self)
|
self._activate_proxy()
|
||||||
self.proxyip.setGeometry(QtCore.QRect(40, 130, 231, 27))
|
|
||||||
self.proxyip.setObjectName("proxyip")
|
|
||||||
self.proxyport = LineEdit(self)
|
|
||||||
self.proxyport.setGeometry(QtCore.QRect(40, 190, 231, 27))
|
|
||||||
self.proxyport.setObjectName("proxyport")
|
|
||||||
self.label = QtWidgets.QLabel(self)
|
|
||||||
self.label.setGeometry(QtCore.QRect(40, 100, 66, 17))
|
|
||||||
self.label_2 = QtWidgets.QLabel(self)
|
|
||||||
self.label_2.setGeometry(QtCore.QRect(40, 165, 66, 17))
|
|
||||||
self.reconnect = QtWidgets.QPushButton(self)
|
|
||||||
self.reconnect.setGeometry(QtCore.QRect(40, 230, 231, 30))
|
|
||||||
self.reconnect.clicked.connect(self.restart_core)
|
|
||||||
self.ipv.setChecked(self._settings['ipv6_enabled'])
|
|
||||||
self.udp.setChecked(self._settings['udp_enabled'])
|
|
||||||
self.proxy.setChecked(self._settings['proxy_type'])
|
|
||||||
self.proxyip.setText(self._settings['proxy_host'])
|
|
||||||
self.proxyport.setText(str(self._settings['proxy_port']))
|
|
||||||
self.http.setChecked(self._settings['proxy_type'] == 1)
|
|
||||||
self.warning = QtWidgets.QLabel(self)
|
|
||||||
self.warning.setGeometry(QtCore.QRect(5, 270, 290, 60))
|
|
||||||
self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
|
|
||||||
self.nodes = QtWidgets.QCheckBox(self)
|
|
||||||
self.nodes.setGeometry(QtCore.QRect(20, 350, 270, 22))
|
|
||||||
self.nodes.setChecked(self._settings['download_nodes_list'])
|
|
||||||
self.retranslateUi()
|
|
||||||
self.proxy.stateChanged.connect(lambda x: self.activate())
|
|
||||||
self.activate()
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(self)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def _retranslate_ui(self):
|
||||||
self.setWindowTitle(util_ui.tr("Network settings"))
|
self.setWindowTitle(util_ui.tr("Network settings"))
|
||||||
self.ipv.setText(util_ui.tr("IPv6"))
|
self.ipv6CheckBox.setText(util_ui.tr("IPv6"))
|
||||||
self.udp.setText(util_ui.tr("UDP"))
|
self.udpCheckBox.setText(util_ui.tr("UDP"))
|
||||||
self.proxy.setText(util_ui.tr("Proxy"))
|
self.lanCheckBox.setText(util_ui.tr("LAN"))
|
||||||
self.label.setText(util_ui.tr("IP:"))
|
self.proxyCheckBox.setText(util_ui.tr("Proxy"))
|
||||||
self.label_2.setText(util_ui.tr("Port:"))
|
self.ipLabel.setText(util_ui.tr("IP:"))
|
||||||
self.reconnect.setText(util_ui.tr("Restart TOX core"))
|
self.portLabel.setText(util_ui.tr("Port:"))
|
||||||
self.http.setText(util_ui.tr("HTTP"))
|
self.restartCorePushButton.setText(util_ui.tr("Restart TOX core"))
|
||||||
self.nodes.setText(util_ui.tr("Download nodes list from tox.chat"))
|
self.httpProxyRadioButton.setText(util_ui.tr("HTTP"))
|
||||||
self.warning.setText(util_ui.tr("WARNING:\nusing proxy with enabled UDP\ncan produce IP leak"))
|
self.socksProxyRadioButton.setText(util_ui.tr("Socks 5"))
|
||||||
|
self.downloadNodesCheckBox.setText(util_ui.tr("Download nodes list from tox.chat"))
|
||||||
|
self.warningLabel.setText(util_ui.tr("WARNING:\nusing proxy with enabled UDP\ncan produce IP leak"))
|
||||||
|
|
||||||
def activate(self):
|
def _activate_proxy(self):
|
||||||
bl = self.proxy.isChecked()
|
bl = self.proxyCheckBox.isChecked()
|
||||||
self.proxyip.setEnabled(bl)
|
self.ipLineEdit.setEnabled(bl)
|
||||||
self.http.setEnabled(bl)
|
self.portLineEdit.setEnabled(bl)
|
||||||
self.proxyport.setEnabled(bl)
|
self.httpProxyRadioButton.setEnabled(bl)
|
||||||
|
self.socksProxyRadioButton.setEnabled(bl)
|
||||||
|
self.ipLabel.setEnabled(bl)
|
||||||
|
self.portLabel.setEnabled(bl)
|
||||||
|
|
||||||
def restart_core(self):
|
def _restart_core(self):
|
||||||
try:
|
try:
|
||||||
self._settings['ipv6_enabled'] = self.ipv.isChecked()
|
self._settings['ipv6_enabled'] = self.ipv6CheckBox.isChecked()
|
||||||
self._settings['udp_enabled'] = self.udp.isChecked()
|
self._settings['udp_enabled'] = self.udpCheckBox.isChecked()
|
||||||
self._settings['proxy_type'] = 2 - int(self.http.isChecked()) if self.proxy.isChecked() else 0
|
proxy_enabled = self.proxyCheckBox.isChecked()
|
||||||
self._settings['proxy_host'] = str(self.proxyip.text())
|
self._settings['proxy_type'] = 2 - int(self.httpProxyRadioButton.isChecked()) if proxy_enabled else 0
|
||||||
self._settings['proxy_port'] = int(self.proxyport.text())
|
self._settings['proxy_host'] = str(self.ipLineEdit.text())
|
||||||
self._settings['download_nodes_list'] = self.nodes.isChecked()
|
self._settings['proxy_port'] = int(self.portLineEdit.text())
|
||||||
|
self._settings['download_nodes_list'] = self.downloadNodesCheckBox.isChecked()
|
||||||
|
self._settings['lan_discovery'] = self.lanCheckBox.isChecked()
|
||||||
self._settings.save()
|
self._settings.save()
|
||||||
# recreate tox instance
|
# recreate tox instance
|
||||||
self._reset()
|
self._reset()
|
||||||
|
|
180
toxygen/ui/views/network_settings_screen.ui
Normal file
180
toxygen/ui/views/network_settings_screen.ui
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
<?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>500</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>500</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>500</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QCheckBox" name="ipv6CheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="udpCheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>210</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="proxyCheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="httpProxyRadioButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>190</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>RadioButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="socksProxyRadioButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>230</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>RadioButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="lanCheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>150</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="ipLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>280</y>
|
||||||
|
<width>60</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="portLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>60</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="restartCorePushButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>370</y>
|
||||||
|
<width>340</width>
|
||||||
|
<height>40</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PushButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="downloadNodesCheckBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>340</width>
|
||||||
|
<height>30</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="warningLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>420</y>
|
||||||
|
<width>340</width>
|
||||||
|
<height>65</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in a new issue