当前位置: 首页>>代码示例>>Python>>正文


Python Chrome.add_jquery_ui方法代码示例

本文整理汇总了Python中trac.web.chrome.Chrome.add_jquery_ui方法的典型用法代码示例。如果您正苦于以下问题:Python Chrome.add_jquery_ui方法的具体用法?Python Chrome.add_jquery_ui怎么用?Python Chrome.add_jquery_ui使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.web.chrome.Chrome的用法示例。


在下文中一共展示了Chrome.add_jquery_ui方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _render_editor

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def _render_editor(self, req, milestone):
        data = {
            'milestone': milestone,
            'datetime_hint': get_datetime_format_hint(req.lc_time),
            'default_due': self.get_default_due(req),
            'milestone_groups': [],
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_MODIFY')
            milestones = [m for m in Milestone.select(self.env)
                          if m.name != milestone.name
                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
            data['milestone_groups'] = group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
            data['num_open_tickets'] = milestone \
                                       .get_num_tickets(exclude_closed=True)
            data['retarget_to'] = self.default_retarget_to
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')
            if milestone.name:
                add_notice(req, _("Milestone %(name)s does not exist. You can"
                                  " create it here.", name=milestone.name))

        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        chrome.add_wiki_toolbars(req)
        add_stylesheet(req, 'common/css/roadmap.css')
        return 'milestone_edit.html', data, None
开发者ID:spsoft-RockWang,项目名称:project-_trac,代码行数:31,代码来源:roadmap.py

示例2: _render_editor

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def _render_editor(self, req, milestone):
        # Suggest a default due time of 18:00 in the user's timezone
        now = datetime.now(req.tz)
        default_due = datetime(now.year, now.month, now.day, 18)
        if now.hour > 18:
            default_due += timedelta(days=1)
        default_due = to_datetime(default_due, req.tz)

        data = {
            'milestone': milestone,
            'datetime_hint': get_datetime_format_hint(req.lc_time),
            'default_due': default_due,
            'milestone_groups': [],
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_MODIFY')
            milestones = [m for m in Milestone.select(self.env)
                          if m.name != milestone.name
                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
            data['milestone_groups'] = group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')

        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        chrome.add_wiki_toolbars(req)
        return 'milestone_edit.html', data, None
开发者ID:nextview,项目名称:medicticket,代码行数:31,代码来源:roadmap.py

示例3: get_stream

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def get_stream(self, req, method, filename, stream, original_data):

        chrome = Chrome(self.env)
        data = original_data
        data['components'] = [component.name for component in trac.ticket.model.Component.select(self.env)]
        data['logs'] = WorkLogTable.getByTicketId(self.env, data['ticket'].id)
        template = chrome.load_template('work_log.html')
        content_stream = template.generate(**(chrome.populate_data(req, data)))
        chrome.add_jquery_ui(req)
        add_stylesheet(req, 'trac/css/work-log.css')
        return Transformer('//div[@id="ticket"]').after(content_stream)
开发者ID:ITAttractor,项目名称:tracker,代码行数:13,代码来源:work_log.py

示例4: test_add_jquery_ui_timezone_list_has_z

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def test_add_jquery_ui_timezone_list_has_z(self):
        chrome = Chrome(self.env)

        req = Request(href=Href('/trac.cgi'), lc_time='iso8601')
        chrome.add_jquery_ui(req)
        self.assertIn({'value': 'Z', 'label': '+00:00'},
                      req.chrome['script_data']['jquery_ui']['timezone_list'])

        req = Request(href=Href('/trac.cgi'), lc_time=locale_en)
        chrome.add_jquery_ui(req)
        self.assertIn({'value': 'Z', 'label': '+00:00'},
                      req.chrome['script_data']['jquery_ui']['timezone_list'])
开发者ID:exocad,项目名称:exotrac,代码行数:14,代码来源:chrome.py

示例5: _render_editor

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def _render_editor(self, req, product):
        """common processing for creating rendering the edit page"""
        if product._exists:
            req.perm(product.resource).require('PRODUCT_MODIFY')
        else:
            req.perm(product.resource).require('PRODUCT_CREATE')

        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        chrome.add_wiki_toolbars(req)
        data = {'product': product,
                'context': web_context(req, product.resource)}
        return 'product_edit.html', data, None
开发者ID:thimalk,项目名称:bloodhound,代码行数:15,代码来源:web_ui.py

示例6: get_stream

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
 def get_stream(self,req, method, filename, stream, original_data):
     chrome = Chrome(self.env)
     ticket_id = original_data['ticket'].id
     data = original_data
     data['objectlinks'] = self.get_links_for('ticket', ticket_id)
     data['link_types'] = get_link_types()
     data['components'] = [component.name for component in trac.ticket.model.Component.select(self.env)]
     data['return_url'] = req.href.ticket(ticket_id)
     template = chrome.load_template('ticket-links.html')
     content_stream = template.generate(**(chrome.populate_data(req, data)))
     chrome.add_jquery_ui(req)
     add_script(req,'objectlinking/jquery-ui-autocomplete.js')
     add_script(req,'objectlinking/search-links.js')
     add_stylesheet(req, 'objectlinking/style.css')
     add_stylesheet(req, 'objectlinking/jquery-ui-custom.css')
     return Transformer('//div[@id="ticket"]').after(content_stream)
开发者ID:ITAttractor,项目名称:trac-object-linking,代码行数:18,代码来源:main.py

示例7: expand_macro

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def expand_macro(self, formatter, name, content):
        args, kw = parse_args(content)
        args = [arg.strip() for arg in args]

        stack_names = kw.get('stack', '').split('|')
        if not stack_names:
            raise TracError('Missing stack names')

        stacks = CardStack.select_by_names(self.env, stack_names)

        cards = Card.select_by_stacks(self.env, stack_names)

        labels = [label for label in kw.get('label', '').split('|') if label]
        labels = dict(zip(stack_names, labels + stack_names[len(labels):]))

        width = int(kw.get('width', 400))

        req = formatter.req
        context = formatter.context

        board_data = {
            'form_token': req.form_token,
            'api_url': formatter.href('card'),
            'cards_by_id': serialized_cards_by_id(cards, self.env, context),
            'stacks_by_name': serialized_stacks_by_name(stacks, stack_names),
            'auto_refresh': self.auto_refresh,
            'auto_refresh_interval': self.auto_refresh_interval,
        }
        board_data_id = '%012x' % id(board_data)
        
        chrome = Chrome(self.env)
        add_stylesheet(req, 'cards/css/cards.css')
        chrome.add_jquery_ui(req)
        add_script_data(req, {'cards_%s' % board_data_id: board_data})
        add_script(req, 'cards/js/cards.js')

        data = {
            'board_data_id': board_data_id,
            'stack_names': stack_names,
            'labels': labels,
            'width': width,
        }
        return chrome.render_template(req, 'cards_macro.html', data, 'text/html', True)
开发者ID:folpindo,项目名称:psuter-cards-plugin,代码行数:45,代码来源:macro.py

示例8: process_request

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def process_request(self, req):
        
        add_stylesheet(req, 'mykanban/css/mykanban.css')
        add_script(req, 'mykanban/js/mykanban.js')
        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        process = req.args.get("process")

        item = None
        res = {}
        data = {}
        
        if process == "insert":
            
            with self.env.db_transaction as db:
                
                data = {
                    'stack_id': 3,
                    'title': 'test item 10',
                    'rank': 10,
                    'added_by': 'user',
                    'modified_by': 'user'
                }
                
                item = KanbanItem(db)
                res = item.insert(data)
        
        if process == "update":
            
            with self.env.db_transaction as db:
                
                criteria = {
                    'id':9
                }
                
                data = {
                    'stack_id': 1,
                    'title': 'test item update',
                    'rank': 5,
                    'added_by': 'user',
                    'modified_by': 'user',
                }
                
                item = KanbanItem(db)
                res = item.update(criteria, data)
                    
        if process == "delete":
            
            with self.env.db_transaction as db:
                
                criteria = {
                    'id':1
                }
                
                item = KanbanItem(db)
                res = item.delete(criteria)
                
        if process == "update-rank":
            
            item_id = int(req.args.get("id"))
            new_rank = int(req.args.get("rank"))
            
            ret = self.update_rank(item_id, new_rank)
            
            criteria = {
                'id':item_id
            }
            
            data = {
                'rank': new_rank,
                'modified_by': 'user'
            }
            
            with self.env.db_transaction as db:
                
                item = KanbanItem(db)
                res = item.update(criteria, data)
            
            self.log.debug("update ret:")
            self.log.debug(ret)
            
        data = {}

        data['greeting'] = "Hello world"
        data['listing'] = ["list 1","listt 2"]
        
        stack_cursor = None
        
        with self.env.db_transaction as db:
            
            fields = ['id','stack_id','rank','title']
            
            criteria = {
                'stack_id':1
            }
            
            item = KanbanItem(db)
            item.select(fields,criteria)
            stack_cursor = item.cursor
            
#.........这里部分代码省略.........
开发者ID:folpindo,项目名称:mykanban,代码行数:103,代码来源:mykanban.py

示例9: _do_actions

# 需要导入模块: from trac.web.chrome import Chrome [as 别名]
# 或者: from trac.web.chrome.Chrome import add_jquery_ui [as 别名]
    def _do_actions(self, context, actions):

        api = TrackerApi()

        time_interval = self.env.config.getint('tracker', 'time_interval', 10)
        time_separate = 1
        minutes_interval=0
        screenshotsWithHourse = []
        screenshotsWithMinutes = []
        template_hourse = []
        minute = 0
        min_hourse = 0
        max_hourse = 0
        allScreenshots=[]

        for action in actions:
            if action == 'view':
                date = datetime.datetime.now(context.req.tz)
                if 'date' in context.req.args:
                    date_from_calendar = context.req.args['date'].strip()
                    if date_from_calendar:
                        precisedate = user_time(context.req, parse_date, date_from_calendar)
                        date = precisedate.astimezone(context.req.tz)
                to_date = to_datetime(datetime.datetime(date.year, date.month, date.day,
                                               23, 59, 59, 999999), context.req.tz)
                to_date_timestamp = to_timestamp(to_date)

                full_date = {
                    'from_date': to_date_timestamp - 86400,
                    'to_date'  : to_date_timestamp
                }

                context.req.data['fromdate'] = to_date
                context.req.data['username'] = context.req.args.get('username')

                screenshot_id = int(context.req.args.get('id') or 0)
                screenshots = api.get_screenshots(context, context.req.args.get('username'), full_date)

                context.req.data['id'] = screenshot_id

                for hourse in range(0, 24):
                    for screenshot in screenshots:
                        screenshot["hourse"] = datetime.datetime.fromtimestamp(screenshot["time"]).strftime('%H')
                        if (int(screenshot["hourse"]) == hourse):
                            if min_hourse == 0:
                                min_hourse = hourse
                            elif min_hourse > hourse:
                                min_hourse = hourse
                            if max_hourse < hourse:
                                max_hourse = hourse
                            screenshotsWithHourse.append({hourse:screenshot})

                while (minute <= 59):
                    for screenshotsAll in screenshotsWithHourse:

                        for index in screenshotsAll:

                            screenshotMinute = datetime.datetime.fromtimestamp(float(screenshotsAll[index]["time"])).strftime('%M')
                            if int(screenshotMinute) == minute:
                                screenshotHourse = datetime.datetime.fromtimestamp(screenshotsAll[index]["time"]).strftime('%H')
                                if int(screenshotHourse) not in template_hourse:
                                    template_hourse.append(int(screenshotHourse))
                                screenshotsAll[index]['hourse'] = int(screenshotHourse)
                                screenshotsAll[index]['minute'] = int(screenshotMinute)
                                if len(screenshotsWithMinutes)>0 and screenshotsWithMinutes[0]['minute']==screenshotsAll[index]['minute']:
                                    screenshotsWithMinutes.pop()
                                screenshotsWithMinutes.append(screenshotsAll[index])
                    minute += 10
                for hourse in template_hourse:
                    for screenshot in screenshotsWithMinutes:
                        if screenshot['hourse']==hourse:
                            while screenshot['minute']!=minutes_interval:
                                allScreenshots.append({"hourse":hourse,"screen":None,"minute":minutes_interval})
                                minutes_interval+=10
                            screenshot["screen"]=1
                            allScreenshots.append(screenshot)
                            minutes_interval+=10
                    while (minutes_interval!=60):
                        allScreenshots.append({"hourse":hourse,"screen":None,"minute":minutes_interval})
                        minutes_interval+=10
                    minutes_interval=0

                context.req.data['allScreenshots'] = allScreenshots
                context.req.data['template_hourse'] = range(int(min_hourse), int(max_hourse)+time_separate)
                context.req.data['time_interval'] = time_interval
                context.req.data['time_separate'] = time_separate
                context.req.data['template'] = 'user_worklog_view.html'
                add_stylesheet(context.req, 'trac/css/tracker.css')
                chrome = Chrome(self.env)
                chrome.add_jquery_ui(context.req)

                return 'screenshots', None

            if action == 'get-file':

                screenshot_id = int(context.req.args.get('id') or 0)
                format = context.req.args.get('format') or self.default_format

                screenshot = api.get_screenshot(context, screenshot_id)

#.........这里部分代码省略.........
开发者ID:AI3Zakir,项目名称:Tracker-for-TRAC,代码行数:103,代码来源:user_list.py


注:本文中的trac.web.chrome.Chrome.add_jquery_ui方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。