Example #1
0
    def get_display(self):
        top = DivWdg()
        self.set_as_panel(top)

        title_div = DivWdg()
        title_div.add_class("maq_search_bar")
        title_div.add("Diagnostics")
        top.add(title_div)

        tool_div = DivWdg()
        top.add(tool_div)
        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            '''
        })
        tool_div.add(refresh)

        content = RoundedCornerDivWdg(hex_color_code="2F2F2F",
                                      corner_size="10")
        content.set_dimensions(width_str='300px', content_height_str=None)
        top.add(content)

        server_title_div = DivWdg()
        server_title_div.add_class("maq_search_bar")
        content.add(server_title_div)
        server_title_div.add("Server")
        server_content_div = DivWdg()
        server_content_div.add_style("padding: 10px")
        server_content_div.add(self.get_ping_wdg())
        server_content_div.add(self.get_load_balance_wdg())
        content.add(server_content_div)

        database_title_div = DivWdg()
        database_title_div.add_class("maq_search_bar")
        content.add(database_title_div)
        database_title_div.add("Database")
        database_content_div = DivWdg()
        database_content_div.add_style("padding: 10px")
        database_content_div.add(self.get_database_wdg())
        content.add(database_content_div)

        checkin_title_div = DivWdg()
        checkin_title_div.add_class("maq_search_bar")
        content.add(checkin_title_div)
        checkin_title_div.add("Database")
        checkin_content_div = DivWdg()
        checkin_content_div.add_style("padding: 10px")
        checkin_content_div.add(self.get_asset_dir_wdg())
        checkin_content_div.add(self.get_asset_management_wdg())
        content.add(checkin_content_div)

        return top
Example #2
0
    def get_display(my):
        from pyasm.biz import Project

        security = Environment.get_security()
        if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"):
            return DivWdg()


        section_div = LabeledHidableWdg(label="Schema Views")
        section_div.set_attr('spt_class_name', Common.get_full_class_name(my) )

        palette = Palette.get()
        color = palette.color("background3")

        project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10")
        project_div.set_dimensions( width_str='175px', content_height_str='100px' )

        project = Project.get()
        project_code = project.get_code()
        project_type = project.get_type()

        div = DivWdg()
        section_div.add(project_div)
        project_div.add(div)

        # get project type schema
        schema = Schema.get_by_code(project_code)
        if schema:
            div.add( my.get_schema_wdg(schema) )
        #if not project_type:
        #    raise SetupException("Project type not found for this [%s]" %project_code)
        if project_type:
            schema = Schema.get_predefined_schema(project_type)
            if schema:
                div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_predefined_schema('config')
        div.add( my.get_schema_wdg(schema) )

        schema = Schema.get_admin_schema()
        div.add( my.get_schema_wdg(schema) )

        return section_div


        # create a fake schema
        project = Project.get()
        db_name = project.get_database()
        sql = DbContainer.get(db_name)
        tables = sql.get_tables()
        tables.sort()
        tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] )

        # look at all of the search objects for mapped tables
        search = Search("sthpw/search_object")
        #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''')
        search.add_filter("namespace", 'MMS')
        search.add_filter("namespace", '{project}')
        search.add_where("or")
        search_types = search.get_sobjects()
        #for search_type in search_types:
        #    print "hhhh: ", search_type

        schema_xml = '''
        <schema>
        %s
        </schema>
        ''' % tables_str
        schema = SearchType.create("sthpw/schema")
        schema.set_value("code", "table")
        schema.set_value("schema", schema_xml)
        #div.add( my.get_schema_wdg(schema) )



        return section_div
