[Xfce4-commits] <thunarx-python:master> Added a real working renamer example

Adam Plumb noreply at xfce.org
Thu May 27 18:10:53 CEST 2010


Updating branch refs/heads/master
         to 9bec784b9617e413ec7fc0ecf17fbd8cc7ae1d92 (commit)
       from 26e50d58b3ae29655ce8355561df403aa9ef35db (commit)

commit 9bec784b9617e413ec7fc0ecf17fbd8cc7ae1d92
Author: Adam Plumb <adamplumb at gmail.com>
Date:   Mon Jan 11 12:28:26 2010 -0500

    Added a real working renamer example

 examples/thunarx-renamer-plugin.py |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/examples/thunarx-renamer-plugin.py b/examples/thunarx-renamer-plugin.py
index 0e25243..9dde971 100644
--- a/examples/thunarx-renamer-plugin.py
+++ b/examples/thunarx-renamer-plugin.py
@@ -1,11 +1,41 @@
 import thunarx
 import gtk
 
+class ThunarxPythonRenamer(thunarx.Renamer):
+  __gtype_name__ = "ThunarxPythonRenamer"
+  
+  def __init__(self):
+    thunarx.Renamer.__init__(self)
+    
+    self.set_name("Adam's Renamer")
+    self.set_help_url("http://www.google.com")
+    
+    hbox = gtk.HBox(0, False)
+    
+    label = gtk.Label("Setting 1:")
+    hbox.pack_start(label, False, False, 0)
+    
+    entry = gtk.Entry()
+    entry.connect("changed", self.changed)
+    hbox.pack_start(entry, False, False, 0)
+    
+    label.show()
+    entry.show()
+    self.add(hbox)
+    hbox.show()    
+  
+  def process(self, file, text, index):
+    return "__" + text
+
+  def changed(self, widget):
+    print "changed"
+
+  do_process = process
+  do_changed = changed
+
 class ThunarxRenamerPlugin(thunarx.RenamerProvider):
   def __init__(self):
     pass
   
   def get_renamers(self):
-    return []
-  
-  
+    return [ThunarxPythonRenamer()]



More information about the Xfce4-commits mailing list