meld r1064 - trunk



Author: stevek
Date: Thu Oct  2 21:34:54 2008
New Revision: 1064
URL: http://svn.gnome.org/viewvc/meld?rev=1064&view=rev

Log:
pygtk/python modernisation patches (Kai Willadsen)

Modified:
   trunk/diffutil.py
   trunk/dirdiff.py
   trunk/filediff.py
   trunk/meldapp.py
   trunk/melddoc.py
   trunk/misc.py
   trunk/task.py
   trunk/tree.py
   trunk/undo.py
   trunk/vcview.py

Modified: trunk/diffutil.py
==============================================================================
--- trunk/diffutil.py	(original)
+++ trunk/diffutil.py	Thu Oct  2 21:34:54 2008
@@ -14,7 +14,6 @@
 ### along with this program; if not, write to the Free Software
 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import generators
 import difflib
 
 def _null_or_space(s):

Modified: trunk/dirdiff.py
==============================================================================
--- trunk/dirdiff.py	(original)
+++ trunk/dirdiff.py	Thu Oct  2 21:34:54 2008
@@ -14,8 +14,6 @@
 ### along with this program; if not, write to the Free Software
 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import generators
-
 import paths
 import gnomeglade
 import gobject
@@ -149,21 +147,18 @@
 
     def on_render(self, window, widget, background_area, cell_area, expose_area, flags):
         r = self.renderer
-        r.set_property("pixbuf", self.pixbuf)
+        r.props.pixbuf = self.pixbuf
         r.render(window, widget, background_area, cell_area, expose_area, flags)
-        r.set_property("pixbuf", self.emblem)
+        r.props.pixbuf = self.emblem
         r.render(window, widget, background_area, cell_area, expose_area, flags)
 
     def on_get_size(self, widget, cell_area):
         if not hasattr(self, "size"):
             r = self.renderer
-            r.set_property("pixbuf", self.pixbuf)
+            r.props.pixbuf = self.pixbuf
             self.size = r.get_size(widget, cell_area)
         return self.size
 
-if gobject.pygtk_version < (2,8,0):
-    gobject.type_register(EmblemCellRenderer)
-
 ################################################################################
 #
 # TypeFilter
@@ -1038,5 +1033,3 @@
     def on_reload_activate(self, *extra):
         self.on_fileentry_activate(None)
 
-if gobject.pygtk_version < (2,8,0):
-    gobject.type_register(DirDiff)

Modified: trunk/filediff.py
==============================================================================
--- trunk/filediff.py	(original)
+++ trunk/filediff.py	Thu Oct  2 21:34:54 2008
@@ -14,8 +14,6 @@
 ### along with this program; if not, write to the Free Software
 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import generators
-
 import codecs
 import math
 import os
@@ -119,20 +117,16 @@
             text.set_wrap_mode( self.prefs.edit_wrap_lines )
             buf = text.get_buffer()
             self.bufferdata.append( MeldBufferData() )
