Features/GTK3: Difference between revisions
DanielDrake (talk | contribs) No edit summary |
DanielDrake (talk | contribs) |
||
| 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, | * 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: | ||
import os | import os | ||
import sys | import sys | ||
if not | 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 | * 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 === | ||