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

Python modules.postMsg函数代码示例

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

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



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

示例1: remove

    def remove(self, iter=None):
        """ Remove the given track, or the selection if iter is None """
        hadMark = self.tree.hasMark()

        iters = [iter] if iter else list(self.tree.iterSelectedRows())

        prev_iter = self.tree.get_prev_iter_or_parent(iters[0])

        # reverse list, so that we remove children before their fathers
        for iter in reversed(iters):
            track = self.tree.getTrack(iter)
            if track:
                self.playtime -= track.getLength()
            self.tree.removeRow(iter)

        self.tree.selection.unselect_all()

        if hadMark and not self.tree.hasMark():
            modules.postMsg(consts.MSG_CMD_STOP)

        # Select new track when old selected is deleted
        if prev_iter:
            self.tree.select(prev_iter)
        else:
            first_iter = self.tree.get_first_iter()
            if first_iter:
                self.tree.select(first_iter)

        self.onListModified()
开发者ID:csryan,项目名称:pogo,代码行数:29,代码来源:Tracktree.py


示例2: onAppStarted

    def onAppStarted(self):
        """ This is the real initialization function, called when the module has been loaded """
        wTree                  = tools.prefs.getWidgetsTree()
        self.playtime          = 0
        self.bufferedTrack     = None
        # Retrieve widgets
        self.window     = wTree.get_object('win-main')

        columns = (('',   [(gtk.CellRendererPixbuf(), gtk.gdk.Pixbuf), (gtk.CellRendererText(), TYPE_STRING)], True),
                   (None, [(None, TYPE_PYOBJECT)], False),
                  )

        self.tree = TrackTreeView(columns, use_markup=True)
        self.tree.enableDNDReordering()
        self.tree.setDNDSources([DND_INTERNAL_TARGET])

        wTree.get_object('scrolled-tracklist').add(self.tree)

        # GTK handlers
        self.tree.connect('exttreeview-button-pressed', self.onMouseButton)
        self.tree.connect('tracktreeview-dnd', self.onDND)
        self.tree.connect('key-press-event', self.onKeyboard)
        self.tree.get_model().connect('row-deleted', self.onRowDeleted)

        (options, args) = prefs.getCmdLine()

        self.savedPlaylist = os.path.join(consts.dirCfg, 'saved-playlist')
        self.paused = False


        # Populate the playlist with the saved playlist
        dump = None
        if os.path.exists(self.savedPlaylist):
            try:
                dump = pickleLoad(self.savedPlaylist)
            except:
                msg = '[%s] Unable to restore playlist from %s\n\n%s'
                log.logger.error(msg % (MOD_INFO[modules.MODINFO_NAME],
                                self.savedPlaylist, traceback.format_exc()))

        if dump:
            self.restoreTreeDump(dump)
            log.logger.info('[%s] Restored playlist' % MOD_INFO[modules.MODINFO_NAME])
            self.tree.collapse_all()
            self.select_last_played_track()
            self.onListModified()

        commands, args = tools.separate_commands_and_tracks(args)

        # Add commandline tracks to the playlist
        if args:
            log.logger.info('[%s] Filling playlist with files given on command line' % MOD_INFO[modules.MODINFO_NAME])
            tracks  = media.getTracks([os.path.abspath(arg) for arg in args])
            playNow = not 'stop' in commands and not 'pause' in commands
            modules.postMsg(consts.MSG_CMD_TRACKLIST_ADD, {'tracks': tracks, 'playNow': playNow})
        elif 'play' in commands:
            modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE)

        # Automatically save the content at regular intervals
        gobject.timeout_add_seconds(SAVE_INTERVAL, self.save_track_tree)
开发者ID:csryan,项目名称:pogo,代码行数:60,代码来源:Tracktree.py


