当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.Box方法代码示例

本文整理汇总了Python中gi.repository.Gtk.Box方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Box方法的具体用法?Python Gtk.Box怎么用?Python Gtk.Box使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.Box方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [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) 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:26,代码来源:headerbar.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, **kwargs):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
        GObject.GObject.__init__(self)

        self.is_edit = kwargs.get("edit", False)
        self._account = kwargs.get("account", None)

        self._providers_store = Gtk.ListStore(str, str)

        self.logo_img = Gtk.Image()
        self.username_entry = Gtk.Entry()
        self.provider_combo = Gtk.ComboBox.new_with_model_and_entry(
            self._providers_store)
        self.token_entry = Gtk.Entry()
        self._build_widgets()
        self._fill_data() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:18,代码来源:add.py

示例3: _build_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def _build_widgets(self, accounts_list, provider):
        provider_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        provider_lbl = Gtk.Label()
        provider_lbl.set_text(provider)
        provider_lbl.set_halign(Gtk.Align.START)
        provider_lbl.get_style_context().add_class("provider-lbl")

        provider_img = Gtk.Image()
        pixbuf = load_pixbuf_from_provider(provider)
        provider_img.set_from_pixbuf(pixbuf)

        provider_container.pack_start(provider_img, False, False, 3)
        provider_container.pack_start(provider_lbl, False, False, 3)

        self.pack_start(provider_container, False, False, 3)
        self.pack_start(accounts_list, False, False, 3) 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:19,代码来源:list.py

示例4: _build_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def _build_widgets(self, label, sub_label):
        self.get_style_context().add_class("settings-box")

        self.switch.set_state(Settings.get_default().get_boolean(self._schema))
        self.switch.connect("state-set", self.__on_toggled)

        label_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        main_lbl = Gtk.Label()
        main_lbl.set_halign(Gtk.Align.START)
        main_lbl.get_style_context().add_class("settings-box-main-label")
        main_lbl.set_text(label)
        label_container.pack_start(main_lbl, False, False, 3)
        secondary_lbl = Gtk.Label()
        secondary_lbl.set_halign(Gtk.Align.START)
        secondary_lbl.get_style_context().add_class("settings-box-secondary-label")
        secondary_lbl.set_text(sub_label)
        label_container.pack_start(secondary_lbl, False, False, 3)

        self.pack_start(label_container, False, False, 0)

        switch_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        switch_container.pack_start(self.switch, False, False, 0)
        switch_container.set_valign(Gtk.Align.CENTER)
        self.pack_end(switch_container, False, False, 0) 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:26,代码来源:settings.py

示例5: _build_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [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) 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:18,代码来源:gnupg.py

示例6: __colour_dialog_background

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __colour_dialog_background(self):
        content_area = self.dialog.get_content_area()
        self.content_background = Gtk.EventBox()
        self.add_style(self.content_background, 'white')
        self.content_background.set_size_request(140, 140)
        content_area.reparent(self.content_background)
        action_area = self.dialog.get_action_area()
        self.action_background = Gtk.EventBox()
        self.add_style(self.action_background, 'white')
        action_area.reparent(self.action_background)
        action_area.set_layout(Gtk.ButtonBoxStyle.CENTER)

        # Set area around the buttons grey by default
        self.set_action_background('grey')

        container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        container.add(self.content_background)
        container.add(self.action_background)
        self.dialog.add(container)

        return content_area, action_area 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:23,代码来源:kano_dialog.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, title, description):

        cssProvider = Gtk.CssProvider()
        cssProvider.load_from_path(common_css_dir + "/heading.css")
        styleContext = Gtk.StyleContext()
        styleContext.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)

        self.title = Gtk.Label(title)
        self.title_style = self.title.get_style_context()
        self.title_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
        self.title_style.add_class('title')

        self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
        self.container.pack_start(self.title, False, False, 0)

        if description != "":
            self.description = Gtk.Label(description)
            self.description.set_justify(Gtk.Justification.CENTER)
            self.description.set_line_wrap(True)
            self.description_style = self.description.get_style_context()
            self.description_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
            self.description_style.add_class('description')

            self.container.pack_start(self.description, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:26,代码来源:heading.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, text="", icon_filename=""):

        Gtk.Button.__init__(self)

        apply_colours_to_widget(self)

        self.internal_box = Gtk.Box(spacing=10)
        self.internal_box.props.halign = Gtk.Align.CENTER
        self.add(self.internal_box)

        if icon_filename:
            self.icon = Gtk.Image.new_from_file(icon_filename)
            self.internal_box.pack_start(self.icon, False, False, 0)
            self.label = Gtk.Label(text)
            self.internal_box.pack_start(self.label, False, False, 0)
        else:
            self.label = Gtk.Label(text)
            self.internal_box.add(self.label)

        cursor.attach_cursor_events(self) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:22,代码来源:buttons.py

示例9: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.win.add(box)

        label = Gtk.Label(title)
        label.set_padding(10, 10)
        label.get_style_context().add_class("KanoProgressBar")
        box.pack_start(label, False, False, 5)
        box.pack_start(self, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:24,代码来源:kano_progress.py

示例10: add_heading

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def add_heading(text, widget, bold=False):

    label = Gtk.Label(text)
    label_alignment = Gtk.Alignment(xscale=0, xalign=0)
    label_alignment.add(label)

    if bold:
        label.get_style_context().add_class("bold_label")
    else:
        label.get_style_context().add_class("desc_label")

    box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    box.pack_start(label_alignment, False, False, 3)
    box.pack_start(widget, False, False, 3)

    return box 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:18,代码来源:labelled_entries.py

示例11: create_custom_label

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def create_custom_label(heading, description=""):

    heading_label = Gtk.Label(heading)
    heading_label.get_style_context().add_class("bold_label")
    box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
    box.pack_start(heading_label, False, False, 0)

    if description:
        description_label = Gtk.Label(description)
        description_label.get_style_context().add_class("desc_label")
        box.pack_start(description_label, False, False, 0)

    align = Gtk.Alignment(yscale=0, yalign=0.5)
    align.add(box)

    return align 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:18,代码来源:labelled_entries.py

示例12: _get_title_box

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def _get_title_box(self):
		menu = Gtk.Menu()
		menu.set_property('valign', Gtk.Align.START)
		menu_item = Gtk.MenuItem.new_with_label('Restore Default Options')
		menu_item.connect('activate', self.signal_activate_plugin_reset, self.plugin_klass)
		menu.append(menu_item)
		menu.show_all()
		self.menu = menu

		plugin_menu_button = Gtk.MenuButton()
		plugin_menu_button.set_property('direction', Gtk.ArrowType.LEFT)
		plugin_menu_button.set_popup(menu)

		title_box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 3)
		title_box.pack_start(Gtk.Label(label=self.plugin_klass.title), False, True, 0)
		title_box.pack_end(plugin_menu_button, False, False, 0)
		return title_box 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:19,代码来源:configuration.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, win, tab, title, img):
        Gtk.Box.__init__(self)
        self.set_spacing(5)

        self.win = win
        self.tab = tab

        # Preview of image
        self.icon = Gtk.Image()

        # Title
        self.label = Gtk.Label()
        self.set_title(title)

        # Close button
        button = Gtk.Button()
        button.set_relief(Gtk.ReliefStyle.NONE)
        button.add(Gtk.Image.new_from_icon_name('window-close',
            Gtk.IconSize.MENU))
        button.connect('clicked', self.on_close_button_clicked)
        self.add(self.icon)
        self.add(self.label)
        self.add(button)

        self.show_all() 
开发者ID:ImEditor,项目名称:ImEditor,代码行数:27,代码来源:tab.py

示例14: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, win, network_list):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
        self._win = win
        self._wiface = self._win.wiface

        # The network that the user selects
        self._selected_network = {}

        # Setting new window here
        self._win.set_main_widget(self)
        self._win.top_bar.disable_prev()

        box = self._create_main_box(network_list)
        self.add(box)

        self._win.show_all() 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:19,代码来源:NetworkScreen.py

示例15: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Box [as 别名]
def __init__(self, device):
        Gtk.Box.__init__(self, hexpand=True)

        self.device = device
        device_name = device.name

        dev_label = Gtk.Label(device_name, hexpand=True)
        dev_label.get_style_context().add_class('normal_label')
        self.pack_start(dev_label, False, False, 0)

        self._pair_button = KanoButton()
        self._set_paired_button_state()
        self._pair_button.set_margin_top(10)
        self._pair_button.set_margin_bottom(10)
        self._pair_button.set_margin_left(10)
        self._pair_button.set_margin_right(10)
        self._pair_button.connect('clicked', self.pair)
        self.pack_start(self._pair_button, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:20,代码来源:bluetooth_config.py


注:本文中的gi.repository.Gtk.Box方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。