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


Python Gtk.Alignment方法代码示例

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


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

示例1: add_heading

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [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

示例2: create_custom_label

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [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

示例3: __init__

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

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.title = Heading(title, description, is_plug, back_btn)
        self.title.container.set_margin_bottom(0)
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3)
        self.align.add(self.box)
        self.kano_button = KanoButton(button_text)
        self.kano_button.pack_and_align()
        self.kano_button.align.set_padding(0, 30, 0, 0)

        self.pack_start(self.title.container, False, False, 0)
        self.pack_start(self.align, True, True, 0)
        self.pack_end(self.kano_button.align, False, False, 0) 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:25,代码来源:templates.py

示例4: init_grid

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def init_grid(self):
		# Create widgets
		self.grid = Gtk.Grid()
		self.rev = RevealerClass()
		align = Gtk.Alignment()
		self.eb = Gtk.EventBox()
		# Set values
		self.grid.set_row_spacing(1)
		self.grid.set_column_spacing(3)
		self.rev.set_reveal_child(False)
		align.set_padding(2, 2, 5, 5)
		self.eb.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.background))
		self.grid.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(*self.background))
		# Connect signals
		self.eb.connect("button-release-event", self.on_grid_release)
		self.eb.connect("button-press-event", self.on_grid_click)
		self.eb.connect('enter-notify-event', self.on_enter_notify)
		self.eb.connect('leave-notify-event', self.on_leave_notify)
		# Pack together
		align.add(self.grid)
		self.eb.add(align)
		self.rev.add(self.eb)
		self.add(self.rev)
	
	### GtkWidget-related stuff 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:27,代码来源:infobox.py

示例5: pack_and_align

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def pack_and_align(self):

        # This stops the button resizing to fit the size of its container
        self.box = Gtk.Box()
        self.box.add(self)
        self.props.halign = Gtk.Align.CENTER
        self.box.props.halign = Gtk.Align.CENTER

        # This allows us to set our padding
        self.align = Gtk.Alignment(xscale=0, yscale=0)
        self.align.add(self.box) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:13,代码来源:buttons.py

示例6: __init__

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

        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.entries = []

        # entries_info = [{"heading": "", "subheading": ""}, {"heading": "", "subheading": ""}]
        for info in entries_info:
            entry = Gtk.Entry()
            align = create_labelled_widget(info["heading"], info["subheading"], entry)
            self.entries.append(entry)
            self.box.pack_start(align, False, False, 5)

        self.add(self.box) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:16,代码来源:labelled_entries.py

示例7: create_labelled_widget

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

    label_box = create_custom_label(heading, description)
    box = Gtk.Box()
    box.pack_start(label_box, False, False, 5)
    box.pack_start(widget, False, False, 5)

    align = Gtk.Alignment(xscale=0, xalign=1)
    align.add(box)

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

示例8: create_align

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def create_align(self, text, css_class='about_label'):
        '''This styles the status information in the 'about' dialog
        '''

        label = Gtk.Label(text)
        label.get_style_context().add_class(css_class)

        align = Gtk.Alignment(xalign=0.5, xscale=0, yalign=0, yscale=0)
        align.add(label)

        return align 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:13,代码来源:set_about.py

示例9: create_text_align

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def create_text_align(self):
        label = Gtk.Label(_("You need internet to continue"))
        label.get_style_context().add_class('about_version')

        align = Gtk.Alignment(xalign=0.5, xscale=0, yalign=0, yscale=0)
        align.add(label)

        return align 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:10,代码来源:no_internet_screen.py

示例10: __build_palette

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def __build_palette(self):
        """Draws the palette of colors"""
        self.__reset_palette()
        # (re-)create the palette widget
        self.palette = Gtk.Alignment()
        self.pack_start(self.palette, True, True, 0)
        # Draw the palette
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.palette.add(vbox)
        vbox.set_spacing(4)
        for i in range(len(self.colors)):
            if i % self.width == 0:
                cur_box = Gtk.Box()
                vbox.pack_start(cur_box, True, True, 0)
            # add the color box
            img = SimpleColorSelectorPaletteItem()
            img.set_size_request(
                BUTTON_WIDTH, BUTTON_HEIGHT)
            img.connect("button-press-event", self.on_color_clicked)
            img.set_color(self.colors[i])
            self.buttons_lookup[self.colors[i]] = img
            self.buttons.append(img)
            cur_box.pack_start(img, False, False, 0)
            cur_box.set_spacing(4)
        # make palette visible
        self.palette.show_all() 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:28,代码来源:simple_color_selector.py

