gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx demo/gldemo.py libpaper/textures.py lib...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx demo/gldemo.py libpaper/textures.py lib...
Date: Mon, 07 Oct 2002 12:29:29 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/07 12:29:29

Modified files:
        gfx/demo       : gldemo.py 
        gfx/libpaper   : textures.py 
        gfx/libutil    : myimport.py 

Log message:
        Make "r" reload all gfx.* modules that have __file__ attr; my_import is 
now just standard import

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/myimport.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/gldemo.py
diff -c gzz/gfx/demo/gldemo.py:1.34 gzz/gfx/demo/gldemo.py:1.35
*** gzz/gfx/demo/gldemo.py:1.34 Mon Oct  7 10:22:25 2002
--- gzz/gfx/demo/gldemo.py      Mon Oct  7 12:29:29 2002
***************
*** 227,238 ****
  def loadScenes():
      print "RELOAD"
  
!     if 0:
          # Reload gfx.* modules
          mods = sys.modules.keys()
          mods.sort()
          for mod in mods:
!             if mod[:4] == "gfx.":
                  print "Reloading", mod
                  reload(sys.modules[mod])
      
--- 227,238 ----
  def loadScenes():
      print "RELOAD"
  
!     if 1:
          # Reload gfx.* modules
          mods = sys.modules.keys()
          mods.sort()
          for mod in mods:
!             if mod[:4] == "gfx." and hasattr(sys.modules[mod], "__file__"):
                  print "Reloading", mod
                  reload(sys.modules[mod])
      
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.15 gzz/gfx/libpaper/textures.py:1.16
*** gzz/gfx/libpaper/textures.py:1.15   Mon Oct  7 10:22:25 2002
--- gzz/gfx/libpaper/textures.py        Mon Oct  7 12:29:29 2002
***************
*** 34,47 ****
  
      bintime = get_file_ctime(binfile)
      srctime = get_file_ctime(srcfile)
!     print binfile,bintime,srcfile,srctime
      if srctime > bintime:
          os.system("make -C gfx/libtexture " + name + ".bin")
          bintime = get_file_ctime(binfile)
          
      key = str(args)
      if texcache.has_key(key) and texcache[(key,"ctime")] == srctime:
!         print "Returning cached texture"
          return texcache[key]
  
      tex = GL.createTexture()
--- 34,47 ----
  
      bintime = get_file_ctime(binfile)
      srctime = get_file_ctime(srcfile)
! 
      if srctime > bintime:
          os.system("make -C gfx/libtexture " + name + ".bin")
          bintime = get_file_ctime(binfile)
          
      key = str(args)
      if texcache.has_key(key) and texcache[(key,"ctime")] == srctime:
!         #print "Returning cached texture"
          return texcache[key]
  
      tex = GL.createTexture()
Index: gzz/gfx/libutil/myimport.py
diff -c gzz/gfx/libutil/myimport.py:1.3 gzz/gfx/libutil/myimport.py:1.4
*** gzz/gfx/libutil/myimport.py:1.3     Mon Oct  7 10:58:14 2002
--- gzz/gfx/libutil/myimport.py Mon Oct  7 12:29:29 2002
***************
*** 52,83 ****
          dependencies[parentname] = {}
      dependencies[parentname][name] = 1
  
!     if name in sys.modules.keys():
          do_reload(name)
      else:
          print "Importing module", name
!         ctime = get_module_ctime(name)
!         mod = __import__(name)
!         components = name.split('.')
!         for comp in components[1:]:
!             mod = getattr(mod, comp)
!             
!         sys.modules[name] = mod
          import_times[name] = ctime
  
  
  def my_import_simple(name):
      """ Import the named module or reload if already imported
      """
!     if not name in sys.modules.keys():
!         print "Importing module", name
!         mod = __import__(name)
!         components = name.split('.')
!         for comp in components[1:]:
!             mod = getattr(mod, comp)
!         sys.modules[name] = mod
!     else:
          print "Reloading module", name
          reload(sys.modules[name])
  
! my_import = my_import_simple
--- 52,82 ----
          dependencies[parentname] = {}
      dependencies[parentname][name] = 1
  
!     if sys.modules.has_key(name):
          do_reload(name)
      else:
          print "Importing module", name
!         standard_import(name)
          import_times[name] = ctime
  
  
  def my_import_simple(name):
      """ Import the named module or reload if already imported
      """
!     if sys.modules.has_key(name):
          print "Reloading module", name
          reload(sys.modules[name])
+     else:
+         print "Importing module", name
+         standard_import(name)
+ 
+ def standard_import(name):
+     mod = __import__(name)
+     components = name.split('.')
+     for comp in components[1:]:
+         mod = getattr(mod, comp)
+     sys.modules[name] = mod
  
! #my_import = my_import_dep
! #my_import = my_import_simple
! my_import = standard_import




reply via email to

[Prev in Thread] Current Thread [Next in Thread]