• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ui.label函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: on_prefs_real

	def on_prefs_real(self, parent_window, popuptimes, as_imported, as_import, as_init, as_reauth, trayicon_available, trayicon_in_use, reconnect, renotify, reinfofile, prefs_notif_toggled, prefs_stylized_toggled, prefs_art_toggled, prefs_playback_toggled, prefs_progress_toggled, prefs_statusbar_toggled, prefs_lyrics_toggled, prefs_trayicon_toggled, prefs_window_response):
		"""Display the preferences dialog"""
		self.window = parent_window
		self.as_imported = as_imported
		self.as_import = as_import
		self.as_init = as_init
		self.as_reauth = as_reauth
		self.reconnect = reconnect
		self.renotify = renotify
		self.reinfofile = reinfofile

		prefswindow = ui.dialog(title=_("Preferences"), parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, role='preferences', resizable=False, separator=False)
		hbox = gtk.HBox()
		prefsnotebook = gtk.Notebook()
		# MPD tab
		mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>', y=1)
		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.prefs_populate_profile_combo(profiles, self.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)
		namebox = gtk.HBox()
		namelabel = ui.label(text=_("Name") + ":")
		namebox.pack_start(namelabel, False, False, 0)
		nameentry = ui.entry()
		namebox.pack_start(nameentry, True, True, 10)
		hostbox = gtk.HBox()
		hostlabel = ui.label(text=_("Host") + ":")
		hostbox.pack_start(hostlabel, False, False, 0)
		hostentry = ui.entry()
		hostbox.pack_start(hostentry, True, True, 10)
		portbox = gtk.HBox()
		portlabel = ui.label(text=_("Port") + ":")
		portbox.pack_start(portlabel, False, False, 0)
		portentry = ui.entry()
		portbox.pack_start(portentry, True, True, 10)
		dirbox = gtk.HBox()
		dirlabel = ui.label(text=_("Music dir") + ":")
		dirbox.pack_start(dirlabel, False, False, 0)
		direntry = ui.entry()
		direntry.connect('changed', self.prefs_direntry_changed, profiles)
		dirbox.pack_start(direntry, True, True, 10)
		passwordbox = gtk.HBox()
		passwordlabel = ui.label(text=_("Password") + ":")
		passwordbox.pack_start(passwordlabel, False, False, 0)
		passwordentry = ui.entry(password=True)
		passwordentry.set_tooltip_text(_("Leave blank if no password is required."))
		passwordbox.pack_start(passwordentry, True, True, 10)
		mpd_labels = [namelabel, hostlabel, portlabel, passwordlabel, dirlabel]
		ui.set_widths_equal(mpd_labels)
		autoconnect = gtk.CheckButton(_("Autoconnect on start"))
		autoconnect.set_active(self.autoconnect)
		# Fill in entries with current profile:
		self.prefs_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:
			using_mpd_env_vars = True
			if not host:
				host = ""
			if not port:
				port = ""
			if not password:
				password = ""
			hostentry.set_text(str(host))
			portentry.set_text(str(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:
			using_mpd_env_vars = False
			# remove_profile is properly set in populate_profile_combo:
			for widget in [hostentry, portentry, passwordentry, nameentry, profiles, add_profile]: 
				widget.set_sensitive(True)
			nameentry.connect('changed', self.prefs_nameentry_changed, profiles, remove_profile)
			hostentry.connect('changed', self.prefs_hostentry_changed, profiles)
			portentry.connect('changed', self.prefs_portentry_changed, profiles)
			passwordentry.connect('changed', self.prefs_passwordentry_changed, profiles)
			profiles.connect('changed', self.prefs_profile_chosen, nameentry, hostentry, portentry, passwordentry, direntry)
			add_profile.connect('clicked', self.prefs_add_profile, nameentry, profiles, remove_profile)
			remove_profile.connect('clicked', self.prefs_remove_profile, profiles, remove_profile)
		mpd_frame = gtk.Frame()
		table = gtk.Table(6, 2, False)
		table.set_col_spacings(3)
		table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(namebox, 1, 3, 2, 3, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(hostbox, 1, 3, 3, 4, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(portbox, 1, 3, 4, 5, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(passwordbox, 1, 3, 5, 6, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(dirbox, 1, 3, 6, 7, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		table.attach(ui.label(), 1, 3, 7, 8, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
		mpd_frame.add(table)
		mpd_frame.set_label_widget(controlbox)
		mpd_table = gtk.Table(9, 2, False)
		mpd_table.set_col_spacings(3)
		mpd_table.attach(ui.label(), 1, 3, 1, 2, gtk.FILL|gtk.EXPAND, gtk.FILL|gtk.EXPAND, 10, 0)
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:101,代码来源:preferences.py


示例17: on_prefs_real

	def on_prefs_real(self, parent_window, popuptimes, scrobbler, trayicon_available, trayicon_in_use, reconnect, renotify, reinfofile, prefs_notif_toggled, prefs_stylized_toggled, prefs_art_toggled, prefs_playback_toggled, prefs_progress_toggled, prefs_statusbar_toggled, prefs_lyrics_toggled, prefs_trayicon_toggled, prefs_crossfade_toggled, prefs_crossfade_changed, prefs_window_response, prefs_last_tab):
		"""Display the preferences dialog"""
		self.window = parent_window
		self.scrobbler = scrobbler
		self.reconnect = reconnect
		self.renotify = renotify
		self.reinfofile = reinfofile
		self.last_tab = prefs_last_tab

		self.prefswindow = ui.dialog(title=_("Preferences"), parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, role='preferences', resizable=False, separator=False)
		hbox = gtk.HBox()
		prefsnotebook = gtk.Notebook()
		# MPD tab
		mpdlabel = ui.label(markup='<b>' + _('MPD Connection') + '</b>', y=1)
		mpd_frame = gtk.Frame()
		mpd_frame.set_label_widget(mpdlabel)
		mpd_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.prefs_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'))
		direntry.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
		direntry.connect('selection-changed', self.prefs_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.prefs_config_widget_active, 'autoconnect')
		# Fill in entries with current profile:
		self.prefs_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:
			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:
			using_mpd_env_vars = False
			nameentry.connect('changed', self.prefs_nameentry_changed, profiles, remove_profile)
			hostentry.connect('changed', self.prefs_hostentry_changed, profiles)
			portentry.connect('value-changed', self.prefs_portentry_changed, profiles)
			passwordentry.connect('changed', self.prefs_passwordentry_changed, profiles)
			profiles.connect('changed', self.prefs_profile_chosen, nameentry, hostentry, portentry, passwordentry, direntry)
			add_profile.connect('clicked', self.prefs_add_profile, nameentry, profiles, remove_profile)
			remove_profile.connect('clicked', self.prefs_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)
		mpd_table = gtk.Table(2, 1)
		mpd_table.set_row_spacings(12)
		mpd_table.attach(connection_frame, 0, 1, 0, 1,
			gtk.FILL|gtk.EXPAND, gtk.FILL)
		mpd_table.attach(autoconnect, 0, 1, 1, 2, gtk.FILL|gtk.EXPAND,
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sonata-svn,代码行数:101,代码来源:preferences.py


示例18: __init__

    def __init__(self, config, find_path, is_lang_rtl, info_imagebox_get_size_request, schedule_gc_collect, target_image_filename, imagelist_append, remotefilelist_append, notebook_get_allocation, allow_art_search, status_is_play_or_pause, album_filename, get_current_song_text):
        self.config = config
        self.album_filename = album_filename

        # constants from main
        self.is_lang_rtl = is_lang_rtl

        # callbacks to main XXX refactor to clear this list
        self.info_imagebox_get_size_request = info_imagebox_get_size_request
        self.schedule_gc_collect = schedule_gc_collect
        self.target_image_filename = target_image_filename
        self.imagelist_append = imagelist_append
        self.remote 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui.load_view函数代码示例发布时间:2022-05-27
下一篇:
Python ui.get_screen_size函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap