Features/GTK3: Difference between revisions

No edit summary
Line 63: Line 63:


* The new GTK3 version of sugar toolkit would be installed with name <tt>sugar</tt>, and the old GTK2 version would be installed with name <tt>sugar_gtk2</tt>.
* The new GTK3 version of sugar toolkit would be installed with name <tt>sugar</tt>, and the old GTK2 version would be installed with name <tt>sugar_gtk2</tt>.
* Before <tt>sugar-activity</tt> imports sugar.activity (or any other sugar-toolkit class), it would look for an empty file called "GTK3_PORTED" in the activity's directory. If present, the GTK3_PORTED environment variable would be set.
* Before <tt>sugar-activity</tt> imports sugar.activity (or any other sugar-toolkit class), it would look for an empty file called "GTK3_PORTED" in the activity's directory. If present, it would run a little trick:
* sugar/__init__.py would then include the following code snippet:
  import os
  import os
  import sys
  import sys
  if not 'GTK3_PORTED' in os.environ:
  if not os.path.exists("GTK3_PORTED"):
     import sugar_gtk2
     import sugar_gtk2
     sys.modules["sugar"] = sugar_gtk2
     sys.modules["sugar"] = sugar_gtk2
* The result is that all unported/unmodified activities (without the GTK3_PORTED file) would <tt>import sugar.foo</tt> as before, but the above trick that modifies Python's module table would result in them (transparently, magically, automatically) being redirected to sugar_gtk2.foo.
* The result is that all unported/unmodified activities (without the GTK3_PORTED file) would <tt>import sugar.foo</tt> as before, but the above trick that modifies Python's module table would result in them (transparently, magically, automatically) being redirected to sugar_gtk2.foo.
* At the end of the transition period, sugar_gtk2 would be deleted in entirity, the above addition to sugar/__init__.py would be dropped, and activities could drop the GTK3_PORTED files at their leisure.
* At the end of the transition period, sugar_gtk2 would be deleted in entirity, the above addition to sugar-activity would be dropped, and activities could drop the GTK3_PORTED files at their leisure.


=== Proposed plan of action ===
=== Proposed plan of action ===