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


Python ScrolledWindow.set_policy方法代码示例

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


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

示例1: get_scrolled_window

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [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: __init__

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
 def __init__(self):
     DialogBox.__init__(self, _("Task Manager"), 350, 450, DIALOG_MASK_SINGLE_PAGE,
                        modal=False, close_callback=self.hide_all)
     
     self.is_changed = False
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     
     scrolled_align = gtk.Alignment()
     scrolled_align.set(1, 1, 1, 1)
     scrolled_align.set_padding(10, 0, 0, 0)
     scrolled_align.add(scrolled_window)
     
     self.jobs_view = JobsView()
     self.jobs_view.draw_mask = self.get_mask_func(self.jobs_view)
     scrolled_window.add_child(self.jobs_view)
     
     pause_button = Button(_("Pause"))
     pause_button.connect("clicked", self.pause_job)
     stop_button = Button(_("Close"))
     stop_button.connect("clicked", lambda w: self.hide_all())
     
     self.body_box.add(scrolled_align)
     self.right_button_box.set_buttons([pause_button, stop_button])
     
     Dispatcher.connect("transfor-job", self.add_new_job)
开发者ID:electricface,项目名称:deepin-music-player,代码行数:28,代码来源:converter.py

示例3: __init__

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
 def __init__(self):
     DialogBox.__init__(self, _("Search"), 460, 300, DIALOG_MASK_SINGLE_PAGE,
                        modal=False, window_hint=None, close_callback=self.hide_all)
     title_label = Label(_("Title:"))
     self.title_entry = TextEntry("")
     self.title_entry.set_size(300, 25)
     self.search_button = Button(_("Search"))
     self.search_button.connect("clicked", self.search_song)
     
     control_box = gtk.HBox(spacing=5)
     control_box.pack_start(title_label, False, False)
     control_box.pack_start(self.title_entry, False, False)
     control_box.pack_start(self.search_button, False, False)
     
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     self.result_view = ListView()
     self.result_view.connect("double-click-item", self.double_click_cb)
     self.result_view.draw_mask = self.get_mask_func(self.result_view)
     self.result_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Type"), _("Size")])
     scrolled_window.add_child(self.result_view)
     
     self.prompt_label = Label("")
     download_button = Button(_("Download"))
     download_button.connect("clicked", self.download_song)
     cancel_button = Button(_("Close"))
     cancel_button.connect("clicked", lambda w: self.hide_all())
     
     self.body_box.set_spacing(5)
     self.body_box.pack_start(control_box, False, False)
     self.body_box.pack_start(scrolled_window, True, True)
     self.left_button_box.set_buttons([self.prompt_label])
     self.right_button_box.set_buttons([download_button, cancel_button])
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:35,代码来源:song_search.py

示例4: __init__

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
 def __init__(self):
     DialogBox.__init__(
         self, _("Lyrics search"), 460, 300, DIALOG_MASK_MULTIPLE_PAGE, close_callback=self.hide_all, 
         modal=False, window_hint=None, skip_taskbar_hint=False)
     self.artist_entry = InputEntry()
     self.artist_entry.set_size(130, 23)
     self.title_entry = InputEntry()
     self.title_entry.set_size(130, 23)
     artist_label = Label(_("Artist:"))
     title_label = Label(_("Title:"))
     right_align = gtk.Alignment()
     right_align.set(0, 0, 0, 1)
     
     search_button = Button(_("Search"))
     search_button.connect("clicked", self.search_lyric_cb)
     
     info_box = gtk.HBox(spacing=25)
     
     control_box = gtk.HBox(spacing=5)
     title_box = gtk.HBox(spacing=5)        
     title_box.pack_start(title_label, False, False)
     title_box.pack_start(self.title_entry)
     artist_box = gtk.HBox(spacing=5)
     artist_box.pack_start(artist_label, False, False)
     artist_box.pack_start(self.artist_entry)
     control_box.pack_start(title_box, False, False)
     control_box.pack_start(artist_box, False, False)
     
     info_box.pack_start(control_box, False, False)
     info_box.pack_start(search_button, False, False)
     
     scrolled_window = ScrolledWindow(0, 0)
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     sort_items = [(lambda item: item.title, cmp), (lambda item: item.artist, cmp)]
     self.result_view = ListView(sort_items)
     self.result_view.connect("double-click-item", self.double_click_cb)
     self.result_view.add_titles([_("Title"), _("Artist")])
     self.result_view.draw_mask = self.get_mask_func(self.result_view)
     scrolled_window.add_child(self.result_view)
     
     self.prompt_label = Label("")
     download_button = Button(_("Download"))
     download_button.connect("clicked", self.download_lyric_cb)
     cancel_button = Button(_("Close"))
     cancel_button.connect("clicked", lambda w: self.hide_all())
     
     info_box_align = gtk.Alignment()
     info_box_align.set_padding(5, 0, 5, 0)
     info_box_align.add(info_box)
     
     self.body_box.set_spacing(5)
     self.body_box.pack_start(info_box_align, False, False)
     self.body_box.pack_start(scrolled_window, True, True)
     self.left_button_box.set_buttons([self.prompt_label])
     self.right_button_box.set_buttons([download_button, cancel_button])
     self.lrc_manager = LrcManager()
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:58,代码来源:lyrics_search.py

示例5: get_icon_view

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
 def get_icon_view(self, padding_x=0, padding_y=10):    
     ''' Draggable IconView '''
     icon_view = IconView(padding_x, padding_y)
     targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2)]
     icon_view.drag_source_set(gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY)
     icon_view.connect("drag-data-get", self.__on_drag_data_get) 
     icon_view.connect("double-click-item", self.__on_double_click_item)
     icon_view.connect("single-click-item", self.__on_single_click_item)
     icon_view.connect("right-click-item", self.__on_right_click_item)
     
     icon_view.draw_mask  = self.on_iconview_draw_mask
     scrolled_window = ScrolledWindow()
     scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     scrolled_window.add_child(icon_view)
     return icon_view, scrolled_window
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:17,代码来源:local_browser.py

