• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.dbg函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.dbg函数的典型用法代码示例。如果您正苦于以下问题:Python dbg函数的具体用法?Python dbg怎么用?Python dbg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: create_layout

    def create_layout(self, layout):
        """Apply any config items from our layout"""
        if not layout.has_key('children'):
            err('layout describes no children: %s' % layout)
            return
        children = layout['children']
        if len(children) != 1:
            # We're a Window, we can only have one child
            err('incorrect number of children for Window: %s' % layout)
            return

        child = children[children.keys()[0]]
        terminal = self.get_children()[0]
        dbg('Making a child of type: %s' % child['type'])
        if child['type'] == 'VPaned':
            self.split_axis(terminal, True)
        elif child['type'] == 'HPaned':
            self.split_axis(terminal, False)
        elif child['type'] == 'Notebook':
            self.tab_new()
            i = 2
            while i < len(child['children']):
                self.tab_new()
                i = i + 1
        elif child['type'] == 'Terminal':
            pass
        else:
            err('unknown child type: %s' % child['type'])
            return

        self.get_children()[0].create_layout(child)
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:31,代码来源:window.py


示例2: move_tab

    def move_tab(self, widget, direction):
        """Handle a keyboard shortcut for moving tab positions"""
        maker = Factory()
        notebook = self.get_child()

        if not maker.isinstance(notebook, 'Notebook'):
            dbg('not in a notebook, refusing to move tab %s' % direction)
            return

        dbg('moving tab %s' % direction)
        numpages = notebook.get_n_pages()
        page = notebook.get_current_page()
        child = notebook.get_nth_page(page)

        if direction == 'left':
            if page == 0:
                page = numpages
            else:
                page = page - 1
        elif direction == 'right':
            if page == numpages - 1:
                page = 0
            else:
                page = page + 1
        else:
            err('unknown direction: %s' % direction)
            return
        
        notebook.reorder_child(child, page)
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:29,代码来源:window.py


示例3: on_window_state_changed

    def on_window_state_changed(self, window, event):
        """Handle the state of the window changing"""
        self.isfullscreen = bool(event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN)
        self.ismaximised = bool(event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED)
        dbg("Window::on_window_state_changed: fullscreen=%s, maximised=%s" % (self.isfullscreen, self.ismaximised))

        return False
开发者ID:AmosZ,项目名称:terminal,代码行数:7,代码来源:window.py


示例4: save

    def save(self):
        """Save the config to a file"""
        dbg("ConfigBase::save: saving config")
        parser = ConfigObj()
        parser.indent_type = "  "

        for section_name in ["global_config", "keybindings"]:
            dbg("ConfigBase::save: Processing section: %s" % section_name)
            section = getattr(self, section_name)
            parser[section_name] = dict_diff(DEFAULTS[section_name], section)

        parser["profiles"] = {}
        for profile in self.profiles:
            dbg("ConfigBase::save: Processing profile: %s" % profile)
            parser["profiles"][profile] = dict_diff(DEFAULTS["profiles"]["default"], self.profiles[profile])

        parser["layouts"] = {}
        for layout in self.layouts:
            dbg("ConfigBase::save: Processing layout: %s" % layout)
            parser["layouts"][layout] = self.layouts[layout]

        parser["plugins"] = {}
        for plugin in self.plugins:
            dbg("ConfigBase::save: Processing plugin: %s" % plugin)
            parser["plugins"][plugin] = self.plugins[plugin]

        config_dir = get_config_dir()
        if not os.path.isdir(config_dir):
            os.makedirs(config_dir)
        try:
            parser.write(open(self.command_line_options.config, "w"))
        except Exception, ex:
            err("ConfigBase::save: Unable to save config: %s" % ex)
开发者ID:swegener,项目名称:terminator,代码行数:33,代码来源:config.py


示例5: input

 def input(self, data):
     if "type" in data:
         function_name = "process_" + data["type"]
         dbg("got {}".format(function_name))
         for plugin in self.bot_plugins:
             plugin.register_jobs()
             plugin.do(function_name, data)
开发者ID:youknowone,项目名称:slairck,代码行数:7,代码来源:slackbot.py


示例6: save

    def save(self):
        """Save the config to a file"""
        dbg('ConfigBase::save: saving config')
        parser = ConfigObj()
        parser.indent_type = '  '

        for section_name in ['global_config', 'keybindings']:
            dbg('ConfigBase::save: Processing section: %s' % section_name)
            section = getattr(self, section_name)
            parser[section_name] = dict_diff(DEFAULTS[section_name], section)

        parser['profiles'] = {}
        for profile in self.profiles:
            dbg('ConfigBase::save: Processing profile: %s' % profile)
            parser['profiles'][profile] = dict_diff(
                    DEFAULTS['profiles']['default'], self.profiles[profile])

        parser['layouts'] = {}
        for layout in self.layouts:
            dbg('ConfigBase::save: Processing layout: %s' % layout)
            parser['layouts'][layout] = self.layouts[layout]

        parser['plugins'] = {}
        for plugin in self.plugins:
            dbg('ConfigBase::save: Processing plugin: %s' % plugin)
            parser['plugins'][plugin] = self.plugins[plugin]

        config_dir = get_config_dir()
        if not os.path.isdir(config_dir):
            os.makedirs(config_dir)
        try:
            parser.write(open(self.command_line_options.config, 'w'))
        except Exception, ex:
            err('ConfigBase::save: Unable to save config: %s' % ex)
