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


Python QLiveLib.ensureNFD方法代码示例

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


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

示例1: newRecent

# 需要导入模块: import QLiveLib [as 别名]
# 或者: from QLiveLib import ensureNFD [as 别名]
 def newRecent(self, file):
     filename = QLiveLib.ensureNFD(OPEN_RECENT_PATH)
     try:
         f = codecs.open(filename, "r", encoding="utf-8")
         lines = [line.replace("\n", "") for line in f.readlines()]
         f.close()
     except:
         lines = []
     if not file in lines:
         f = codecs.open(filename, "w", encoding="utf-8")
         lines.insert(0, file)
         if len(lines) > 20:
             lines = lines[0:20]
         for line in lines:
             f.write(line + '\n')
         f.close()
     subId = 2000
     if lines != []:
         for item in self.submenu1.GetMenuItems():
             self.submenu1.DeleteItem(item)
         for file in lines:
             self.submenu1.Append(subId, QLiveLib.toSysEncoding(file))
             subId += 1
开发者ID:lucasParis,项目名称:QLive,代码行数:25,代码来源:MainWindow.py

示例2: __init__

# 需要导入模块: import QLiveLib [as 别名]
# 或者: from QLiveLib import ensureNFD [as 别名]
    def __init__(self, pos, size):
        wx.Frame.__init__(self, None, pos=pos, size=size)
        
        self.SetMinSize((600, 400))
        self.SetTitle("QLive Session")

        # Status bar, the third filed is unused yet.
        self.status = self.CreateStatusBar(3)
        self.status.SetStatusWidths([100, 100, -1])
        self.status.SetStatusText("CPU: 0.0 %", 0)
        self.status.SetStatusText("MEM: 0.00 Mb", 1)

        # Retrieve the current process
        self.process = psutil.Process()

        # Start a timer to update CPU and memory usage
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.updateUsage, self.timer)
        self.timer.Start(1000)

        self.audioServer = AudioServer()
        QLiveLib.setVar("AudioServer", self.audioServer)

        self.saveState = None

        menubar = wx.MenuBar()
        menu1 = wx.Menu()
        menu1.Append(wx.ID_NEW, "New\tCtrl+N")
        self.Bind(wx.EVT_MENU, self.onNew, id=wx.ID_NEW)        
        menu1.Append(wx.ID_OPEN, "Open\tCtrl+O")
        self.Bind(wx.EVT_MENU, self.onLoad, id=wx.ID_OPEN)
        self.submenu1 = wx.Menu()
        ID_OPEN_RECENT = 2000
        recentFiles = []
        filename = QLiveLib.ensureNFD(OPEN_RECENT_PATH)
        if os.path.isfile(filename):
            f = codecs.open(filename, "r", encoding="utf-8")
            for line in f.readlines():
                recentFiles.append(line.replace("\n", ""))
            f.close()
        if recentFiles:
            for file in recentFiles:
                self.submenu1.Append(ID_OPEN_RECENT, file)
                self.Bind(wx.EVT_MENU, self.openRecent, id=ID_OPEN_RECENT)
                ID_OPEN_RECENT += 1
        menu1.AppendMenu(1999, "Open Recent...", self.submenu1)
        menu1.AppendSeparator()
        menu1.Append(wx.ID_CLOSE, "Close\tCtrl+W")
        self.Bind(wx.EVT_MENU, self.onClose, id=wx.ID_CLOSE)        
        menu1.Append(wx.ID_SAVE, "Save\tCtrl+S")
        self.Bind(wx.EVT_MENU, self.onSave, id=wx.ID_SAVE)        
        menu1.Append(wx.ID_SAVEAS, "Save As...\tShift+Ctrl+S")
        self.Bind(wx.EVT_MENU, self.onSaveAs, id=wx.ID_SAVEAS)
        if PLATFORM != "darwin":
            menu1.AppendSeparator()
        prefItem = menu1.Append(wx.ID_PREFERENCES, "Preferences...\tCtrl+;")
        self.Bind(wx.EVT_MENU, self.openPrefs, prefItem)
        if PLATFORM != "darwin":
            menu1.AppendSeparator()
        quitItem = menu1.Append(wx.ID_EXIT, "Quit\tCtrl+Q")
        self.Bind(wx.EVT_MENU, self.OnClose, quitItem)
        menubar.Append(menu1, 'File')

        menu2 = wx.Menu()
        menu2.Append(NEW_TRACK_ID, "Add Track\tCtrl+T")
        self.Bind(wx.EVT_MENU, self.onNewTrack, id=NEW_TRACK_ID)        
        menu2.Append(DELETE_TRACK_ID, "Delete Track\tShift+Ctrl+D")
        self.Bind(wx.EVT_MENU, self.onDeleteTrack, id=DELETE_TRACK_ID)        
        menubar.Append(menu2, 'Tracks')

        menu3 = wx.Menu()
        menu3.AppendCheckItem(LINK_STEREO_ID, "Link Mixer Sliders\tCtrl+L")
        self.Bind(wx.EVT_MENU, self.onLinkSliders, id=LINK_STEREO_ID)        
        menubar.Append(menu3, 'Mixer')

        self.SetMenuBar(menubar)

        tabId = wx.NewId()
        self.prevId = wx.NewId()
        self.nextId = wx.NewId()
        accel_tbl = wx.AcceleratorTable([(wx.ACCEL_NORMAL,  wx.WXK_TAB, tabId),
                                        (wx.ACCEL_NORMAL,  wx.WXK_LEFT, self.prevId),
                                        (wx.ACCEL_NORMAL,  wx.WXK_RIGHT, self.nextId)])
        self.SetAcceleratorTable(accel_tbl)
        
        self.Bind(wx.EVT_MENU, self.onTabulate, id=tabId)
        self.Bind(wx.EVT_MENU, self.onMoveCue, id=self.prevId, id2=self.nextId)

        self.mainPanel = wx.Panel(self, style=wx.SUNKEN_BORDER)
        self.mainPanel.SetBackgroundColour(BACKGROUND_COLOUR)

        self.audioMixer = AudioMixer()
        QLiveLib.setVar("AudioMixer", self.audioMixer)

        self.controlPanel = ControlPanel(self.mainPanel)
        QLiveLib.setVar("ControlPanel", self.controlPanel)
        csize = self.controlPanel.GetSize()
        
        self.cues = CuesPanel(self.mainPanel, size=(csize[0], 1000))
        QLiveLib.setVar("CuesPanel", self.cues)
