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


Python ScrolledWindow.connect方法代码示例

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


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

示例1: get_scrolled_window

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import connect [as 别名]
 def get_scrolled_window(self):
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     scrolled_window.connect("vscrollbar-state-changed",
                             self.__on_vscrollbar_state_changed)
     scrolled_window.add_child(self)
     return scrolled_window
开发者ID:haskyLue,项目名称:deepin-music-player,代码行数:9,代码来源:radio_view.py

示例2: DetailPage

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

#.........这里部分代码省略.........
        self.left_homepage_box_align.set(0.0, 0.5, 0, 0)
        self.left_homepage_box_align.add(self.left_homepage_box)

        self.left_recommend_box = gtk.VBox()
        self.left_recommend_box_align = gtk.Alignment()
        self.left_recommend_box_align.set(0.0, 0.0, 0, 0)
        self.left_recommend_box_align.set_padding(30, 0, 14, 0)
        self.left_recommend_box_align.add(self.left_recommend_box)

        self.left_recommend_label = Label(_("Popular recommendations"))

        self.right_info_box = gtk.VBox()
        self.scrolled_window = ScrolledWindow(0, 0)
        self.right_view_box = gtk.VBox()

        self.right_top_box = gtk.HBox()
        self.right_top_box.set_size_request(-1, self.RIGHT_TITLE_BOX_HEIGHT)
        self.right_desc_box = gtk.VBox()
        self.right_slide_box = gtk.VBox()
        self.right_comment_box = gtk.VBox()

        self.right_title_box = gtk.VBox()

        self.return_button = ImageButton(
            app_theme.get_pixbuf("detail/normal.png"),
            app_theme.get_pixbuf("detail/hover.png"),
            app_theme.get_pixbuf("detail/press.png"),
            )
        self.return_align = gtk.Alignment()
        self.return_align.set(0.5, 0.5, 1, 1)
        self.return_align.set_padding(self.ALIAS_NAME_PADDING_Y, 0, 0, self.RIGHT_INFO_PADDING_X)
        self.return_align.add(self.return_button)

        self.return_button.connect("clicked", lambda w: global_event.emit("switch-from-detail-page"))

        self.right_top_box.pack_start(self.right_title_box, True, True)
        self.right_top_box.pack_start(self.return_align, False, False)

        self.right_view_box.pack_start(self.right_top_box, False, False)
        self.right_view_box.pack_start(self.right_desc_box, False, False)
        self.right_view_box.pack_start(self.right_slide_box, False, False)
        self.right_view_box.pack_start(self.right_comment_box, False, False)
        self.scrolled_window.add_child(self.right_view_box)

        self.left_view_box.pack_start(self.left_logo_box, False, False)
        self.left_view_box.pack_start(self.star_align, False, False)
        self.left_view_box.pack_start(self.left_action_align, False, False)
        self.left_label_table.attach(self.left_category_box, 0, 1, 0, 1)
        self.left_label_table.attach(self.left_version_label, 0, 1, 1, 2)
        self.left_label_table.attach(self.left_size_label, 0, 1, 2, 3)
        self.left_label_table.attach(self.left_download_label, 0, 1, 3, 4)
        self.left_label_table.attach(self.left_homepage_box_align, 0, 1, 4, 5)
        self.left_label_align.add(self.left_label_table)
        self.left_view_box.pack_start(self.left_label_align, False, False)
        self.left_view_box.pack_start(self.left_recommend_box_align, False, False)
        self.right_info_box.pack_start(self.scrolled_window, True, True)
        self.pack_start(self.left_view_box, False, False)
        self.pack_start(self.right_info_box, True, True)

        self.left_view_box.connect("expose-event", self.expose_left_view)
        self.right_view_box.connect("expose-event", self.expose_right_view)
        self.left_logo_box.connect("expose-event", self.expose_left_logo_box)
        self.right_top_box.connect("expose-event", self.expose_right_top_box)
        self.right_title_box.connect("expose-event", self.expose_right_title_box)
        self.connect("hierarchy-changed", self.hierarchy_change)
开发者ID:kissthink,项目名称:deepin-store,代码行数:69,代码来源:detail_page.py

示例3: SecondCategoryItem

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

#.........这里部分代码省略.........
    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 scrolled_window_vscrollbar_handler(self, widget, state):
        if state == "bottom":
            current_item_number = len(self.pkg_icon_view.items)
            all_pkgs_number = len(self.all_pkg_names)
            start = current_item_number
            if current_item_number < all_pkgs_number and (current_item_number+LOAD_ITEMS_NUMBER) < all_pkgs_number:
                end = current_item_number+LOAD_ITEMS_NUMBER
            elif current_item_number < all_pkgs_number and (current_item_number+LOAD_ITEMS_NUMBER) >= all_pkgs_number:
                end = all_pkgs_number
            else:
                return
            self.load_new_items(self.all_pkg_names[start:end])

    def load_new_items(self, pkg_names):
        items = []
        for pkg_name in pkg_names:
            info = self.data_manager.get_item_pkg_info(pkg_name)
            items.append(PkgIconItem(info[0], info[1], info[2], self.data_manager))
        self.pkg_icon_view.add_items(items)
        global_event.emit("show-pkg-view", self.page_box)

    def handle_pkg_install_status_request(self, status, items):
        for (index, state) in enumerate(status):
            items[index].is_installed = state
            items[index].emit_redraw_request()

    def button_press(self, column, offset_x, offset_y):
        # init Loading widget
        loading_box = LoadingBox()

        global_event.emit("show-pkg-view", loading_box)

        self.page_box = gtk.VBox()    
            
        self.all_pkg_names = self.data_manager.get_second_category_packages(self.second_category_name)
        self.message_bar = MessageBar(18)
        self.message_bar.set_message(_("%s > %s : %s applications") % (
                get_category_name(self.first_category_name), 
                get_category_name(self.second_category_name), 
                len(self.all_pkg_names),
                ))
        
        self.pkg_icon_view = IconView() 
        self.pkg_icon_view.connect("motion-notify-item", tooltip_aciton)
        if len(self.all_pkg_names) > LOAD_ITEMS_NUMBER:
            self.load_new_items(self.all_pkg_names[:LOAD_ITEMS_NUMBER])
        else:
            self.load_new_items(self.all_pkg_names)

        self.pkg_icon_scrolled_window = ScrolledWindow()
        self.pkg_icon_scrolled_window.connect("vscrollbar-state-changed", self.scrolled_window_vscrollbar_handler)
        self.pkg_icon_scrolled_window.add_child(self.pkg_icon_view)
        self.pkg_icon_view.draw_mask = self.draw_mask
        self.pkg_icon_view.draw_row_mask = self.draw_row_mask
        
        self.page_box.pack_start(self.message_bar, False, False)
        self.page_box.pack_start(self.pkg_icon_scrolled_window, True, True)
        
        global_event.emit("update-current-status-pkg-page", self.pkg_icon_view)
        
    def draw_row_mask(self, cr, rect, row):
        if row % 2 == 1:
            cr.set_source_rgba(1, 1, 1, 0.5)
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.fill()
    
    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)),]
                     )
开发者ID:electricface,项目名称:deepin-software-center,代码行数:104,代码来源:home_page.py

示例4: CategoryItem

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

#.........这里部分代码省略.........
            self.load_new_items(self.all_pkg_names[start:end])
            
    def load_new_items(self, pkg_names):
        items = []
        for pkg_name in pkg_names:
            info = self.data_manager.get_item_pkg_info(pkg_name)
            items.append(PkgIconItem(info[0], info[1], info[2], self.data_manager))
        self.pkg_icon_view.add_items(items)
        global_event.emit("show-pkg-view", self.page_box)

    def handle_pkg_install_status_request(self, status, items):
        for (index, state) in enumerate(status):
            items[index].is_installed = state
            items[index].emit_redraw_request()

    def single_click(self, column, offset_x, offset_y):
        # init Loading widget
        loading_box = LoadingBox()
        global_event.emit("show-pkg-view", loading_box)

        self.page_box = gtk.VBox()    

        self.all_pkg_names = []
        self.all_desktop_infos = {}
        self.all_pkg_names = self.data_manager.get_first_category_packages(self.first_category_name)
            
        self.message_bar = MessageBar(18)
        self.message_bar.set_message(_("%s: %s applications") % (
                    get_category_name(self.first_category_name), 
                    len(self.all_pkg_names),
                    ))
        
        self.pkg_icon_view = IconView() 
        self.pkg_icon_view.connect("motion-notify-item", tooltip_aciton)
        if len(self.all_pkg_names) > LOAD_ITEMS_NUMBER:
            self.load_new_items(self.all_pkg_names[:LOAD_ITEMS_NUMBER])
        else:
            self.load_new_items(self.all_pkg_names)

        self.pkg_icon_view.draw_mask = self.draw_mask
        self.pkg_icon_view.draw_row_mask = self.draw_row_mask
        self.pkg_icon_scrolled_window = ScrolledWindow()
        self.pkg_icon_scrolled_window.connect("vscrollbar-state-changed", self.scrolled_window_vscrollbar_handler)
        self.pkg_icon_scrolled_window.add_child(self.pkg_icon_view)
        
        self.page_box.pack_start(self.message_bar, False, False)
        self.page_box.pack_start(self.pkg_icon_scrolled_window, True, True)
        global_event.emit("update-current-status-pkg-page", self.pkg_icon_view)
        
    def draw_row_mask(self, cr, rect, row):
        if row % 2 == 1:
            cr.set_source_rgba(1, 1, 1, 0.5)
            cr.rectangle(rect.x, rect.y, rect.width, rect.height)
            cr.fill()
    
    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,
开发者ID:electricface,项目名称:deepin-software-center,代码行数:70,代码来源:home_page.py

示例5: get_scrolled_window

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import connect [as 别名]
 def get_scrolled_window(self):
     scrolled_window = ScrolledWindow()
     scrolled_window.connect("vscrollbar-state-changed", self.__on_vscrollbar_state_changed)
     scrolled_window.add_child(self)
     return scrolled_window
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:7,代码来源:select_page.py

示例6: ModuleFrame

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import connect [as 别名]
        # Return True to tell IconView call gc.collect() to release memory resource.
        if self.pixbuf:
            del self.pixbuf
        self.pixbuf = None    
        return True
    
if __name__ == '__main__':
    gtk.gdk.threads_init()
    module_frame = ModuleFrame(os.path.join(get_parent_dir(__file__, 2), "config.ini"))

    scrolled_window = ScrolledWindow()
    scrolled_window.set_size_request(788, 467)
    wallpaper_view = WallpaperView()
    scrolled_window.add_child(wallpaper_view)
    module_frame.add(scrolled_window)
    
    scrolled_window.connect("vscrollbar-state-changed", wallpaper_view.load_more_background)
    
    download_pool = MissionThreadPool(5)
    download_pool.start()
    
    def message_handler(*message):
        (message_type, message_content) = message
        if message_type == "show_again":
            module_frame.send_module_info()
        elif message_type == "exit":
            module_frame.exit()

    module_frame.module_message_handler = message_handler        
    module_frame.run()
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:32,代码来源:main.new.py


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