コード例 #1
0
ファイル: tab_wdg.py プロジェクト: zieglerm/TACTIC
    def __init__(self, dynamic_load=0, tab_key="tab", css=REG):

        self.tab_names = []
        self.wdg_dict = {}
        self.dynamic_load = dynamic_load
        self.set_tab_key(tab_key)
        self.tab_style = css
        self.content_height = 0

        self.mode = Container.get("tab_mode")

        # setting tab path
        self.tab_path = Container.get("tab_path")
        if not self.tab_path:
            self.tab_path = "Main"

        self.error_wdg = None
        self.div = DivWdg(css='left_content')

        if Environment.has_tactic_database():
            self.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
        else:
            self.invisible_list = []

        super(TabWdg, self).__init__()
コード例 #2
0
ファイル: tab_wdg.py プロジェクト: mincau/TACTIC
    def __init__(self, dynamic_load=0, tab_key="tab", css=REG):

        self.tab_names = []
        self.wdg_dict = {}
        self.dynamic_load = dynamic_load
        self.set_tab_key(tab_key)
        self.tab_style = css
        self.content_height = 0

        self.mode = Container.get("tab_mode")

        # setting tab path
        self.tab_path = Container.get("tab_path")
        if not self.tab_path:
            self.tab_path = "Main"

        self.error_wdg = None
        self.div = DivWdg(css='left_content')

        if Environment.has_tactic_database():
            self.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
        else:
            self.invisible_list = []

        super(TabWdg,self).__init__()
コード例 #3
0
ファイル: tab_wdg.py プロジェクト: 0-T-0/TACTIC
    def __init__(my, dynamic_load=0, tab_key="tab", css=REG):

        my.tab_names = []
        my.wdg_dict = {}
        my.dynamic_load = dynamic_load
        my.set_tab_key(tab_key)
        my.tab_style = css
        my.content_height = 0

        my.mode = Container.get("tab_mode")

        # setting tab path
        my.tab_path = Container.get("tab_path")
        if not my.tab_path:
            my.tab_path = "Main"

        my.error_wdg = None
        my.div = DivWdg(css='left_content')

        if Environment.has_tactic_database():
            my.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
        else:
            my.invisible_list = []

        super(TabWdg,my).__init__()
コード例 #4
0
ファイル: tab_wdg.py プロジェクト: rajubuddha/TACTIC
    def __init__(my, dynamic_load=0, tab_key="tab", css=REG):

        my.tab_names = []
        my.wdg_dict = {}
        my.dynamic_load = dynamic_load
        my.set_tab_key(tab_key)
        my.tab_style = css
        my.content_height = 0

        my.mode = Container.get("tab_mode")

        # setting tab path
        my.tab_path = Container.get("tab_path")
        if not my.tab_path:
            my.tab_path = "Main"

        my.error_wdg = None
        my.div = DivWdg(css='left_content')

        if Environment.has_tactic_database():
            my.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
        else:
            my.invisible_list = []

        super(TabWdg, my).__init__()
コード例 #5
0
    def add_behavior(my, bvr_spec):
        '''adds an individual behavior specification to the HTML based widget'''
        #print "bvr: ", str(bvr_spec).replace(r"\n", "\n")
        #print "---"
        if my.behaviors == None:
            my.behaviors = []

        if type(bvr_spec) == types.DictType:
            # handle any cbjs string value that has newlines (e.g. ones specified using triple single quote block
            # quotes in order to have the javascript code readable as indented multi-line code) ...
            regex = re.compile( r'\n\s*' )

            if my.__class__.__name__.find('CheckboxWdg') != -1:
                if bvr_spec.get('propagate_evt') == None:
                    bvr_spec['propagate_evt'] = True

            script_path = bvr_spec.get('cbjs_script_path')
            if script_path:
                script_sobj = Container.get("HTML::custom_script")
                if script_sobj == None:
                    basename = os.path.basename(script_path)
                    dirname = os.path.dirname(script_path)
                    search = Search("config/custom_script")
                    search.add_filter("folder", dirname)
                    search.add_filter("title", basename)
                    script_sobj = search.get_sobject()
                if script_sobj:
                    Container.put("HTML::custom_script", script_sobj)
                    v = script_sobj.get_value("script")
                    bvr_spec['cbjs_action'] = regex.sub( '\n', v )

                else:
                    raise Exception( "Error: script path [%s] does not exist" % script_path )
                    

            for k,v in bvr_spec.iteritems():
                if 'cbjs' in k and '\n' in v:
                    bvr_spec[k] = regex.sub( '\n', v )
            my.behaviors.append( bvr_spec )
        elif type(bvr_spec) == types.StringType:
            # legacy support for any '.add_behavior' calls that provide a bvr_spec argument that is a string
            # representation of a behavior specification dictionary
            my.behaviors.append( my.convert_behavior_str(bvr_spec) )
        else:
            raise Exception( "Behavior specification should be a dictionary, %s spec is not supported." %
                             type(bvr_spec) )

        count = Container.get("Widget:bvr_count")
        if not count:
            count = 1
        else:
            count += 1
        Container.put("Widget:bvr_count", count)
コード例 #6
0
 def push_palette(cls, palette):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     palette = Palette(palette=palette)
     palettes.append(palette)
コード例 #7
0
    def get_action_html(my):
        from pyasm.prod.site import EditorialTabWdg, MainTabWdg, ClientTabWdg

        #edit = SubmitWdg("do_edit", "Submit/Next" )
        edit_continue = SubmitWdg("do_edit", "Submit/Close")
        edit_continue.add_event("onclick",
                                "document.form.%s.value='true'" % my.CLOSE_WDG)

        # call an edit event
        #event = WebContainer.get_event("sthpw:submit")
        #edit.add_event( "onclick", event.get_caller() )

        # create a cancel button to close the window
        cancel = ButtonWdg("Cancel")
        iframe = Container.get("iframe")
        cancel.add_event("onclick",
                         "window.parent.%s" % iframe.get_off_script())

        div = DivWdg(css='centered')

        div.center()
        #div.add(SpanWdg(edit, css='med'))
        div.add(SpanWdg(edit_continue, css='med'))
        div.add(SpanWdg(cancel, css='med'))

        return div
コード例 #8
0
ファイル: cache.py プロジェクト: mincau/TACTIC
 def get():
     key = 'CacheList'
     cache_list = Container.get(key)
     if not cache_list:
         cache_list = CacheList()
         Container.put(key, cache_list)
     return cache_list
コード例 #9
0
ファイル: frame_info_wdg.py プロジェクト: nuxping/TACTIC
    def get_display(my):

        sobject = my.get_current_sobject()

        widget_class = my.get_option("class")

        if widget_class == '':
            raise WidgetException("No widget class defined")

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", widget_class)
        url.set_option("search_key", sobject.get_search_key())

        ref = url.get_url()

        iframe = Container.get("iframe")
        iframe.set_width(90)
        action = iframe.get_on_script(ref)

        info_type = my.get_option("info_type")

        button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
        button.add_event("onclick", "%s" % (action))
        button.add_style("margin: 3px 5px")

        return button
コード例 #10
0
    def get_display(my):

        # assert my.search is not None

        # search_type_obj = my.search.get_search_type_obj()
        search_key = my.sobject.get_search_key()

        title = my.sobject.get_code()

        upload_url = WebContainer.get_web().get_widget_url()
        upload_url.set_option("widget", "pyasm.prod.web.SObjectUploadWdg")
        upload_url.set_option("search_key", search_key)
        # upload_url.set_option("mode", "copy")
        upload_url.set_option("naming", "no")
        for name, value in my.upload_options.items():
            upload_url.set_option(name, value)

        # get the main iframe
        iframe = Container.get("iframe")
        iframe.set_width(65)
        upload_action = iframe.get_on_script(upload_url.get_url())

        # upload button
        upload_button = IconButtonWdg("file publish %s" % title, IconWdg.UPLOAD)
        upload_button.add_event("onclick", upload_action)

        my.add(upload_button, "upload_button")

        return super(SObjectFilePublishWdg, my).get_display()
コード例 #11
0
ファイル: sql_test.py プロジェクト: zieglerm/TACTIC
    def _test_add_drop_column(self):
        #Project.set_project('unittest')
        from pyasm.command import ColumnAddCmd, ColumnDropCmd, Command
        cmd = ColumnAddCmd('unittest/country', 'special_place', 'varchar(256)')
        Command.execute_cmd(cmd)
        search_type = 'unittest/country'

        # clear cache

        SearchType.clear_column_cache(search_type)

        DatabaseImpl.clear_table_cache()
        exists = SearchType.column_exists(search_type, 'special_place')
        self.assertEquals(exists, True)

        # now drop the column
        cmd = ColumnDropCmd(search_type, 'special_place')
        Command.execute_cmd(cmd)

        # clear cache
        SearchType.clear_column_cache(search_type)
        cache_dict = Container.get("DatabaseImpl:column_info")

        # assume database is the same as sthpw
        database_type = Project.get_by_code("unittest").get_database_type()
        db_resource = DbResource.get_default('unittest')
        table_info = cache_dict.get("%s:%s" % (db_resource, "country"))
        self.assertEquals(table_info == None, True)

        key = "%s:%s" % (db_resource, "country")
        cache_dict[key] = None
        exists = SearchType.column_exists(search_type, 'special_place')
        self.assertEquals(exists, False)
コード例 #12
0
ファイル: preference.py プロジェクト: 0-T-0/TACTIC
    def get_by_key(cls, key, user=None, project_code=None, use_cache=True):
      
        if not user:
            user = Environment.get_user_name()

        # ignore the project_code column for now
        dict_key = '%s:%s:%s' %(cls.SEARCH_TYPE, project_code, user) 
        if use_cache:
            settings_dict = Container.get(dict_key)
        else:
            settings_dict = None

        # explicit check for None
        if settings_dict == None:
            settings_dict = {}

            if use_cache:
                Container.put(dict_key, settings_dict)

            search = Search(cls.SEARCH_TYPE)
            search.add_filter("login", user)
            if project_code:
                search.add_filter("project_code", project_code)
            else:
                search.add_null_filter("project_code")
            # don't filter with the key in order to build a dict
            pref_settings = search.get_sobjects()
            for setting in pref_settings:
                settings_dict[setting.get_value('key')] = setting

        pref_setting = settings_dict.get(key)

        return pref_setting
コード例 #13
0
ファイル: sobject_connection.py プロジェクト: zieglerm/TACTIC
    def get_connections(cls,
                        sobjects,
                        direction="dst",
                        context='',
                        context_filters=[],
                        src_search=None):
        '''return a Search instance if src_search is provided'''
        if not sobjects and not src_search:
            return []
        search = Search(SObjectConnection)

        if direction == "dst":
            prefix = "src"
        else:
            prefix = "dst"

        if src_search:
            search.add_filter("%s_search_type" % prefix,
                              src_search.get_search_type())
            search.add_search_filter('%s_search_id' % prefix,
                                     src_search,
                                     op="in")
        else:
            search_types = [x.get_search_type() for x in sobjects]
            search_ids = [x.get_id() for x in sobjects]

            if len(Common.get_unique_list(search_types)) == 1:
                search.add_filter("%s_search_type" % prefix, search_types[0])
                search.add_filters("%s_search_id" % prefix, search_ids)
            else:
                search.add_op("begin")
                for search_type, search_id in zip(search_types, search_ids):
                    search.add_op("begin")
                    search.add_filter("%s_search_type" % prefix, search_type)
                    search.add_filter("%s_search_id" % prefix, search_id)
                    search.add_op("and")
                search.add_op("or")

        if context:
            search.add_filter("context", context)
        elif context_filters:
            search.add_op_filters(context_filters)

        if src_search:
            return search

# cache for connection sobjects
        key = search.get_statement()
        cache = Container.get("SObjectConnection:cache")
        if cache == None:
            cache = {}
            Container.put("SObjectConnection:cache", cache)

        ret_val = cache.get(key)
        if ret_val != None:
            return ret_val

        connections = search.get_sobjects()

        return connections
コード例 #14
0
    def set_pipeline(my, pipeline_xml, cache=True):
        '''set the pipeline externally'''
        # cache according to pipeline code, which will share the same xml object
        if my.is_insert():
            cache = False

        search_key = my.get_search_key()

        xml_dict = Container.get("Pipeline:xml")

        if xml_dict == None:
            xml_dict = {}
            Container.put("Pipeline:xml", xml_dict)

        my.xml = xml_dict.get(search_key)

        if my.xml == None:
            my.xml = Xml()
            if cache:
                xml_dict[search_key] = my.xml

            if not pipeline_xml:
                pipeline_xml = "<pipeline/>"

            try:
                my.xml.read_string(pipeline_xml)
            except XmlException, e:
                my.xml.read_string("<pipeline/>")
コード例 #15
0
ファイル: web_state.py プロジェクト: zieglerm/TACTIC
 def get():
     # try getting from the web from
     state = Container.get("WebState")
     if not state:
         state = WebState()
         Container.put("WebState", state)
     return state
コード例 #16
0
ファイル: dynamic_loader_page.py プロジェクト: 0-T-0/TACTIC
    def __init__(my, buffer_id=None, display_id=None):
        super(DynamicLoaderWdg,my).__init__()

        ref_count = Container.get("DyanmicLoaderWdg:ref_count")
        if ref_count is None:
            ref_count = 0

        if display_id is None:
            my.display_id = "dynamic_display_%s" % ref_count
        else:
            my.display_id = display_id

        if buffer_id is None:
            my.buffer_id = "dynamic_buffer_%s" % ref_count
        else:
            my.buffer_id = buffer_id

        my.loader_id = "dynamic_loader_%s" % ref_count


        Container.put("DyanmicLoaderWdg:ref_count", ref_count + 1 )


        my.load_class = None
        my.load_args = None

        web = WebContainer.get_web()
        my.loader_url = web.get_dynamic_loader_url()
コード例 #17
0
ファイル: loader_element_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_process(my):
        '''Get from the ProcessFilterWdg in SObjectLoadWdg,
            otherwise get from FilterData'''

        process = ''

        # Ususally there is no pipeline defined for prod/shot_instance
        # so get from prod/shot
        search_type = my.search_type
        if search_type =='prod/shot_instance':
            search_type = 'prod/shot'

        state = Container.get("global_state")
        if state:
            process = state.get('process')
        else:
            
            # get it from FilterData
            data = FilterData.get()
            values = data.get_values_by_prefix('view_action_option')
            if values:
                process = values[0].get('load_%s_process' %search_type)

        if not process:
            from pyasm.prod.web import ProcessFilterWdg
            process_filter = ProcessFilterWdg(None, search_type)
            process = process_filter.get_value()
        return process
コード例 #18
0
 def get():
     key = 'CacheList'
     cache_list = Container.get(key)
     if not cache_list:
         cache_list = CacheList()
         Container.put(key, cache_list)
     return cache_list
コード例 #19
0
    def get_process(my):
        '''Get from the ProcessFilterWdg in SObjectLoadWdg,
            otherwise get from FilterData'''

        process = ''

        # Ususally there is no pipeline defined for prod/shot_instance
        # so get from prod/shot
        search_type = my.search_type
        if search_type == 'prod/shot_instance':
            search_type = 'prod/shot'

        state = Container.get("global_state")
        if state:
            process = state.get('process')
        else:

            # get it from FilterData
            data = FilterData.get()
            values = data.get_values_by_prefix('view_action_option')
            if values:
                process = values[0].get('load_%s_process' % search_type)

        if not process:
            from pyasm.prod.web import ProcessFilterWdg
            process_filter = ProcessFilterWdg(None, search_type)
            process = process_filter.get_value()
        return process
コード例 #20
0
ファイル: maya_tab_wdg.py プロジェクト: 0-T-0/TACTIC
    def init(my):

        help = HelpItemWdg('Loader', 'The Loader lets you load 3D assets into your 3D applications. Among many options, you can choose to either reference, import, or open the asset through http or the internal file system.')
        my.add(help)

        pref = PrefSetting.get_value_by_key("use_java_maya")
        app = WebContainer.get_web().get_app_name_by_uri()
        
        if app == "Maya":
            if not Container.get('GeneralAppletWdg'):
                my.add( GeneralAppletWdg() )
                Container.put('GeneralAppletWdg', True)
        site_menu = SiteMenuWdg()
        site_menu.add_style("float", "right")
        site_menu.add_style("margin-top", "-2px")
        my.add(site_menu)
        
        WebContainer.add_js('MayaWebTools.js')
        WebContainer.add_js('PyMaya.js')
        
        tab = MayaTabWdgImpl()
        tab_value = tab.set_tab_key("maya_tab")
        #my.handle_tab(tab)
        #my.add(tab,"tab")
        my.setup_tab("maya_tab", tab=tab)
        my.add( ProgressWdg() )
コード例 #21
0
ファイル: web_state.py プロジェクト: 0-T-0/TACTIC
 def get():
     # try getting from the web from
     state = Container.get("WebState")
     if not state:
         state = WebState()
         Container.put("WebState", state)
     return state
コード例 #22
0
ファイル: project.py プロジェクト: hellios78/TACTIC
 def get_resource(my):
     key = "Project:resource:%s" % my
     resource = Container.get(key)
     if resource == None:
         resource = ProjectResource(my)
         Container.put(key, resource)
     return resource
コード例 #23
0
ファイル: frame_info_wdg.py プロジェクト: 0-T-0/TACTIC
    def get_display(my):

        sobject = my.get_current_sobject()

        widget_class = my.get_option("class")
        
        if widget_class == '':
            raise WidgetException("No widget class defined")

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", widget_class)
        url.set_option("search_key", sobject.get_search_key())

        ref = url.get_url()

        iframe = Container.get("iframe")
        iframe.set_width(90)
        action = iframe.get_on_script(ref)

        info_type = my.get_option("info_type")
        
        button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
        button.add_event("onclick", "%s" % (action) )
        button.add_style("margin: 3px 5px")

        return button
コード例 #24
0
ファイル: filter_data.py プロジェクト: mincau/TACTIC
    def __init__(self, data=[]):

        if not data:
            self.data = []
        elif type(data) in types.StringTypes:
            try:
                # optimize the loading of json data
                json_data = Container.get("json_data")
                if json_data == None:
                    json_data = {}
                    Container.put("json_data", json_data)

                self.data = json_data.get(data)
                if self.data == None:
                    self.data = jsonloads(data)
                    json_data[data] = self.data

            except ValueError, e:
                if e.__str__().find('No JSON object') != -1:
                    raise SetupException('Data is not decodable as JSON.')
                # try a straight eval
                self.data = eval(data)

            except Exception as e:
                 if e.__str__().find('cannot parse JSON description') != -1:
                    raise SetupException('Data is not valid JSON.')
コード例 #25
0
ファイル: project.py プロジェクト: davidsouthpaw/TACTIC
 def get_global_project_code(cls):
     PROJECT_KEY = "Project:global"
     project_code = Container.get(PROJECT_KEY)
     if not project_code:
         project_code = "admin"
         Project.set_global_project_code(project_code)
     return project_code
コード例 #26
0
ファイル: pipeline.py プロジェクト: 0-T-0/TACTIC
    def set_pipeline(my, pipeline_xml, cache=True):
        '''set the pipeline externally'''
        # cache according to pipeline code, which will share the same xml object
        if my.is_insert():
            cache = False

        search_key = my.get_search_key()

        xml_dict = Container.get("Pipeline:xml")
            
        if xml_dict == None:
            xml_dict = {}
            Container.put("Pipeline:xml", xml_dict)

        my.xml = xml_dict.get(search_key)
        
        if my.xml == None:
            my.xml = Xml()
            if cache:
                xml_dict[search_key] = my.xml

            if not pipeline_xml:
                pipeline_xml = "<pipeline/>"

            try:
                my.xml.read_string(pipeline_xml)
            except XmlException, e:
                my.xml.read_string("<pipeline/>")
コード例 #27
0
ファイル: sql_test.py プロジェクト: 0-T-0/TACTIC
    def _test_add_drop_column(my):
        #Project.set_project('unittest')
        from pyasm.command import ColumnAddCmd, ColumnDropCmd, Command
        cmd = ColumnAddCmd('unittest/country','special_place','varchar(256)')
        Command.execute_cmd(cmd)
        search_type = 'unittest/country'

        # clear cache
       
        SearchType.clear_column_cache(search_type)

        DatabaseImpl.clear_table_cache()
        exists = SearchType.column_exists(search_type, 'special_place')
        my.assertEquals(exists, True)

        # now drop the column
        cmd = ColumnDropCmd(search_type,'special_place')
        Command.execute_cmd(cmd)

        # clear cache
        SearchType.clear_column_cache(search_type)
        cache_dict = Container.get("DatabaseImpl:column_info")

       
        # assume database is the same as sthpw
        database_type = Project.get_by_code("unittest").get_database_type()
        db_resource = DbResource.get_default('unittest')
        table_info = cache_dict.get("%s:%s" % (db_resource, "country"))
        my.assertEquals(table_info == None, True)


        key = "%s:%s" % (db_resource, "country")
        cache_dict[key] = None
        exists = SearchType.column_exists(search_type, 'special_place')
        my.assertEquals(exists, False)
コード例 #28
0
    def get_display(my):
        
        #assert my.search is not None
        
        #search_type_obj = my.search.get_search_type_obj()
        search_key = my.sobject.get_search_key()

        title = my.sobject.get_code()

        upload_url = WebContainer.get_web().get_widget_url()
        upload_url.set_option("widget", "pyasm.prod.web.SObjectUploadWdg")
        upload_url.set_option("search_key", search_key)
        #upload_url.set_option("mode", "copy")
        upload_url.set_option("naming", "no")
        for name, value in my.upload_options.items():
            upload_url.set_option(name,value)

       
        # get the main iframe
        iframe = Container.get("iframe")
        iframe.set_width(65)
        upload_action = iframe.get_on_script(upload_url.get_url())

        # upload button
        upload_button = IconButtonWdg("file publish %s" % title, IconWdg.UPLOAD)
        upload_button.add_event("onclick", upload_action )
    
        my.add(upload_button, "upload_button")
        
        return super(SObjectFilePublishWdg,my).get_display()    
コード例 #29
0
ファイル: project.py プロジェクト: hellios78/TACTIC
 def get_global_project_code(cls):
     PROJECT_KEY = "Project:global"
     project_code = Container.get(PROJECT_KEY)
     if not project_code:
         project_code = "admin"
         Project.set_global_project_code(project_code)
     return project_code
コード例 #30
0
ファイル: js_wrapper.py プロジェクト: nuxping/TACTIC
 def get():
     key = "JsWrapper"
     wrapper = Container.get(key)
     if wrapper == None:
         wrapper = JsWrapper()
         Container.put(key, wrapper)
     return wrapper
コード例 #31
0
 def get():
     key = "JsWrapper"
     wrapper = Container.get(key)
     if wrapper == None:
         wrapper = JsWrapper()
         Container.put(key, wrapper)
     return wrapper
コード例 #32
0
    def __init__(my, buffer_id=None, display_id=None):
        super(DynamicLoaderWdg, my).__init__()

        ref_count = Container.get("DyanmicLoaderWdg:ref_count")
        if ref_count is None:
            ref_count = 0

        if display_id is None:
            my.display_id = "dynamic_display_%s" % ref_count
        else:
            my.display_id = display_id

        if buffer_id is None:
            my.buffer_id = "dynamic_buffer_%s" % ref_count
        else:
            my.buffer_id = buffer_id

        my.loader_id = "dynamic_loader_%s" % ref_count

        Container.put("DyanmicLoaderWdg:ref_count", ref_count + 1)

        my.load_class = None
        my.load_args = None

        web = WebContainer.get_web()
        my.loader_url = web.get_dynamic_loader_url()
コード例 #33
0
    def init(self):

        help = HelpItemWdg(
            'Loader',
            'The Loader lets you load 3D assets into your 3D applications. Among many options, you can choose to either reference, import, or open the asset through http or the internal file system.'
        )
        self.add(help)

        pref = PrefSetting.get_value_by_key("use_java_maya")
        app = WebContainer.get_web().get_app_name_by_uri()

        if app == "Maya":
            if not Container.get('GeneralAppletWdg'):
                self.add(GeneralAppletWdg())
                Container.put('GeneralAppletWdg', True)
        site_menu = SiteMenuWdg()
        site_menu.add_style("float", "right")
        site_menu.add_style("margin-top", "-2px")
        self.add(site_menu)

        WebContainer.add_js('MayaWebTools.js')
        WebContainer.add_js('PyMaya.js')

        tab = MayaTabWdgImpl()
        tab_value = tab.set_tab_key("maya_tab")
        #self.handle_tab(tab)
        #self.add(tab,"tab")
        self.setup_tab("maya_tab", tab=tab)
        self.add(ProgressWdg())
コード例 #34
0
ファイル: palette.py プロジェクト: 2gDigitalPost/tactic_src
 def push_palette(cls, palette):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     palette = Palette(palette=palette)
     palettes.append(palette)
コード例 #35
0
    def get_by_key(cls, key, user=None, project_code=None, use_cache=True):

        if not user:
            user = Environment.get_user_name()

        # ignore the project_code column for now
        dict_key = '%s:%s:%s' % (cls.SEARCH_TYPE, project_code, user)
        if use_cache:
            settings_dict = Container.get(dict_key)
        else:
            settings_dict = None

        # explicit check for None
        if settings_dict == None:
            settings_dict = {}

            if use_cache:
                Container.put(dict_key, settings_dict)

            search = Search(cls.SEARCH_TYPE)
            search.add_filter("login", user)
            if project_code:
                search.add_filter("project_code", project_code)
            else:
                search.add_null_filter("project_code")
            # don't filter with the key in order to build a dict
            pref_settings = search.get_sobjects()
            for setting in pref_settings:
                settings_dict[setting.get_value('key')] = setting

        pref_setting = settings_dict.get(key)

        return pref_setting
コード例 #36
0
ファイル: submission_wdg.py プロジェクト: mincau/TACTIC
    def get_action_html(self):
        from pyasm.prod.site import EditorialTabWdg, MainTabWdg, ClientTabWdg

        #edit = SubmitWdg("do_edit", "Submit/Next" )
        edit_continue = SubmitWdg("do_edit", "Submit/Close" )
        edit_continue.add_event("onclick", "document.form.%s.value='true'"%self.CLOSE_WDG) 
        
        # call an edit event
        #event = WebContainer.get_event("sthpw:submit")
        #edit.add_event( "onclick", event.get_caller() )
        

        # create a cancel button to close the window
        cancel = ButtonWdg("Cancel")
        iframe = Container.get("iframe")
        cancel.add_event("onclick", "window.parent.%s" % iframe.get_off_script() )

        div = DivWdg(css='centered')
        
        div.center()
        #div.add(SpanWdg(edit, css='med'))
        div.add(SpanWdg(edit_continue, css='med'))
        div.add(SpanWdg(cancel, css='med'))

        return div
コード例 #37
0
ファイル: project.py プロジェクト: davidsouthpaw/TACTIC
 def get_resource(my):
     key = "Project:resource:%s" % my
     resource = Container.get(key)
     if resource == None:
         resource = ProjectResource(my)
         Container.put(key, resource)
     return resource
コード例 #38
0
    def __init__(my, data=[]):

        if not data:
            my.data = []
        elif type(data) in types.StringTypes:
            try:
                # optimize the loading of json data
                json_data = Container.get("json_data")
                if json_data == None:
                    json_data = {}
                    Container.put("json_data", json_data)

                my.data = json_data.get(data)
                if my.data == None:
                    my.data = jsonloads(data)
                    json_data[data] = my.data

            except ValueError, e:
                if e.__str__().find('No JSON object') != -1:
                    raise SetupException('Data is not decodable as JSON.')
                # try a straight eval
                my.data = eval(data)

            except Exception, e:
                if e.__str__().find('cannot parse JSON description') != -1:
                    raise SetupException('Data is not valid JSON.')
コード例 #39
0
ファイル: composite_wdg.py プロジェクト: mincau/TACTIC
    def get_title(self):
        widget = Widget()

        if not Container.get('GeneralAppletWdg'):
            widget.add( GeneralAppletWdg() )
            Container.put('GeneralAppletWdg', True)
        widget.add(super(LayerTableElementWdg, self).get_title())
        return widget
コード例 #40
0
    def get_title(self):
        widget = Widget()

        if not Container.get('GeneralAppletWdg'):
            widget.add(GeneralAppletWdg())
            Container.put('GeneralAppletWdg', True)
        widget.add(super(LayerTableElementWdg, self).get_title())
        return widget
コード例 #41
0
 def pop_palette(cls):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     if len(palettes) == 0:
         return palettes[0]
     return palettes.pop()
コード例 #42
0
 def get(cls):
     filter_data = Container.get("FilterData")
     if filter_data == None:
         web = WebContainer.get_web()
         data = web.get_form_value('json')
         filter_data = FilterData(data)
         Container.put("FilterData", filter_data)
     return filter_data
コード例 #43
0
ファイル: filter_data.py プロジェクト: mincau/TACTIC
 def get(cls):
     filter_data = Container.get("FilterData")
     if filter_data == None:
         web = WebContainer.get_web()
         data = web.get_form_value('json')
         filter_data = FilterData(data)
         Container.put("FilterData", filter_data)
     return filter_data
コード例 #44
0
ファイル: palette.py プロジェクト: 2gDigitalPost/tactic_src
 def pop_palette(cls):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     if len(palettes) == 0:
         return palettes[0]
     return palettes.pop()
コード例 #45
0
 def get_context(self):
     context_select = Container.get('context_filter')
     context = 'publish'
     if context_select:
         context = context_select.get_value()
     if context == "":
         values = context_select.get_option('values')
         context = values[len(values) - 1]
     return context
コード例 #46
0
ファイル: project.py プロジェクト: 0-T-0/TACTIC
 def get_global_project_code(cls):
     from pyasm.security import Site
     site = Site.get_site()
     PROJECT_KEY = "Project:global:%s:" % site
     project_code = Container.get(PROJECT_KEY)
     if not project_code:
         project_code = "admin"
         Project.set_global_project_code(project_code)
     return project_code
コード例 #47
0
ファイル: prod_wdg.py プロジェクト: 0-T-0/TACTIC
 def get_context(my):
     context_select = Container.get('context_filter')
     context = 'publish'
     if context_select:
         context = context_select.get_value()
     if context == "":
         values = context_select.get_option('values')
         context = values[len(values)-1]
     return context
コード例 #48
0
 def get_global_project_code(cls):
     from pyasm.security import Site
     site = Site.get_site()
     PROJECT_KEY = "Project:global:%s:" % site
     project_code = Container.get(PROJECT_KEY)
     if not project_code:
         project_code = "admin"
         Project.set_global_project_code(project_code)
     return project_code
コード例 #49
0
    def get_unique_event_name(self):
        # generate a unique function name
        ref_count = Container.get("EventContainer:ref_count")
        if ref_count == None:
            ref_count = 0

        event_name = "event_name_%s" % ref_count
        Container.put("EventContainer:ref_count", ref_count + 1 )

        return event_name
コード例 #50
0
ファイル: event_container.py プロジェクト: 0-T-0/TACTIC
    def get_unique_event_name(my):
        # generate a unique function name
        ref_count = Container.get("EventContainer:ref_count")
        if ref_count == None:
            ref_count = 0

        event_name = "event_name_%s" % ref_count
        Container.put("EventContainer:ref_count", ref_count + 1 )

        return event_name
