diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/imagedetailspage.py')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 101 |
1 files changed, 85 insertions, 16 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py index 1af67f24ed..a843ad4ce5 100755 --- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py | |||
@@ -41,10 +41,10 @@ class ImageDetailsPage (HobPage): | |||
41 | style.bg[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(color, False, False) | 41 | style.bg[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(color, False, False) |
42 | self.set_style(style) | 42 | self.set_style(style) |
43 | 43 | ||
44 | self.hbox = gtk.HBox() | 44 | self.row = gtk.Table(1, 2, False) |
45 | self.hbox.set_border_width(10) | 45 | self.row.set_border_width(10) |
46 | self.add(self.hbox) | 46 | self.add(self.row) |
47 | 47 | ||
48 | total_rows = 0 | 48 | total_rows = 0 |
49 | if widget: | 49 | if widget: |
50 | total_rows = 10 | 50 | total_rows = 10 |
@@ -54,8 +54,8 @@ class ImageDetailsPage (HobPage): | |||
54 | self.table = gtk.Table(total_rows, 20, True) | 54 | self.table = gtk.Table(total_rows, 20, True) |
55 | self.table.set_row_spacings(6) | 55 | self.table.set_row_spacings(6) |
56 | self.table.set_size_request(100, -1) | 56 | self.table.set_size_request(100, -1) |
57 | self.hbox.pack_start(self.table, expand=True, fill=True, padding=15) | 57 | self.row.attach(self.table, 0, 1, 0, 1, xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) |
58 | 58 | ||
59 | colid = 0 | 59 | colid = 0 |
60 | rowid = 0 | 60 | rowid = 0 |
61 | self.line_widgets = {} | 61 | self.line_widgets = {} |
@@ -73,11 +73,80 @@ class ImageDetailsPage (HobPage): | |||
73 | # pack the button on the right | 73 | # pack the button on the right |
74 | if button: | 74 | if button: |
75 | self.bbox = gtk.VBox() | 75 | self.bbox = gtk.VBox() |
76 | self.bbox.pack_start(button, expand=True, fill=True) | 76 | self.bbox.pack_start(button, expand=True, fill=False) |
77 | if button2: | 77 | if button2: |
78 | self.bbox.pack_start(button2, expand=True, fill=True) | 78 | self.bbox.pack_start(button2, expand=True, fill=False) |
79 | self.hbox.pack_end(self.bbox, expand=False, fill=False) | 79 | self.bbox.set_size_request(150,-1) |
80 | self.row.attach(self.bbox, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.EXPAND) | ||
81 | |||
82 | def update_line_widgets(self, variable, value): | ||
83 | if len(self.line_widgets) == 0: | ||
84 | return | ||
85 | if not isinstance(self.line_widgets[variable], gtk.Label): | ||
86 | return | ||
87 | self.line_widgets[variable].set_markup(self.format_line(variable, value)) | ||
88 | |||
89 | def wrap_line(self, inputs): | ||
90 | # wrap the long text of inputs | ||
91 | wrap_width_chars = 75 | ||
92 | outputs = "" | ||
93 | tmps = inputs | ||
94 | less_chars = len(inputs) | ||
95 | while (less_chars - wrap_width_chars) > 0: | ||
96 | less_chars -= wrap_width_chars | ||
97 | outputs += tmps[:wrap_width_chars] + "\n " | ||
98 | tmps = inputs[less_chars:] | ||
99 | outputs += tmps | ||
100 | return outputs | ||
101 | |||
102 | def format_line(self, variable, value): | ||
103 | wraped_value = self.wrap_line(value) | ||
104 | markup = "<span weight=\'bold\'>%s</span>" % variable | ||
105 | markup += "<span weight=\'normal\' foreground=\'#1c1c1c\' font_desc=\'14px\'>%s</span>" % wraped_value | ||
106 | return markup | ||
107 | |||
108 | def text2label(self, variable, value): | ||
109 | # append the name:value to the left box | ||
110 | # such as "Name: hob-core-minimal-variant-2011-12-15-beagleboard" | ||
111 | label = gtk.Label() | ||
112 | label.set_alignment(0.0, 0.5) | ||
113 | label.set_markup(self.format_line(variable, value)) | ||
114 | return label | ||
115 | |||
116 | class BuildDetailBox (gtk.EventBox): | ||
117 | def __init__(self, varlist = None, vallist = None, icon = None, color = HobColors.LIGHT_GRAY): | ||
118 | gtk.EventBox.__init__(self) | ||
119 | |||
120 | # set color | ||
121 | style = self.get_style().copy() | ||
122 | style.bg[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(color, False, False) | ||
123 | self.set_style(style) | ||
80 | 124 | ||
125 | self.hbox = gtk.HBox() | ||
126 | self.hbox.set_border_width(10) | ||
127 | self.add(self.hbox) | ||
128 | |||
129 | total_rows = 0 | ||
130 | if varlist and vallist: | ||
131 | # pack the icon and the text on the left | ||
132 | total_rows += len(varlist) | ||
133 | self.table = gtk.Table(total_rows, 20, True) | ||
134 | self.table.set_row_spacings(6) | ||
135 | self.table.set_size_request(100, -1) | ||
136 | self.hbox.pack_start(self.table, expand=True, fill=True, padding=15) | ||
137 | |||
138 | colid = 0 | ||
139 | rowid = 0 | ||
140 | self.line_widgets = {} | ||
141 | if icon: | ||
142 | self.table.attach(icon, colid, colid + 2, 0, 1) | ||
143 | colid = colid + 2 | ||
144 | if varlist and vallist: | ||
145 | for row in range(rowid, total_rows): | ||
146 | index = row - rowid | ||
147 | self.line_widgets[varlist[index]] = self.text2label(varlist[index], vallist[index]) | ||
148 | self.table.attach(self.line_widgets[varlist[index]], colid, 20, row, row + 1) | ||
149 | |||
81 | def update_line_widgets(self, variable, value): | 150 | def update_line_widgets(self, variable, value): |
82 | if len(self.line_widgets) == 0: | 151 | if len(self.line_widgets) == 0: |
83 | return | 152 | return |
@@ -192,7 +261,7 @@ class ImageDetailsPage (HobPage): | |||
192 | icon.set_from_pixbuf(pix_buffer) | 261 | icon.set_from_pixbuf(pix_buffer) |
193 | varlist = [""] | 262 | varlist = [""] |
194 | vallist = ["Your image is ready"] | 263 | vallist = ["Your image is ready"] |
195 | self.build_result = self.DetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color) | 264 | self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color) |
196 | self.box_group_area.pack_start(self.build_result, expand=False, fill=False) | 265 | self.box_group_area.pack_start(self.build_result, expand=False, fill=False) |
197 | 266 | ||
198 | # create the buttons at the bottom first because the buttons are used in apply_button_per_image() | 267 | # create the buttons at the bottom first because the buttons are used in apply_button_per_image() |
@@ -271,7 +340,7 @@ class ImageDetailsPage (HobPage): | |||
271 | change_kernel_button.connect("clicked", self.change_kernel_cb) | 340 | change_kernel_button.connect("clicked", self.change_kernel_cb) |
272 | change_kernel_button.set_tooltip_text("Change qemu kernel file") | 341 | change_kernel_button.set_tooltip_text("Change qemu kernel file") |
273 | self.kernel_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=change_kernel_button) | 342 | self.kernel_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=change_kernel_button) |
274 | self.box_group_area.pack_start(self.kernel_detail, expand=False, fill=False) | 343 | self.box_group_area.pack_start(self.kernel_detail, expand=True, fill=True) |
275 | 344 | ||
276 | # Machine, Base image and Layers | 345 | # Machine, Base image and Layers |
277 | layer_num_limit = 15 | 346 | layer_num_limit = 15 |
@@ -316,7 +385,7 @@ class ImageDetailsPage (HobPage): | |||
316 | else: # get to this page from "My images" | 385 | else: # get to this page from "My images" |
317 | edit_packages_button = None | 386 | edit_packages_button = None |
318 | self.package_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_packages_button) | 387 | self.package_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_packages_button) |
319 | self.box_group_area.pack_start(self.package_detail, expand=False, fill=False) | 388 | self.box_group_area.pack_start(self.package_detail, expand=True, fill=True) |
320 | 389 | ||
321 | # pack the buttons at the bottom, at this time they are already created. | 390 | # pack the buttons at the bottom, at this time they are already created. |
322 | if self.build_succeeded: | 391 | if self.build_succeeded: |
@@ -478,7 +547,7 @@ class ImageDetailsPage (HobPage): | |||
478 | name = "Deploy image" | 547 | name = "Deploy image" |
479 | if name in buttonlist and self.test_deployable(image_name): | 548 | if name in buttonlist and self.test_deployable(image_name): |
480 | deploy_button = HobButton('Deploy image') | 549 | deploy_button = HobButton('Deploy image') |
481 | deploy_button.set_size_request(205, 49) | 550 | #deploy_button.set_size_request(205, 49) |
482 | deploy_button.set_tooltip_text("Burn a live image to a USB drive or flash memory") | 551 | deploy_button.set_tooltip_text("Burn a live image to a USB drive or flash memory") |
483 | deploy_button.set_flags(gtk.CAN_DEFAULT) | 552 | deploy_button.set_flags(gtk.CAN_DEFAULT) |
484 | button_id = deploy_button.connect("clicked", self.deploy_button_clicked_cb) | 553 | button_id = deploy_button.connect("clicked", self.deploy_button_clicked_cb) |
@@ -499,7 +568,7 @@ class ImageDetailsPage (HobPage): | |||
499 | else: | 568 | else: |
500 | # create button "Run image" as the primary button | 569 | # create button "Run image" as the primary button |
501 | run_button = HobButton("Run image") | 570 | run_button = HobButton("Run image") |
502 | run_button.set_size_request(205, 49) | 571 | #run_button.set_size_request(205, 49) |
503 | run_button.set_flags(gtk.CAN_DEFAULT) | 572 | run_button.set_flags(gtk.CAN_DEFAULT) |
504 | packed = True | 573 | packed = True |
505 | run_button.set_tooltip_text("Start up an image with qemu emulator") | 574 | run_button.set_tooltip_text("Start up an image with qemu emulator") |
@@ -520,7 +589,7 @@ class ImageDetailsPage (HobPage): | |||
520 | save_button = HobAltButton("Save as template") | 589 | save_button = HobAltButton("Save as template") |
521 | else: | 590 | else: |
522 | save_button = HobButton("Save as template") | 591 | save_button = HobButton("Save as template") |
523 | save_button.set_size_request(205, 49) | 592 | #save_button.set_size_request(205, 49) |
524 | save_button.set_flags(gtk.CAN_DEFAULT) | 593 | save_button.set_flags(gtk.CAN_DEFAULT) |
525 | packed = True | 594 | packed = True |
526 | save_button.set_tooltip_text("Save the image configuration for reuse") | 595 | save_button.set_tooltip_text("Save the image configuration for reuse") |
@@ -537,7 +606,7 @@ class ImageDetailsPage (HobPage): | |||
537 | else: | 606 | else: |
538 | build_new_button = HobButton("Build new image") | 607 | build_new_button = HobButton("Build new image") |
539 | build_new_button.set_flags(gtk.CAN_DEFAULT) | 608 | build_new_button.set_flags(gtk.CAN_DEFAULT) |
540 | build_new_button.set_size_request(205, 49) | 609 | #build_new_button.set_size_request(205, 49) |
541 | self.details_bottom_buttons.pack_end(build_new_button, expand=False, fill=False) | 610 | self.details_bottom_buttons.pack_end(build_new_button, expand=False, fill=False) |
542 | build_new_button.set_tooltip_text("Create a new image from scratch") | 611 | build_new_button.set_tooltip_text("Create a new image from scratch") |
543 | button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb) | 612 | button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb) |