示例6: ConvTAskGui

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class ConvTAskGui(DialogBox):
    def __init__(self):
        DialogBox.__init__(self, 
                           _("Task Manager for format conversion"), 
                           FORM_WIDTH, FORM_HEIGHT, 
                           mask_type=DIALOG_MASK_SINGLE_PAGE, #DIALOG_MASK_MULTIPLE_PAGE,
                           close_callback=self.hide_all,
                           modal=True,
                           window_hint=gtk.gdk.WINDOW_TYPE_HINT_DIALOG,
                           window_pos=gtk.WIN_POS_CENTER,
                           resizable=False,
                           )
        self.init_widgets()
        # add widgets.
        self.body_box.pack_start(self.scrolled_window, False, False)
        
        
    def init_widgets(self):
        
        self.scrolled_window = ScrolledWindow()
        self.list_view = ListView()                
        self.list_view.draw_mask = self.get_mask_func(self.list_view)
        self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.scrolled_window.add_child(self.list_view)
        
        # self.start_btn = Button(_("Start"))
        self.show_time_label = Label("")
        self.pause_btn = Button(_("Pause"))
        self.close_btn = Button(_("Close"))
        
        self.show_time_label_align = gtk.Alignment()
        self.show_time_label_align.set(0.0, 0.5, 1.0, 1.0)
        self.show_time_label_align.add(self.show_time_label)
                        
        self.left_button_box.set_buttons([self.show_time_label_align])
        self.right_button_box.set_buttons([self.pause_btn, self.close_btn])        
                
        self.close_btn.connect("clicked", lambda w : self.hide_all())
开发者ID:Bruners,项目名称:deepin-media-player,代码行数:40,代码来源:conv_task_gui.py

示例7: __init_ui

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
    def __init_ui(self):
        self.vbox = gtk.VBox(False, BETWEEN_SPACING)
        self.__init_sections( -1)
        self.vbox.set_size_request(WINDOW_WIDTH - 2 * TEXT_WINDOW_LEFT_PADDING, -1)
        
        scroll_win = ScrolledWindow(right_space=0, top_bottom_space=0)
        #scroll_win.connect("event", self.test)
        scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        # FIXME UI a align to adjust ui
        ui_align = gtk.Alignment(0, 0, 0, 0)
        ui_align.set_padding(TEXT_WINDOW_TOP_PADDING,
                                    TEXT_WINDOW_TOP_PADDING,
                                    TEXT_WINDOW_LEFT_PADDING,
                                    TEXT_WINDOW_LEFT_PADDING)

        ui_align.add(self.vbox)
        scroll_win.add_with_viewport(ui_align)

        self.eventbox = gtk.EventBox()
        self.eventbox.set_above_child(False)
        self.eventbox.add(scroll_win)
        self.vbox.connect("expose-event", self.expose_callback)
        ui_align.connect("expose-event", self.expose_callback)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:26,代码来源:main_ui.py

