Exemple #1
0
    def create(self):

        project = Project.get_by_code(self.project_code)
        if project:

            self.delete()

        print "Setting up a basic Sample3d project"

        # create the project
        create_cmd = CreateProjectCmd(project_code=self.project_code, project_title="Sample 3D") #, project_type="unittest")
        create_cmd.execute()

        # install the unittest plugin
        installer = PluginInstaller(relative_dir="TACTIC/internal/sample3d", verbose=False)
        installer.execute()

        # add 30 shots
        for x in xrange(30):
            shot = SearchType.create("prod/shot")
            shot.set_value('name','shot%s'%x)
            shot.set_value('sequence_code','SEQ_01')
            shot.commit(triggers=False)

        if not Search.eval("@SOBJECT(prod/sequence['code','SEQ_01'])"):
            seq = SearchType.create("prod/sequence")
            seq.set_value('code','SEQ_01')
            seq.commit(triggers=False)
Exemple #2
0
    def create(my):

        project = Project.get_by_code(my.project_code)
        if project:

            my.delete()

        print "Setting up a basic Sample3d project"

        # create the project
        create_cmd = CreateProjectCmd(
            project_code=my.project_code,
            project_title="Sample 3D")  #, project_type="unittest")
        create_cmd.execute()

        # install the unittest plugin
        installer = PluginInstaller(relative_dir="TACTIC/internal/sample3d",
                                    verbose=False)
        installer.execute()

        # add 30 shots
        for x in xrange(30):
            shot = SearchType.create("prod/shot")
            shot.set_value('name', 'shot%s' % x)
            shot.set_value('sequence_code', 'SEQ_01')
            shot.commit(triggers=False)

        seq = SearchType.create("prod/sequence")
        seq.set_value('code', 'SEQ_01')
        seq.commit(triggers=False)
Exemple #3
0
def import_schema(plugin_code):
    from pyasm.search import Transaction
    transaction = Transaction.get(create=True)

    install_dir = Environment.get_install_dir()
    base_dir = Environment.get_plugin_dir()
    template_dir = "%s/%s" % (base_dir, plugin_code)
    manifest_path = "%s/manifest.xml" % (template_dir)
    print "Reading manifest: ", manifest_path

    xml = Xml()
    xml.read_file(manifest_path)

    # create a new project
    installer = PluginInstaller(base_dir=base_dir, manifest=xml.to_string() )
    installer.execute()
Exemple #4
0
def import_schema(plugin_code):
    from pyasm.search import Transaction
    transaction = Transaction.get(create=True)

    install_dir = Environment.get_install_dir()
    base_dir = Environment.get_plugin_dir()
    template_dir = "%s/%s" % (base_dir, plugin_code)
    manifest_path = "%s/manifest.xml" % (template_dir)
    print "Reading manifest: ", manifest_path

    xml = Xml()
    xml.read_file(manifest_path)

    # create a new project
    installer = PluginInstaller(base_dir=base_dir, manifest=xml.to_string())
    installer.execute()
Exemple #5
0
    def create(self):

        project = Project.get_by_code(self.project_code)
        if project:

            self.delete()

        print "Setting up clean Unittest project"

        # create the project
        create_cmd = CreateProjectCmd(project_code=self.project_code, project_title="Unittest") #, project_type="unittest")
        create_cmd.execute()

        # install the unittest plugin
        installer = PluginInstaller(relative_dir="TACTIC/internal/unittest", verbose=False)
        installer.execute()
Exemple #6
0
    def create(my):

        project = Project.get_by_code(my.project_code)
        if project:

            my.delete()

        print "Setting up a basic Sample3d project"

        # create the project
        create_cmd = CreateProjectCmd(project_code=my.project_code, project_title="Sample 3D") #, project_type="unittest")
        create_cmd.execute()

        # install the unittest plugin
        installer = PluginInstaller(relative_dir="TACTIC/internal/sample3d", verbose=False)
        installer.execute()
Exemple #7
0
    def create(my):

        project = Project.get_by_code(my.project_code)
        if project:

            my.delete()

        print "Setting up clean Unittest project"

        # create the project
        create_cmd = CreateProjectCmd(project_code=my.project_code, project_title="Unittest") #, project_type="unittest")
        create_cmd.execute()

        # install the unittest plugin
        installer = PluginInstaller(relative_dir="TACTIC/internal/unittest", verbose=False)
        installer.execute()
Exemple #8
0
    def create_theme(my, theme):

        # get a built-in plugin
        plugin_base_dir = Environment.get_plugin_dir()
        zip_path = "%s/%s.zip" % (plugin_base_dir, theme)
        manifest_path = "%s/%s/manifest.xml" % (plugin_base_dir, theme)

        plugin_base_dir2 = Environment.get_builtin_plugin_dir()
        zip_path2 = "%s/%s.zip" % (plugin_base_dir2, theme)
        manifest_path2 = "%s/%s/manifest.xml" % (plugin_base_dir2, theme)

        # install the theme
        from tactic.command import PluginInstaller
        if os.path.exists(manifest_path):
            plugin_dir = "%s/%s" % (plugin_base_dir, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(zip_path):
            installer = PluginInstaller(zip_path=zip_path, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(manifest_path2):
            plugin_dir = "%s/%s" % (plugin_base_dir2, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = True
        elif os.path.exists(zip_path2):
            installer = PluginInstaller(zip_path=zip_path2, register=True)
            installer.execute()
            is_builtin = True
        else:
            raise Exception("Installation error: cannot find %s theme" % theme)

        from pyasm.biz import PluginUtil
        if is_builtin:
            plugin_util = PluginUtil(base_dir=plugin_base_dir2)
        else:
            plugin_util = PluginUtil()
        data = plugin_util.get_plugin_data(theme)

        # if the theme does not have the url defined (which it likely
        # shouldn't, but just in case ...
        search = Search("config/url")
        search.add_filter("url", "/index")
        url = search.get_sobject()
        if not url:

            index_view = data.get("index_view")
            if not index_view:
                # don't use the folder in the theme
                base = os.path.basename(theme)
                index_view = "%s/index" % base

            # set this as the default index
            search = SearchType.create("config/url")
            search.set_value("url", "/index")
            search.set_value(
                "widget", '''
<element name='index'>
  <display class='tactic.ui.panel.CustomLayoutWdg'>
    <view>%s</view>
  </display>
</element>
            ''' % index_view)
            search.set_value("description", "Index Page")
            search.commit()
    def create_theme(my, theme):

        # get a built-in plugin
        plugin_base_dir = Environment.get_plugin_dir()
        zip_path = "%s/%s.zip" % (plugin_base_dir, theme)
        manifest_path = "%s/%s/manifest.xml" % (plugin_base_dir, theme)

        plugin_base_dir2 = Environment.get_builtin_plugin_dir()
        zip_path2 = "%s/%s.zip" % (plugin_base_dir2, theme)
        manifest_path2 = "%s/%s/manifest.xml" % (plugin_base_dir2, theme)

        # install the theme
        from tactic.command import PluginInstaller

        if os.path.exists(manifest_path):
            plugin_dir = "%s/%s" % (plugin_base_dir, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(zip_path):
            installer = PluginInstaller(zip_path=zip_path, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(manifest_path2):
            plugin_dir = "%s/%s" % (plugin_base_dir2, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = True
        elif os.path.exists(zip_path2):
            installer = PluginInstaller(zip_path=zip_path2, register=True)
            installer.execute()
            is_builtin = True
        else:
            raise Exception("Installation error: cannot find %s theme" % theme)

        from pyasm.biz import PluginUtil

        if is_builtin:
            plugin_util = PluginUtil(base_dir=plugin_base_dir2)
        else:
            plugin_util = PluginUtil()
        data = plugin_util.get_plugin_data(theme)

        # if the theme does not have the url defined (which it likely
        # shouldn't, but just in case ...
        search = Search("config/url")
        search.add_filter("url", "/index")
        url = search.get_sobject()
        if not url:

            index_view = data.get("index_view")
            if not index_view:
                # don't use the folder in the theme
                base = os.path.basename(theme)
                index_view = "%s/index" % base

            # set this as the default index
            search = SearchType.create("config/url")
            search.set_value("url", "/index")
            search.set_value(
                "widget",
                """
<element name='index'>
  <display class='tactic.ui.panel.CustomLayoutWdg'>
    <view>%s</view>
  </display>
</element>
            """
                % index_view,
            )
            search.set_value("description", "Index Page")
            search.commit()