~ubuntu-branches/ubuntu/precise/gnome-games/precise-proposed

« back to all changes in this revision

Viewing changes to gnome-sudoku/src/lib/gtk_goodies/Undo.py

  • Committer: Package Import Robot
  • Author(s): Rodrigo Moya
  • Date: 2011-05-30 13:32:04 UTC
  • mfrom: (1.3.4)
  • mto: (163.1.3 precise)
  • mto: This revision was merged to the branch mainline in revision 143.
  • Revision ID: package-import@ubuntu.com-20110530133204-celaq1v1dsxc48q1
Tags: upstream-3.0.2
ImportĀ upstreamĀ versionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
 
import gtk, difflib,re
 
2
from gi.repository import Gtk
 
3
import difflib,re
3
4
DEBUG=False
4
5
def debug (*args,**kwargs):
5
6
    if DEBUG: print args,kwargs
303
304
            w.set_sensitive(val)
304
305
            debug('%s.set_sensitive succeeded'%w,0)
305
306
        except AttributeError:
306
 
            # 2.6 will give gtk.Action a set_sensitive property, but for now...
307
 
            #if type(w)==gtk.Action:
 
307
            # 2.6 will give Gtk.Action a set_sensitive property, but for now...
 
308
            #if type(w)==Gtk.Action:
308
309
            for p in w.get_proxies():
309
310
                debug('setting %s sensitivity to %s'%(w,val),0)
310
311
                #p.set_sensitive(val)
330
331
                debug('Sensitizing "reapply" widgets',0)
331
332
                self.set_sensitive(self.reapply_widget,True)
332
333
                if self[-1].reapply_name:
333
 
                    if type(self.reapply_widget)==gtk.MenuItem:
 
334
                    if type(self.reapply_widget)==Gtk.MenuItem:
334
335
                        alabel = self.reapply_widget.get_children()[0]
335
336
                        alabel.set_text_with_mnemonic(self[-1].reapply_name)
336
337
                        alabel.set_use_markup(True)
441
442
    #while txt:
442
443
    #    txt = raw_input('Text: ')
443
444
    #    history[-1].add_text(txt)
444
 
    import gtk
445
 
    w = gtk.Window()
446
 
    e = gtk.Entry()
447
 
    tv = gtk.TextView()
448
 
    ub = gtk.Button(stock=gtk.STOCK_UNDO)
449
 
    rb = gtk.Button(stock=gtk.STOCK_REDO)
450
 
    sc = gtk.Button('show changes')
451
 
    vb = gtk.VBox()
452
 
    bb = gtk.HButtonBox()
 
445
    from gi.repository import Gtk
 
446
    w = Gtk.Window()
 
447
    e = Gtk.Entry()
 
448
    tv = Gtk.TextView()
 
449
    ub = Gtk.Button(stock=Gtk.STOCK_UNDO)
 
450
    rb = Gtk.Button(stock=Gtk.STOCK_REDO)
 
451
    sc = Gtk.Button('show changes')
 
452
    vb = Gtk.VBox()
 
453
    bb = Gtk.HButtonBox()
453
454
    bb.add(ub)
454
455
    bb.add(rb)
455
456
    bb.add(sc)
461
462
    UndoableTextView(tv,uhl)
462
463
    UndoableEntry(e,uhl)
463
464
    w.show_all()
464
 
    w.connect('delete-event',lambda *args:gtk.main_quit())
 
465
    w.connect('delete-event',lambda *args:Gtk.main_quit())
465
466
    def show_changes (*args):
466
467
        for c in uhl:
467
468
            print c,' initial: ',c.initial_text,' current: ',c.text
468
469
    ub.connect('clicked',lambda *args: debug('Undo clicked!',0))
469
470
    sc.connect('clicked',show_changes)
470
471
    rb.connect('clicked',lambda *args: debug('Redo clicked!',0))    
471
 
    gtk.main()
 
472
    Gtk.main()
472
473
 
473
474