本文整理汇总了Python中gi.repository.Gtk.HeaderBar方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.HeaderBar方法的具体用法?Python Gtk.HeaderBar怎么用?Python Gtk.HeaderBar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.HeaderBar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def __init__(self):
Gtk.HeaderBar.__init__(self)
self.search_btn = HeaderBarToggleButton("system-search-symbolic",
_("Search"))
self.add_btn = HeaderBarButton("list-add-symbolic",
_("Add a new account"))
self.settings_btn = HeaderBarButton("open-menu-symbolic",
_("Settings"))
self.select_btn = HeaderBarButton("object-select-symbolic",
_("Selection mode"))
self.cancel_btn = Gtk.Button(label=_("Cancel"))
self.popover = None
self._build_widgets()
示例2: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
"""
Generate the HeaderBar widgets
"""
self.set_show_close_button(True)
left_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
# Hide the search button if nothing is found
if Database.get_default().count > 0:
self.search_btn.show_()
else:
self.search_btn.hide_()
left_box.add(self.add_btn)
right_box.pack_start(self.search_btn, False, False, 0)
right_box.pack_start(self.select_btn, False, False, 0)
right_box.pack_start(self.cancel_btn, False, False, 0)
right_box.pack_end(self.settings_btn, False, False, 3)
self.pack_start(left_box)
self.pack_end(right_box)
示例3: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(False)
header_bar.set_title(_("Edit {} - {}".format(self._account.username,
self._account.provider)))
self.set_titlebar(header_bar)
# Save btn
self.save_btn = Gtk.Button()
self.save_btn.set_label(_("Save"))
self.save_btn.connect("clicked", self._on_save)
self.save_btn.get_style_context().add_class("suggested-action")
header_bar.pack_end(self.save_btn)
self.close_btn = Gtk.Button()
self.close_btn.set_label(_("Close"))
self.close_btn.connect("clicked", self._on_quit)
header_bar.pack_start(self.close_btn)
self.account_config = AccountConfig(edit=True, account=self._account)
self.account_config.connect("changed", self._on_account_config_changed)
self.add(self.account_config)
示例4: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(True)
header_bar.set_title(_("GPG paraphrase"))
apply_btn = Gtk.Button()
apply_btn.set_label(_("Import"))
apply_btn.get_style_context().add_class("suggested-action")
apply_btn.connect("clicked", self.__on_apply)
header_bar.pack_end(apply_btn)
self.set_titlebar(header_bar)
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.paraphrase_widget = SettingsBoxWithEntry(_("Paraphrase"), True)
container.pack_start(self.paraphrase_widget, False, False, 0)
container.get_style_context().add_class("settings-main-container")
self.add(container)
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def __init__(self, *args, **kwargs):
super(FileDialog, self).__init__(*args, **kwargs)
self.set_titlebar(Gtk.HeaderBar(show_close_button=True))
self.set_title("Open File")
self.add_button("_Open", Gtk.ResponseType.OK)
self.add_button("_Cancel", Gtk.ResponseType.CANCEL)
self.set_default_response(Gtk.ResponseType.OK)
#TODO Add file filters based on extensions given in INI
filefiler = Gtk.FileFilter()
filefiler.add_pattern('*.ngc')
filefiler.set_name('G-code')
self.add_filter(filefiler)
filefiler = Gtk.FileFilter()
filefiler.add_pattern('*')
filefiler.set_name('All Files')
self.add_filter(filefiler)
self.show_all()
示例6: main
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def main():
window = Gtk.Window()
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
window.add(box)
title = "Custom HeaderBar"
subtitle = "with fullscreen toggle button"
header_bar = HeaderBar(window, title=title, subtitle=subtitle)
window.set_titlebar(header_bar)
window.set_default_size(600, 300)
window.connect('destroy', Gtk.main_quit)
window.show_all()
Gtk.main()
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def __init__(self, window):
"""
Provides
:param window: Main application window reference, serves as communication hub
"""
super(Gtk.HeaderBar, self).__init__()
self.set_show_close_button(False)
try:
self.set_has_subtitle(True)
except AttributeError:
pass # Too bad?
# Set default window title
self.props.title = _("Preferences")
self.__window = window
self.__menu = Gtk.Menu()
# Fill it with all the wigets
self.__populate_headerbar()
示例8: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def __init__(self):
self.hb = Gtk.HeaderBar().new()
self.hb.props.show_close_button = True
self.hb_revealer = Gtk.Revealer(name="titlebar-revealer-pv")
self.hb_revealer.add(self.hb)
self.hb_revealer.props.transition_duration = 750
self.hb_revealer.set_transition_type(
Gtk.RevealerTransitionType.CROSSFADE)
self.hb_revealer.show()
self.hb_revealer.set_reveal_child(True)
self.hb_container = Gtk.Frame(name="titlebar-container")
self.hb_container.set_shadow_type(Gtk.ShadowType.NONE)
self.hb_container.add(self.hb_revealer)
self.hb_container.show()
self.hb.show_all()
示例9: get_default
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def get_default():
"""
:return: Default instance of HeaderBar
"""
if HeaderBar.instance is None:
HeaderBar.instance = HeaderBar()
return HeaderBar.instance
示例10: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
"""Create the Add Account widgets."""
# Header Bar
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(False)
header_bar.set_title(_("Add a new account"))
self.set_titlebar(header_bar)
# Next btn
self.add_btn = Gtk.Button()
self.add_btn.set_label(_("Add"))
self.add_btn.connect("clicked", self._on_add)
self.add_btn.get_style_context().add_class("suggested-action")
self.add_btn.set_sensitive(False)
header_bar.pack_end(self.add_btn)
# QR code scan btn
from ...application import Application
self.scan_btn = HeaderBarButton("qrscanner-symbolic",
_("Scan QR code"))
if Application.USE_QRSCANNER and can_use_qrscanner():
self.scan_btn.connect("clicked", self._on_scan)
header_bar.pack_end(self.scan_btn)
# Back btn
self.close_btn = Gtk.Button()
self.close_btn.set_label(_("Close"))
self.close_btn.connect("clicked", self._on_quit)
header_bar.pack_start(self.close_btn)
self.account_config = AccountConfig()
self.account_config.connect("changed", self._on_account_config_changed)
self.add(self.account_config)
示例11: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(True)
self.set_titlebar(header_bar)
header_bar.set_custom_title(self.stack_switcher)
self.stack_switcher.set_stack(self.stack)
self.stack.get_style_context().add_class("settings-main-container")
appearance_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
dark_theme = SwitchSettingsBox(_("Dark theme"), _("Use a dark theme, if possible"), "night-mode")
dark_theme.connect("changed", self.__on_dark_theme_changed)
appearance_container.pack_start(dark_theme, False, False, 0)
self.stack.add_titled(appearance_container, "appearance", _("Appearance"))
behaviour_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
clear_database = ClickableSettingsBox(_("Clear the database"), _("Erase existing accounts"))
clear_database.connect("button-press-event", self.__on_clear_database_clicked)
behaviour_container.pack_start(clear_database, False, False, 0)
self.stack.add_titled(behaviour_container, "behaviour", _("Behaviour"))
backup_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
gpg_location = ClickableSettingsBox(_("GPG keys location"),
Settings.get_default().gpg_location)
gpg_location.connect("button-press-event", self.__on_gpg_location_clicked)
backup_container.pack_start(gpg_location, False, False, 0)
self.stack.add_titled(backup_container, "backup", _("Backup"))
self.add(self.stack)
示例12: _build_header_bar
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_header_bar(self):
"""Setup window headerbar."""
# Header bar
headerbar = Gtk.HeaderBar()
headerbar_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
spacing=3)
title = Gtk.Label()
title.set_text(_("Icon Chooser"))
title.get_style_context().add_class("title")
headerbar_container.pack_start(title, False, False, 0)
subtitle = Gtk.Label()
subtitle.get_style_context().add_class("subtitle")
subtitle_text = ", ".join(self._folders)
subtitle.set_text(subtitle_text)
subtitle.set_ellipsize(Pango.EllipsizeMode.END)
subtitle.set_tooltip_text(subtitle_text)
subtitle.props.max_width_chars = 30
headerbar_container.pack_start(subtitle, False, False, 0)
headerbar.set_custom_title(headerbar_container)
headerbar.set_show_close_button(False)
# Search Button
self._search_btn = Gtk.ToggleButton()
search_icn = Gio.ThemedIcon(name="system-search-symbolic")
search_img = Gtk.Image.new_from_gicon(search_icn, Gtk.IconSize.BUTTON)
self._search_btn.set_image(search_img)
# Cancel Button
close_button = Gtk.Button()
close_button.set_label(_("Close"))
close_button.connect("clicked", self._close_window)
headerbar.pack_start(close_button)
headerbar.pack_end(self._search_btn)
self.set_titlebar(headerbar)
示例13: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def __init__(self):
GObject.GObject.__init__(self)
Gtk.HeaderBar.__init__(self)
self.play_btn = Gtk.Button()
self._open_btn = Gtk.Button()
self.menu_btn = Gtk.Button()
self.set_title(_("Audio Cutter"))
self.set_show_close_button(True)
self._setup_widgets()
示例14: get_default
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def get_default():
"""Return the default instnace of HeaderBar."""
if HeaderBar.instance is None:
HeaderBar.instance = HeaderBar()
return HeaderBar.instance
示例15: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import HeaderBar [as 别名]
def _build_widgets(self):
"""Build Settings Window widgets."""
# HeaderBar
headerbar = Gtk.HeaderBar()
headerbar.set_show_close_button(True)
headerbar.set_title(_("Settings"))
self.set_titlebar(headerbar)