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


Python TreeView.show_all方法代码示例

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


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

示例1: Region

# 需要导入模块: from dtk.ui.treeview import TreeView [as 别名]
# 或者: from dtk.ui.treeview.TreeView import show_all [as 别名]
class Region(gtk.Alignment):
    def __init__(self, connection=None):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)

        #################
        self.provider_select = None
        self.connect('expose-event', self.expose_event)
        self.prop_dict = {}

        main_table = gtk.Table(2, 2, False)
        main_table.set_row_spacing(1, 10)
        main_table.set_col_spacings(4)
        self.add(main_table)
        
        self.country_tree = TreeView(enable_multiple_select=False,
                                     enable_drag_drop=False,
                                     )
        self.country_tree.set_expand_column(1)

        self.country_tree.set_size_request(365, 380)
        self.country_tree.draw_mask = self.draw_mask
        self.country_tree.connect("button-press-item", self.country_selected)
        left_box_align = gtk.Alignment(0, 0, 0, 0)
        left_box_align.set_padding(1,1,1,1)
        left_box_align.add(self.country_tree)
        left_box_align.show_all()

        left_box = gtk.VBox()
        # wrap title
        country_title = TitleBar(app_theme.get_pixbuf("network/globe-green.png"),
                                 _("Country or Region:"),
                                 has_separator=False)
        left_box.pack_start(country_title, False, False)
        left_box.pack_start(left_box_align, False, False)

        self.provider_tree = TreeView(enable_multiple_select=False,
                                     enable_drag_drop=False,
                                      )
        self.provider_tree.set_expand_column(0)
        self.provider_tree.set_size_request(365, 380)
        self.provider_tree.draw_mask = self.draw_mask
        self.provider_tree.connect("button-press-item", self.provider_selected)
        right_box_align = gtk.Alignment(0, 0, 0, 0)
        right_box_align.set_padding(1,1,1,1)
        right_box_align.add(self.provider_tree)
        right_box = gtk.VBox()
        # wrap title
        provider_title = TitleBar(app_theme.get_pixbuf("network/building.png"),
                                  _("Provider:"),
                                  has_separator=False)
        right_box.pack_start(provider_title, False, False)
        right_box.pack_start(right_box_align, False, False)
        
        
        main_left_align = gtk.Alignment(0, 0, 0, 0)
        main_left_align.set_padding(15, 0, 20, 0)
        main_left_align.add(left_box)
        main_table.attach(main_left_align, 0, 1, 0, 1)
        main_right_align = gtk.Alignment(0, 0, 0, 0)
        main_right_align.set_padding(15, 0, 0, 20)
        main_right_align.add(right_box)
        main_table.attach(main_right_align, 1, 2, 0, 1)

        hints = _("Tips:This assistant helps you easily set up a mobile broadband connection to a cellular network.")
            
        left_box_align.connect("expose-event", self.expose_outline)
        right_box_align.connect("expose-event", self.expose_outline)

        next_button = Button("Next")
        next_button.connect("clicked", self.next_button_clicked)
        
        self.foot_box = FootBox()
        self.foot_box.set_buttons([next_button])
        self.foot_box.set_tip(hints)
        main_table.attach(self.foot_box, 0, 2, 1, 2)

        self.show_all()
        #self.init()

    def expose_outline(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        with cairo_disable_antialias(cr):
            cr.set_line_width(1)
            cr.set_source_rgb(*BORDER_COLOR)
            cr.rectangle(rect.x, rect.y, rect.width , rect.height )
            cr.stroke()

    def draw_mask(self, cr, x, y, w, h):
        cr.set_source_rgb(1, 1, 1)
        cr.rectangle(x, y, w, h)
        cr.fill()

    def expose_event(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        cr.set_source_rgb( 1, 1, 1) 
        cr.rectangle(rect.x, rect.y, rect.width, rect.height)
        cr.fill()

#.........这里部分代码省略.........
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:103,代码来源:regions.py


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