diff options
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 123 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 40 |
2 files changed, 85 insertions, 78 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 9d00023140..e8549a135a 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
| @@ -53,8 +53,10 @@ class hic: | |||
| 53 | ICON_INFO_HOVER_FILE = os.path.join(HOB_ICON_BASE_DIR, ('info/info_hover.png')) | 53 | ICON_INFO_HOVER_FILE = os.path.join(HOB_ICON_BASE_DIR, ('info/info_hover.png')) |
| 54 | ICON_INDI_CONFIRM_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/confirmation.png')) | 54 | ICON_INDI_CONFIRM_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/confirmation.png')) |
| 55 | ICON_INDI_ERROR_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/error.png')) | 55 | ICON_INDI_ERROR_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/error.png')) |
| 56 | ICON_INDI_REMOVE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove.png')) | 56 | ICON_INDI_REMOVE_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove.png')) |
| 57 | ICON_INDI_ADD = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png')) | 57 | ICON_INDI_REMOVE_HOVER_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove-hover.png')) |
| 58 | ICON_INDI_ADD_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png')) | ||
| 59 | ICON_INDI_ADD_HOVER_FILE = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add-hover.png')) | ||
| 58 | 60 | ||
| 59 | class hcc: | 61 | class hcc: |
| 60 | 62 | ||
| @@ -173,6 +175,27 @@ class HobViewTable (gtk.VBox): | |||
| 173 | if not view_column.get_title() in self.toggle_columns: | 175 | if not view_column.get_title() in self.toggle_columns: |
| 174 | self.emit("row-activated", tree.get_model(), path) | 176 | self.emit("row-activated", tree.get_model(), path) |
| 175 | 177 | ||
| 178 | """ | ||
| 179 | A method to calculate a softened value for the colour of widget when in the | ||
| 180 | provided state. | ||
| 181 | |||
| 182 | widget: the widget whose style to use | ||
| 183 | state: the state of the widget to use the style for | ||
| 184 | |||
| 185 | Returns a string value representing the softened colour | ||
| 186 | """ | ||
| 187 | def soften_color(widget, state=gtk.STATE_NORMAL): | ||
| 188 | # this colour munging routine is heavily inspired bu gdu_util_get_mix_color() | ||
| 189 | # from gnome-disk-utility: | ||
| 190 | # http://git.gnome.org/browse/gnome-disk-utility/tree/src/gdu-gtk/gdu-gtk.c?h=gnome-3-0 | ||
| 191 | blend = 0.7 | ||
| 192 | style = widget.get_style() | ||
| 193 | color = style.text[state] | ||
| 194 | color.red = color.red * blend + style.base[state].red * (1.0 - blend) | ||
| 195 | color.green = color.green * blend + style.base[state].green * (1.0 - blend) | ||
| 196 | color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend) | ||
| 197 | return color.to_string() | ||
| 198 | |||
| 176 | class HobAltButton(gtk.Button): | 199 | class HobAltButton(gtk.Button): |
| 177 | """ | 200 | """ |
| 178 | A gtk.Button subclass which has no relief, and so is more discrete | 201 | A gtk.Button subclass which has no relief, and so is more discrete |
| @@ -181,64 +204,46 @@ class HobAltButton(gtk.Button): | |||
| 181 | gtk.Button.__init__(self, label) | 204 | gtk.Button.__init__(self, label) |
| 182 | self.set_relief(gtk.RELIEF_NONE) | 205 | self.set_relief(gtk.RELIEF_NONE) |
| 183 | 206 | ||
| 184 | class HobXpmLabelButtonBox(gtk.EventBox): | 207 | class HobImageButton(gtk.Button): |
| 185 | """ label: name of buttonbox | ||
| 186 | description: the simple description | ||
| 187 | """ | 208 | """ |
| 188 | def __init__(self, display_file="", hover_file="", label="", description=""): | 209 | A gtk.Button with an icon and two rows of text, the second of which is |
| 189 | gtk.EventBox.__init__(self) | 210 | displayed in a blended colour. |
| 190 | self._base_state_flags = gtk.STATE_NORMAL | 211 | |
| 191 | self.set_events(gtk.gdk.MOTION_NOTIFY | gtk.gdk.BUTTON_PRESS | gtk.gdk.EXPOSE) | 212 | primary_text: the main button label |
| 192 | 213 | secondary_text: optional second line of text | |
| 193 | self.connect("expose-event", self.cb) | 214 | icon_path: path to the icon file to display on the button |
| 194 | self.connect("enter-notify-event", self.pointer_enter_cb) | 215 | """ |
| 195 | self.connect("leave-notify-event", self.pointer_leave_cb) | 216 | def __init__(self, primary_text, secondary_text="", icon_path="", hover_icon_path=""): |
| 196 | 217 | gtk.Button.__init__(self) | |
| 197 | self.icon_hover = gtk.Image() | 218 | self.set_relief(gtk.RELIEF_NONE) |
| 198 | self.icon_hover.set_name("icon_image") | 219 | |
| 199 | if type(hover_file) == str: | 220 | self.icon_path = icon_path |
| 200 | pixbuf = gtk.gdk.pixbuf_new_from_file(hover_file) | 221 | self.hover_icon_path = hover_icon_path |
| 201 | self.icon_hover.set_from_pixbuf(pixbuf) | 222 | |
| 202 | 223 | hbox = gtk.HBox(False, 3) | |
| 203 | self.icon_display = gtk.Image() | 224 | hbox.show() |
| 204 | self.icon_display.set_name("icon_image") | 225 | self.add(hbox) |
| 205 | if type(display_file) == str: | 226 | self.icon = gtk.Image() |
| 206 | pixbuf = gtk.gdk.pixbuf_new_from_file(display_file) | 227 | self.icon.set_from_file(self.icon_path) |
| 207 | self.icon_display.set_from_pixbuf(pixbuf) | 228 | self.icon.set_alignment(0.5, 0.0) |
| 208 | 229 | self.icon.show() | |
| 209 | self.tb = gtk.Table(2, 10, True) | 230 | if self.hover_icon_path and len(self.hover_icon_path): |
| 210 | self.tb.set_row_spacing(1, False) | 231 | self.connect("enter-notify-event", self.set_hover_icon_cb) |
| 211 | self.tb.set_col_spacing(1, False) | 232 | self.connect("leave-notify-event", self.set_icon_cb) |
| 212 | self.add(self.tb) | 233 | hbox.pack_start(self.icon, False, False, 0) |
| 213 | self.tb.attach(self.icon_display, 0, 2, 0, 2, 0, 0) | 234 | label = gtk.Label() |
| 214 | self.tb.attach(self.icon_hover, 0, 2, 0, 2, 0, 0) | 235 | label.set_alignment(0.0, 0.5) |
| 215 | 236 | colour = soften_color(label) | |
| 216 | lbl = gtk.Label() | 237 | mark = "%s\n<span fgcolor='%s'><small>%s</small></span>" % (primary_text, colour, secondary_text) |
| 217 | lbl.set_alignment(0.0, 0.5) | 238 | label.set_markup(mark) |
| 218 | lbl.set_markup("<span foreground=\'#1C1C1C\' font_desc=\'18px\'>%s</span>" % label) | 239 | label.show() |
| 219 | self.tb.attach(lbl, 2, 10, 0, 1) | 240 | hbox.pack_start(label, True, True, 0) |
| 220 | 241 | ||
| 221 | lbl = gtk.Label() | 242 | def set_hover_icon_cb(self, widget, event): |
| 222 | lbl.set_alignment(0.0, 0.5) | 243 | self.icon.set_from_file(self.hover_icon_path) |
| 223 | lbl.set_markup("<span foreground=\'#1C1C1C\' font_desc=\'14px\'>%s</span>" % description) | 244 | |
| 224 | self.tb.attach(lbl, 2, 10, 1, 2) | 245 | def set_icon_cb(self, widget, event): |
| 225 | 246 | self.icon.set_from_file(self.icon_path) | |
| 226 | def pointer_enter_cb(self, *args): | ||
| 227 | #if not self.is_focus(): | ||
| 228 | self.set_state(gtk.STATE_PRELIGHT) | ||
| 229 | self._base_state_flags = gtk.STATE_PRELIGHT | ||
| 230 | self.icon_hover.show() | ||
| 231 | self.icon_display.hide() | ||
| 232 | |||
| 233 | def pointer_leave_cb(self, *args): | ||
| 234 | self.set_state(gtk.STATE_NORMAL) | ||
| 235 | self._base_state_flags = gtk.STATE_NORMAL | ||
| 236 | self.icon_display.show() | ||
| 237 | self.icon_hover.hide() | ||
| 238 | |||
| 239 | def cb(self, w,e): | ||
| 240 | """ Hide items - first time """ | ||
| 241 | pass | ||
| 242 | 247 | ||
| 243 | class HobInfoButton(gtk.EventBox): | 248 | class HobInfoButton(gtk.EventBox): |
| 244 | """ | 249 | """ |
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py index c358a970e4..836bd0a798 100644 --- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | |||
| @@ -24,7 +24,7 @@ import gtk | |||
| 24 | import glib | 24 | import glib |
| 25 | from bb.ui.crumbs.progressbar import HobProgressBar | 25 | from bb.ui.crumbs.progressbar import HobProgressBar |
| 26 | from bb.ui.crumbs.hobcolor import HobColors | 26 | from bb.ui.crumbs.hobcolor import HobColors |
| 27 | from bb.ui.crumbs.hobwidget import hic, HobXpmLabelButtonBox, HobInfoButton, HobAltButton | 27 | from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton, HobAltButton, HobButton |
| 28 | from bb.ui.crumbs.hoblistmodel import RecipeListModel | 28 | from bb.ui.crumbs.hoblistmodel import RecipeListModel |
| 29 | from bb.ui.crumbs.hobpages import HobPage | 29 | from bb.ui.crumbs.hobpages import HobPage |
| 30 | 30 | ||
| @@ -139,9 +139,9 @@ class ImageConfigurationPage (HobPage): | |||
| 139 | 139 | ||
| 140 | icon_file = hic.ICON_LAYERS_DISPLAY_FILE | 140 | icon_file = hic.ICON_LAYERS_DISPLAY_FILE |
| 141 | hover_file = hic.ICON_LAYERS_HOVER_FILE | 141 | hover_file = hic.ICON_LAYERS_HOVER_FILE |
| 142 | self.layer_button = HobXpmLabelButtonBox(icon_file, hover_file, | 142 | self.layer_button = HobImageButton("Layers", "Add support for machines, software, etc.", |
| 143 | "Layers", "Add support for machines, software, etc") | 143 | icon_file, hover_file) |
| 144 | self.layer_button.connect("button-release-event", self.layer_button_clicked_cb) | 144 | self.layer_button.connect("clicked", self.layer_button_clicked_cb) |
| 145 | 145 | ||
| 146 | markup = "Layers are a powerful mechanism to extend the Yocto Project " | 146 | markup = "Layers are a powerful mechanism to extend the Yocto Project " |
| 147 | markup += "with your own functionality.\n" | 147 | markup += "with your own functionality.\n" |
| @@ -163,9 +163,9 @@ class ImageConfigurationPage (HobPage): | |||
| 163 | self.gtable.attach(self.machine_title, 0, 40, 0, 4) | 163 | self.gtable.attach(self.machine_title, 0, 40, 0, 4) |
| 164 | self.gtable.attach(self.machine_title_desc, 0, 40, 4, 6) | 164 | self.gtable.attach(self.machine_title_desc, 0, 40, 4, 6) |
| 165 | self.gtable.attach(self.machine_combo, 0, 12, 6, 9) | 165 | self.gtable.attach(self.machine_combo, 0, 12, 6, 9) |
| 166 | self.gtable.attach(self.layer_button, 12, 36, 6, 10) | 166 | self.gtable.attach(self.layer_button, 12, 36, 6, 11) |
| 167 | self.gtable.attach(self.layer_info_icon, 36, 40, 6, 9) | 167 | self.gtable.attach(self.layer_info_icon, 36, 40, 6, 10) |
| 168 | if show_progress_bar == True: | 168 | if show_progress_bar: |
| 169 | self.gtable.attach(self.progress_box, 0, 40, 13, 17) | 169 | self.gtable.attach(self.progress_box, 0, 40, 13, 17) |
| 170 | self.gtable.attach(self.machine_separator, 0, 40, 12, 13) | 170 | self.gtable.attach(self.machine_separator, 0, 40, 12, 13) |
| 171 | 171 | ||
| @@ -186,22 +186,24 @@ class ImageConfigurationPage (HobPage): | |||
| 186 | self.image_combo_id = self.image_combo.connect("changed", self.image_combo_changed_cb) | 186 | self.image_combo_id = self.image_combo.connect("changed", self.image_combo_changed_cb) |
| 187 | 187 | ||
| 188 | self.image_desc = gtk.Label() | 188 | self.image_desc = gtk.Label() |
| 189 | self.image_desc.set_alignment(0, 0) | 189 | self.image_desc.set_alignment(0, 0.5) |
| 190 | self.image_desc.set_line_wrap(True) | 190 | self.image_desc.set_line_wrap(True) |
| 191 | 191 | ||
| 192 | # button to view recipes | 192 | # button to view recipes |
| 193 | icon_file = hic.ICON_RCIPE_DISPLAY_FILE | 193 | icon_file = hic.ICON_RCIPE_DISPLAY_FILE |
| 194 | hover_file = hic.ICON_RCIPE_HOVER_FILE | 194 | hover_file = hic.ICON_RCIPE_HOVER_FILE |
| 195 | self.view_recipes_button = HobXpmLabelButtonBox(icon_file, hover_file, | 195 | self.view_recipes_button = HobImageButton("View Recipes", |
| 196 | "View Recipes", "Add/remove recipes and collections") | 196 | "Add/remove recipes and collections", |
| 197 | self.view_recipes_button.connect("button-release-event", self.view_recipes_button_clicked_cb) | 197 | icon_file, hover_file) |
| 198 | self.view_recipes_button.connect("clicked", self.view_recipes_button_clicked_cb) | ||
| 198 | 199 | ||
| 199 | # button to view packages | 200 | # button to view packages |
| 200 | icon_file = hic.ICON_PACKAGES_DISPLAY_FILE | 201 | icon_file = hic.ICON_PACKAGES_DISPLAY_FILE |
| 201 | hover_file = hic.ICON_PACKAGES_HOVER_FILE | 202 | hover_file = hic.ICON_PACKAGES_HOVER_FILE |
| 202 | self.view_packages_button = HobXpmLabelButtonBox(icon_file, hover_file, | 203 | self.view_packages_button = HobImageButton("View Packages", |
| 203 | "View Packages", "Add/remove previously built packages to/from your image") | 204 | "Add/remove previously built packages to/from your image", |
| 204 | self.view_packages_button.connect("button-release-event", self.view_packages_button_clicked_cb) | 205 | icon_file, hover_file) |
| 206 | self.view_packages_button.connect("clicked", self.view_packages_button_clicked_cb) | ||
| 205 | 207 | ||
| 206 | self.image_separator = gtk.HSeparator() | 208 | self.image_separator = gtk.HSeparator() |
| 207 | 209 | ||
| @@ -213,8 +215,8 @@ class ImageConfigurationPage (HobPage): | |||
| 213 | self.gtable.attach(self.image_separator, 0, 40, 35, 36) | 215 | self.gtable.attach(self.image_separator, 0, 40, 35, 36) |
| 214 | 216 | ||
| 215 | def set_rcppkg_layout(self): | 217 | def set_rcppkg_layout(self): |
| 216 | self.gtable.attach(self.view_recipes_button, 0, 18, 28, 32) | 218 | self.gtable.attach(self.view_recipes_button, 0, 20, 27, 32) |
| 217 | self.gtable.attach(self.view_packages_button, 18, 40, 28, 32) | 219 | self.gtable.attach(self.view_packages_button, 20, 40, 27, 32) |
| 218 | 220 | ||
| 219 | def create_config_build_button(self): | 221 | def create_config_build_button(self): |
| 220 | # Create the "Build packages" and "Just bake" buttons at the bottom | 222 | # Create the "Build packages" and "Just bake" buttons at the bottom |
| @@ -343,14 +345,14 @@ class ImageConfigurationPage (HobPage): | |||
| 343 | self.image_combo.set_active(-1) | 345 | self.image_combo.set_active(-1) |
| 344 | self.image_combo.set_active(active) | 346 | self.image_combo.set_active(active) |
| 345 | 347 | ||
| 346 | def layer_button_clicked_cb(self, event, data): | 348 | def layer_button_clicked_cb(self, button): |
| 347 | # Create a layer selection dialog | 349 | # Create a layer selection dialog |
| 348 | self.builder.show_layer_selection_dialog() | 350 | self.builder.show_layer_selection_dialog() |
| 349 | 351 | ||
| 350 | def view_recipes_button_clicked_cb(self, event, data): | 352 | def view_recipes_button_clicked_cb(self, button): |
| 351 | self.builder.show_recipes() | 353 | self.builder.show_recipes() |
| 352 | 354 | ||
| 353 | def view_packages_button_clicked_cb(self, event, data): | 355 | def view_packages_button_clicked_cb(self, button): |
| 354 | self.builder.show_packages() | 356 | self.builder.show_packages() |
| 355 | 357 | ||
| 356 | def just_bake_button_clicked_cb(self, button): | 358 | def just_bake_button_clicked_cb(self, button): |
