Commit b4c005c3 authored by Stephen Kennedy's avatar Stephen Kennedy

pygtk/python modernisation patches (Kai Willadsen)

svn path=/trunk/; revision=1064
parent 16d0cf13
......@@ -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):
......
......@@ -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 @@ class EmblemCellRenderer(gtk.GenericCellRenderer):
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 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_reload_activate(self, *extra):
self.on_fileentry_activate(None)
if gobject.pygtk_version < (2,8,0):
gobject.type_register(DirDiff)
......@@ -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 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
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 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_linkmap_drag_begin(self, *args):
print args
if gobject.pygtk_version < (2,8,0):
gobject.type_register(FileDiff)
################################################################################
#
# Local Functions
......
......@@ -115,7 +115,7 @@ class ListWidget(gnomeglade.Component):
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 @@ class PreferencesDialog(gnomeglade.Component):
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 @@ class MeldApp(gnomeglade.Component):
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()
#
......
......@@ -139,5 +139,3 @@ class MeldDoc(gobject.GObject):
"""
pass
if gobject.pygtk_version < (2,8,0):
gobject.type_register(MeldDoc)
......@@ -18,7 +18,6 @@
"""
from __future__ import generators
import copy
import os
from gettext import gettext as _
......
......@@ -17,7 +17,6 @@
"""Classes to implement scheduling for cooperative threads.
"""
from __future__ import generators
import traceback
class SchedulerBase(object):
......
......@@ -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
......
......@@ -183,6 +183,3 @@ class UndoSequence(gobject.GObject):
else:
self.group = None
if gobject.pygtk_version < (2,8,0):
gobject.type_register(UndoSequence)
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment