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


Python ui.label函数代码示例

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


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

示例1: _widgets_lyrics

 def _widgets_lyrics(self):
     horiz_spacing = 2
     vert_spacing = 1
     self.info_lyrics = ui.expander(markup="<b>%s</b>" % _("Lyrics"),
                 expand=self.config.info_lyrics_expanded,
                 can_focus=False)
     self.info_lyrics.connect("activate", self._expanded, "lyrics")
     lyricsbox = gtk.VBox()
     self.lyricsText = ui.textview(text="", edit=False, wrap=True)
     self._populate_lyrics_tag_table()
     self.lyricsSw = ui.scrollwindow(policy_x=gtk.POLICY_NEVER,
                                     policy_y=gtk.POLICY_NEVER,
                                     add=self.lyricsText)
     lyricsbox.pack_start(self.lyricsSw, True, True, vert_spacing)
     lyricsbox_bottom = gtk.HBox()
     self._searchlabel = ui.label(y=0)
     self._editlyricslabel = ui.label(y=0)
     searchevbox = ui.eventbox(add=self._searchlabel)
     editlyricsevbox = ui.eventbox(add=self._editlyricslabel)
     self._apply_link_signals(searchevbox, 'search',
                              _("Search Lyricwiki.org for lyrics"))
     self._apply_link_signals(editlyricsevbox, 'editlyrics',
                              _("Edit lyrics at Lyricwiki.org"))
     lyricsbox_bottom.pack_start(searchevbox, False, False, horiz_spacing)
     lyricsbox_bottom.pack_start(editlyricsevbox, False, False,
                                 horiz_spacing)
     lyricsbox.pack_start(lyricsbox_bottom, False, False, vert_spacing)
     self.info_lyrics.add(lyricsbox)
     return self.info_lyrics
开发者ID:xcorp,项目名称:sonata-svn,代码行数:29,代码来源:info.py

示例2: _widgets_lyrics

 def _widgets_lyrics(self):
     horiz_spacing = 2
     vert_spacing = 1
     self.info_lyrics = ui.expander(markup='<b>%s</b>' % _('Lyrics'),
                 expand=self.config.info_lyrics_expanded,
                 can_focus=False)
     self.info_lyrics.connect('activate', self._expanded, 'lyrics')
     lyricsbox = gtk.VBox()
     self.lyricsText = ui.label(markup=' ', y=0, select=True, wrap=True)
     lyricsbox.pack_start(self.lyricsText, True, True, vert_spacing)
     lyricsbox_bottom = gtk.HBox()
     self._searchlabel = ui.label(y=0)
     self._editlyricslabel = ui.label(y=0)
     searchevbox = ui.eventbox(add=self._searchlabel)
     editlyricsevbox = ui.eventbox(add=self._editlyricslabel)
     self._apply_link_signals(searchevbox, 'search',
             _('Search Lyricwiki.org for lyrics'))
     self._apply_link_signals(editlyricsevbox,
             'editlyrics', _('Edit lyrics at Lyricwiki.org'))
     lyricsbox_bottom.pack_start(searchevbox, False, False, horiz_spacing)
     lyricsbox_bottom.pack_start(editlyricsevbox, False,
             False, horiz_spacing)
     lyricsbox.pack_start(lyricsbox_bottom, False, False, vert_spacing)
     self.info_lyrics.add(lyricsbox)
     return self.info_lyrics
开发者ID:jakebarnwell,项目名称:PythonGenerator,代码行数:25,代码来源:info.py

