def __init__(self):
Gtk.Dialog.__init__(self, _(u"_Create profile\u2026").replace(u"\u2026", "").replace("_", ""))
self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
vbox = gu.hig_dlg_vbox()
self.vbox.pack_start(vbox, True, True, 0)
#
label = Gtk.Label(label=_("Enter the name of the new folder:"))
label.set_alignment(0.0, 0.5)
vbox.pack_start(label, False, False, 0)
#
self.g_entry = Gtk.Entry()
self.g_entry.connect('changed', self.on_entry_changed)
self.g_entry.set_activates_default(True)
vbox.pack_start(self.g_entry, False, False, 0)
#
label = Gtk.Label(label=_("Your profile data will be stored in:"))
label.set_alignment(0.0, 0.5)
vbox.pack_start(label, False, False, 0)
#
self.g_profile_location = Gtk.Label()
vbox.pack_start(self.g_profile_location, False, False, 0)
#
self.g_statusbox = Gtk.HBox()
self.g_statusbox.set_no_show_all(True)
vbox.pack_start(self.g_statusbox, False, False, 0)
im = Gtk.Image()
im.set_from_stock(Gtk.STOCK_DIALOG_WARNING, Gtk.IconSize.MENU)
self.g_statusbox.pack_start(im, False, False, 0)
im.show()
self.g_status = Gtk.Label()
self.g_status.show()
self.g_statusbox.pack_start(self.g_status, False, False, 0)
self.g_entry.set_text(_("New Profile"))
self.set_default_response(Gtk.ResponseType.ACCEPT)
python类HBox()的实例源码
def __init__(self, fields=('link',)):
SelectWinBase.__init__(self)
self.m_fields = fields
app = solfege.app
self.g_box = Gtk.VBox(False, 0)
self.g_box.set_border_width(gu.hig.SPACE_MEDIUM)
self.add_with_viewport(self.g_box)
self.g_searchbox = Gtk.HBox(False, gu.hig.SPACE_SMALL)
self.g_box.pack_start(self.g_searchbox, False, False, padding=gu.hig.SPACE_MEDIUM)
self.g_searchentry = Gtk.Entry()
self.g_searchbox.pack_start(self.g_searchentry, True, True, 0)
self.g_searchentry.connect('activate', self.on_search)
gu.bButton(self.g_searchbox, _("Search"), callback=self.on_search, expand=False)
self.show_all()
def create_mainwin_ui(self):
qbox = gu.hig_dlg_vbox()
self.g_notebook.append_page(qbox, Gtk.Label(label=_("Questions")))
gu.bLabel(qbox, _("Enter new chords using the mouse"), False, False)
hbox = gu.bHBox(qbox, False, False)
self.g_displayer = mpd.musicdisplayer.ChordEditor()
self.g_displayer.connect('clicked', self.on_displayer_clicked)
self.g_displayer.clear(2)
gu.bLabel(hbox, "")
hbox.pack_start(self.g_displayer, False)
gu.bLabel(hbox, "")
##
self.g_question_name = Gtk.Entry()
qbox.pack_start(gu.hig_label_widget(_("Question title:", True, True, 0), self.g_question_name, None), False)
self.g_navinfo = Gtk.Label(label="")
qbox.pack_start(self.g_navinfo, False)
##
self.m_P = EditorLessonfile()
cvbox = Gtk.VBox()
self.g_notebook.append_page(cvbox, Gtk.Label(label=_("Lessonfile header")))
## Header section
sizegroup = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
self.g_title = Gtk.Entry()
cvbox.pack_start(gu.hig_label_widget(_("File title:", True, True, 0), self.g_title,
sizegroup))
self.g_content_chord = Gtk.RadioButton(None, "chord")
self.g_content_chord_voicing = Gtk.RadioButton(self.g_content_chord, "chord-voicing")
self.g_content_idbyname = Gtk.RadioButton(self.g_content_chord, "id-by-name")
box = Gtk.HBox()
box.pack_start(self.g_content_chord, True, True, 0)
box.pack_start(self.g_content_chord_voicing, True, True, 0)
box.pack_start(self.g_content_idbyname, True, True, 0)
cvbox.pack_start(gu.hig_label_widget(_("Content:", True, True, 0), box, sizegroup))
self.g_random_transpose = Gtk.Entry()
cvbox.pack_start(gu.hig_label_widget(_("Random transpose:", True, True, 0),
self.g_random_transpose, sizegroup))
#
#self.g_statusbar = Gtk.Statusbar()
#self.toplevel_vbox.pack_start(self.g_statusbar, False)
self.update_appwin()
def FramedInstrumentSelector(title, exname, varname, sizegroup):
box = Gtk.HBox()
box.set_spacing(6)
label = Gtk.Label(label=title)
label.set_alignment(0.0, 0.5)
box.pack_start(label, False, False, 0)
n = nInstrumentSelector(exname, varname, None)
sizegroup.add_widget(label)
n.show()
box.pack_start(n, True, True, 0)
return box
def create_linkrow(self, link_this):
hbox = Gtk.HBox()
def ff(btn, page):
if id(page) in editor_of(self).m_page_mapping:
editor_of(self).show_page_id(id(page))
else:
if not page[0]:
page[0].append(pd.LinkList(link_this.m_name))
p = Page(page, parent_page(self))
p.show()
editor_of(self).add_page(p)
if isinstance(link_this, pd.Page):
linkbutton = gu.ClickableLabel(link_this.m_name)
linkbutton.connect('clicked', ff, link_this)
else:
try:
linkbutton = gu.ClickableLabel(lessonfile.infocache.get(link_this, 'title'))
linkbutton.set_tooltip_text(link_this)
except lessonfile.InfoCache.FileNotFound:
linkbutton = gu.ClickableLabel(_(u"«%s» was not found") % link_this)
linkbutton.make_warning()
hbox.pack_start(linkbutton, True, True, 0)
linkbutton.connect('button-press-event', self.on_right_click_row, link_this)
hbox.show_all()
return hbox
def __init__(self, model, parent):
Gtk.VBox.__init__(self)
self.m_model = model
self.m_parent = parent
sc = Gtk.ScrolledWindow()
sc.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self.pack_start(sc, True, True, 0)
self.g_column_box = Gtk.HBox()
self.g_column_box.set_spacing(gu.hig.SPACE_LARGE)
self.g_column_box.set_border_width(gu.hig.SPACE_SMALL)
# We pack column into this box
sc.add_with_viewport(self.g_column_box)
self.show_all()
if model:
self.update_from_model()
def __init__(self, filename=None):
Gtk.Window.__init__(self)
logging.debug("fpeditor.Editor.__init__(%s)", filename)
gu.EditorDialogBase.__init__(self, filename)
self.set_default_size(800, 600)
self.g_main_box = Gtk.VBox()
self.add(self.g_main_box)
self.g_actiongroup.add_actions([
('GoBack', Gtk.STOCK_GO_BACK, None, None, None, self.go_back),
])
self.setup_toolbar()
self.g_title_hbox = Gtk.HBox()
self.g_title_hbox.set_spacing(gu.hig.SPACE_SMALL)
self.g_title_hbox.set_border_width(gu.hig.SPACE_SMALL)
label = Gtk.Label()
label.set_markup(u"<b>%s</b>" % _("Front page title:"))
self.g_title_hbox.pack_start(label, False, False, 0)
self.g_fptitle = Gtk.Entry()
self.g_title_hbox.pack_start(self.g_fptitle, True, True, 0)
self.g_main_box.pack_start(self.g_title_hbox, False, False, 0)
# This dict maps the windows created for all pages belonging to
# the file.
self.m_page_mapping = {}
self.m_model = None
if filename:
self.load_file(filename)
else:
self.m_model = pd.Page(_("Untitled%s") % self.m_instance_number,
pd.Column())
self.set_not_modified()
self.add_page(Page(self.m_model, self))
self.clipboard.update_buttons()
self.show_all()
self.add_to_instance_dict()
self.g_fptitle.set_text(self.m_model.m_name)
self.g_fptitle.connect('changed', self.on_frontpage_title_changed)
def __init__(self, package_name):
self.install_choice = ()
Gtk.Window.__init__(self, title="Install")
self.set_default_size(300, 100)
self.set_resizable(False)
self.connect("delete-event", Gtk.main_quit)
main_box = Gtk.VBox()
button_box = Gtk.HBox()
install_message = "Would you like to install %s?" % package_name
intro_label = Gtk.Label(install_message)
install_button = Gtk.Button(label='Install')
cancel_button = Gtk.Button(label='Cancel')
install_button.connect('clicked', self.install_was_pressed)
cancel_button.connect('clicked', self.cancel_was_pressed)
self.add(main_box)
button_box.pack_start(install_button, True, True, 5)
button_box.pack_start(cancel_button, True, True, 5)
main_box.pack_start(intro_label, True, True, 0)
main_box.pack_start(button_box, True, True, 5)
def __init__(self, text, menu):
GObject.GObject.__init__(self)
self.menu = menu
hbox1 = Gtk.HBox()
hbox2 = Gtk.HBox()
icon = Gtk.Image()
icon.set_from_file(datafile_path('bokken-small.svg'))
hbox1.pack_start(icon, True, True, 3)
label = Gtk.Label()
label.set_markup("<b>"+ text + "</b>")
hbox1.pack_start(label, True, True, 3)
arrow = Gtk.Arrow(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN)
hbox1.pack_start(arrow, False, False, 3)
hbox2.pack_start(hbox1, True, True, 0)
# MEOW Text settings
#attrs = Pango.AttrList()
#attrs.change(Pango.AttrWeight(Pango.Weight.SEMIBOLD, 0, -1))
#label.set_attributes(attrs)
self.add(hbox2)
self.set_relief(Gtk.ReliefStyle.NORMAL)
self.set_can_focus(True)
self.set_can_default(False)
self.connect("toggled", self.on_toggled)
for sig in "selection-done", "deactivate", "cancel":
menu.connect(sig, self.on_menu_dismiss)
def create_seek_buttons(self):
self.hbox = Gtk.HBox(False, 1)
self.back = Gtk.Button()
self.back_img = Gtk.Image()
self.back_img.set_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.MENU)
self.back.set_image(self.back_img)
self.back.set_relief(Gtk.ReliefStyle.NONE)
self.back.connect('clicked', self.do_seek, 'b')
self.forward = Gtk.Button()
self.forward_img = Gtk.Image()
self.forward_img.set_from_stock(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.MENU)
self.forward.set_image(self.forward_img)
self.forward.set_relief(Gtk.ReliefStyle.NONE)
self.forward.connect('clicked', self.do_seek, 'f')
self.seek = Gtk.Entry()
self.seek.set_max_length(30)
self.seek.set_icon_from_stock(1, Gtk.STOCK_JUMP_TO)
self.seek.set_activates_default(True)
self.seek.connect("activate", self.goto)
self.seek.connect("icon-press", self.goto)
self.seek.set_icon_tooltip_text(1, 'Go')
self.hbox.pack_start(self.back, False, False, 0)
self.hbox.pack_start(self.forward, False, False, 0)
self.hbox.pack_start(self.seek, True, True, 0)
return self.hbox
def __init__(self):
GObject.GObject.__init__(self)
# XDotWidget
xdotwidget = self.xdotwidget = xdot.DotWidget()
# Toolbar
uimanager = Gtk.UIManager()
actiongroup = Gtk.ActionGroup('Actions')
actiongroup.add_actions((
('ZoomIn', Gtk.STOCK_ZOOM_IN, None, None, None, self.xdotwidget.on_zoom_in),
('ZoomOut', Gtk.STOCK_ZOOM_OUT, None, None, None, self.xdotwidget.on_zoom_out),
('ZoomFit', Gtk.STOCK_ZOOM_FIT, None, None, None, self.xdotwidget.on_zoom_fit),
('Zoom100', Gtk.STOCK_ZOOM_100, None, None, None, self.xdotwidget.on_zoom_100),
))
uimanager.insert_action_group(actiongroup, 0)
uimanager.add_ui_from_string(self.ui)
toolbar = uimanager.get_widget('/ToolBar')
toolbar.set_icon_size(Gtk.IconSize.SMALL_TOOLBAR)
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
toolbar.set_show_arrow(False)
label = self.label = Gtk.Label()
hbox = Gtk.HBox(False, 5)
hbox.pack_start(toolbar, False, True, 0)
hbox.pack_start(label, False, True, 0)
self.pack_start(hbox, False, True, 0)
self.pack_start(xdotwidget, True, True, 0)
def add_text(self, data_dict, version):
'''data_dict ontains text to be added.
Key will be the title
Value will be... well, the value :)'''
self.box = Gtk.HBox(False, 1)
self._statusbar.pack_start(self.box, False, False, 1)
ellipsize = Pango.EllipsizeMode.NONE
for element in data_dict.keys():
if element == 'Arch':
_icon = Gtk.Image.new_from_file(self.icons[element])
else:
_icon = Gtk.Image.new_from_stock(self.icons[element], Gtk.IconSize.MENU)
self.box.pack_start(_icon, False, False, 0)
# Element label
label = Gtk.Label()
label.set_markup('<b>%s:</b>' % element)
label.set_padding(1, 0)
label.set_max_width_chars(len(element) + 1)
label.set_single_line_mode(True)
label.set_ellipsize(ellipsize)
self.box.pack_start(label, True, True, 1)
# Element content
label = Gtk.Label(label=str(data_dict[element]))
label.set_padding(1, 0)
label.set_max_width_chars(len(str(data_dict[element])))
label.set_single_line_mode(True)
label.set_ellipsize(ellipsize)
self.box.pack_start(label, True, True, 1)
sep = Gtk.VSeparator()
self.box.pack_start(sep, True, True, 1)
if version:
_icon = Gtk.Image.new_from_file(datafile_path('bokken-small.svg'))
self.pack_start(_icon, False, False, 1)
label = Gtk.Label()
label.set_markup('<b>Bokken ' + version + '</b> (' + self.uicore.backend.capitalize() + ' ' + self.uicore.version + ')')
label.set_padding(1, 0)
self.pack_end(label, False, True, 0)
self.show_all()
def __init__(self, core, main):
self.uicore = core
self.main = main
self.last_fcn = ''
#dotcode = self.uicore.get_callgraph()
#GObject.GObject.__init__(self, False, 1)
# MEOW
GObject.GObject.__init__(self)
self.side_vb = Gtk.VBox(False, 1)
self.side_hb = Gtk.HBox(False, 1)
#self.dot_widget = DotWidget()
self.dot_widget = mydot_widget.MyDotWidget(self.uicore, self.main)
self.create_tree()
self.create_preview()
self.pack_start(self.dot_widget, True, True, 0)
self.bar = graph_bar.GraphBar(self.dot_widget, self, self.uicore)
#self.pack_start(self.bar, False, False, 0)
self.side_hb.pack_start(self.bar, False, False, 1)
if self.uicore.backend == 'radare':
self.pack_start(self.side_vb, False, False, 1)
self.side_hb.pack_start(self.sw, True, True, 1)
self.side_vb.pack_start(self.side_hb, True, True, 1)
self.side_vb.pack_start(self.preview, False, False, 0)
def __init__(self, parent=None,
title='', description='', long_description=''):
Gtk.Window.__init__(self, title=title)
self.set_parent(parent)
self.set_transient_for(parent)
self.set_destroy_with_parent(False)
self.set_default_size(600, 500)
self.vbox = Gtk.VBox(spacing=0)
self.add(self.vbox)
self.text_buffer = Gtk.TextBuffer()
self.text_buffer.insert_at_cursor(description)
self.text_buffer.insert_at_cursor(
'\n\n'
+ '############################################################'
+ '\n')
self.text_buffer.insert_at_cursor(
'Complete file implementing the input method follows here:\n')
self.text_buffer.insert_at_cursor(
'############################################################'
+ '\n')
self.text_buffer.insert_at_cursor(long_description)
self.text_view = Gtk.TextView()
self.text_view.set_buffer(self.text_buffer)
self.text_view.set_editable(False)
self.text_view.set_cursor_visible(False)
self.text_view.set_justification(Gtk.Justification.LEFT)
self.text_view.set_wrap_mode(Gtk.WrapMode.WORD)
self.scrolledwindow = Gtk.ScrolledWindow()
self.scrolledwindow.set_hexpand(True)
self.scrolledwindow.set_vexpand(True)
self.scrolledwindow.add(self.text_view)
self.vbox.pack_start(self.scrolledwindow, True, True, 0)
self.close_button = Gtk.Button(stock=Gtk.STOCK_CLOSE)
self.close_button.connect("clicked", self.on_close_button_clicked)
self.hbox = Gtk.HBox(spacing=0)
self.hbox.pack_end(self.close_button, False, False, 0)
self.vbox.pack_start(self.hbox, False, False, 5)
def insert_image(self, widget):
self.insert_window_image = Gtk.Window()
self.insert_window_image.set_title("Insert Image")
self.insert_window_image.set_resizable(True)
self.insert_window_image.set_border_width(6)
self.insert_window_image.set_default_size(300, 250)
self.insert_window_image.set_position(Gtk.WindowPosition.CENTER)
vbox = Gtk.VBox()
label_alt_text = Gtk.Label("Alt Text:")
self.entry_alt_text_i = Gtk.Entry()
label_title = Gtk.Label("Title:")
self.entry_title_i = Gtk.Entry()
label_url = Gtk.Label("Path/Url:")
self.entry_url_i = Gtk.Entry()
vbox.pack_start(label_alt_text, self, False, False)
vbox.pack_start(self.entry_alt_text_i, self, False, False)
vbox.pack_start(label_title, self, False, False)
vbox.pack_start(self.entry_title_i, self, False, False)
vbox.pack_start(label_url, self, False, False)
self.hbox_url = Gtk.HBox()
self.hbox_url.pack_start(self.entry_url_i, self, True, False)
self.path_file_button = Gtk.FileChooserButton(title= "Select an image")
self.path_file_button.connect("file-set", self.file_chooser_button_clicked)
self.hbox_url.pack_start(self.path_file_button, self, False, False)
vbox.pack_start(self.hbox_url, self, False, False)
button = Gtk.Button("Insert Image")
vbox.pack_end(button, self, False, False)
self.insert_window_image.add(vbox)
self.insert_window_image.show_all()
button.connect("clicked", self.insert_image_cmd, self.insert_window_image)
def __init__(self, window, format="dmy", separator='/', value = datetime.date.today()):
Gtk.HBox.__init__(self)
self.format = format
self.separator = separator
self._window = window
self.entry = Gtk.Entry()
self.entry.set_editable(False)
self.button = Gtk.Button()
self.button.add(Gtk.Arrow.new(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN))
self.button.connect('clicked', self.on_button)
self.pack_start(self.entry, 0, 0, 0)
self.pack_start(self.button, 0, 0, 0)
self.month_changed = False
self.set_date(value)
def __init__(self,url):
self.code = None
Gtk.Dialog.__init__(self)
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
self.set_title(comun.APP)
self.set_icon_from_file(comun.ICON)
#
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(600,420)
self.viewer.connect('navigation-policy-decision-requested', self.on_navigation_requested)
self.viewer.open(url)
#
self.show_all()
####################################################################
#########################BROWSER####################################
####################################################################
def __init__(self, window, index=0, values = [], height = 150):
Gtk.HBox.__init__(self)
self._window = window
self.entry = Gtk.Entry()
self.entry.set_editable(False)
self.button = Gtk.Button()
self.button.add(Gtk.Arrow.new(Gtk.ArrowType.DOWN, Gtk.ShadowType.IN))
self.button.connect('clicked', self.on_button)
self.pack_start(self.entry, 0, 0, 0)
self.pack_start(self.button, 0, 0, 0)
self.index = index
self.values = values
self.height = height
def __init__(self):
Gtk.HBox.__init__(self)
title = Gtk.Label('Size:')
self.width = Gtk.Entry()
self.height = Gtk.Entry()
text = Gtk.Label('x')
okay = Gtk.Button('Okay')
okay.connect('clicked', self.clicked)
self.pack_start(title, True, True, 10)
self.pack_start(self.width, True, True, 0)
self.pack_start(text, True, True, 0)
self.pack_start(self.height, True, True, 0)
self.pack_start(okay, True, True, 0)
self.set_size(*self.default)