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


Python Gtk.Expander方法代码示例

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


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

示例1: write_citation

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Expander [as 别名]
def write_citation(self, vbox, chandle):
        citation = self.dbstate.db.get_citation_from_handle(chandle)
        shandle = citation.get_reference_handle()
        source = self.dbstate.db.get_source_from_handle(shandle)
        heading = source.get_title()
        page = citation.get_page()
        if page:
            heading += ' \u2022 ' + page

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        url_label = self.get_url(citation)
        if url_label:
            box.pack_start(url_label, False, False, 0)
        hbox = self.load_images(citation)
        box.pack_start(hbox, False, False, 0)

        if len(hbox.get_children()) > 0 or url_label:
            exp = Gtk.Expander(label=heading)
            exp.add(box)
            vbox.pack_start(exp, False, False, 0)
        else:
            label = widgets.BasicLabel(heading)
            vbox.pack_start(label, False, False, 0) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:25,代码来源:combinedview.py

示例2: onNewsItem

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

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Expander [as 别名]
def __init__(self, manager, parent=None):
		Gtk.Window.__init__(self, title=_("Backup"))
		self.set_border_width(10)
		self.set_icon_name("drive-harddisk")
		self.set_position(Gtk.WindowPosition.CENTER)

		if parent is not None:
			self.set_transient_for(parent)

		vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
		self.add(vbox)

		self.label = Gtk.Label(_("Ready."), xalign=0)
		self.label.set_justify(Gtk.Justification.LEFT)
		vbox.pack_start(self.label, False, False, 0)

		self.progressbar = Gtk.ProgressBar()
		vbox.pack_start(self.progressbar, False, False, 0)

		self.textview = Gtk.TextView()
		#self.textview.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(0, 0, 0))
		#self.textview.modify_text(Gtk.StateType.NORMAL, Gdk.Color(255, 255, 255))
		fontdesc = Pango.FontDescription("monospace")
		self.textview.modify_font(fontdesc)
		self.textview.set_editable(False)
		sw = Gtk.ScrolledWindow()
		sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
		sw.set_min_content_height(200)
		sw.add(self.textview)
		exp = Gtk.Expander()
		exp.set_label(_("Details"))
		exp.add(sw)
		vbox.pack_start(exp, True, True, 0)

		hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=50)
		vbox.add(hbox)
		self.close_button = Gtk.Button(_("Close"))
		self.close_button.connect("clicked", self.on_close_clicked)
		hbox.pack_end(self.close_button, False, False, 0)

		self.manager = manager 
开发者ID:emersion,项目名称:bups,代码行数:43,代码来源:gtk.py

示例4: write_parents

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Expander [as 别名]
def write_parents(self, family_handle, person = None):
        family = self.dbstate.db.get_family_from_handle(family_handle)
        if not family:
            return

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        heading = self.write_label(_('Parents'), family, True)
        vbox.pack_start(heading, False, False, 1)
        f_handle = family.get_father_handle()
        box = self.write_person(_('Father'), f_handle)
        ebox = self.make_dragbox(box, 'Person', f_handle)
        vbox.pack_start(ebox, False, False, 1)
        m_handle = family.get_mother_handle()
        box = self.write_person(_('Mother'), m_handle)
        ebox = self.make_dragbox(box, 'Person', m_handle)
        vbox.pack_start(ebox, False, False, 1)

        if self.show_siblings:
            active = self.get_handle()

            count = len(family.get_child_ref_list())
            ex2 = Gtk.Expander(label='%s (%s):' % (_('Siblings'), count))
            ex2.set_margin_start(24)
            ex2.set_expanded(True)
            vbox.pack_start(ex2, False, False, 6)

            vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
            hbox = Gtk.Box()
            addchild = widgets.IconButton(self.add_child_to_fam,
                                          family.handle,
                                          'list-add')
            addchild.set_tooltip_text(_('Add new child to family'))
            selchild = widgets.IconButton(self.sel_child_to_fam,
                                          family.handle,
                                          'gtk-index')
            selchild.set_tooltip_text(_('Add existing child to family'))
            hbox.pack_start(addchild, False, True, 0)
            hbox.pack_start(selchild, False, True, 0)

            vbox2.pack_start(hbox, False, False, 0)
            i = 1
            child_list = [ref.ref for ref in family.get_child_ref_list()]
            for child_handle in child_list:
                child_should_be_linked = (child_handle != active)
                widget = self.write_child(child_handle, i, child_should_be_linked)
                vbox2.pack_start(widget, True, True, 1)
                i += 1

            ex2.add(vbox2)

        self.vbox2.pack_start(vbox, False, True, 0) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:53,代码来源:combinedview.py

示例5: write_family

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Expander [as 别名]
def write_family(self, family_handle, person = None):
        family = self.dbstate.db.get_family_from_handle(family_handle)
        if family is None:
            from gramps.gui.dialog import WarningDialog
            WarningDialog(
                _('Broken family detected'),
                _('Please run the Check and Repair Database tool'),
                parent=self.uistate.window)
            return

        father_handle = family.get_father_handle()
        mother_handle = family.get_mother_handle()
        if self.get_handle() == father_handle:
            handle = mother_handle
        else:
            handle = father_handle

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        heading = self.write_label(_('Family'), family, False)
        vbox.pack_start(heading, False, False, 1)

        if handle or family.get_relationship() != FamilyRelType.UNKNOWN:
            box = self.write_person(_('Spouse'), handle)
            if not self.write_relationship_events(box, family):
                self.write_relationship(box, family)
            ebox = self.make_dragbox(box, 'Person', handle)
        vbox.pack_start(ebox, False, False, 1)

        count = len(family.get_child_ref_list())
        ex2 = Gtk.Expander(label='%s (%s):' % (_('Children'), count))
        ex2.set_expanded(True)
        ex2.set_margin_start(24)
        vbox.pack_start(ex2, False, False, 6)

        vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        hbox = Gtk.Box()
        addchild = widgets.IconButton(self.add_child_to_fam,
                                      family.handle,
                                      'list-add')
        addchild.set_tooltip_text(_('Add new child to family'))
        selchild = widgets.IconButton(self.sel_child_to_fam,
                                      family.handle,
                                      'gtk-index')
        selchild.set_tooltip_text(_('Add existing child to family'))
        hbox.pack_start(addchild, False, True, 0)
        hbox.pack_start(selchild, False, True, 0)

        vbox2.pack_start(hbox, False, False, 0)

        i = 1
        child_list = family.get_child_ref_list()
        for child_ref in child_list:
            widget = self.write_child(child_ref.ref, i, True)
            vbox2.pack_start(widget, True, True, 1)
            i += 1

        ex2.add(vbox2)

        self.vbox2.pack_start(vbox, False, True, 0) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:62,代码来源:combinedview.py


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