diff options
author | Nostalghia <b.vehikel@googlemail.com> | 2010-06-17 17:43:01 (GMT) |
---|---|---|
committer | Nostalghia <b.vehikel@googlemail.com> | 2010-06-17 17:43:01 (GMT) |
commit | ad2d12f3e64dc7ada866d750ebf08f3cad8f9a91 (patch) | |
tree | 84227134029be9e10ae1a0daded0f26f0fdd5ff1 /ka_widget.py | |
parent | 1c85682c78b69b1799c190bafa898ca2ca1bc2ca (diff) |
Removing Glade for Kandid to make it more compatible with the Sugar Platform (SP).
Glade is availble in SoaS and Glade could be installed in most cases. But it is not part of http://wiki.sugarlabs.org/go/0.88/Platform_Components and there is no guaranty that Glade will exists on sugar box.
Diffstat (limited to 'ka_widget.py')
-rw-r--r-- | ka_widget.py | 110 |
1 files changed, 58 insertions, 52 deletions
diff --git a/ka_widget.py b/ka_widget.py index b88c148..077db00 100644 --- a/ka_widget.py +++ b/ka_widget.py @@ -15,13 +15,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import gtk -import gtk.glade +#import gtk.glade import os import sys import traceback from gettext import gettext as _ import ka_controller import ka_debug +import no_glade class KandidWidget(object): """ @@ -31,22 +32,27 @@ class KandidWidget(object): def __init__(self, main_view): # Create GUI and attach that widget to our window # Load Glade XML - self._widget_tree = gtk.glade.XML("kandid.glade") - - # Get Window - kandidWindow = self._widget_tree.get_widget('kandidWindow') - # Get Windows child - kandidWindow_child = kandidWindow.get_child() +# self._widget_tree = gtk.glade.XML("kandid.glade") +# +# # Get Window +# kandidWindow = self._widget_tree.get_widget('kandidWindow') +# # Get Windows child +# kandidWindow_child = kandidWindow.get_child() - # Remove the widget's parent - if kandidWindow_child.parent: - kandidWindow_child.parent.remove(kandidWindow_child) +# glade_replacement = no_glade.NoGlade() + kandidNotebook = no_glade.NoGlade.get_notebook() + self._widget_tree = no_glade.NoGlade.getWidget_tree() +# # Get Windows child +# kandidWindow_child = kandidWindow.get_child() +# # Remove the widget's parent +# if kandidWindow_child.parent: +# kandidWindow_child.parent.remove(kandidWindow_child) # self.widget will be attached to the Activity # This can be any GTK widget except a window - main_view.pack_start(kandidWindow_child) + main_view.pack_start(kandidNotebook) - self._localizePopulation() +# self._localizePopulation() # Display everything def getWidget_tree(self): @@ -54,46 +60,46 @@ class KandidWidget(object): widget_tree = property(getWidget_tree) - def _localizePopulation(self): - try: - local = {'breedGenerationButton' : _('Breed'), - 'randomGenerationButton' : _('Random'), - 'flurryLabel' : _('Flurry rate:'), - 'populationLabel' : _('Population'), - 'zoomLabel' : _('Zoom'), - 'introLabel' : _('Introduction'), - 'statusLabel' : _('Status'), - 'ancestorsLabel' : _('Ancestors'), - } - for key, label in local.iteritems(): - self._widget_tree.get_widget(key).set_label(label) -# ka_debug.info('localize "%s" to "%s"' % (key, label)) - - for cell_index in range(ka_controller.POPULATION_CAPACITY): - local = {'favorite_menuitem_#' : _('My favorite'), - 'awfull_menuitem_#' : _('Awful bore, replace it'), - 'publishprotozoon_menuitem_#' : _('Publish to my friends'), - 'zoomprotozoon_menuitem_#' : _('Zoom'), - 'exportpng_menuitem_#' : _('Send image to journal'), - } - self._set_localized_child_text(local, cell_index) - - for cell_index in range(ka_controller.INCOMMING_CAPACITY): - local = {'accept_menuitem_#' : _('Accept protozoon'), - 'decline_menuitem_#' : _('Decline protozoon'), - } - self._set_localized_child_text(local, cell_index) - except: - ka_debug.err('localize population failed [%s] [%s]' % \ - (sys.exc_info()[0], sys.exc_info()[1])) - traceback.print_exc(file=sys.__stderr__) - - def _set_localized_child_text(self, local, cell_index): - strix = str(cell_index) - for key, label in local.iteritems(): - ikey = key if cell_index < 0 else key.replace('#', strix) - self._widget_tree.get_widget(ikey).get_child().set_text(label) -# ka_debug.info('localize "%s" to "%s"' % (ikey, label)) +# def _localizePopulation(self): +# try: +# local = {'breedGenerationButton' : _('Breed'), +# 'randomGenerationButton' : _('Random'), +# 'flurryLabel' : _('Flurry rate:'), +# 'populationLabel' : _('Population'), +# 'zoomLabel' : _('Zoom'), +# 'introLabel' : _('Introduction'), +# 'statusLabel' : _('Status'), +# 'ancestorsLabel' : _('Ancestors'), +# } +# for key, label in local.iteritems(): +# self._widget_tree.get_widget(key).set_label(label) +## ka_debug.info('localize "%s" to "%s"' % (key, label)) +# +# for cell_index in range(ka_controller.POPULATION_CAPACITY): +# local = {'favorite_menuitem_#' : _('My favorite'), +# 'awfull_menuitem_#' : _('Awful bore, replace it'), +# 'publishprotozoon_menuitem_#' : _('Publish to my friends'), +# 'zoomprotozoon_menuitem_#' : _('Zoom'), +# 'exportpng_menuitem_#' : _('Send image to journal'), +# } +# self._set_localized_child_text(local, cell_index) +# +# for cell_index in range(ka_controller.INCOMMING_CAPACITY): +# local = {'accept_menuitem_#' : _('Accept protozoon'), +# 'decline_menuitem_#' : _('Decline protozoon'), +# } +# self._set_localized_child_text(local, cell_index) +# except: +# ka_debug.err('localize population failed [%s] [%s]' % \ +# (sys.exc_info()[0], sys.exc_info()[1])) +# traceback.print_exc(file=sys.__stderr__) +# +# def _set_localized_child_text(self, local, cell_index): +# strix = str(cell_index) +# for key, label in local.iteritems(): +# ikey = key if cell_index < 0 else key.replace('#', strix) +# self._widget_tree.get_widget(ikey).get_child().set_text(label) +## ka_debug.info('localize "%s" to "%s"' % (ikey, label)) @staticmethod def get_localization(): |