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

Python util.dbg函数代码示例

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

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



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

示例1: __init__

 def __init__(self):
     super(TerminalExporter, self).__init__()
     self.config = Config()
     self.plugin_config = parse_plugin_config(self.config)
     self.logging_terminals = {}
     self.scrollback_lines = self.config['scrollback_lines']
     dbg('using config: %s' % self.plugin_config)
开发者ID:aedis,项目名称:TerminatorPlugins,代码行数:7,代码来源:TerminalExporter.py


示例2: __init__

 def __init__(self):
     plugin.MenuItem.__init__(self)
     self.config = Config()
     self.pluginConfig = parsePluginConfig(self.config)
     self.loggingTerminals = {}
     self.scrollbackLines = self.config['scrollback_lines']
     dbg("using config: %s" % self.pluginConfig)
开发者ID:sfate,项目名称:TerminatorPlugins,代码行数:7,代码来源:TerminalExporter.py


示例3: get_last_line

    def get_last_line(self, terminal):
        """Retrieve last line of terminal (contains '[email protected]')"""
        ret=None
        vte = terminal.get_vte()

        cursor = vte.get_cursor_position()
        column_count = vte.get_column_count()
        row_position = cursor[1]
        
        start_row = row_position
        start_col = 0
        end_row = row_position
        end_col = column_count
        is_interesting_char = lambda a, b, c, d: True

        """ manage text wrapping :
        usecases :
        - PS1 too long
        - componant of PS1 forcing display on several lines (e.g working directory)
        - window resizing
        - ...
        So, very ugly algorithm
        if current line too short, we assume prompt is wrapped
        we the search for 1st line of prompt, that is : first line following the
        last line containing LF
        we iterate back until LF found (means : end of output of last command), 
        then forward one line
        """
        lines= vte.get_text_range(start_row, start_col, end_row, end_col, is_interesting_char)

        if lines and lines[0]:
            # line too short, iterate back
            if len(lines)<=self.prompt_minlen:
                dbg("line below prompt min size of "+str(self.prompt_minlen)+ " chars : must iterate back '"+lines+"'")
                start_row=start_row-1
                end_row=start_row
                lines = vte.get_text_range(start_row, start_col, end_row, end_col, is_interesting_char)
                prev_lines=lines
                # we iterate back to first line of terminal, including history...
                while lines != None and start_row>=0:
                    # LF found, PS1 first line is next line... eeeer previous pushed line
                    if lines[len(lines)-1] == '\n':
                        lines=prev_lines
                        break
                    
                    lines = vte.get_text_range(start_row, start_col, end_row, end_col, is_interesting_char)
                    start_row=start_row-1
                    end_row=start_row                        
                    prev_lines=lines
                    
        lines=lines.splitlines()
        if lines and lines[0]:
            if len(lines[0])>=self.line_minlen:
                ret=lines[0]
            else:
                # should never happen since we browse back in history
                dbg("line '"+lines[0]+"' too short, won't use : "+str(len(lines[0])))
        
        return ret
开发者ID:GratefulTony,项目名称:TerminatorHostWatch,代码行数:59,代码来源:host_watch.py


示例4: set_cwd

 def set_cwd(self, cwd=None):
     if cwd is None:
         cwd = self.terminal.get_cwd()
     if cwd == self.cwd:
         return
     self.cwd = cwd
     cwd = self.clisnips.SetWorkingDirectory(cwd)
     dbg('clisnips.SetWorkingDirectory "%s"' % cwd)
开发者ID:ju1ius,项目名称:clisnips,代码行数:8,代码来源:clisnips_plugin.py


示例5: watch

 def watch(self, _widget, terminal):
     """Watch a terminal"""
     vte = terminal.get_vte()
     self.watches[terminal] = vte.connect('contents-changed',
                                          self.reset_timer, terminal)
     timeout_id = gobject.timeout_add(5000, self.check_times, terminal)
     self.timers[terminal] = timeout_id
     dbg('timer %s added for %s' %(timeout_id, terminal))
开发者ID:davetcoleman,项目名称:unix_settings,代码行数:8,代码来源:activitywatch.py


示例6: spawn

def spawn(env):
  PythonConsoleServer.env = env
  tcpserver = SocketServer.TCPServer(('127.0.0.1', 0), PythonConsoleServer)
  dbg("debugserver: listening on %s" % str(tcpserver.server_address))
  debugserver = threading.Thread(target=tcpserver.serve_forever, name="DebugServer")
  debugserver.setDaemon(True)
  debugserver.start()
  return(debugserver, tcpserver)
开发者ID:AmosZ,项目名称:terminal,代码行数:8,代码来源:debugserver.py


