Project/ProjectResourcesBrowser.py

changeset 427
6af5d12cfecb
parent 253
3ccdf551bde7
child 461
34528aaedf1c
equal deleted inserted replaced
426:161992758137 427:6af5d12cfecb
34 @signal closeSourceWindow(string) emitted after a file has been removed/deleted 34 @signal closeSourceWindow(string) emitted after a file has been removed/deleted
35 from the project 35 from the project
36 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name 36 @signal showMenu(string, QMenu) emitted when a menu is about to be shown. The name
37 of the menu and a reference to the menu are given. 37 of the menu and a reference to the menu are given.
38 """ 38 """
39 RCFilenameFormatPython = "%s_rc.py" 39 RCFilenameFormatPython = "{0}_rc.py"
40 RCFilenameFormatRuby = "%s_rc.rb" 40 RCFilenameFormatRuby = "{0}_rc.rb"
41 41
42 def __init__(self, project, parent = None): 42 def __init__(self, project, parent = None):
43 """ 43 """
44 Constructor 44 Constructor
45 45
583 fn = os.path.join(self.project.ppath, fn) 583 fn = os.path.join(self.project.ppath, fn)
584 584
585 dirname, filename = os.path.split(ofn) 585 dirname, filename = os.path.split(ofn)
586 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 586 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]:
587 self.compiledFile = os.path.join(dirname, 587 self.compiledFile = os.path.join(dirname,
588 self.RCFilenameFormatPython % filename) 588 self.RCFilenameFormatPython.format(filename))
589 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": 589 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby":
590 self.compiledFile = os.path.join( 590 self.compiledFile = os.path.join(
591 dirname, self.RCFilenameFormatRuby % filename) 591 dirname, self.RCFilenameFormatRuby.format(filename))
592 592
593 args.append(fn) 593 args.append(fn)
594 self.connect(self.compileProc, SIGNAL('finished(int, QProcess::ExitStatus)'), 594 self.connect(self.compileProc, SIGNAL('finished(int, QProcess::ExitStatus)'),
595 self.__compileQRCDone) 595 self.__compileQRCDone)
596 self.connect(self.compileProc, SIGNAL('readyReadStandardOutput()'), 596 self.connect(self.compileProc, SIGNAL('readyReadStandardOutput()'),
714 for line in buf.splitlines(): 714 for line in buf.splitlines():
715 line = line.strip() 715 line = line.strip()
716 if line.lower().startswith("<file>") or line.lower().startswith("<file "): 716 if line.lower().startswith("<file>") or line.lower().startswith("<file "):
717 lbuf = line 717 lbuf = line
718 elif lbuf: 718 elif lbuf:
719 lbuf = "%s%s" % (lbuf, line) 719 lbuf = "{0}{1}".format(lbuf, line)
720 if lbuf.lower().endswith("</file>"): 720 if lbuf.lower().endswith("</file>"):
721 rfile = lbuf.split(">", 1)[1].split("<", 1)[0] 721 rfile = lbuf.split(">", 1)[1].split("<", 1)[0]
722 if not os.path.isabs(rfile): 722 if not os.path.isabs(rfile):
723 rfile = os.path.join(self.project.ppath, rfile) 723 rfile = os.path.join(self.project.ppath, rfile)
724 if os.path.exists(rfile) and \ 724 if os.path.exists(rfile) and \
749 QApplication.processEvents() 749 QApplication.processEvents()
750 ifn = os.path.join(self.project.ppath, fn) 750 ifn = os.path.join(self.project.ppath, fn)
751 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]: 751 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python3"]:
752 dirname, filename = os.path.split(os.path.splitext(ifn)[0]) 752 dirname, filename = os.path.split(os.path.splitext(ifn)[0])
753 ofn = os.path.join(dirname, 753 ofn = os.path.join(dirname,
754 self.RCFilenameFormatPython % filename) 754 self.RCFilenameFormatPython.format(filename))
755 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": 755 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby":
756 dirname, filename = os.path.split(os.path.splitext(ifn)[0]) 756 dirname, filename = os.path.split(os.path.splitext(ifn)[0])
757 ofn = os.path.join(dirname, 757 ofn = os.path.join(dirname,
758 self.RCFilenameFormatRuby % filename) 758 self.RCFilenameFormatRuby.format(filename))
759 else: 759 else:
760 return 760 return
761 if not os.path.exists(ofn) or \ 761 if not os.path.exists(ofn) or \
762 os.stat(ifn).st_mtime > os.stat(ofn).st_mtime: 762 os.stat(ifn).st_mtime > os.stat(ofn).st_mtime:
763 changedResources.append(fn) 763 changedResources.append(fn)

eric ide

mercurial