Example #3
0
    def get_display(self):
        self.config_search_type = self.kwargs.get("config_search_type")
        if not self.config_search_type:
            self.config_search_type = "SideBarWdg"

        title = self.kwargs.get('title')
        config = self.kwargs.get('config')
        view = self.kwargs.get('view')
        width = self.kwargs.get('width')
        #sortable = self.kwargs.get('sortable')
        if not width:
            width = "175"

        self.prefix = self.kwargs.get("prefix")
        if not self.prefix:
            self.prefix = "side_bar"

        self.mode = self.kwargs.get("mode")
        if not self.mode:
            self.mode = 'view'

        self.default = self.kwargs.get('default') == 'True'

        div = DivWdg()
        div.add_class("spt_section_top")
        div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")

        # create the top widgets
        label = SpanWdg()
        label.add(title)
        label.add_style("font-size: 1.1em")
        section_div = LabeledHidableWdg(label=label)
        div.add(section_div)

        section_div.set_attr('spt_class_name',
                             Common.get_full_class_name(self))
        for name, value in self.kwargs.items():
            if name == "config":
                continue
            section_div.set_attr("spt_%s" % name, value)

        bgcolor = label.get_color("background3")
        project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,
                                          corner_size="10")
        project_div.set_dimensions(width_str='%spx' % width,
                                   content_height_str='100px')
        content_div = project_div.get_content_wdg()

        #project_div = DivWdg()
        #content_div = project_div

        section_div.add(project_div)

        content_div.add_class("spt_side_bar_content")
        content_div.add_attr("spt_view", view)

        if type(view) in types.StringTypes:
            view = [view]

        view_margin_top = '4px'

        web = WebContainer.get_web()
        for viewx in view:
            config = self.get_config(self.config_search_type,
                                     viewx,
                                     default=self.default)
            if not config:
                continue

            # make up a title
            title = DivWdg()
            title.add_gradient("background",
                               "side_bar_title",
                               0,
                               -15,
                               default="background")
            title.add_color("color", "side_bar_title_color", default="color")
            title.add_styles(
                "margin-top: %s; margin-bottom: 3px; vertical-align: middle" %
                view_margin_top)
            if not web.is_IE():
                title.add_styles("margin-left: -5px; margin-right: -5px;")
            title.add_looks("navmenu_header")
            title.add_style("height: 18px")
            title.add_style("padding-top: 2px")
            """
            title = DivWdg()
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -10px; margin-right: -10px;")
            title.add_looks( "navmenu_header" )
            """

            # FIXME: not sure if this logic should be here. It basically
            # makes special titles for certain view names
            view_attrs = config.get_view_attributes()
            title_str = view_attrs.get("title")
            if not title_str:
                if viewx.startswith("self_view_"):
                    title_str = "My Views"
                else:
                    title_str = viewx

            title_str = Common.get_display_title(title_str)

            title_label = SpanWdg()
            title_label.add_styles("margin-left: 6px; padding-bottom: 2px;")
            title_label.add_looks("fnt_title_5 fnt_bold")
            title_label.add(title_str)
            title.add(title_label)

            content_div.add(title)

            info = {'counter': 10, 'view': viewx}
            self.generate_section(config, content_div, info)
            error_list = Container.get_seq(self.ERR_MSG)
            if error_list:
                span = SpanWdg()
                span.add_style('background', 'red')
                span.add('<br/>'.join(error_list))
                content_div.add(span)
                Container.clear_seq(self.ERR_MSG)
            self.add_dummy(config, content_div)

        return div