-            def add_tag(name, props):
-                tag = buf.create_tag(name)
-                for p,v in props.items():
-                    tag.set_property(p,v)
-            add_tag("edited line",   {"background": self.prefs.color_edited_bg,
-                                      "foreground": self.prefs.color_edited_fg} )
-            add_tag("delete line",   {"background": self.prefs.color_delete_bg,
-                                      "foreground": self.prefs.color_delete_fg}  )
-            add_tag("replace line",  {"background": self.prefs.color_replace_bg,
-                                      "foreground": self.prefs.color_replace_fg} )
-            add_tag("conflict line", {"background": self.prefs.color_conflict_bg,
-                                      "foreground": self.prefs.color_conflict_fg} )
-            add_tag("inline line",   {"background": self.prefs.color_inline_bg,
-                                      "foreground": self.prefs.color_inline_fg} )
+            buf.create_tag("edited line",   background = self.prefs.color_edited_bg,
+                                            foreground = self.prefs.color_edited_fg)
+            buf.create_tag("delete line",   background = self.prefs.color_delete_bg,
+                                            foreground = self.prefs.color_delete_fg)
+            buf.create_tag("replace line",  background = self.prefs.color_replace_bg,
+                                            foreground = self.prefs.color_replace_fg)
+            buf.create_tag("conflict line", background = self.prefs.color_conflict_bg,
+                                            foreground = self.prefs.color_conflict_fg)
+            buf.create_tag("inline line",   background = self.prefs.color_inline_bg,
+                                            foreground = self.prefs.color_inline_fg)
 
         actions = (
             ("FilePopupSave",     gtk.STOCK_SAVE,       None,            None, _("Save the current file"), self.save),
@@ -1385,9 +1379,6 @@
     def on_linkmap_drag_begin(self, *args):
         print args
 
-if gobject.pygtk_version < (2,8,0):
-    gobject.type_register(FileDiff)
-
 ################################################################################
 #
 # Local Functions

Modified: trunk/meldapp.py
==============================================================================
--- trunk/meldapp.py	(original)
+++ trunk/meldapp.py	Thu Oct  2 21:34:54 2008
@@ -115,7 +115,7 @@
         def addTextCol(label, colnum, expand=0):
             model = view.get_model()
             rentext = gtk.CellRendererText()
-            rentext.set_property("editable", 1)
+            rentext.props.editable = 1
             def change_text(ren, row, text):
                 it = model.get_iter( (int(row),))
                 model.set_value( it, colnum, text)
@@ -335,8 +335,8 @@
             self.prefs.save_encoding = self.save_encoding.index(radio)
     def on_response(self, dialog, arg):
         if arg==gtk.RESPONSE_CLOSE:
-            self.prefs.text_codecs = self.entry_text_codecs.get_property("text")
-            self.prefs.edit_command_custom = self.custom_edit_command_entry.get_property("text")
+            self.prefs.text_codecs = self.entry_text_codecs.props.text
+            self.prefs.edit_command_custom = self.custom_edit_command_entry.props.text
         self.widget.destroy()
 
 ################################################################################
@@ -756,8 +756,8 @@
 
     def on_menu_about_activate(self, *extra):
         about = gtk.glade.XML(paths.share_dir("glade2/meldapp.glade"),"about").get_widget("about")
-        about.set_property("name", "Meld")
-        about.set_property("version", version)
+        about.props.name = "Meld"
+        about.props.version = version
         about.show()
 
     #

Modified: trunk/melddoc.py
==============================================================================
--- trunk/melddoc.py	(original)
+++ trunk/melddoc.py	Thu Oct  2 21:34:54 2008
@@ -139,5 +139,3 @@
         """
         pass
 
-if gobject.pygtk_version < (2,8,0):
-    gobject.type_register(MeldDoc)

Modified: trunk/misc.py
==============================================================================
--- trunk/misc.py	(original)
+++ trunk/misc.py	Thu Oct  2 21:34:54 2008
@@ -18,7 +18,6 @@
 
 """
 
-from __future__ import generators
 import copy
 import os
 from gettext import gettext as _

Modified: trunk/task.py
==============================================================================
--- trunk/task.py	(original)
+++ trunk/task.py	Thu Oct  2 21:34:54 2008
@@ -17,7 +17,6 @@
 """Classes to implement scheduling for cooperative threads.
 """
 
-from __future__ import generators
 import traceback
 
 class SchedulerBase(object):

Modified: trunk/tree.py
==============================================================================
--- trunk/tree.py	(original)
+++ trunk/tree.py	Thu Oct  2 21:34:54 2008
@@ -14,7 +14,6 @@
 ### along with this program; if not, write to the Free Software
 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import generators
 import os
 import gtk
 import misc

Modified: trunk/undo.py
==============================================================================
--- trunk/undo.py	(original)
+++ trunk/undo.py	Thu Oct  2 21:34:54 2008
@@ -183,6 +183,3 @@
         else:
             self.group = None
 
-if gobject.pygtk_version < (2,8,0):
-    gobject.type_register(UndoSequence)
-

Modified: trunk/vcview.py
==============================================================================
--- trunk/vcview.py	(original)
+++ trunk/vcview.py	Thu Oct  2 21:34:54 2008
@@ -14,8 +14,6 @@
 ### along with this program; if not, write to the Free Software
 ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import generators
-
 import tempfile
 import shutil
 import gtk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]