开发者ID:FreedomBen,项目名称:terminator,代码行数:34,代码来源:config.py


示例7: tab_change

    def tab_change(self, widget, num=None):
        """Change to a specific tab"""
        if num is None:
            err('must specify a tab to change to')

        maker = Factory()
        child = self.get_child()

        if not maker.isinstance(child, 'Notebook'):
            dbg('child is not a notebook, nothing to change to')
            return

        if num == -1:
            # Go to the next tab
            cur = child.get_current_page()
            pages = child.get_n_pages()
            if cur == pages - 1:
                num = 0
            else:
                num = cur + 1
        elif num == -2:
            # Go to the previous tab
            cur = child.get_current_page()
            if cur > 0:
                num = cur - 1
            else:
                num = child.get_n_pages() - 1

        child.set_current_page(num)
        # Work around strange bug in gtk-2.12.11 and pygtk-2.12.1
        # Without it, the selection changes, but the displayed page doesn't
        # change
        child.set_current_page(child.get_current_page())
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:33,代码来源:window.py


示例8: group_emit

 def group_emit(self, terminal, group, type, event):
     """Emit to each terminal in a group"""
     dbg('Terminator::group_emit: emitting a keystroke for group %s' %
             group)
     for term in self.terminals:
         if term != terminal and term.group == group:
             term.vte.emit(type, event)
开发者ID:Reventl0v,项目名称:Terminator,代码行数:7,代码来源:terminator.py


示例9: input

 def input(self, data):
     data = Message(data)
     function_name = "process_" + data.type.lower()
     dbg("got {}".format(function_name))
     for plugin in self.bot_plugins:
         plugin.register_jobs()
         plugin.do(function_name, data)
开发者ID:youknowone,项目名称:slairck,代码行数:7,代码来源:ircbot.py


示例10: register_terminal

 def register_terminal(self, terminal):
     """Register a new terminal widget"""
     if terminal not in self.terminals:
         dbg('Terminator::register_terminal: registering %s:%s' %
                 (id(terminal), type(terminal)))
         self.terminals.append(terminal)
         terminal.connect('ungroup-all', self.ungroup_all)
开发者ID:janisozaur,项目名称:terminator,代码行数:7,代码来源:terminator.py


示例11: get_pid_cwd

def get_pid_cwd():
    """Determine an appropriate cwd function for the OS we are running on"""

    func = lambda pid: None
    system = platform.system()

    if system == 'Linux':
        dbg('Using Linux get_pid_cwd')
        func = linux_get_pid_cwd
    elif system == 'FreeBSD':
        try:
            import freebsd
            func = freebsd.get_process_cwd
            dbg('Using FreeBSD get_pid_cwd')
        except (OSError, NotImplementedError, ImportError):
            dbg('FreeBSD version too old for get_pid_cwd')
    elif system == 'SunOS':
        dbg('Using SunOS get_pid_cwd')
        func = sunos_get_pid_cwd
    elif psutil_avail:
        func = psutil_cwd
    else:
        dbg('Unable to determine a get_pid_cwd for OS: %s' % system)

    return(func)
开发者ID:dannywillems,项目名称:terminator,代码行数:25,代码来源:cwd.py


示例12: create_layout

    def create_layout(self, layout):
        """Apply layout configuration"""
        if not layout.has_key('children'):
            err('layout specifies no children: %s' % layout)
            return

        children = layout['children']
        if len(children) != 2:
            # Paned widgets can only have two children
            err('incorrect number of children for Paned: %s' % layout)
            return

        keys = []

        # FIXME: This seems kinda ugly. All we want here is to know the order
        # of children based on child['order']
        try:
            child_order_map = {}
            for child in children:
                key = children[child]['order']
                child_order_map[key] = child
            map_keys = child_order_map.keys()
            map_keys.sort()
            for map_key in map_keys:
                keys.append(child_order_map[map_key])
        except KeyError:
            # We've failed to figure out the order. At least give the terminals
            # in the wrong order
            keys = children.keys()

        num = 0
        for child_key in keys:
            child = children[child_key]
            dbg('Making a child of type: %s' % child['type'])
            if child['type'] == 'Terminal':
                pass
            elif child['type'] == 'VPaned':
                if num == 0:
                    terminal = self.get_child1()
                else:
                    terminal = self.get_child2()
                self.split_axis(terminal, True)
            elif child['type'] == 'HPaned':
                if num == 0:
                    terminal = self.get_child1()
                else:
                    terminal = self.get_child2()
                self.split_axis(terminal, False)
            else:
                err('unknown child type: %s' % child['type'])
            num = num + 1

        self.get_child1().create_layout(children[keys[0]])
        self.get_child2().create_layout(children[keys[1]])

        # Set the position with ratio. For some reason more reliable than by pos.
        if layout.has_key('ratio'):
            self.ratio = float(layout['ratio'])
            self.set_position_by_ratio()