示例3: _widgets_song

    def _widgets_song(self):
        info_song = ui.expander(markup="<b>%s</b>" % _("Song Info"),
                expand=self.config.info_song_expanded,
                can_focus=False)
        info_song.connect("activate", self._expanded, "song")

        self.info_labels = {}
        self.info_boxes_in_more = []
        labels = [(_("Title"), 'title', False, "", False),
            (_("Artist"), 'artist', True,
                _("Launch artist in Wikipedia"), False),
            (_("Album"), 'album', True,
                 _("Launch album in Wikipedia"), False),
            (_("Date"), 'date', False, "", False),
            (_("Track"), 'track', False, "", False),
            (_("Genre"), 'genre', False, "", False),
            (_("File"), 'file', False, "", True),
            (_("Bitrate"), 'bitrate', False, "", True)]

        tagtable = gtk.Table(len(labels), 2)
        tagtable.set_col_spacings(12)
        for i, (text, name, link, tooltip, in_more) in enumerate(labels):
            label = ui.label(markup="<b>%s:</b>" % text, y=0)
            tagtable.attach(label, 0, 1, i, i + 1, yoptions=gtk.SHRINK)
            if i == 0:
                self.info_left_label = label
            # Using set_selectable overrides the hover cursor that
            # sonata tries to set for the links, and I can't figure
            # out how to stop that. So we'll disable set_selectable
            # for those labels until it's figured out.
            tmplabel2 = ui.label(wrap=True, y=0, select=not link)
            if link:
                tmpevbox = ui.eventbox(add=tmplabel2)
                self._apply_link_signals(tmpevbox, name, tooltip)
            to_pack = tmpevbox if link else tmplabel2
            tagtable.attach(to_pack, 1, 2, i, i + 1, yoptions=gtk.SHRINK)
            self.info_labels[name] = tmplabel2
            if in_more:
                self.info_boxes_in_more.append(label)
                self.info_boxes_in_more.append(to_pack)

        self._morelabel = ui.label(y=0)
        self.toggle_more()
        moreevbox = ui.eventbox(add=self._morelabel)
        self._apply_link_signals(moreevbox, 'more', _("Toggle extra tags"))
        self._editlabel = ui.label(y=0)
        editevbox = ui.eventbox(add=self._editlabel)
        self._apply_link_signals(editevbox, 'edit', _("Edit song tags"))
        mischbox = gtk.HBox()
        mischbox.pack_start(moreevbox, False, False, 3)
        mischbox.pack_start(editevbox, False, False, 3)

        tagtable.attach(mischbox, 0, 2, len(labels), len(labels) + 1)
        inner_hbox = gtk.HBox()
        inner_hbox.pack_start(self._imagebox, False, False, 6)
        inner_hbox.pack_start(tagtable, False, False, 6)
        info_song.add(inner_hbox)
        return info_song
开发者ID:xcorp,项目名称:sonata-svn,代码行数:58,代码来源:info.py

示例4: on_streams_new

	def on_streams_new(self, _action, stream_num=-1):
		if stream_num > -1:
			edit_mode = True
		else:
			edit_mode = False
		# Prompt user for playlist name:
		dialog = ui.dialog(title=None, parent=self.window, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT), role="streamsNew")
		if edit_mode:
			dialog.set_title(_("Edit Stream"))
		else:
			dialog.set_title(_("New Stream"))
		hbox = gtk.HBox()
		namelabel = ui.label(text=_('Stream name') + ':')
		hbox.pack_start(namelabel, False, False, 5)
		nameentry = ui.entry()
		if edit_mode:
			nameentry.set_text(self.config.stream_names[stream_num])
		hbox.pack_start(nameentry, True, True, 5)
		hbox2 = gtk.HBox()
		urllabel = ui.label(text=_('Stream URL') + ':')
		hbox2.pack_start(urllabel, False, False, 5)
		urlentry = ui.entry()
		if edit_mode:
			urlentry.set_text(self.config.stream_uris[stream_num])
		hbox2.pack_start(urlentry, True, True, 5)
		ui.set_widths_equal([namelabel, urllabel])
		dialog.vbox.pack_start(hbox)
		dialog.vbox.pack_start(hbox2)
		ui.show(dialog.vbox)
		response = dialog.run()
		if response == gtk.RESPONSE_ACCEPT:
			name = nameentry.get_text()
			uri = urlentry.get_text()
			if len(name.decode('utf-8')) > 0 and len(uri.decode('utf-8')) > 0:
				# Make sure this stream name doesn't already exit:
				i = 0
				for item in self.config.stream_names:
					# Prevent a name collision in edit_mode..
					if not edit_mode or (edit_mode and i != stream_num):
						if item == name:
							dialog.destroy()
							if ui.show_msg(self.window, _("A stream with this name already exists. Would you like to replace it?"), _("New Stream"), 'newStreamError', gtk.BUTTONS_YES_NO) == gtk.RESPONSE_YES:
								# Pop existing stream:
								self.config.stream_names.pop(i)
								self.config.stream_uris.pop(i)
							else:
								return
					i = i + 1
				if edit_mode:
					self.config.stream_names.pop(stream_num)
					self.config.stream_uris.pop(stream_num)
				self.config.stream_names.append(name)
				self.config.stream_uris.append(uri)
				self.populate()
				self.settings_save()
		dialog.destroy()
		self.iterate_now()
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:57,代码来源:streams.py

示例5: on_prefs_real

	def on_prefs_real(self, extras_cbs, display_cbs, behavior_cbs, format_cbs):
		"""Display the preferences dialog"""

		self.prefswindow = ui.dialog(title=_("Preferences"), parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, role='preferences', resizable=False, separator=False)
		self.prefsnotebook = gtk.Notebook()

		tabs = [(_("MPD"), 'mpd'),
		        (_("Display"), 'display'),
		        (_("Behavior"), 'behavior'),
		        (_("Format"), 'format'),
		        (_("Extras"), 'extras'),
		        (_("Plugins"), 'plugins'),
		        ]

		for display_name, name in tabs[:-1]:
			label = ui.label(text=display_name)
			func = getattr(self, '%s_tab' % name)
			tab = func(locals().get('%s_cbs' % name))
			self.prefsnotebook.append_page(tab, label)
		hbox = gtk.HBox()
		hbox.pack_start(self.prefsnotebook, False, False, 10)
		self.prefswindow.vbox.pack_start(hbox, False, False, 10)
		close_button = self.prefswindow.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
		self.prefswindow.show_all()
		self.prefsnotebook.set_current_page(self.last_tab)
		close_button.grab_focus()
		self.prefswindow.connect('response', self._window_response)
		# Save previous connection properties to determine if we should try to
		# connect to MPD after prefs are closed:
		self.prev_host = self.config.host[self.config.profile_num]
		self.prev_port = self.config.port[self.config.profile_num]
		self.prev_password = self.config.password[self.config.profile_num]
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:32,代码来源:preferences.py

示例6: prompt_for_playlist_name

 def prompt_for_playlist_name(self, title, role):
     plname = None
     if self.connected():
         # Prompt user for playlist name:
         dialog = ui.dialog(title=title, parent=self.window,
                            flags=gtk.DIALOG_MODAL |
                            gtk.DIALOG_DESTROY_WITH_PARENT,
                            buttons=(gtk.STOCK_CANCEL,
                                     gtk.RESPONSE_REJECT,
                                     gtk.STOCK_SAVE,
                                     gtk.RESPONSE_ACCEPT),
                            role=role, default=gtk.RESPONSE_ACCEPT)
         hbox = gtk.HBox()
         hbox.pack_start(ui.label(text=_('Playlist name:')), False, False,
                         5)
         entry = ui.entry()
         entry.set_activates_default(True)
         hbox.pack_start(entry, True, True, 5)
         dialog.vbox.pack_start(hbox)
         ui.show(dialog.vbox)
         response = dialog.run()
         if response == gtk.RESPONSE_ACCEPT:
             plname = misc.strip_all_slashes(entry.get_text())
         dialog.destroy()
     return plname
开发者ID:xcorp,项目名称:sonata-svn,代码行数:25,代码来源:playlists.py

示例7: _widgets_album

 def _widgets_album(self):
     info_album = ui.expander(markup='<b>%s</b>' % _('Album Info'),
             expand=self.config.info_album_expanded,
             can_focus=False)
     info_album.connect('activate', self._expanded, 'album')
     self.albumText = ui.label(markup=' ', y=0, select=True, wrap=True)
     info_album.add(self.albumText)
     return info_album
开发者ID:jakebarnwell,项目名称:PythonGenerator,代码行数:8,代码来源:info.py

