本文整理匯總了Python中bb.ui.crumbs.hobwidget.HobNotebook類的典型用法代碼示例。如果您正苦於以下問題:Python HobNotebook類的具體用法?Python HobNotebook怎麽用?Python HobNotebook使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了HobNotebook類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_visual_elements
def create_visual_elements(self):
self.eventbox = self.add_onto_top_bar(None, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need modify table when the dialog is shown
search_names = []
search_tips = []
# append the tabs in order
for page in self.pages:
columns = page['columns']
name = page['name']
tab = HobViewTable(columns, name)
search_names.append(page['search'])
search_tips.append(page['searchtip'])
filter = page['filter']
sort_model = self.recipe_model.tree_model(filter, initial=True)
tab.set_model(sort_model)
tab.connect("toggled", self.table_toggled_cb, name)
if name == "Included recipes":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
if name == "Package Groups":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
if name == "All recipes":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.button_click_cb)
self.ins.append_page(tab, page['name'], page['tooltip'])
self.tables.append(tab)
self.ins.set_entry(search_names, search_tips)
self.ins.search.connect("changed", self.search_entry_changed)
# add all into the window
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
button_box = gtk.HBox(False, 6)
self.box_group_area.pack_end(button_box, expand=False, fill=False)
self.build_packages_button = HobButton('Build packages')
#self.build_packages_button.set_size_request(205, 49)
self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
self.build_packages_button.grab_default()
self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
button_box.pack_end(self.build_packages_button, expand=False, fill=False)
self.back_button = HobAltButton('Cancel')
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_end(self.back_button, expand=False, fill=False)
示例2: create_visual_elements
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visiable members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
# append the tab
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.package_model.tree_model(filter))
tab.connect("toggled", self.table_toggled_cb)
if page['name'] == "Included":
tab.connect("row-activated", self.tree_row_activated_cb)
label = gtk.Label(page['name'])
self.ins.append_page(tab, label)
self.tables.append(tab)
self.ins.set_entry("Search packages:")
# set the search entry for each table
for tab in self.tables:
tab.set_search_entry(0, self.ins.search)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(button_box, expand=False, fill=False)
self.build_image_button = gtk.Button()
label = gtk.Label()
mark = "<span %s>Build image</span>" % self.span_tag('24px', 'bold')
label.set_markup(mark)
self.build_image_button.set_image(label)
self.build_image_button.set_size_request(205, 49)
self.build_image_button.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(HobColors.ORANGE))
self.build_image_button.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(HobColors.ORANGE))
self.build_image_button.modify_bg(gtk.STATE_SELECTED, gtk.gdk.Color(HobColors.ORANGE))
self.build_image_button.set_tooltip_text("Build image to get your target image")
self.build_image_button.set_flags(gtk.CAN_DEFAULT)
self.build_image_button.grab_default()
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_start(self.back_button, expand=False, fill=False)
示例3: create_visual_elements
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
search_names = []
search_tips = []
# append the tab
for page in self.pages:
columns = page["columns"]
name = page["name"]
tab = HobViewTable(columns, name)
search_names.append(page["search"])
search_tips.append(page["searchtip"])
filter = page["filter"]
sort_model = self.package_model.tree_model(filter, initial=True)
tab.set_model(sort_model)
tab.connect("toggled", self.table_toggled_cb, name)
if name == "Included packages":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
if name == "All packages":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
self.ins.append_page(tab, page["name"], page["tooltip"])
self.tables.append(tab)
self.ins.set_entry(search_names, search_tips)
self.ins.search.connect("changed", self.search_entry_changed)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
self.button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(self.button_box, expand=False, fill=False)
self.build_image_button = HobButton("Build image")
# self.build_image_button.set_size_request(205, 49)
self.build_image_button.set_tooltip_text("Build target image")
self.build_image_button.set_flags(gtk.CAN_DEFAULT)
self.build_image_button.grab_default()
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
self.button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = HobAltButton("Cancel")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_end(self.back_button, expand=False, fill=False)
示例4: create_visual_elements
def create_visual_elements(self):
self.label = gtk.Label()
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visiable members
self.ins = HobNotebook()
self.tables = [] # we need modify table when the dialog is shown
# append the tabs in order
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.recipe_model.tree_model(filter))
tab.connect("toggled", self.table_toggled_cb, page['name'])
if page['name'] == "Included":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
label = gtk.Label(page['name'])
label.set_selectable(False)
label.set_tooltip_text(page['tooltip'])
self.ins.append_page(tab, label)
self.tables.append(tab)
self.ins.set_entry("Search recipes:")
# set the search entry for each table
for tab in self.tables:
search_tip = "Enter a recipe's or task's name to find it"
self.ins.search.set_tooltip_text(search_tip)
self.ins.search.props.has_tooltip = True
tab.set_search_entry(0, self.ins.search)
# add all into the window
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
button_box = gtk.HBox(False, 6)
self.box_group_area.pack_end(button_box, expand=False, fill=False)
self.build_packages_button = HobButton('Build packages')
self.build_packages_button.set_size_request(205, 49)
self.build_packages_button.set_tooltip_text("Build selected recipes into packages")
self.build_packages_button.set_flags(gtk.CAN_DEFAULT)
self.build_packages_button.grab_default()
self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
button_box.pack_end(self.build_packages_button, expand=False, fill=False)
self.back_button = HobAltButton("<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_start(self.back_button, expand=False, fill=False)
示例5: create_visual_elements
def create_visual_elements(self):
# create visual elements
self.vbox = gtk.VBox(False, 12)
self.progress_box = gtk.VBox(False, 12)
self.task_status = gtk.Label("\n") # to ensure layout is correct
self.task_status.set_alignment(0.0, 0.5)
self.progress_box.pack_start(self.task_status, expand=False, fill=False)
self.progress_hbox = gtk.HBox(False, 6)
self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
self.progress_bar = HobProgressBar()
self.progress_hbox.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = HobAltButton("Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.stop_button.set_sensitive(False)
self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)
self.notebook = HobNotebook()
self.config_tv = BuildConfigurationTreeView()
self.scrolled_view_config = gtk.ScrolledWindow()
self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_config.add(self.config_tv)
self.notebook.append_page(self.scrolled_view_config, "Build configuration")
self.failure_tv = BuildFailureTreeView()
self.failure_model = self.builder.handler.build.model.failure_model()
self.failure_tv.set_model(self.failure_model)
self.scrolled_view_failure = gtk.ScrolledWindow()
self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_failure.add(self.failure_tv)
self.notebook.append_page(self.scrolled_view_failure, "Issues")
self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
self.build_tv.set_model(self.builder.handler.build.model)
self.scrolled_view_build = gtk.ScrolledWindow()
self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_build.add(self.build_tv)
self.notebook.append_page(self.scrolled_view_build, "Log")
self.builder.handler.build.model.connect_after(
"row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv
)
self.button_box = gtk.HBox(False, 6)
self.back_button = HobAltButton("<< Back")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)
示例6: create_visual_elements
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, padding=15)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
search_names = []
search_tips = []
# append the tab
page = self.pages[0]
columns = page['columns']
name = page['name']
self.tab = HobViewTable(columns, name)
search_names.append(page['search'])
search_tips.append(page['searchtip'])
self.ins.set_entry(search_names, search_tips)
self.ins.search.connect("changed", self.search_entry_changed)
filter = page['filter']
sort_model = self.package_model.tree_model(filter, initial=True)
self.tab.set_model(sort_model)
self.tab.connect("toggled", self.table_toggled_cb, name)
self.tab.connect("button-release-event", self.button_click_cb)
self.tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
#self.tab.set_size_request(-1, 350)
self.ins.append_page(self.tab, page['name'], page['tooltip'])
self.tables.append(self.tab)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
self.button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(self.button_box, expand=False, fill=False)
self.build_image_button = HobButton('Build image')
self.build_image_button.set_tooltip_text("Build your image")
self.build_image_button.set_flags(gtk.CAN_DEFAULT)
self.build_image_button.grab_default()
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
self.button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = HobAltButton('Cancel')
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_end(self.back_button, expand=False, fill=False)
示例7: create_visual_elements
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
# append the tab
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.package_model.tree_model(filter))
tab.connect("toggled", self.table_toggled_cb, page['name'])
tab.connect_group_selection(self.table_selected_cb)
if page['name'] == "Included":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
self.ins.append_page(tab, page['name'])
self.tables.append(tab)
self.ins.set_entry("Search packages:")
# set the search entry for each table
for tab in self.tables:
tab.set_search_entry(0, self.ins.search)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(button_box, expand=False, fill=False)
self.build_image_button = HobButton('Build image')
self.build_image_button.set_size_request(205, 49)
self.build_image_button.set_tooltip_text("Build target image")
self.build_image_button.set_flags(gtk.CAN_DEFAULT)
self.build_image_button.grab_default()
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = HobAltButton("<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_start(self.back_button, expand=False, fill=False)
示例8: create_visual_elements
def create_visual_elements(self):
# create visual elements
self.vbox = gtk.VBox(False, 12)
self.progress_box = gtk.HBox(False, 6)
self.progress_bar = HobProgressBar()
self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = gtk.LinkButton("Stop the build process", "Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
self.notebook = HobNotebook()
self.config_tv = BuildConfigurationTreeView()
self.config_model = self.builder.handler.build.model.config_model()
self.config_tv.set_model(self.config_model)
self.scrolled_view_config = gtk.ScrolledWindow ()
self.scrolled_view_config.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_config.add(self.config_tv)
self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration"))
self.failure_tv = BuildFailureTreeView()
self.failure_model = self.builder.handler.build.model.failure_model()
self.failure_tv.set_model(self.failure_model)
self.scrolled_view_failure = gtk.ScrolledWindow ()
self.scrolled_view_failure.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_failure.add(self.failure_tv)
self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
self.build_tv = RunningBuildTreeView(readonly=True)
self.build_tv.set_model(self.builder.handler.build.model)
self.scrolled_view_build = gtk.ScrolledWindow ()
self.scrolled_view_build.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_build.add(self.build_tv)
self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
self.button_box = gtk.HBox(False, 6)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)
示例9: BuildDetailsPage
class BuildDetailsPage (HobPage):
def __init__(self, builder):
super(BuildDetailsPage, self).__init__(builder, "Building ...")
self.num_of_issues = 0
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
# create visual elements
self.vbox = gtk.VBox(False, 12)
self.progress_box = gtk.HBox(False, 6)
self.progress_bar = HobProgressBar()
self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = gtk.LinkButton("Stop the build process", "Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
self.notebook = HobNotebook()
self.config_tv = BuildConfigurationTreeView()
self.config_model = self.builder.handler.build.model.config_model()
self.config_tv.set_model(self.config_model)
self.scrolled_view_config = gtk.ScrolledWindow ()
self.scrolled_view_config.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_config.add(self.config_tv)
self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration"))
self.failure_tv = BuildFailureTreeView()
self.failure_model = self.builder.handler.build.model.failure_model()
self.failure_tv.set_model(self.failure_model)
self.scrolled_view_failure = gtk.ScrolledWindow ()
self.scrolled_view_failure.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_failure.add(self.failure_tv)
self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
self.build_tv = RunningBuildTreeView(readonly=True)
self.build_tv.set_model(self.builder.handler.build.model)
self.scrolled_view_build = gtk.ScrolledWindow ()
self.scrolled_view_build.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.scrolled_view_build.add(self.build_tv)
self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
self.button_box = gtk.HBox(False, 6)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)
def show_issues(self):
self.num_of_issues += 1
self.notebook.show_indicator_icon("Issues", self.num_of_issues)
def reset_issues(self):
self.num_of_issues = 0
self.notebook.hide_indicator_icon("Issues")
def _remove_all_widget(self):
children = self.vbox.get_children() or []
for child in children:
self.vbox.remove(child)
children = self.box_group_area.get_children() or []
for child in children:
self.box_group_area.remove(child)
children = self.get_children() or []
for child in children:
self.remove(child)
def show_page(self, step):
self._remove_all_widget()
if step == self.builder.PACKAGE_GENERATING or step == self.builder.FAST_IMAGE_GENERATING:
self.title = "Building packages ..."
else:
self.title = "Building image ..."
self.build_details_top = self.add_onto_top_bar(None)
self.pack_start(self.build_details_top, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
self.box_group_area.pack_start(self.vbox, expand=True, fill=True)
self.progress_bar.reset()
self.vbox.pack_start(self.progress_box, expand=False, fill=False)
self.vbox.pack_start(self.notebook, expand=True, fill=True)
self.box_group_area.pack_end(self.button_box, expand=False, fill=False)
self.show_all()
self.back_button.hide()
def update_progress_bar(self, title, fraction, status=True):
self.progress_bar.update(fraction)
self.progress_bar.set_title(title)
self.progress_bar.set_rcstyle(status)
def back_button_clicked_cb(self, button):
self.builder.show_configuration()
def show_back_button(self):
self.back_button.show()
#.........這裏部分代碼省略.........
示例10: PackageSelectionPage
class PackageSelectionPage (HobPage):
pages = [
{
'name' : 'All packages',
'filter' : {},
'columns' : [{
'col_name' : 'Name',
'col_id' : PackageListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'size',
'col_id' : PackageListModel.COL_SIZE,
'col_style': 'text',
'col_min' : 100,
'col_max' : 500
}, {
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}]
}, {
'name' : 'Included',
'filter' : { PackageListModel.COL_INC : [True] },
'columns' : [{
'col_name' : 'Name',
'col_id' : PackageListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 300
}, {
'col_name' : 'Brought by',
'col_id' : PackageListModel.COL_BINB,
'col_style': 'text',
'col_min' : 100,
'col_max' : 350
}, {
'col_name' : 'size',
'col_id' : PackageListModel.COL_SIZE,
'col_style': 'text',
'col_min' : 100,
'col_max' : 300
}, {
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}]
}
]
def __init__(self, builder):
super(PackageSelectionPage, self).__init__(builder, "Package Selection")
# set invisiable members
self.package_model = self.builder.package_model
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visiable members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
# append the tab
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.package_model.tree_model(filter))
tab.connect("toggled", self.table_toggled_cb)
if page['name'] == "Included":
tab.connect("row-activated", self.tree_row_activated_cb)
label = gtk.Label(page['name'])
self.ins.append_page(tab, label)
self.tables.append(tab)
self.ins.set_entry("Search packages:")
# set the search entry for each table
for tab in self.tables:
tab.set_search_entry(0, self.ins.search)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(button_box, expand=False, fill=False)
self.build_image_button = gtk.Button()
#.........這裏部分代碼省略.........
示例11: PackageSelectionPage
class PackageSelectionPage (HobPage):
pages = [
{
'name' : 'Included',
'filter' : { PackageListModel.COL_INC : [True] },
'columns' : [{
'col_name' : 'Package name',
'col_id' : PackageListModel.COL_NAME,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'text',
'col_min' : 100,
'col_max' : 300,
'expand' : 'True'
}, {
'col_name' : 'Brought in by',
'col_id' : PackageListModel.COL_BINB,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'binb',
'col_min' : 100,
'col_max' : 350,
'expand' : 'True'
}, {
'col_name' : 'Size',
'col_id' : PackageListModel.COL_SIZE,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'text',
'col_min' : 100,
'col_max' : 300,
'expand' : 'True'
}, {
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'check toggle',
'col_group': 'tree store group',
'col_min' : 100,
'col_max' : 100
}]
}, {
'name' : 'All packages',
'filter' : {},
'columns' : [{
'col_name' : 'Package name',
'col_id' : PackageListModel.COL_NAME,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400,
'expand' : 'True'
}, {
'col_name' : 'Size',
'col_id' : PackageListModel.COL_SIZE,
'col_t_id' : PackageListModel.COL_FONT,
'col_style': 'text',
'col_min' : 100,
'col_max' : 500,
'expand' : 'True'
}, {
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_style': 'check toggle',
'col_group': 'tree store group',
'col_min' : 100,
'col_max' : 100
}]
}
]
def __init__(self, builder):
super(PackageSelectionPage, self).__init__(builder, "Packages")
# set invisiable members
self.recipe_model = self.builder.recipe_model
self.package_model = self.builder.package_model
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visiable members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
# append the tab
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.package_model.tree_model(filter))
tab.connect("toggled", self.table_toggled_cb, page['name'])
tab.connect_group_selection(self.table_selected_cb)
if page['name'] == "Included":
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
label = gtk.Label(page['name'])
#.........這裏部分代碼省略.........
示例12: PackageSelectionPage
#.........這裏部分代碼省略.........
}, {
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 100,
'col_max' : 100
}]
}
]
(INCLUDED,
ALL) = range(2)
def __init__(self, builder):
super(PackageSelectionPage, self).__init__(builder, "Edit packages")
# set invisible members
self.recipe_model = self.builder.recipe_model
self.package_model = self.builder.package_model
# create visual elements
self.create_visual_elements()
def included_clicked_cb(self, button):
self.ins.set_current_page(self.INCLUDED)
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
search_names = []
search_tips = []
# append the tab
for page in self.pages:
columns = page['columns']
name = page['name']
tab = HobViewTable(columns, name)
search_names.append(page['search'])
search_tips.append(page['searchtip'])
filter = page['filter']
sort_model = self.package_model.tree_model(filter, initial=True)
tab.set_model(sort_model)
tab.connect("toggled", self.table_toggled_cb, name)
tab.connect("button-release-event", self.button_click_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
self.ins.append_page(tab, page['name'], page['tooltip'])
self.tables.append(tab)
self.ins.set_entry(search_names, search_tips)
self.ins.search.connect("changed", self.search_entry_changed)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
self.button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(self.button_box, expand=False, fill=False)
self.build_image_button = HobButton('Build image')
#self.build_image_button.set_size_request(205, 49)
self.build_image_button.set_tooltip_text("Build target image")
示例13: RecipeSelectionPage
class RecipeSelectionPage (HobPage):
pages = [
{
'name' : 'Recipe',
'filter' : { RecipeListModel.COL_TYPE : ['recipe'] },
'columns' : [{
'col_name' : 'Recipe',
'col_id' : RecipeListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'License',
'col_id' : RecipeListModel.COL_LIC,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'Group',
'col_id' : RecipeListModel.COL_GROUP,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'Included',
'col_id' : RecipeListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}]
}, {
'name' : 'Recipe Collection',
'filter' : { RecipeListModel.COL_TYPE : ['task'] },
'columns' : [{
'col_name' : 'Recipe Collection',
'col_id' : RecipeListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'Description',
'col_id' : RecipeListModel.COL_DESC,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'Included',
'col_id' : RecipeListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}]
}, {
'name' : 'Included',
'filter' : { RecipeListModel.COL_INC : [True],
RecipeListModel.COL_TYPE : ['recipe', 'task'] },
'columns' : [{
'col_name' : 'Recipe',
'col_id' : RecipeListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 400
}, {
'col_name' : 'Brought by',
'col_id' : RecipeListModel.COL_BINB,
'col_style': 'text',
'col_min' : 100,
'col_max' : 500
}, {
'col_name' : 'Included',
'col_id' : RecipeListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}]
}
]
def __init__(self, builder = None):
super(RecipeSelectionPage, self).__init__(builder, "Recipe Selection")
# set invisiable members
self.recipe_model = self.builder.recipe_model
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
self.label = gtk.Label("Recipes included: %s" % len(self.builder.configuration.selected_recipes))
self.eventbox = self.add_onto_top_bar(self.label, 73)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visiable members
self.ins = HobNotebook()
self.tables = [] # we need modify table when the dialog is shown
# append the tabs in order
for page in self.pages:
columns = page['columns']
tab = HobViewTable(columns)
#.........這裏部分代碼省略.........
示例14: BuildDetailsPage
class BuildDetailsPage (HobPage):
def __init__(self, builder):
super(BuildDetailsPage, self).__init__(builder, "Building ...")
self.num_of_issues = 0
self.endpath = (0,)
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
# create visual elements
self.vbox = gtk.VBox(False, 12)
self.progress_box = gtk.VBox(False, 12)
self.task_status = gtk.Label("\n") # to ensure layout is correct
self.task_status.set_alignment(0.0, 0.5)
self.progress_box.pack_start(self.task_status, expand=False, fill=False)
self.progress_hbox = gtk.HBox(False, 6)
self.progress_box.pack_end(self.progress_hbox, expand=True, fill=True)
self.progress_bar = HobProgressBar()
self.progress_hbox.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = HobAltButton("Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.stop_button.set_sensitive(False)
self.progress_hbox.pack_end(self.stop_button, expand=False, fill=False)
self.notebook = HobNotebook()
self.config_tv = BuildConfigurationTreeView()
self.scrolled_view_config = gtk.ScrolledWindow ()
self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_config.add(self.config_tv)
self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build configuration"))
self.failure_tv = BuildFailureTreeView()
self.failure_model = self.builder.handler.build.model.failure_model()
self.failure_tv.set_model(self.failure_model)
self.scrolled_view_failure = gtk.ScrolledWindow ()
self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_failure.add(self.failure_tv)
self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
self.build_tv.set_model(self.builder.handler.build.model)
self.scrolled_view_build = gtk.ScrolledWindow ()
self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.scrolled_view_build.add(self.build_tv)
self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)
self.button_box = gtk.HBox(False, 6)
self.back_button = HobAltButton("<< Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)
def update_build_status(self, current, total, task):
recipe_path, recipe_task = task.split(", ")
recipe = os.path.basename(recipe_path).rstrip(".bb")
tsk_msg = "<b>Running task %s of %s:</b> %s\n<b>Recipe:</b> %s" % (current, total, recipe_task, recipe)
self.task_status.set_markup(tsk_msg)
self.stop_button.set_sensitive(True)
def reset_build_status(self):
self.task_status.set_markup("\n") # to ensure layout is correct
self.endpath = (0,)
def show_issues(self):
self.num_of_issues += 1
self.notebook.show_indicator_icon("Issues", self.num_of_issues)
def reset_issues(self):
self.num_of_issues = 0
self.notebook.hide_indicator_icon("Issues")
def _remove_all_widget(self):
children = self.vbox.get_children() or []
for child in children:
self.vbox.remove(child)
children = self.box_group_area.get_children() or []
for child in children:
self.box_group_area.remove(child)
children = self.get_children() or []
for child in children:
self.remove(child)
def show_page(self, step):
self._remove_all_widget()
if step == self.builder.PACKAGE_GENERATING or step == self.builder.FAST_IMAGE_GENERATING:
self.title = "Building packages ..."
else:
self.title = "Building image ..."
self.build_details_top = self.add_onto_top_bar(None)
self.pack_start(self.build_details_top, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
self.box_group_area.pack_start(self.vbox, expand=True, fill=True)
self.progress_bar.reset()
self.config_tv.reset()
#.........這裏部分代碼省略.........
示例15: PackageSelectionPage
class PackageSelectionPage (HobPage):
pages = [
{
'name' : 'All packages',
'tooltip' : 'All packages that have been built',
'filter' : {},
'search' : 'Search packages by name',
'searchtip' : 'Enter a package name to find it',
'columns' : [{
'col_name' : 'Included',
'col_id' : PackageListModel.COL_INC,
'col_style': 'check toggle',
'col_min' : 50,
'col_max' : 50
}, {
'col_name' : 'Package name',
'col_id' : PackageListModel.COL_NAME,
'col_style': 'text',
'col_min' : 100,
'col_max' : 200,
'expand' : 'True'
}, {
'col_name' : 'Size',
'col_id' : PackageListModel.COL_SIZE,
'col_style': 'text',
'col_min' : 80,
'col_max' : 80,
'expand' : 'True'
}, {
'col_name' : 'Brought in by',
'col_id' : PackageListModel.COL_BINB,
'col_style': 'binb',
'col_min' : 150,
'col_max' : 170,
'expand' : 'True'
}]
}
]
(INCLUDED,
ALL) = range(2)
def __init__(self, builder):
super(PackageSelectionPage, self).__init__(builder, "Edit packages")
# set invisible members
self.recipe_model = self.builder.recipe_model
self.package_model = self.builder.package_model
# create visual elements
self.create_visual_elements()
def create_visual_elements(self):
self.label = gtk.Label("Packages included: 0\nSelected packages size: 0 MB")
self.eventbox = self.add_onto_top_bar(self.label, padding=15)
self.pack_start(self.eventbox, expand=False, fill=False)
self.pack_start(self.group_align, expand=True, fill=True)
# set visible members
self.ins = HobNotebook()
self.tables = [] # we need to modify table when the dialog is shown
search_names = []
search_tips = []
# append the tab
page = self.pages[0]
columns = page['columns']
name = page['name']
self.tab = HobViewTable(columns, name)
search_names.append(page['search'])
search_tips.append(page['searchtip'])
self.ins.set_entry(search_names, search_tips)
self.ins.search.connect("changed", self.search_entry_changed)
filter = page['filter']
sort_model = self.package_model.tree_model(filter, initial=True)
self.tab.set_model(sort_model)
self.tab.connect("toggled", self.table_toggled_cb, name)
self.tab.connect("button-release-event", self.button_click_cb)
self.tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include, filter)
#self.tab.set_size_request(-1, 350)
self.ins.append_page(self.tab, page['name'], page['tooltip'])
self.tables.append(self.tab)
# add all into the dialog
self.box_group_area.pack_start(self.ins, expand=True, fill=True)
self.button_box = gtk.HBox(False, 6)
self.box_group_area.pack_start(self.button_box, expand=False, fill=False)
self.build_image_button = HobButton('Build image')
self.build_image_button.set_tooltip_text("Build your image")
self.build_image_button.set_flags(gtk.CAN_DEFAULT)
self.build_image_button.grab_default()
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
self.button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = HobAltButton('Cancel')
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_end(self.back_button, expand=False, fill=False)
#.........這裏部分代碼省略.........