def bottom_bar_handler(self, tim: time, text: str, action: str):
"""Add actions to the eventlist in the bottom bar.
:param tim: Time of action.
:param text: Recognized text.
:param action: Action performed.
"""
row = Gtk.ListBoxRow()
box = Gtk.HBox()
box.set_homogeneous(True)
text_label = Gtk.Label(text)
text_label.set_line_wrap(True)
box.pack_start(Gtk.Label(tim), False, False, 0)
box.pack_start(text_label, True, True, 0)
box.pack_start(Gtk.Label(action), False, False, 0)
row.add(box)
# Remove old entries
if self.bottom_widget.get_object("event_list").get_row_at_index(40):
self.bottom_widget.get_object("event_list").get_row_at_index(40).destroy()
row.show_all()
self.bottom_widget.get_object("event_list").prepend(row)
python类HBox()的实例源码
def buildTree(self, *args):
for item in self.files:
a = Gtk.Label(item)
if os.path.isdir(self.projectPath + '/' + item):
i = Gtk.Image.new_from_icon_name('folder', Gtk.IconSize.MENU) # change this for recursive function
else:
i = Gtk.Image.new_from_icon_name('text-x-script', Gtk.IconSize.MENU)
hb = Gtk.HBox(spacing=6)
hb.pack_start(i, False, False, 0)
hb.pack_start(a, False, False, 0)
row = Gtk.ListBoxRow()
row.add(hb)
self.sideView.add(row)
self.sideView.show_all()
def add_module_is_deprecated_label(self):
"""
The deprecated module must set a message in self.g_deprecated_label
in on_start_practise, preferable telling the file name of the
lesson file.
"""
img = Gtk.Image()
img.set_from_stock(Gtk.STOCK_DIALOG_WARNING,
Gtk.IconSize.BUTTON)
hbox = Gtk.HBox()
hbox.set_border_width(12)
self.practise_box.set_child_packing(self.g_lesson_heading, False, False, 0, 0)
hbox.set_spacing(6)
hbox.pack_start(img, True, True, 0)
self.g_deprecated_label = Gtk.Label()
hbox.pack_start(self.g_deprecated_label, True, True, 0)
self.practise_box.pack_start(hbox, False, False, 0)
self.practise_box.reorder_child(hbox, 0)
def add_select_num_beats_gui(self):
###
hbox = Gtk.HBox()
hbox.set_spacing(gu.hig.SPACE_SMALL)
label = Gtk.Label(label=_("Number of beats in question:"))
hbox.pack_start(label, False, False, 0)
self.config_box_sizegroup.add_widget(label)
label.set_alignment(1.0, 0.5)
hbox.pack_start(gu.nSpinButton(self.m_exname, "num_beats",
Gtk.Adjustment(4, 1, 100, 1, 10)), False, False, 0)
self.config_box.pack_start(hbox, False, False, 0)
hbox.show_all()
#
hbox = Gtk.HBox()
hbox.set_spacing(gu.hig.SPACE_SMALL)
label = Gtk.Label(label=_("Count in before question:"))
hbox.pack_start(label, False, False, 0)
self.config_box_sizegroup.add_widget(label)
label.set_alignment(1.0, 0.5)
hbox.pack_start(gu.nSpinButton(self.m_exname, "count_in",
Gtk.Adjustment(2, 0, 10, 1, 10)), False, False, 0)
hbox.show_all()
self.config_box.pack_start(hbox, False, False, 0)
def add_lock_to_key_gui(self):
# gui to lock to a key
def toggle_lock_to_key_sensitivity(checkbutton):
self.g_notename.set_sensitive(checkbutton.get_active())
self.g_scaletype.set_sensitive(checkbutton.get_active())
self.g_lock_to_key_hbox = Gtk.HBox(False, gu.hig.SPACE_SMALL)
self.config_box.pack_start(self.g_lock_to_key_hbox, False, False, 0)
check = gu.nCheckButton(self.m_exname, 'lock-to-key',
_("Lock intervals to key:"),
callback = toggle_lock_to_key_sensitivity)
self.g_lock_to_key_hbox.pack_start(check, False, False, 0)
self.g_notename = gu.nComboBox(self.m_exname, 'lock-to-key-note',
mpd.MusicalPitch.new_from_int(60).get_user_notename(),
[mpd.MusicalPitch.new_from_int(60 + x).get_user_notename() for x in range(12)])
self.g_notename.show()
self.g_lock_to_key_hbox.pack_start(self.g_notename, False, False, 0)
self.g_scaletype = gu.nComboBox(self.m_exname, 'lock-to-key-scaletype', _("Major"), [n['name'] for n in utils.key_data.values()])
self.g_scaletype.show()
self.g_lock_to_key_hbox.pack_start(self.g_scaletype, False, False, 0)
toggle_lock_to_key_sensitivity(check)
def __init__(self, statistics, heading):
Gtk.ScrolledWindow.__init__(self)
self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self.vbox = Gtk.VBox(False, 0)
self.vbox.set_spacing(gu.PAD)
self.vbox.set_border_width(gu.PAD)
self.add_with_viewport(self.vbox)
hbox = Gtk.HBox(False, 0)
hbox.set_spacing(gu.hig.SPACE_SMALL)
im = Gtk.Image.new_from_file("graphics/applications-system.svg")
self.g_settings_button = b = Gtk.Button()
b.connect('clicked', self.on_delete_statistics)
b.add(im)
hbox.pack_start(b, False, False, 0)
self.g_heading = Gtk.Label(label=heading)
self.g_heading.set_alignment(0.0, 0.5)
self.g_heading.set_name("StatisticsH1")
hbox.pack_start(self.g_heading, False, False, 0)
self.vbox.pack_start(hbox, False, False, 0)
self.m_statistics = statistics
self.g_tables = Gtk.VBox(False, 0)
self.g_tables.show()
self.vbox.pack_start(self.g_tables, True, True, 0)
self.show_all()
def __init__(self, exname, name, sizegroup):
Gtk.VBox.__init__(self)
cfg.ConfigUtils.__dict__['__init__'](self, exname)
self.m_name = name
hbox = gu.bHBox(self)
hbox.set_spacing(gu.PAD_SMALL)
self.g_button = Gtk.Button(
soundcard.instrument_names[self.get_int(self.m_name)])
self.g_button.connect('clicked', self.on_btnclick)
hbox.pack_start(self.g_button, True, True, 0)
g = Gtk.VolumeButton()
g.props.value = self.get_int('%s_volume' % name) / MAX_VOLUME
def ff(volumebutton, value):
self.set_int('%s_volume' % name, int(value * MAX_VOLUME))
g.connect('value-changed', ff)
hbox.pack_start(g, False, False, 0)
self.g_menu = MidiInstrumentMenu(self.on_instrument_selected)
self.m_instrument = self.get_int('preferred_instrument')
hbox = Gtk.HBox()
hbox.set_spacing(6)
self.pack_start(hbox, True, True, 0)
def create_tab(self, title, tab_child, icon=''):
tab_box = Gtk.HBox(False, 3)
close_button = Gtk.Button()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
label = Gtk.Label(label=title)
if icon:
i = Gtk.Image()
i.set_from_stock(eval('Gtk.STOCK_' + icon), Gtk.IconSize.MENU)
tab_box.pack_start(i, False, False, 0)
close_button.connect("clicked", self.close_tab, tab_child)
close_button.set_image(image)
close_button.set_relief(Gtk.ReliefStyle.NONE)
tab_box.pack_start(label, True, True, 0)
tab_box.pack_end(close_button, False, False, 0)
tab_box.show_all()
if title in ['Loading dasm...', 'Code', 'Callgraph', 'Flowgraph', 'Interactive', 'Strings', "Sections", 'Hexdump', 'Bindiff', 'File info']:
close_button.hide()
return tab_box
def __init__(self):
self.main_window = Gtk.Window()
self.main_window.set_border_width(5)
self.main_window.connect("destroy", self._destroy)
self.main_vbox = Gtk.VBox()
self.select_hbox = Gtk.HBox()
self.select_button = Gtk.Button("Select")
self.select_button.connect("clicked", self._select_clicked)
self.select_hbox.pack_start(self.select_button, False, True, 0)
self.file_combo = Gtk.ComboBoxText()
self.file_combo.connect("changed", self._file_combo_changed)
self.select_hbox.pack_start(self.file_combo, True, True, 0)
self.main_vbox.pack_start(self.select_hbox, False, True, 0)
self.metadata_table = Gtk.Table(1, 1)
self.metadata_table.attach(
Gtk.Label("Select a file to view metadata information..."), 0, 1, 0, 1)
self.main_vbox.pack_start(self.metadata_table, True, True, 0)
self.main_window.add(self.main_vbox)
self.main_window.show_all()
def _append_recommended_for_you(self):
# TODO: This space will initially contain an opt-in screen, and this
# will update to the tile view of recommended apps when ready
# see https://wiki.ubuntu.com/SoftwareCenter#Home_screen
self.bottom_hbox = Gtk.HBox(spacing=StockEms.SMALL)
bottom_hbox_alignment = Gtk.Alignment()
bottom_hbox_alignment.set_padding(0, 0, StockEms.MEDIUM - 2,
StockEms.MEDIUM - 2)
bottom_hbox_alignment.add(self.bottom_hbox)
self.vbox.pack_start(bottom_hbox_alignment, False, False, 0)
# TODO: During development, place the "Recommended For You" panel
# at the bottom, but swap this with the Top Rated panel once
# the recommended for you pieces are done and deployed
# see https://wiki.ubuntu.com/SoftwareCenter#Home_screen
self.recommended_for_you_panel = RecommendationsPanelLobby(self)
self.bottom_hbox.pack_start(self.recommended_for_you_panel,
True, True, 0)
def _add_progress_ui(self):
# create toolbar box
self.header = Gtk.HBox()
# add spinner
self.spinner = Gtk.Spinner()
self.header.pack_start(self.spinner, False, False, 6)
# add a url to the toolbar
self.url = Gtk.Label()
self.url.set_ellipsize(Pango.EllipsizeMode.END)
self.url.set_alignment(0.0, 0.5)
self.url.set_text("")
self.header.pack_start(self.url, True, True, 0)
# frame around the box
self.frame = Gtk.Frame()
self.frame.set_border_width(3)
self.frame.add(self.header)
self.pack_start(self.frame, False, False, 6)
# connect the webkit stuff
self.webkit.connect("notify::uri", self._on_uri_changed)
self.webkit.connect("notify::load-status",
self._on_load_status_changed)
def get_test_buttons_window():
win = Gtk.Window()
win.set_size_request(200, 200)
vb = Gtk.VBox(spacing=12)
win.add(vb)
link = Link("<small>test link</small>", uri="www.google.co.nz")
vb.pack_start(link, False, False, 0)
button = Gtk.Button()
button.set_label("channels")
channels_button = ChannelSelector(button)
channels_button.parent_style_type = Gtk.Window
channels_button.set_build_func(_build_channels_list)
hb = Gtk.HBox()
hb.pack_start(button, False, False, 0)
hb.pack_start(channels_button, False, False, 0)
vb.pack_start(hb, False, False, 0)
win.show_all()
win.connect("destroy", Gtk.main_quit)
return win
def get_test_symbolic_icons_window():
win = Gtk.Window()
win.set_border_width(20)
hb = Gtk.HBox(spacing=12)
win.add(hb)
ico = SymbolicIcon("available")
hb.add(ico)
ico = PendingSymbolicIcon("pending")
ico.start()
ico.set_transaction_count(33)
hb.add(ico)
ico = PendingSymbolicIcon("pending")
ico.start()
ico.set_transaction_count(1)
hb.add(ico)
win.show_all()
win.connect("destroy", Gtk.main_quit)
return win
def get_test_buttons_window():
win = Gtk.Window()
win.set_size_request(200, 200)
vb = Gtk.VBox(spacing=12)
win.add(vb)
link = Link("<small>test link</small>", uri="www.google.co.nz")
vb.pack_start(link, False, False, 0)
button = Gtk.Button()
button.set_label("channels")
channels_button = ChannelSelector(button)
channels_button.parent_style_type = Gtk.Window
channels_button.set_build_func(_build_channels_list)
hb = Gtk.HBox()
hb.pack_start(button, False, False, 0)
hb.pack_start(channels_button, False, False, 0)
vb.pack_start(hb, False, False, 0)
win.show_all()
win.connect("destroy", Gtk.main_quit)
return win
def get_test_symbolic_icons_window():
win = Gtk.Window()
win.set_border_width(20)
hb = Gtk.HBox(spacing=12)
win.add(hb)
ico = SymbolicIcon("available")
hb.add(ico)
ico = PendingSymbolicIcon("pending")
ico.start()
ico.set_transaction_count(33)
hb.add(ico)
ico = PendingSymbolicIcon("pending")
ico.start()
ico.set_transaction_count(1)
hb.add(ico)
win.show_all()
win.connect("destroy", Gtk.main_quit)
return win
def __init__(self, lat=39.36873, lon=-2.417274645879, units='F'):
self.images = {}
self.echo = True
Gtk.Window.__init__(self)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
self.set_title(comun.APP)
self.set_default_size(900, 600)
self.set_icon_from_file(comun.ICON)
self.connect('destroy', self.close_application)
#
vbox = Gtk.VBox(spacing=5)
self.get_content_area().add(vbox)
hbox1 = Gtk.HBox()
vbox.pack_start(hbox1, True, True, 0)
self.scrolledwindow1 = Gtk.ScrolledWindow()
self.scrolledwindow1.set_policy(
Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self.scrolledwindow1.set_shadow_type(Gtk.ShadowType.IN)
hbox1.pack_start(self.scrolledwindow1, True, True, 0)
self.viewer = WebKit.WebView()
self.scrolledwindow1.add(self.viewer)
self.scrolledwindow1.set_size_request(900, 600)
self.viewer.connect('title-changed', self.title_changed)
self.viewer.open('file://' + comun.HTML)
self.lat = lat
self.lon = lon
self.units = units
self.set_focus(self.viewer)
self.show_all()
self.message_queue = queue.Queue()
while Gtk.events_pending():
Gtk.main_iteration()
self.show_all()
self.inicialize()
self.run()
self.destroy()
# ###################################################################
# #########################ENGINE####################################
# ###################################################################
def get_image_with_text(text, image=None):
hbox = Gtk.HBox()
if image:
image = load_image(os.path.join(comun.IMAGESDIR, image))
# image = Gtk.Image.new_from_file(image)
image.set_alignment(1, 0.5)
hbox.pack_start(image, True, True, 0)
label = Gtk.Label.new(text)
label.set_alignment(0, 0.5)
hbox.pack_start(label, True, True, 0)
return hbox
def applySettings(self, *args):
self.sview.set_show_line_numbers(self.showLineNumbers)
self.sbuff.set_highlight_matching_brackets(self.highlightMatchingBrackets)
if self.wordWrap:
self.sview.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
else:
self.sview.set_wrap_mode(Gtk.WrapMode.NONE)
Gtk.Settings.get_default().set_property('gtk-application-prefer-dark-theme', self.darkMode)
self.autoToggling = True
self.toggleDarkCheck.set_active(self.darkMode)
self.toggleHighlightCheck.set_active(self.highlightMatchingBrackets)
self.toggleLineCheck.set_active(self.showLineNumbers)
self.toggleWordWrap.set_active(self.wordWrap)
self.autoToggling = False
self.terminal.set_color_background(self.sview.get_style_context().get_background_color(Gtk.StateFlags.NORMAL))
if hasattr(self, 'gitButton'):
text = Repository(self.projectPath).head.shorthand
repo = Gtk.HBox(spacing=6)
img = None
if self.darkMode:
img = Gtk.Image.new_from_file('resources/icons/git-branch-white.svg')
else:
img = Gtk.Image.new_from_file('resources/icons/git-branch.svg')
repo.pack_start(img, False, False, 0)
repo.pack_start(Gtk.Label(text), False, False, 0)
repo.show_all()
self.gitButton.remove(self.gitButton.get_child())
self.gitButton.set_tooltip_text("On branch " + text)
self.gitButton.add(repo)
def __init__(self):
Gtk.HBox.__init__(self)
self.checkbox_dict = {}
for x in range(1, mpd.interval.max_interval + 1):
self.checkbox_dict[x] = c \
= Gtk.ToggleButton(mpd.interval.short_name[x])
c.connect('toggled', self.on_toggle)
c.show()
self.pack_start(c, True, True, 0)
def update_select_elements_buttons(self):
"""
(Re)create the checkbuttons used to select which rhythm elements
to be used when creating questions. We only need to do this if
we are in m_custom_mode.
"""
for but in self.soltogglebuttons:
but.destroy()
self.soltogglebuttons = []
gs = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
for i, v in enumerate((
[1, 4, -1, 8, 11, -1, 15, 18, 21, -1, 25, 28, -1, 32],
[0, 3, 6, 7, 10, 13, 14, 17, 20, 23, 24, 27, 30, 31, 34],
[2, 5, -1, 9, 12, -1, 16, 19, 22, -1, 26, 29, -1, 33])):
hbox = Gtk.HBox(True, 0)
for k in v:
b = self.soltogglebutton(k)
gs.add_widget(b)
for n in self.m_t.m_P.header.solmisation_elements:
if k == n:
b.set_active(True)
hbox.pack_start(b, True, True, 0)
self.soltogglebuttons.append(b)
spacing = Gtk.Alignment()
if i in (0, 2):
spacing.set_property('left-padding', 16)
spacing.set_property('right-padding', 16)
spacing.add(hbox)
self.g_select_rhythms_box.pack_start(spacing, True, True, 0)
spacing.show_all()
def __init__(self, teacher):
abstract.LessonbasedGui.__init__(self, teacher)
################
# practise_box #
################
self.g_contents = Gtk.Table()
hbox = gu.bHBox(self.practise_box, True, False)
hbox.pack_start(Gtk.HBox(), True, True, 0)
hbox.pack_start(self.g_contents, True, True, 0)
hbox.pack_start(Gtk.HBox(), True, True, 0)
self.g_contents.set_col_spacings(gu.PAD)
self.g_contents.set_row_spacings(gu.PAD)
self.g_music_displayer = mpd.MusicDisplayer()
self.g_music_displayer.set_size_request(100, -1)
self.g_contents.attach(self.g_music_displayer, 1, 2, 1, 2)
self.g_flashbar = gu.FlashBar()
self.practise_box.pack_start(self.g_flashbar, False, False, 0)
self.std_buttons_add(
('new', self.new_question),
('repeat', lambda w: self.run_exception_handled(self.m_t.m_P.play_question)),
('repeat_arpeggio', lambda w: self.run_exception_handled(self.m_t.m_P.play_question_arpeggio)),
('give_up', self.give_up))
self.practise_box.show_all()
##############
# config_box #
##############
self.config_box.set_spacing(gu.PAD_SMALL)
self.add_random_transpose_gui()
# -----------------------------------------
self.g_select_questions_category_box, category_box= gu.hig_category_vbox(
_("Chord types to ask"))
self.config_box.pack_start(self.g_select_questions_category_box, True, True, 0)
self.g_select_questions = QuestionNameCheckButtonTable(self.m_t)
self.g_select_questions.initialize(4, 0)
category_box.pack_start(self.g_select_questions, False, False, 0)
self.g_select_questions.show()
def __init__(self, parent):
Gtk.Frame.__init__(self)
self.set_shadow_type(Gtk.ShadowType.IN)
self.g_parent = parent
self.g_box = Gtk.HBox(False, 0)
self.g_box.show()
self.g_box.set_spacing(gu.PAD_SMALL)
self.g_box.set_border_width(gu.PAD)
self.add(self.g_box)
self.m_data = []
# the number of rhythm elements the viewer is supposed to show
self.m_num_beats = 0
self.g_face = None
self.__timeout = None
def __init__(self, teacher):
abstract.LessonbasedGui.__init__(self, teacher)
self.m_key_bindings = {'backspace_ak': self.on_backspace}
self.g_music_displayer = mpd.MusicDisplayer()
self.practise_box.pack_start(self.g_music_displayer, False, False, 0)
self.g_answer_button_box = gu.NewLineBox()
self.practise_box.pack_start(self.g_answer_button_box, False, False, 0)
# The user fill the answer in this box
self.g_answer_frame = Gtk.Frame()
self.g_answer_frame.set_shadow_type(Gtk.ShadowType.IN)
self.practise_box.pack_start(self.g_answer_frame, False, False, 0)
self.g_answer = Gtk.HBox()
self.g_answer_frame.add(self.g_answer)
self.g_answer_frame.show_all()
# Flashbar
self.g_flashbar = gu.FlashBar()
self.g_flashbar.show()
self.practise_box.pack_start(self.g_flashbar, False, False, 0)
# action area
self.std_buttons_add(
('new', self.new_question),
('play_music', lambda w: self.run_exception_handled(self.m_t.m_P.play_question)),
('display_music', self.show_answer),
('repeat', self.repeat_question),
('guess_answer', self.guess_answer),
('play_tonic', lambda w: self.run_exception_handled(self.m_t.play_tonic)),
('give_up', self.give_up),
('backspace', self.on_backspace),
)
##############
# statistics #
##############
self.setup_statisticsviewer(statisticsviewer.StatisticsViewer, "")
def __init__(self, teacher):
abstract.Gui.__init__(self, teacher)
#
self.g_music_displayer = mpd.MusicDisplayer()
self.practise_box.pack_start(self.g_music_displayer, False, False, 0)
#
self.g_tap = gu.bButton(self.practise_box, _("Tap here"), self.on_tap)
self.std_buttons_add(
('new', self.on_new_question),
('play_music', lambda w: self.run_exception_handled(self.m_t.m_P.play_question)),
('display_music', self.show_answer),
('repeat', self.on_repeat),
('give_up', self.on_give_up))
# Flashbar
self.g_flashbar = gu.FlashBar()
self.g_flashbar.show()
self.practise_box.pack_start(self.g_flashbar, False, False, 0)
# Config box
label = Gtk.Label(label=_("Accuracy required:"))
self.config_box_sizegroup.add_widget(label)
label.set_alignment(1.0, 0.5)
spin = gu.nSpinButton(self.m_exname, 'accuracy',
Gtk.Adjustment(0, 0, 2, 0.01, 0.05))
spin.set_tooltip_text("See bug report #93 (http://bugs.solfege.org/93) and add suggested values to the bug report.")
spin.set_digits(2)
hbox = Gtk.HBox()
hbox.set_spacing(gu.hig.SPACE_SMALL)
hbox.pack_start(label, False, False, 0)
hbox.pack_start(spin, False, False, 0)
self.config_box.pack_start(hbox, False, False, 0)
hbox.show_all()
def __init__(self, parent):
Gtk.Frame.__init__(self)
self.set_shadow_type(Gtk.ShadowType.IN)
self.g_parent = parent
self.g_box = Gtk.HBox()
self.g_box.show()
self.g_box.set_spacing(gu.PAD_SMALL)
self.g_box.set_border_width(gu.PAD)
self.add(self.g_box)
self.m_data = []
# the number of rhythm elements the viewer is supposed to show
self.m_num_notes = 0
self.g_face = None
self.__timeout = None
def __init__(self, teacher):
abstract.IntervalGui.__init__(self, teacher)
self.g_test_stat_dlg = None
self.std_buttons_add(('give_up', self.give_up))
##############
# config_box #
##############
self.g_mici = MultipleIntervalConfigWidget(self.m_exname)
self.config_box.pack_start(self.g_mici, False, False, 0)
box = Gtk.HBox(False, 0)
self.config_box.pack_start(box, False, False,
padding=gu.PAD_SMALL)
self._add_auto_new_question_gui(self.config_box)
# ----------------------------------
self._create_select_inputwidget_gui()
self.add_lock_to_key_gui()
self.config_box.show_all()
##############
# statistics #
##############
self.setup_statisticsviewer(statisticsviewer.StatisticsViewer,
_("Melodic interval"))
self.select_inputwidget()
def _f(watchvar):
# The variables being watched by this function will change
# when we switch lesson files or when we are in expert mode and
# the user configures the exercise manually. We only have to run
# end|start_exercise here in expert mode because it is called
# automatically when we change lesson file.
if self.m_t.m_custom_mode:
self.on_end_practise()
for i in range(self.get_int('maximum_number_of_intervals')):
self.add_watch('ask_for_intervals_%i' % i, _f)
self.add_watch('number_of_intervals', _f)
def bHBox(pack_into, expand=True, fill=True, padding=0):
b = Gtk.HBox(False, 0)
b.show()
pack_into.pack_start(b, expand, fill, padding)
return b
def __init__(self):
Gtk.Frame.__init__(self)
self.set_shadow_type(Gtk.ShadowType.IN)
self.__stack = []
self.__label = HarmonicProgressionLabel('')
self.__content = Gtk.HBox(False, 0)
self.__content.show()
self.add(self.__content)
self.__timeout = None
# The allocated size
self.m_sx, self.m_sy = 0, 0
def create_stock_menu_item(stock, txt, callback, ag, accel_key, accel_mod):
box = Gtk.HBox(False, 0)
box.set_spacing(PAD_SMALL)
im = Gtk.Image()
im.set_from_stock(stock, Gtk.IconSize.MENU)
item = Gtk.ImageMenuItem(txt)
item.set_image(im)
if accel_key != 0:
item.add_accelerator('activate', ag, accel_key, accel_mod, Gtk.AccelFlags.VISIBLE)
item.connect('activate', callback)
return item
def setup_post(self):
self.g_postbox = Gtk.HBox(False, 0)
self.g_postbox.set_no_show_all(True)
self.pack_start(self.g_postbox, True, True, 0)