#.........这里部分代码省略.........
开发者ID:lucasParis,项目名称:QLive,代码行数:103,代码来源:MainWindow.py

示例3: __init__

# 需要导入模块: import QLiveLib [as 别名]
# 或者: from QLiveLib import ensureNFD [as 别名]
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        self.reinit_server = False

        # Setting audio driver
        audioDriverDefault = QLiveLib.getVar("audio")
        audioDriverLabel = wx.StaticText(self, -1, "Audio driver:")
        self.audioDriverCB = wx.ComboBox(self, -1, audioDriverDefault,
                                         wx.DefaultPosition, wx.DefaultSize,
                                         AUDIO_DRIVERS,
                                         wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.audioDriverCB.Bind(wx.EVT_COMBOBOX, self.setAudioDriver,
                                self.audioDriverCB)

        # Portaudio: Audio Input devices
        self.inputDeviceLabel = wx.StaticText(self, -1,
                                              "Audio Input (portaudio):")

        availableAudioIns = []
        for d in QLiveLib.getVar("availableAudioInputs"):
            availableAudioIns.append(QLiveLib.ensureNFD(d))
        initInput = QLiveLib.ensureNFD(QLiveLib.getVar("audioInput"))
        self.inputDeviceCB = wx.ComboBox(self, -1, initInput,
                                         wx.DefaultPosition, wx.DefaultSize,
                                         availableAudioIns,
                                         wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.inputDeviceCB.Bind(wx.EVT_COMBOBOX, self.setInputDevice,
                                self.inputDeviceCB)

        # Portaudio: Audio Output devices
        self.outputDeviceLabel = wx.StaticText(self, -1,
                                               "Audio Output (portaudio):")
        availableAudioOuts = []
        for d in QLiveLib.getVar("availableAudioOutputs"):
            availableAudioOuts.append(QLiveLib.ensureNFD(d))
        initOutput = QLiveLib.ensureNFD(QLiveLib.getVar("audioOutput"))
        self.outputDeviceCB = wx.ComboBox(self, -1, initOutput,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          availableAudioOuts,
                                          wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.outputDeviceCB.Bind(wx.EVT_COMBOBOX, self.setOutputDevice,
                                 self.outputDeviceCB)

        # First physical input device
        self.firstPhysicalInputLabel = wx.StaticText(self, -1,
                                                     "First Physical Input:")

        initPysicalInput = str(QLiveLib.getVar("defaultFirstInput"))
        self.firstPhysicalInputCB = wx.ComboBox(self, -1, initPysicalInput,
                                            wx.DefaultPosition,
                                            wx.DefaultSize,
                                            [str(x) for x in range(36)],
                                            wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.firstPhysicalInputCB.Bind(wx.EVT_COMBOBOX,
                                       self.setFirstPhysicalInput,
                                       self.firstPhysicalInputCB)

        # First physical output device
        self.firstPhysicalOutputLabel = wx.StaticText(self, -1,
                                                      "First Physical Output:")

        initPysicalOutput = str(QLiveLib.getVar("defaultFirstOutput"))
        self.firstPhysicalOutputCB = wx.ComboBox(self, -1, initPysicalOutput,
                                             wx.DefaultPosition,
                                             wx.DefaultSize,
                                             [str(x) for x in range(36)],
                                             wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.firstPhysicalOutputCB.Bind(wx.EVT_COMBOBOX,
                                        self.setFirstPhysicalOutput,
                                        self.firstPhysicalOutputCB)

        # Setting buffer size
        bufferSizeDefault = QLiveLib.getVar("bufferSize")
        bufferSizeLabel = wx.StaticText(self, -1, "Buffer size:")
        self.bufferSizeCB = wx.ComboBox(self, -1, bufferSizeDefault,
                                        wx.DefaultPosition, wx.DefaultSize,
                                        BUFFER_SIZES,
                                        wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.bufferSizeCB.Bind(wx.EVT_COMBOBOX, self.setBufferSize,
                               self.bufferSizeCB)

        # Setting sampling rate
        samplingRateDefault = QLiveLib.getVar("sr")
        samplingRateLabel = wx.StaticText(self, -1, "Sampling rate:")
        self.samplingRateCB = wx.ComboBox(self, -1, samplingRateDefault,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          SAMPLE_RATES,
                                          wx.CB_READONLY|wx.TE_PROCESS_ENTER)
        self.samplingRateCB.Bind(wx.EVT_COMBOBOX, self.setSamplingRate,
                                 self.samplingRateCB)

        # Setting duplex True/False
        duplexDefault = QLiveLib.getVar("duplex")
        duplexLabel = wx.StaticText(self, -1, "Duplex:")
        self.duplexCB = wx.CheckBox(self, -1, "", style=wx.ALIGN_LEFT)
        self.duplexCB.SetValue(bool(int(QLiveLib.getVar("duplex"))))
        self.duplexCB.Bind(wx.EVT_CHECKBOX, self.setDuplex, self.duplexCB)

        # Main box
#.........这里部分代码省略.........
开发者ID:belangeo,项目名称:qlive,代码行数:103,代码来源:PreferencePanel.py


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