426 ex = selectedFilter.split("(*")[1].split(")")[0] |
426 ex = selectedFilter.split("(*")[1].split(")")[0] |
427 if ex: |
427 if ex: |
428 fname += ex |
428 fname += ex |
429 |
429 |
430 if os.path.exists(fname): |
430 if os.path.exists(fname): |
431 res = E5MessageBox.yesNo(self, |
431 res = E5MessageBox.yesNo( |
|
432 self, |
432 self.trUtf8("New Resource"), |
433 self.trUtf8("New Resource"), |
433 self.trUtf8("The file already exists! Overwrite it?"), |
434 self.trUtf8("The file already exists! Overwrite it?"), |
434 icon=E5MessageBox.Warning) |
435 icon=E5MessageBox.Warning) |
435 if not res: |
436 if not res: |
436 # user selected to not overwrite |
437 # user selected to not overwrite |
447 rcfile.write('<qresource>\n') |
448 rcfile.write('<qresource>\n') |
448 rcfile.write('</qresource>\n') |
449 rcfile.write('</qresource>\n') |
449 rcfile.write('</RCC>\n') |
450 rcfile.write('</RCC>\n') |
450 rcfile.close() |
451 rcfile.close() |
451 except IOError as e: |
452 except IOError as e: |
452 E5MessageBox.critical(self, |
453 E5MessageBox.critical( |
|
454 self, |
453 self.trUtf8("New Resource"), |
455 self.trUtf8("New Resource"), |
454 self.trUtf8("<p>The new resource file <b>{0}</b> could not" |
456 self.trUtf8("<p>The new resource file <b>{0}</b> could not" |
455 " be created.<br>Problem: {1}</p>")\ |
457 " be created.<br>Problem: {1}</p>")\ |
456 .format(fname, str(e))) |
458 .format(fname, str(e))) |
457 return |
459 return |
545 f.write(line + "\n") |
547 f.write(line + "\n") |
546 f.close() |
548 f.close() |
547 if self.compiledFile not in self.project.pdata["SOURCES"]: |
549 if self.compiledFile not in self.project.pdata["SOURCES"]: |
548 self.project.appendFile(ofn) |
550 self.project.appendFile(ofn) |
549 if not self.noDialog and not ui.notificationsEnabled(): |
551 if not self.noDialog and not ui.notificationsEnabled(): |
550 E5MessageBox.information(self, |
552 E5MessageBox.information( |
|
553 self, |
551 self.trUtf8("Resource Compilation"), |
554 self.trUtf8("Resource Compilation"), |
552 self.trUtf8("The compilation of the resource file" |
555 self.trUtf8("The compilation of the resource file" |
553 " was successful.")) |
556 " was successful.")) |
554 else: |
557 else: |
555 ui.showNotification( |
558 ui.showNotification( |
557 self.trUtf8("Resource Compilation"), |
560 self.trUtf8("Resource Compilation"), |
558 self.trUtf8("The compilation of the resource file" |
561 self.trUtf8("The compilation of the resource file" |
559 " was successful.")) |
562 " was successful.")) |
560 except IOError as msg: |
563 except IOError as msg: |
561 if not self.noDialog: |
564 if not self.noDialog: |
562 E5MessageBox.information(self, |
565 E5MessageBox.information( |
|
566 self, |
563 self.trUtf8("Resource Compilation"), |
567 self.trUtf8("Resource Compilation"), |
564 self.trUtf8( |
568 self.trUtf8( |
565 "<p>The compilation of the resource file" |
569 "<p>The compilation of the resource file" |
566 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
570 " failed.</p><p>Reason: {0}</p>").format(str(msg))) |
567 else: |
571 else: |
568 if not self.noDialog: |
572 if not self.noDialog: |
569 E5MessageBox.information(self, |
573 E5MessageBox.information( |
|
574 self, |
570 self.trUtf8("Resource Compilation"), |
575 self.trUtf8("Resource Compilation"), |
571 self.trUtf8( |
576 self.trUtf8( |
572 "The compilation of the resource file failed.")) |
577 "The compilation of the resource file failed.")) |
573 else: |
578 else: |
574 ui.showNotification( |
579 ui.showNotification( |
655 return self.compileProc |
660 return self.compileProc |
656 else: |
661 else: |
657 self.compileRunning = False |
662 self.compileRunning = False |
658 if progress is not None: |
663 if progress is not None: |
659 progress.cancel() |
664 progress.cancel() |
660 E5MessageBox.critical(self, |
665 E5MessageBox.critical( |
|
666 self, |
661 self.trUtf8('Process Generation Error'), |
667 self.trUtf8('Process Generation Error'), |
662 self.trUtf8( |
668 self.trUtf8( |
663 'Could not start {0}.<br>' |
669 'Could not start {0}.<br>' |
664 'Ensure that it is in the search path.' |
670 'Ensure that it is in the search path.' |
665 ).format(self.rccCompiler)) |
671 ).format(self.rccCompiler)) |