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


Python ScrolledWindow.show_all方法代码示例

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


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

示例1: SettingUI

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import show_all [as 别名]
class SettingUI(gtk.Alignment):
    def __init__(self, slide_back_cb, change_crumb_cb):
        gtk.Alignment.__init__(self, 0, 0, 0, 0)
        self.slide_back = slide_back_cb
        self.change_crumb = change_crumb_cb
        
        self.scroll_win = ScrolledWindow()
        self.scroll_win.set_can_focus(False)

        self.scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        main_vbox = gtk.VBox()
        self.foot_box = FootBox()
        self.hbox = gtk.HBox()

        self.scroll_win.add_with_viewport(self.hbox)
        self.scroll_align = gtk.Alignment()
        self.scroll_win.set_size_request(800, 435)
        self.scroll_align.set(0, 0, 0, 0)
        self.scroll_align.set_padding(0, 0, 30, 0)
        self.scroll_align.add(self.scroll_win)
        
        padding_align = gtk.Alignment(0, 0, 0, 0)
        padding_align.set_padding(15, 0, 0, 0)
        self.sidebar = SideBar( None)
        padding_align.add(self.sidebar)
        self.hpaned = MyPaned()
        self.hpaned.set_size_request(800, -1)
        self.hpaned.connect("expose-event",self.expose_line)
        #self.hpaned.do_enter_notify_event = self.enter_notify_event
        self.hpaned.add1(padding_align)
        self.hpaned.add2(self.scroll_align)
        self.connect_after("show", self.__init_paned)
        main_vbox.pack_start(self.hpaned, True, True)
        main_vbox.pack_start(self.foot_box, False, False)
        self.add(main_vbox)

        self.__init_signals()

    def enter_notify_event(self, e):
        pass

    def __init_paned(self, widget):
        log.debug("")
        self.hpaned.saved_position = 160
        self.hpaned.set_position(1)
        self.hpaned.animation_position_frames = [0]
        self.hpaned.update_position()

    def __init_signals(self):
        Dispatcher.connect("connection-change", self.switch_content)
        Dispatcher.connect("setting-saved", self.save_connection_setting)
        Dispatcher.connect("setting-appled", self.apply_connection_setting)
        Dispatcher.connect("request_redraw", lambda w: self.scroll_win.show_all())

    def load_module(self, module_obj, hide_left):
        # create a reference
        self.setting_group = module_obj
        
        # init paned
        self.__init_paned(None)
        log.info("dss start load module", module_obj)
        self.hpaned.set_button_show(hide_left)
        
        # init foot_box
        self.foot_box.set_setting(module_obj)

        # init sidebar
        self.sidebar.load_list(module_obj)
        self.apply_method = module_obj.apply_changes
        self.save_method = module_obj.save_changes
        

    def switch_content(self, widget, connection):
        container_remove_all(self.hbox)
        self.set_tab_content(connection)
        self.set_foot_bar_button(connection)
    
        self.focus_connection = connection

    def set_foot_bar_button(self, connection):
        if type(connection) == NMRemoteConnection:
            self.foot_box.show_delete(connection)
        else:
            self.foot_box.hide_delete()
        states = self.setting_group.get_button_state(connection)
        if states:
            Dispatcher.set_button(*states)
        
    def set_tab_content(self, connection):
        log.debug("set tab content", connection)
        setting = self.setting_group.init_items(connection)
        self.hbox.add(setting)
        self.hbox.show_all()
        self.foot_box.set_lock(False)

    def expose_line(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        style.draw_out_line(cr, rect, exclude=["left", "right", "top"])

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

示例2: RecommendItem

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import show_all [as 别名]

#.........这里部分代码省略.........
    
    def get_column_widths(self):
        return [CATEGORY_ITEM_NAME_WIDTH]
        
    def get_column_renders(self):    
        return [self.render_name]
        
    def hover(self, column, offset_x, offset_y):
        self.is_hover = True
        if self.redraw_request_callback:
            self.redraw_request_callback(self)
        
    def unhover(self, column, offset_x, offset_y):
        self.is_hover = False
        if self.redraw_request_callback:
            self.redraw_request_callback(self)
    
    def select(self):
        self.is_select = True
        if self.redraw_request_callback:
            self.redraw_request_callback(self)
        
    def unselect(self):
        self.is_select = False
        if self.redraw_request_callback:
            self.redraw_request_callback(self)
            
    def button_press(self, column, offset_x, offset_y):
        self.show_page()

    def get_pkg_icon_view_page(self):
        items = []
        for info in self.recommend_infos:
            items.append(RecommendIconItem(info))
        
        self.pkg_icon_view = IconView() 
        self.pkg_icon_view.add_items(items)
        self.pkg_icon_scrolled_window = ScrolledWindow()
        self.pkg_icon_scrolled_window.add_child(self.pkg_icon_view)
        self.pkg_icon_view.draw_mask = self.draw_mask
        
        self.pkg_icon_view_align = gtk.Alignment()
        self.pkg_icon_view_align.set(0.5, 0.5, 1, 1)
        self.pkg_icon_view_align.set_padding(6, 0, 1, 11)
        self.pkg_icon_view_align.add(self.pkg_icon_scrolled_window)
        return self.pkg_icon_view_align

    def get_download_rank_page(self):
        self.download_rank_page = DownloadRankPage(self.data_manager)
        return self.download_rank_page
    
    def get_album_page(self):
        self.album_page = AlbumPage(self.data_manager)
        return self.album_page
        
    # from deepin_utils.date_time import print_exec_time
    # @print_exec_time
    def show_page(self):
        if self.recommend_scrolled_window_initial:        
            global_event.emit("show-pkg-view", self.recommend_scrolled_window)
        else:
            self.check_network_connection()
        
    def draw_blank_mask(self, cr, x, y, w, h):
        pass
        
    def draw_mask(self, cr, x, y, w, h):
        '''
        Draw mask interface.
        
        @param cr: Cairo context.
        @param x: X coordiante of draw area.
        @param y: Y coordiante of draw area.
        @param w: Width of draw area.
        @param h: Height of draw area.
        '''
        draw_vlinear(cr, x, y, w, h,
                     [(0, ("#FFFFFF", 0.9)),
                      (1, ("#FFFFFF", 0.9)),]
                     )
        
    def click_page(self):
        if isinstance(self.active_page, AlbumPage) and self.active_page.in_detail_view:
            self.active_page.switch_to_album_summary_view()
        
    def switch_page(self, page_index):
        container_remove_all(self.page_box)
        page_name = self.page_name[page_index]

        if not self.page_cache.has_key(self.page_name[page_index]):
            self.page_cache[page_name] = getattr(self, self.tab_switcher_pages_callback[page_index])()

        self.active_page = self.page_cache[page_name]
        self.page_box.pack_start(self.active_page, True, True)
        
        if isinstance(self.active_page, AlbumPage):
            if self.active_page.in_detail_view:
                self.active_page.switch_to_album_summary_view()

        self.recommend_scrolled_window.show_all()
开发者ID:electricface,项目名称:deepin-software-center,代码行数:104,代码来源:home_page.py


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