2013-01-16 58 views

回答

2

这是一个非常好的tutorial on writing gedit 3 plugins。示例#3可以实现您想要的功能:连接到“打开新选项卡”信号并写入文档名称。

在这里你有完整的Gedit API reference

handler_id = self.window.connect("tab-added", self.on_tab_added) 

(...) 

def on_tab_added(self, window, tab, data=None): 
    document = tab.get_document() 
    print "'%s' has been added." % document.get_short_name_for_display() 
    print "New file's path: %s" % document.get_uri_for_display() 
+0

干杯。如果他们在Python中有一个参考,那么会更好,因为作为Python开发人员将会更清楚。 –

+0

习惯阅读C文档,是最好的文档。而且,由于python绑定是自动生成的,所以很容易从C中“翻译”到python:**(C)** gedit_document_goto_line(doc,line) - > **(python)** doc.goto_line(line) –

相关问题