示例8: __init__

	def __init__(self, config, info_image, linkcolor, on_link_click_cb, library_return_search_items, get_playing_song, TAB_INFO, on_image_activate, on_image_motion_cb, on_image_drop_cb):
		self.config = config
		self.info_image = info_image
		self.linkcolor = linkcolor
		self.on_link_click_cb = on_link_click_cb
		self.library_return_search_items = library_return_search_items
		self.get_playing_song = get_playing_song
		self.TAB_INFO = TAB_INFO
		self.on_image_activate = on_image_activate
		self.on_image_motion_cb = on_image_motion_cb
		self.on_image_drop_cb = on_image_drop_cb

		try:
			self.enc = locale.getpreferredencoding()
		except:
			print "Locale cannot be found; please set your system's locale. Aborting..."
			sys.exit(1)

		self.lyricServer = None
		self.last_info_bitrate = None

		self.info_boxes_in_more = None
		self.info_editlabel = None
		self.info_editlyricslabel = None
		self.info_labels = None
		self.info_left_label = None
		self.info_lyrics = None
		self.info_morelabel = None
		self.info_searchlabel = None
		self.info_tagbox = None
		self.info_type = None

		self.lyricsText = None
		self.albumText = None

		# Info tab
		self.info_area = ui.scrollwindow()

		if self.config.info_art_enlarged:
			self.info_imagebox = ui.eventbox()
		else:
			self.info_imagebox = ui.eventbox(w=152)

		self.info_imagebox.add(self.info_image)

		infohbox = gtk.HBox()
		infohbox.pack_start(ui.image(stock=gtk.STOCK_JUSTIFY_FILL), False, False, 2)
		infohbox.pack_start(ui.label(text=self.TAB_INFO), False, False, 2)
		self.infoevbox = ui.eventbox(add=infohbox)
		self.infoevbox.show_all()

		self.info_imagebox.drag_dest_set(gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, [("text/uri-list", 0, 80), ("text/plain", 0, 80)], gtk.gdk.ACTION_DEFAULT)
		self.info_imagebox.connect('button_press_event', self.on_image_activate)
		self.info_imagebox.connect('drag_motion', self.on_image_motion_cb)
		self.info_imagebox.connect('drag_data_received', self.on_image_drop_cb)

		self.widgets_initialize(self.info_area)
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:57,代码来源:info.py

示例9: _create_label_entry_button_hbox

    def _create_label_entry_button_hbox(self, label_name, track=False):
        """Creates a label, entry, apply all button, packing them into an hbox.

        This is usually one row in the tagedit dialog, for example the title.
        """
        entry = ui.entry()
        button = ui.button()
        buttonvbox = self.tags_win_create_apply_all_button(button, entry, track)

        label = ui.label(text=label_name, x=1)
        hbox = gtk.HBox()
        hbox.pack_start(label, False, False, 2)
        hbox.pack_start(entry, True, True, 2)
        hbox.pack_start(buttonvbox, False, False, 2)

        return (label, entry, button, hbox)
开发者ID:BackupTheBerlios,项目名称:sonata,代码行数:16,代码来源:tagedit.py

示例10: __init__

	def __init__(self, config, window, client, UIManager, update_menu_visibility, iterate_now, on_add_item, on_playlists_button_press, get_current_songs, connected, TAB_PLAYLISTS):
		self.config = config
		self.window = window
		self.client = client
		self.UIManager = UIManager
		self.update_menu_visibility = update_menu_visibility
		self.iterate_now = iterate_now # XXX Do we really need this?
		self.on_add_item = on_add_item
		self.on_playlists_button_press = on_playlists_button_press
		self.get_current_songs = get_current_songs
		self.connected = connected
		self.TAB_PLAYLISTS = TAB_PLAYLISTS

		self.mergepl_id = None
		self.actionGroupPlaylists = None

		# Playlists tab
		self.playlists = ui.treeview()
		self.playlists_selection = self.playlists.get_selection()
		self.playlistswindow = ui.scrollwindow(add=self.playlists)
		playlistshbox = gtk.HBox()
		playlistshbox.pack_start(ui.image(stock=gtk.STOCK_JUSTIFY_CENTER), False, False, 2)
		playlistshbox.pack_start(ui.label(text=self.TAB_PLAYLISTS), False, False, 2)
		self.playlistsevbox = ui.eventbox(add=playlistshbox)
		self.playlistsevbox.show_all()

		self.playlists.connect('button_press_event', self.on_playlists_button_press)
		self.playlists.connect('row_activated', self.playlists_activated)
		self.playlists.connect('key-press-event', self.playlists_key_press)

		# Initialize playlist data and widget
		self.playlistsdata = gtk.ListStore(str, str)
		self.playlists.set_model(self.playlistsdata)
		self.playlists.set_search_column(1)
		self.playlistsimg = gtk.CellRendererPixbuf()
		self.playlistscell = gtk.CellRendererText()
		self.playlistscell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.playlistscolumn = gtk.TreeViewColumn()
		self.playlistscolumn.pack_start(self.playlistsimg, False)
		self.playlistscolumn.pack_start(self.playlistscell, True)
		self.playlistscolumn.set_attributes(self.playlistsimg, stock_id=0)
		self.playlistscolumn.set_attributes(self.playlistscell, markup=1)
		self.playlists.append_column(self.playlistscolumn)
		self.playlists_selection.set_mode(gtk.SELECTION_MULTIPLE)
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:44,代码来源:playlists.py