示例8: PlaylistItem

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class PlaylistItem(gobject.GObject):
    
    def __init__(self, playlist):
        '''Init song item.'''
        self.item_id = None
        self.main_box = gtk.VBox()
        self.update(playlist)        
        self.create_jobs_box()


    def draw_mask(self, widget, event):            
        cr = widget.window.cairo_create()
        rect = widget.allocation
        draw_alpha_mask(cr, rect.x, rect.y, rect.width, rect.height, "layoutMiddle")
        
    def create_jobs_box(self):    
        
        self.file_job_button = self.create_job_button("plus", _("Add Music"), self.song_view.recursion_add_dir)
        # self.file_job_button.connect("clicked", self.open_file_or_dir)

        self.job_box = gtk.EventBox()
        self.job_box.set_size_request(220, -1)
        targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
        self.job_box.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
                           targets, gtk.gdk.ACTION_COPY)
        self.job_box.set_visible_window(False)
        self.job_box.connect("drag-data-received", self.song_view.on_drag_data_received)
        
        # Content box. 
        
        content_box = gtk.VBox()
        content_box.pack_start(create_bottom_align(), True, True)
        # content_box.pack_start(ImageBox(app_theme.get_pixbuf("jobs/scan_tip.png")), False, False)
        content_box.pack_start(self.file_job_button, False, False)
        content_box.pack_start(create_upper_align(), True, True)
        
        # Rind box.
        rind_box = gtk.HBox()
        rind_box.pack_start(create_right_align(), True, True)
        rind_box.pack_start(content_box, False, False)
        rind_box.pack_start(create_left_align(), True, True)
        
        self.job_box.add(rind_box)
        self.jobs_align = gtk.Alignment()
        self.jobs_align.set(0.5, 0.5, 1, 1)
        self.jobs_align.add(self.job_box)
        self.jobs_align.connect("expose-event", self.draw_mask)
        
    def create_job_button(self, icon_name, content, callback=None):    
        button = ComplexButton(
            [app_theme.get_pixbuf("jobs/complex_normal.png"),
             app_theme.get_pixbuf("jobs/complex_hover.png"),
             app_theme.get_pixbuf("jobs/complex_press.png")],
            app_theme.get_pixbuf("jobs/%s.png" % icon_name),
            content
            )
        if callback:
            button.connect("clicked", lambda w : callback())
        return button    
        
    def set_title(self, value):    
        self.title = value
        
    def get_title(self):    
        return self.title
    
    def get_left_image(self):
        return None
    
    def get_has_arrow(self):
        return None
    
    def set_item_id(self, index):
        self.item_id = index
        
    def get_item_id(self):    
        return self.item_id
        
    def update(self, playlist):
        '''update'''
        self.playlist = playlist
        songs = self.playlist.get_songs()
        self.song_view = SongView()
        self.song_view.add_songs(songs)
        self.song_view.connect("begin-add-items", lambda w: self.switch_it())
        self.song_view.connect("empty-items", lambda w: self.switch_it(False))
        self.scrolled_window = ScrolledWindow(0, 0)
        self.scrolled_window.add_child(self.song_view)
        self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.scrolled_window.set_size_request(220, -1)
        self.title = playlist.get_name()
        
    def get_list_widget(self):
        if self.get_songs():
            switch_box(self.main_box, self.scrolled_window)
        else:    
            switch_box(self.main_box, self.jobs_align)
        return self.main_box    
    
    def switch_it(self, scrolled_window=True):
#.........这里部分代码省略.........
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:103,代码来源:list_item.py

