168 |
169 |
169 ################################## |
170 ################################## |
170 ## database action below ## |
171 ## database action below ## |
171 ################################## |
172 ################################## |
172 |
173 |
|
174 # TODO: replace this with 'flask-migrate' |
173 self.initDatabaseAct = E5Action( |
175 self.initDatabaseAct = E5Action( |
174 self.tr('Initialize Database'), |
176 self.tr('Initialize Database'), |
175 self.tr('&Initialize Database'), |
177 self.tr('&Initialize Database'), |
176 0, 0, |
178 0, 0, |
177 self, 'flask_init_database') |
179 self, 'flask_init_database') |
184 )) |
186 )) |
185 self.initDatabaseAct.triggered.connect(self.__initDatabase) |
187 self.initDatabaseAct.triggered.connect(self.__initDatabase) |
186 self.actions.append(self.initDatabaseAct) |
188 self.actions.append(self.initDatabaseAct) |
187 |
189 |
188 ################################## |
190 ################################## |
189 ## pybabel action below ## |
|
190 ################################## |
|
191 |
|
192 self.pybabelConfigAct = E5Action( |
|
193 self.tr('Configure PyBabel'), |
|
194 self.tr('Configure Py&Babel'), |
|
195 0, 0, |
|
196 self, 'flask_config_pybabel') |
|
197 self.pybabelConfigAct.setStatusTip(self.tr( |
|
198 'Shows a dialog to edit the configuration for pybabel')) |
|
199 self.pybabelConfigAct.setWhatsThis(self.tr( |
|
200 """<b>Configure PyBabel</b>""" |
|
201 """<p>Shows a dialog to edit the configuration for pybabel.</p>""" |
|
202 )) |
|
203 self.pybabelConfigAct.triggered.connect( |
|
204 self.__pybabelProject.configurePyBabel) |
|
205 self.actions.append(self.pybabelConfigAct) |
|
206 |
|
207 ################################## |
|
208 ## documentation action below ## |
191 ## documentation action below ## |
209 ################################## |
192 ################################## |
210 |
193 |
211 self.documentationAct = E5Action( |
194 self.documentationAct = E5Action( |
212 self.tr('Documentation'), |
195 self.tr('Documentation'), |
237 """<b>About Flask</b>""" |
220 """<b>About Flask</b>""" |
238 """<p>Shows some information about Flask.</p>""" |
221 """<p>Shows some information about Flask.</p>""" |
239 )) |
222 )) |
240 self.aboutFlaskAct.triggered.connect(self.__flaskInfo) |
223 self.aboutFlaskAct.triggered.connect(self.__flaskInfo) |
241 self.actions.append(self.aboutFlaskAct) |
224 self.actions.append(self.aboutFlaskAct) |
|
225 |
|
226 self.__pybabelProject.initActions() |
242 |
227 |
243 def initMenu(self): |
228 def initMenu(self): |
244 """ |
229 """ |
245 Public method to initialize the Flask menu. |
230 Public method to initialize the Flask menu. |
246 |
231 |
247 @return the menu generated |
232 @return the menu generated |
248 @rtype QMenu |
233 @rtype QMenu |
249 """ |
234 """ |
250 self.__menus = {} # clear menus references |
235 self.__menus = {} # clear menus references |
|
236 |
|
237 self.__menus["pybabel"] = self.__pybabelProject.initMenu() |
251 |
238 |
252 menu = QMenu(self.tr('&Flask'), self.__ui) |
239 menu = QMenu(self.tr('&Flask'), self.__ui) |
253 menu.setTearOffEnabled(True) |
240 menu.setTearOffEnabled(True) |
254 |
241 |
255 menu.addAction(self.runServerAct) |
242 menu.addAction(self.runServerAct) |
260 menu.addSeparator() |
247 menu.addSeparator() |
261 menu.addAction(self.showRoutesAct) |
248 menu.addAction(self.showRoutesAct) |
262 menu.addSeparator() |
249 menu.addSeparator() |
263 menu.addAction(self.initDatabaseAct) |
250 menu.addAction(self.initDatabaseAct) |
264 menu.addSeparator() |
251 menu.addSeparator() |
265 menu.addAction(self.pybabelConfigAct) |
252 menu.addMenu(self.__menus["pybabel"]) |
266 menu.addSeparator() |
253 menu.addSeparator() |
267 menu.addAction(self.documentationAct) |
254 menu.addAction(self.documentationAct) |
268 menu.addSeparator() |
255 menu.addSeparator() |
269 menu.addAction(self.aboutFlaskAct) |
256 menu.addAction(self.aboutFlaskAct) |
270 |
257 |
526 "<tr><td>Flask Version:</td><td>{0}</td></tr>" |
513 "<tr><td>Flask Version:</td><td>{0}</td></tr>" |
527 "<tr><td>Werkzeug Version:</td><td>{1}</td></tr>" |
514 "<tr><td>Werkzeug Version:</td><td>{1}</td></tr>" |
528 "<tr><td>Python Version:</td><td>{2}</td></tr>" |
515 "<tr><td>Python Version:</td><td>{2}</td></tr>" |
529 "<tr><td>Flask URL:</td><td><a href=\"{3}\">" |
516 "<tr><td>Flask URL:</td><td><a href=\"{3}\">" |
530 "The Pallets Projects - Flask</a></td></tr>" |
517 "The Pallets Projects - Flask</a></td></tr>" |
531 "</table></p>" |
518 "</table></p>", |
|
519 "Do not translate the program names." |
532 ).format(versions["flask"], versions["werkzeug"], |
520 ).format(versions["flask"], versions["werkzeug"], |
533 versions["python"], url), |
521 versions["python"], url), |
534 modal=True, |
522 modal=True, |
535 buttons=E5MessageBox.Ok) |
523 buttons=E5MessageBox.Ok) |
536 msgBox.setIconPixmap(UI.PixmapCache.getPixmap( |
524 msgBox.setIconPixmap(UI.PixmapCache.getPixmap( |
667 Private method to determine capabilities provided by supported |
655 Private method to determine capabilities provided by supported |
668 extensions. |
656 extensions. |
669 """ |
657 """ |
670 # 1. support for flask-babel (i.e. pybabel) |
658 # 1. support for flask-babel (i.e. pybabel) |
671 self.__pybabelProject.determineCapability() |
659 self.__pybabelProject.determineCapability() |
672 self.pybabelConfigAct.setEnabled(self.hasCapability("pybabel")) |
|
673 |
660 |
674 # 2. support for flask-migrate |
661 # 2. support for flask-migrate |
675 # TODO: add support for flask-migrate |
662 # TODO: add support for flask-migrate |
676 |
663 |
677 def hasCapability(self, key): |
664 def hasCapability(self, key): |