eric7/Preferences/ConfigurationPages/PluginManagerPage.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2007 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Plugin Manager configuration page.
8 """
9
10 from PyQt5.QtCore import pyqtSlot
11
12 from E5Gui.E5PathPicker import E5PathPickerModes
13
14 from .ConfigurationPageBase import ConfigurationPageBase
15 from .Ui_PluginManagerPage import Ui_PluginManagerPage
16
17 import Preferences
18
19
20 class PluginManagerPage(ConfigurationPageBase, Ui_PluginManagerPage):
21 """
22 Class implementing the Plugin Manager configuration page.
23 """
24 def __init__(self):
25 """
26 Constructor
27 """
28 super().__init__()
29 self.setupUi(self)
30 self.setObjectName("PluginManagerPage")
31
32 self.downloadDirPicker.setMode(E5PathPickerModes.DirectoryMode)
33
34 # set initial values
35 self.activateExternalPluginsCheckBox.setChecked(
36 Preferences.getPluginManager("ActivateExternal"))
37 self.downloadDirPicker.setText(
38 Preferences.getPluginManager("DownloadPath"))
39 self.generationsSpinBox.setValue(
40 Preferences.getPluginManager("KeepGenerations"))
41 self.keepHiddenCheckBox.setChecked(
42 Preferences.getPluginManager("KeepHidden"))
43 self.startupCleanupCheckBox.setChecked(
44 Preferences.getPluginManager("StartupCleanup"))
45
46 period = Preferences.getPluginManager("UpdatesCheckInterval")
47 if period == 0:
48 self.noCheckRadioButton.setChecked(True)
49 elif period == 1:
50 self.dailyCheckRadioButton.setChecked(True)
51 elif period == 2:
52 self.weeklyCheckRadioButton.setChecked(True)
53 elif period == 3:
54 self.monthlyCheckRadioButton.setChecked(True)
55 elif period == 4:
56 self.alwaysCheckRadioButton.setChecked(True)
57 else:
58 # invalid value, default to daily
59 self.dailyCheckRadioButton.setChecked(True)
60
61 self.downloadedOnlyCheckBox.setChecked(
62 Preferences.getPluginManager("CheckInstalledOnly"))
63
64 self.__repositoryUrl = Preferences.getUI("PluginRepositoryUrl6")
65 self.repositoryUrlEdit.setText(self.__repositoryUrl)
66
67 def save(self):
68 """
69 Public slot to save the Viewmanager configuration.
70 """
71 Preferences.setPluginManager(
72 "ActivateExternal",
73 self.activateExternalPluginsCheckBox.isChecked())
74 Preferences.setPluginManager(
75 "DownloadPath",
76 self.downloadDirPicker.text())
77 Preferences.setPluginManager(
78 "KeepGenerations",
79 self.generationsSpinBox.value())
80 Preferences.setPluginManager(
81 "KeepHidden",
82 self.keepHiddenCheckBox.isChecked())
83 Preferences.setPluginManager(
84 "StartupCleanup",
85 self.startupCleanupCheckBox.isChecked())
86
87 if self.noCheckRadioButton.isChecked():
88 period = 0
89 elif self.dailyCheckRadioButton.isChecked():
90 period = 1
91 elif self.weeklyCheckRadioButton.isChecked():
92 period = 2
93 elif self.monthlyCheckRadioButton.isChecked():
94 period = 3
95 elif self.alwaysCheckRadioButton.isChecked():
96 period = 4
97 Preferences.setPluginManager("UpdatesCheckInterval", period)
98
99 Preferences.setPluginManager(
100 "CheckInstalledOnly",
101 self.downloadedOnlyCheckBox.isChecked())
102
103 if self.repositoryUrlEdit.text() != self.__repositoryUrl:
104 Preferences.setUI(
105 "PluginRepositoryUrl6", self.repositoryUrlEdit.text())
106
107 @pyqtSlot(bool)
108 def on_repositoryUrlEditButton_toggled(self, checked):
109 """
110 Private slot to set the read only status of the repository URL line
111 edit.
112
113 @param checked state of the push button (boolean)
114 """
115 self.repositoryUrlEdit.setReadOnly(not checked)
116
117
118 def create(dlg):
119 """
120 Module function to create the configuration page.
121
122 @param dlg reference to the configuration dialog
123 @return reference to the instantiated page (ConfigurationPageBase)
124 """
125 page = PluginManagerPage()
126 return page

eric ide

mercurial