208 """<b>About Django</b>""" |
212 """<b>About Django</b>""" |
209 """<p>Shows some information about Django.</p>""" |
213 """<p>Shows some information about Django.</p>""" |
210 )) |
214 )) |
211 self.aboutDjangoAct.triggered[()].connect(self.__djangoInfo) |
215 self.aboutDjangoAct.triggered[()].connect(self.__djangoInfo) |
212 self.actions.append(self.aboutDjangoAct) |
216 self.actions.append(self.aboutDjangoAct) |
213 ## |
217 |
214 ## self.__initDatabaseActions() |
218 self.__initDatabaseActions() |
215 ## self.__initDatabaseSqlActions() |
219 self.__initDatabaseSqlActions() |
216 ## self.__initToolsActions() |
220 self.__initToolsActions() |
217 ## self.__initTestingActions() |
221 self.__initTestingActions() |
218 ## |
222 |
219 ## def __initDatabaseActions(self): |
223 def __initDatabaseActions(self): |
220 ## """ |
224 """ |
221 ## Private method to define the database related actions. |
225 Private method to define the database related actions. |
222 ## """ |
226 """ |
223 ## self.syncDatabaseAct = E4Action(self.trUtf8('Synchronize'), |
227 self.syncDatabaseAct = E5Action(self.trUtf8('Synchronize'), |
224 ## self.trUtf8('&Synchronize'), |
228 self.trUtf8('&Synchronize'), |
225 ## 0, 0, |
229 0, 0, |
226 ## self,'django_database_syncdb') |
230 self,'django_database_syncdb') |
227 ## self.syncDatabaseAct.setStatusTip(self.trUtf8( |
231 self.syncDatabaseAct.setStatusTip(self.trUtf8( |
228 ## 'Synchronizes the database')) |
232 'Synchronizes the database')) |
229 ## self.syncDatabaseAct.setWhatsThis(self.trUtf8( |
233 self.syncDatabaseAct.setWhatsThis(self.trUtf8( |
230 ## """<b>Synchronize</b>""" |
234 """<b>Synchronize</b>""" |
231 ## """<p>Synchronizes the database.</p>""" |
235 """<p>Synchronizes the database.</p>""" |
232 ## )) |
236 )) |
233 ## self.connect(self.syncDatabaseAct, SIGNAL('triggered()'), |
237 self.syncDatabaseAct.triggered[()].connect(self.__databaseSynchronize) |
234 ## self.__databaseSynchronize) |
238 self.actions.append(self.syncDatabaseAct) |
235 ## self.actions.append(self.syncDatabaseAct) |
239 |
236 ## |
240 self.inspectDatabaseAct = E5Action(self.trUtf8('Introspect'), |
237 ## self.inspectDatabaseAct = E4Action(self.trUtf8('Introspect'), |
241 self.trUtf8('&Introspect'), |
238 ## self.trUtf8('&Introspect'), |
242 0, 0, |
239 ## 0, 0, |
243 self,'django_database_inspect') |
240 ## self,'django_database_inspect') |
244 self.inspectDatabaseAct.setStatusTip(self.trUtf8( |
241 ## self.inspectDatabaseAct.setStatusTip(self.trUtf8( |
245 'Introspects the database tables and outputs a Django model module')) |
242 ## 'Introspects the database tables and outputs a Django model module')) |
246 self.inspectDatabaseAct.setWhatsThis(self.trUtf8( |
243 ## self.inspectDatabaseAct.setWhatsThis(self.trUtf8( |
247 """<b>Introspect</b>""" |
244 ## """<b>Introspect</b>""" |
248 """<p>Introspects the database tables and outputs a """ |
245 ## """<p>Introspects the database tables and outputs a """ |
249 """Django model module.</p>""" |
246 ## """Django model module.</p>""" |
250 )) |
247 ## )) |
251 self.inspectDatabaseAct.triggered[()].connect(self.__databaseInspect) |
248 ## self.connect(self.inspectDatabaseAct, SIGNAL('triggered()'), |
252 self.actions.append(self.inspectDatabaseAct) |
249 ## self.__databaseInspect) |
253 |
250 ## self.actions.append(self.inspectDatabaseAct) |
254 self.flushDatabaseAct = E5Action(self.trUtf8('Flush'), |
251 ## |
255 self.trUtf8('&Flush'), |
252 ## self.flushDatabaseAct = E4Action(self.trUtf8('Flush'), |
256 0, 0, |
253 ## self.trUtf8('&Flush'), |
257 self,'django_database_flush') |
254 ## 0, 0, |
258 self.flushDatabaseAct.setStatusTip(self.trUtf8( |
255 ## self,'django_database_flush') |
259 'Returns all database tables to the state just after their installation')) |
256 ## self.flushDatabaseAct.setStatusTip(self.trUtf8( |
260 self.flushDatabaseAct.setWhatsThis(self.trUtf8( |
257 ## 'Returns all database tables to the state just after their installation')) |
261 """<b>Flush</b>""" |
258 ## self.flushDatabaseAct.setWhatsThis(self.trUtf8( |
262 """<p>Returns all database tables to the state """ |
259 ## """<b>Flush</b>""" |
263 """just after their installation.</p>""" |
260 ## """<p>Returns all database tables to the state """ |
264 )) |
261 ## """just after their installation.</p>""" |
265 self.flushDatabaseAct.triggered[()].connect(self.__databaseFlush) |
262 ## )) |
266 self.actions.append(self.flushDatabaseAct) |
263 ## self.connect(self.flushDatabaseAct, SIGNAL('triggered()'), |
267 |
264 ## self.__databaseFlush) |
268 self.databaseClientAct = E5Action(self.trUtf8('Start Client Console'), |
265 ## self.actions.append(self.flushDatabaseAct) |
269 self.trUtf8('Start &Client Console'), |
266 ## |
270 0, 0, |
267 ## self.resetDatabaseAct = E4Action(self.trUtf8('Reset Application(s)'), |
271 self,'django_database_client') |
268 ## self.trUtf8('&Reset Application(s)'), |
272 self.databaseClientAct.setStatusTip(self.trUtf8( |
269 ## 0, 0, |
273 'Starts a console window for the database client')) |
270 ## self,'django_database_reset_application') |
274 self.databaseClientAct.setWhatsThis(self.trUtf8( |
271 ## self.resetDatabaseAct.setStatusTip(self.trUtf8( |
275 """<b>Start Client Console</b>""" |
272 ## 'Resets the database tables of one or more applications')) |
276 """<p>Starts a console window for the database client.</p>""" |
273 ## self.resetDatabaseAct.setWhatsThis(self.trUtf8( |
277 )) |
274 ## """<b>Reset Application(s)</b>""" |
278 self.databaseClientAct.triggered[()].connect(self.__runDatabaseClient) |
275 ## """<p>Resets the database tables of one or more applications.</p>""" |
279 self.actions.append(self.databaseClientAct) |
276 ## )) |
280 |
277 ## self.connect(self.resetDatabaseAct, SIGNAL('triggered()'), |
281 def __initDatabaseSqlActions(self): |
278 ## self.__databaseReset) |
282 """ |
279 ## self.actions.append(self.resetDatabaseAct) |
283 Private method to define the database SQL related actions. |
280 ## |
284 """ |
281 ## self.databaseClientAct = E4Action(self.trUtf8('Start Client Console'), |
285 self.databaseSqlCreateTablesAct = E5Action(self.trUtf8('Create Tables'), |
282 ## self.trUtf8('Start &Client Console'), |
286 self.trUtf8('Create &Tables'), |
283 ## 0, 0, |
287 0, 0, |
284 ## self,'django_database_client') |
288 self,'django_database_sql_create_tables') |
285 ## self.databaseClientAct.setStatusTip(self.trUtf8( |
289 self.databaseSqlCreateTablesAct.setStatusTip(self.trUtf8( |
286 ## 'Starts a console window for the database client')) |
290 'Prints the CREATE TABLE SQL statements for one or more applications')) |
287 ## self.databaseClientAct.setWhatsThis(self.trUtf8( |
291 self.databaseSqlCreateTablesAct.setWhatsThis(self.trUtf8( |
288 ## """<b>Start Client Console</b>""" |
292 """<b>Create Tables</b>""" |
289 ## """<p>Starts a console window for the database client.</p>""" |
293 """<p>Prints the CREATE TABLE SQL statements for one or """ |
290 ## )) |
294 """more applications.</p>""" |
291 ## self.connect(self.databaseClientAct, SIGNAL('triggered()'), |
295 )) |
292 ## self.__runDatabaseClient) |
296 self.databaseSqlCreateTablesAct.triggered[()].connect( |
293 ## self.actions.append(self.databaseClientAct) |
297 self.__databaseSqlCreateTables) |
294 ## |
298 self.actions.append(self.databaseSqlCreateTablesAct) |
295 ## def __initDatabaseSqlActions(self): |
299 |
296 ## """ |
300 self.databaseSqlCreateIndexesAct = E5Action(self.trUtf8('Create Indexes'), |
297 ## Private method to define the database SQL related actions. |
301 self.trUtf8('Create &Indexes'), |
298 ## """ |
302 0, 0, |
299 ## self.databaseSqlCreateTablesAct = E4Action(self.trUtf8('Create Tables'), |
303 self,'django_database_sql_create_indexes') |
300 ## self.trUtf8('Create &Tables'), |
304 self.databaseSqlCreateIndexesAct.setStatusTip(self.trUtf8( |
301 ## 0, 0, |
305 'Prints the CREATE INDEX SQL statements for one or more applications')) |
302 ## self,'django_database_sql_create_tables') |
306 self.databaseSqlCreateIndexesAct.setWhatsThis(self.trUtf8( |
303 ## self.databaseSqlCreateTablesAct.setStatusTip(self.trUtf8( |
307 """<b>Create Indexes</b>""" |
304 ## 'Prints the CREATE TABLE SQL statements for one or more applications')) |
308 """<p>Prints the CREATE INDEX SQL statements for one or """ |
305 ## self.databaseSqlCreateTablesAct.setWhatsThis(self.trUtf8( |
309 """more applications.</p>""" |
306 ## """<b>Create Tables</b>""" |
310 )) |
307 ## """<p>Prints the CREATE TABLE SQL statements for one or """ |
311 self.databaseSqlCreateIndexesAct.triggered[()].connect( |
308 ## """more applications.</p>""" |
312 self.__databaseSqlCreateIndexes) |
309 ## )) |
313 self.actions.append(self.databaseSqlCreateIndexesAct) |
310 ## self.connect(self.databaseSqlCreateTablesAct, SIGNAL('triggered()'), |
314 |
311 ## self.__databaseSqlCreateTables) |
315 self.databaseSqlCreateEverythingAct = E5Action(self.trUtf8('Create Everything'), |
312 ## self.actions.append(self.databaseSqlCreateTablesAct) |
316 self.trUtf8('Create &Everything'), |
313 ## |
317 0, 0, |
314 ## self.databaseSqlCreateIndexesAct = E4Action(self.trUtf8('Create Indexes'), |
318 self,'django_database_sql_create_everything') |
315 ## self.trUtf8('Create &Indexes'), |
319 self.databaseSqlCreateEverythingAct.setStatusTip(self.trUtf8( |
316 ## 0, 0, |
320 'Prints the CREATE ... SQL statements for one or more applications')) |
317 ## self,'django_database_sql_create_indexes') |
321 self.databaseSqlCreateEverythingAct.setWhatsThis(self.trUtf8( |
318 ## self.databaseSqlCreateIndexesAct.setStatusTip(self.trUtf8( |
322 """<b>Create Everything</b>""" |
319 ## 'Prints the CREATE INDEX SQL statements for one or more applications')) |
323 """<p>Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL """ |
320 ## self.databaseSqlCreateIndexesAct.setWhatsThis(self.trUtf8( |
324 """statements for one or more applications.</p>""" |
321 ## """<b>Create Indexes</b>""" |
325 )) |
322 ## """<p>Prints the CREATE INDEX SQL statements for one or """ |
326 self.databaseSqlCreateEverythingAct.triggered[()].connect( |
323 ## """more applications.</p>""" |
327 self.__databaseSqlCreateEverything) |
324 ## )) |
328 self.actions.append(self.databaseSqlCreateEverythingAct) |
325 ## self.connect(self.databaseSqlCreateIndexesAct, SIGNAL('triggered()'), |
329 |
326 ## self.__databaseSqlCreateIndexes) |
330 self.databaseSqlCustomAct = E5Action(self.trUtf8('Custom Statements'), |
327 ## self.actions.append(self.databaseSqlCreateIndexesAct) |
331 self.trUtf8('&Custom Statements'), |
328 ## |
332 0, 0, |
329 ## self.databaseSqlCreateEverythingAct = E4Action(self.trUtf8('Create Everything'), |
333 self,'django_database_sql_custom') |
330 ## self.trUtf8('Create &Everything'), |
334 self.databaseSqlCustomAct.setStatusTip(self.trUtf8( |
331 ## 0, 0, |
335 'Prints the custom table modifying SQL statements for ' |
332 ## self,'django_database_sql_create_everything') |
336 'one or more applications')) |
333 ## self.databaseSqlCreateEverythingAct.setStatusTip(self.trUtf8( |
337 self.databaseSqlCustomAct.setWhatsThis(self.trUtf8( |
334 ## 'Prints the CREATE ... SQL statements for one or more applications')) |
338 """<b>Custom Statements</b>""" |
335 ## self.databaseSqlCreateEverythingAct.setWhatsThis(self.trUtf8( |
339 """<p>Prints the custom table modifying SQL statements """ |
336 ## """<b>Create Everything</b>""" |
340 """for one or more applications.</p>""" |
337 ## """<p>Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL """ |
341 )) |
338 ## """statements for one or more applications.</p>""" |
342 self.databaseSqlCustomAct.triggered[()].connect( |
339 ## )) |
343 self.__databaseSqlCustom) |
340 ## self.connect(self.databaseSqlCreateEverythingAct, SIGNAL('triggered()'), |
344 self.actions.append(self.databaseSqlCustomAct) |
341 ## self.__databaseSqlCreateEverything) |
345 |
342 ## self.actions.append(self.databaseSqlCreateEverythingAct) |
346 self.databaseSqlDropTablesAct = E5Action(self.trUtf8('Drop Tables'), |
343 ## |
347 self.trUtf8('&Drop Tables'), |
344 ## self.databaseSqlCustomAct = E4Action(self.trUtf8('Custom Statements'), |
348 0, 0, |
345 ## self.trUtf8('&Custom Statements'), |
349 self,'django_database_sql_drop_tables') |
346 ## 0, 0, |
350 self.databaseSqlDropTablesAct.setStatusTip(self.trUtf8( |
347 ## self,'django_database_sql_custom') |
351 'Prints the DROP TABLE SQL statements for ' |
348 ## self.databaseSqlCustomAct.setStatusTip(self.trUtf8( |
352 'one or more applications')) |
349 ## 'Prints the custom table modifying SQL statements for ' |
353 self.databaseSqlDropTablesAct.setWhatsThis(self.trUtf8( |
350 ## 'one or more applications')) |
354 """<b>Drop Tables</b>""" |
351 ## self.databaseSqlCustomAct.setWhatsThis(self.trUtf8( |
355 """<p>Prints the DROP TABLE SQL statements """ |
352 ## """<b>Custom Statements</b>""" |
356 """for one or more applications.</p>""" |
353 ## """<p>Prints the custom table modifying SQL statements """ |
357 )) |
354 ## """for one or more applications.</p>""" |
358 self.databaseSqlDropTablesAct.triggered[()].connect( |
355 ## )) |
359 self.__databaseSqlDropTables) |
356 ## self.connect(self.databaseSqlCustomAct, SIGNAL('triggered()'), |
360 self.actions.append(self.databaseSqlDropTablesAct) |
357 ## self.__databaseSqlCustom) |
361 |
358 ## self.actions.append(self.databaseSqlCustomAct) |
362 self.databaseSqlFlushAct = E5Action(self.trUtf8('Flush Database'), |
359 ## |
363 self.trUtf8('&Flush Database'), |
360 ## self.databaseSqlDropTablesAct = E4Action(self.trUtf8('Drop Tables'), |
364 0, 0, |
361 ## self.trUtf8('&Drop Tables'), |
365 self,'django_database_sql_flush_database') |
362 ## 0, 0, |
366 self.databaseSqlFlushAct.setStatusTip(self.trUtf8( |
363 ## self,'django_database_sql_drop_tables') |
367 'Prints a list of statements to return all database tables to the state ' |
364 ## self.databaseSqlDropTablesAct.setStatusTip(self.trUtf8( |
368 'just after their installation')) |
365 ## 'Prints the DROP TABLE SQL statements for ' |
369 self.databaseSqlFlushAct.setWhatsThis(self.trUtf8( |
366 ## 'one or more applications')) |
370 """<b>Flush Database</b>""" |
367 ## self.databaseSqlDropTablesAct.setWhatsThis(self.trUtf8( |
371 """<p>Prints a list of statements to return all database tables to """ |
368 ## """<b>Drop Tables</b>""" |
372 """the state just after their installation.</p>""" |
369 ## """<p>Prints the DROP TABLE SQL statements """ |
373 )) |
370 ## """for one or more applications.</p>""" |
374 self.databaseSqlFlushAct.triggered[()].connect( |
371 ## )) |
375 self.__databaseSqlFlushDatabase) |
372 ## self.connect(self.databaseSqlDropTablesAct, SIGNAL('triggered()'), |
376 self.actions.append(self.databaseSqlFlushAct) |
373 ## self.__databaseSqlDropTables) |
377 |
374 ## self.actions.append(self.databaseSqlDropTablesAct) |
378 self.databaseSqlResetSeqAct = E5Action(self.trUtf8('Reset Sequences'), |
375 ## |
379 self.trUtf8('Reset &Sequences'), |
376 ## self.databaseSqlFlushAct = E4Action(self.trUtf8('Flush Database'), |
380 0, 0, |
377 ## self.trUtf8('&Flush Database'), |
381 self,'django_database_sql_reset_sequences') |
378 ## 0, 0, |
382 self.databaseSqlResetSeqAct.setStatusTip(self.trUtf8( |
379 ## self,'django_database_sql_flush_database') |
383 'Prints the SQL statements for resetting sequences for ' |
380 ## self.databaseSqlFlushAct.setStatusTip(self.trUtf8( |
384 'one or more applications')) |
381 ## 'Prints a list of statements to return all database tables to the state ' |
385 self.databaseSqlResetSeqAct.setWhatsThis(self.trUtf8( |
382 ## 'just after their installation')) |
386 """<b>Reset Sequences</b>""" |
383 ## self.databaseSqlFlushAct.setWhatsThis(self.trUtf8( |
387 """<p>Prints the SQL statements for resetting sequences for """ |
384 ## """<b>Flush Database</b>""" |
388 """one or more applications.</p>""" |
385 ## """<p>Prints a list of statements to return all database tables to """ |
389 )) |
386 ## """the state just after their installation.</p>""" |
390 self.databaseSqlResetSeqAct.triggered[()].connect( |
387 ## )) |
391 self.__databaseSqlResetSequences) |
388 ## self.connect(self.databaseSqlFlushAct, SIGNAL('triggered()'), |
392 self.actions.append(self.databaseSqlResetSeqAct) |
389 ## self.__databaseSqlFlushDatabase) |
393 |
390 ## self.actions.append(self.databaseSqlFlushAct) |
394 def __initToolsActions(self): |
391 ## |
395 """ |
392 ## self.databaseSqlResetApplAct = E4Action(self.trUtf8('Reset Application(s)'), |
396 Private method to define the tool actions. |
393 ## self.trUtf8('Reset &Application(s)'), |
397 """ |
394 ## 0, 0, |
398 self.diffSettingsAct = E5Action(self.trUtf8('Diff Settings'), |
395 ## self,'django_database_sql_reset_application') |
399 self.trUtf8('&Diff Settings'), |
396 ## self.databaseSqlResetApplAct.setStatusTip(self.trUtf8( |
400 0, 0, |
397 ## 'Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for ' |
401 self,'django_tools_diffsettings') |
398 ## 'one or more applications')) |
402 self.diffSettingsAct.setStatusTip(self.trUtf8( |
399 ## self.databaseSqlResetApplAct.setWhatsThis(self.trUtf8( |
403 'Shows the modification made to the settings')) |
400 ## """<b>Reset Application(s)</b>""" |
404 self.diffSettingsAct.setWhatsThis(self.trUtf8( |
401 ## """<p>Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for """ |
405 """<b>Diff Settings</b>""" |
402 ## """one or more applications.</p>""" |
406 """<p>Shows the modification made to the settings.</p>""" |
403 ## )) |
407 )) |
404 ## self.connect(self.databaseSqlResetApplAct, SIGNAL('triggered()'), |
408 self.diffSettingsAct.triggered[()].connect(self.__diffSettings) |
405 ## self.__databaseSqlResetApplication) |
409 self.actions.append(self.diffSettingsAct) |
406 ## self.actions.append(self.databaseSqlResetApplAct) |
410 |
407 ## |
411 self.cleanupAct = E5Action(self.trUtf8('Cleanup'), |
408 ## self.databaseSqlResetSeqAct = E4Action(self.trUtf8('Reset Sequences'), |
412 self.trUtf8('&Cleanup'), |
409 ## self.trUtf8('Reset &Sequences'), |
413 0, 0, |
410 ## 0, 0, |
414 self,'django_tools_cleanup') |
411 ## self,'django_database_sql_reset_sequences') |
415 self.cleanupAct.setStatusTip(self.trUtf8( |
412 ## self.databaseSqlResetSeqAct.setStatusTip(self.trUtf8( |
416 'Cleans out old data from the database')) |
413 ## 'Prints the SQL statements for resetting sequences for ' |
417 self.cleanupAct.setWhatsThis(self.trUtf8( |
414 ## 'one or more applications')) |
418 """<b>Cleanup</b>""" |
415 ## self.databaseSqlResetSeqAct.setWhatsThis(self.trUtf8( |
419 """<p>Cleans out old data from the database.</p>""" |
416 ## """<b>Reset Sequences</b>""" |
420 )) |
417 ## """<p>Prints the SQL statements for resetting sequences for """ |
421 self.cleanupAct.triggered[()].connect(self.__cleanup) |
418 ## """one or more applications.</p>""" |
422 self.actions.append(self.cleanupAct) |
419 ## )) |
423 |
420 ## self.connect(self.databaseSqlResetSeqAct, SIGNAL('triggered()'), |
424 self.validateAct = E5Action(self.trUtf8('Validate'), |
421 ## self.__databaseSqlResetSequences) |
425 self.trUtf8('&Validate'), |
422 ## self.actions.append(self.databaseSqlResetSeqAct) |
426 0, 0, |
423 ## |
427 self,'django_tools_validate') |
424 ## def __initToolsActions(self): |
428 self.validateAct.setStatusTip(self.trUtf8( |
425 ## """ |
429 'Validates all installed models')) |
426 ## Private method to define the tool actions. |
430 self.validateAct.setWhatsThis(self.trUtf8( |
427 ## """ |
431 """<b>Validate</b>""" |
428 ## self.diffSettingsAct = E4Action(self.trUtf8('Diff Settings'), |
432 """<p>Validates all installed models.</p>""" |
429 ## self.trUtf8('&Diff Settings'), |
433 )) |
430 ## 0, 0, |
434 self.validateAct.triggered[()].connect(self.__validate) |
431 ## self,'django_tools_diffsettings') |
435 self.actions.append(self.validateAct) |
432 ## self.diffSettingsAct.setStatusTip(self.trUtf8( |
436 |
433 ## 'Shows the modification made to the settings')) |
437 self.runPythonShellAct = E5Action(self.trUtf8('Start Python Console'), |
434 ## self.diffSettingsAct.setWhatsThis(self.trUtf8( |
438 self.trUtf8('Start &Python Console'), |
435 ## """<b>Diff Settings</b>""" |
439 0, 0, |
436 ## """<p>Shows the modification made to the settings.</p>""" |
440 self,'django_tools_pythonconsole') |
437 ## )) |
441 self.runPythonShellAct.setStatusTip(self.trUtf8( |
438 ## self.connect(self.diffSettingsAct, SIGNAL('triggered()'), |
442 'Starts a Python interactive interpreter')) |
439 ## self.__diffSettings) |
443 self.runPythonShellAct.setWhatsThis(self.trUtf8( |
440 ## self.actions.append(self.diffSettingsAct) |
444 """<b>Start Python Console</b>""" |
441 ## |
445 """<p>Starts a Python interactive interpreter.</p>""" |
442 ## self.cleanupAct = E4Action(self.trUtf8('Cleanup'), |
446 )) |
443 ## self.trUtf8('&Cleanup'), |
447 self.runPythonShellAct.triggered[()].connect(self.__runPythonShell) |
444 ## 0, 0, |
448 self.actions.append(self.runPythonShellAct) |
445 ## self,'django_tools_cleanup') |
449 |
446 ## self.cleanupAct.setStatusTip(self.trUtf8( |
450 def __initTestingActions(self): |
447 ## 'Cleans out old data from the database')) |
451 """ |
448 ## self.cleanupAct.setWhatsThis(self.trUtf8( |
452 Private method to define the testing actions. |
449 ## """<b>Cleanup</b>""" |
453 """ |
450 ## """<p>Cleans out old data from the database.</p>""" |
454 self.dumpDataAct = E5Action(self.trUtf8('Dump Data'), |
451 ## )) |
455 self.trUtf8('&Dump Data'), |
452 ## self.connect(self.cleanupAct, SIGNAL('triggered()'), |
456 0, 0, |
453 ## self.__cleanup) |
457 self,'django_tools_dumpdata') |
454 ## self.actions.append(self.cleanupAct) |
458 self.dumpDataAct.setStatusTip(self.trUtf8( |
455 ## |
459 'Dump the database data to a fixture')) |
456 ## self.validateAct = E4Action(self.trUtf8('Validate'), |
460 self.dumpDataAct.setWhatsThis(self.trUtf8( |
457 ## self.trUtf8('&Validate'), |
461 """<b>Dump Data</b>""" |
458 ## 0, 0, |
462 """<p>Dump the database data to a fixture.</p>""" |
459 ## self,'django_tools_validate') |
463 )) |
460 ## self.validateAct.setStatusTip(self.trUtf8( |
464 self.dumpDataAct.triggered[()].connect(self.__dumpData) |
461 ## 'Validates all installed models')) |
465 self.actions.append(self.dumpDataAct) |
462 ## self.validateAct.setWhatsThis(self.trUtf8( |
466 |
463 ## """<b>Validate</b>""" |
467 self.loadDataAct = E5Action(self.trUtf8('Load Data'), |
464 ## """<p>Validates all installed models.</p>""" |
468 self.trUtf8('&Load Data'), |
465 ## )) |
469 0, 0, |
466 ## self.connect(self.validateAct, SIGNAL('triggered()'), |
470 self,'django_tools_loaddata') |
467 ## self.__validate) |
471 self.loadDataAct.setStatusTip(self.trUtf8( |
468 ## self.actions.append(self.validateAct) |
472 'Load data from fixture files')) |
469 ## |
473 self.loadDataAct.setWhatsThis(self.trUtf8( |
470 ## self.adminindexAct = E4Action(self.trUtf8('Admin Index'), |
474 """<b>Load Data</b>""" |
471 ## self.trUtf8('&Admin Index'), |
475 """<p>Load data from fixture files.</p>""" |
472 ## 0, 0, |
476 )) |
473 ## self,'django_tools_adminindex') |
477 self.loadDataAct.triggered[()].connect(self.__loadData) |
474 ## self.adminindexAct.setStatusTip(self.trUtf8( |
478 self.actions.append(self.loadDataAct) |
475 ## 'Prints the admin-index template snippet')) |
479 |
476 ## self.adminindexAct.setWhatsThis(self.trUtf8( |
480 self.runTestAct = E5Action(self.trUtf8('Run Testsuite'), |
477 ## """<b>Admin Index</b>""" |
481 self.trUtf8('Run &Testsuite'), |
478 ## """<p>Prints the admin-index template snippet.</p>""" |
482 0, 0, |
479 ## )) |
483 self,'django_tools_run_test') |
480 ## self.connect(self.adminindexAct, SIGNAL('triggered()'), |
484 self.runTestAct.setStatusTip(self.trUtf8( |
481 ## self.__adminIndex) |
485 'Run the test suite for applications or the whole site')) |
482 ## self.actions.append(self.adminindexAct) |
486 self.runTestAct.setWhatsThis(self.trUtf8( |
483 ## |
487 """<b>Run Testsuite</b>""" |
484 ## self.runPythonShellAct = E4Action(self.trUtf8('Start Python Console'), |
488 """<p>Run the test suite for applications or the whole site.</p>""" |
485 ## self.trUtf8('Start &Python Console'), |
489 )) |
486 ## 0, 0, |
490 self.runTestAct.triggered[()].connect(self.__runTestSuite) |
487 ## self,'django_tools_pythonconsole') |
491 self.actions.append(self.runTestAct) |
488 ## self.runPythonShellAct.setStatusTip(self.trUtf8( |
492 |
489 ## 'Starts a Python interactive interpreter')) |
493 self.runTestServerAct = E5Action(self.trUtf8('Run Testserver'), |
490 ## self.runPythonShellAct.setWhatsThis(self.trUtf8( |
494 self.trUtf8('Run Test&server'), |
491 ## """<b>Start Python Console</b>""" |
495 0, 0, |
492 ## """<p>Starts a Python interactive interpreter.</p>""" |
496 self,'django_tools_run_test_server') |
493 ## )) |
497 self.runTestServerAct.setStatusTip(self.trUtf8( |
494 ## self.connect(self.runPythonShellAct, SIGNAL('triggered()'), |
498 'Run a development server with data from a set of fixtures')) |
495 ## self.__runPythonShell) |
499 self.runTestServerAct.setWhatsThis(self.trUtf8( |
496 ## self.actions.append(self.runPythonShellAct) |
500 """<b>Run Testserver</b>""" |
497 ## |
501 """<p>Run a development server with data from a set of fixtures.</p>""" |
498 ## def __initTestingActions(self): |
502 )) |
499 ## """ |
503 self.runTestServerAct.triggered[()].connect(self.__runTestServer) |
500 ## Private method to define the testing actions. |
504 self.actions.append(self.runTestServerAct) |
501 ## """ |
505 |
502 ## self.dumpDataAct = E4Action(self.trUtf8('Dump Data'), |
|
503 ## self.trUtf8('&Dump Data'), |
|
504 ## 0, 0, |
|
505 ## self,'django_tools_dumpdata') |
|
506 ## self.dumpDataAct.setStatusTip(self.trUtf8( |
|
507 ## 'Dump the database data to a fixture')) |
|
508 ## self.dumpDataAct.setWhatsThis(self.trUtf8( |
|
509 ## """<b>Dump Data</b>""" |
|
510 ## """<p>Dump the database data to a fixture.</p>""" |
|
511 ## )) |
|
512 ## self.connect(self.dumpDataAct, SIGNAL('triggered()'), |
|
513 ## self.__dumpData) |
|
514 ## self.actions.append(self.dumpDataAct) |
|
515 ## |
|
516 ## self.loadDataAct = E4Action(self.trUtf8('Load Data'), |
|
517 ## self.trUtf8('&Load Data'), |
|
518 ## 0, 0, |
|
519 ## self,'django_tools_loaddata') |
|
520 ## self.loadDataAct.setStatusTip(self.trUtf8( |
|
521 ## 'Load data from fixture files')) |
|
522 ## self.loadDataAct.setWhatsThis(self.trUtf8( |
|
523 ## """<b>Load Data</b>""" |
|
524 ## """<p>Load data from fixture files.</p>""" |
|
525 ## )) |
|
526 ## self.connect(self.loadDataAct, SIGNAL('triggered()'), |
|
527 ## self.__loadData) |
|
528 ## self.actions.append(self.loadDataAct) |
|
529 ## |
|
530 ## self.runTestAct = E4Action(self.trUtf8('Run Testsuite'), |
|
531 ## self.trUtf8('Run &Testsuite'), |
|
532 ## 0, 0, |
|
533 ## self,'django_tools_run_test') |
|
534 ## self.runTestAct.setStatusTip(self.trUtf8( |
|
535 ## 'Run the test suite for applications or the whole site')) |
|
536 ## self.runTestAct.setWhatsThis(self.trUtf8( |
|
537 ## """<b>Run Testsuite</b>""" |
|
538 ## """<p>Run the test suite for applications or the whole site.</p>""" |
|
539 ## )) |
|
540 ## self.connect(self.runTestAct, SIGNAL('triggered()'), |
|
541 ## self.__runTestSuite) |
|
542 ## self.actions.append(self.runTestAct) |
|
543 ## |
|
544 ## self.runTestServerAct = E4Action(self.trUtf8('Run Testserver'), |
|
545 ## self.trUtf8('Run Test&server'), |
|
546 ## 0, 0, |
|
547 ## self,'django_tools_run_test_server') |
|
548 ## self.runTestServerAct.setStatusTip(self.trUtf8( |
|
549 ## 'Run a development server with data from a set of fixtures')) |
|
550 ## self.runTestServerAct.setWhatsThis(self.trUtf8( |
|
551 ## """<b>Run Testserver</b>""" |
|
552 ## """<p>Run a development server with data from a set of fixtures.</p>""" |
|
553 ## )) |
|
554 ## self.connect(self.runTestServerAct, SIGNAL('triggered()'), |
|
555 ## self.__runTestServer) |
|
556 ## self.actions.append(self.runTestServerAct) |
|
557 ## |
|
558 def initMenu(self): |
506 def initMenu(self): |
559 """ |
507 """ |
560 Public slot to initialize the Django menu. |
508 Public slot to initialize the Django menu. |
561 |
509 |
562 @return the menu generated (QMenu) |
510 @return the menu generated (QMenu) |
1182 |
1151 |
1183 ################################################################## |
1152 ################################################################## |
1184 ## slots below implement run functions |
1153 ## slots below implement run functions |
1185 ################################################################## |
1154 ################################################################## |
1186 |
1155 |
1187 ## def __runServer(self): |
1156 def __runServer(self): |
1188 ## """ |
1157 """ |
1189 ## Private slot to start the Django Web server. |
1158 Private slot to start the Django Web server. |
1190 ## """ |
1159 """ |
1191 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommand")) |
1160 consoleCmd = self.__isSpawningConsole( |
1192 ## if consoleCmd: |
1161 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1193 ## args = Utilities.parseOptionString(consoleCmd) |
1162 if consoleCmd: |
1194 ## args[0] = Utilities.getExecutablePath(args[0]) |
1163 args = Utilities.parseOptionString(consoleCmd) |
1195 ## args.append(self.__getPythonExecutable()) |
1164 args[0] = Utilities.getExecutablePath(args[0]) |
1196 ## args.append("manage.py") |
1165 args.append(self.__getPythonExecutable()) |
1197 ## args.append("runserver") |
1166 args.append("manage.py") |
1198 ## addr = self.__plugin.getPreferences("ServerAddress") |
1167 args.append("runserver") |
1199 ## if addr: |
1168 addr = self.__plugin.getPreferences("ServerAddress") |
1200 ## args.append(addr) |
1169 if addr: |
1201 ## |
1170 args.append(addr) |
1202 ## try: |
1171 |
1203 ## if Utilities.isWindowsPlatform(): |
1172 try: |
1204 ## serverProcStarted, pid = \ |
1173 if Utilities.isWindowsPlatform(): |
1205 ## QProcess.startDetached(args[0], args[1:], self.__sitePath()) |
1174 serverProcStarted, pid = \ |
1206 ## else: |
1175 QProcess.startDetached(args[0], args[1:], self.__sitePath()) |
1207 ## if self.__serverProc is not None: |
1176 else: |
1208 ## self.__serverProcFinished() |
1177 if self.__serverProc is not None: |
1209 ## |
1178 self.__serverProcFinished() |
1210 ## self.__serverProc = QProcess() |
1179 |
1211 ## self.connect(self.__serverProc, |
1180 self.__serverProc = QProcess() |
1212 ## SIGNAL('finished(int, QProcess::ExitStatus)'), |
1181 self.__serverProc.finished.connect(self.__serverProcFinished) |
1213 ## self.__serverProcFinished) |
1182 self.__serverProc.setWorkingDirectory(self.__sitePath()) |
1214 ## self.__serverProc.setWorkingDirectory(self.__sitePath()) |
1183 self.__serverProc.start(args[0], args[1:]) |
1215 ## self.__serverProc.start(args[0], args[1:]) |
1184 serverProcStarted = self.__serverProc.waitForStarted() |
1216 ## serverProcStarted = self.__serverProc.waitForStarted() |
1185 if not serverProcStarted: |
1217 ## if not serverProcStarted: |
1186 E5MessageBox.critical(None, |
1218 ## KQMessageBox.critical(None, |
1187 self.trUtf8('Process Generation Error'), |
1219 ## self.trUtf8('Process Generation Error'), |
1188 self.trUtf8('The Django server could not be started.')) |
1220 ## self.trUtf8('The Django server could not be started.')) |
1189 except DjangoNoSiteSelectedException: |
1221 ## except DjangoNoSiteSelectedException: |
1190 pass |
1222 ## pass |
1191 |
1223 ## |
1192 def __serverProcFinished(self): |
1224 ## def __serverProcFinished(self): |
1193 """ |
1225 ## """ |
1194 Private slot connected to the finished signal. |
1226 ## Private slot connected to the finished signal. |
1195 """ |
1227 ## """ |
1196 if self.__serverProc is not None and \ |
1228 ## if self.__serverProc is not None and \ |
1197 self.__serverProc.state() != QProcess.NotRunning: |
1229 ## self.__serverProc.state() != QProcess.NotRunning: |
1198 self.__serverProc.terminate() |
1230 ## self.__serverProc.terminate() |
1199 QTimer.singleShot(2000, self.__serverProc.kill) |
1231 ## QTimer.singleShot(2000, self.__serverProc, SLOT('kill()')) |
1200 self.__serverProc.waitForFinished(3000) |
1232 ## self.__serverProc.waitForFinished(3000) |
1201 self.__serverProc = None |
1233 ## self.__serverProc = None |
1202 |
1234 ## |
1203 def __runBrowser(self): |
1235 ## def __runBrowser(self): |
1204 """ |
1236 ## """ |
1205 Private slot to start the default web browser with the server URL. |
1237 ## Private slot to start the default web browser with the server URL. |
1206 """ |
1238 ## """ |
1207 addr = self.__plugin.getPreferences("ServerAddress") |
1239 ## addr = self.__plugin.getPreferences("ServerAddress") |
1208 if addr: |
1240 ## if addr: |
1209 if ':' in addr: |
1241 ## if ':' in addr: |
1210 port = addr.split(':')[1] |
1242 ## port = addr.split(':')[1] |
1211 else: |
1243 ## else: |
1212 port = addr |
1244 ## port = addr |
1213 else: |
1245 ## else: |
1214 port = "8000" |
1246 ## port = QString("8000") |
1215 url = QUrl("http://127.0.0.1:{0}".format(port)) |
1247 ## url = QUrl(QString("http://127.0.0.1:%1").arg(port)) |
1216 res = QDesktopServices.openUrl(url) |
1248 ## res = QDesktopServices.openUrl(url) |
1217 if not res: |
1249 ## if not res: |
1218 E5MessageBox.critical(None, |
1250 ## KQMessageBox.critical(None, |
1219 self.trUtf8('Run Web-Browser'), |
1251 ## self.trUtf8('Run Web-Browser'), |
1220 self.trUtf8('Could not start the web-browser for the url "{0}".')\ |
1252 ## self.trUtf8('Could not start the web-browser for the url "%1".')\ |
1221 .format(url.toString())) |
1253 ## .arg(url.toString())) |
|
1254 |
1222 |
1255 ################################################################## |
1223 ################################################################## |
1256 ## slots below implement database related functions |
1224 ## slots below implement database related functions |
1257 ################################################################## |
1225 ################################################################## |
1258 |
1226 |
1259 ## def __databaseSynchronize(self): |
1227 def __databaseSynchronize(self): |
1260 ## """ |
1228 """ |
1261 ## Private slot to synchronize the database. |
1229 Private slot to synchronize the database. |
1262 ## """ |
1230 """ |
1263 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommandNoClose")) |
1231 consoleCmd = self.__isSpawningConsole( |
1264 ## if consoleCmd: |
1232 self.__plugin.getPreferences("ConsoleCommandNoClose"))[1] |
1265 ## proc = QProcess() |
1233 if consoleCmd: |
1266 ## args = Utilities.parseOptionString(consoleCmd) |
1234 args = Utilities.parseOptionString(consoleCmd) |
1267 ## args[0] = Utilities.getExecutablePath(args[0]) |
1235 args[0] = Utilities.getExecutablePath(args[0]) |
1268 ## args.append(self.__getPythonExecutable()) |
1236 args.append(self.__getPythonExecutable()) |
1269 ## args.append("manage.py") |
1237 args.append("manage.py") |
1270 ## args.append("syncdb") |
1238 args.append("syncdb") |
1271 ## try: |
1239 try: |
1272 ## wd = self.__sitePath() |
1240 wd = self.__sitePath() |
1273 ## started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1241 started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1274 ## if not started: |
1242 if not started: |
1275 ## KQMessageBox.critical(None, |
1243 E5MessageBox.critical(None, |
1276 ## self.trUtf8('Process Generation Error'), |
1244 self.trUtf8('Process Generation Error'), |
1277 ## self.trUtf8('The Django process could not be started.')) |
1245 self.trUtf8('The Django process could not be started.')) |
1278 ## except DjangoNoSiteSelectedException: |
1246 except DjangoNoSiteSelectedException: |
1279 ## pass |
1247 pass |
1280 ## |
1248 |
1281 ## def __databaseInspect(self): |
1249 def __databaseInspect(self): |
1282 ## """ |
1250 """ |
1283 ## Private slot to introspect the database and output a Django model module. |
1251 Private slot to introspect the database and output a Django model module. |
1284 ## """ |
1252 """ |
1285 ## title = self.trUtf8("Introspect Database") |
1253 title = self.trUtf8("Introspect Database") |
1286 ## |
1254 |
1287 ## args = QStringList() |
1255 args = [] |
1288 ## args.append(self.__getPythonExecutable()) |
1256 args.append(self.__getPythonExecutable()) |
1289 ## args.append("manage.py") |
1257 args.append("manage.py") |
1290 ## args.append("inspectdb") |
1258 args.append("inspectdb") |
1291 ## |
1259 |
1292 ## try: |
1260 try: |
1293 ## path = self.__sitePath() |
1261 path = self.__sitePath() |
1294 ## except DjangoNoSiteSelectedException: |
1262 except DjangoNoSiteSelectedException: |
1295 ## return |
1263 return |
1296 ## |
1264 |
1297 ## dia = DjangoDialog(title, fixed = True, linewrap = False) |
1265 dia = DjangoDialog(title, fixed = True, linewrap = False) |
1298 ## res = dia.startProcess(args, path, False) |
1266 res = dia.startProcess(args, path, False) |
1299 ## if res: |
1267 if res: |
1300 ## dia.exec_() |
1268 dia.exec_() |
1301 ## |
1269 |
1302 ## def __databaseFlush(self): |
1270 def __databaseFlush(self): |
1303 ## """ |
1271 """ |
1304 ## Private slot to return all database tables to the state just after their |
1272 Private slot to return all database tables to the state just after their |
1305 ## installation. |
1273 installation. |
1306 ## """ |
1274 """ |
1307 ## try: |
1275 try: |
1308 ## path = self.__sitePath() |
1276 path = self.__sitePath() |
1309 ## except DjangoNoSiteSelectedException: |
1277 except DjangoNoSiteSelectedException: |
1310 ## return |
1278 return |
1311 ## |
1279 |
1312 ## title = self.trUtf8("Flush Database") |
1280 title = self.trUtf8("Flush Database") |
1313 ## |
1281 |
1314 ## res = KQMessageBox.question(self.__ui, |
1282 res = E5MessageBox.yesNo(self.__ui, |
1315 ## title, |
1283 title, |
1316 ## self.trUtf8("""Flushing the database will destroy all data. Are you sure?"""), |
1284 self.trUtf8("""Flushing the database will destroy all data. Are you sure?""")) |
1317 ## QMessageBox.StandardButtons(\ |
1285 if res: |
1318 ## QMessageBox.No | \ |
1286 args = [] |
1319 ## QMessageBox.Yes), |
1287 args.append(self.__getPythonExecutable()) |
1320 ## QMessageBox.No) |
1288 args.append("manage.py") |
1321 ## if res == QMessageBox.No: |
1289 args.append("flush") |
1322 ## return |
1290 args.append("--noinput") |
1323 ## |
1291 |
1324 ## args = QStringList() |
1292 dia = DjangoDialog(title, |
1325 ## args.append(self.__getPythonExecutable()) |
1293 msgSuccess = self.trUtf8("Database tables flushed successfully.")) |
1326 ## args.append("manage.py") |
1294 res = dia.startProcess(args, path) |
1327 ## args.append("flush") |
1295 if res: |
1328 ## args.append("--noinput") |
1296 dia.exec_() |
1329 ## |
1297 |
1330 ## dia = DjangoDialog(title, |
1298 def __runDatabaseClient(self): |
1331 ## msgSuccess = self.trUtf8("Database tables flushed successfully.")) |
1299 """ |
1332 ## res = dia.startProcess(args, path) |
1300 Private slot to start a database client for a Django project. |
1333 ## if res: |
1301 """ |
1334 ## dia.exec_() |
1302 consoleCmd = self.__isSpawningConsole( |
1335 ## |
1303 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1336 ## def __databaseReset(self): |
1304 if consoleCmd: |
1337 ## """ |
1305 args = Utilities.parseOptionString(consoleCmd) |
1338 ## Private slot to reset the database tables of one or more applications. |
1306 args[0] = Utilities.getExecutablePath(args[0]) |
1339 ## """ |
1307 args.append(self.__getPythonExecutable()) |
1340 ## try: |
1308 args.append("manage.py") |
1341 ## path = self.__sitePath() |
1309 args.append("dbshell") |
1342 ## except DjangoNoSiteSelectedException: |
1310 try: |
1343 ## return |
1311 wd = self.__sitePath() |
1344 ## |
1312 started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1345 ## title = self.trUtf8("Reset Application(s)") |
1313 if not started: |
1346 ## |
1314 E5MessageBox.critical(None, |
1347 ## apps = self.__getApplications() |
1315 self.trUtf8('Process Generation Error'), |
1348 ## if apps.isEmpty(): |
1316 self.trUtf8('The Django process could not be started.')) |
1349 ## return |
1317 except DjangoNoSiteSelectedException: |
1350 ## |
1318 pass |
1351 ## res = KQMessageBox.question(self.__ui, |
|
1352 ## title, |
|
1353 ## self.trUtf8("""Resetting the database tables for the applications '%1' """ |
|
1354 ## """will destroy all data. Are you sure?""")\ |
|
1355 ## .arg(apps.join(", ")), |
|
1356 ## QMessageBox.StandardButtons(\ |
|
1357 ## QMessageBox.No | \ |
|
1358 ## QMessageBox.Yes), |
|
1359 ## QMessageBox.No) |
|
1360 ## if res == QMessageBox.No: |
|
1361 ## return |
|
1362 ## |
|
1363 ## args = QStringList() |
|
1364 ## args.append(self.__getPythonExecutable()) |
|
1365 ## args.append("manage.py") |
|
1366 ## args.append("reset") |
|
1367 ## args.append("--noinput") |
|
1368 ## args += apps |
|
1369 ## |
|
1370 ## dia = DjangoDialog(title, |
|
1371 ## msgSuccess = self.trUtf8("Database tables for applications '%1' reset " |
|
1372 ## "successfully.").arg(apps.join(", ")) |
|
1373 ## ) |
|
1374 ## res = dia.startProcess(args, path) |
|
1375 ## if res: |
|
1376 ## dia.exec_() |
|
1377 ## |
|
1378 ## def __runDatabaseClient(self): |
|
1379 ## """ |
|
1380 ## Private slot to start a database client for a Django project. |
|
1381 ## """ |
|
1382 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommand")) |
|
1383 ## if consoleCmd: |
|
1384 ## proc = QProcess() |
|
1385 ## args = Utilities.parseOptionString(consoleCmd) |
|
1386 ## args[0] = Utilities.getExecutablePath(args[0]) |
|
1387 ## args.append(self.__getPythonExecutable()) |
|
1388 ## args.append("manage.py") |
|
1389 ## args.append("dbshell") |
|
1390 ## try: |
|
1391 ## wd = self.__sitePath() |
|
1392 ## started, pid = QProcess.startDetached(args[0], args[1:], wd) |
|
1393 ## if not started: |
|
1394 ## KQMessageBox.critical(None, |
|
1395 ## self.trUtf8('Process Generation Error'), |
|
1396 ## self.trUtf8('The Django process could not be started.')) |
|
1397 ## except DjangoNoSiteSelectedException: |
|
1398 ## pass |
|
1399 |
1319 |
1400 ####################################################################### |
1320 ####################################################################### |
1401 ## slots below implement database functions outputting SQL statements |
1321 ## slots below implement database functions outputting SQL statements |
1402 ####################################################################### |
1322 ####################################################################### |
1403 |
1323 |
1404 ## def __sqlCommand(self, title, command, requestApps = True): |
1324 def __sqlCommand(self, title, command, requestApps = True): |
1405 ## """ |
1325 """ |
1406 ## Private method to perform an SQL creation function. |
1326 Private method to perform an SQL creation function. |
1407 ## |
1327 |
1408 ## @param title dialog title (string or QString) |
1328 @param title dialog title (string) |
1409 ## @param command Django sql... command (string or QString) |
1329 @param command Django sql... command (string) |
1410 ## @param requestApps flag indicating to request a list of applications |
1330 @param requestApps flag indicating to request a list of applications |
1411 ## to work on (boolean) |
1331 to work on (boolean) |
1412 ## """ |
1332 """ |
1413 ## try: |
1333 try: |
1414 ## path = self.__sitePath() |
1334 path = self.__sitePath() |
1415 ## except DjangoNoSiteSelectedException: |
1335 except DjangoNoSiteSelectedException: |
1416 ## return |
1336 return |
1417 ## |
1337 |
1418 ## if requestApps: |
1338 if requestApps: |
1419 ## apps = self.__getApplications() |
1339 apps = self.__getApplications() |
1420 ## if apps.isEmpty(): |
1340 if not apps: |
1421 ## return |
1341 return |
1422 ## else: |
1342 else: |
1423 ## apps = QStringList() |
1343 apps = [] |
1424 ## |
1344 |
1425 ## args = QStringList() |
1345 args = [] |
1426 ## args.append(self.__getPythonExecutable()) |
1346 args.append(self.__getPythonExecutable()) |
1427 ## args.append("manage.py") |
1347 args.append("manage.py") |
1428 ## args.append(command) |
1348 args.append(command) |
1429 ## args += apps |
1349 args += apps |
1430 ## |
1350 |
1431 ## fileFilter = self.trUtf8("SQL Files (*.sql)") |
1351 fileFilter = self.trUtf8("SQL Files (*.sql)") |
1432 ## |
1352 |
1433 ## dia = DjangoDialog(title, fixed = True, linewrap = False, |
1353 dia = DjangoDialog(title, fixed = True, linewrap = False, |
1434 ## saveFilters = fileFilter) |
1354 saveFilters = fileFilter) |
1435 ## res = dia.startProcess(args, path, False) |
1355 res = dia.startProcess(args, path, False) |
1436 ## if res: |
1356 if res: |
1437 ## dia.exec_() |
1357 dia.exec_() |
1438 ## |
1358 |
1439 ## def __databaseSqlCreateTables(self): |
1359 def __databaseSqlCreateTables(self): |
1440 ## """ |
1360 """ |
1441 ## Private slot to print the CREATE TABLE SQL statements for one |
1361 Private slot to print the CREATE TABLE SQL statements for one |
1442 ## or more applications. |
1362 or more applications. |
1443 ## """ |
1363 """ |
1444 ## self.__sqlCommand(self.trUtf8("Create Tables"), "sql") |
1364 self.__sqlCommand(self.trUtf8("Create Tables"), "sql") |
1445 ## |
1365 |
1446 ## def __databaseSqlCreateIndexes(self): |
1366 def __databaseSqlCreateIndexes(self): |
1447 ## """ |
1367 """ |
1448 ## Private slot to print the CREATE INDEX SQL statements for one |
1368 Private slot to print the CREATE INDEX SQL statements for one |
1449 ## or more applications. |
1369 or more applications. |
1450 ## """ |
1370 """ |
1451 ## self.__sqlCommand(self.trUtf8("Create Indexes"), "sqlindexes") |
1371 self.__sqlCommand(self.trUtf8("Create Indexes"), "sqlindexes") |
1452 ## |
1372 |
1453 ## def __databaseSqlCreateEverything(self): |
1373 def __databaseSqlCreateEverything(self): |
1454 ## """ |
1374 """ |
1455 ## Private slot to print the CREATE TABLE, custom SQL and |
1375 Private slot to print the CREATE TABLE, custom SQL and |
1456 ## CREATE INDEX SQL statements for one or more applications. |
1376 CREATE INDEX SQL statements for one or more applications. |
1457 ## """ |
1377 """ |
1458 ## self.__sqlCommand(self.trUtf8("Create Everything"), "sqlall") |
1378 self.__sqlCommand(self.trUtf8("Create Everything"), "sqlall") |
1459 ## |
1379 |
1460 ## def __databaseSqlCustom(self): |
1380 def __databaseSqlCustom(self): |
1461 ## """ |
1381 """ |
1462 ## Private slot to print the custom table modifying SQL statements |
1382 Private slot to print the custom table modifying SQL statements |
1463 ## for one or more applications. |
1383 for one or more applications. |
1464 ## """ |
1384 """ |
1465 ## self.__sqlCommand(self.trUtf8("Custom Statements"), "sqlcustom") |
1385 self.__sqlCommand(self.trUtf8("Custom Statements"), "sqlcustom") |
1466 ## |
1386 |
1467 ## def __databaseSqlDropTables(self): |
1387 def __databaseSqlDropTables(self): |
1468 ## """ |
1388 """ |
1469 ## Private slot to print the DROP TABLE SQL statements for one or |
1389 Private slot to print the DROP TABLE SQL statements for one or |
1470 ## more applications. |
1390 more applications. |
1471 ## """ |
1391 """ |
1472 ## self.__sqlCommand(self.trUtf8("Drop Tables"), "sqlclear") |
1392 self.__sqlCommand(self.trUtf8("Drop Tables"), "sqlclear") |
1473 ## |
1393 |
1474 ## def __databaseSqlFlushDatabase(self): |
1394 def __databaseSqlFlushDatabase(self): |
1475 ## """ |
1395 """ |
1476 ## Private slot to print a list of statements to return all database |
1396 Private slot to print a list of statements to return all database |
1477 ## tables to their initial state. |
1397 tables to their initial state. |
1478 ## """ |
1398 """ |
1479 ## self.__sqlCommand(self.trUtf8("Flush Database"), "sqlflush", False) |
1399 self.__sqlCommand(self.trUtf8("Flush Database"), "sqlflush", False) |
1480 ## |
1400 |
1481 ## def __databaseSqlResetApplication(self): |
1401 def __databaseSqlResetSequences(self): |
1482 ## """ |
1402 """ |
1483 ## Private slot to print the DROP TABLE SQL, then the CREATE TABLE SQL |
1403 Private slot to print the SQL statements for resetting sequences for |
1484 ## for one or more applications. |
1404 one or more applications. |
1485 ## """ |
1405 """ |
1486 ## self.__sqlCommand(self.trUtf8("Reset Application(s)"), "sqlreset") |
1406 self.__sqlCommand(self.trUtf8("Reset Sequences"), "sqlsequencereset") |
1487 ## |
|
1488 ## def __databaseSqlResetSequences(self): |
|
1489 ## """ |
|
1490 ## Private slot to print the SQL statements for resetting sequences for |
|
1491 ## one or more applications. |
|
1492 ## """ |
|
1493 ## self.__sqlCommand(self.trUtf8("Reset Sequences"), "sqlsequencereset") |
|
1494 |
1407 |
1495 ################################################################## |
1408 ################################################################## |
1496 ## slots below implement some tool functions |
1409 ## slots below implement some tool functions |
1497 ################################################################## |
1410 ################################################################## |
1498 |
1411 |
1499 ## def __diffSettings(self): |
1412 def __diffSettings(self): |
1500 ## """ |
1413 """ |
1501 ## Private slot to show the changes made to the settings.py file. |
1414 Private slot to show the changes made to the settings.py file. |
1502 ## """ |
1415 """ |
1503 ## title = self.trUtf8("Diff Settings") |
1416 title = self.trUtf8("Diff Settings") |
1504 ## |
1417 |
1505 ## args = QStringList() |
1418 args = [] |
1506 ## args.append(self.__getPythonExecutable()) |
1419 args.append(self.__getPythonExecutable()) |
1507 ## args.append("manage.py") |
1420 args.append("manage.py") |
1508 ## args.append("diffsettings") |
1421 args.append("diffsettings") |
1509 ## |
1422 |
1510 ## try: |
1423 try: |
1511 ## path = self.__sitePath() |
1424 path = self.__sitePath() |
1512 ## except DjangoNoSiteSelectedException: |
1425 except DjangoNoSiteSelectedException: |
1513 ## return |
1426 return |
1514 ## |
1427 |
1515 ## dia = DjangoDialog(title, fixed = True, linewrap = False) |
1428 dia = DjangoDialog(title, fixed = True, linewrap = False) |
1516 ## res = dia.startProcess(args, path, False) |
1429 res = dia.startProcess(args, path, False) |
1517 ## if res: |
1430 if res: |
1518 ## dia.exec_() |
1431 dia.exec_() |
1519 ## |
1432 |
1520 ## def __cleanup(self): |
1433 def __cleanup(self): |
1521 ## """ |
1434 """ |
1522 ## Private slot to clean out old data from the database. |
1435 Private slot to clean out old data from the database. |
1523 ## """ |
1436 """ |
1524 ## title = self.trUtf8("Cleanup") |
1437 title = self.trUtf8("Cleanup") |
1525 ## |
1438 |
1526 ## args = QStringList() |
1439 args = [] |
1527 ## args.append(self.__getPythonExecutable()) |
1440 args.append(self.__getPythonExecutable()) |
1528 ## args.append("manage.py") |
1441 args.append("manage.py") |
1529 ## args.append("cleanup") |
1442 args.append("cleanup") |
1530 ## |
1443 |
1531 ## try: |
1444 try: |
1532 ## path = self.__sitePath() |
1445 path = self.__sitePath() |
1533 ## except DjangoNoSiteSelectedException: |
1446 except DjangoNoSiteSelectedException: |
1534 ## return |
1447 return |
1535 ## |
1448 |
1536 ## dia = DjangoDialog(title, |
1449 dia = DjangoDialog(title, |
1537 ## msgSuccess = self.trUtf8("Database cleaned up successfully.")) |
1450 msgSuccess = self.trUtf8("Database cleaned up successfully.")) |
1538 ## res = dia.startProcess(args, path) |
1451 res = dia.startProcess(args, path) |
1539 ## if res: |
1452 if res: |
1540 ## dia.exec_() |
1453 dia.exec_() |
1541 ## |
1454 |
1542 ## def __validate(self): |
1455 def __validate(self): |
1543 ## """ |
1456 """ |
1544 ## Private slot to validate all installed models. |
1457 Private slot to validate all installed models. |
1545 ## """ |
1458 """ |
1546 ## title = self.trUtf8("Validate") |
1459 title = self.trUtf8("Validate") |
1547 ## |
1460 |
1548 ## args = QStringList() |
1461 args = [] |
1549 ## args.append(self.__getPythonExecutable()) |
1462 args.append(self.__getPythonExecutable()) |
1550 ## args.append("manage.py") |
1463 args.append("manage.py") |
1551 ## args.append("validate") |
1464 args.append("validate") |
1552 ## |
1465 |
1553 ## try: |
1466 try: |
1554 ## path = self.__sitePath() |
1467 path = self.__sitePath() |
1555 ## except DjangoNoSiteSelectedException: |
1468 except DjangoNoSiteSelectedException: |
1556 ## return |
1469 return |
1557 ## |
1470 |
1558 ## dia = DjangoDialog(title) |
1471 dia = DjangoDialog(title) |
1559 ## res = dia.startProcess(args, path) |
1472 res = dia.startProcess(args, path) |
1560 ## if res: |
1473 if res: |
1561 ## dia.exec_() |
1474 dia.exec_() |
1562 ## |
1475 |
1563 ## def __adminIndex(self): |
1476 def __runPythonShell(self): |
1564 ## """ |
1477 """ |
1565 ## Private slot to print the admin-index template snippet. |
1478 Private slot to start a Python console for a Django project. |
1566 ## """ |
1479 """ |
1567 ## apps = self.__getApplications() |
1480 consoleCmd = self.__isSpawningConsole( |
1568 ## if apps.isEmpty(): |
1481 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1569 ## return |
1482 if consoleCmd: |
1570 ## |
1483 args = Utilities.parseOptionString(consoleCmd) |
1571 ## title = self.trUtf8("Print admin-index") |
1484 args[0] = Utilities.getExecutablePath(args[0]) |
1572 ## |
1485 args.append(self.__getPythonExecutable()) |
1573 ## args = QStringList() |
1486 args.append("manage.py") |
1574 ## args.append(self.__getPythonExecutable()) |
1487 args.append("shell") |
1575 ## args.append("manage.py") |
1488 if self.__plugin.getPreferences("UsePlainPython"): |
1576 ## args.append("adminindex") |
1489 args.append("--plain") |
1577 ## args += apps |
1490 try: |
1578 ## |
1491 wd = self.__sitePath() |
1579 ## try: |
1492 started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1580 ## path = self.__sitePath() |
1493 if not started: |
1581 ## except DjangoNoSiteSelectedException: |
1494 E5MessageBox.critical(None, |
1582 ## return |
1495 self.trUtf8('Process Generation Error'), |
1583 ## |
1496 self.trUtf8('The Django process could not be started.')) |
1584 ## dia = DjangoDialog(title, fixed = True, linewrap = False) |
1497 except DjangoNoSiteSelectedException: |
1585 ## res = dia.startProcess(args, path, False) |
1498 pass |
1586 ## if res: |
|
1587 ## dia.exec_() |
|
1588 ## |
|
1589 ## def __runPythonShell(self): |
|
1590 ## """ |
|
1591 ## Private slot to start a Python console for a Django project. |
|
1592 ## """ |
|
1593 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommand")) |
|
1594 ## if consoleCmd: |
|
1595 ## proc = QProcess() |
|
1596 ## args = Utilities.parseOptionString(consoleCmd) |
|
1597 ## args[0] = Utilities.getExecutablePath(args[0]) |
|
1598 ## args.append(self.__getPythonExecutable()) |
|
1599 ## args.append("manage.py") |
|
1600 ## args.append("shell") |
|
1601 ## if self.__plugin.getPreferences("UsePlainPython"): |
|
1602 ## args.append("--plain") |
|
1603 ## try: |
|
1604 ## wd = self.__sitePath() |
|
1605 ## started, pid = QProcess.startDetached(args[0], args[1:], wd) |
|
1606 ## if not started: |
|
1607 ## KQMessageBox.critical(None, |
|
1608 ## self.trUtf8('Process Generation Error'), |
|
1609 ## self.trUtf8('The Django process could not be started.')) |
|
1610 ## except DjangoNoSiteSelectedException: |
|
1611 ## pass |
|
1612 |
1499 |
1613 ################################################################## |
1500 ################################################################## |
1614 ## slots below implement caching functions |
1501 ## slots below implement caching functions |
1615 ################################################################## |
1502 ################################################################## |
1616 |
1503 |
1617 ## def __createCacheTables(self): |
1504 def __createCacheTables(self): |
1618 ## """ |
1505 """ |
1619 ## Private slot to create the tables for the SQL caching backend. |
1506 Private slot to create the tables for the SQL caching backend. |
1620 ## """ |
1507 """ |
1621 ## title = self.trUtf8("Create Cache Tables") |
1508 title = self.trUtf8("Create Cache Tables") |
1622 ## |
1509 |
1623 ## try: |
1510 try: |
1624 ## wd = self.__sitePath() |
1511 wd = self.__sitePath() |
1625 ## except DjangoNoSiteSelectedException: |
1512 except DjangoNoSiteSelectedException: |
1626 ## return |
1513 return |
1627 ## |
1514 |
1628 ## tblStr, ok = KQInputDialog.getText(\ |
1515 tblStr, ok = QInputDialog.getText( |
1629 ## self.__ui, |
1516 self.__ui, |
1630 ## title, |
1517 title, |
1631 ## self.trUtf8("Enter the names of the cache tables separated by spaces."), |
1518 self.trUtf8("Enter the names of the cache tables separated by spaces."), |
1632 ## QLineEdit.Normal) |
1519 QLineEdit.Normal) |
1633 ## if ok and not tblStr.isEmpty(): |
1520 if ok and tblStr != "": |
1634 ## tableNames = tblStr.split(" ", QString.SkipEmptyParts) |
1521 tableNames = tblStr.split() |
1635 ## |
1522 |
1636 ## args = QStringList() |
1523 args = [] |
1637 ## args.append(self.__getPythonExecutable()) |
1524 args.append(self.__getPythonExecutable()) |
1638 ## args.append("manage.py") |
1525 args.append("manage.py") |
1639 ## args.append("createcachetable") |
1526 args.append("createcachetable") |
1640 ## args += tableNames |
1527 args += tableNames |
1641 ## |
1528 |
1642 ## dia = DjangoDialog(title, |
1529 dia = DjangoDialog(title, |
1643 ## msgSuccess = self.trUtf8("Cache tables created successfully.")) |
1530 msgSuccess = self.trUtf8("Cache tables created successfully.")) |
1644 ## res = dia.startProcess(args, wd) |
1531 res = dia.startProcess(args, wd) |
1645 ## if res: |
1532 if res: |
1646 ## dia.exec_() |
1533 dia.exec_() |
1647 |
1534 |
1648 ################################################################## |
1535 ################################################################## |
1649 ## slots below implement testing functions |
1536 ## slots below implement testing functions |
1650 ################################################################## |
1537 ################################################################## |
1651 |
1538 |
1652 ## def __dumpData(self): |
1539 def __dumpData(self): |
1653 ## """ |
1540 """ |
1654 ## Private slot to dump the database data to a fixture. |
1541 Private slot to dump the database data to a fixture. |
1655 ## """ |
1542 """ |
1656 ## title = self.trUtf8("Dump Data") |
1543 title = self.trUtf8("Dump Data") |
1657 ## |
1544 |
1658 ## try: |
1545 try: |
1659 ## wd = self.__sitePath() |
1546 wd = self.__sitePath() |
1660 ## except DjangoNoSiteSelectedException: |
1547 except DjangoNoSiteSelectedException: |
1661 ## return |
1548 return |
1662 ## |
1549 |
1663 ## dlg = DjangoDumpdataDataDialog(self, self.__ui) |
1550 from .DjangoDumpdataDataDialog import DjangoDumpdataDataDialog |
1664 ## if dlg.exec_() == QDialog.Accepted: |
1551 dlg = DjangoDumpdataDataDialog(self, self.__ui) |
1665 ## appls, excls, format = dlg.getData() |
1552 if dlg.exec_() == QDialog.Accepted: |
1666 ## |
1553 appls, excls, format, indent = dlg.getData() |
1667 ## args = QStringList() |
1554 |
1668 ## args.append(self.__getPythonExecutable()) |
1555 args = [] |
1669 ## args.append("manage.py") |
1556 args.append(self.__getPythonExecutable()) |
1670 ## args.append("dumpdata") |
1557 args.append("manage.py") |
1671 ## args.append("--format=%s" % format) |
1558 args.append("dumpdata") |
1672 ## args.append("--indent=2") |
1559 args.append("--format={0}".format(format)) |
1673 ## for excl in excls: |
1560 args.append("--indent={0}".format(indent)) |
1674 ## args.append("--exclude=%s" % excl) |
1561 for excl in excls: |
1675 ## if not appls.isEmpty(): |
1562 args.append("--exclude={0}".format(excl)) |
1676 ## args += appls |
1563 args += appls |
1677 ## |
1564 |
1678 ## if format == "json": |
1565 if format == "json": |
1679 ## fileFilters = self.trUtf8("JSON Files (*.json)") |
1566 fileFilters = self.trUtf8("JSON Files (*.json)") |
1680 ## elif format == "xml": |
1567 elif format == "xml": |
1681 ## fileFilters = self.trUtf8("XML Files (*.xml)") |
1568 fileFilters = self.trUtf8("XML Files (*.xml)") |
1682 ## elif format == "yaml": |
1569 elif format == "yaml": |
1683 ## fileFilters = self.trUtf8("YAML Files (*.yaml)") |
1570 fileFilters = self.trUtf8("YAML Files (*.yaml)") |
1684 ## |
1571 |
1685 ## dia = DjangoDialog(title, fixed = True, linewrap = False, |
1572 dia = DjangoDialog(title, fixed = True, linewrap = False, |
1686 ## saveFilters = fileFilters) |
1573 saveFilters = fileFilters) |
1687 ## res = dia.startProcess(args, wd, showCommand = False) |
1574 res = dia.startProcess(args, wd, showCommand = False) |
1688 ## if res: |
1575 if res: |
1689 ## dia.exec_() |
1576 dia.exec_() |
1690 ## |
1577 |
1691 ## def __loadData(self): |
1578 def __loadData(self): |
1692 ## """ |
1579 """ |
1693 ## Private slot to load data from fixture files. |
1580 Private slot to load data from fixture files. |
1694 ## """ |
1581 """ |
1695 ## title = self.trUtf8("Load Data") |
1582 title = self.trUtf8("Load Data") |
1696 ## |
1583 |
1697 ## try: |
1584 try: |
1698 ## wd = self.__sitePath() |
1585 wd = self.__sitePath() |
1699 ## except DjangoNoSiteSelectedException: |
1586 except DjangoNoSiteSelectedException: |
1700 ## return |
1587 return |
1701 ## |
1588 |
1702 ## dlg = DjangoLoaddataDataDialog(self, self.__ui) |
1589 from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog |
1703 ## if dlg.exec_() == QDialog.Accepted: |
1590 dlg = DjangoLoaddataDataDialog(self, self.__ui) |
1704 ## fixtures = dlg.getData() |
1591 if dlg.exec_() == QDialog.Accepted: |
1705 ## |
1592 fixtures = dlg.getData() |
1706 ## args = QStringList() |
1593 |
1707 ## args.append(self.__getPythonExecutable()) |
1594 args = [] |
1708 ## args.append("manage.py") |
1595 args.append(self.__getPythonExecutable()) |
1709 ## args.append("loaddata") |
1596 args.append("manage.py") |
1710 ## args += fixtures |
1597 args.append("loaddata") |
1711 ## |
1598 args += fixtures |
1712 ## dia = DjangoDialog(title) |
1599 |
1713 ## res = dia.startProcess(args, wd) |
1600 dia = DjangoDialog(title) |
1714 ## if res: |
1601 res = dia.startProcess(args, wd) |
1715 ## dia.exec_() |
1602 if res: |
1716 ## |
1603 dia.exec_() |
1717 ## def __runTestSuite(self): |
1604 |
1718 ## """ |
1605 def __runTestSuite(self): |
1719 ## Private slot to run the test suite for applications or the whole site. |
1606 """ |
1720 ## """ |
1607 Private slot to run the test suite for applications or the whole site. |
1721 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommandNoClose")) |
1608 """ |
1722 ## if consoleCmd: |
1609 consoleCmd = self.__isSpawningConsole( |
1723 ## try: |
1610 self.__plugin.getPreferences("ConsoleCommandNoClose"))[1] |
1724 ## wd = self.__sitePath() |
1611 if consoleCmd: |
1725 ## except DjangoNoSiteSelectedException: |
1612 try: |
1726 ## return |
1613 wd = self.__sitePath() |
1727 ## |
1614 except DjangoNoSiteSelectedException: |
1728 ## proc = QProcess() |
1615 return |
1729 ## args = Utilities.parseOptionString(consoleCmd) |
1616 |
1730 ## args[0] = Utilities.getExecutablePath(args[0]) |
1617 args = Utilities.parseOptionString(consoleCmd) |
1731 ## args.append(self.__getPythonExecutable()) |
1618 args[0] = Utilities.getExecutablePath(args[0]) |
1732 ## args.append("manage.py") |
1619 args.append(self.__getPythonExecutable()) |
1733 ## args.append("test") |
1620 args.append("manage.py") |
1734 ## args += self.__getApplications() |
1621 args.append("test") |
1735 ## |
1622 args += self.__getApplications() |
1736 ## started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1623 |
1737 ## if not started: |
1624 started, pid = QProcess.startDetached(args[0], args[1:], wd) |
1738 ## KQMessageBox.critical(None, |
1625 if not started: |
1739 ## self.trUtf8('Process Generation Error'), |
1626 E5MessageBox.critical(None, |
1740 ## self.trUtf8('The Django process could not be started.')) |
1627 self.trUtf8('Process Generation Error'), |
1741 ## |
1628 self.trUtf8('The Django process could not be started.')) |
1742 ## def __runTestServer(self): |
1629 |
1743 ## """ |
1630 def __runTestServer(self): |
1744 ## Private slot to run a development server with data from a set of fixtures. |
1631 """ |
1745 ## """ |
1632 Private slot to run a development server with data from a set of fixtures. |
1746 ## consoleCmd = unicode(self.__plugin.getPreferences("ConsoleCommand")) |
1633 """ |
1747 ## if consoleCmd: |
1634 consoleCmd = self.__isSpawningConsole( |
1748 ## dlg = DjangoLoaddataDataDialog(self, self.__ui) |
1635 self.__plugin.getPreferences("ConsoleCommand"))[1] |
1749 ## if dlg.exec_() == QDialog.Accepted: |
1636 if consoleCmd: |
1750 ## fixtures = dlg.getData() |
1637 from .DjangoLoaddataDataDialog import DjangoLoaddataDataDialog |
1751 ## |
1638 dlg = DjangoLoaddataDataDialog(self, self.__ui) |
1752 ## args = Utilities.parseOptionString(consoleCmd) |
1639 if dlg.exec_() == QDialog.Accepted: |
1753 ## args[0] = Utilities.getExecutablePath(args[0]) |
1640 fixtures = dlg.getData() |
1754 ## args.append(self.__getPythonExecutable()) |
1641 |
1755 ## args.append("manage.py") |
1642 args = Utilities.parseOptionString(consoleCmd) |
1756 ## args.append("testserver") |
1643 args[0] = Utilities.getExecutablePath(args[0]) |
1757 ## addr = self.__plugin.getPreferences("ServerAddress") |
1644 args.append(self.__getPythonExecutable()) |
1758 ## if addr: |
1645 args.append("manage.py") |
1759 ## args.append("--addrport=%s" % addr) |
1646 args.append("testserver") |
1760 ## args += fixtures |
1647 addr = self.__plugin.getPreferences("ServerAddress") |
1761 ## |
1648 if addr: |
1762 ## try: |
1649 args.append("--addrport=%s" % addr) |
1763 ## if Utilities.isWindowsPlatform(): |
1650 args += fixtures |
1764 ## serverProcStarted, pid = \ |
1651 |
1765 ## QProcess.startDetached(args[0], args[1:], self.__sitePath()) |
1652 try: |
1766 ## else: |
1653 if Utilities.isWindowsPlatform(): |
1767 ## if self.__testServerProc is not None: |
1654 serverProcStarted, pid = \ |
1768 ## self.__testServerProcFinished() |
1655 QProcess.startDetached(args[0], args[1:], self.__sitePath()) |
1769 ## |
1656 else: |
1770 ## self.__testServerProc = QProcess() |
1657 if self.__testServerProc is not None: |
1771 ## self.connect(self.__testServerProc, |
1658 self.__testServerProcFinished() |
1772 ## SIGNAL('finished(int, QProcess::ExitStatus)'), |
1659 |
1773 ## self.__serverProcFinished) |
1660 self.__testServerProc = QProcess() |
1774 ## |
1661 self.__testServerProc.finished.connect(self.__serverProcFinished) |
1775 ## self.__testServerProc.setWorkingDirectory(self.__sitePath()) |
1662 self.__testServerProc.setWorkingDirectory(self.__sitePath()) |
1776 ## self.__testServerProc.start(args[0], args[1:]) |
1663 self.__testServerProc.start(args[0], args[1:]) |
1777 ## serverProcStarted = self.__testServerProc.waitForStarted() |
1664 serverProcStarted = self.__testServerProc.waitForStarted() |
1778 ## if not serverProcStarted: |
1665 if not serverProcStarted: |
1779 ## KQMessageBox.critical(None, |
1666 E5MessageBox.critical(None, |
1780 ## self.trUtf8('Process Generation Error'), |
1667 self.trUtf8('Process Generation Error'), |
1781 ## self.trUtf8('The Django test server could not be started.')) |
1668 self.trUtf8('The Django test server could not be started.')) |
1782 ## except DjangoNoSiteSelectedException: |
1669 except DjangoNoSiteSelectedException: |
1783 ## pass |
1670 pass |
1784 ## |
1671 |
1785 ## def __testServerProcFinished(self): |
1672 def __testServerProcFinished(self): |
1786 ## """ |
1673 """ |
1787 ## Private slot connected to the finished signal of the test server. |
1674 Private slot connected to the finished signal of the test server. |
1788 ## """ |
1675 """ |
1789 ## if self.__testServerProc is not None and \ |
1676 if self.__testServerProc is not None and \ |
1790 ## self.__testServerProc.state() != QProcess.NotRunning: |
1677 self.__testServerProc.state() != QProcess.NotRunning: |
1791 ## self.__testServerProc.terminate() |
1678 self.__testServerProc.terminate() |
1792 ## QTimer.singleShot(2000, self.__testServerProc, SLOT('kill()')) |
1679 QTimer.singleShot(2000, self.__testServerProc.kill) |
1793 ## self.__testServerProc.waitForFinished(3000) |
1680 self.__testServerProc.waitForFinished(3000) |
1794 ## self.__testServerProc = None |
1681 self.__testServerProc = None |
1795 |
1682 |
1796 ################################################################## |
1683 ################################################################## |
1797 ## slots below implement translation functions |
1684 ## slots below implement translation functions |
1798 ################################################################## |
1685 ################################################################## |
1799 |
1686 |
1800 ## def __getLocale(self, filename): |
1687 # TODO: the below stuff needs testing |
1801 ## """ |
1688 def __getLocale(self, filename): |
1802 ## Private method to extract the locale out of a file name. |
1689 """ |
1803 ## |
1690 Private method to extract the locale out of a file name. |
1804 ## @param filename name of the file used for extraction (string or QString) |
1691 |
1805 ## @return extracted locale (string) or None |
1692 @param filename name of the file used for extraction (string) |
1806 ## """ |
1693 @return extracted locale (string) or None |
1807 ## if self.__e4project.pdata["TRANSLATIONPATTERN"]: |
1694 """ |
1808 ## pattern = unicode(self.__e4project.pdata["TRANSLATIONPATTERN"][0])\ |
1695 if self.__e5project.pdata["TRANSLATIONPATTERN"]: |
1809 ## .replace("%language%", "(.*?)") |
1696 pattern = self.__e5project.pdata["TRANSLATIONPATTERN"][0]\ |
1810 ## match = re.search(pattern, unicode(filename)) |
1697 .replace("%language%", "(.*?)") |
1811 ## if match is not None: |
1698 match = re.search(pattern, filename) |
1812 ## loc = match.group(1) |
1699 if match is not None: |
1813 ## return loc |
1700 loc = match.group(1) |
1814 ## else: |
1701 return loc |
1815 ## loc = None |
1702 else: |
1816 ## else: |
1703 loc = None |
1817 ## loc = None |
1704 else: |
1818 ## |
1705 loc = None |
1819 ## return loc |
1706 |
1820 ## |
1707 return loc |
1821 ## def __normalizeList(self, filenames): |
1708 |
1822 ## """ |
1709 def __normalizeList(self, filenames): |
1823 ## Private method to normalize a list of file names. |
1710 """ |
1824 ## |
1711 Private method to normalize a list of file names. |
1825 ## @param filenames list of file names to normalize (list of string or QString) |
1712 |
1826 ## @return normalized file names (list of string) |
1713 @param filenames list of file names to normalize (list of strings) |
1827 ## """ |
1714 @return normalized file names (list of strings) |
1828 ## nfilenames = [] |
1715 """ |
1829 ## for filename in filenames: |
1716 nfilenames = [] |
1830 ## filename = unicode(filename) |
1717 for filename in filenames: |
1831 ## if filename.endswith(".mo"): |
1718 if filename.endswith(".mo"): |
1832 ## filename = filename.replace(".mo", ".po") |
1719 filename = filename.replace(".mo", ".po") |
1833 ## if filename not in nfilenames: |
1720 if filename not in nfilenames: |
1834 ## nfilenames.append(filename) |
1721 nfilenames.append(filename) |
1835 ## |
1722 |
1836 ## return nfilenames |
1723 return nfilenames |
1837 ## |
1724 |
1838 ## def __siteFilteredList(self, filenames): |
1725 def __siteFilteredList(self, filenames): |
1839 ## """ |
1726 """ |
1840 ## Private method to filter a list of file names by site. |
1727 Private method to filter a list of file names by site. |
1841 ## |
1728 |
1842 ## @param filenames list of file names to be filtered (list of string or QString) |
1729 @param filenames list of file names to be filtered (list of strings) |
1843 ## @return file names belonging to the current site (list of string) |
1730 @return file names belonging to the current site (list of strings) |
1844 ## """ |
1731 """ |
1845 ## site = self.__site() |
1732 site = self.__site() |
1846 ## nfilenames = [] |
1733 nfilenames = [] |
1847 ## for filename in filenames: |
1734 for filename in filenames: |
1848 ## filename = unicode(filename) |
1735 if site == "" or filename.startswith(site + os.sep): |
1849 ## if site == "" or filename.startswith(site + os.sep): |
1736 nfilenames.append(filename) |
1850 ## nfilenames.append(filename) |
1737 |
1851 ## |
1738 return nfilenames |
1852 ## return nfilenames |
|
1853 |
1739 |
1854 def __projectLanguageAdded(self, code): |
1740 def __projectLanguageAdded(self, code): |
1855 """ |
1741 """ |
1856 Private slot handling the addition of a new language. |
1742 Private slot handling the addition of a new language. |
1857 |
1743 |
1858 @param code language code of the new language (string or QString) |
1744 @param code language code of the new language (string) |
1859 """ |
1745 """ |
1860 ## title = self.trUtf8("Initializing message catalog for '%1'").arg(code) |
1746 title = self.trUtf8("Initializing message catalog for '{0}'").format(code) |
1861 ## |
1747 |
1862 ## args = QStringList() |
1748 args = [] |
1863 ## args.append(self.__getPythonExecutable()) |
1749 args.append(self.__getPythonExecutable()) |
1864 ## args.append("manage.py") |
1750 args.append("manage.py") |
1865 ## args.append("makemessages") |
1751 args.append("makemessages") |
1866 ## args.append("-l") |
1752 args.append("--domain=django") |
1867 ## args.append(code) |
1753 args.append("--domain=djangojs") |
1868 ## |
1754 args.append("-l") |
1869 ## try: |
1755 args.append(code) |
1870 ## wd = self.__sitePath() |
1756 |
1871 ## except DjangoNoSiteSelectedException: |
1757 try: |
1872 ## KQMessageBox.warning(None, |
1758 wd = self.__sitePath() |
1873 ## title, |
1759 except DjangoNoSiteSelectedException: |
1874 ## self.trUtf8('No current site selected or no site created yet.' |
1760 E5MessageBox.warning(None, |
1875 ## ' Aborting...')) |
1761 title, |
1876 ## return |
1762 self.trUtf8('No current site selected or no site created yet.' |
1877 ## |
1763 ' Aborting...')) |
1878 ## dia = DjangoDialog(title, |
1764 return |
1879 ## msgSuccess = \ |
1765 |
1880 ## self.trUtf8("\nMessage catalog initialized successfully.")) |
1766 dia = DjangoDialog(title, |
1881 ## res = dia.startProcess(args, wd) |
1767 msgSuccess = \ |
1882 ## if res: |
1768 self.trUtf8("\nMessage catalog initialized successfully.")) |
1883 ## dia.exec_() |
1769 res = dia.startProcess(args, wd) |
1884 ## |
1770 if res: |
1885 ## langFile = self.__e4project.pdata["TRANSLATIONPATTERN"][0]\ |
1771 dia.exec_() |
1886 ## .replace("%language%", code) |
1772 |
1887 ## self.__e4project.appendFile(langFile) |
1773 langFile = self.__e5project.pdata["TRANSLATIONPATTERN"][0]\ |
|
1774 .replace("%language%", code) |
|
1775 self.__e5project.appendFile(langFile) |
1888 |
1776 |
1889 def updateSelectedCatalogs(self, filenames): |
1777 def updateSelectedCatalogs(self, filenames): |
1890 """ |
1778 """ |
1891 Public method to update the message catalogs. |
1779 Public method to update the message catalogs. |
1892 |
1780 |
|
1781 @param filenames list of file names (list of strings) |
|
1782 """ |
|
1783 title = self.trUtf8("Updating message catalogs") |
|
1784 |
|
1785 try: |
|
1786 wd = self.__sitePath() |
|
1787 except DjangoNoSiteSelectedException: |
|
1788 E5MessageBox.warning(None, |
|
1789 title, |
|
1790 self.trUtf8('No current site selected or no site created yet.' |
|
1791 ' Aborting...')) |
|
1792 return |
|
1793 |
|
1794 argsLists = [] |
|
1795 |
|
1796 for filename in self.__normalizeList(self.__siteFilteredList(filenames)): |
|
1797 locale = self.__getLocale(filename) |
|
1798 if locale: |
|
1799 args = [] |
|
1800 args.append(self.__getPythonExecutable()) |
|
1801 args.append("manage.py") |
|
1802 args.append("makemessages") |
|
1803 args.append("--no-obsolete") |
|
1804 args.append("--domain=django") |
|
1805 args.append("--domain=djangojs") |
|
1806 args.append("-l") |
|
1807 args.append(locale) |
|
1808 argsLists.append(args) |
|
1809 |
|
1810 if len(argsLists) == 0: |
|
1811 E5MessageBox.warning(None, |
|
1812 title, |
|
1813 self.trUtf8('No locales detected. Aborting...')) |
|
1814 return |
|
1815 |
|
1816 dia = DjangoDialog(title, |
|
1817 msgSuccess = \ |
|
1818 self.trUtf8("\nMessage catalogs updated successfully.")) |
|
1819 res = dia.startBatchProcesses(argsLists, wd) |
|
1820 if res: |
|
1821 dia.exec_() |
|
1822 |
|
1823 def updateSelectedCatalogsWithObsolete(self, filenames): |
|
1824 """ |
|
1825 Public method to update the message catalogs keeping obsolete messages. |
|
1826 |
1893 @param filenames list of filenames |
1827 @param filenames list of filenames |
1894 """ |
1828 """ |
1895 ## title = self.trUtf8("Updating message catalogs") |
1829 title = self.trUtf8("Updating message catalogs (keeping obsolete messages)") |
1896 ## |
1830 |
1897 ## try: |
1831 try: |
1898 ## wd = self.__sitePath() |
1832 wd = self.__sitePath() |
1899 ## except DjangoNoSiteSelectedException: |
1833 except DjangoNoSiteSelectedException: |
1900 ## KQMessageBox.warning(None, |
1834 E5MessageBox.warning(None, |
1901 ## title, |
1835 title, |
1902 ## self.trUtf8('No current site selected or no site created yet.' |
1836 self.trUtf8('No current site selected or no site created yet.' |
1903 ## ' Aborting...')) |
1837 ' Aborting...')) |
1904 ## return |
1838 return |
1905 ## |
1839 |
1906 ## argsLists = [] |
1840 argsLists = [] |
1907 ## |
1841 |
1908 ## for filename in self.__normalizeList(self.__siteFilteredList(filenames)): |
1842 for filename in self.__normalizeList(self.__siteFilteredList(filenames)): |
1909 ## locale = self.__getLocale(filename) |
1843 locale = self.__getLocale(filename) |
1910 ## if locale: |
1844 if locale: |
1911 ## args = QStringList() |
1845 args = [] |
1912 ## args.append(self.__getPythonExecutable()) |
1846 args.append(self.__getPythonExecutable()) |
1913 ## args.append("manage.py") |
1847 args.append("manage.py") |
1914 ## args.append("makemessages") |
1848 args.append("makemessages") |
1915 ## args.append("-l") |
1849 args.append("--domain=django") |
1916 ## args.append(locale) |
1850 args.append("--domain=djangojs") |
1917 ## argsLists.append(args) |
1851 args.append("-l") |
1918 ## |
1852 args.append(locale) |
1919 ## if len(argsLists) == 0: |
1853 argsLists.append(args) |
1920 ## KQMessageBox.warning(None, |
1854 |
1921 ## title, |
1855 if len(argsLists) == 0: |
1922 ## self.trUtf8('No locales detected.' |
1856 E5MessageBox.warning(None, |
1923 ## ' Aborting...')) |
1857 title, |
1924 ## return |
1858 self.trUtf8('No locales detected. Aborting...')) |
1925 ## |
1859 return |
1926 ## dia = DjangoDialog(title, |
1860 |
1927 ## msgSuccess = \ |
1861 dia = DjangoDialog(title, |
1928 ## self.trUtf8("\nMessage catalogs updated successfully.")) |
1862 msgSuccess = \ |
1929 ## res = dia.startBatchProcesses(argsLists, wd) |
1863 self.trUtf8("\nMessage catalogs updated successfully.")) |
1930 ## if res: |
1864 res = dia.startBatchProcesses(argsLists, wd) |
1931 ## dia.exec_() |
1865 if res: |
|
1866 dia.exec_() |
1932 |
1867 |
1933 def updateCatalogs(self, filenames): |
1868 def updateCatalogs(self, filenames): |
1934 """ |
1869 """ |
1935 Public method to update the message catalogs. |
1870 Public method to update the message catalogs. |
1936 |
1871 |
1937 @param filenames list of filenames (not used) |
1872 @param filenames list of filenames (not used) |
1938 """ |
1873 """ |
1939 ## title = self.trUtf8("Updating message catalogs") |
1874 title = self.trUtf8("Updating message catalogs") |
1940 ## |
1875 |
1941 ## args = QStringList() |
1876 args = [] |
1942 ## args.append(self.__getPythonExecutable()) |
1877 args.append(self.__getPythonExecutable()) |
1943 ## args.append("manage.py") |
1878 args.append("manage.py") |
1944 ## args.append("makemessages") |
1879 args.append("makemessages") |
1945 ## args.append("-a") |
1880 args.append("-a") |
1946 ## |
1881 args.append("--no-obsolete") |
1947 ## try: |
1882 args.append("--domain=django") |
1948 ## wd = self.__sitePath() |
1883 args.append("--domain=djangojs") |
1949 ## except DjangoNoSiteSelectedException: |
1884 |
1950 ## KQMessageBox.warning(None, |
1885 try: |
1951 ## title, |
1886 wd = self.__sitePath() |
1952 ## self.trUtf8('No current site selected or no site created yet.' |
1887 except DjangoNoSiteSelectedException: |
1953 ## ' Aborting...')) |
1888 E5MessageBox.warning(None, |
1954 ## return |
1889 title, |
1955 ## |
1890 self.trUtf8('No current site selected or no site created yet.' |
1956 ## dia = DjangoDialog(title, |
1891 ' Aborting...')) |
1957 ## msgSuccess = \ |
1892 return |
1958 ## self.trUtf8("\nMessage catalogs updated successfully.")) |
1893 |
1959 ## res = dia.startProcess(args, wd) |
1894 dia = DjangoDialog(title, |
1960 ## if res: |
1895 msgSuccess = \ |
1961 ## dia.exec_() |
1896 self.trUtf8("\nMessage catalogs updated successfully.")) |
|
1897 res = dia.startProcess(args, wd) |
|
1898 if res: |
|
1899 dia.exec_() |
|
1900 |
|
1901 def updateCatalogsWithObsolete(self, filenames): |
|
1902 """ |
|
1903 Public method to update the message catalogs keeping obsolete messages. |
|
1904 |
|
1905 @param filenames list of filenames (not used) |
|
1906 """ |
|
1907 title = self.trUtf8("Updating message catalogs (keeping obsolete messages)") |
|
1908 |
|
1909 args = [] |
|
1910 args.append(self.__getPythonExecutable()) |
|
1911 args.append("manage.py") |
|
1912 args.append("makemessages") |
|
1913 args.append("-a") |
|
1914 args.append("--domain=django") |
|
1915 args.append("--domain=djangojs") |
|
1916 |
|
1917 try: |
|
1918 wd = self.__sitePath() |
|
1919 except DjangoNoSiteSelectedException: |
|
1920 E5MessageBox.warning(None, |
|
1921 title, |
|
1922 self.trUtf8('No current site selected or no site created yet.' |
|
1923 ' Aborting...')) |
|
1924 return |
|
1925 |
|
1926 dia = DjangoDialog(title, |
|
1927 msgSuccess = \ |
|
1928 self.trUtf8("\nMessage catalogs updated successfully.")) |
|
1929 res = dia.startProcess(args, wd) |
|
1930 if res: |
|
1931 dia.exec_() |
1962 |
1932 |
1963 def compileSelectedCatalogs(self, filenames): |
1933 def compileSelectedCatalogs(self, filenames): |
1964 """ |
1934 """ |
1965 Public method to update the message catalogs. |
1935 Public method to update the message catalogs. |
1966 |
1936 |
1967 @param filenames list of filenames |
1937 @param filenames list of filenames |
1968 """ |
1938 """ |
1969 ## title = self.trUtf8("Compiling message catalogs") |
1939 title = self.trUtf8("Compiling message catalogs") |
1970 ## |
1940 |
1971 ## try: |
1941 try: |
1972 ## wd = self.__sitePath() |
1942 wd = self.__sitePath() |
1973 ## except DjangoNoSiteSelectedException: |
1943 except DjangoNoSiteSelectedException: |
1974 ## KQMessageBox.warning(None, |
1944 E5MessageBox.warning(None, |
1975 ## title, |
1945 title, |
1976 ## self.trUtf8('No current site selected or no site created yet.' |
1946 self.trUtf8('No current site selected or no site created yet.' |
1977 ## ' Aborting...')) |
1947 ' Aborting...')) |
1978 ## return |
1948 return |
1979 ## |
1949 |
1980 ## argsLists = [] |
1950 argsLists = [] |
1981 ## |
1951 |
1982 ## for filename in self.__normalizeList(self.__siteFilteredList(filenames)): |
1952 for filename in self.__normalizeList(self.__siteFilteredList(filenames)): |
1983 ## locale = self.__getLocale(filename) |
1953 locale = self.__getLocale(filename) |
1984 ## if locale: |
1954 if locale: |
1985 ## args = QStringList() |
1955 args = [] |
1986 ## args.append(self.__getPythonExecutable()) |
1956 args.append(self.__getPythonExecutable()) |
1987 ## args.append("manage.py") |
1957 args.append("manage.py") |
1988 ## args.append("compilemessages") |
1958 args.append("compilemessages") |
1989 ## args.append("-l") |
1959 args.append("-l") |
1990 ## args.append(locale) |
1960 args.append(locale) |
1991 ## argsLists.append(args) |
1961 argsLists.append(args) |
1992 ## |
1962 |
1993 ## if len(argsLists) == 0: |
1963 if len(argsLists) == 0: |
1994 ## KQMessageBox.warning(None, |
1964 E5MessageBox.warning(None, |
1995 ## title, |
1965 title, |
1996 ## self.trUtf8('No locales detected.' |
1966 self.trUtf8('No locales detected. Aborting...')) |
1997 ## ' Aborting...')) |
1967 return |
1998 ## return |
1968 |
1999 ## |
1969 dia = DjangoDialog(title, |
2000 ## dia = DjangoDialog(title, |
1970 msgSuccess = \ |
2001 ## msgSuccess = \ |
1971 self.trUtf8("\nMessage catalogs compiled successfully.")) |
2002 ## self.trUtf8("\nMessage catalogs compiled successfully.")) |
1972 res = dia.startBatchProcesses(argsLists, wd, mergedOutput = True) |
2003 ## res = dia.startBatchProcesses(argsLists, wd, mergedOutput = True) |
1973 if res: |
2004 ## if res: |
1974 dia.exec_() |
2005 ## dia.exec_() |
1975 |
2006 ## |
1976 for entry in os.walk(self.__sitePath()): |
2007 ## for entry in os.walk(self.__sitePath()): |
1977 for fileName in entry[2]: |
2008 ## for fileName in entry[2]: |
1978 fullName = os.path.join(entry[0], fileName) |
2009 ## fullName = os.path.join(entry[0], fileName) |
1979 if fullName.endswith('.mo'): |
2010 ## if fullName.endswith('.mo'): |
1980 self.__e5project.appendFile(fullName) |
2011 ## self.__e4project.appendFile(fullName) |
|
2012 |
1981 |
2013 def compileCatalogs(self, filenames): |
1982 def compileCatalogs(self, filenames): |
2014 """ |
1983 """ |
2015 Public method to compile the message catalogs. |
1984 Public method to compile the message catalogs. |
2016 |
1985 |
2017 @param filenames list of filenames (not used) |
1986 @param filenames list of filenames (not used) |
2018 """ |
1987 """ |
2019 ## title = self.trUtf8("Compiling message catalogs") |
1988 title = self.trUtf8("Compiling message catalogs") |
2020 ## |
1989 |
2021 ## args = QStringList() |
1990 args = [] |
2022 ## args.append(self.__getPythonExecutable()) |
1991 args.append(self.__getPythonExecutable()) |
2023 ## args.append("manage.py") |
1992 args.append("manage.py") |
2024 ## args.append("compilemessages") |
1993 args.append("compilemessages") |
2025 ## |
1994 |
2026 ## try: |
1995 try: |
2027 ## wd = self.__sitePath() |
1996 wd = self.__sitePath() |
2028 ## except DjangoNoSiteSelectedException: |
1997 except DjangoNoSiteSelectedException: |
2029 ## KQMessageBox.warning(None, |
1998 E5MessageBox.warning(None, |
2030 ## title, |
1999 title, |
2031 ## self.trUtf8('No current site selected or no site created yet.' |
2000 self.trUtf8('No current site selected or no site created yet.' |
2032 ## ' Aborting...')) |
2001 ' Aborting...')) |
2033 ## return |
2002 return |
2034 ## |
2003 |
2035 ## dia = DjangoDialog(title, |
2004 dia = DjangoDialog(title, |
2036 ## msgSuccess = \ |
2005 msgSuccess = \ |
2037 ## self.trUtf8("\nMessage catalogs compiled successfully.")) |
2006 self.trUtf8("\nMessage catalogs compiled successfully.")) |
2038 ## res = dia.startProcess(args, wd, mergedOutput = True) |
2007 res = dia.startProcess(args, wd, mergedOutput = True) |
2039 ## if res: |
2008 if res: |
2040 ## dia.exec_() |
2009 dia.exec_() |
2041 ## |
2010 |
2042 ## for entry in os.walk(self.__sitePath()): |
2011 for entry in os.walk(self.__sitePath()): |
2043 ## for fileName in entry[2]: |
2012 for fileName in entry[2]: |
2044 ## fullName = os.path.join(entry[0], fileName) |
2013 fullName = os.path.join(entry[0], fileName) |
2045 ## if fullName.endswith('.mo'): |
2014 if fullName.endswith('.mo'): |
2046 ## self.__e4project.appendFile(fullName) |
2015 self.__e5project.appendFile(fullName) |