Improve gitlab configuration
offlate/systems/gitlab.py
100 | 100 | def getSystemConfigSpec(data=None): | |
101 | 101 | specs = [] | |
102 | 102 | specs.extend(GitProject.getSystemConfigSpec()) | |
103 | - | specs.append( | |
103 | + | if data is not None: | |
104 | + | instance = urlparse(data['repo']).hostname | |
105 | + | specs.append( | |
106 | + | RowConfigSpec('servers', Project.tr('Gitlab instance configuration'), | |
107 | + | Project.tr("You need to configure each Gitlab instance \ | |
108 | + | separately, and you haven't configured the instance at {} yet.".format(instance)), | |
109 | + | [ | |
110 | + | StringConfigSpec('token', Project.tr('Token'), | |
111 | + | Project.tr('The token you created from your account. \ | |
112 | + | You can create it from <a href="#">the Access Tokens tab</a> in your account settings.'), | |
113 | + | link = '{}/-/profile/personal_access_tokens'.format(instance), | |
114 | + | placeholder = 'Lynid8y56urst-TdlUs6') | |
115 | + | ], | |
116 | + | 'server', | |
117 | + | instance)) | |
118 | + | else: | |
119 | + | specs.append( | |
104 | 120 | ListConfigSpec('servers', Project.tr('Configured Gitlab instances'), | |
105 | 121 | Project.tr('You need to create a token for each Gitlab instance \ | |
106 | 122 | you have an account on. You can create a token by logging into your account, \ |
offlate/systems/weblate.py
222 | 222 | @staticmethod | |
223 | 223 | def getSystemConfigSpec(data=None): | |
224 | 224 | if data is not None: | |
225 | - | print('weblate: {}'.format(data)) | |
226 | 225 | return [RowConfigSpec('servers', Project.tr('Weblate instance configuration'), | |
227 | 226 | Project.tr('You need to configure each Weblate instance separately, \ | |
228 | 227 | and you haven\'t configured the instance at {} yet.').format(data['instance']), | |
229 | 228 | [ | |
230 | 229 | StringConfigSpec('token', Project.tr('Token'), | |
231 | 230 | Project.tr('The token you created from your account. \ | |
232 | - | You can create it from <a href="#">The API access tab</a> in your account settings'), | |
231 | + | You can create it from <a href="#">the API access tab</a> in your account settings.'), | |
233 | 232 | link = "{}/accounts/profile/#api".format(data['instance']), | |
234 | 233 | placeholder = Project.tr('fKbStkBgFzIL0UW15sfcJh7kC0BAbcVtV16kblXlM')) | |
235 | 234 | ], 'server', data['instance'])] |
offlate/ui/settingsedit.py
205 | 205 | def content(self): | |
206 | 206 | hasRow = False | |
207 | 207 | for d in self.data: | |
208 | - | print(d) | |
209 | 208 | if d[self.conf.indexKey] == self.conf.indexValue: | |
210 | 209 | hasRow = True | |
211 | 210 |
offlate/ui/welcome.py
166 | 166 | def initializePage(self): | |
167 | 167 | layout = QVBoxLayout() | |
168 | 168 | system = self.field("project")["system"] | |
169 | + | info = self.field("project")["info"] | |
169 | 170 | lang = self.field("lang") | |
170 | 171 | email = self.field("email") | |
171 | 172 | name = self.field("name") | |
172 | 173 | self.parent.manager.updateSettings({'Generic': {'name': name, 'email': email, 'lang': lang}}) | |
173 | - | widget = SystemSettingsWidget(self.parent.manager, system = system, parent = self) | |
174 | + | widget = SystemSettingsWidget(self.parent.manager, system = system, parent = self, data = info) | |
174 | 175 | layout.addWidget(widget) | |
175 | 176 | self.setLayout(layout) | |
176 | 177 |