示例9: SettingUI

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [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

示例10: DisplayView

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class DisplayView(gtk.VBox):
    '''
    class docs
    '''
	
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.brightness_id = None

        self.display_manager = DisplayManager()
        self.__xrandr_settings = self.display_manager.get_xrandr_settings()
        self.__xrandr_settings.connect("changed", self.__xrandr_changed)

        self.resize_width = 790
        self.resize_height = 200
        self.monitor_items = []
        self.__output_names = []
        self.__current_output_name = self.display_manager.get_primary_output_name()
        self.__setup_monitor_items()
        self.sizes_items = []
        self.monitor_combo = None
        if len(self.monitor_items) > 1 and self.display_manager.is_copy_monitors():
            self.__set_same_sizes()
        else:
            self.__setup_sizes_items()
        self.multi_monitors_items = [(_("Copy Display"), 1), 
                                     (_("Extend Display"), 2), 
                                     (_("Only shown in display 1"), 3), 
                                     (_("Only shown in display 2"), 4)]
        self.rotation_items = [(_("Normal"), 1), 
                               (_("Right"), 2), 
                               (_("Left"), 3), 
                               (_("Inverted"), 4)]
        self.duration_items = [("1 %s" % _("Minute"), 1), 
                               ("2 %s" % _("Minutes"), 2), 
                               ("3 %s" % _("Minutes"), 3), 
                               ("5 %s" % _("Minutes"), 5), 
                               ("10 %s" % _("Minutes"), 10), 
                               ("30 %s" % _("Minutes"), 30), 
                               ("1 %s" % _("Hour"), 60), 
                               (_("Never"), DisplayManager.BIG_NUM / 60)]
        '''
        scrolled_window
        '''
        self.scrolled_window = ScrolledWindow()
        self.scrolled_window.set_size_request(-1, 425)
        self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.main_box = gtk.VBox()
        self.main_box.set_size_request(600, -1)
        self.body_box = gtk.HBox()
        '''
        left, right align
        '''
        self.left_align = self.__setup_align(padding_top = FRAME_TOP_PADDING, 
                                             padding_left = TEXT_WINDOW_LEFT_PADDING)
        self.right_align = self.__setup_align(padding_top = FRAME_TOP_PADDING, 
                                              padding_left = 0)
        '''
        left, right box
        '''
        self.left_box = gtk.VBox(spacing = WIDGET_SPACING)
        self.right_box = gtk.VBox(spacing = WIDGET_SPACING)
        '''
        monitor operation && detect
        '''
        self.monitor_resize_align = self.__setup_align(padding_top = 11, 
                                                       padding_left = int(TEXT_WINDOW_LEFT_PADDING / 2))
        self.monitor_resize_box = MonitorResizableBox(self.display_manager)
        self.monitor_resize_box.select_output(self.__current_output_name)
        self.monitor_resize_box.connect("select-output", self.__select_output)
        self.monitor_resize_box.connect("resize", self.__resize_box)
        self.monitor_resize_align.add(self.monitor_resize_box)
        '''
        monitor display
        '''
        self.monitor_display_align = self.__setup_title_align(
            app_theme.get_pixbuf("display/monitor_display.png"), 
            _("Display"), 
            0)
        '''
        monitor
        '''
        self.monitor_align = self.__setup_align()
        self.monitor_box = gtk.HBox(spacing = WIDGET_SPACING)
        self.monitor_label = self.__setup_label(_("Monitor"))
        self.monitor_combo = self.__setup_combo(self.monitor_items)
        self.monitor_combo.set_select_index(self.display_manager.get_primary_output_name_index(self.monitor_items))
        self.monitor_combo.connect("item-selected", self.__combo_item_selected, "monitor_combo")
        self.__widget_pack_start(self.monitor_box, 
            [self.monitor_label, 
             self.monitor_combo])
        self.monitor_align.add(self.monitor_box)
        '''
        goto individuation or power setting
        '''
        self.goto_align = self.__setup_align()
#.........这里部分代码省略.........
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:103,代码来源:display_view.py

示例11: PlayListView

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class PlayListView(object):
    def __init__(self):
        self.one_close = app_theme.get_pixbuf("treeview/1-close.png")
        self.one_open  = app_theme.get_pixbuf("treeview/1-open.png")
        self.two_close = app_theme.get_pixbuf("treeview/2-close.png")
        self.two_open  = app_theme.get_pixbuf("treeview/2-open.png")
        self.three_close = app_theme.get_pixbuf("treeview/3-close.png")
        self.three_open  = app_theme.get_pixbuf("treeview/3-open.png")
        #
        self.tree_view_open  = app_theme.get_pixbuf("treeview/open.png")
        self.tree_view_close = app_theme.get_pixbuf("treeview/close.png")
        self.tree_view_right = app_theme.get_pixbuf("treeview/right.png")
        self.tree_view_bottom = app_theme.get_pixbuf("treeview/bottom.png")
        #
        self.listview_color = ui_theme.get_color("scrolledbar")
        self.play_list_vbox = gtk.VBox()
        #
        self.list_view_vbox = gtk.VBox()
        self.list_scroll_win   = ScrolledWindow(0, 0)
        self.list_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.list_view    = ListView()
        #
        self.play_list_con = PlayListControl()
        #
        self.list_view_vbox.pack_start(self.list_scroll_win, True, True)
        self.list_view_vbox.pack_start(self.play_list_con, False, False)
        # 网络列表,搜索框.
        self.tree_scroll_win   = ScrolledWindow(0, 0)
        self.tree_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
        self.tree_view_vbox = gtk.VBox()
        self.tree_view     = TreeViewBase()
        self.search_ali    = gtk.Alignment(0, 0, 1, 1)
        self.search        = Search()
        self.search_ali.add(self.search)
        #
        self.search_ali.set_padding(7, 5, 12, 12)
        self.tree_view_vbox.pack_start(self.search_ali, False, False)
        self.tree_view_vbox.pack_start(self.tree_scroll_win, True, True)
        self.search_ali.connect("expose-event", self.search_ali_expose_event)
        #
        self.note_book = NoteBook()
        #
        self.list_view.on_draw_sub_item =  self.__listview_on_draw_sub_item
        self.list_view.columns.add_range(["filename", "time"])
        self.list_view.columns[0].width = 120
        self.list_view.columns[1].width = 95
        #
        self.note_book.hide_title()
        self.tree_view.paint_nodes_event = self.__treeview_paint_nodes_event
        #
        self.list_scroll_win.add_with_viewport(self.list_view)
        self.tree_scroll_win.add_with_viewport(self.tree_view)
        #self.note_book.add_layout1(self.list_scroll_win) 
        self.note_book.add_layout1(self.list_view_vbox) 
        self.note_book.add_layout2(self.tree_view_vbox)
        #self.play_list_vbox.pack_start(self.scroll_win, True, True)
        self.play_list_vbox.pack_start(self.note_book, True, True)

    def __listview_on_draw_sub_item(self, e):
        color = self.listview_color.get_color()
        if e.double_items == e.item:
            e.text_color = "#000000"
            text_size=9
            color_info = [(0, (color, 0.8)), (1, (color, 0.8))] 
            draw_vlinear(e.cr,
                         e.x, e.y, e.w, e.h,
                         color_info
                         )
        elif e.item in e.single_items:
            e.text_color = "#FFFFFF"
            text_size=9
            color_info = [(0, (color, 0.5)), (1, (color, 0.5))] 
            draw_vlinear(e.cr,
                         e.x, e.y, e.w, e.h,
                         color_info
                         )
        elif e.motion_items == e.item:
            e.text_color  = "#FFFFFF"
            text_size=9
            color_info = [(0, (color, 0.2)), (1, (color, 0.2))] 
            draw_vlinear(e.cr,
                         e.x, e.y, e.w, e.h,
                         color_info
                         )
        else:
            e.text_color = "#FFFFFF"
            text_size=9
        #
        text = e.text.decode("utf-8")
        one_width = self.list_view.columns[0].width
        two_width = self.list_view.columns[1].width
        #if e.w == one_width: # 显示播放名字的第一列.
        if e.column_index == 0:
            #
            t_width = 0
            t_index = 0
            add_point = False
            for t in text:
                t_width += get_text_size(t, text_size=text_size)[0]
                if t_width > one_width - 20:
#.........这里部分代码省略.........
开发者ID:Bruners,项目名称:deepin-media-player,代码行数:103,代码来源:playlistview.py

示例12: Browser

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class Browser(gtk.VBox, SignalContainer):
    
    def __init__(self, db_query):
        
        gtk.VBox.__init__(self)
        SignalContainer.__init__(self)
        
        self.__db_query = db_query
        self._tree = {}
        self.__selected_tag = {"album": [], "artist": [], "genre": []}
        self.view_mode = ICON_VIEW_MODE
        self.__search_flag = False
        self.__song_cache_items = []
        self.__cover_cache_items = []
        
        # init widget.
        self.entry_box = SearchEntry("")
        self.entry_box.set_size(155, 22)
        self.entry_box.entry.connect("changed", self.__search_cb)
        
        # upper box.
        self.back_button = self.__create_simple_button("back", self.__switch_to_filter_view)
        self.back_button.set_no_show_all(True)
        back_align = gtk.Alignment()
        back_align.set(0.5, 0.5, 0, 0)
        back_align.set_padding(0, 0, 0, 10)
        back_align.add(self.back_button)
        
        # path control
        self.path_combo_box = ComboMenuButton()
        self.path_combo_box.connect("list-actived", lambda w: self.update_path_list_view())
        self.path_combo_box.connect("combo-actived", lambda w, k : self.update_path_filter_view(k))
        path_combo_align = gtk.Alignment()
        path_combo_align.set_padding(0, 0, 10, 0)
        path_combo_align.add(self.path_combo_box)
        self.path_combo_box.set_no_show_all(True)
        
        upper_box = gtk.HBox(spacing=5)
        upper_box.pack_start(path_combo_align, False, False)
        upper_box.pack_start(create_right_align(), True, True)
        upper_box.pack_start(back_align, False, False)
        entry_box_align = gtk.Alignment()
        entry_box_align.set(0.5, 0.5, 0, 0)
        entry_box_align.set_padding(1, 0, 0, 0)
        entry_box_align.add(self.entry_box)
        upper_box.pack_start(entry_box_align, False, False)
        
        upper_box_align = gtk.Alignment()
        upper_box_align.set_padding(0, 10, 0, 10)
        upper_box_align.set(0.5, 0.5, 1, 1)
        upper_box_align.connect("expose-event", self.expose_upper_box_mask)
        upper_box_align.add(upper_box)
        
        self.categorybar_status = "artist"
        self.filter_categorybar = OptionBar(
            [(app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"),
              _("By artist"), lambda : self.reload_filter_view("artist", True)),
             (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"),
              _("By album"), lambda : self.reload_filter_view("album", True)),
             (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"),
              _("By genre"), lambda : self.reload_filter_view("genre", True)),]
                                            )
        
        # Song path bar.
        self.__current_path = None
        self.current_icon_item = None
        self.reload_path_flag = True
        self.path_categorybar = SongPathBar(_("Local"))
        self.path_categorybar.set_size_request(-1, 205)
        
        # Song import bar.
        self.import_categorybar = SongImportBar()
        self.import_categorybar.reload_items(
            [
             (_("Scan Home dir"), lambda : ImportFolderJob([os.path.expanduser("~")])),                
             (_("Select dir to scan"), lambda : ImportFolderJob()),
             (_("Refresh library"), lambda : ReloadDBJob())]
            )
        
        # iconview.
        self.filter_view = IconView(10, 10)
        targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2)]
        self.filter_view.drag_source_set(gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY)
        self.filter_view.connect("drag-data-get", self.__on_drag_data_get) 
        self.filter_view.connect("double-click-item", self.__on_double_click_item)
        self.filter_view.connect("single-click-item", self.__on_single_click_item)
        self.filter_view.draw_mask  = self.draw_filter_view_mask
        self.filter_scrolled_window = ScrolledWindow()
        self.filter_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.filter_scrolled_window.add_child(self.filter_view)
        
        # songs_view
        self.songs_view = MultiDragSongView()
        self.songs_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Added time")])
        self.songs_scrolled_window = ScrolledWindow(0, 0)
        self.songs_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        self.songs_scrolled_window.add_child(self.songs_view)
        
        # left_vbox
        align = gtk.Alignment()