示例3: onModLoaded

    def onModLoaded(self):
        """ The module has been loaded """
        txtRdrLen = gtk.CellRendererText()

        columns = (('',   [(gtk.CellRendererPixbuf(), gtk.gdk.Pixbuf), (txtRdrLen, gobject.TYPE_STRING), (gtk.CellRendererText(), gobject.TYPE_STRING)], True),
                   (None, [(None, gobject.TYPE_PYOBJECT)],                                                                                               False))

        # The album length is written in a smaller font, with a lighter color
        txtRdrLen.set_property('scale', 0.85)
        txtRdrLen.set_property('foreground', '#909090')

        self.tree     = extTreeview.ExtTreeView(columns, True)
        self.popup    = None
        self.cfgWin   = None
        self.expName  = MOD_L10N
        self.scrolled = gtk.ScrolledWindow()
        self.cacheDir = os.path.join(consts.dirCfg, MOD_INFO[modules.MODINFO_NAME])
        # Explorer
        self.tree.setDNDSources([consts.DND_TARGETS[consts.DND_DAP_TRACKS]])
        self.scrolled.add(self.tree)
        self.scrolled.set_shadow_type(gtk.SHADOW_IN)
        self.scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.scrolled.show()
        # GTK handlers
        self.tree.connect('drag-data-get',              self.onDragDataGet)
        self.tree.connect('key-press-event',            self.onKeyPressed)
        self.tree.connect('exttreeview-button-pressed', self.onButtonPressed)
        modules.postMsg(consts.MSG_CMD_EXPLORER_ADD, {'modName': MOD_L10N, 'expName': self.expName, 'icon': consts.icoCdrom, 'widget': self.scrolled})

        # Hide the album length when not drawing the root node
        self.tree.get_column(0).set_cell_data_func(txtRdrLen, self.__drawAlbumLenCell)
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:31,代码来源:AudioCD.py


示例4: timerFunc

    def timerFunc(self):
        """ Move a bit the scales to their target value """
        isFinished = True

        # Move the scales a bit
        for i in xrange(10):
            currLvl    = self.scales[i].get_value()
            targetLvl  = self.targetLvls[i]
            difference = targetLvl - currLvl

            if abs(difference) <= 0.25:
                newLvl = targetLvl
            else:
                newLvl     = currLvl + (difference / 8.0)
                isFinished = False

            self.lvls[i] = newLvl
            self.scales[i].set_value(newLvl)

        # Set the equalizer to the new levels
        modules.postMsg(consts.MSG_CMD_SET_EQZ_LVLS, {'lvls': self.lvls})

        if isFinished:
            self.timer = None
            prefs.set(__name__, 'levels', self.lvls)

            # Make sure labels are up to date (sometimes they aren't when we're done with the animation)
            # Also unblock the handlers
            for i in xrange(10):
                self.scales[i].queue_draw()
                self.scales[i].handler_unblock_by_func(self.onScaleValueChanged)

            return False

        return True
开发者ID:csryan,项目名称:pogo,代码行数:35,代码来源:Equalizer.py


示例5: updateTree

    def updateTree(self, discInfo):
        """ Update the tree using disc information from the cache, if any """
        cddb = self.getDiscFromCache(discInfo)

        # Create fake CDDB information if needed
        if cddb is None:
            cddb = {"DTITLE": "%s / %s" % (consts.UNKNOWN_ARTIST, consts.UNKNOWN_ALBUM)}
            for i in xrange(discInfo[DISC_NB_TRACKS]):
                cddb["TTITLE%u" % i] = consts.UNKNOWN_TITLE

        # Compute the length of each track
        trackLen = [
            int(round((discInfo[DISC_FRAME1 + i + 1] - discInfo[DISC_FRAME1 + i]) / 75.0))
            for i in xrange(discInfo[DISC_NB_TRACKS] - 1)
        ]
        trackLen.append(discInfo[DISC_LENGTH] - int(round(discInfo[DISC_FRAMEn] / 75.0)))

        # Update the root of the tree
        disc = cddb["DTITLE"].strip().decode("iso-8859-15", "replace")
        artist, album = disc.split(" / ")

        self.tree.setItem((0,), ROW_NAME, "%s" % tools.htmlEscape(disc))
        self.tree.setItem((0,), ROW_LENGTH, "[%s]" % sec2str(sum(trackLen)))

        # Update the explorer name
        modules.postMsg(
            consts.MSG_CMD_EXPLORER_RENAME, {"modName": MOD_L10N, "expName": self.expName, "newExpName": disc}
        )
        self.expName = disc

        # Optional information
        try:
            date = int(cddb["DYEAR"].strip().decode("iso-8859-15", "replace"))
        except:
            date = None

        try:
            genre = cddb["DGENRE"].strip().decode("iso-8859-15", "replace")
        except:
            genre = None

        # Update each track
        for i, child in enumerate(self.tree.iterChildren((0,))):
            title = cddb["TTITLE%u" % i].strip().decode("iso-8859-15", "replace")

            # Create the corresponding Track object
            track = CDTrack(str(i + 1))
            track.setTitle(title)
            track.setAlbum(album)
            track.setArtist(artist)
            track.setLength(trackLen[i])
            track.setNumber(i + 1)
            # Optional information
            if date is not None:
                track.setDate(date)
            if genre is not None:
                track.setGenre(genre)
            # Fill the tree
            self.tree.setItem(child, ROW_NAME, "%02u. %s" % (i + 1, tools.htmlEscape(title)))
            self.tree.setItem(child, ROW_TRACK, track)
