def create_toolbar( self): self.toolbar_box = gtk.HandleBox() toolbar = gnutr_widgets.GnutrToolbar() tooltips = gtk.Tooltips() self.toolbar_box.add( toolbar) self.open_button = toolbar.append_button( 'gtk-open', "Open", tooltips, "Open recipe from database") self.save_button = toolbar.append_button( 'gtk-save', "Save", tooltips, "Save recipe to database") self.clear_button = toolbar.append_button( 'gtk-refresh', "Clear", tooltips, "Clear recipe") sep = gtk.SeparatorToolItem() toolbar.insert( sep, -1) self.add_button = toolbar.append_button( 'gtk-add', "Add", tooltips, "Add food to recipe") self.delete_button = toolbar.append_button( 'gtk-remove', "Delete", tooltips, "Delete food from recipe") self.edit_button = toolbar.append_button( 'gtk-undo', "Edit", tooltips, "Edit food in recipe") sep = gtk.SeparatorToolItem() toolbar.insert( sep, -1) self.nutr_button = toolbar.append_button( 'gtk-execute', "Nutrients", tooltips, "Display recipe nutrient totals") self.goal_button = toolbar.append_button( 'gtk-properties', "Goals", tooltips, "Nutrition goals") # icon9 = gtk.Image() # icon9.set_from_stock( 'gtk-execute', gtk.ICON_SIZE_LARGE_TOOLBAR) # self.graph_button = toolbar.append_item( "Graph", # "Display graph of recipe nutrient totals", None, icon9, # None, None) self.toolbar_box.show_all()
def create_toolbar( self): self.toolbar_box = gtk.HandleBox() toolbar = gnutr_widgets.GnutrToolbar() tooltips = gtk.Tooltips() self.toolbar_box.add( toolbar) self.save_button = toolbar.append_button( 'gtk-save', 'Save', tooltips, 'Save meal plan') sep = gtk.SeparatorToolItem() toolbar.insert(sep, -1) self.add_button = toolbar.append_button( 'gtk-add', 'Add', tooltips, 'Add food or recipe') self.edit_button = toolbar.append_button( 'gtk-undo', 'Edit', tooltips, 'Edit recipe or food') self.delete_button = toolbar.append_button( 'gtk-remove', 'Delete', tooltips, 'Delete selected recipe or food') sep = gtk.SeparatorToolItem() toolbar.insert(sep, -1) self.compute_button = toolbar.append_button( 'gtk-execute', 'Compute', tooltips, 'Compute nutritient composition') # icon6 = gtk.Image() # icon6.set_from_stock( 'gtk-execute', gtk.ICON_SIZE_LARGE_TOOLBAR) # self.graph_button = toolbar.append_item( 'Graph', # 'Graph of nutrient composition', None, icon6, None, None) # icon7 = gtk.Image() # icon7.set_from_stock( 'gtk-execute', gtk.ICON_SIZE_LARGE_TOOLBAR) # self.graph_button = toolbar.append_item( 'Variation', # 'Graph of variation of nutrient composition', None, icon7, # None, None) self.toolbar_box.show_all()
def create_toolbar(self): self.toolbar_box = gtk.HandleBox() toolbar = gnutr_widgets.GnutrToolbar() tooltips = gtk.Tooltips() self.toolbar_box.add(toolbar) self.clear_button = toolbar.append_button('gtk-clear', 'Clear', tooltips, 'Clear food data') sep = gtk.SeparatorToolItem() toolbar.insert(sep, -1) self.select_button = toolbar.append_button('gtk-find', 'Select', tooltips, 'Select food from database') self.compute_button = toolbar.append_button('gtk-execute', 'Compute', tooltips, 'Compute nutrition composition') sep = gtk.SeparatorToolItem() toolbar.insert(sep, -1) self.pref_button = toolbar.append_button('gtk-preferences', 'Goals', tooltips, 'Nutritient goal') # icon5 = gtk.Image() # icon5.set_from_stock('gtk-execute', gtk.ICON_SIZE_LARGE_TOOLBAR) # self.graph_button = toolbar.append_item('Graph', # 'Graph of nutrient composition', None, icon5, None, None) self.toolbar_box.show_all()
def __init__(self): self.win = gtk.Window(gtk.WINDOW_TOPLEVEL) self.win.set_title('Gnutrition') vbox1 = gtk.VBox(False, 0) self.win.add(vbox1) self.menubar_box = gtk.VBox(False, 0) vbox1.pack_start(self.menubar_box, False, True, 0) self.toolbar_box = gtk.VBox(False, 0) vbox1.pack_start(self.toolbar_box, False, True, 0) hpaned1 = gtk.HPaned() # hpaned1.set_position( 0) vbox1.pack_start(hpaned1, True, True, 0) vbox2 = gtk.VBox(False, 0) hpaned1.pack1(vbox2, False, True) frame1 = gtk.Frame() frame1.set_border_width(2) frame1.set_shadow_type(gtk.SHADOW_IN) vbox2.pack_start(frame1, False, True, 0) label1 = gtk.Label('View') frame1.add(label1) frame2 = gtk.Frame() frame2.set_border_width(2) frame2.set_shadow_type(gtk.SHADOW_IN) vbox2.pack_start(frame2, True, True, 0) tooltips = gtk.Tooltips() toolbar = gnutr_widgets.GnutrToolbar() toolbar.set_orientation(gtk.ORIENTATION_VERTICAL) frame2.add(toolbar) self.recipe_button = toolbar.append_button('gnutr-recipe', 'Recipe', tooltips, 'Switch view to recipe') self.plan_button = toolbar.append_button('gnutr-plan', 'Plan', tooltips, 'Switch view to plan') self.food_button = toolbar.append_button('gnutr-food', 'Food', tooltips, 'Switch view to food') # the original version of the buttons (using the deprecated API) looks # a bit different, buttons are smaller and have some padding around # them: # vbox4 = gtk.VBox() # vbox4.set_border_width( 10) # self.recipe_button = gtk.Button() # icon2 = gtk.Image() # icon2.set_from_stock( 'gnutr-recipe', gtk.ICON_SIZE_LARGE_TOOLBAR) # self.recipe_button.add( icon2) # self.recipe_button.set_relief( gtk.RELIEF_NONE) # vbox4.pack_start( self.recipe_button) # label3 = gtk.Label( 'Recipe') # vbox4.pack_start( label3) # toolbar.append_widget( vbox4, 'Switch view to recipe', None) self.pane_box = gtk.HBox(False, 0) self.pane_box.set_border_width(2) hpaned1.pack2(self.pane_box, True, True) self.win.show_all() # about dialog self.about_dlg = gtk.Dialog(title='About Nutrition', flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.about_dlg.set_resizable(False) about_label = gtk.Label("""Gnutrition %s (C) 2002 Edgar Denny Author: Edgar Denny ([email protected]) A Diet and Nutrition Analysis Program.""" % (install.VERSION)) about_label.set_justify(gtk.JUSTIFY_CENTER) vbox6 = gtk.VBox() vbox6.set_border_width(5) vbox6.pack_start(about_label, True, True, 0) self.about_dlg.vbox.pack_start(vbox6, True, True, 0) self.about_dlg.vbox.show_all()
def __init__(self): self.win = gtk.Window(gtk.WINDOW_TOPLEVEL) self.win.set_title('GNUtrition') self.win.resize(750, 560) vbox1 = gtk.VBox(False, 0) self.win.add(vbox1) self.menubar_box = gtk.VBox(False, 0) vbox1.pack_start(self.menubar_box, False, True, 0) self.toolbar_box = gtk.VBox(False, 0) vbox1.pack_start(self.toolbar_box, False, True, 0) hpaned1 = gtk.HPaned() # hpaned1.set_position(0) vbox1.pack_start(hpaned1, True, True, 0) vbox2 = gtk.VBox(False, 0) hpaned1.pack1(vbox2, False, True) frame1 = gtk.Frame() frame1.set_border_width(2) frame1.set_shadow_type(gtk.SHADOW_IN) vbox2.pack_start(frame1, False, True, 0) label1 = gtk.Label('View') frame1.add(label1) frame2 = gtk.Frame() frame2.set_border_width(2) frame2.set_shadow_type(gtk.SHADOW_IN) vbox2.pack_start(frame2, True, True, 0) tooltips = gtk.Tooltips() toolbar = gnutr_widgets.GnutrToolbar() toolbar.set_orientation(gtk.ORIENTATION_VERTICAL) frame2.add(toolbar) self.recipe_button = toolbar.append_button('gnutr-recipe', 'Recipe', tooltips, 'Switch view to recipe') self.plan_button = toolbar.append_button('gnutr-plan', 'Plan', tooltips, 'Switch view to plan') self.food_button = toolbar.append_button('gnutr-food', 'Food', tooltips, 'Switch view to food') self.pane_box = gtk.HBox(False, 0) self.pane_box.set_border_width(2) hpaned1.pack2(self.pane_box, True, True) self.win.show_all() # about dialog self.about_dlg = gtk.Dialog(title='About Nutrition', flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) self.about_dlg.set_resizable(False) about_label = gtk.Label("""GNUtrition {0:s} A Diet and Nutrition Analysis Program using the USDA National Nutrient Database for Standard Reference. Current database version is SR{1:s}, {2:s}. (C) 2002 Edgar Denny (C) 2010 2012 Free Software Foundation, Inc. http://www.gnu.org/software/gnutrition/""".format(gnutr_version(), get_value('sr'), get_value('sr_date'))) about_label.set_justify(gtk.JUSTIFY_CENTER) vbox6 = gtk.VBox() vbox6.set_border_width(5) vbox6.pack_start(about_label, True, True, 0) self.about_dlg.vbox.pack_start(vbox6, True, True, 0) self.about_dlg.vbox.show_all()