开发者ID:dannywillems,项目名称:terminator,代码行数:59,代码来源:paned.py


示例13: create_layout

    def create_layout(self, layout):
        """Apply layout configuration"""
        def child_compare(a, b):
            order_a = children[a]['order']
            order_b = children[b]['order']

            if (order_a == order_b):
                return 0
            if (order_a < order_b):
                return -1
            if (order_a > order_b):
                return 1

        if not layout.has_key('children'):
            err('layout specifies no children: %s' % layout)
            return

        children = layout['children']
        if len(children) <= 1:
            #Notebooks should have two or more children
            err('incorrect number of children for Notebook: %s' % layout)
            return

        num = 0
        keys = children.keys()
        keys.sort(child_compare)

        for child_key in keys:
            child = children[child_key]
            dbg('Making a child of type: %s' % child['type'])
            if child['type'] == 'Terminal':
                pass
            elif child['type'] == 'VPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, True)
            elif child['type'] == 'HPaned':
                page = self.get_nth_page(num)
                self.split_axis(page, False)
            num = num + 1

        num = 0
        for child_key in keys:
            page = self.get_nth_page(num)
            if not page:
                # This page does not yet exist, so make it
                self.newtab(children[child_key])
                page = self.get_nth_page(num)
            if layout.has_key('labels'):
                labeltext = layout['labels'][num]
                if labeltext and labeltext != "None":
                    label = self.get_tab_label(page)
                    label.set_custom_label(labeltext)
            page.create_layout(children[child_key])
            num = num + 1

        if layout.has_key('active_page'):
            self.set_current_page(int(layout['active_page']))
        else:
            self.set_current_page(0)
开发者ID:janisozaur,项目名称:terminator,代码行数:59,代码来源:notebook.py


示例14: new_tab

 def new_tab(self, options=dbus.Dictionary()):
     """Create a new tab"""
     dbg('dbus method called: new_tab with parameters %s'%(options))
     oldopts = self.terminator.config.options_get()
     oldopts.__dict__ = options
     self.terminator.config.options_set(oldopts)
     window = self.terminator.get_windows()[0]
     window.tab_new()
开发者ID:FreedomBen,项目名称:terminator,代码行数:8,代码来源:ipc.py


示例15: with_proxy

def with_proxy(func):
    """Decorator function to connect to the session dbus bus"""
    dbg('dbus client call: %s' % func.func_name)
    def _exec(*args, **argd):
        bus = dbus.SessionBus()
        proxy = bus.get_object(BUS_NAME, BUS_PATH)
        func(proxy, *args, **argd)
    return _exec
开发者ID:AmosZ,项目名称:terminal,代码行数:8,代码来源:ipc.py


示例16: new_window

 def new_window(self, options=dbus.Dictionary()):
     """Create a new Window"""
     dbg('dbus method called: new_window with parameters %s'%(options))
     oldopts = self.terminator.config.options_get()
     oldopts.__dict__ = options
     self.terminator.config.options_set(oldopts)
     self.terminator.create_layout(oldopts.layout)
     self.terminator.layout_done()
开发者ID:FreedomBen,项目名称:terminator,代码行数:8,代码来源:ipc.py


示例17: remove_widget

 def remove_widget(self, widget):
     """Remove all signal handlers for a widget"""
     if not self.cnxids.has_key(widget):
         dbg("%s not registered" % widget)
         return
     signals = self.cnxids[widget].keys()
     for signal in signals:
         self.remove_signal(widget, signal)
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:8,代码来源:signalman.py


示例18: relay

 def relay(self, bot, relay_ins):
     for data in relay_ins:
         if "type" in data:
             function_name = "relay_" + data["type"]
             dbg("got {}".format(function_name))
             for plugin in self.bot_plugins:
                 plugin.register_jobs()
                 plugin.do(function_name, bot, data)
开发者ID:youknowone,项目名称:slairck,代码行数:8,代码来源:bot.py


示例19: find_terminal_by_uuid

 def find_terminal_by_uuid(self, uuid):
     """Search our terminals for one matching the supplied UUID"""
     dbg('searching self.terminals for: %s' % uuid)
     for terminal in self.terminals:
         dbg('checking: %s (%s)' % (terminal.uuid.urn, terminal))
         if terminal.uuid.urn == uuid:
             return terminal
     return None
开发者ID:Reventl0v,项目名称:Terminator,代码行数:8,代码来源:terminator.py


示例20: find_window_by_uuid

 def find_window_by_uuid(self, uuid):
     """Search our terminals for one matching the supplied UUID"""
     dbg('searching self.terminals for: %s' % uuid)
     for window in self.windows:
         dbg('checking: %s (%s)' % (window.uuid.urn, window))
         if window.uuid.urn == uuid:
             return window
     return None
开发者ID:albfan,项目名称:terminator,代码行数:8,代码来源:terminator.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.debug函数代码示例发布时间:2022-05-27
下一篇:
Python util.datestr函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap