Preferences/ConfigurationPages/NetworkPage.py

changeset 4577
e79a139aacc4
parent 4350
686c79ffbcff
child 4582
3a1d1d4c6f4f
equal deleted inserted replaced
4576:a258569d44db 4577:e79a139aacc4
7 Module implementing the Network configuration page. 7 Module implementing the Network configuration page.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os
13
14 from PyQt5.QtCore import pyqtSlot 12 from PyQt5.QtCore import pyqtSlot
15 13
16 from E5Gui.E5Completers import E5DirCompleter 14 from E5Gui.E5PathPicker import E5PathPickerModes
17 from E5Gui import E5FileDialog 15
18 from E5Network.E5Ftp import E5FtpProxyType 16 from E5Network.E5Ftp import E5FtpProxyType
19 17
20 from .ConfigurationPageBase import ConfigurationPageBase 18 from .ConfigurationPageBase import ConfigurationPageBase
21 from .Ui_NetworkPage import Ui_NetworkPage 19 from .Ui_NetworkPage import Ui_NetworkPage
22 20
23 import Preferences 21 import Preferences
24 import Utilities
25 import UI.PixmapCache
26 22
27 23
28 class NetworkPage(ConfigurationPageBase, Ui_NetworkPage): 24 class NetworkPage(ConfigurationPageBase, Ui_NetworkPage):
29 """ 25 """
30 Class implementing the Network configuration page. 26 Class implementing the Network configuration page.
35 """ 31 """
36 super(NetworkPage, self).__init__() 32 super(NetworkPage, self).__init__()
37 self.setupUi(self) 33 self.setupUi(self)
38 self.setObjectName("NetworkPage") 34 self.setObjectName("NetworkPage")
39 35
40 self.downloadDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) 36 self.downloadDirPicker.setMode(E5PathPickerModes.DiretoryMode)
41
42 self.downloadDirCompleter = E5DirCompleter(self.downloadDirEdit)
43 37
44 self.ftpProxyTypeCombo.addItem( 38 self.ftpProxyTypeCombo.addItem(
45 self.tr("No FTP Proxy"), E5FtpProxyType.NoProxy) 39 self.tr("No FTP Proxy"), E5FtpProxyType.NoProxy)
46 self.ftpProxyTypeCombo.addItem( 40 self.ftpProxyTypeCombo.addItem(
47 self.tr("No Proxy Authentication required"), 41 self.tr("No Proxy Authentication required"),
61 self.tr("AUTH and RESP"), E5FtpProxyType.AuthResp) 55 self.tr("AUTH and RESP"), E5FtpProxyType.AuthResp)
62 self.ftpProxyTypeCombo.addItem( 56 self.ftpProxyTypeCombo.addItem(
63 self.tr("Bluecoat Proxy"), E5FtpProxyType.Bluecoat) 57 self.tr("Bluecoat Proxy"), E5FtpProxyType.Bluecoat)
64 58
65 # set initial values 59 # set initial values
66 self.downloadDirEdit.setText(Preferences.getUI("DownloadPath")) 60 self.downloadDirPicker.setText(Preferences.getUI("DownloadPath"))
67 self.requestFilenameCheckBox.setChecked( 61 self.requestFilenameCheckBox.setChecked(
68 Preferences.getUI("RequestDownloadFilename")) 62 Preferences.getUI("RequestDownloadFilename"))
69 policy = Preferences.getHelp("DownloadManagerRemovePolicy") 63 policy = Preferences.getHelp("DownloadManagerRemovePolicy")
70 from Helpviewer.Download.DownloadManager import DownloadManager 64 from Helpviewer.Download.DownloadManager import DownloadManager
71 if policy == DownloadManager.RemoveNever: 65 if policy == DownloadManager.RemoveNever:
118 """ 112 """
119 Public slot to save the Networj configuration. 113 Public slot to save the Networj configuration.
120 """ 114 """
121 Preferences.setUI( 115 Preferences.setUI(
122 "DownloadPath", 116 "DownloadPath",
123 self.downloadDirEdit.text()) 117 self.downloadDirPicker.text())
124 Preferences.setUI( 118 Preferences.setUI(
125 "RequestDownloadFilename", 119 "RequestDownloadFilename",
126 self.requestFilenameCheckBox.isChecked()) 120 self.requestFilenameCheckBox.isChecked())
127 from Helpviewer.Download.DownloadManager import DownloadManager 121 from Helpviewer.Download.DownloadManager import DownloadManager
128 if self.cleanupNeverButton.isChecked(): 122 if self.cleanupNeverButton.isChecked():
182 "ProxyPassword/Ftp", 176 "ProxyPassword/Ftp",
183 self.ftpProxyPasswordEdit.text()) 177 self.ftpProxyPasswordEdit.text())
184 Preferences.setUI( 178 Preferences.setUI(
185 "ProxyAccount/Ftp", 179 "ProxyAccount/Ftp",
186 self.ftpProxyAccountEdit.text()) 180 self.ftpProxyAccountEdit.text())
187
188 @pyqtSlot()
189 def on_downloadDirButton_clicked(self):
190 """
191 Private slot to handle the directory selection via dialog.
192 """
193 directory = E5FileDialog.getExistingDirectory(
194 self,
195 self.tr("Select download directory"),
196 self.downloadDirEdit.text(),
197 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
198
199 if directory:
200 dn = Utilities.toNativeSeparators(directory)
201 while dn.endswith(os.sep):
202 dn = dn[:-1]
203 self.downloadDirEdit.setText(dn)
204 181
205 @pyqtSlot() 182 @pyqtSlot()
206 def on_clearProxyPasswordsButton_clicked(self): 183 def on_clearProxyPasswordsButton_clicked(self):
207 """ 184 """
208 Private slot to clear the saved HTTP(S) proxy passwords. 185 Private slot to clear the saved HTTP(S) proxy passwords.

eric ide

mercurial