示例11: _art_location_changed

	def _art_location_changed(self, combobox):
		if combobox.get_active() == consts.ART_LOCATION_CUSTOM:
			# Prompt user for playlist name:
			dialog = ui.dialog(title=_("Custom Artwork"), parent=self.window, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT), role='customArtwork', default=gtk.RESPONSE_ACCEPT)
			hbox = gtk.HBox()
			hbox.pack_start(ui.label(text=_('Artwork filename') + ':'), False, False, 5)
			entry = ui.entry()
			entry.set_activates_default(True)
			hbox.pack_start(entry, True, True, 5)
			dialog.vbox.pack_start(hbox)
			dialog.vbox.show_all()
			response = dialog.run()
			if response == gtk.RESPONSE_ACCEPT:
				self.config.art_location_custom_filename = entry.get_text().replace("/", "")
			else:
				# Revert to non-custom item in combobox:
				combobox.set_active(self.config.art_location)
			dialog.destroy()
		self.config.art_location = combobox.get_active()
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:19,代码来源:preferences.py

示例12: show_tooltip

 def show_tooltip(self, id_, x, y):
     height = self.rect.height // 30
     try:
         label = ui.label(layout=ui.fill_layout(), 
                          text=repr(id_)[1:-1],
                          color=(1., 1., 1., 1.))
     except UnicodeDecodeError:
         print "Bad string", repr(id_)
         return
     lw, lh = label.content_size(height)
     margin = .2
     bg_width = lw * (1 + 2 * margin)
     bg_height = lh * (1 + 2 * margin)
     x, y = self.world_to_window(x, y)
     x = max(0, min(self.rect.width - bg_width, x))
     y = max(0, min(self.rect.height - bg_height, y))
     bg_rect = ui.rect(x, y, bg_width, bg_height)
     background = ui.plain_color(id='tooltip',
                                 rect=bg_rect,
                                 color=(.0, .0, .0, .5))
     background.children.append(label)
     background.layout_children()
     self.children.append(background)
开发者ID:euccastro,项目名称:searchview,代码行数:23,代码来源:searchview.py

示例13: __init__

	def __init__(self, config, window, on_streams_button_press, on_add_item, settings_save, iterate_now, TAB_STREAMS):
		self.config = config
		self.window = window
		self.on_streams_button_press = on_streams_button_press
		self.on_add_item = on_add_item
		self.settings_save = settings_save
		self.iterate_now = iterate_now # XXX Do we really need this?
		self.TAB_STREAMS = TAB_STREAMS

		# Streams tab
		self.streams = ui.treeview()
		self.streams_selection = self.streams.get_selection()
		self.streamswindow = ui.scrollwindow(add=self.streams)
		streamshbox = gtk.HBox()
		streamshbox.pack_start(ui.image(stock=gtk.STOCK_NETWORK), False, False, 2)
		streamshbox.pack_start(ui.label(text=self.TAB_STREAMS), False, False, 2)
		self.streamsevbox = ui.eventbox(add=streamshbox)
		self.streamsevbox.show_all()

		self.streams.connect('button_press_event', self.on_streams_button_press)
		self.streams.connect('row_activated', self.on_streams_activated)
		self.streams.connect('key-press-event', self.on_streams_key_press)

		# Initialize streams data and widget
		self.streamsdata = gtk.ListStore(str, str, str)
		self.streams.set_model(self.streamsdata)
		self.streams.set_search_column(1)
		self.streamsimg = gtk.CellRendererPixbuf()
		self.streamscell = gtk.CellRendererText()
		self.streamscell.set_property("ellipsize", pango.ELLIPSIZE_END)
		self.streamscolumn = gtk.TreeViewColumn()
		self.streamscolumn.pack_start(self.streamsimg, False)
		self.streamscolumn.pack_start(self.streamscell, True)
		self.streamscolumn.set_attributes(self.streamsimg, stock_id=0)
		self.streamscolumn.set_attributes(self.streamscell, markup=1)
		self.streams.append_column(self.streamscolumn)
		self.streams_selection.set_mode(gtk.SELECTION_MULTIPLE)
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:37,代码来源:streams.py

示例14: __init__

    def __init__(
        self,
        config,
        client,
        TAB_CURRENT,
        on_current_button_press,
        parse_formatting_colnames,
        parse_formatting,
        connected,
        sonata_loaded,
        songinfo,
        update_statusbar,
        iterate_now,
        libsearchfilter_get_style,
    ):
        self.config = config
        self.client = client
        self.TAB_CURRENT = TAB_CURRENT
        self.on_current_button_press = on_current_button_press
        self.parse_formatting_colnames = parse_formatting_colnames
        self.parse_formatting = parse_formatting
        self.connected = connected
        self.sonata_loaded = sonata_loaded
        self.songinfo = songinfo
        self.update_statusbar = update_statusbar
        self.iterate_now = iterate_now
        self.libsearchfilter_get_style = libsearchfilter_get_style

        self.currentdata = None
        self.filterbox_visible = False
        self.current_update_skip = False
        self.filter_row_mapping = []  # Mapping between filter rows and self.currentdata rows
        self.columnformat = None
        self.columns = None

        self.current_songs = None
        self.filterbox_cmd_buf = None
        self.filterbox_cond = None
        self.filterbox_source = None
        self.column_sorted = (None, gtk.SORT_DESCENDING)  # TreeViewColumn, order
        self.total_time = 0
        self.edit_style_orig = None
        self.resizing_columns = None
        self.prev_boldrow = -1
        self.prevtodo = None
        self.plpos = None
        self.playlist_pos_before_filter = None
        self.sel_rows = None

        # Current tab
        self.current = ui.treeview(reorder=True, search=False, headers=True)
        self.current_selection = self.current.get_selection()
        self.expanderwindow = ui.scrollwindow(shadow=gtk.SHADOW_IN, add=self.current)
        self.filterpattern = ui.entry()
        self.filterbox = gtk.HBox()
        self.filterbox.pack_start(ui.label(text=_("Filter") + ":"), False, False, 5)
        self.filterbox.pack_start(self.filterpattern, True, True, 5)
        filterclosebutton = ui.button(img=ui.image(stock=gtk.STOCK_CLOSE), relief=gtk.RELIEF_NONE)
        self.filterbox.pack_start(filterclosebutton, False, False, 0)
        self.filterbox.set_no_show_all(True)
        self.vbox_current = gtk.VBox()
        self.vbox_current.pack_start(self.expanderwindow, True, True)
        self.vbox_current.pack_start(self.filterbox, False, False, 5)
        playlisthbox = gtk.HBox()
        playlisthbox.pack_start(ui.image(stock=gtk.STOCK_CDROM), False, False, 2)
        playlisthbox.pack_start(ui.label(text=self.TAB_CURRENT), False, False, 2)
        self.playlistevbox = ui.eventbox(add=playlisthbox)
        self.playlistevbox.show_all()

        self.current.connect("drag_data_received", self.on_dnd)
        self.current.connect("row_activated", self.on_current_click)
        self.current.connect("button_press_event", self.on_current_button_press)
        self.current.connect("drag-begin", self.on_current_drag_begin)
        self.current.connect_after("drag-begin", self.dnd_after_current_drag_begin)
        self.current.connect("button_release_event", self.on_current_button_release)

        self.filter_changed_handler = self.filterpattern.connect("changed", self.searchfilter_feed_loop)
        self.filterpattern.connect("activate", self.searchfilter_on_enter)
        self.filterpattern.connect("key-press-event", self.searchfilter_key_pressed)
        filterclosebutton.connect("clicked", self.searchfilter_toggle)

        # Set up current view
        self.initialize_columns()
        self.current_selection.set_mode(gtk.SELECTION_MULTIPLE)
        target_reorder = ("MY_TREE_MODEL_ROW", gtk.TARGET_SAME_WIDGET, 0)
        target_file_managers = ("text/uri-list", 0, 0)
        self.current.enable_model_drag_source(
            gtk.gdk.BUTTON1_MASK, [target_reorder, target_file_managers], gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_DEFAULT
        )
        self.current.enable_model_drag_dest(
            [target_reorder, target_file_managers], gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_DEFAULT
        )
        self.current.connect("drag-data-get", self.dnd_get_data_for_file_managers)
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:93,代码来源:current.py

示例15: mpd_tab

	def mpd_tab(self, cbs=None):
		"""Construct and layout the MPD tab"""
		mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>')
		frame = gtk.Frame()
		frame.set_label_widget(mpdlabel)
		frame.set_shadow_type(gtk.SHADOW_NONE)
		controlbox = gtk.HBox()
		profiles = ui.combo()
		add_profile = ui.button(img=ui.image(stock=gtk.STOCK_ADD))
		remove_profile = ui.button(img=ui.image(stock=gtk.STOCK_REMOVE))
		self._populate_profile_combo(profiles, self.config.profile_num,
			remove_profile)
		controlbox.pack_start(profiles, False, False, 2)
		controlbox.pack_start(remove_profile, False, False, 2) 
		controlbox.pack_start(add_profile, False, False, 2)
		namelabel = ui.label(textmn=_("_Name") + ":")
		nameentry = ui.entry()
		namelabel.set_mnemonic_widget(nameentry)
		hostlabel = ui.label(textmn=_("_Host") + ":")
		hostentry = ui.entry()
		hostlabel.set_mnemonic_widget(hostentry)
		portlabel = ui.label(textmn=_("_Port") + ":")
		portentry = gtk.SpinButton(gtk.Adjustment(0 ,0 ,65535, 1),1)
		portentry.set_numeric(True)
		portlabel.set_mnemonic_widget(portentry)
		dirlabel = ui.label(textmn=_("_Music dir") + ":")
		direntry = gtk.FileChooserButton(_('Select a Music Directory'))
		self.direntry = direntry
		direntry.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
		direntry.connect('selection-changed', self._direntry_changed,
			profiles)
		dirlabel.set_mnemonic_widget(direntry)
		passwordlabel = ui.label(textmn=_("Pa_ssword") + ":")
		passwordentry = ui.entry(password=True)
		passwordlabel.set_mnemonic_widget(passwordentry)
		passwordentry.set_tooltip_text(_("Leave blank if no password is required."))
		autoconnect = gtk.CheckButton(_("_Autoconnect on start"))
		autoconnect.set_active(self.config.autoconnect)
		autoconnect.connect('toggled', self._config_widget_active,
			'autoconnect')
		# Fill in entries with current profile:
		self._profile_chosen(profiles, nameentry, hostentry,
			portentry, passwordentry, direntry)
		# Update display if $MPD_HOST or $MPD_PORT is set:
		host, port, password = misc.mpd_env_vars()
		if host or port:
			self.using_mpd_env_vars = True
			if not host:
				host = ""
			if not port:
				port = 0
			if not password:
				password = ""
			hostentry.set_text(str(host))
			portentry.set_value(port)
			passwordentry.set_text(str(password))
			nameentry.set_text(_("Using MPD_HOST/PORT"))
			for widget in [hostentry, portentry, passwordentry,
				       nameentry, profiles, add_profile,
				       remove_profile]:
				widget.set_sensitive(False)
		else:
			self.using_mpd_env_vars = False
			nameentry.connect('changed', self._nameentry_changed,
				profiles, remove_profile)
			hostentry.connect('changed', self._hostentry_changed,
				profiles)
			portentry.connect('value-changed',
				self._portentry_changed, profiles)
			passwordentry.connect('changed',
				self._passwordentry_changed, profiles)
			profiles.connect('changed',
				self._profile_chosen, nameentry, hostentry,
				portentry, passwordentry, direntry)
			add_profile.connect('clicked', self._add_profile,
				nameentry, profiles, remove_profile)
			remove_profile.connect('clicked', self._remove_profile,
				profiles, remove_profile)

		rows = [(namelabel, nameentry),
			(hostlabel, hostentry),
			(portlabel, portentry),
			(passwordlabel, passwordentry),
			(dirlabel, direntry)]

		connection_table = gtk.Table(len(rows), 2)
		connection_table.set_col_spacings(12)
		for i, (label, entry) in enumerate(rows):
			connection_table.attach(label, 0, 1, i, i+1, gtk.FILL,
				gtk.FILL)
			connection_table.attach(entry, 1, 2, i, i+1,
				gtk.FILL|gtk.EXPAND, gtk.FILL)

		connection_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
		connection_alignment.set_padding(12, 12, 12, 12)
		connection_alignment.add(connection_table)
		connection_frame = gtk.Frame()
		connection_frame.set_label_widget(controlbox)
		connection_frame.add(connection_alignment)
		table = gtk.Table(2, 1)
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:101,代码来源:preferences.py


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