Created
October 23, 2013 18:02
-
-
Save draganHR/7123534 to your computer and use it in GitHub Desktop.
Scripts for generating PyQT/PySide ui and resource python code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def main(): | |
os.chdir(os.path.dirname(os.path.dirname(__file__))) | |
src_path = "resources" | |
dest_path = "myproject/res" | |
for filename in os.listdir(src_path): | |
if not os.path.isfile(os.path.join(src_path, filename)): | |
continue | |
if filename[-4:] != '.qrc': | |
continue | |
print "generating %s..." % filename | |
os.system("pyside-rcc -py2 %(src_path)s/%(basename)s.qrc -o %(dest_path)s/%(basename)s_rc.py" % | |
{'src_path': src_path, 'dest_path': dest_path, 'basename': filename[:-4]}) | |
if __name__ == '__main__': | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def main(): | |
os.chdir(os.path.dirname(os.path.dirname(__file__))) | |
src_path = "ui" | |
dest_path = "myproject/res" | |
for filename in os.listdir(src_path): | |
if not os.path.isfile(os.path.join(src_path, filename)): | |
continue | |
if filename[-3:] != '.ui': | |
continue | |
print "generating %s..." % filename | |
os.system("pyside-uic --from-imports %(src_path)s/%(basename)s.ui -o %(dest_path)s/%(basename)s.py" % | |
{'src_path': src_path, 'dest_path': dest_path, 'basename': filename[:-3]}) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment