Exemplo n.º 1
0
def test_tom_create_database():

    root = "\\\\192.168.1.10\\tomsporer\\PROJECTS"

    # find all subfolders with an opicfg file
    subfolders = glob.glob(os.path.join(root, '*', '.opicfg'))
    folderNames = []
    for subfolder in subfolders:
        folderNames += [os.path.split(os.path.split(subfolder)[0])[1]]

    if len(folderNames) == 0:
        folderNames += ['']

    # next you need some templates to use, we'll just use the samples
    templateSource = os.path.join(
        os.path.split(
            os.path.split(os.path.split(os.path.abspath(__file__))[0])[0])[0],
        'templates')

    # ok - we are ready now to launch the data base. let's create one
    # and point it to our root
    db = OpiDB(root, templateRoot=templateSource, rootSubFolders=folderNames)

    projects = db.query('Project')

    for project in projects:
        print project.location
Exemplo n.º 2
0
    def execute(self):

        db = self.host.apis['db']
        opiDbRoot = os.environ['OPI_DATABASE_DIR']
        opiTemplateRoot = os.environ['OPI_TEMPLATE_DIR']
        opiProjects = db.query("project", sql="SELECT * FROM project")

        opiProjectLocations = []
        for p in opiProjects:
            opiProjectLocations.append(str(p.location))
        # print opiProjectLocations
        self.host.apis['db'] = OpiDB(opiDbRoot,
                                     templateRoot=opiTemplateRoot,
                                     rootSubFolders=opiProjectLocations)

        print "Refresh Database - Completed!"
Exemplo n.º 3
0
    def execute(self):

        db = self.host.apis['db']

        opiDbRoot = os.environ['OPI_DATABASE_DIR']
        opiTemplateRoot = os.environ['OPI_TEMPLATE_DIR']
        rootSubFolders = os.environ.get('OPI_DATABASE_SUBFOLDERS', '')
        rootSubFolders = rootSubFolders.split(os.pathsep)
        excludeRootSubFoldersSubFolders = os.environ.get(
            'OPI_DATABASE_EXLUDESUBFOLDERSSUBFOLDERS', None)

        self.host.apis['db'] = OpiDB(
            opiDbRoot,
            templateRoot=opiTemplateRoot,
            rootSubFolders=rootSubFolders,
            excludeRootSubFoldersSubFolders=excludeRootSubFoldersSubFolders)

        print "Refresh Database - Completed!"
Exemplo n.º 4
0
def test_tom_create_project():

  root = opi.getEmptyUnitTestFolder('test_tom_create_project')

  # next you need some templates to use, we'll just use the samples
  templateSource = os.path.join(os.path.split(os.path.split(os.path.split(os.path.abspath(__file__))[0])[0])[0], 'templates')

  # ok - we are ready now to launch the data base. let's create one
  # and point it to our root
  backend = peewee.SqliteDatabase(os.path.join(root, "test.db"))
  db = OpiDB(root, templateRoot=templateSource, backend=backend)

  project = db.createNew('Project', shorthand='PRO', name='ProjectX')
  task3D = db.createNew('Task', project=project, name='3D')
  taskComposite = db.createNew('Task', project=project, name='Composite')
  render = db.createNew('Render', project=project, name='test', version=1)
  beauty = db.createNew('Aov', render=render, name='beauty')

  print root
Exemplo n.º 5
0
    import os
    import opi
    from opi.client.database import DataBase as OpiDB
    from opi.tools.host import Host as OPIHost
    from opi.tools.workshop import WorkShop as OPIWorkShop
    from opi.ui.Qt import QtWidgets, QtCore

    path = os.path.split(os.path.abspath(__file__))[0]
    path = os.path.split(path)[0]
    path = os.path.split(path)[0]
    path = os.path.split(path)[0]

    dbRoot = "e:\\PROJECTS"

    templateRoot = os.path.join(path, 'OPI_Tools', 'templates')
    toolRoot = os.path.join(path, 'OPI_Tools', 'tools')

    db = OpiDB(dbRoot,
               templateRoot=templateRoot,
               rootSubFolders=['ROT_Rotkaeppchen', 'ROT_Rotkaeppchen_2'])

    host = OPIHost('python', {
        'db': db,
        'QtWidgets': QtWidgets,
        'QtCore': QtCore
    })
    workshop = OPIWorkShop(host, toolRoot)

    tool = workshop.instantiate(cmd='saveas')
    tool.invokeWithUI()
Exemplo n.º 6
0
    import opi
    from opi.client.database import DataBase as OpiDB
    from opi.tools.host import Host as OPIHost
    from opi.tools.workshop import WorkShop as OPIWorkShop
    from opi.ui.Qt import QtWidgets, QtCore

    filepath = os.path.abspath(__file__)

    dbRoot = "e:\\projects"

    path = os.path.split(filepath)[0]
    path = os.path.split(path)[0]
    os.environ["OPI_TOOL_DIR"] = path
    path = os.path.split(path)[0]
    path = os.path.split(path)[0]

    templateRoot = os.path.join(path, 'OPI_Tools', 'templates')
    toolRoot = os.path.join(path, 'OPI_Tools', 'tools')

    db = OpiDB(dbRoot, templateRoot=templateRoot, rootSubFolders=[''])

    host = OPIHost('python', {
        'db': db,
        'QtWidgets': QtWidgets,
        'QtCore': QtCore
    })
    workshop = OPIWorkShop(host, toolRoot)

    tool = workshop.instantiate(cmd='createproject')
    tool.invokeWithUI(active=False)