eric6/Preferences/ConfigurationPages/PluginManagerPage.py

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

eric ide

mercurial