Project/ProjectTranslationsBrowser.py

changeset 428
58405c24aa09
parent 248
f4561c24989a
child 461
34528aaedf1c
equal deleted inserted replaced
427:6af5d12cfecb 428:58405c24aa09
655 @param filter list of source file extension that should be considered 655 @param filter list of source file extension that should be considered
656 (list of strings) 656 (list of strings)
657 @return flag indicating success 657 @return flag indicating success
658 """ 658 """
659 path, ext = os.path.splitext(self.project.pfile) 659 path, ext = os.path.splitext(self.project.pfile)
660 pfile = '%s_e4x.pro' % path 660 pfile = '{0}_e4x.pro'.format(path)
661 661
662 # only consider files satisfying the filter criteria 662 # only consider files satisfying the filter criteria
663 _sources = [s for s in self.project.pdata["SOURCES"] \ 663 _sources = [s for s in self.project.pdata["SOURCES"] \
664 if os.path.splitext(s)[1] in filter] 664 if os.path.splitext(s)[1] in filter]
665 sources = [] 665 sources = []
708 708
709 try: 709 try:
710 pf = open(pfile, "w", encoding = "utf-8") 710 pf = open(pfile, "w", encoding = "utf-8")
711 for key, list in sections: 711 for key, list in sections:
712 if len(list) > 0: 712 if len(list) > 0:
713 pf.write('%s = ' % key) 713 pf.write('{0} = '.format(key))
714 last = len(list) - 1 714 last = len(list) - 1
715 if last > 0: 715 if last > 0:
716 pf.write('%s \\%s' % \ 716 pf.write('{0} \\{1}'.format(
717 (list[0].replace(os.sep, '/'), "\n")) 717 list[0].replace(os.sep, '/'), "\n"))
718 for i in range(1, last): 718 for i in range(1, last):
719 pf.write('\t%s \\%s' % \ 719 pf.write('\t{0} \\{1}'.format(
720 (list[i].replace(os.sep, '/'), "\n")) 720 list[i].replace(os.sep, '/'), "\n"))
721 pf.write('\t%s %s%s' % \ 721 pf.write('\t{0} {1}{2}'.format(
722 (list[last].replace(os.sep, '/'), "\n", "\n")) 722 list[last].replace(os.sep, '/'), "\n", "\n"))
723 else: 723 else:
724 pf.write('%s %s%s' % \ 724 pf.write('{0} {1}{2}'.format(
725 (list[0].replace(os.sep, '/'), "\n", "\n")) 725 list[0].replace(os.sep, '/'), "\n", "\n"))
726 726
727 pf.close() 727 pf.close()
728 self.tmpProject = pfile 728 self.tmpProject = pfile
729 return True 729 return True
730 except IOError: 730 except IOError:
741 """ 741 """
742 Private slot to handle the readyReadStandardOutput signal of the 742 Private slot to handle the readyReadStandardOutput signal of the
743 pylupdate process. 743 pylupdate process.
744 """ 744 """
745 if self.pylupdateProc is not None: 745 if self.pylupdateProc is not None:
746 self.__readStdout(self.pylupdateProc, '%s: ' % self.pylupdate) 746 self.__readStdout(self.pylupdateProc, '{0}: '.format(self.pylupdate))
747 else: 747 else:
748 return 748 return
749 749
750 def __readStdoutLrelease(self): 750 def __readStdoutLrelease(self):
751 """ 751 """
777 """ 777 """
778 Private slot to handle the readyReadStandardError signal of the 778 Private slot to handle the readyReadStandardError signal of the
779 pylupdate process. 779 pylupdate process.
780 """ 780 """
781 if self.pylupdateProc is not None: 781 if self.pylupdateProc is not None:
782 self.__readStderr(self.pylupdateProc, '%s: ' % self.pylupdate) 782 self.__readStderr(self.pylupdateProc, '{0}: '.format(self.pylupdate))
783 else: 783 else:
784 return 784 return
785 785
786 def __readStderrLrelease(self): 786 def __readStderrLrelease(self):
787 """ 787 """

eric ide

mercurial