Preferences/ConfigurationPages/PluginManagerPage.py

changeset 4577
e79a139aacc4
parent 4021
195a471c327b
child 4582
3a1d1d4c6f4f
equal deleted inserted replaced
4576:a258569d44db 4577:e79a139aacc4
7 Module implementing the Plugin Manager configuration page. 7 Module implementing the Plugin Manager 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
18 15
19 from .ConfigurationPageBase import ConfigurationPageBase 16 from .ConfigurationPageBase import ConfigurationPageBase
20 from .Ui_PluginManagerPage import Ui_PluginManagerPage 17 from .Ui_PluginManagerPage import Ui_PluginManagerPage
21 18
22 import Preferences 19 import Preferences
23 import Utilities
24 import UI.PixmapCache
25 20
26 21
27 class PluginManagerPage(ConfigurationPageBase, Ui_PluginManagerPage): 22 class PluginManagerPage(ConfigurationPageBase, Ui_PluginManagerPage):
28 """ 23 """
29 Class implementing the Plugin Manager configuration page. 24 Class implementing the Plugin Manager configuration page.
34 """ 29 """
35 super(PluginManagerPage, self).__init__() 30 super(PluginManagerPage, self).__init__()
36 self.setupUi(self) 31 self.setupUi(self)
37 self.setObjectName("PluginManagerPage") 32 self.setObjectName("PluginManagerPage")
38 33
39 self.downloadDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) 34 self.downloadDirPicker.setMode(E5PathPickerModes.DiretoryMode)
40
41 self.downloadDirCompleter = E5DirCompleter(self.downloadDirEdit)
42 35
43 # set initial values 36 # set initial values
44 self.activateExternalPluginsCheckBox.setChecked( 37 self.activateExternalPluginsCheckBox.setChecked(
45 Preferences.getPluginManager("ActivateExternal")) 38 Preferences.getPluginManager("ActivateExternal"))
46 self.downloadDirEdit.setText( 39 self.downloadDirPicker.setText(
47 Preferences.getPluginManager("DownloadPath")) 40 Preferences.getPluginManager("DownloadPath"))
48 self.generationsSpinBox.setValue( 41 self.generationsSpinBox.setValue(
49 Preferences.getPluginManager("KeepGenerations")) 42 Preferences.getPluginManager("KeepGenerations"))
50 self.keepHiddenCheckBox.setChecked( 43 self.keepHiddenCheckBox.setChecked(
51 Preferences.getPluginManager("KeepHidden")) 44 Preferences.getPluginManager("KeepHidden"))
73 Preferences.setPluginManager( 66 Preferences.setPluginManager(
74 "ActivateExternal", 67 "ActivateExternal",
75 self.activateExternalPluginsCheckBox.isChecked()) 68 self.activateExternalPluginsCheckBox.isChecked())
76 Preferences.setPluginManager( 69 Preferences.setPluginManager(
77 "DownloadPath", 70 "DownloadPath",
78 self.downloadDirEdit.text()) 71 self.downloadDirPicker.text())
79 Preferences.setPluginManager( 72 Preferences.setPluginManager(
80 "KeepGenerations", 73 "KeepGenerations",
81 self.generationsSpinBox.value()) 74 self.generationsSpinBox.value())
82 Preferences.setPluginManager( 75 Preferences.setPluginManager(
83 "KeepHidden", 76 "KeepHidden",
99 92
100 if self.repositoryUrlEdit.text() != self.__repositoryUrl: 93 if self.repositoryUrlEdit.text() != self.__repositoryUrl:
101 Preferences.setUI( 94 Preferences.setUI(
102 "PluginRepositoryUrl6", self.repositoryUrlEdit.text()) 95 "PluginRepositoryUrl6", self.repositoryUrlEdit.text())
103 96
104 @pyqtSlot()
105 def on_downloadDirButton_clicked(self):
106 """
107 Private slot to handle the directory selection via dialog.
108 """
109 directory = E5FileDialog.getExistingDirectory(
110 self,
111 self.tr("Select plugins download directory"),
112 self.downloadDirEdit.text(),
113 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
114
115 if directory:
116 dn = Utilities.toNativeSeparators(directory)
117 while dn.endswith(os.sep):
118 dn = dn[:-1]
119 self.downloadDirEdit.setText(dn)
120
121 @pyqtSlot(bool) 97 @pyqtSlot(bool)
122 def on_repositoryUrlEditButton_toggled(self, checked): 98 def on_repositoryUrlEditButton_toggled(self, checked):
123 """ 99 """
124 Private slot to set the read only status of the repository URL line 100 Private slot to set the read only status of the repository URL line
125 edit. 101 edit.

eric ide

mercurial