コード例 #51
0
ファイル: base_tab_wdg.py プロジェクト: zieglerm/TACTIC
    def init(self):
        tab_path = Container.get("tab_path")
        if not tab_path:
            tab_path = self.name
            Container.put("tab_path", tab_path)

        if len(tab_path.split("/")) > 0:
            self.setup_tab(tab_path, css=TabWdg.SMALL)
        else:
            self.setup_tab(tab_path)
コード例 #52
0
ファイル: palette.py プロジェクト: 2gDigitalPost/tactic_src
 def get(cls):
     palettes = Container.get("Palette:palettes")
     if palettes == None:
         palettes = []
         Container.put("Palette:palettes", palettes)
     if not palettes:
         palette = Palette()
         palettes.append(palette)
     else:
         palette = palettes[-1]
     return palette
コード例 #53
0
ファイル: translation.py プロジェクト: zieglerm/TACTIC
    def get_language():
        lang = Container.get("language")
        if lang:
            return lang

        import os
        lang = os.environ.get('TACTIC_LANG')
        if not lang:
            lang = 'en'

        return lang
コード例 #54
0
ファイル: project.py プロジェクト: hellios78/TACTIC
    def get_project_db_resource(my):
        # get the db resource for attached to this particular project.
        # Not the db_resource for "sthpw/project" for which
        # project.get_db_resource() does
        key = "Project:db_resource:%s" % my.get_code()
        resource = Container.get(key)
        if resource != None:
            return resource

        # the project defines the resource
        database = my.get_database_name()
        assert database

        if database == 'sthpw':
            # get if from the config
            db_resource_code = None
        else:
            db_resource_code = my.get_value("db_resource", no_exception=True)

        if not db_resource_code:
            # this could be any project, not just sthpw
            # already looked at cache, so set use_cache to False
            db_resource = DbResource.get_default(database, use_cache=False)
            Container.put(key, db_resource)
            return db_resource
        #elif isinstance(db_resource_code, DbResource):
        elif DbResource.is_instance(db_resource_code):
            db_resource = db_resource_code
            Container.put(key, db_resource)
            return db_resource

        db_resource_code = db_resource_code.strip()
        search = Search("sthpw/db_resource")
        search.add_filter("code", db_resource_code)
        db_resource_sobj = search.get_sobject()
        if not db_resource_sobj:
            raise TacticException("Database Resource [%s] does not exist" %
                                  db_resource_code)

        host = db_resource_sobj.get_value("host")
        vendor = db_resource_sobj.get_value("vendor")
        host = db_resource_sobj.get_value("host")
        port = db_resource_sobj.get_value("port")
        user = db_resource_sobj.get_value("login")
        password = db_resource_sobj.get_value("password")

        db_resource = DbResource(database=database,
                                 host=host,
                                 port=port,
                                 vendor=vendor,
                                 password=password)
        Container.put(key, db_resource)

        return db_resource
コード例 #55
0
ファイル: schema.py プロジェクト: zieglerm/TACTIC
    def get_predefined_schema(cls, code):
        assert(code)
        schema = Container.get("Schema:%s" % code)
        if not schema:
            schema = Schema("sthpw/schema", dependencies=False)
            schema.set_value("schema", SCHEMA_XML[code])
            schema.set_value("code", code)
            schema.init()
            Container.put("Schema:%s" % code, schema)

        return schema
コード例 #56
0
ファイル: project.py プロジェクト: mincau/TACTIC
    def get_by_code(cls, project_name, use_cache=True):
        if project_name == "default":
            project = Container.get("default_project")
            return project

        if not use_cache:
            search = Search("sthpw/project")
            search.add_filter("code", project_name)
            return search.get_sobject()

        return super(Project, cls).get_by_code(project_name)
コード例 #57
0
ファイル: run_transaction_cmd.py プロジェクト: funic/TACTIC
    def get_next_job(my):
        from pyasm.prod.queue import Queue
        import random
        import time
        interval = 0.2
        time.sleep(interval)
        job_search_type = my.get_job_search_type()
        servers_tried = []

        job = None
        while 1:
            my.servers = Container.get("TransactionQueueServers")
            if my.servers == None:
                trigger = TransactionQueueServersTrigger()
                trigger.execute()
                my.servers = Container.get("TransactionQueueServers")


            # use a random load balancer.  This algorithm is pretty
            # inefficient, but will only be an issue if there are lots
            # of servers
            num_servers = len(my.servers)
            if num_servers == 0:
                break


            server_index = random.randint(0, len(my.servers)-1)
            if server_index in servers_tried:
                continue

            server_code = my.servers[server_index].get_code()
            #print "server_code: ", server_code
            job = Queue.get_job(job_search_type=job_search_type, server_code=server_code)
            if job:
                break

            servers_tried.append(server_index)
            if len(servers_tried) == len(my.servers):
                break

        return job