import os
import unittest

from common import gobject, gtk, testhelper

# Enable PyGILState API
os.environ['PYGTK_USE_GIL_STATE_API'] = ''

gobject.threads_init()

class TestThread(unittest.TestCase):
    def from_thread_cb(self, test, enum):
        assert test == self.obj
        assert int(enum) == 0
        assert type(enum) != int
        
    def idle_cb(self):
        self.obj = testhelper.get_test_thread()
        self.obj.connect('from-thread', self.from_thread_cb)
        self.obj.emit('emit-signal')

    def testExtensionModule(self):
        gtk.idle_add(self.idle_cb)
        gtk.timeout_add(50, self.timeout_cb)
        gtk.main()

    def timeout_cb(self):
        gtk.main_quit()

import os
import unittest

from common import gobject, gtk, testhelper

# Enable PyGILState API
os.environ['PYGTK_USE_GIL_STATE_API'] = ''

gobject.threads_init()

class TestThread(unittest.TestCase):
    def from_thread_cb(self, test, enum):
        assert test == self.obj
        assert int(enum) == 0
        assert type(enum) != int
        
    def idle_cb(self):
        self.obj = testhelper.get_test_thread()
        self.obj.connect('from-thread', self.from_thread_cb)
        self.obj.emit('emit-signal')

    def testExtensionModule(self):
        gobject.idle_add(self.idle_cb)
        gobject.timeout_add(50, self.timeout_cb)
        gtk.main()

    def timeout_cb(self):
        gtk.main_quit()

Add pygtk_postinstall.py Updated Deprecate gtk.idle_add and friends. Merge
Add pygtk_postinstall.py Updated Deprecate gtk.idle_add and friends. Merge

	* Makefile.am: Add pygtk_postinstall.py
	* docs/random/missing-symbols: Updated
	* gtk/__init__.py: Deprecate gtk.idle_add and friends.
	* gtk/gtk.defs:	Merge in 2.6 api, for GtkLabel functions,
	thanks to Gian Mario Tagliaretti, fixes bug #163296
	* tests/test_thread.py: Don't use gtk.idle_add

  import os
  import unittest
  
  from common import gobject, gtk, testhelper
  
  # Enable PyGILState API
  os.environ['PYGTK_USE_GIL_STATE_API'] = ''
  
  gobject.threads_init()
  
  class TestThread(unittest.TestCase):
      def from_thread_cb(self, test, enum):
          assert test == self.obj
          assert int(enum) == 0
          assert type(enum) != int
          
      def idle_cb(self):
          self.obj = testhelper.get_test_thread()
          self.obj.connect('from-thread', self.from_thread_cb)
          self.obj.emit('emit-signal')
  
      def testExtensionModule(self):
-         gtk.idle_add(self.idle_cb)
+         gobject.idle_add(self.idle_cb)
-         gtk.timeout_add(50, self.timeout_cb)
+         gobject.timeout_add(50, self.timeout_cb)
          gtk.main()
  
      def timeout_cb(self):
          gtk.main_quit()
  
Add pygtk_postinstall.py Updated Deprecate gtk.idle_add and friends. Merge
## Code Before:
import os
import unittest

from common import gobject, gtk, testhelper

# Enable PyGILState API
os.environ['PYGTK_USE_GIL_STATE_API'] = ''

gobject.threads_init()

class TestThread(unittest.TestCase):
    def from_thread_cb(self, test, enum):
        assert test == self.obj
        assert int(enum) == 0
        assert type(enum) != int
        
    def idle_cb(self):
        self.obj = testhelper.get_test_thread()
        self.obj.connect('from-thread', self.from_thread_cb)
        self.obj.emit('emit-signal')

    def testExtensionModule(self):
        gtk.idle_add(self.idle_cb)
        gtk.timeout_add(50, self.timeout_cb)
        gtk.main()

    def timeout_cb(self):
        gtk.main_quit()

## Instruction:
Add pygtk_postinstall.py Updated Deprecate gtk.idle_add and friends. Merge
## Code After:
import os
import unittest

from common import gobject, gtk, testhelper

# Enable PyGILState API
os.environ['PYGTK_USE_GIL_STATE_API'] = ''

gobject.threads_init()

class TestThread(unittest.TestCase):
    def from_thread_cb(self, test, enum):
        assert test == self.obj
        assert int(enum) == 0
        assert type(enum) != int
        
    def idle_cb(self):
        self.obj = testhelper.get_test_thread()
        self.obj.connect('from-thread', self.from_thread_cb)
        self.obj.emit('emit-signal')

    def testExtensionModule(self):
        gobject.idle_add(self.idle_cb)
        gobject.timeout_add(50, self.timeout_cb)
        gtk.main()

    def timeout_cb(self):
        gtk.main_quit()