示例7: on_resize

 def on_resize(self, widget, allocation):
     # current = self.term.vte.get_font()
     config = pango.FontDescription(self.term.config['font'])
     # dbg(current.get_size())
     dbg(config.get_size())
     dbg(allocation)
     if allocation.width < 600 or allocation.height < 400:
         config.set_size(int(config.get_size() * 0.85))
     self.term.set_font(config)
开发者ID:blmarket,项目名称:home_base,代码行数:9,代码来源:autofont.py


示例8: on_terminal_key_pressed

 def on_terminal_key_pressed(self, vt, event):
     kv = event.keyval
     if kv in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
         # Although we registered the emission hook on vte.Terminal,
         # the event is also fired by terminatorlib.window.Window ...
         if isinstance(vt, vte.Terminal):
             dbg('CliSnipsMenu :: Enter pressed %s' % vt)
             self.on_keypress_enter()
     return True
开发者ID:ju1ius,项目名称:clisnips,代码行数:9,代码来源:clisnips_plugin.py


示例9: callback

 def callback(self, menuitems, menu, terminal):
     """Add our menu item to the menu"""
     item = gtk.CheckMenuItem(_("Watch for _silence"))
     item.set_active(self.watches.has_key(terminal))
     if item.get_active():
         item.connect("activate", self.unwatch, terminal)
     else:
         item.connect("activate", self.watch, terminal)
     menuitems.append(item)
     dbg('Menu items appended')
开发者ID:dannywillems,项目名称:terminator,代码行数:10,代码来源:activitywatch.py


示例10: callback

 def callback(self, menuitems, menu, terminal):
     """Add our menu items to the menu"""
     if not self.watches.has_key(terminal):
         item = gtk.MenuItem(_("Watch for silence"))
         item.connect("activate", self.watch, terminal)
     else:
         item = gtk.MenuItem(_("Stop watching for silence"))
         item.connect("activate", self.unwatch, terminal)
     menuitems.append(item)
     dbg('Menu items appended')
开发者ID:davetcoleman,项目名称:unix_settings,代码行数:10,代码来源:activitywatch.py


示例11: callback

 def callback(self, menuitems, menu, terminal):
     """Add our menu item to the menu"""
     item = Gtk.CheckMenuItem.new_with_mnemonic(_('Watch for _activity'))
     item.set_active(self.watches.has_key(terminal))
     if item.get_active():
         item.connect("activate", self.unwatch, terminal)
     else:
         item.connect("activate", self.watch, terminal)
     menuitems.append(item)
     dbg('Menu item appended')
开发者ID:guoxiao,项目名称:terminator-gtk3,代码行数:10,代码来源:activitywatch.py


示例12: tryAddLayoutMenuItem

 def tryAddLayoutMenuItem(self, name, terminal, menu):
     (isLayout, shortname) = self.tryGetLayoutShortName(name)
     if isLayout:
         layoutItem = gtk.MenuItem(_(shortname))
         layoutItem.connect(EVENT_ACTIVATE, self.loadCallback, terminal)
         menu.append(layoutItem)
         return True
     else:
         dbg("ignoring [%s] : %s" % (name, shortname))
         return False               
开发者ID:sfate,项目名称:TerminatorPlugins,代码行数:10,代码来源:LayoutManager.py


示例13: writeXmlToFile

 def writeXmlToFile (self, element, filename = None):
     if filename is None:
         newFilename = inputBox(title=SAVE_BOX_TITLE, message=SAVE_BOX_MESSAGE, default_text="")
         if not (newFilename is None or newFilename == ""):
             self.writeXmlToFile(element, newFilename)
         else:
             dbg("no filename provided; abort saving")
     else:           
         targetFileName = join(self.configDir,filename)
         targetFileName = targetFileName + LAYOUT_EXTENSION
         ET.ElementTree(element).write(targetFileName)
开发者ID:sfate,项目名称:TerminatorPlugins,代码行数:11,代码来源:LayoutManager.py


示例14: write_xml_to_file

    def write_xml_to_file(self, element, filename=None):
        if filename is None:
            new_filename = input_box(title=SAVE_BOX_TITLE,
                                     message=SAVE_BOX_MESSAGE, default_text="")
            if not (new_filename is None or new_filename == ""):
                return self.write_xml_to_file(element, new_filename)
            else:
                dbg('no filename provided; abort saving')
                return

        target_filename = join(self.config_dir, filename)
        target_filename += LAYOUT_EXTENSION
        ElementTree.ElementTree(element).write(target_filename)
开发者ID:aedis,项目名称:TerminatorPlugins,代码行数:13,代码来源:LayoutManager.py


示例15: try_add_layout_menu_item

 def try_add_layout_menu_item(self, name, terminal, menu):
     """
     Checks if given file is a layout and add a context menu item if so.
     @param name: The file name of the possible layout.
     @param terminal: The terminal this context menu item belongs to.
     @param menu: Full gtk menu instance; not used here.
     """
     is_layout, short_name = self.try_get_layout_short_name(name)
     if is_layout:
         layout_item = gtk.MenuItem(short_name)
         layout_item.connect(EVENT_ACTIVATE, self.load_callback, terminal)
         menu.append(layout_item)
         return True
     dbg('ignoring [%s] : %s' % (name, short_name))
     return False
开发者ID:aedis,项目名称:TerminatorPlugins,代码行数:15,代码来源:LayoutManager.py


示例16: check_times

    def check_times(self, terminal):
        """Check if this terminal has gone silent"""
        time_now = time.mktime(time.gmtime())
        if not self.last_activities.has_key(terminal):
            dbg('Terminal %s has no last activity' % terminal)
            return True

        dbg('seconds since last activity: %f (%s)' % (time_now - self.last_activities[terminal], terminal))
        if time_now - self.last_activities[terminal] >= 10.0:
            del(self.last_activities[terminal])
            note = pynotify.Notification('Terminator', 'Silence in: %s' % 
                                         terminal.get_window_title(), 'terminator')
            note.show()

        return True
开发者ID:adiabuk,项目名称:arch-tf701t,代码行数:15,代码来源:activitywatch.py


示例17: doExport

 def doExport(self, widget, terminal):
     """
     Export complete terminal content into file.
     """
     vte = terminal.get_vte()
     (startRow, endRow, endColumn) = self.getVteBufferRange(vte)
     content = vte.get_text_range(startRow, 0, endRow, endColumn, 
                                 lambda widget, col, row, junk: True)
     filename = self.getFilename()
     with open(filename, "w") as outputFile: 
         outputFile.writelines(content)
         outputFile.close()
     dbg("terminal content written to [%s]" % filename)
     if self.pluginConfig[SETTING_EXPORT_ENV] != "":
         terminal.feed('%s="%s"\n' % (self.pluginConfig[SETTING_EXPORT_ENV] ,filename))
     return filename
开发者ID:sfate,项目名称:TerminatorPlugins,代码行数:16,代码来源:TerminalExporter.py


示例18: tryAddLayoutMenuItem

 def tryAddLayoutMenuItem(self, name, terminal, menu):
     """
     Checks if given file is a layout and add a context menu item if so.
     @param name: The file name of the possible layout.
     @param terminal: The terminal this context menu item belongs to.
     @param menu: Full gtk menu instance; not used here.
     """
     isLayout, shortname = self.tryGetLayoutShortName(name)
     if isLayout:
         layoutItem = gtk.MenuItem(_(shortname))
         layoutItem.connect(EVENT_ACTIVATE, self.loadCallback, terminal)
         menu.append(layoutItem)
         return True
     else:
         dbg("ignoring [%s] : %s" % (name, shortname))
         return False
开发者ID:farzeni,项目名称:TerminatorPlugins,代码行数:16,代码来源:LayoutManager.py


示例19: check_host

    def check_host(self, _vte, terminal):
        """Our host might have changed..."""
        self.update_watches()

        last_line = self.get_last_line(terminal)
        

        if last_line:
            patterns = self.get_patterns()
            for profile, pattern in patterns.iteritems():
                match = re.match(pattern, last_line)
                if match:
                    if profile in self.profiles and profile != terminal.get_profile():
                        dbg("switching to profile : "+profile)
                        terminal.set_profile(None, profile, False)
        return True
开发者ID:fgiroud,项目名称:TerminatorHostWatch,代码行数:16,代码来源:host_watch.py


示例20: do_export

 def do_export(self, _, terminal):
     """
     Export complete terminal content into file.
     """
     vte = terminal.get_vte()
     (start_row, end_row, end_column) = self.get_vte_buffer_range(vte)
     content = vte.get_text_range(start_row, 0, end_row, end_column,
                                  lambda widget, col, row, junk: True)
     filename = self.get_filename()
     with open(filename, "w") as output_file:
         output_file.writelines(content)
         output_file.close()
     dbg('terminal content written to [%s]' % filename)
     if self.plugin_config[SETTING_EXPORT_ENV] != '':
         terminal.feed('%s="%s"\n' % (self.plugin_config[SETTING_EXPORT_ENV], filename))
     return filename
开发者ID:aedis,项目名称:TerminatorPlugins,代码行数:16,代码来源:TerminalExporter.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.err函数代码示例发布时间:2022-05-27
下一篇:
Python translation._函数代码示例发布时间: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