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


Python util.dbg函数代码示例

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


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


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