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


Python label.Label类代码示例

本文整理汇总了Python中dtk.ui.label.Label的典型用法代码示例。如果您正苦于以下问题:Python Label类的具体用法?Python Label怎么用?Python Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: create_lyrics_dir_table

 def create_lyrics_dir_table(self):    
     main_table = gtk.Table(3, 2)
     main_table.set_row_spacings(CONTENT_ROW_SPACING)
     
     dir_title_label = Label(_("Lyrics directory"))
     dir_title_label.set_size_request(200, 12)
     label_align = gtk.Alignment()
     label_align.set_padding(0, 0, 0, 0)
     label_align.add(dir_title_label)
     
     self.dir_entry = InputEntry()
     self.dir_entry.set_text(os.path.expanduser(config.get("lyrics", "save_lrc_path", "~/.lyrics")))
     self.dir_entry.set_editable(False)        
     self.dir_entry.set_size(250, 25)
     
     modify_button = Button(_("Change"))
     modify_button.connect("clicked", self.change_lyrics_save_dir)
     hbox = gtk.HBox(spacing=5)
     hbox.pack_start(self.dir_entry, False, False)
     hbox.pack_start(modify_button, False, False)
     
     main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(hbox, 0, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
     return main_table
开发者ID:electricface,项目名称:deepin-music-player,代码行数:25,代码来源:preference.py

示例2: StatusBox

class StatusBox(gtk.HBox):
    def __init__(self, width=800):
        gtk.HBox.__init__(self)

        self.width = width

        self.status_label = Label(
            text="", text_size=CONTENT_FONT_SIZE, text_x_align=ALIGN_MIDDLE, label_width=600, enable_select=False
        )

        self.set_size_request(self.width, -1)
        self.pack_start(self.status_label, False, False)

        self.connect("expose-event", self.__expose)

    def hide_status(self):
        self.status_label.set_text("")

    def set_status(self, text):
        self.status_label.set_text(text)
        gobject.timeout_add(3000, self.hide_status)

    def __expose(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation

        cr.set_source_rgb(*color_hex_to_cairo(TREEVIEW_BORDER_COLOR))
        draw_line(cr, rect.x, rect.y + 1, rect.x + self.width, rect.y + 1)
开发者ID:martyr-deepin,项目名称:deepin-system-settings,代码行数:28,代码来源:status_box.py

示例3: MessageBar

class MessageBar(CycleStrip):
    '''
    class docs
    '''
	
    def __init__(self, padding_left=0,):
        '''
        init docs
        '''
        # Init.
        CycleStrip.__init__(self, app_theme.get_pixbuf("strip/background.png"))
        
        self.label = Label()
        self.label_align = gtk.Alignment()
        self.label_align.set(0.0, 0.5, 0, 0)
        self.label_align.set_padding(0, 0, padding_left, 0)
        self.label_align.add(self.label)

        self.search_button = ImageButton(
            app_theme.get_pixbuf("entry/search_normal.png"),
            app_theme.get_pixbuf("entry/search_hover.png"),
            app_theme.get_pixbuf("entry/search_press.png"),
            )
        self.search_entry = InputEntry(action_button=self.search_button)
        self.search_entry.set_size(220, 24)
        entry_align = gtk.Alignment(0.5, 0.5, 0, 0)
        entry_align.set_padding(0, 0, 5, 5)
        entry_align.add(self.search_entry)

        self.pack_start(self.label_align, True, True)
        self.pack_start(entry_align, False, False)
        
    def set_message(self, message):
        self.label.set_text(message)
开发者ID:PeterDaveHello,项目名称:deepin-software-center,代码行数:34,代码来源:uninstall_page.py

示例4: __init__

    def __init__(self, default_width=300, default_height=160, cancel_cb=None):
        DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE)

        self.cancel_cb = cancel_cb

        self.message_align = gtk.Alignment()
        self.message_align.set(0, 0, 0, 0)
        self.message_align.set_padding(0, 0, 10, 0)
        self.message_label = Label("", label_width=300)
        self.message_align.add(self.message_label)
        self.progress_align = gtk.Alignment()
        self.progress_align.set(0, 0, 0, 0)
        self.progress_align.set_padding(20, 0, 10, 10)
        self.progress_bar = ProgressBar()
        self.progress_bar.set_size_request(default_width, -1)
        self.progress_align.add(self.progress_bar)
        self.percentage_align = gtk.Alignment()
        self.percentage_align.set(0, 0, 0, 0)
        self.percentage_align.set_padding(10, 0, 140, 0)
        self.percentage_label = Label("0%", label_width=300)
        self.percentage_label.set_size_request(default_width, -1)
        self.percentage_align.add(self.percentage_label)
        self.cancel_align = gtk.Alignment()
        self.cancel_align.set(0, 0, 0, 0)
        self.cancel_align.set_padding(20, 0, 200, 0)
        self.cancel_button = Button(_("Cancel"))
        self.cancel_button.set_size_request(70, WIDGET_HEIGHT)
        self.cancel_button.connect("clicked", self.__on_cancel_button_clicked)
        self.cancel_align.add(self.cancel_button)

        self.body_box.pack_start(self.message_align, False, False)
        self.body_box.pack_start(self.progress_align, False, False)
        self.body_box.pack_start(self.percentage_align, False, False)
        self.body_box.pack_start(self.cancel_align)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:34,代码来源:bluetooth_dialog.py

示例5: create_source_update_frequency_table

    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)

        dir_title_label = Label(_("Refresh package lists"))

        # auto update check button
        self.is_auto_update_button = CheckButton(label_text=_('Upgrade automatically'))
        self.is_auto_update_button.connect('released', self.change_auto_update)
        self.is_auto_update_button.set_active(utils.is_auto_update())

        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(dir_title_label, 0, 2, 0, 1, yoptions=gtk.FILL)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)
        return main_table
开发者ID:kissthink,项目名称:deepin-store,代码行数:26,代码来源:preference.py

示例6: StatusBar

class StatusBar(gtk.HBox):
    '''docstring for StatusBar'''
    def __init__(self):
        super(StatusBar, self).__init__(False)
        self.__count = 0
        self.__timeout_id = None
        self.text_label = Label("", text_x_align=ALIGN_MIDDLE,
                                label_width=500,
                                enable_select=False,
                                enable_double_click=False)
        text_align = gtk.Alignment()
        text_align.set(0.0, 0.5, 0.0, 0.0)
        text_align.add(self.text_label)

        self.button_hbox = gtk.HBox(False)
        self.button_hbox.set_spacing(WIDGET_SPACING)
        button_align = gtk.Alignment()
        button_align.set(1.0, 0.5, 0.0, 0.0)
        button_align.set_padding(0, 0, 0, 10)
        button_align.add(self.button_hbox)

        self.pack_start(text_align)
        self.pack_start(button_align)

        self.set_size_request(WINDOW_WIDTH, STATUS_HEIGHT)
        self.connect("expose-event", self.draw_background)

    def draw_background(self, widget, event):
        cr = widget.window.cairo_create()
        x, y, w, h = widget.allocation
        cr.set_source_rgb(*color_hex_to_cairo(MODULE_BG_COLOR))
        cr.rectangle(x, y+1, w, h-1)
        cr.fill()

        cr.set_source_rgb(*color_hex_to_cairo(TREEVIEW_BORDER_COLOR))
        draw_line(cr, x, y + 1, x + w, y + 1)

    def set_text(self, text):
        self.__count += 1
        if self.__timeout_id:
            gtk.timeout_remove(self.__timeout_id)
        self.text_label.set_text(text)
        self.__timeout_id = gobject.timeout_add(3000, self.hide_text)

    def hide_text(self):
        self.__count -= 1
        self.__timeout_id = None
        self.text_label.set_text("")

    def set_buttons(self, buttons):
        self.clear_button()
        for bt in buttons:
            self.button_hbox.pack_start(bt, False, False)
        self.show_all()

    def get_buttons(self):
        return self.button_hbox.get_children()

    def clear_button(self):
        self.button_hbox.foreach(self.button_hbox.remove)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:60,代码来源:statusbar.py

示例7: __init__

    def __init__(self, detail_page, pkg_name, alias_name, star):
        '''
        init docs
        '''
        gtk.HBox.__init__(self)
        self.star = star
        self.pkg_name = pkg_name

        v_box = gtk.VBox()
        pkg_icon_image = gtk.image_new_from_pixbuf(
            gtk.gdk.pixbuf_new_from_file_at_size(get_icon_pixbuf_path(pkg_name), 32, 32))
        pkg_alias_label = Label(alias_name,
                                hover_color=app_theme.get_color("homepage_hover"))
        pkg_alias_label.set_clickable()
        pkg_alias_label.connect("button-press-event", lambda w, e: detail_page.update_pkg_info(pkg_name))

        self.pkg_star_box = gtk.HBox()

        self.pkg_star_view = StarView()
        self.pkg_star_view.star_buffer.star_level = int(star)
        self.pkg_star_view.connect("clicked", lambda w: self.grade_pkg())

        self.pkg_star_mark = StarMark(self.star, self.MARK_SIZE, self.MARK_PADDING_X, self.MARK_PADDING_Y)

        self.pack_start(pkg_icon_image, False, False)
        self.pack_start(v_box, True, True, 8)
        v_box.pack_start(pkg_alias_label, False, False, 2)
        v_box.pack_start(self.pkg_star_box, False, False, 2)
        self.pkg_star_box.pack_start(self.pkg_star_view, False, False)
        self.pkg_star_box.pack_start(self.pkg_star_mark, False, False)
开发者ID:kissthink,项目名称:deepin-store,代码行数:30,代码来源:detail_page.py

示例8: create_source_update_frequency_table

    def create_source_update_frequency_table(self):
        main_table = gtk.Table(3, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)
        
        dir_title_label = Label(_("Update applications lists"))
        dir_title_label.set_size_request(200, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(0, 0, 0, 0)
        label_align.add(dir_title_label)

        self.is_auto_update_button = CheckButton(label_text=_('Update automatically'))
        self.is_auto_update_button.connect('toggled', self.change_auto_update)
        
        self.update_label = Label(_("Time interval: "))
        self.update_spin = SpinBox(int(get_update_interval()), 0, 168, 1)
        self.update_spin.connect("value-changed", lambda w, v: set_update_interval(v))
        self.hour_lablel = Label(_(" hour"))
        self.hour_lablel.set_size_request(50, 12)
        spin_hbox = gtk.HBox(spacing=3)
        spin_hbox.pack_start(self.update_label, False, False)
        spin_hbox.pack_start(self.update_spin, False, False)
        spin_hbox.pack_start(self.hour_lablel, False, False)

        main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        main_table.attach(self.is_auto_update_button, 0, 1, 2, 3, xpadding=10, xoptions=gtk.FILL)
        main_table.attach(spin_hbox, 1, 2, 2, 3, xpadding=10, xoptions=gtk.FILL)

        if is_auto_update():
            self.is_auto_update_button.set_active(True)
        else:
            self.is_auto_update_button.toggled()

        return main_table
开发者ID:menghun3,项目名称:deepin-software-center-1,代码行数:34,代码来源:preference.py

示例9: create_combo_label

 def create_combo_label(self, title, content=""):   
     hbox = gtk.HBox(spacing=5)
     title_label  = Label(title)
     content_label = Label(content)
     content_label.set_size_request(200, -1)
     hbox.pack_start(title_label, False, False)
     hbox.pack_start(content_label, False, False)
     return hbox, content_label
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:8,代码来源:song_editor.py

示例10: BottomTipBar

class BottomTipBar(gtk.HBox):
    def __init__(self):
        gtk.HBox.__init__(self)
        
        self.info_image_box = gtk.VBox()
        self.info_image_box.set_size_request(24, 24)
        self.info_image_box.connect('expose-event', self.expose_info_image_box)

        self.info_label = Label("")
        self.end_info_label = Label("")
        self.info_callback_button = ActionButton('')

        self.close_button = CloseButton()

        self.pack_start(self.info_image_box, False, False)
        self.pack_start(self.info_label)

        self.pack_end(self.close_button, False, False)
        self.pack_end(self.info_callback_button, False, False)
        self.pack_end(self.end_info_label, False, False)

        self.connect('expose-event', self.expose)

    def expose(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation

        cr.set_source_rgb(*color_hex_to_cairo('#cccccc'))
        cr.rectangle(rect.x, rect.y, rect.width, 1)
        cr.fill()

        cr.set_source_rgb(*color_hex_to_cairo('#ffffff'))
        cr.rectangle(rect.x, rect.y+1, rect.width, 1)
        cr.fill()

        cr.set_source_rgb(*color_hex_to_cairo('#fff9c9'))
        cr.rectangle(rect.x, rect.y+2, rect.width, rect.height-2)
        cr.fill()

    def expose_info_image_box(self, widget, event):
        cr = widget.window.cairo_create()
        rect = widget.allocation
        msg_pixbuf = get_common_image_pixbuf("msg/msg1.png")
        pix_width = msg_pixbuf.get_width()
        pix_height = msg_pixbuf.get_height()
        draw_pixbuf(cr,
                    msg_pixbuf,
                    rect.x + (rect.width-pix_width)/2,
                    rect.y + (rect.height-pix_height)/2,
                    )

    def update_end_info(self, info):
        self.end_info_label.set_text(info)

    def update_info(self, info, callback_name='', callback_action=None):
        self.info_label.set_text(info)
        self.info_callback_button.set_text(callback_name)
        self.info_callback_button.callback_action = callback_action
开发者ID:PeterDaveHello,项目名称:deepin-software-center,代码行数:58,代码来源:widgets.py

示例11: __label

 def __label(self, label_name):
     label = Label(label_name,
                   text_x_align = ALIGN_END,
                   text_size=CONTENT_FONT_SIZE,
                   enable_select=False,
                   enable_double_click=False,
                   fixed_width = STANDARD_LINE)
     label.set_can_focus(False)
     return label
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:9,代码来源:elements.py

示例12: SongSearchUI

class SongSearchUI(DialogBox):
    
    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])
        
    def search_song(self, widget):    
        self.result_view.clear()
        title = self.title_entry.entry.get_text()
        if not title.strip():
            return 
        self.prompt_label.set_text(_("Now searching"))        
        # widget.set_sensitive(False)
        utils.ThreadRun(multi_ways_query_song, self.render_song_infos, [title]).start()
        
    @post_gui    
    def render_song_infos(self, song_infos):
        if song_infos:
            try:
                items = [QueryInfoItem(song_info) for song_info in song_infos]
            except Exception, e:    
                print e
            else:    
                self.result_view.add_items(items)
        self.prompt_label.set_text(_("Finish!"))        
开发者ID:andy071001,项目名称:deepin-music-player,代码行数:55,代码来源:song_search.py

示例13: __init__

    def __init__(self, 
                 text, 
                 callback_action=None,
                 enable_gaussian=False, 
                 text_color=ui_theme.get_color("link_text"),
                 ):
        Label.__init__(self, text, text_color, enable_gaussian=enable_gaussian, text_size=9,
                       gaussian_radious=1, border_radious=0, underline=False)
        self.callback_action = callback_action

        set_clickable_cursor(self)
        self.connect('button-press-event', self.button_press_action)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:12,代码来源:select_page.py

示例14: ShowTime

class ShowTime(object):
    
    def __init__(self):     
        self.time_font1 = ""
        self.time_font2 = ""
        self.time_box = Label("", enable_gaussian=True)
        
    def set_time_font(self, time_font2, time_font1):    
        self.time_font1 = str(time_font1) # 右边显示的时间.
        self.time_font2 = str(time_font2) # 左边显示的时间.
        
        self.time_box.set_text(self.time_font2 + self.time_font1)
开发者ID:Bruners,项目名称:deepin-media-player,代码行数:12,代码来源:show_time.py

示例15: __set_row

    def __set_row(self, name, arg, types="ip"):
        label = Label(name, text_size=CONTENT_FONT_SIZE,
                               enable_select=False,
                               enable_double_click=False)

        label.set_can_focus(False)
        entry = IPV4Entry()
        if types == "ip":
            entry.connect("changed", self.set_ip_address, arg)
        else:
            entry.connect("changed", self.set_dns_address, arg)

        return (label, entry)
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:13,代码来源:ipsettings.py


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