Example #1
0
def main():
    # Directorio desde donde se leerán los archivos .ui generados por QtDesigner
    uiDir = os.path.abspath(os.path.join(os.curdir, 'qt', 'IA2013TPIRLGUI'))
    print uiDir
    # Directorio donde serán almacenados los archivos generados por pyuic
    uiPyDir = os.path.abspath(os.path.join('..', 'src', 'gui', 'qtgen'))
    qrcDir = os.path.abspath(os.path.join(os.curdir, 'qt', 'IA2013TPIRLGUI'))
    qrcPyDir = uiPyDir

    def map_dir(py_dir, py_file):
        print py_file
        return (uiPyDir, py_file)

    try:
        print 'Compilando archivos de interfaz gráfica...'
        uic.compileUiDir(uiDir, recurse=True, map=map_dir)
    except Exception as e:
        print 'ERROR: ' + str(e)
    finally:
        print 'Compilación finalizada.'

    qrc_compiler = "pyrcc4"
    qrc_build_path = uiDir
    full_path = os.path.join(qrc_build_path, qrc_compiler)
    args = ["pyrcc4", os.path.join(uiDir, "recursos.qrc"), "-o", os.path.join(qrcPyDir, "recursos_rc.py")]
    process = subprocess.Popen(args, shell=True, cwd=uiDir)
    process.communicate()
Example #2
0
def main(argv, dir='.'):
    """ Main function that parses and compiles the files """
    parser = ClassParser()
    if isinstance(dir, str):
        dir = [dir]

    for dir in dir[:]:
        # Create py files from ui files
        # file_names is passed around here as it is outside of each functions scope
        del file_names[:]
        uic.compileUiDir(dir, map=modname)

        # Parse those py_ui files for the class names
        file_classes = {}
        for file in file_names:
            with open(file,'rb') as fid:
                code = fid.read()
            file_classes[file] = parser.parse(code)

        # Create an init file filling it with import statements using the class
        # names that were parse above
        init_file = os.path.join(dir, "__init__.py")
        with open(init_file, "wb") as fid:
            fid.write("#This file is generated by BuildUiFiles.py")
            fid.write(os.linesep)
            for k, v in file_classes.items():
                file = os.path.split(k)[1]
                i_from = os.path.splitext(file)[0]
                print(i_from)
                for mod in v:
                    stmt = "from {} import {}".format(i_from, mod)
                    fid.write(stmt)
                    fid.write(os.linesep)
        py_compile.compile(init_file)

        # Compile the py_ui file and then remove the uncompiled versions unless
        # the dontremove flag was set.
        py_compile.main(file_names)
        if not("--dontremove" in argv):
            for k in file_names:
                os.remove(k)
Example #3
0
from PyQt4 import uic
import os

if __name__ == '__main__':

    for root, dirs, files in os.walk(os.path.dirname(
            os.path.dirname(__file__))):
        for f in files:
            if f.endswith('.ui'):
                print root
                uic.compileUiDir(root)
                break
    print "done"
Example #4
0
def main(folder):
    # pattern = "*.ui"
    # files = os.listdir(folder)
    # files_found = fnmatch.filter(files, pattern)
    uic.compileUiDir(folder, recurse=False, execute=True)
Example #5
0
from PyQt4 import uic
import os

if __name__ == '__main__':

    for root,dirs,files in os.walk(os.path.dirname(os.path.dirname(__file__))):
        for f in files:
            if f.endswith('.ui'):
                print root
                uic.compileUiDir(root)
                break
    print "done"
Example #6
0
def build_all_qt_ui(base_dir='.', from_imports=False):
    from PyQt4.uic import compileUiDir
    mapper = lambda d, f: (d, rem_file_ext(f) + '_ui.py')
    compileUiDir(base_dir, map=mapper, from_imports=from_imports)
Example #7
0
#!/usr/bin/python
import sys
import os
from PyQt4 import QtGui, uic  # importiamo i moduli necessari
from app import mainwindowCtr

if __name__ == "__main__":
    uic.compileUiDir("gui")
    app = QtGui.QApplication(sys.argv)
    myapp = mainwindowCtr.applicationForm()
    myapp.show()
    sys.exit(app.exec_())
Example #8
0
from __future__ import division

try:
    from PyQt4 import uic
except ImportError:
    pass
else:
    import libtbx.load_env

    ui_dir = libtbx.env.under_dist(module_name="crys3d", path="qttbx")
    print '  Processing *.ui files in "%s"' % ui_dir
    uic.compileUiDir(ui_dir, recurse=True)
Example #9
0
def compileUiFiles():
    """
    Compile the .ui files to Python sources.
    """
    compileUiDir(".", True, __pyName)
Example #10
0
#     out_file = '{0}'.format(ui_file)
    out_path = os.path.join(out_dir, out_file)
    file_names.append(out_path)
    return (out_dir, out_file)
    
if not hasattr(sys, '_MEIPASS'):
    parser = ClassParser()
    file_classes = {}

    # Create py files from ui files
    # file_names is passed around here as it is outside of each functions scope
    pth = os.path.split(__file__)[0]
    if not pth:
        pth = './'
    if [k for k in os.listdir(pth) if '.ui' in k]:
        uic.compileUiDir(pth, map=modname, execute=True)

    # Parse those py_ui files for the class names
    for File in file_names:
        with open(File, 'rb') as fid:
            code = fid.read()
        file_classes[File] = parser.parse(code)

    # Import the Classes
    # First split the file names to get the import modules then append those to the
    # package name in dot format. I the from list include the class names from the
    # AST parse above. Make the import into the local variable "_". Then move the
    # classes we want into the local name space with getattr.
    for File, k_list in file_classes.items():
        mod = os.path.splitext(os.path.split(File)[1])[0]
        import_stmt = "{}.{}".format(__package__, mod)
Example #11
0
import os
from PyQt4 import uic

uic.compileUiDir(os.path.dirname(__file__))
Example #12
0
#!/usr/bin/env python
# coding=utf-8

import os
import sys
import shutil
import glob

from PyQt4 import QtGui
from PyQt4.uic import compileUiDir

if getattr(sys, 'frozen', False):
    basedir = sys._MEIPASS
else:
    basedir = os.path.dirname(__file__)
    compileUiDir(os.path.join(basedir, 'audio/resources'))
    for file_ in glob.glob(os.path.join(basedir, 'audio/resources/*.py')):
        shutil.copy(file_, os.path.join(basedir, 'audio/ui'))
        if os.path.exists(file_):
            os.remove(file_)

from audio.ui.mainwindowform import MainWindow

__version__ = "1.0.0"


#     def updatestatus(self, message):
#         """
#
#         :param message:
#         """
Example #13
0
    def write_output(self, out_path, **kwargs):
        args = self.validate_arguments(kwargs, ["target_license", "version"])

        self.clear_output_dir(out_path)
        bolts_path = join(out_path, "BOLTS")

        #generate macro
        start_macro = open(join(out_path, "start_bolts.FCMacro"), "w")
        start_macro.write("import BOLTS\n")
        start_macro.write("BOLTS.show_widget()\n")
        start_macro.close()

        #copy files
        #bolttools
        if not license.is_combinable_with("LGPL 2.1+", args["target_license"]):
            raise IncompatibleLicenseError(
                "bolttools is LGPL 2.1+, which is not compatible with %s" %
                args["target_license"])
        copytree(join(self.repo.path, "bolttools"),
                 join(bolts_path, "bolttools"))
        #remove the test suite and documentation, to save space
        rmtree(join(bolts_path, "bolttools", "test_blt"))

        #generate version file
        date = datetime.now()
        version_file = open(join(bolts_path, "VERSION"), "w")
        version_file.write("%s\n%d-%d-%d\n%s\n" %
                           (args["version"], date.year, date.month, date.day,
                            args["target_license"]))
        version_file.close()

        #freecad gui code
        if not license.is_combinable_with("LGPL 2.1+", args["target_license"]):
            raise IncompatibleLicenseError(
                "FreeCAD gui files are LGPL 2.1+, which is not compatible with %s"
                % args["target_license"])
        if not exists(join(bolts_path, "freecad")):
            makedirs(join(bolts_path, "freecad"))
        if not exists(join(bolts_path, "data")):
            makedirs(join(bolts_path, "data"))
        open(join(bolts_path, "freecad", "__init__.py"), "w").close()

        copytree(join(self.repo.path, "backends", "freecad", "gui"),
                 join(bolts_path, "gui"))
        copytree(join(self.repo.path, "backends", "freecad", "assets"),
                 join(bolts_path, "assets"))
        copytree(join(self.repo.path, "icons"), join(bolts_path, "icons"))
        copyfile(join(self.repo.path, "backends", "freecad", "init.py"),
                 join(bolts_path, "__init__.py"))
        open(join(bolts_path, "gui", "__init__.py"), "w").close()

        #compile ui files
        uic.compileUiDir(join(bolts_path, "gui"))

        for coll, in self.repo.itercollections():
            if not license.is_combinable_with(coll.license_name,
                                              args["target_license"]):
                continue
            copy(join(self.repo.path, "data", "%s.blt" % coll.id),
                 join(bolts_path, "data", "%s.blt" % coll.id))

            if not exists(join(bolts_path, "freecad", coll.id)):
                makedirs(join(bolts_path, "freecad", coll.id))

            if not exists(
                    join(self.repo.path, "freecad", coll.id,
                         "%s.base" % coll.id)):
                continue

            copy(join(self.repo.path, "freecad", coll.id, "%s.base" % coll.id),
                 join(bolts_path, "freecad", coll.id, "%s.base" % coll.id))

            open(join(bolts_path, "freecad", coll.id, "__init__.py"),
                 "w").close()

            for base, in self.dbs["freecad"].iterbases(filter_collection=coll):
                if not base.license_name in license.LICENSES:
                    continue
                if not license.is_combinable_with(base.license_name,
                                                  args["target_license"]):
                    continue
                copy(
                    join(self.repo.path, "freecad", coll.id,
                         basename(base.filename)),
                    join(bolts_path, "freecad", coll.id,
                         basename(base.filename)))
Example #14
0
Created on Tue Jul 07 06:47:55 2015

@author: Mirko
"""
import os

# this does not work in  the console
os.chdir(os.path.dirname(__file__))
# this is for the console, comment if script is run
# os.chdir("C:/Users/Mirko/SkyDrive/python/locomotifGUI")
os.chdir("C:/User/thomas.sonstiges/GitHub/locomotifGUI")

# After a UI file was created using QtDesigner, this has to be translated into
# a python class. The PyQt4 modules has a uic submodule for compiling ui files.
from PyQt4 import uic
uic.compileUiDir("ui/")
# please save all ui files prefixed by Ui_, then all python classes will also 
# be prefixed by ui. these classes only create the window and another class
# located in the project root, not prefixed by ui can inherit this class in 
# order to draw the correct window.
uic.compileUiDir("tools/")
uic.compileUiDir("data/")
uic.compileUiDir("work/")
uic.compileUiDir("config/")
uic.compileUiDir("polyline/")
uic.compileUiDir("uicustom/")

#-----------------------------------------------------------------------------
# locomotif API 
#-----------------------------------------------------------------------------
Example #15
0
    def write_output(self, out_path, target_license, version, stable=False):

        self.clear_output_dir(out_path)
        bolts_path = join(out_path, "BOLTS")

        #generate macro
        start_macro = open(join(out_path, "start_bolts.FCMacro"), "w")
        start_macro.write("import BOLTS\n")
        start_macro.close()

        #copy files
        #bolttools
        if not license.is_combinable_with("LGPL 2.1+", target_license):
            raise IncompatibleLicenseError(
                "bolttools licensed under LGPL 2.1+, which is not compatible with %s"
                % target_license)
        copytree(join(self.repo.path, "bolttools"),
                 join(bolts_path, "bolttools"))
        #remove the .git file, because it confuses git
        remove(join(bolts_path, "bolttools", ".git"))
        #remove the test suite and documentation, to save space
        rmtree(join(bolts_path, "bolttools", "test"))
        rmtree(join(bolts_path, "bolttools", "doc"))

        #generate version file
        date = datetime.now()
        version_file = open(join(bolts_path, "VERSION"), "w")
        version_file.write(
            "%s\n%d-%d-%d\n%s\n" %
            (version, date.year, date.month, date.day, target_license))
        version_file.close()

        #freecad gui code
        if not license.is_combinable_with("LGPL 2.1+", target_license):
            raise IncompatibleLicenseError(
                "FreeCAD gui files are licensed under LGPL 2.1+, which is not compatible with %s"
                % target_license)
        if not exists(join(bolts_path, "freecad")):
            makedirs(join(bolts_path, "freecad"))
        if not exists(join(bolts_path, "data")):
            makedirs(join(bolts_path, "data"))
        open(join(bolts_path, "freecad", "__init__.py"), "w").close()

        copytree(join(self.repo.path, "backends", "freecad", "gui"),
                 join(bolts_path, "gui"))
        copytree(join(self.repo.path, "backends", "freecad", "assets"),
                 join(bolts_path, "assets"))
        copytree(join(self.repo.path, "icons"), join(bolts_path, "icons"))
        copyfile(join(self.repo.path, "backends", "freecad", "init.py"),
                 join(bolts_path, "__init__.py"))
        open(join(bolts_path, "gui", "__init__.py"), "w").close()

        #compile ui files
        uic.compileUiDir(join(bolts_path, "gui"))

        for coll in self.repo.collections:
            if not license.is_combinable_with(coll.license_name,
                                              target_license):
                continue
            copy(join(self.repo.path, "data", "%s.blt" % coll.id),
                 join(bolts_path, "data", "%s.blt" % coll.id))

            if not exists(join(bolts_path, "freecad", coll.id)):
                makedirs(join(bolts_path, "freecad", coll.id))

            if not exists(
                    join(self.repo.path, "freecad", coll.id,
                         "%s.base" % coll.id)):
                continue

            copy(join(self.repo.path, "freecad", coll.id, "%s.base" % coll.id),
                 join(bolts_path, "freecad", coll.id, "%s.base" % coll.id))

            open(join(bolts_path, "freecad", coll.id, "__init__.py"),
                 "w").close()

            for cl in coll.classes:
                base = self.freecad.getbase[cl.id]
                if not base.license_name in license.LICENSES:
                    continue
                if not license.is_combinable_with(base.license_name,
                                                  target_license):
                    continue
                copy(
                    join(self.repo.path, "freecad", coll.id,
                         basename(base.filename)),
                    join(bolts_path, "freecad", coll.id,
                         basename(base.filename)))
Example #16
0
#!/usr/bin/env python
import os
from os import path as osp
from PyQt4.uic import compileUiDir
    
PWD = osp.dirname(os.path.realpath(__file__))
ui_path = osp.join(osp.dirname(PWD), "ui")

#def convert_py_filename(ui_dir, ui_filename):
#    ''' convert name, foo.ui -> ui_foo.py '''
#    py_filename = "ui_%s.py" % ui_filename[:-3]
#    return ui_dir, py_filename

compileUiDir(ui_path)


Example #17
0
# keep one folder above .ui files
# TODO consider removing shell commands
from PyQt4 import uic
import os

cd = os.path.dirname(os.path.realpath(__file__))


def move(directory, file_name):
    return directory.replace(cd + "/UI", cd), file_name.replace("", "")


uic.compileUiDir(cd + "/UI", map=move)

# def rename_and_move_callable(directory, file_name):
#         return directory.replace("ui/", "widget/"), file_name.replace("Widget.py", ".py")
#
# uic.compileUiDir("ui/", map=rename_and_move_callable)
Example #18
0
def compileUiFiles():
    """
    Compile the .ui files to Python sources.
    """                                                 # __IGNORE_WARNING__
    try:
        from PyQt4.uic import compileUiDir
    except ImportError:
        from PyQt4.uic import compileUi
        
        def compileUiDir(dir, recurse=False,            # __IGNORE_WARNING__
                         map=None, **compileUi_args):
            """
            Creates Python modules from Qt Designer .ui files in a directory or
            directory tree.
            
            Note: This function is a modified version of the one found in
            PyQt4.

            @param dir Name of the directory to scan for files whose name ends
                with '.ui'. By default the generated Python module is created
                in the same directory ending with '.py'.
            @param recurse flag indicating that any sub-directories should be
                scanned.
            @param map an optional callable that is passed the name of the
                directory containing the '.ui' file and the name of the Python
                module that will be created. The callable should return a tuple
                of the name of the directory in which the Python module will be
                created and the (possibly modified) name of the module.
            @param compileUi_args any additional keyword arguments that are
                passed to the compileUi() function that is called to create
                each Python module.
            """
            def compile_ui(ui_dir, ui_file):
                """
                Local function to compile a single .ui file.
                
                @param ui_dir directory containing the .ui file (string)
                @param ui_file file name of the .ui file (string)
                """
                # Ignore if it doesn't seem to be a .ui file.
                if ui_file.endswith('.ui'):
                    py_dir = ui_dir
                    py_file = ui_file[:-3] + '.py'

                    # Allow the caller to change the name of the .py file or
                    # generate it in a different directory.
                    if map is not None:
                        py_dir, py_file = list(map(py_dir, py_file))

                    # Make sure the destination directory exists.
                    try:
                        os.makedirs(py_dir)
                    except:
                        pass

                    ui_path = os.path.join(ui_dir, ui_file)
                    py_path = os.path.join(py_dir, py_file)

                    ui_file = open(ui_path, 'r')
                    py_file = open(py_path, 'w')

                    try:
                        compileUi(ui_file, py_file, **compileUi_args)
                    finally:
                        ui_file.close()
                        py_file.close()

            if recurse:
                for root, _, files in os.walk(dir):
                    for ui in files:
                        compile_ui(root, ui)
            else:
                for ui in os.listdir(dir):
                    if os.path.isfile(os.path.join(dir, ui)):
                        compile_ui(dir, ui)
    
    def pyName(py_dir, py_file):
        """
        Local function to create the Python source file name for the compiled
        .ui file.
        
        @param py_dir suggested name of the directory (string)
        @param py_file suggested name for the compile source file (string)
        @return tuple of directory name (string) and source file name (string)
        """
        return py_dir, "Ui_{0}".format(py_file)
    
    compileUiDir(".", True, pyName, pyqt3_wrapper=True, )
Example #19
0
def compileUiFiles():
    """
    Compile the .ui files to Python sources.
    """
    compileUiDir(".", True, __pyName)
Example #20
0
data_files = []
for dp, dn, fs in os.walk(os.path.join(name, "icons")):
    temp=[]
    for f in fs:
        if f.endswith('.png'):
            temp.append(os.path.join(dp, f))
    data_files.append((os.path.join(prefix, dp), temp,))

'''
data_files.append(
        ("/usr/share/applications/",
         [os.path.join(name, "pyhomelib.desktop")]))
'''

compileUiDir(os.path.join(name,'ui'))
compile_qrc(os.path.join(name, 'resources','pyhomelib.qrc'), os.path.join(name, 'pyhomelib_rc.py'))

p = subprocess.Popen(['lrelease', os.path.join(name, 'locals', 'pyhomelib_ru.ts')])
p.wait()

setup(name='pyhomelib',
    #version = VERSION,
      description='fb2 collection manager',
      author='md2',
      author_email='',#TODO
      url='https://github.com/md2/pyhomelib',
      download_url = 'https://github.com/md2/pyhomelib',
      license='GPLv3',
      packages=find_packages(exclude=('pyhomelib')),
      data_files=data_files,
Example #21
0
# -*- coding: utf-8 -*-
#
# setup.py -
#
# Author: Paolo Olivo ([email protected])
#
# See the file LICENSE for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.

# --- Compile PyQt4 .ui files ---
import os.path
from PyQt4 import uic
uic.compileUiDir(os.path.join(os.path.dirname(__file__), "boing"), True)
# ---

from setuptools import setup, find_packages
import boing

long_desc = """Boing is a toolkit designed to support the development
of multi-touch and gesture enabled applications.

It enables to create pipelines for connecting different input sources to
multiple target destinations (e.g. applications, logs, etc.)  and
eventually process the data before being dispatched."""

kwargs = dict(
    name = "boing",
    version = boing.__version__,
    packages = find_packages(),
    entry_points = {"console_scripts": ["boing = boing.run"]},
    test_suite = "boing.test.run",
Example #22
0
	def write_output(self,out_path,target_license,version,stable=False):

		self.clear_output_dir(out_path)
		bolts_path = join(out_path,"BOLTS")

		#generate macro
		start_macro = open(join(out_path,"start_bolts.FCMacro"),"w")
		start_macro.write("import BOLTS\n")
		start_macro.write("BOLTS.show_widget()\n")
		start_macro.close()

		#copy files
		#bolttools
		if not license.is_combinable_with("LGPL 2.1+",target_license):
			raise IncompatibleLicenseError(
				"bolttools is LGPL 2.1+, which is not compatible with %s" % target_license)
		copytree(join(self.repo.path,"bolttools"),join(bolts_path,"bolttools"))
		#remove the test suite and documentation, to save space
		rmtree(join(bolts_path,"bolttools","test"))
		rmtree(join(bolts_path,"bolttools","doc"))

		#generate version file
		date = datetime.now()
		version_file = open(join(bolts_path,"VERSION"),"w")
		version_file.write("%s\n%d-%d-%d\n%s\n" %
			(version, date.year, date.month, date.day, target_license))
		version_file.close()

		#freecad gui code
		if not license.is_combinable_with("LGPL 2.1+",target_license):
			raise IncompatibleLicenseError(
				"FreeCAD gui files are LGPL 2.1+, which is not compatible with %s" % target_license)
		if not exists(join(bolts_path,"freecad")):
			makedirs(join(bolts_path,"freecad"))
		if not exists(join(bolts_path,"data")):
			makedirs(join(bolts_path,"data"))
		open(join(bolts_path,"freecad","__init__.py"),"w").close()

		copytree(join(self.repo.path,"backends","freecad","gui"),join(bolts_path,"gui"))
		copytree(join(self.repo.path,"backends","freecad","assets"),join(bolts_path,"assets"))
		copytree(join(self.repo.path,"icons"),join(bolts_path,"icons"))
		copyfile(join(self.repo.path,"backends","freecad","init.py"),join(bolts_path,"__init__.py"))
		open(join(bolts_path,"gui","__init__.py"),"w").close()

		#compile ui files
		uic.compileUiDir(join(bolts_path,"gui"))

		for coll in self.repo.collections:
			if not license.is_combinable_with(coll.license_name,target_license):
				continue
			copy(join(self.repo.path,"data","%s.blt" % coll.id),
				join(bolts_path,"data","%s.blt" % coll.id))

			if not exists(join(bolts_path,"freecad",coll.id)):
				makedirs(join(bolts_path,"freecad",coll.id))

			if not exists(join(self.repo.path,"freecad",coll.id,"%s.base" % coll.id)):
				continue

			copy(join(self.repo.path,"freecad",coll.id,"%s.base" % coll.id),
				join(bolts_path,"freecad",coll.id,"%s.base" % coll.id))

			open(join(bolts_path,"freecad",coll.id,"__init__.py"),"w").close()

			for cl in coll.classes:
				if not cl.id in self.freecad.getbase:
					continue
				base = self.freecad.getbase[cl.id]
				if not base.license_name in license.LICENSES:
					continue
				if not license.is_combinable_with(base.license_name,target_license):
					continue
				copy(join(self.repo.path,"freecad",coll.id,basename(base.filename)),
					join(bolts_path,"freecad",coll.id,basename(base.filename)))
Example #23
0
    out_path = os.path.join(out_dir, out_file)
    file_names.append(out_path)
    return (out_dir, out_file)


if not hasattr(sys, '_MEIPASS'):
    parser = ClassParser()
    file_classes = {}

    # Create py files from ui files
    # file_names is passed around here as it is outside of each functions scope
    pth = os.path.split(__file__)[0]
    if not pth:
        pth = './'
    if [k for k in os.listdir(pth) if '.ui' in k]:
        uic.compileUiDir(pth, map=modname, execute=True)

    # Parse those py_ui files for the class names
    for File in file_names:
        with open(File, 'rb') as fid:
            code = fid.read()
        file_classes[File] = parser.parse(code)

    # Import the Classes
    # First split the file names to get the import modules then append those to the
    # package name in dot format. I the from list include the class names from the
    # AST parse above. Make the import into the local variable "_". Then move the
    # classes we want into the local name space with getattr.
    for File, k_list in file_classes.items():
        mod = os.path.splitext(os.path.split(File)[1])[0]
        import_stmt = "{}.{}".format(__package__, mod)
Example #24
0
from __future__ import absolute_import, division, print_function
try:
    from PyQt4 import uic
except ImportError:
    pass
else:
    import libtbx.load_env
    ui_dir = libtbx.env.under_dist(module_name="crys3d", path="qttbx")
    print('  Processing *.ui files in "%s"' % ui_dir)
    try:
        # check in case PyQt4 looks for ucs2, our Python is built with ucs4
        uic.compileUiDir(ui_dir, recurse=True)
    except BaseException:
        pass
Example #25
0
Created on Tue Jul 07 06:47:55 2015

@author: Mirko
"""
import os

# this does not work in  the console
os.chdir(os.path.dirname(__file__))
# this is for the console, comment if script is run
# os.chdir("C:/Users/Mirko/SkyDrive/python/locomotifGUI")
os.chdir("C:/User/thomas.sonstiges/GitHub/locomotifGUI")

# After a UI file was created using QtDesigner, this has to be translated into
# a python class. The PyQt4 modules has a uic submodule for compiling ui files.
from PyQt4 import uic
uic.compileUiDir("ui/")
# please save all ui files prefixed by Ui_, then all python classes will also 
# be prefixed by ui. these classes only create the window and another class
# located in the project root, not prefixed by ui can inherit this class in 
# order to draw the correct window.

#-----------------------------------------------------------------------------
# locomotif API 
#-----------------------------------------------------------------------------

# es gibt verschiedene vordefinierte Vormate, die von locomitf einfach eingelesen
# werden können. hierfür sind die konfigurationen jeweils in einer Datei hinterlegt.
# unter angabe der Versionsnummer der verwendet GPS gerätes, werden diese Einstellungen
# von locomitf direkt geladen. 
# die funktion gibt die daten als richtig formattierten pandas.DataFrame zurück.
import locomotif as loc
Example #26
0
'''
Created on 22.09.2014

@author: kaiser
'''