开发者ID:jtojnar,项目名称:decibel-audio-player,代码行数:60,代码来源:AudioCD.py


示例6: timerFunc

    def timerFunc(self):
        """ Move a bit the scales to their target value """
        isFinished = True

        # Disconnect handlers before moving the scales
        for i in xrange(10):
            self.scales[i].disconnect(self.handlers[i])

        # Move the scales a bit
        for i in xrange(10):
            currLvl    = self.scales[i].get_value()
            targetLvl  = self.targetLvls[i]
            difference = targetLvl - currLvl

            if abs(difference) <= 0.25:
                newLvl = targetLvl
            else:
                newLvl     = currLvl + (difference / 8.0)
                isFinished = False

            self.lvls[i] = newLvl
            self.scales[i].set_value(newLvl)

        # Reconnect the handlers
        for i in xrange(10):
            self.handlers[i] = self.scales[i].connect('value-changed', self.onScaleValueChanged, i)

        # Set the equalizer to the new levels
        prefs.set(__name__, 'levels', self.lvls)
        modules.postMsg(consts.MSG_CMD_SET_EQZ_LVLS, {'lvls': self.lvls})

        return not isFinished
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:32,代码来源:Equalizer.py


示例7: onRemoveSelectedFolder

    def onRemoveSelectedFolder(self, list):
        """ Remove the selected media folder """
        import gui

        if list.getSelectedRowsCount() == 1:
            remark   = _('You will be able to add this root folder again later on if you wish so.')
            question = _('Remove the selected entry?')
        else:
            remark   = _('You will be able to add these root folders again later on if you wish so.')
            question = _('Remove all selected entries?')

        if gui.questionMsgBox(self.cfgWin, question, '%s %s' % (_('Your media files will not be deleted.'), remark)) == gtk.RESPONSE_YES:
            for row in self.cfgList.getSelectedRows():
                name = row[0]
                modules.postMsg(consts.MSG_CMD_EXPLORER_REMOVE, {'modName': MOD_L10N, 'expName': name})
                del self.folders[name]

                # Remove the tree, if any, from the scrolled window
                if self.currRoot == name:
                    self.currRoot = None

                # Remove the saved state of the tree, if any
                if name in self.treeState:
                    del self.treeState[name]

            self.cfgList.removeSelectedRows()
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:26,代码来源:FileExplorer.py


示例8: onAppStarted

    def onAppStarted(self):
        """ Real initialization function, called when this module has been loaded """
        self.currTrackLength = 0
        self.sclBeingDragged = False
        # Widgets
        wTree             = prefs.getWidgetsTree()
#        self.btnStop      = wTree.get_widget('btn-stop')
        self.btnPlay      = wTree.get_widget('btn-play')
#        self.btnNext      = wTree.get_widget('btn-next')
        self.btnPrev      = wTree.get_widget('btn-previous')
        self.sclSeek      = wTree.get_widget('scl-position')
        self.btnVolume    = wTree.get_widget('btn-volume')
        self.lblElapsed   = wTree.get_widget('lbl-elapsedTime')
        self.lblRemaining = wTree.get_widget('lbl-remainingTime')

        # Initial state
        self.onStopped()
        self.btnPlay.set_sensitive(False)
        # GTK handlers
#        self.btnStop.connect('clicked',      lambda widget: modules.postMsg(consts.MSG_CMD_STOP))
#        self.btnNext.connect('clicked',      lambda widget: modules.postMsg(consts.MSG_CMD_NEXT))
        self.btnPrev.connect('clicked',      lambda widget: modules.postMsg(consts.MSG_CMD_PREVIOUS))
        self.btnPlay.connect('clicked',      lambda widget: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE))
        self.sclSeek.connect('change-value', self.onSeekChangeValue)
        # We need to keep the handler ID for this one to be able to disconnect it when needed
        self.seekHandler   = self.sclSeek.connect('value-changed',   self.onSeekValueChanged)
        self.volumeHandler = self.btnVolume.connect('value-changed', self.onVolumeValueChanged)
        # We must make sure that the handler will be called: this is not the case if the new value is the same as the old one
        volumeValue = prefs.get(__name__, 'volume', PREFS_DEFAULT_VOLUME)
        if self.btnVolume.get_value() != volumeValue: self.btnVolume.set_value(volumeValue)
        else:                                         self.onVolumeValueChanged(self.btnVolume, volumeValue)
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:31,代码来源:CtrlPanel.py


示例9: onMediaKey

    def onMediaKey(self, appName, action):
        """ A media key has been pressed """
        if appName == consts.appName:
#            if action == 'Stop':              modules.postMsg(consts.MSG_CMD_STOP)
#            elif action == 'Next':            modules.postMsg(consts.MSG_CMD_NEXT)
            if action == 'Previous':        modules.postMsg(consts.MSG_CMD_PREVIOUS)
            elif action in ['Play', 'Pause']: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE)
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:7,代码来源:GnomeMediaKeys.py


示例10: tryToRestore

    def tryToRestore(self, tracklist):
        """ Check whether it's possible to restore playback """
        (options, args) = prefs.getCmdLine()

        # Ignore if the user provided its own tracks on the command line
        if len(args) != 0:
            return

        # Ignore if no track was being played last time
        if not self.playing or self.currTrack is None:
            return

        # Make sure the playlist is the same one
        if len(tracklist) != len(self.currTracklist):
            return

        trackIdx = -1
        for i in xrange(len(tracklist)):
            if tracklist[i] != self.currTracklist[i]:
                return

            if tracklist[i] == self.currTrack:
                trackIdx = i

        # Once here, we know playback can be resumed
        if trackIdx != -1:
            if self.paused: modules.postMsg(consts.MSG_CMD_TRACKLIST_PLAY_PAUSE, {'idx': trackIdx, 'seconds': self.currPos})
            else:           modules.postMsg(consts.MSG_CMD_TRACKLIST_PLAY,       {'idx': trackIdx, 'seconds': self.currPos})
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:28,代码来源:AutoResume.py


示例11: onPopupMenu

    def onPopupMenu(self, statusIcon, button, time):
        """ The user asks for the popup menu """
        if self.popupMenu is None:
            wTree              = loadGladeFile('StatusIconMenu.ui')
            self.menuPlay      = wTree.get_object('item-play')
            self.menuStop      = wTree.get_object('item-stop')
            self.menuNext      = wTree.get_object('item-next')
            self.popupMenu     = wTree.get_object('menu-popup')
            self.menuPause     = wTree.get_object('item-pause')
            self.menuPrevious  = wTree.get_object('item-previous')
            self.menuSeparator = wTree.get_object('item-separator')
            # Connect handlers
            wTree.get_object('item-quit').connect('activate', lambda btn: modules.postQuitMsg())
            wTree.get_object('item-preferences').connect('activate', lambda btn: modules.showPreferences())
            self.menuPlay.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE))
            self.menuStop.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_STOP))
            self.menuNext.connect('activate',     lambda btn: modules.postMsg(consts.MSG_CMD_NEXT))
            self.menuPrevious.connect('activate', lambda btn: modules.postMsg(consts.MSG_CMD_PREVIOUS))
            self.menuPause.connect('activate',    lambda btn: modules.postMsg(consts.MSG_CMD_TOGGLE_PAUSE))
            self.popupMenu.show_all()

        # Enable only relevant menu entries
        self.menuStop.set_sensitive(self.isPlaying)
        self.menuNext.set_sensitive(self.isPlaying and self.trackHasNext)
        self.menuPause.set_sensitive(self.isPlaying and not self.isPaused)
        self.menuPrevious.set_sensitive(self.isPlaying and self.trackHasPrev)
        self.menuPlay.set_sensitive((not (self.isPlaying or self.emptyTracklist)) or self.isPaused)

        self.popupMenu.popup(None, None, gtk.status_icon_position_menu, button, time, statusIcon)
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:29,代码来源:StatusIcon.py


示例12: removeSelectedLibraries

    def removeSelectedLibraries(self, list):
        """ Remove all selected libraries """
        import shutil

        from gui import questionMsgBox

        if list.getSelectedRowsCount() == 1:
            remark   = _('You will be able to recreate this library later on if you wish so.')
            question = _('Remove the selected library?')
        else:
            remark   = _('You will be able to recreate these libraries later on if you wish so.')
            question = _('Remove all selected libraries?')

        if questionMsgBox(self.cfgWindow, question, '%s %s' % (_('Your media files will not be removed.'), remark)) == gtk.RESPONSE_YES:
            for row in list.getSelectedRows():
                libName = row[0]

                if self.currLib == libName:
                    self.currLib = None

                # Remove the library from the disk
                libPath = os.path.join(ROOT_PATH, libName)
                if isdir(libPath):
                    shutil.rmtree(libPath)
                # Remove the corresponding explorer
                modules.postMsg(consts.MSG_CMD_EXPLORER_REMOVE, {'modName': MOD_L10N, 'expName': libName})
                del self.libraries[libName]
                # Remove tree states
                self.removeTreeStates(libName)
            # Clean up the listview
            list.removeSelectedRows()
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:31,代码来源:Library.py


示例13: onSearch

    def onSearch(self, query):
        self.should_stop = False
        self.found_something = False

        # Transform whitespace-separated query into OR-regex.
        regex = re.compile('|'.join(tools.get_pattern(word)
                           for word in query.split()), re.IGNORECASE)

        for dir in self.get_search_paths() + [consts.dirBaseUsr]:
            # Check if search has been aborted during filtering
            if self.should_stop:
                break

            # Only search in home folder if we haven't found anything yet.
            if dir == consts.dirBaseUsr and self.found_something:
                break

            results = self.search_dir(dir, query)

            # Check if search has been aborted during searching
            if results is None or self.should_stop:
                break

            dirs, files = self.filter_results(results, dir, regex)
            if not self.should_stop and (dirs or files):
                self.found_something = True
                modules.postMsg(consts.MSG_EVT_SEARCH_APPEND,
                                {'results': (dirs, files), 'query': query})

        modules.postMsg(consts.MSG_EVT_SEARCH_END)
开发者ID:csryan,项目名称:pogo,代码行数:30,代码来源:Search.py


示例14: onScroll

    def onScroll(self, statusIcon, scrollEvent):
        """ The mouse is scrolled on the status icon """
        if scrollEvent.direction == gtk.gdk.SCROLL_UP or scrollEvent.direction == gtk.gdk.SCROLL_RIGHT:
            self.volume = min(1.0, self.volume + 0.05)
        else:
            self.volume = max(0.0, self.volume - 0.05)

        modules.postMsg(consts.MSG_CMD_SET_VOLUME, {'value': self.volume})
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:8,代码来源:StatusIcon.py


示例15: playPaths

    def playPaths(self, tree, paths, replace):
        """
            Replace/extend the tracklist
            If the list 'paths' is None, use the current selection
        """
        tracks = self.__getTracksFromPaths(tree, paths)

        if replace: modules.postMsg(consts.MSG_CMD_TRACKLIST_SET, {'tracks': tracks, 'playNow': True})
        else:       modules.postMsg(consts.MSG_CMD_TRACKLIST_ADD, {'tracks': tracks})
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:9,代码来源:Library.py


示例16: onAppStarted

    def onAppStarted(self):
        """ This is the real initialization function, called when the module has been loaded """
        wTree                  = tools.prefs.getWidgetsTree()
        self.playtime          = 0
        self.bufferedTrack     = None
        self.previousTracklist = None
        # Retrieve widgets
        self.window     = wTree.get_object('win-main')
        self.btnClear   = wTree.get_object('btn-tracklistClear')
        self.btnRepeat  = wTree.get_object('btn-tracklistRepeat')
        self.btnShuffle = wTree.get_object('btn-tracklistShuffle')
        self.btnClear.set_sensitive(False)
        self.btnShuffle.set_sensitive(False)
        # Create the list and its columns
        txtLRdr   = gtk.CellRendererText()
        txtRRdr   = gtk.CellRendererText()
        pixbufRdr = gtk.CellRendererPixbuf()
        txtRRdr.set_property('xalign', 1.0)

        # 'columns-visibility' may be broken, we should not use it (#311293)
        visible = tools.prefs.get(__name__, 'columns-visibility-2', PREFS_DEFAULT_COLUMNS_VISIBILITY)
        for (key, value) in PREFS_DEFAULT_COLUMNS_VISIBILITY.iteritems():
            if key not in visible:
                visible[key] = value

        columns = (('#',           [(pixbufRdr, gtk.gdk.Pixbuf), (txtRRdr, TYPE_INT)], (ROW_NUM, ROW_TIT),                            False, visible[COL_TRCK_NUM]),
                   (_('Title'),    [(txtLRdr, TYPE_STRING)],                           (ROW_TIT,),                                    True,  visible[COL_TITLE]),
                   (_('Artist'),   [(txtLRdr, TYPE_STRING)],                           (ROW_ART, ROW_ALB, ROW_NUM, ROW_TIT),          True,  visible[COL_ARTIST]),
                   (_('Album'),    [(txtLRdr, TYPE_STRING)],                           (ROW_ALB, ROW_NUM, ROW_TIT),                   True,  visible[COL_ALBUM]),
                   (_('Length'),   [(txtRRdr, TYPE_INT)],                              (ROW_LEN,),                                    False, visible[COL_LENGTH]),
                   (_('Bit Rate'), [(txtRRdr, TYPE_STRING)],                           (ROW_BTR, ROW_ART, ROW_ALB, ROW_NUM, ROW_TIT), False, visible[COL_BITRATE]),
                   (_('Genre'),    [(txtLRdr, TYPE_STRING)],                           (ROW_GNR, ROW_ART, ROW_ALB, ROW_NUM, ROW_TIT), False, visible[COL_GENRE]),
                   (_('Date'),     [(txtLRdr, TYPE_INT)],                              (ROW_DAT, ROW_ART, ROW_ALB, ROW_NUM, ROW_TIT), False, visible[COL_DATE]),
                   (_('Filename'), [(txtLRdr, TYPE_STRING)],                           (ROW_FIL,),                                    False, visible[COL_FILENAME]),
                   (_('Path'),     [(txtLRdr, TYPE_STRING)],                           (ROW_PTH,),                                    False, visible[COL_PATH]),
                   (None,          [(None, TYPE_PYOBJECT)],                            (None,),                                       False, False))

        self.list = ExtListView(columns, sortable=True, dndTargets=consts.DND_TARGETS.values(), useMarkup=False, canShowHideColumns=True)
        self.list.get_column(1).set_cell_data_func(txtLRdr, self.__fmtColumnColor)
        self.list.get_column(4).set_cell_data_func(txtRRdr, self.__fmtLengthColumn)
        self.list.enableDNDReordering()
        wTree.get_object('scrolled-tracklist').add(self.list)
        # GTK handlers
        self.list.connect('extlistview-dnd', self.onDND)
        self.list.connect('key-press-event', self.onKeyboard)
        self.list.connect('extlistview-modified', self.onListModified)
        self.list.connect('extlistview-button-pressed', self.onButtonPressed)
        self.list.connect('extlistview-selection-changed', self.onSelectionChanged)
        self.list.connect('extlistview-column-visibility-changed', self.onColumnVisibilityChanged)
        self.btnClear.connect('clicked', lambda widget: modules.postMsg(consts.MSG_CMD_TRACKLIST_CLR))
        self.btnRepeat.connect('toggled', self.onButtonRepeat)
        self.btnShuffle.connect('clicked', lambda widget: modules.postMsg(consts.MSG_CMD_TRACKLIST_SHUFFLE))
        # Restore preferences
        self.btnRepeat.set_active(tools.prefs.get(__name__, 'repeat-status', PREFS_DEFAULT_REPEAT_STATUS))
        # Set icons
        wTree.get_object('img-repeat').set_from_icon_name('stock_repeat', gtk.ICON_SIZE_BUTTON)
        wTree.get_object('img-shuffle').set_from_icon_name('stock_shuffle', gtk.ICON_SIZE_BUTTON)
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:57,代码来源:Tracklist.py


示例17: onAddFolder

    def onAddFolder(self, btn):
        """ Let the user add a new folder to the list """
        result = selectPath.SelectPath(MOD_L10N, self.cfgWin, self.folders.keys()).run()

        if result is not None:
            name, path = result
            self.folders[name] = path
            self.populateFolderList()
            modules.postMsg(consts.MSG_CMD_EXPLORER_ADD, {'modName': MOD_L10N, 'expName': name, 'icon': None, 'widget': self.scrolled})
开发者ID:gabrielmcf,项目名称:biel-audio-player,代码行数:9,代码来源:FileExplorer.py


示例18: renameFolder

    def renameFolder(self, oldName, newName):
        """ Rename a folder """
        self.folders[newName] = self.folders[oldName]
        del self.folders[oldName]

        if oldName in self.treeState:
            self.treeState[newName] = self.treeState[oldName]
            del self.treeState[oldName]

        modules.postMsg(consts.MSG_CMD_EXPLORER_RENAME, {'modName': MOD_L10N, 'expName': oldName, 'newExpName': newName})
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:10,代码来源:FileExplorer.py


示例19: crop

    def crop(self):
        """ Remove the unselected tracks """
        hadMark                = self.list.hasMark()
        self.previousTracklist = [row[ROW_TRK] for row in self.list]

        self.playtime = sum([row[ROW_LEN] for row in self.list.iterSelectedRows()])
        self.list.cropSelectedRows()

        if hadMark and not self.list.hasMark():
            modules.postMsg(consts.MSG_CMD_STOP)
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:10,代码来源:Tracklist.py


示例20: play

    def play(self, replace, path=None):
        """
            Replace/extend the tracklist
            If 'path' is None, use the current selection
        """
        if path is None: tracks = media.getTracks([row[ROW_FULLPATH] for row in self.tree.getSelectedRows()], self.addByFilename, not self.showHiddenFiles)
        else:            tracks = media.getTracks([self.tree.getRow(path)[ROW_FULLPATH]], self.addByFilename, not self.showHiddenFiles)

        if replace: modules.postMsg(consts.MSG_CMD_TRACKLIST_SET, {'tracks': tracks, 'playNow': True})
        else:       modules.postMsg(consts.MSG_CMD_TRACKLIST_ADD, {'tracks': tracks, 'playNow': False})
开发者ID:Nenuphar,项目名称:decibel-audio-player,代码行数:10,代码来源:FileExplorer.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python modules.Mixin类代码示例发布时间:2022-05-27
下一篇:
Python modules.load函数代码示例发布时间: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