#.........这里部分代码省略.........
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:103,代码来源:browser.py

示例13: get_scrolled_window

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

示例14: __init__

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
    def __init__(self):
        super(PreferenceDialog, self).__init__(_("Preference"), 575, 495, 
                                               mask_type=DIALOG_MASK_MULTIPLE_PAGE,
                                               close_callback=self.hide_all)
        
        self.set_position(gtk.WIN_POS_CENTER)
        
        self.main_box = gtk.VBox()
        close_button = Button(_("Close"))
        close_button.connect("clicked", lambda w: self.hide_all())
        
        # Init widget.
        self.general_setting = GeneralSetting()
        self.hotkey_setting = HotKeySetting()
        self.desktop_lyrics_setting = DesktopLyricsSetting()
        self.scroll_lyrics_setting = ScrollLyricsSetting()
        
        # Category bar
        self.category_bar = TreeView(font_x_padding=20)
        self.category_bar.draw_mask = self.draw_treeview_mask
        self.general_category_item = CategoryItem(_("General"), self.general_setting)
        self.category_bar.add_item(None, self.general_category_item)
        self.category_bar.add_item(None, CategoryItem(_("Hotkeys"), self.hotkey_setting))
        lyrics_node = self.category_bar.add_item(None, CategoryItem(_("Lyrics")))
        self.category_bar.add_item(lyrics_node, CategoryItem(_("Desktop"), self.desktop_lyrics_setting))
        self.category_bar.add_item(lyrics_node, CategoryItem(_("Window"), self.scroll_lyrics_setting))
        self.category_bar.add_item(None, CategoryItem(_("About us"), AboutBox()))
        self.category_bar.connect("single-click-item", self.category_single_click_cb)
        self.category_bar.set_highlight_index(0)
        
        category_box = gtk.VBox()
        background_box = BackgroundBox()
        background_box.set_size_request(132, 11)
        background_box.draw_mask = self.draw_treeview_mask
        category_box.pack_start(background_box, False, False)
        
        category_scrolled_window = ScrolledWindow()
        category_scrolled_window.add_child(self.category_bar)
        category_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
        category_scrolled_window.set_size_request(132, 516)
        
        category_scrolled_window_align = gtk.Alignment()
        category_scrolled_window_align.set(0, 0, 1, 1,)
        category_scrolled_window_align.set_padding(0, 1, 0, 0)
        category_scrolled_window_align.add(category_scrolled_window)
        
        category_box.pack_start(category_scrolled_window_align, True, True)
        
        # Pack widget.
        left_box = gtk.VBox()
        self.right_box = gtk.VBox()
        left_box.add(category_box)
        self.right_box.add(self.general_category_item.get_allocated_widget())
        right_align = gtk.Alignment()
        right_align.set_padding(0, 0, 10, 0)
        right_align.add(self.right_box)

        body_box = gtk.HBox()
        body_box.pack_start(left_box, False, False)
        body_box.pack_start(right_align, False, False)
        self.main_box.add(body_box)
        
        # DialogBox code.
        self.body_box.pack_start(self.main_box, True, True)
        self.right_button_box.set_buttons([close_button])        
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:67,代码来源:preference.py

示例15: ThemePage

# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import set_policy [as 别名]
class ThemePage(gtk.VBox):
    '''
    class docs
    '''
	
    def __init__(self):
        '''
        init docs
        '''
        gtk.VBox.__init__(self)

        self.status_box = StatusBox()

        self.scroll = ScrolledWindow()
        self.scroll.set_size_request(800, 432)
        self.scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        self.label_padding_x = 10
        self.label_padding_y = 10
        
        self.theme_box = gtk.VBox()
        self.user_theme_label = Label(_("My Themes"), text_size=TITLE_FONT_SIZE, 
                                      text_color=app_theme.get_color("globalTitleForeground"))
        self.user_theme_view = UserThemeView(status_box = self.status_box)
        self.user_theme_scrolledwindow = self.user_theme_view.get_scrolled_window()
        
        self.system_theme_label = Label(_("System Themes"), text_size=TITLE_FONT_SIZE, 
                                      text_color=app_theme.get_color("globalTitleForeground"))
        self.system_theme_view = SystemThemeView(status_box = self.status_box)
        self.system_theme_scrolledwindow = self.system_theme_view.get_scrolled_window()
        
        self.theme_box.pack_start(self.user_theme_label, False, False)
        self.theme_box.pack_start(get_separator(), False, False)
        self.theme_box.pack_start(self.user_theme_scrolledwindow, False, False)
        
        self.theme_box.pack_start(self.system_theme_label, False, False)
        self.theme_box.pack_start(get_separator(), False, False)
        self.theme_box.pack_start(self.system_theme_scrolledwindow, True, True)
        
        main_align = gtk.Alignment()
        main_align.set_padding(15, 0, 20, 20)
        main_align.set(1, 1, 1, 1)
        main_align.add(self.theme_box)
        
        self.scroll.add_child(main_align)
        
        main_align.connect("expose-event", self.expose_label_align)

        self.pack_start(self.scroll, False, False)
        self.pack_start(self.status_box)
        
    def expose_label_align(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        
        self.draw_mask(cr, rect.x, rect.y, rect.width, rect.height)
                
    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.
        '''
        cr.set_source_rgb(1, 1, 1)
        cr.rectangle(x, y, w, h)
        cr.fill()
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:72,代码来源:theme_page.py


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