Plugins/PluginVcsPySvn.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
34 pyqtApi = 2 34 pyqtApi = 2
35 # End-Of-Header 35 # End-Of-Header
36 36
37 error = "" 37 error = ""
38 38
39
39 def exeDisplayData(): 40 def exeDisplayData():
40 """ 41 """
41 Public method to support the display of some executable info. 42 Public method to support the display of some executable info.
42 43
43 @return dictionary containing the data to be shown 44 @return dictionary containing the data to be shown
46 import pysvn 47 import pysvn
47 try: 48 try:
48 text = os.path.dirname(pysvn.__file__) 49 text = os.path.dirname(pysvn.__file__)
49 except AttributeError: 50 except AttributeError:
50 text = "PySvn" 51 text = "PySvn"
51 version = ".".join([str(v) for v in pysvn.version]) 52 version = ".".join([str(v) for v in pysvn.version])
52 except ImportError: 53 except ImportError:
53 text = "PySvn" 54 text = "PySvn"
54 version = "" 55 version = ""
55 56
56 data = { 57 data = {
57 "programEntry" : False, 58 "programEntry": False,
58 "header" : QApplication.translate("VcsPySvnPlugin", 59 "header": QApplication.translate("VcsPySvnPlugin",
59 "Version Control - Subversion (pysvn)"), 60 "Version Control - Subversion (pysvn)"),
60 "text" : text, 61 "text": text,
61 "version" : version, 62 "version": version,
62 } 63 }
63 64
64 return data 65 return data
66
65 67
66 def getVcsSystemIndicator(): 68 def getVcsSystemIndicator():
67 """ 69 """
68 Public function to get the indicators for this version control system. 70 Public function to get the indicators for this version control system.
69 71
78 data["_svn"] = (pluginTypename, displayString()) 80 data["_svn"] = (pluginTypename, displayString())
79 except ImportError: 81 except ImportError:
80 pass 82 pass
81 return data 83 return data
82 84
85
83 def displayString(): 86 def displayString():
84 """ 87 """
85 Public function to get the display string. 88 Public function to get the display string.
86 89
87 @return display string (string) 90 @return display string (string)
91 return QApplication.translate('VcsPySvnPlugin', 'Subversion (pysvn)') 94 return QApplication.translate('VcsPySvnPlugin', 'Subversion (pysvn)')
92 except ImportError: 95 except ImportError:
93 return "" 96 return ""
94 97
95 subversionCfgPluginObject = None 98 subversionCfgPluginObject = None
99
96 100
97 def createConfigurationPage(configDlg): 101 def createConfigurationPage(configDlg):
98 """ 102 """
99 Module function to create the configuration page. 103 Module function to create the configuration page.
100 104
105 if subversionCfgPluginObject is None: 109 if subversionCfgPluginObject is None:
106 subversionCfgPluginObject = VcsPySvnPlugin(None) 110 subversionCfgPluginObject = VcsPySvnPlugin(None)
107 page = SubversionPage(subversionCfgPluginObject) 111 page = SubversionPage(subversionCfgPluginObject)
108 return page 112 return page
109 113
114
110 def getConfigData(): 115 def getConfigData():
111 """ 116 """
112 Module function returning data as required by the configuration dialog. 117 Module function returning data as required by the configuration dialog.
113 118
114 @return dictionary with key "zzz_subversionPage" containing the relevant data 119 @return dictionary with key "zzz_subversionPage" containing the relevant data
115 """ 120 """
116 return { 121 return {
117 "zzz_subversionPage" : \ 122 "zzz_subversionPage": \
118 [QApplication.translate("VcsPySvnPlugin", "Subversion"), 123 [QApplication.translate("VcsPySvnPlugin", "Subversion"),
119 os.path.join("VcsPlugins", "vcsPySvn", "icons", 124 os.path.join("VcsPlugins", "vcsPySvn", "icons",
120 "preferences-subversion.png"), 125 "preferences-subversion.png"),
121 createConfigurationPage, "vcsPage", None], 126 createConfigurationPage, "vcsPage", None],
122 } 127 }
123 128
129
124 def prepareUninstall(): 130 def prepareUninstall():
125 """ 131 """
126 Module function to prepare for an uninstallation. 132 Module function to prepare for an uninstallation.
127 """ 133 """
128 if not e5App().getObject("PluginManager").isPluginLoaded("PluginVcsSubversion"): 134 if not e5App().getObject("PluginManager").isPluginLoaded("PluginVcsSubversion"):
129 Preferences.Prefs.settings.remove("Subversion") 135 Preferences.Prefs.settings.remove("Subversion")
130 136
137
131 class VcsPySvnPlugin(QObject): 138 class VcsPySvnPlugin(QObject):
132 """ 139 """
133 Class implementing the PySvn version control plugin. 140 Class implementing the PySvn version control plugin.
134 """ 141 """
135 def __init__(self, ui): 142 def __init__(self, ui):
140 """ 147 """
141 QObject.__init__(self, ui) 148 QObject.__init__(self, ui)
142 self.__ui = ui 149 self.__ui = ui
143 150
144 self.__subversionDefaults = { 151 self.__subversionDefaults = {
145 "StopLogOnCopy" : 1, 152 "StopLogOnCopy": 1,
146 "LogLimit" : 100, 153 "LogLimit": 100,
147 "CommitMessages" : 20, 154 "CommitMessages": 20,
148 } 155 }
149 156
150 from VcsPlugins.vcsPySvn.ProjectHelper import SvnProjectHelper 157 from VcsPlugins.vcsPySvn.ProjectHelper import SvnProjectHelper
151 self.__projectHelperObject = SvnProjectHelper(None, None) 158 self.__projectHelperObject = SvnProjectHelper(None, None)
152 try: 159 try:
153 e5App().registerPluginObject(pluginTypename, self.__projectHelperObject, 160 e5App().registerPluginObject(pluginTypename, self.__projectHelperObject,
154 pluginType) 161 pluginType)
155 except KeyError: 162 except KeyError:
156 pass # ignore duplicate registration 163 pass # ignore duplicate registration
157 readShortcuts(pluginName = pluginTypename) 164 readShortcuts(pluginName=pluginTypename)
158 165
159 def getProjectHelper(self): 166 def getProjectHelper(self):
160 """ 167 """
161 Public method to get a reference to the project helper object. 168 Public method to get a reference to the project helper object.
162 169
166 173
167 def activate(self): 174 def activate(self):
168 """ 175 """
169 Public method to activate this plugin. 176 Public method to activate this plugin.
170 177
171 @return tuple of reference to instantiated viewmanager and 178 @return tuple of reference to instantiated viewmanager and
172 activation status (boolean) 179 activation status (boolean)
173 """ 180 """
174 from VcsPlugins.vcsPySvn.subversion import Subversion 181 from VcsPlugins.vcsPySvn.subversion import Subversion
175 self.__object = Subversion(self, self.__ui) 182 self.__object = Subversion(self, self.__ui)
176 return self.__object, True 183 return self.__object, True
196 return int(Preferences.Prefs.settings.value("Subversion/" + key, 203 return int(Preferences.Prefs.settings.value("Subversion/" + key,
197 self.__subversionDefaults[key])) 204 self.__subversionDefaults[key]))
198 elif key in ["Commits"]: 205 elif key in ["Commits"]:
199 return Preferences.toList(Preferences.Prefs.settings.value( 206 return Preferences.toList(Preferences.Prefs.settings.value(
200 "Subversion/" + key)) 207 "Subversion/" + key))
201 else: 208 else:
202 return Preferences.Prefs.settings.value("Subversion/" + key) 209 return Preferences.Prefs.settings.value("Subversion/" + key)
203 210
204 def setPreferences(self, key, value): 211 def setPreferences(self, key, value):
205 """ 212 """
206 Public method to store the various settings. 213 Public method to store the various settings.

eric ide

mercurial