Example #4
0
    def get_display(self):
        top = DivWdg()
        self.set_as_panel(top)

        title_div = DivWdg()
        title_div.add_class("maq_search_bar")
        title_div.add("Diagnostics")
        top.add(title_div)


        tool_div = DivWdg()
        top.add(tool_div)
        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            '''
        } )
        tool_div.add(refresh)




        content = RoundedCornerDivWdg(hex_color_code="2F2F2F",corner_size="10")
        content.set_dimensions( width_str='300px', content_height_str=None )
        top.add(content)

        server_title_div = DivWdg()
        server_title_div.add_class("maq_search_bar")
        content.add(server_title_div)
        server_title_div.add("Server")
        server_content_div = DivWdg()
        server_content_div.add_style("padding: 10px")
        server_content_div.add(self.get_ping_wdg())
        server_content_div.add(self.get_load_balance_wdg())
        content.add(server_content_div)


        database_title_div = DivWdg()
        database_title_div.add_class("maq_search_bar")
        content.add(database_title_div)
        database_title_div.add("Database")
        database_content_div = DivWdg()
        database_content_div.add_style("padding: 10px")
        database_content_div.add(self.get_database_wdg())
        content.add(database_content_div)


        checkin_title_div = DivWdg()
        checkin_title_div.add_class("maq_search_bar")
        content.add(checkin_title_div)
        checkin_title_div.add("Database")
        checkin_content_div = DivWdg()
        checkin_content_div.add_style("padding: 10px")
        checkin_content_div.add(self.get_asset_dir_wdg() )
        checkin_content_div.add(self.get_asset_management_wdg())
        content.add(checkin_content_div)

 

        return top
Example #5
0
    def get_display(self):

        if self.is_popup:
            icon_chooser_popup_id = "IconChooserPopup"
            icon_chooser_popup = PopupWdg(id=icon_chooser_popup_id,
                                          allow_page_activity=False,
                                          width="760px")
            icon_chooser_popup.add("Icon Chooser", "title")

        orig_icon_list = IconWdg.icons.keys()
        icon_list = ['-- No Icon --']
        do_not_list = [
            'MAYA', 'HOUDINI', 'PROGRESS', 'CLIP_PLAY', 'XSI', 'CLIP_PAUSE',
            'CHECK_OUT_LG', 'CHECK_OUT', 'PUBLISH_LG'
        ]

        for k in orig_icon_list:
            if k in do_not_list:
                continue
            icon_list.append(k)

        icon_list.sort()
        icon_list_len = float(len(icon_list))

        num_cols = 5
        num_rows = int(math.ceil(icon_list_len / float(num_cols)))

        chooser_wrapper_div = DivWdg()
        chooser_wrapper_div.add_class("SPT_ICON_CHOOSER_WRAPPER_DIV")

        chooser_bkg_rc = RoundedCornerDivWdg(hex_color_code="949494",
                                             corner_size="10")
        chooser_bkg_rc.set_dimensions(width_str='740px',
                                      content_height_str='520px')

        table = Table()
        for r in range(num_rows):
            table.add_row()
            for c in range(num_cols):
                td = table.add_cell()
                td.add_styles(
                    "color: black; overflow: hidden; width: 140px; max-width: 140px; height: 20px;"
                )
                td.add_styles(
                    "border: 1px solid transparent; cursor: pointer;")
                td.add_behavior({
                    'type': 'hover',
                    'mod_styles': 'background-color: #555555;'
                })

                if c > 0:
                    td.add_styles("border-left-color: black;")

                idx = int(c * num_rows + r)
                if idx < icon_list_len:
                    icon_name = icon_list[idx]
                    icon_path = ''
                    if icon_name != '-- No Icon --':
                        icon_path = IconWdg.get_icon_path(icon_name)
                        icon = IconWdg(icon_name, icon_path)
                        td.add(icon)
                    text_span = SpanWdg()
                    text_span.add_looks("fnt_code")
                    text_span.add_styles("font-size: 10px")
                    if len(icon_name) > 16:
                        text_span.add("%s..." % icon_name[:15])
                    else:
                        text_span.add(icon_name)
                    td.add(text_span)
                    if icon_name == '-- No Icon --':
                        icon_name = ''
                    td.add_class("SPT_ICON_SELECT_%s" % icon_name)
                    if self.is_popup:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.popup.close( spt.popup.get_popup( bvr.src_el ) );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,
                               "ICON_CHOOSER_SELECTION_MADE")
                    else:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.hide( cwd );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,
                               "ICON_CHOOSER_SELECTION_MADE")
                        pass
                    td.add_behavior({
                        'type': 'click_up',
                        'cbjs_action': cbjs_action
                    })

        chooser_bkg_rc.add(table)
        chooser_wrapper_div.add(chooser_bkg_rc)

        if self.is_popup:
            icon_chooser_popup.add(chooser_wrapper_div, "content")
            return icon_chooser_popup

        return div
Example #6
0
    def get_display(self):


        from tactic.ui.report import MMSUtility
        import datetime
        date = datetime.datetime.now()
        start_wday, end_wday =  MMSUtility.get_week_range(date)

        self.prefix = 'week'
        top = DivWdg()
        top.add_class("spt_table_search")
        self.set_as_panel(top)

        from tactic.ui.container import RoundedCornerDivWdg
        inner = RoundedCornerDivWdg(corner_size=10, hex_color_code='949494')
        inner.set_dimensions(width_str="95%", content_height_str='95%', height_str="100%")
        inner.add_style("margin: 20px")
        top.add(inner)


        hidden = HiddenWdg("prefix", self.prefix)
        top.add(hidden)



        filter_data = FilterData.get()
        values = filter_data.get_values_by_index("week", 0)
        date_string = values.get("calendar")
        if not date_string:
            date_string = WebContainer.get_web().get_form_value("calendar")

        if date_string:
            date = parser.parse(date_string)
        else:
            date = datetime.datetime.now()

        week = 1


        table = Table()
        table.add_style("color: black")
        table.add_style("width: 600px")
        table.add_row()
        inner.add(table)


        #inner.add("Range: %s - %s<br/><br/>" % (start_wday, end_wday))


        table.add_cell("Week Of Date: <br/>")
        calendar = CalendarInputWdg('calendar')

        day_cbk = '''
        var top = spt.get_parent(bvr.src_el, '.spt_table_search');
        var week_el = top.getElement('.spt_calendar_week');
        var input_el = top.getElement('.spt_calendar_input');
        var value = input_el.value;
        var week = spt.date_util.ymd.get_week( value )
        week_el.innerHTML = week + '';
        '''
        calendar.add_day_cbk(day_cbk)


        #calendar.set_option("first_day_of_week", 4)
        calendar.set_value(date.strftime("%Y-%m-%d"))
        # TODO: set default
        table.add_cell( calendar )

        week = int(date.strftime("%W")) + 1

        table.add_cell("Week: ")
        #select = SelectWdg("week")
        #select.add_class("action inputfield")
        #select.set_option("values", range(1,53) )
        #select.set_value(week)
        #select.set_option( "size", "2" )
        text = DivWdg()
        text.add_class("spt_calendar_week")
        text.add_style("width", "25px")
        text.add(week)
        table.add_cell(text)

        table.add_cell( self.get_search_wdg() )

        return top
Example #7
0
    def get_display(self):
        from pyasm.biz import Project

        security = Environment.get_security()
        if not security.check_access("builtin", "side_bar_schema", "allow", default="deny"):
            return DivWdg()


        section_div = LabeledHidableWdg(label="Schema Views")
        section_div.set_attr('spt_class_name', Common.get_full_class_name(self) )

        palette = Palette.get()
        color = palette.color("background3")

        project_div = RoundedCornerDivWdg(hex_color_code=color,corner_size="10")
        project_div.set_dimensions( width_str='175px', content_height_str='100px' )

        project = Project.get()
        project_code = project.get_code()
        project_type = project.get_type()

        div = DivWdg()
        section_div.add(project_div)
        project_div.add(div)

        # get project type schema
        schema = Schema.get_by_code(project_code)
        if schema:
            div.add( self.get_schema_wdg(schema) )
        #if not project_type:
        #    raise SetupException("Project type not found for this [%s]" %project_code)
        if project_type:
            schema = Schema.get_predefined_schema(project_type)
            if schema:
                div.add( self.get_schema_wdg(schema) )

        schema = Schema.get_predefined_schema('config')
        div.add( self.get_schema_wdg(schema) )

        schema = Schema.get_admin_schema()
        div.add( self.get_schema_wdg(schema) )

        return section_div


        # create a fake schema
        project = Project.get()
        db_name = project.get_database()
        sql = DbContainer.get(db_name)
        tables = sql.get_tables()
        tables.sort()
        tables_str = "\n".join( ['<search_type name="%s"/>'%x for x in tables] )

        # look at all of the search objects for mapped tables
        search = Search("sthpw/search_object")
        #search.add_where('''"namespace" = 'MMS' or namespace = '{project}' ''')
        search.add_filter("namespace", 'MMS')
        search.add_filter("namespace", '{project}')
        search.add_where("or")
        search_types = search.get_sobjects()

        schema_xml = '''
        <schema>
        %s
        </schema>
        ''' % tables_str
        schema = SearchType.create("sthpw/schema")
        schema.set_value("code", "table")
        schema.set_value("schema", schema_xml)
        #div.add( self.get_schema_wdg(schema) )



        return section_div
Example #8
0
    def get_display(self):
        top = DivWdg()

        search_type = self.kwargs.get("search_type")
        view = self.kwargs.get("view")
        element_name = self.kwargs.get("element_name")

        config_view = WidgetConfigView.get_by_search_type(search_type, view)

        #inner_div = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        inner_div = RoundedCornerDivWdg(hex_color_code="272727",
                                        corner_size="10")
        inner_div.set_dimensions(width_str='400px', content_height_str='600px')
        top.add(inner_div)

        # add the save button
        buttons_list = []
        buttons_list.append({
            'label': 'Save as View',
            'tip': 'Save as View',
            'bvr': {
                'cbjs_action': "alert('Not Implemented')"
            }
        })
        buttons_list.append({
            'label': 'Save as Def',
            'tip': 'Save as Definition',
            'bvr': {
                'cbjs_action': "alert('Not Implemented')"
            }
        })

        buttons = TextBtnSetWdg(float="right",
                                buttons=buttons_list,
                                spacing=6,
                                size='small',
                                side_padding=4)

        inner_div.add(buttons)

        title_div = DivWdg()
        title_div.add_style("margin-bottom: 10px")
        title_div.add_class("maq_search_bar")
        title_div.add("Element Definition")
        inner_div.add(title_div)

        test = SimpleElementDefinitionWdg(config_view=config_view,
                                          element_name=element_name)
        inner_div.add(test)

        config_title_wdg = DivWdg()
        inner_div.add(config_title_wdg)
        config_title_wdg.add("<b>Definitions in config</b>")
        config_title_wdg.add_style("margin: 15px 0px 5px 0px")

        for config in config_view.get_configs():
            view = config.get_view()
            xml = config.get_element_xml(element_name)

            config_div = DivWdg()
            inner_div.add(config_div)

            # add the title
            from pyasm.widget import SwapDisplayWdg, IconWdg

            view_div = DivWdg()
            view_div.add_class("spt_view")
            config_div.add(view_div)

            if not xml:
                icon_wdg = IconWdg("Nothing defined", IconWdg.DOT_RED)
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)
            else:
                icon_wdg = IconWdg("Is defined", IconWdg.DOT_GREEN)
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)

            swap = SwapDisplayWdg()
            view_div.add(swap)
            swap.add_action_script('''
                var info_wdg = bvr.src_el.getParent('.spt_view').getElement('.spt_info');
                spt.toggle_show_hide(info_wdg);
            ''')

            mode = "predefined"
            file_path = config.get_file_path()
            if not file_path:
                mode = "database"
            elif file_path == 'generated':
                mode = 'generated'

            # display the title
            view_div.add("%s" % view)
            view_div.add(" - [%s]" % mode)

            info_div = DivWdg()
            info_div.add_class("spt_info")
            info_div.add_style("margin-left: 20px")
            info_div.add_style("display: none")
            #if not xml:
            #    info_div.add_style("display: none")
            #else:
            #    swap.set_off()
            view_div.add(info_div)

            path_div = DivWdg()
            if not file_path:
                file_path = mode
            path_div.add("Defined in: %s" % file_path)
            info_div.add(path_div)

            text_wdg = TextAreaWdg()
            text_wdg.set_option("rows", 15)
            text_wdg.set_option("cols", 80)
            text_wdg.set_value(xml)
            info_div.add(text_wdg)

            #view_div.add("<hr/>")

        return top
Example #9
0
    def get_display(my):
        top = DivWdg()


        search_type = my.kwargs.get("search_type")
        view = my.kwargs.get("view")
        element_name = my.kwargs.get("element_name")

        config_view = WidgetConfigView.get_by_search_type(search_type, view)


        #inner_div = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        inner_div = RoundedCornerDivWdg(hex_color_code="272727",corner_size="10")
        inner_div.set_dimensions( width_str='400px', content_height_str='600px' )
        top.add(inner_div)


        # add the save button
        buttons_list = []
        buttons_list.append( {'label': 'Save as View', 'tip': 'Save as View',
                'bvr': { 'cbjs_action': "alert('Not Implemented')" }
        })
        buttons_list.append( {'label': 'Save as Def', 'tip': 'Save as Definition',
                'bvr': { 'cbjs_action': "alert('Not Implemented')" }
        })

        buttons = TextBtnSetWdg( float="right", buttons=buttons_list,
                                 spacing=6, size='small', side_padding=4 )


        inner_div.add(buttons)


        title_div = DivWdg()
        title_div.add_style("margin-bottom: 10px")
        title_div.add_class("maq_search_bar")
        title_div.add("Element Definition")
        inner_div.add(title_div)



        test = SimpleElementDefinitionWdg(config_view=config_view, element_name=element_name)
        inner_div.add(test)



        config_title_wdg = DivWdg()
        inner_div.add(config_title_wdg)
        config_title_wdg.add("<b>Definitions in config</b>")
        config_title_wdg.add_style("margin: 15px 0px 5px 0px")

        for config in config_view.get_configs():
            view = config.get_view()
            xml = config.get_element_xml(element_name)

            config_div = DivWdg()
            inner_div.add(config_div)



            # add the title
            from pyasm.widget import SwapDisplayWdg, IconWdg

            view_div = DivWdg()
            view_div.add_class("spt_view")
            config_div.add(view_div)

            if not xml:
                icon_wdg = IconWdg( "Nothing defined", IconWdg.DOT_RED )
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)
            else:
                icon_wdg = IconWdg( "Is defined", IconWdg.DOT_GREEN )
                icon_wdg.add_style("float: right")
                view_div.add(icon_wdg)

            swap = SwapDisplayWdg()
            view_div.add(swap)
            swap.add_action_script('''
                var info_wdg = bvr.src_el.getParent('.spt_view').getElement('.spt_info');
                spt.toggle_show_hide(info_wdg);
            ''')


            mode = "predefined"
            file_path = config.get_file_path()
            if not file_path:
                mode = "database"
            elif file_path == 'generated':
                mode = 'generated'
                

            # display the title
            view_div.add("%s" % view)
            view_div.add(" - [%s]" % mode)

            info_div = DivWdg()
            info_div.add_class("spt_info")
            info_div.add_style("margin-left: 20px")
            info_div.add_style("display: none")
            #if not xml:
            #    info_div.add_style("display: none")
            #else:
            #    swap.set_off()
            view_div.add(info_div)

            path_div = DivWdg()
            if not file_path:
                file_path = mode
            path_div.add("Defined in: %s" % file_path)
            info_div.add(path_div)

            text_wdg = TextAreaWdg()
            text_wdg.set_option("rows", 15)
            text_wdg.set_option("cols", 80)
            text_wdg.set_value(xml)
            info_div.add(text_wdg)

            #view_div.add("<hr/>")

        return top
Example #10
0
    def get_display(my):
        my.config_search_type = my.kwargs.get("config_search_type")
        if not my.config_search_type:
            my.config_search_type = "SideBarWdg"

        title = my.kwargs.get('title')
        config = my.kwargs.get('config')
        view = my.kwargs.get('view')
        width = my.kwargs.get('width')
        #sortable = my.kwargs.get('sortable')
        if not width:
            width = "175"

        my.prefix = my.kwargs.get("prefix")
        if not my.prefix:
            my.prefix = "side_bar"

        my.mode = my.kwargs.get("mode")
        if not my.mode:
            my.mode = 'view'


        my.default = my.kwargs.get('default') == 'True'

        div = DivWdg()
        div.add_class("spt_section_top")
        div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")


        # create the top widgets
        label = SpanWdg()
        label.add(title)
        label.add_style("font-size: 1.1em")
        section_div = LabeledHidableWdg(label=label)
        div.add(section_div)

        section_div.set_attr('spt_class_name', Common.get_full_class_name(my))
        for name, value in my.kwargs.items():
            if name == "config":
                continue
            section_div.set_attr("spt_%s" % name, value)

        bgcolor = label.get_color("background3")
        project_div = RoundedCornerDivWdg(hex_color_code=bgcolor,corner_size="10")
        project_div.set_dimensions( width_str='%spx' % width, content_height_str='100px' )
        content_div = project_div.get_content_wdg()

        #project_div = DivWdg()
        #content_div = project_div


        section_div.add( project_div )

        content_div.add_class("spt_side_bar_content")
        content_div.add_attr("spt_view", view)

        if type(view) in types.StringTypes:
            view = [view]

        view_margin_top = '4px'

        web = WebContainer.get_web()
        for viewx in view:
            config = my.get_config(my.config_search_type, viewx, default=my.default)
            if not config:
                continue

            # make up a title
            title = DivWdg()
            title.add_gradient( "background", "side_bar_title", 0, -15, default="background" )
            title.add_color( "color", "side_bar_title_color", default="color" )
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -5px; margin-right: -5px;")
            title.add_looks( "navmenu_header" )
            title.add_style( "height: 18px" )
            title.add_style( "padding-top: 2px" )
            """
            title = DivWdg()
            title.add_styles( "margin-top: %s; margin-bottom: 3px; vertical-align: middle" % view_margin_top )
            if not web.is_IE():
                title.add_styles( "margin-left: -10px; margin-right: -10px;")
            title.add_looks( "navmenu_header" )
            """

            # FIXME: not sure if this logic should be here. It basically
            # makes special titles for certain view names
            view_attrs = config.get_view_attributes()
            title_str = view_attrs.get("title")
            if not title_str:
                if viewx.startswith("my_view_"):
                    title_str = "My Views"
                else:
                    title_str = viewx

            title_str = Common.get_display_title(title_str)

            title_label = SpanWdg()
            title_label.add_styles( "margin-left: 6px; padding-bottom: 2px;" )
            title_label.add_looks( "fnt_title_5 fnt_bold" )
            title_label.add( title_str )
            title.add( title_label )

            content_div.add( title )

            info = { 'counter' : 10, 'view': viewx }
            my.generate_section( config, content_div, info )
            error_list = Container.get_seq(my.ERR_MSG)
            if error_list: 
                span = SpanWdg()
                span.add_style('background', 'red')
                span.add('<br/>'.join(error_list))
                content_div.add(span)
                Container.clear_seq(my.ERR_MSG)
            my.add_dummy(config, content_div) 

        return div
Example #11
0
    def get_display(self):

        from tactic.ui.report import MMSUtility
        import datetime
        date = datetime.datetime.now()
        start_wday, end_wday = MMSUtility.get_week_range(date)

        self.prefix = 'week'
        top = DivWdg()
        top.add_class("spt_table_search")
        self.set_as_panel(top)

        from tactic.ui.container import RoundedCornerDivWdg
        inner = RoundedCornerDivWdg(corner_size=10, hex_color_code='949494')
        inner.set_dimensions(width_str="95%",
                             content_height_str='95%',
                             height_str="100%")
        inner.add_style("margin: 20px")
        top.add(inner)

        hidden = HiddenWdg("prefix", self.prefix)
        top.add(hidden)

        filter_data = FilterData.get()
        values = filter_data.get_values_by_index("week", 0)
        date_string = values.get("calendar")
        if not date_string:
            date_string = WebContainer.get_web().get_form_value("calendar")

        if date_string:
            date = parser.parse(date_string)
        else:
            date = datetime.datetime.now()

        week = 1

        table = Table()
        table.add_style("color: black")
        table.add_style("width: 600px")
        table.add_row()
        inner.add(table)

        #inner.add("Range: %s - %s<br/><br/>" % (start_wday, end_wday))

        table.add_cell("Week Of Date: <br/>")
        calendar = CalendarInputWdg('calendar')

        day_cbk = '''
        var top = spt.get_parent(bvr.src_el, '.spt_table_search');
        var week_el = top.getElement('.spt_calendar_week');
        var input_el = top.getElement('.spt_calendar_input');
        var value = input_el.value;
        var week = spt.date_util.ymd.get_week( value )
        week_el.innerHTML = week + '';
        '''
        calendar.add_day_cbk(day_cbk)

        #calendar.set_option("first_day_of_week", 4)
        calendar.set_value(date.strftime("%Y-%m-%d"))
        # TODO: set default
        table.add_cell(calendar)

        week = int(date.strftime("%W")) + 1

        table.add_cell("Week: ")
        #select = SelectWdg("week")
        #select.add_class("action inputfield")
        #select.set_option("values", range(1,53) )
        #select.set_value(week)
        #select.set_option( "size", "2" )
        text = DivWdg()
        text.add_class("spt_calendar_week")
        text.add_style("width", "25px")
        text.add(week)
        table.add_cell(text)

        table.add_cell(self.get_search_wdg())

        return top
Example #12
0
    def get_display(my):

        if my.is_popup:
            icon_chooser_popup_id = "IconChooserPopup"
            icon_chooser_popup = PopupWdg(id=icon_chooser_popup_id, allow_page_activity=False, width="760px")
            icon_chooser_popup.add("Icon Chooser", "title")

        orig_icon_list = IconWdg.icons.keys()
        icon_list = ['-- No Icon --']
        do_not_list = [ 'MAYA', 'HOUDINI', 'PROGRESS', 'CLIP_PLAY', 'XSI', 'CLIP_PAUSE', 'CHECK_OUT_LG','CHECK_OUT','PUBLISH_LG' ]

        for k in orig_icon_list:
            if k in do_not_list:
                continue
            icon_list.append(k)

        icon_list.sort()
        icon_list_len = float(len(icon_list))

        num_cols = 5
        num_rows = int( math.ceil( icon_list_len / float(num_cols) ) )

        chooser_wrapper_div = DivWdg()
        chooser_wrapper_div.add_class( "SPT_ICON_CHOOSER_WRAPPER_DIV" )

        chooser_bkg_rc = RoundedCornerDivWdg(hex_color_code="949494",corner_size="10")
        chooser_bkg_rc.set_dimensions( width_str='740px', content_height_str='520px' )

        table = Table()
        for r in range(num_rows):
            table.add_row()
            for c in range(num_cols):
                td = table.add_cell()
                td.add_styles("color: black; overflow: hidden; width: 140px; max-width: 140px; height: 20px;")
                td.add_styles("border: 1px solid transparent; cursor: pointer;")
                td.add_behavior( {'type': 'hover', 'mod_styles': 'background-color: #555555;'} )

                if c > 0:
                    td.add_styles("border-left-color: black;")

                idx = int( c * num_rows + r )
                if idx < icon_list_len:
                    icon_name = icon_list[ idx ]
                    icon_path = ''
                    if icon_name != '-- No Icon --':
                        icon_path = IconWdg.get_icon_path(icon_name)
                        icon = IconWdg( icon_name, icon_path )
                        td.add(icon)
                    text_span = SpanWdg()
                    text_span.add_looks( "fnt_code" )
                    text_span.add_styles( "font-size: 10px" )
                    if len(icon_name) > 16:
                        text_span.add( "%s..." % icon_name[:15] )
                    else:
                        text_span.add( icon_name )
                    td.add( text_span )
                    if icon_name == '-- No Icon --':
                        icon_name = ''
                    td.add_class( "SPT_ICON_SELECT_%s" % icon_name )
                    if my.is_popup:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.popup.close( spt.popup.get_popup( bvr.src_el ) );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,"ICON_CHOOSER_SELECTION_MADE")
                    else:
                        cbjs_action = '''
                            var cwd = bvr.src_el.getParent(".SPT_ICON_CHOOSER_WRAPPER_DIV");
                            cwd.setProperty("spt_icon_selected", "%s");
                            cwd.setProperty("spt_icon_path", "%s");
                            spt.hide( cwd );
                            spt.named_events.fire_event("%s",bvr);
                        ''' % (icon_name, icon_path,"ICON_CHOOSER_SELECTION_MADE")
                        pass
                    td.add_behavior( {'type': 'click_up', 'cbjs_action': cbjs_action} )

        chooser_bkg_rc.add( table )
        chooser_wrapper_div.add( chooser_bkg_rc )


        if my.is_popup:
            icon_chooser_popup.add(chooser_wrapper_div, "content")
            return icon_chooser_popup


        return div