示例11: on_chessfile_opened0

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def on_chessfile_opened0(self, persp, chessfile):
        page = Gtk.Alignment()
        tabcontent, close_button = self.get_tabcontent(chessfile)
        self.headbook.append_page(page, tabcontent)
        self.page_dict[page] = (chessfile, close_button)
        page.show_all()

        gamelist = GameList(self)
        self.gamelists.append(gamelist)
        opening_tree_panel = OpeningTreePanel(self)
        self.opening_tree_panels.append(opening_tree_panel)
        filter_panel = FilterPanel(self)
        self.filter_panels.append(filter_panel)
        preview_panel = PreviewPanel(self)
        self.preview_panels.append(preview_panel)

        self.notebooks["gamelist"].append_page(gamelist.box)
        self.notebooks["OpeningTreePanel"].append_page(opening_tree_panel.box)
        self.notebooks["FilterPanel"].append_page(filter_panel.box)
        self.notebooks["PreviewPanel"].append_page(preview_panel.box)

        self.headbook.set_current_page(self.headbook.get_n_pages() - 1)

        gamelist.load_games()
        opening_tree_panel.update_tree(load_games=False)

        self.set_sensitives(True)
        self.emit("chessfile_opened", chessfile) 
开发者ID:pychess,项目名称:pychess,代码行数:30,代码来源:__init__.py

示例12: onNewsItem

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def onNewsItem(self, nm, news):
        weekday, month, day, title, details = news

        dtitle = "%s, %s %s: %s" % (weekday, month, day, title)
        label = Gtk.Label(label=dtitle)
        label.props.width_request = 300
        label.props.xalign = 0
        label.set_ellipsize(Pango.EllipsizeMode.END)
        expander = Gtk.Expander()
        expander.set_label_widget(label)
        expander.set_tooltip_text(title)
        textview = Gtk.TextView()
        textview.set_wrap_mode(Gtk.WrapMode.WORD)
        textview.set_editable(False)
        textview.set_cursor_visible(False)
        textview.props.pixels_above_lines = 4
        textview.props.pixels_below_lines = 4
        textview.props.right_margin = 2
        textview.props.left_margin = 6

        tb_iter = textview.get_buffer().get_end_iter()
        insert_formatted(textview, tb_iter, details)

        alignment = Gtk.Alignment()
        alignment.set_padding(3, 6, 12, 0)
        alignment.props.xscale = 1
        alignment.add(textview)

        expander.add(alignment)
        expander.show_all()
        self.widgets["newsVBox"].pack_start(expander, False, False, 0) 
开发者ID:pychess,项目名称:pychess,代码行数:33,代码来源:NewsPanel.py

示例13: onFingeringFinished

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def onFingeringFinished(self, fm, finger, playername):
            if not isinstance(self.get_child(), Gtk.Label) or \
                    finger.getName().lower() != playername.lower():
                return
            self.fm.disconnect(self.handle_id)

            label = Gtk.Label()
            label.set_markup("<b>%s</b>" % playername)
            widget = Gtk.Frame()
            widget.set_label_widget(label)
            widget.set_shadow_type(Gtk.ShadowType.NONE)

            alignment = Gtk.Alignment.new(0, 0, 1, 1)
            alignment.set_padding(3, 0, 12, 0)
            widget.add(alignment)

            text_view = Gtk.TextView()
            text_view.set_editable(False)
            text_view.set_cursor_visible(False)
            text_view.props.wrap_mode = Gtk.WrapMode.WORD

            tb_iter = text_view.get_buffer().get_end_iter()
            for i, note in enumerate(finger.getNotes()):
                if note:
                    insert_formatted(text_view, tb_iter, "%s\n" % note)
            text_view.show_all()
            scroll_win = Gtk.ScrolledWindow()
            scroll_win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            scroll_win.add(text_view)
            alignment.add(scroll_win)

            self.remove(self.get_child())
            self.add(widget)
            widget.show_all() 
开发者ID:pychess,项目名称:pychess,代码行数:36,代码来源:InfoPanel.py

示例14: toggle_active

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def toggle_active(self, *args):
        if self.active:  # Deactivate
            self.active = False
            self.container.remove(self.frame)
            if self.update is not None:
                self.update()
            self.plotcanvas.mpl_disconnect(self.click_subscription)
            self.plotcanvas.mpl_disconnect(self.move_subscription)
            return False
        else:  # Activate
            App.log.debug("DEBUG: Activating Measurement Tool...")
            self.active = True
            self.click_subscription = self.plotcanvas.mpl_connect("button_press_event", self.on_click)
            self.move_subscription = self.plotcanvas.mpl_connect('motion_notify_event', self.on_move)
            self.frame = Gtk.Frame()
            self.frame.set_margin_right(5)
            self.frame.set_margin_top(3)
            align = Gtk.Alignment()
            align.set(0, 0.5, 0, 0)
            align.set_padding(4, 4, 4, 4)
            self.label = Gtk.Label()
            self.label.set_label("Click on a reference point...")
            abox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10)
            abox.pack_start(Gtk.Image.new_from_file('share/measure16.png'), False, False, 0)
            abox.pack_start(self.label, False, False, 0)
            align.add(abox)
            self.frame.add(align)
            self.container.pack_end(self.frame, False, True, 1)
            self.frame.show_all()
            return True 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:32,代码来源:FlatCAMApp.py

示例15: _create_toolitems

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Alignment [as 别名]
def _create_toolitems(self):
        iconSize = Gtk.IconSize.SMALL_TOOLBAR

        for text, tooltip_text, image_num, callback, callback_arg, scroll \
                in self.toolitems:
            if text is None:
                self.insert( Gtk.SeparatorToolItem(), -1 )
                continue
            image = Gtk.Image()
            image.set_from_stock(image_num, iconSize)
            tbutton = Gtk.ToolButton()
            tbutton.set_label(text)
            tbutton.set_icon_widget(image)
            self.insert(tbutton, -1)
            if callback_arg:
                tbutton.connect('clicked', getattr(self, callback),
                                callback_arg)
            else:
                tbutton.connect('clicked', getattr(self, callback))
            if scroll:
                tbutton.connect('scroll_event', getattr(self, callback))
            tbutton.set_tooltip_text(tooltip_text)

        # Axes toolitem, is empty at start, update() adds a menu if >=2 axes
        self.axes_toolitem = Gtk.ToolItem()
        self.insert(self.axes_toolitem, 0)
        self.axes_toolitem.set_tooltip_text(
                            'Select axes that controls affect')

        align = Gtk.Alignment (xalign=0.5, yalign=0.5, xscale=0.0, yscale=0.0)
        self.axes_toolitem.add(align)

        self.menubutton = Gtk.Button ("Axes")
        align.add (self.menubutton)

        def position_menu (menu):
            """Function for positioning a popup menu.
            Place menu below the menu button, but ensure it does not go off
            the bottom of the screen.
            The default is to popup menu at current mouse position
            """
            x0, y0    = self.window.get_origin()
            x1, y1, m = self.window.get_pointer()
            x2, y2    = self.menubutton.get_pointer()
            sc_h      = self.get_screen().get_height()
            w, h      = menu.size_request()

            x = x0 + x1 - x2
            y = y0 + y1 - y2 + self.menubutton.allocation.height
            y = min(y, sc_h - h)
            return x, y, True

        def button_clicked (button, data=None):
            self.axismenu.popup (None, None, position_menu, 0,
                                 Gtk.get_current_event_time())

        self.menubutton.connect ("clicked", button_clicked) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:59,代码来源:backend_gtk3.py


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