本文整理汇总了Python中gi.repository.Gtk.Stack方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Stack方法的具体用法?Python Gtk.Stack怎么用?Python Gtk.Stack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gtk
的用法示例。
在下文中一共展示了Gtk.Stack方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_widget
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def build_widget(self):
"""
Build the widget that contains the view, see
:class:`~gui.views.pageview.PageView
"""
container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
container.set_border_width(12)
self.header = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.header.show()
self.stack = Gtk.Stack()
ss = Gtk.StackSwitcher()
ss.set_stack(self.stack)
self.stack.show()
ss.show()
container.set_spacing(6)
container.pack_start(self.header, False, False, 0)
container.pack_start(Gtk.Separator(), False, False, 0)
container.pack_start(ss, False, False, 0)
container.pack_start(self.stack, True, True, 0)
container.show_all()
return container
示例2: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self, inactive_icon, active_icon, on_press_callback = None):
Gtk.EventBox.__init__(self)
self.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
if on_press_callback is None:
self.connect("button-press-event", self.on_icon_pressed)
else:
self.connect("button-press-event", on_press_callback)
self.inactive_icon = inactive_icon
self.active_icon = active_icon
self._position = 0
self._state = SideBarButtonState.OFF
self.iconstack = Gtk.Stack(margin_left=12, margin_right=12, margin_top=6, margin_bottom=6)
self.iconstack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
self.iconstack.set_transition_duration(300)
icon = self.set_image_from_file(self.inactive_icon)
self.iconstack.add_named(icon, 'inactive')
icon = self.set_image_from_file(self.active_icon)
self.iconstack.add_named(icon, 'active')
self.add(self.iconstack)
示例3: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self, gday, hday, gcolor, hcolor):
Gtk.EventBox.__init__(self)
self.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
self.connect("button-press-event", self.on_day_pressed)
self._state = CalendarState.Gregorian
# Set up the stack for the labels
self.labelstack = Gtk.Stack()
self.labelstack.set_transition_type(Gtk.StackTransitionType.SLIDE_UP_DOWN)
self.labelstack.set_transition_duration(300)
# Make the inactive label
self.labelstack.add_named(CalEntryLabel(gday, gcolor), 'Gregorian')
# Make the active label
self.labelstack.add_named(CalEntryLabel(hday, hcolor), 'Hijri')
self.add(self.labelstack)
self.show_all()
示例4: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self):
Gtk.Window.__init__(self)
self.set_transient_for(Window.get_default())
self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
self.set_size_request(600, 600)
self.set_title(_("Settings"))
self.resize(600, 600)
self.stack_switcher = Gtk.StackSwitcher()
self.stack = Gtk.Stack()
self._build_widgets()
示例5: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
self.count = 0
frame = Gtk.Frame()
scrolled_window = Gtk.ScrolledWindow(hscrollbar_policy=Gtk.PolicyType.NEVER)
self.listbox = Gtk.ListBox()
self.listbox.set_selection_mode(Gtk.SelectionMode.SINGLE)
self.listbox.connect('row-activated', self.on_row_activated)
scrolled_window.add(self.listbox)
frame.add(scrolled_window)
self.pack_start(frame, True, True, 0)
self.stack = Gtk.Stack()
self.pack_end(self.stack, False, False, 0)
示例6: set_layout
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def set_layout(self):
# Set up Titlebar
self.headerbar.set_show_close_button(True)
self.set_titlebar(self.headerbar)
# Set up the Stack
stack = Gtk.Stack()
stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
stack.set_transition_duration(300)
stack.set_homogeneous(False)
# Set up sidebar and give it the stack to manage
self.sidebar = SideBar(stack)
# Set up the home pane
self.set_home()
# Set up the qibla pane
compdirection = self.prayertimes.get_qibla()
country = self.prayertimes.options.country
city = self.prayertimes.options.city
self.qiblacompass = QiblaCompass(compdirection, country, city)
self.sidebar.add_to_stack(self.qiblacompass, 'qibla')
# Set up calendar panel
self.calendar = SilatyCal()
self.sidebar.add_to_stack(self.calendar, "calendar")
# Set up the options pane
self.set_options()
# Set up the sidebar buttons
self.set_sidebar_buttons()
# Add the stack and menu to the list
self.mainbox.set_size_request(429, 200)
self.mainbox.pack_start(self.sidebar, False, True, 0)
self.mainbox.pack_start(self.sidebar.stack, True, True, 0)
self.add(self.mainbox)
示例7: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self):
Gtk.Stack.__init__(self)
self.set_homogeneous(True)
self.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
self.set_transition_duration(300)
self.screen_count = 0
self.show_all()
示例8: _build_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def _build_widgets(self):
"""Build main window widgets."""
# HeaderBar
header_bar = HeaderBar.get_default()
header_bar.select_btn.connect("clicked", Window.toggle_select)
header_bar.add_btn.connect("clicked", self.add_account)
header_bar.cancel_btn.connect("clicked", Window.toggle_select)
self.set_titlebar(header_bar)
# Main Container
self.main_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
# Main Stack
self.main_stack = Gtk.Stack()
# Accounts List
account_list_cntr = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
accounts_widget = AccountsWidget.get_default()
accounts_widget.connect("changed", self.update_view)
# Search Bar
search_bar = SearchBar()
self.connect("key-press-event", lambda x,
y: search_bar.handle_event(y))
search_bar.search_button = header_bar.search_btn
search_bar.search_list = accounts_widget.accounts_lists
# Actions Bar
actions_bar = ActionsBar.get_default()
actions_bar.delete_btn.connect("clicked",
accounts_widget.delete_selected)
accounts_widget.connect("selected-rows-changed",
actions_bar.on_selected_rows_changed)
account_list_cntr.pack_start(search_bar, False, False, 0)
account_list_cntr.pack_start(accounts_widget, True, True, 0)
account_list_cntr.pack_start(actions_bar, False, False, 0)
self.main_stack.add_named(account_list_cntr,
"accounts-list")
# Empty accounts list
self.main_stack.add_named(EmptyAccountsList.get_default(),
"empty-accounts-list")
self.main_container.pack_start(self.main_stack, True, True, 0)
self.add(self.main_container)
self.update_view()
actions_bar.bind_property("visible", header_bar.cancel_btn,
"visible",
GObject.BindingFlags.BIDIRECTIONAL)
actions_bar.bind_property("no_show_all", header_bar.cancel_btn,
"no_show_all",
GObject.BindingFlags.BIDIRECTIONAL)
示例9: _setup_widgets
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def _setup_widgets(self):
"""Setup the main widgets."""
# Main widget
self.add(self._main)
# Headerbar
headerbar = HeaderBar.get_default()
headerbar.connect("open-file", self._open_file)
headerbar.play_btn.connect("clicked", self._play)
# Set up the app menu in other DE than GNOME
from ..application import Application
app_menu = Application.get_default().app_menu
menu_btn = headerbar.menu_btn
popover = Gtk.Popover.new_from_model(menu_btn, app_menu)
menu_btn.connect("clicked", self._toggle_popover, popover)
self.set_titlebar(headerbar)
# Action Bar
actionbar = ActionBar.get_default()
actionbar.connect("selected-format", self._on_export)
self._main.pack_end(actionbar, False, False, 0)
# Notification
notification = Notification.get_default()
self._main.pack_start(notification, False, False, 0)
# Audio Graph
self.main_stack = Gtk.Stack()
self.audio_graph_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.audio_graph_box.get_style_context().add_class("audio-graph-container")
self.zoombox = ZoomBox()
overlay = Gtk.Overlay()
overlay.add(self.audio_graph_box)
overlay.add_overlay(self.zoombox)
self.main_stack.add_named(overlay, "wave")
loading = Loading()
self.main_stack.add_named(loading, "loading")
self._main.pack_start(self.main_stack, True, True, 0)
# Config Box
sound_config = SoundConfig.get_default()
self._main.pack_end(sound_config, False, False, 0)
示例10: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self, win, mode=MODE_CHOOSE):
self.win = win
self.app = win.app
self.mode = mode
if mode == self.MODE_CHOOSE:
title = 'Choose Connection'
show_header_buttons = True
else:
title = 'Manage Connections'
show_header_buttons = False
super(ConnectionDialog, self).__init__(
title, win,
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
use_header_bar=True)
# Response buttons
if show_header_buttons:
self._btn_cancel = self.add_button('_Cancel',
Gtk.ResponseType.CANCEL)
self._btn_choose = self.add_button('_Connect', Gtk.ResponseType.OK)
self.set_default_response(Gtk.ResponseType.OK)
else:
self._btn_choose = self._btn_cancel = None
hb = self.get_header_bar()
self._btn_form_back = Gtk.Button()
icon = Gio.ThemedIcon(name='back')
image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON)
self._btn_form_back.add(image)
self._btn_form_back.connect('clicked', self.on_show_list)
hb.pack_start(self._btn_form_back)
self.builder = Gtk.Builder()
self.builder.add_from_resource('/org/runsqlrun/connection_dialog.ui')
content_area = self.get_content_area()
content_area.set_border_width(12)
content_area.set_spacing(6)
stack = Gtk.Stack()
stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT)
page_list = self._setup_list_page(self.builder)
stack.add_named(page_list, 'list')
page_form = self._setup_form_page(self.builder)
self._edit_key = None
stack.add_named(page_form, 'form')
content_area.pack_start(stack, True, True, 0)
self.stack = stack
self.show_all()
self._btn_form_back.hide()
示例11: __init__
# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Stack [as 别名]
def __init__(self, parent, notebook):
Dialog.__init__(self, parent, _('Properties'), help='Help:Properties') # T: Dialog title
self.notebook = notebook
stack = Gtk.Stack()
sidebar = Gtk.StackSidebar()
sidebar.set_stack(stack)
hbox = Gtk.Box()
hbox.add(sidebar)
hbox.add(stack)
self.vbox.add(hbox)
self.form = InputForm(
inputs=notebook_properties,
values=notebook.config['Notebook']
)
self.form.widgets['icon'].set_use_relative_paths(self.notebook)
if self.notebook.readonly:
for widget in list(self.form.widgets.values()):
widget.set_sensitive(False)
box = Gtk.VBox()
box.pack_start(self.form, False, False, 0)
stack.add_titled(box, 'notebook', _('Notebook'))
self.plugin_forms = {}
plugins = PluginManager()
for name in plugins:
plugin = plugins[name]
if plugin.plugin_notebook_properties:
key = plugin.config_key
form = InputForm(
inputs=plugin.form_fields(plugin.plugin_notebook_properties),
values=notebook.config[key]
)
self.plugin_forms[key] = form
if self.notebook.readonly:
for widget in list(form.widgets.values()):
widget.set_sensitive(False)
box = Gtk.VBox()
box.pack_start(form, False, False, 0)
stack.add_titled(box, name, plugin.plugin_info['name'])