from PyQt4 import uic

if __name__ == '__main__':
    print("Compiling UI files...")
    uic.compileUiDir(".")
    print("Done!")
Example #27
0
for dp, dn, fs in os.walk(os.path.join(name, "icons")):
    temp = []
    for f in fs:
        if f.endswith('.png'):
            temp.append(os.path.join(dp, f))
    data_files.append((
        os.path.join(prefix, dp),
        temp,
    ))
'''
data_files.append(
        ("/usr/share/applications/",
         [os.path.join(name, "pyhomelib.desktop")]))
'''

compileUiDir(os.path.join(name, 'ui'))
compile_qrc(os.path.join(name, 'resources', 'pyhomelib.qrc'),
            os.path.join(name, 'pyhomelib_rc.py'))

p = subprocess.Popen(
    ['lrelease', os.path.join(name, 'locals', 'pyhomelib_ru.ts')])
p.wait()

setup(
    name='pyhomelib',
    #version = VERSION,
    description='fb2 collection manager',
    author='md2',
    author_email='',  #TODO
    url='https://github.com/md2/pyhomelib',
    download_url='https://github.com/md2/pyhomelib',
Example #28
0
	def write_output(self,out_path,**kwargs):
		args = self.validate_arguments(kwargs,["target_license","version"])

		self.clear_output_dir(out_path)
		bolts_path = join(out_path,"BOLTS")

		#generate macro
		start_macro = open(join(out_path,"start_bolts.FCMacro"),"w")
		start_macro.write("import BOLTS\n")
		start_macro.write("BOLTS.show_widget()\n")
		start_macro.close()

		#copy files
		#bolttools
		if not license.is_combinable_with("LGPL 2.1+",args["target_license"]):
			raise IncompatibleLicenseError(
				"bolttools is LGPL 2.1+, which is not compatible with %s" % args["target_license"])
		copytree(join(self.repo.path,"bolttools"),join(bolts_path,"bolttools"))
		#remove the test suite and documentation, to save space
		rmtree(join(bolts_path,"bolttools","test_blt"))

		#generate version file
		date = datetime.now()
		version_file = open(join(bolts_path,"VERSION"),"w")
		version_file.write("%s\n%d-%d-%d\n%s\n" %
			(args["version"], date.year, date.month, date.day, args["target_license"]))
		version_file.close()

		#freecad gui code
		if not license.is_combinable_with("LGPL 2.1+",args["target_license"]):
			raise IncompatibleLicenseError(
				"FreeCAD gui files are LGPL 2.1+, which is not compatible with %s" % args["target_license"])
		if not exists(join(bolts_path,"freecad")):
			makedirs(join(bolts_path,"freecad"))
		if not exists(join(bolts_path,"data")):
			makedirs(join(bolts_path,"data"))
		open(join(bolts_path,"freecad","__init__.py"),"w").close()

		copytree(join(self.repo.path,"backends","freecad","gui"),join(bolts_path,"gui"))
		copytree(join(self.repo.path,"backends","freecad","assets"),join(bolts_path,"assets"))
		copytree(join(self.repo.path,"icons"),join(bolts_path,"icons"))
		copyfile(join(self.repo.path,"backends","freecad","init.py"),join(bolts_path,"__init__.py"))
		open(join(bolts_path,"gui","__init__.py"),"w").close()

		#compile ui files
		uic.compileUiDir(join(bolts_path,"gui"))

		for coll, in self.repo.itercollections():
			if not license.is_combinable_with(coll.license_name,args["target_license"]):
				continue
			copy(join(self.repo.path,"data","%s.blt" % coll.id),
				join(bolts_path,"data","%s.blt" % coll.id))

			if not exists(join(bolts_path,"freecad",coll.id)):
				makedirs(join(bolts_path,"freecad",coll.id))

			if not exists(join(self.repo.path,"freecad",coll.id,"%s.base" % coll.id)):
				continue

			copy(join(self.repo.path,"freecad",coll.id,"%s.base" % coll.id),
				join(bolts_path,"freecad",coll.id,"%s.base" % coll.id))

			open(join(bolts_path,"freecad",coll.id,"__init__.py"),"w").close()

			for base, in self.dbs["freecad"].iterbases(filter_collection=coll):
				if not base.license_name in license.LICENSES:
					continue
				if not license.is_combinable_with(base.license_name,args["target_license"]):
					continue
				copy(join(self.repo.path,"freecad",coll.id,basename(base.filename)),
					join(bolts_path,"freecad",coll.id,basename(base.filename)))
Example #29
0
#!/usr/bin/env python
import os
from os import path as osp
from PyQt4.uic import compileUiDir

PWD = osp.dirname(os.path.realpath(__file__))
ui_path = osp.join(osp.dirname(PWD), "ui")

#def convert_py_filename(ui_dir, ui_filename):
#    ''' convert name, foo.ui -> ui_foo.py '''
#    py_filename = "ui_%s.py" % ui_filename[:-3]
#    return ui_dir, py_filename

compileUiDir(ui_path)
Example #30
0
#! /usr/bin/env python
# Simple wrapper script which uses the PyQt4.uic module to compile
# all *.ui files in the current directory to Python code

import os

try:
    from PyQt4 import uic
    uic.compileUiDir(os.getcwd())
except Exception as e:
    print("Error compiling UI Files!")
    print(e)
    import traceback
    traceback.print_exc()
    exit(1)
else:
    print("Successfully updated *.ui -> *.py")
    exit(0)
Example #31
0
"""
Compiles PyQt UI templates found in SRC and places the corresponding compiled
Python modules in DEST. Output files have the same name, but have a `.py`
extension instead of `.ui`.
"""

import os
from PyQt4 import uic

SRC = '.'
DEST = '.'

if __name__ == '__main__':
    uic.compileUiDir(SRC, map=lambda src, name: (DEST, name))