Exemplo n.º 1
0
    def bt_LoadVirtualClick(self, event):
        filters = guiFunctions.configMe("general", "playlist_extensions")
        defDir = guiFunctions.configMe("general", "default_sp_path")
        wildcards = "Virtual/Work Playlists (" + filters + ")|" + filters.replace(
            " ", ";") + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog(None,
                               message='Select Virtual/Works Playlist File...',
                               defaultDir=defDir,
                               wildcard=wildcards,
                               style=wxOPEN)

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                # All the hard work goes here...
                file = open(selection)
                print file.read()
                guiFunctions.statusText(
                    self, "Playlist: " + selection + " selected...")
        dialog.Destroy()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 2
0
    def browseDB(self, event):
        filters = guiFunctions.configMe("general", "database_extensions")
        wildcards = "Sonospy Database (" + filters + ")|" + filters.replace(
            " ", ";") + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog(None,
                               message='Select database...',
                               defaultDir=guiFunctions.configMe(
                                   "general", "default_database_path"),
                               wildcard=wildcards,
                               style=wxOPEN)

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                basename, extension = os.path.splitext(selection)
                event.GetEventObject().tc.Value = basename
                event.GetEventObject().ck.Label = selection
                event.GetEventObject().ck.Enable()
                event.GetEventObject().ck.Value = True
                guiFunctions.statusText(
                    self, "Database: " + selection + " selected...")
        dialog.Destroy()
        self.Update()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 3
0
    def bt_TargetDatabaseClick(self, event):
        filters = guiFunctions.configMe("general", "database_extensions")
        wildcards = "Sonospy Database (" + filters + ")|" + filters.replace(
            " ", ";") + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog(None,
                               message='Select Target Database File...',
                               defaultDir=guiFunctions.configMe(
                                   "general", "default_database_path"),
                               wildcard=wildcards,
                               style=wxOPEN)

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                self.tc_TargetDatabase.Value = selection
                guiFunctions.statusText(
                    self, "Target Database: " + selection + " selected...")
        dialog.Destroy()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 4
0
    def browseDB(self, event):
        filters = guiFunctions.configMe("general", "database_extensions")
        wildcards = "Sonospy Database (" + filters + ")|" + filters.replace(" ", ";") + "|All files (*.*)|*.*"
        
        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog ( None, message = 'Select database...', defaultDir=guiFunctions.configMe("general", "default_database_path"), wildcard = wildcards, style = wxOPEN)

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                basename, extension = os.path.splitext(selection)
                event.GetEventObject().tc.Value = basename
                event.GetEventObject().ck.Label = selection
                event.GetEventObject().ck.Enable()
                event.GetEventObject().ck.Value = True
                guiFunctions.statusText(self, "Database: " + selection + " selected...")
        dialog.Destroy()
        self.Update()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 5
0
    def bt_SavePlaylistClick(self, event):
        dataToSave = "type=" + self.combo_typeOptions.GetValue()
        dataToSave += "\n" + "title=" + self.tc_Title.Value
        dataToSave += "\n" + "artist=" + self.tc_Artist.Value
        dataToSave += "\n" + "albumartist=" + self.tc_AlbumArtist.Value
        dataToSave += "\n" + "composer=" + self.tc_Composer.Value
        dataToSave += "\n" + "year=" + self.tc_Year.Value
        dataToSave += "\n" + "genre=" + self.tc_Genre.Value
        dataToSave += "\n" + "cover=" + self.tc_Cover.Value
        dataToSave += "\n" + "discnumber=" + self.tc_DiscNumber.Value
        dataToSave += "\n" + "inserted="
        dataToSave += "\n" + "created="
        dataToSave += "\n" + "lastmodified="
        dataToSave += "\n\n"
        dataToSave += self.tc_FilesFolders.Value

        dialog = wx.FileDialog(self, message='Choose a file', defaultDir=guiFunctions.configMe("general", "default_sp_path"), wildcard="Playlist Files (*.sp)|*.sp", style=wx.SAVE|wx.OVERWRITE_PROMPT)
        if dialog.ShowModal() == wx.ID_OK:
            savefile = dialog.GetFilename()
            basename, extension = os.path.splitext(savefile)
            if extension == "":
                extension = ".sp"
            savefile = basename + extension
            savedir = dialog.GetDirectory()
            saveMe=open(os.path.join(savedir, savefile),'w')
            print os.path.join(savedir, savefile)
            saveMe.write(dataToSave)
            saveMe.close()
            guiFunctions.statusText(self, "SP: " + savefile + " saved...")
Exemplo n.º 6
0
    def bt_FoldersToScanAddClick(self, event):
        dialog = wx.DirDialog(self, "Add a Directory...", defaultPath=guiFunctions.configMe("general", "default_music_path"), style=wx.DD_DEFAULT_STYLE)
        if dialog.ShowModal() == wx.ID_OK:
            if self.tc_FilesFolders.Value == "":
                self.tc_FilesFolders.AppendText("%s" % dialog.GetPath())
            else:
                self.tc_FilesFolders.AppendText("\n%s" % dialog.GetPath())

        dialog.Destroy()
        guiFunctions.statusText(self, "Folder: " + "%s" % dialog.GetPath() + " added.")
Exemplo n.º 7
0
 def bt_FilesToScanAddClick(self, event):
     dialog = wx.FileDialog(self, "Add Track(s)...", defaultDir=guiFunctions.configMe("general", "default_music_path"), style=wx.DD_DEFAULT_STYLE|wx.FD_MULTIPLE)
     if dialog.ShowModal() == wxID_OK:
         selected = dialog.GetFilenames()
         for selection in selected:
             if self.tc_FilesFolders.Value == "":
                 self.tc_FilesFolders.AppendText(selection)
             else:
                 self.tc_FilesFolders.AppendText("\n" + selection)
     dialog.Destroy()
     guiFunctions.statusText(self, "Tracks added.")
Exemplo n.º 8
0
    def bt_LoadVirtualClick(self, event):
        filters = guiFunctions.configMe("general", "playlist_extensions")
        defDir = guiFunctions.configMe("general", "default_sp_path")
        wildcards = "Virtual/Work Playlists (" + filters + ")|" + filters.replace(" ", ";") + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog ( None, message = 'Select Virtual/Works Playlist File...', defaultDir=defDir, wildcard = wildcards, style = wxOPEN)

        
        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                # All the hard work goes here...
                file = open(selection)
                print file.read()
                guiFunctions.statusText(self, "Playlist: " + selection + " selected...")
        dialog.Destroy()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 9
0
    def bt_TargetDatabaseClick(self, event):
        filters = guiFunctions.configMe("general", "database_extensions")
        wildcards = "Sonospy Database (" + filters + ")|" + filters.replace(" ", ";") + "|All files (*.*)|*.*"
        
        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)
        
        dialog = wx.FileDialog ( None, message = 'Select Target Database File...', wildcard = wildcards, style = wxOPEN )

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                self.tc_TargetDatabase.Value = selection
        dialog.Destroy()
        guiFunctions.statusText(self, "Target Database: " + selection + " selected...")

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 10
0
    def bt_INIClick(self, event):
        filters = "*.ini"
        wildcards = "INIFiles (" + filters + ")|" + filters + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog ( None, message = 'Select INI File...', defaultDir=guiFunctions.configMe("general", "default_ini_path"), wildcard = wildcards, style = wxOPEN)

        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetFilenames()
            for selection in selected:
                self.tc_INI.Value = selection
                guiFunctions.statusText(self, "INI File: " + selection + " selected...")
        dialog.Destroy()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 11
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(7, 5)
        self.currentDirectory = os.getcwd()
        sizerIndexX = 0

        # [0] Main Database Text, Entry and Browse Button --------------------------
        label_MainDatabase = wx.StaticText(panel, label="Source Database:")
        help_MainDatabase = "Select the source database to extract from.  This is most commonly your main database/index. Enter it into the text field, or click BROWSE to select a .db file."
        label_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))
        sizer.Add(label_MainDatabase,
                  pos=(sizerIndexX, 0),
                  flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.TOP,
                  border=10)

        self.tc_MainDatabase = wx.TextCtrl(panel)
        self.tc_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))
        self.tc_MainDatabase.Value = guiFunctions.configMe(
            "extract", "database_source")
        self.bt_MainDatabase = wx.Button(panel, label="Browse...")
        self.bt_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))

        sizer.Add(self.tc_MainDatabase,
                  pos=(sizerIndexX, 1),
                  span=(1, 4),
                  flag=wx.TOP | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_MainDatabase,
                  pos=(sizerIndexX, 5),
                  flag=wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL
                  | wx.ALIGN_RIGHT,
                  border=10)

        self.bt_MainDatabase.Bind(wx.EVT_BUTTON, self.bt_MainDatabaseClick,
                                  self.bt_MainDatabase)
        # --------------------------------------------------------------------------
        # [1] Target Database Label, Entry and Browse Button -----------------------
        sizerIndexX += 1

        # Create the label, text control and button
        label_TargetDatabase = wx.StaticText(panel, label="Target Database:")
        help_TargetDatabase = "Select the database you wish to create or update.  Enter it into the text field, or click BROWSE to select a previously created .db file."
        label_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))

        self.tc_TargetDatabase = wx.TextCtrl(panel)
        self.tc_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))
        self.tc_TargetDatabase.Value = guiFunctions.configMe(
            "extract", "database_target")

        self.bt_TargetDatabase = wx.Button(panel, label="Browse...")
        self.bt_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))

        # Add them to the sizer.
        sizer.Add(label_TargetDatabase,
                  pos=(sizerIndexX, 0),
                  flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.TOP,
                  border=10)
        sizer.Add(self.tc_TargetDatabase,
                  pos=(sizerIndexX, 1),
                  span=(1, 4),
                  flag=wx.TOP | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_TargetDatabase,
                  pos=(sizerIndexX, 5),
                  flag=wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL
                  | wx.ALIGN_LEFT,
                  border=10)

        # Bind the button to a click event
        self.bt_TargetDatabase.Bind(wx.EVT_BUTTON, self.bt_TargetDatabaseClick,
                                    self.bt_TargetDatabase)
        # --------------------------------------------------------------------------
        # [2] Options Static Box ---------------------------------------------------

        # Create static box
        self.sb_ExtractOptions = wx.StaticBox(panel,
                                              label="Options for Extract",
                                              size=(100, 100))
        sbs_ExtractOptions = wx.StaticBoxSizer(self.sb_ExtractOptions,
                                               wx.VERTICAL)
        OptionBoxSizer = wx.GridBagSizer(7, 9)

        # Create the options
        logicList = ['<', '<=', '=', '>', '>=']

        optSizerIndexX = 0

        # Created
        label_OptionsCreated = wx.StaticText(panel, label="Created:")
        help_Created = "Extract files to the Target Database based on the CREATION DATE of the music files in the Source Database."
        label_OptionsCreated.SetToolTip(wx.ToolTip(help_Created))

        self.combo_LogicalCreated = wx.ComboBox(panel, 1, "", (25, 25),
                                                (60, 25), logicList,
                                                wx.CB_DROPDOWN)
        self.combo_LogicalCreated.SetToolTip(wx.ToolTip(help_Created))
        self.combo_LogicalCreated.Select(
            guiFunctions.configMe("extract", "createdidx", integer=True))

        self.tc_DaysAgoCreated = wx.TextCtrl(panel)
        self.tc_DaysAgoCreated.SetToolTip(wx.ToolTip(help_Created))
        self.tc_DaysAgoCreated.Value = guiFunctions.configMe(
            "extract", "createdVal")

        label_DaysAgoCreated = wx.StaticText(panel, label="days ago")
        label_DaysAgoCreated.SetToolTip(wx.ToolTip(help_Created))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsCreated,
                           pos=(optSizerIndexX, 0),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalCreated,
                           pos=(optSizerIndexX, 1),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                           border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoCreated,
                           pos=(optSizerIndexX, 2),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)
        OptionBoxSizer.Add(label_DaysAgoCreated,
                           pos=(optSizerIndexX, 3),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        # Bit-rate
        label_OptionsBitrate = wx.StaticText(panel, label="Bitrate:")
        help_Bitrate = "Extract files to the Target Database based on the BIT-RATE of the music files in the Source Database."
        label_OptionsBitrate.SetToolTip(wx.ToolTip(help_Bitrate))

        self.combo_LogicalBitrate = wx.ComboBox(panel, 1, "", (25, 25),
                                                (60, 25), logicList,
                                                wx.CB_DROPDOWN)
        self.combo_LogicalBitrate.Select(
            guiFunctions.configMe("extract", "bitrateIdx", integer=True))
        self.combo_LogicalBitrate.SetToolTip(wx.ToolTip(help_Bitrate))

        self.tc_Bitrate = wx.TextCtrl(panel)
        self.tc_Bitrate.SetToolTip(wx.ToolTip(help_Bitrate))
        self.tc_Bitrate.Value = guiFunctions.configMe("extract", "bitrateVal")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsBitrate,
                           pos=(optSizerIndexX, 4),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalBitrate,
                           pos=(optSizerIndexX, 5),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.tc_Bitrate,
                           pos=(optSizerIndexX, 6),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                           border=10)

        # Inserted
        optSizerIndexX += 1
        label_OptionsInserted = wx.StaticText(panel, label="Inserted:")
        help_Inserted = "Extract files to the Target Database based on the INSERTED DATE (i.e. when the file was first added to the database) of the entries in the Source Database."
        label_OptionsInserted.SetToolTip(wx.ToolTip(help_Inserted))

        self.combo_LogicalInserted = wx.ComboBox(panel, 1, "", (25, 25),
                                                 (60, 25), logicList,
                                                 wx.CB_DROPDOWN)
        self.combo_LogicalInserted.SetToolTip(wx.ToolTip(help_Inserted))
        self.combo_LogicalInserted.Select(
            guiFunctions.configMe("extract", "insertedIdx", integer=True))
        self.tc_DaysAgoInserted = wx.TextCtrl(panel)
        self.tc_DaysAgoInserted.SetToolTip(wx.ToolTip(help_Inserted))
        self.tc_DaysAgoInserted.Value = guiFunctions.configMe(
            "extract", "insertedVal")

        label_DaysAgoInserted = wx.StaticText(panel, label="days ago")
        label_DaysAgoInserted.SetToolTip(wx.ToolTip(help_Inserted))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsInserted,
                           pos=(optSizerIndexX, 0),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalInserted,
                           pos=(optSizerIndexX, 1),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                           border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoInserted,
                           pos=(optSizerIndexX, 2),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)
        OptionBoxSizer.Add(label_DaysAgoInserted,
                           pos=(optSizerIndexX, 3),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        # Genre
        label_OptionsGenre = wx.StaticText(panel, label="Genre:")
        help_Genre = "Extract files to the Target Database based on the GENRE tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsGenre.SetToolTip(wx.ToolTip(help_Genre))

        self.tc_Genre = wx.TextCtrl(panel)
        self.tc_Genre.SetToolTip(wx.ToolTip(help_Genre))
        self.tc_Genre.Value = guiFunctions.configMe("extract", "genre")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsGenre,
                           pos=(optSizerIndexX, 4),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.tc_Genre,
                           pos=(optSizerIndexX, 5),
                           span=(1, 2),
                           flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND
                           | wx.ALIGN_CENTER_VERTICAL,
                           border=0)

        # Modified
        optSizerIndexX += 1
        label_OptionsModified = wx.StaticText(panel, label="Modified:")
        help_Modified = "Extract files to the Target Database based on the LAST MODIFIED DATE of the music files in the Source Database."
        label_OptionsModified.SetToolTip(wx.ToolTip(help_Modified))

        self.combo_LogicalModified = wx.ComboBox(panel, 1, "", (25, 25),
                                                 (60, 25), logicList,
                                                 wx.CB_DROPDOWN)
        self.combo_LogicalModified.SetToolTip(wx.ToolTip(help_Modified))
        self.combo_LogicalModified.Select(
            guiFunctions.configMe("extract", "modifiedidx", integer=True))

        self.tc_DaysAgoModified = wx.TextCtrl(panel)
        self.tc_DaysAgoModified.SetToolTip(wx.ToolTip(help_Modified))

        label_DaysAgoModified = wx.StaticText(panel, label="days ago")
        label_DaysAgoModified.SetToolTip(wx.ToolTip(help_Modified))
        self.tc_DaysAgoModified.Value = guiFunctions.configMe(
            "extract", "modifiedval")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsModified,
                           pos=(optSizerIndexX, 0),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalModified,
                           pos=(optSizerIndexX, 1),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                           border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoModified,
                           pos=(optSizerIndexX, 2),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)
        OptionBoxSizer.Add(label_DaysAgoModified,
                           pos=(optSizerIndexX, 3),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        # Artist
        label_OptionsArtist = wx.StaticText(panel, label="Artist:")
        help_Artist = "Extract files to the Target Database based on the ARTIST tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsArtist.SetToolTip(wx.ToolTip(help_Artist))

        self.tc_Artist = wx.TextCtrl(panel)
        self.tc_Artist.SetToolTip(wx.ToolTip(help_Artist))
        self.tc_Artist.Value = guiFunctions.configMe("extract", "artist")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsArtist,
                           pos=(optSizerIndexX, 4),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.tc_Artist,
                           pos=(optSizerIndexX, 5),
                           span=(1, 2),
                           flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND
                           | wx.ALIGN_CENTER_VERTICAL,
                           border=0)

        # Accessed
        optSizerIndexX += 1
        label_OptionsAccessed = wx.StaticText(panel, label="Accessed:")
        help_Accessed = "Extract files to the Target Database based on the LAST ACCESSED DATE of the music files in the Source Database."
        label_OptionsAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        self.combo_LogicalAccessed = wx.ComboBox(panel, 1, "", (25, 25),
                                                 (60, 25), logicList,
                                                 wx.CB_DROPDOWN)
        self.combo_LogicalAccessed.Select(
            guiFunctions.configMe("extract", "accessedIdx", integer=True))
        self.combo_LogicalAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        self.tc_DaysAgoAccessed = wx.TextCtrl(panel)
        self.tc_DaysAgoAccessed.SetToolTip(wx.ToolTip(help_Accessed))
        self.tc_DaysAgoAccessed.Value = guiFunctions.configMe(
            "extract", "accessedVal")

        label_DaysAgoAccessed = wx.StaticText(panel, label="days ago")
        label_DaysAgoAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsAccessed,
                           pos=(optSizerIndexX, 0),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalAccessed,
                           pos=(optSizerIndexX, 1),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                           border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoAccessed,
                           pos=(optSizerIndexX, 2),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)
        OptionBoxSizer.Add(label_DaysAgoAccessed,
                           pos=(optSizerIndexX, 3),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        # Composer
        label_OptionsComposer = wx.StaticText(panel, label="Composer:")
        help_Composer = "Extract files to the Target Database based on the COMPOSER tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsComposer.SetToolTip(wx.ToolTip(help_Composer))

        self.tc_Composer = wx.TextCtrl(panel)
        self.tc_Composer.SetToolTip(wx.ToolTip(help_Composer))
        self.tc_Composer.Value = guiFunctions.configMe("extract", "composer")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsComposer,
                           pos=(optSizerIndexX, 4),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.tc_Composer,
                           pos=(optSizerIndexX, 5),
                           span=(1, 2),
                           flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND
                           | wx.ALIGN_CENTER_VERTICAL,
                           border=0)

        # Last X Albums
        optSizerIndexX += 1
        label_Last = wx.StaticText(panel, label="Last:")
        help_Last = "[EXPERIMENTAL] Extract files to the Target Database based on the MOST RECENT <#> OF ALBUMS in the Source Database."
        label_Last.SetToolTip(wx.ToolTip(help_Last))

        self.tc_Last = wx.TextCtrl(panel)
        self.tc_Last.SetToolTip(wx.ToolTip(help_Last))
        self.tc_Last.Value = guiFunctions.configMe("extract", "last")

        label_Albums = wx.StaticText(panel, label="Albums")
        label_Albums.SetToolTip(wx.ToolTip(help_Last))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_Last,
                           pos=(optSizerIndexX, 0),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.tc_Last,
                           pos=(optSizerIndexX, 1),
                           span=(1, 2),
                           flag=wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)
        OptionBoxSizer.Add(label_Albums,
                           pos=(optSizerIndexX, 3),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        # Year
        label_OptionsYear = wx.StaticText(panel, label="Year:")
        help_Year = "Extract files to the Target Database based on the YEAR RECORDED tag of the music files in the Source Database."
        label_OptionsYear.SetToolTip(wx.ToolTip(help_Year))

        self.combo_LogicalYear = wx.ComboBox(panel, 1, "", (25, 25), (60, 25),
                                             logicList, wx.CB_DROPDOWN)
        self.combo_LogicalYear.Select(
            guiFunctions.configMe("extract", "yearIdx", integer=True))
        self.combo_LogicalYear.SetToolTip(wx.ToolTip(help_Year))

        self.tc_Year = wx.TextCtrl(panel)
        self.tc_Year.SetToolTip(wx.ToolTip(help_Year))
        self.tc_Year.Value = guiFunctions.configMe("extract", "yearVal")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsYear,
                           pos=(optSizerIndexX, 4),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_RIGHT,
                           border=0)
        OptionBoxSizer.Add(self.combo_LogicalYear,
                           pos=(optSizerIndexX, 5),
                           flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                           border=1)
        OptionBoxSizer.Add(self.tc_Year,
                           pos=(optSizerIndexX, 6),
                           flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL
                           | wx.ALIGN_LEFT,
                           border=0)

        sizerIndexX += 1
        OptionBoxSizer.AddGrowableCol(4)
        sbs_ExtractOptions.Add(OptionBoxSizer,
                               flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND
                               | wx.ALIGN_CENTER_VERTICAL,
                               border=10)
        sizer.Add(sbs_ExtractOptions,
                  pos=(sizerIndexX, 0),
                  span=(1, 6),
                  flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        # --------------------------------------------------------------------------
        # [3] Add Scan Options and Scan Button -------------------------------------
        sizerIndexX += 1
        self.bt_Extract = wx.Button(panel, label="Extract")
        help_Extract = "Click to start the extract process based on the options chosen above."
        self.bt_Extract.SetToolTip(wx.ToolTip(help_Extract))
        self.bt_Extract.Bind(wx.EVT_BUTTON, self.bt_ExtractClick,
                             self.bt_Extract)

        self.ck_ExtractVerbose = wx.CheckBox(panel, label="Verbose")
        help_ExtractVerbose = "Select this checkbox if you want to turn on the verbose settings during the extract."
        self.ck_ExtractVerbose.SetToolTip(wx.ToolTip(help_ExtractVerbose))
        self.ck_ExtractVerbose.Value = guiFunctions.configMe("extract",
                                                             "verbose",
                                                             bool=True)

        self.bt_SaveLog = wx.Button(panel, label="Save to Log")
        help_SaveLogToFile = "Save the log below to a file."
        self.bt_SaveLog.SetToolTip(wx.ToolTip(help_SaveLogToFile))
        self.bt_SaveLog.Bind(wx.EVT_BUTTON, self.bt_SaveLogClick,
                             self.bt_SaveLog)

        self.ck_OverwriteExisting = wx.CheckBox(panel, label="Overwrite")
        help_Overwrite = "Select this checkbox if you want to overwrite the Target Database."
        self.ck_OverwriteExisting.SetToolTip(wx.ToolTip(help_Overwrite))
        self.ck_OverwriteExisting.Value = guiFunctions.configMe("extract",
                                                                "overwrite",
                                                                bool=True)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick,
                                  self.bt_SaveDefaults)

        # ADD TO SCHEDULER TAB
        self.bt_AddSched = wx.Button(panel, label="+ Schedule")
        help_AddSched = "NOT IMPLEMENTED YET.  Add current settings to Schedule tab."
        self.bt_AddSched.SetToolTip(wx.ToolTip(help_AddSched))
        self.bt_AddSched.Bind(wx.EVT_BUTTON, self.bt_AddSchedClick,
                              self.bt_AddSched)
        self.bt_AddSched.Disable()

        sizer.Add(self.bt_Extract,
                  pos=(sizerIndexX, 0),
                  flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_SaveLog,
                  pos=(sizerIndexX, 1),
                  flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT,
                  border=10)
        sizer.Add(self.ck_ExtractVerbose,
                  pos=(sizerIndexX, 2),
                  flag=wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.ck_OverwriteExisting,
                  pos=(sizerIndexX, 3),
                  flag=wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_SaveDefaults,
                  pos=(sizerIndexX, 4),
                  flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_AddSched,
                  pos=(sizerIndexX, 5),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        # --------------------------------------------------------------------------
        # [4] Separator line ------------------------------------------------------
        sizerIndexX += 1
        hl_SepLine2 = wx.StaticLine(panel, 0, (250, 50), (300, 1))
        sizer.Add(hl_SepLine2,
                  pos=(sizerIndexX, 0),
                  span=(1, 6),
                  flag=wx.EXPAND,
                  border=10)
        # --------------------------------------------------------------------------
        # [5] Output/Log Box -------------------------------------------------------
        sizerIndexX += 1
        self.LogWindow = wx.TextCtrl(panel,
                                     -1,
                                     "",
                                     size=(100, 225),
                                     style=wx.TE_MULTILINE | wx.TE_READONLY)
        LogFont = wx.Font(7.5, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
        self.LogWindow.SetFont(LogFont)
        help_LogWindow = "Results of a extract will appear here."
        self.LogWindow.SetToolTip(wx.ToolTip(help_LogWindow))
        self.LogWindow.SetInsertionPoint(0)
        self.LogWindow.Disable()
        sizer.Add(self.LogWindow,
                  pos=(sizerIndexX, 0),
                  span=(1, 6),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        # Indicate we don't have a worker thread yet
        EVT_RESULT(self, self.onResult)
        self.worker = None

        Publisher().subscribe(self.setExtractPanel, 'setExtractPanel')

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 12
0
    def initialize(self):

        global sizer
        
        panel = self
        sizer = wx.GridBagSizer(11, 3)
        
        xIndex = 0
        yIndex = 0

    # [0] Make Header Columns --------------------------
        self.label_ProxyName = wx.StaticText(panel, label="Display Name")
        self.ck_EnableAll = wxCheckBox(panel, label="Enable All ")
        help_EnableAll = "Click here to enable or disable all the databases below."
        self.ck_EnableAll.SetToolTip(wx.ToolTip(help_EnableAll))
        self.bt_AutoPopulate = wx.Button(panel, label="Auto Populate")
        help_AutoPopulate = "Autopopulate with up to 8 found databases."
        self.bt_AutoPopulate.SetToolTip(wx.ToolTip(help_AutoPopulate))
        self.bt_AutoPopulate.Bind(wx.EVT_BUTTON, self.bt_AutoPopulateClick, self.bt_AutoPopulate)

        self.bt_Clear = wx.Button(panel, label="Clear")
        help_Clear = "Clear database fields."
        self.bt_Clear.SetToolTip(wx.ToolTip(help_Clear))
        self.bt_Clear.Bind(wx.EVT_BUTTON, self.bt_ClearClick, self.bt_Clear)

        self.ck_EnableAll.Bind(wx.EVT_CHECKBOX, self.enableAllChecks, self.ck_EnableAll)
        sizer.Add(self.label_ProxyName, pos=(xIndex, 1), flag=wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
        sizer.Add(self.ck_EnableAll, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
        sizer.Add(self.bt_AutoPopulate, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
        sizer.Add(self.bt_Clear, pos=(xIndex, 2), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.TOP|wx.ALIGN_RIGHT, border=10)


        xIndex +=1
    # --------------------------------------------------------------------------
    # [1] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine1, pos=(xIndex, 0), span=(1, 3), flag=wx.EXPAND)
        xIndex +=1

    # --------------------------------------------------------------------------
    # [2-9] Checkbox, database name and proxy name field, plus browse button
    #   [2]
        self.ck_DB1 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB1.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        
        self.tc_DB1 = wx.TextCtrl(panel)
        self.tc_DB1.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))

        self.bt_DB1 = wx.Button(self, label="Browse")
        self.bt_DB1.tc = self.tc_DB1
        self.bt_DB1.ck = self.ck_DB1

        sizer.Add(self.ck_DB1, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB1, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB1, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB1.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB1)
        self.bt_DB1.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB1)

        # Read in config
        self.ck_DB1.Value = guiFunctions.configMe("launch", "db1_check", bool=True)
        self.ck_DB1.Label =  guiFunctions.configMe("launch", "db1_dbname")
        self.tc_DB1.Value = guiFunctions.configMe("launch", "db1_proxyname")

        if self.ck_DB1.Label == "":
            self.ck_DB1.Label = "<add database>"

        if self.ck_DB1.Label == "<add database>":
            self.ck_DB1.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB1.GetId())
        list_checkboxLabel.append(self.ck_DB1.GetLabel())
        list_txtctrlID.append(self.tc_DB1.GetId())
        list_txtctrlLabel.append(self.tc_DB1.Value)

        xIndex +=1

    #   [3]
        self.ck_DB2 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB2.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB2 = wx.TextCtrl(panel)
        self.tc_DB2.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB2 = wx.Button(self, label="Browse")
        self.bt_DB2.tc = self.tc_DB2
        self.bt_DB2.ck = self.ck_DB2

        sizer.Add(self.ck_DB2, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB2, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB2, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB2.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB2)
        self.bt_DB2.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB2)

        # Read in config
        self.ck_DB2.Value = guiFunctions.configMe("launch", "db2_check", bool=True)
        self.ck_DB2.Label =  guiFunctions.configMe("launch", "db2_dbname")
        self.tc_DB2.Value = guiFunctions.configMe("launch", "db2_proxyname")

        if self.ck_DB2.Label == "":
            self.ck_DB2.Label = "<add database>"

        if self.ck_DB2.Label == "<add database>":
            self.ck_DB2.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB2.GetId())
        list_checkboxLabel.append(self.ck_DB2.GetLabel())
        list_txtctrlID.append(self.tc_DB2.GetId())
        list_txtctrlLabel.append(self.tc_DB2.Value)

        xIndex +=1

    #   [4]
        self.ck_DB3 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB3.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB3 = wx.TextCtrl(panel)
        self.tc_DB3.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB3 = wx.Button(self, label="Browse")
        self.bt_DB3.tc = self.tc_DB3
        self.bt_DB3.ck = self.ck_DB3

        sizer.Add(self.ck_DB3, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB3, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB3, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB3.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB3)
        self.bt_DB3.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB3)

        # Read in config
        self.ck_DB3.Value = guiFunctions.configMe("launch", "db3_check", bool=True)
        self.ck_DB3.Label =  guiFunctions.configMe("launch", "db3_dbname")
        self.tc_DB3.Value = guiFunctions.configMe("launch", "db3_proxyname")

        if self.ck_DB3.Label == "":
            self.ck_DB3.Label = "<add database>"

        if self.ck_DB3.Label == "<add database>":
            self.ck_DB3.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB3.GetId())
        list_checkboxLabel.append(self.ck_DB3.GetLabel())
        list_txtctrlID.append(self.tc_DB3.GetId())
        list_txtctrlLabel.append(self.tc_DB3.Value)

        xIndex +=1

    #   [5]
        self.ck_DB4 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB4.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB4 = wx.TextCtrl(panel)
        self.tc_DB4.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB4 = wx.Button(self, label="Browse")
        self.bt_DB4.tc = self.tc_DB4
        self.bt_DB4.ck = self.ck_DB4

        sizer.Add(self.ck_DB4, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB4, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB4, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB4.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB4)
        self.bt_DB4.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB4)

        # Read in config
        self.ck_DB4.Value = guiFunctions.configMe("launch", "db4_check", bool=True)
        self.ck_DB4.Label =  guiFunctions.configMe("launch", "db4_dbname")
        self.tc_DB4.Value = guiFunctions.configMe("launch", "db4_proxyname")

        if self.ck_DB4.Label == "":
            self.ck_DB4.Label = "<add database>"

        if self.ck_DB4.Label == "<add database>":
            self.ck_DB4.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB4.GetId())
        list_checkboxLabel.append(self.ck_DB4.GetLabel())
        list_txtctrlID.append(self.tc_DB4.GetId())
        list_txtctrlLabel.append(self.tc_DB4.Value)

        xIndex +=1

    #   [6]
        self.ck_DB5 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB5.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB5 = wx.TextCtrl(panel)
        self.tc_DB5.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB5 = wx.Button(self, label="Browse")
        self.bt_DB5.tc = self.tc_DB5
        self.bt_DB5.ck = self.ck_DB5

        sizer.Add(self.ck_DB5, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB5, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB5, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB5.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB5)
        self.bt_DB5.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB5)

        # Read in config
        self.ck_DB5.Value = guiFunctions.configMe("launch", "db5_check", bool=True)
        self.ck_DB5.Label =  guiFunctions.configMe("launch", "db5_dbname")
        self.tc_DB5.Value = guiFunctions.configMe("launch", "db5_proxyname")

        if self.ck_DB5.Label == "":
            self.ck_DB5.Label = "<add database>"

        if self.ck_DB5.Label == "<add database>":
            self.ck_DB5.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB5.GetId())
        list_checkboxLabel.append(self.ck_DB5.GetLabel())
        list_txtctrlID.append(self.tc_DB5.GetId())
        list_txtctrlLabel.append(self.tc_DB5.Value)

        xIndex +=1

    #   [7]
        self.ck_DB6 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB6.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB6 = wx.TextCtrl(panel)
        self.tc_DB6.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB6 = wx.Button(self, label="Browse")
        self.bt_DB6.tc = self.tc_DB6
        self.bt_DB6.ck = self.ck_DB6

        sizer.Add(self.ck_DB6, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB6, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB6, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB6.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB6)
        self.bt_DB6.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB6)

        # Read in config
        self.ck_DB6.Value = guiFunctions.configMe("launch", "db6_check", bool=True)
        self.ck_DB6.Label =  guiFunctions.configMe("launch", "db6_dbname")
        self.tc_DB6.Value = guiFunctions.configMe("launch", "db6_proxyname")

        if self.ck_DB6.Label == "":
            self.ck_DB6.Label = "<add database>"

        if self.ck_DB6.Label == "<add database>":
            self.ck_DB6.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB6.GetId())
        list_checkboxLabel.append(self.ck_DB6.GetLabel())
        list_txtctrlID.append(self.tc_DB6.GetId())
        list_txtctrlLabel.append(self.tc_DB6.Value)

        xIndex +=1

    #   [8]
        self.ck_DB7 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB7.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB7 = wx.TextCtrl(panel)
        self.tc_DB7.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB7 = wx.Button(self, label="Browse")
        self.bt_DB7.tc = self.tc_DB7
        self.bt_DB7.ck = self.ck_DB7

        sizer.Add(self.ck_DB7, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB7, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB7, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB7.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB7)
        self.bt_DB7.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB7)

        # Read in config
        self.ck_DB7.Value = guiFunctions.configMe("launch", "db7_check", bool=True)
        self.ck_DB7.Label =  guiFunctions.configMe("launch", "db7_dbname")
        self.tc_DB7.Value = guiFunctions.configMe("launch", "db7_proxyname")

        if self.ck_DB7.Label == "":
            self.ck_DB7.Label = "<add database>"

        if self.ck_DB7.Label == "<add database>":
            self.ck_DB7.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB7.GetId())
        list_checkboxLabel.append(self.ck_DB7.GetLabel())
        list_txtctrlID.append(self.tc_DB7.GetId())
        list_txtctrlLabel.append(self.tc_DB7.Value)

        xIndex +=1

    #   [9]
        self.ck_DB8 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB8.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))

        self.tc_DB8 = wx.TextCtrl(panel)
        self.tc_DB8.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB8 = wx.Button(self, label="Browse")
        self.bt_DB8.tc = self.tc_DB8
        self.bt_DB8.ck = self.ck_DB8

        sizer.Add(self.ck_DB8, pos=(xIndex,0), flag=wx.EXPAND|wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_DB8, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_DB8, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        self.ck_DB8.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB8)
        self.bt_DB8.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB8)

        # Read in config
        self.ck_DB8.Value = guiFunctions.configMe("launch", "db8_check", bool=True)
        self.ck_DB8.Label =  guiFunctions.configMe("launch", "db8_dbname")
        self.tc_DB8.Value = guiFunctions.configMe("launch", "db8_proxyname")

        if self.ck_DB8.Label == "":
            self.ck_DB8.Label = "<add database>"

        if self.ck_DB8.Label == "<add database>":
            self.ck_DB8.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB8.GetId())
        list_checkboxLabel.append(self.ck_DB8.GetLabel())
        list_txtctrlID.append(self.tc_DB8.GetId())
        list_txtctrlLabel.append(self.tc_DB8.Value)

        xIndex +=1

    # --------------------------------------------------------------------------
    # [12] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine1, pos=(10, 0), span=(1, 3), flag=wx.EXPAND)

    # --------------------------------------------------------------------------
    # [13] Create and add a launch button and radios for Proxy vs. Web
    # Eventually add "Use Sorts" and "Remove Dupes"
        self.bt_Launch = wx.Button(panel, label="Launch")
        help_bt_Launch = "Click here to launch the Sonospy service."
        self.bt_Launch.SetToolTip(wx.ToolTip(help_bt_Launch))
        self.bt_Launch.Bind(wx.EVT_BUTTON, self.bt_LaunchClick, self.bt_Launch)
        self.rd_Proxy = wx.RadioButton(panel, label="Proxy")
        help_rd_Proxy = "Run only as a proxy service in the background."
        self.rd_Proxy.SetToolTip(wx.ToolTip(help_rd_Proxy))
        self.rd_Web = wx.RadioButton(panel, label="Web")
        help_rd_Web = "Run as the web interface to Sonospy."
        self.rd_Web.SetToolTip(wx.ToolTip(help_rd_Web))

        if guiFunctions.configMe("launch", "proxy", bool=True) == True:
            self.rd_Proxy.SetValue(True)
        else:
            self.rd_Web.SetValue(True)

        self.rd_Proxy.Bind(wx.EVT_RADIOBUTTON, self.updateScratchPad, self.rd_Proxy)
        self.rd_Web.Bind(wx.EVT_RADIOBUTTON, self.updateScratchPad, self.rd_Web)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick, self.bt_SaveDefaults)

        sizer.Add(self.bt_Launch, pos=(11,0), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.rd_Proxy, pos=(11,1), flag=wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.rd_Web, pos=(11,2), flag=wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_SaveDefaults, pos=(11,3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

    # --------------------------------------------------------------------------
    # [13] Create Scratch Pad

        self.sb_Scratchpad = wx.StaticBox(panel, label="Scratchpad:", size=(200, 140))
        help_Scratchpad = "You can cut and paste this into a command/shell window..."
        scratchpadSizer = wx.StaticBoxSizer(self.sb_Scratchpad, wx.VERTICAL)
        self.tc_Scratchpad = wx.TextCtrl(panel, -1,"",size=(300, 130), style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.tc_Scratchpad.SetToolTip(wx.ToolTip(help_Scratchpad))
        self.tc_Scratchpad.SetInsertionPoint(0)
        LogFont = wx.Font(7.5, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
        self.tc_Scratchpad.SetFont(LogFont)

        scratchpadSizer.Add(self.tc_Scratchpad, flag=wx.EXPAND)
        sizer.Add(scratchpadSizer, pos=(12, 0), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.ALIGN_BOTTOM, border=10)

        # Bind a text event to autoupdate the scratchpad if the user decides
        # to edit the proxy name manually.
        self.tc_DB1.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB1)
        self.tc_DB2.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB2)
        self.tc_DB3.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB3)
        self.tc_DB4.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB4)
        self.tc_DB5.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB5)
        self.tc_DB6.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB6)
        self.tc_DB7.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB7)
        self.tc_DB8.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB8)

        Publisher().subscribe(self.setLaunchPanel, 'setLaunchPanel')

        panel.Refresh()
        panel.Update()
        
        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)

        # self.populateMe()
        self.buildLaunch()
Exemplo n.º 13
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)
        self.currentDirectory = os.getcwd()

        xIndex = 0
    # --------------------------------------------------------------------------
    # [0] Virtuals Type      ---------------------------------------------------
        label_Type = wx.StaticText(panel, label="Type:")
        sizer.Add(label_Type, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        typeOptions = ['work', 'virtual']
        help_typeOptions = "Select the type of virtual you want to create."

        self.combo_typeOptions = wx.ComboBox(panel, 1, "", (25, 25), (290, 25), typeOptions, wx.CB_DROPDOWN)
        self.combo_typeOptions.SetToolTip(wx.ToolTip(help_typeOptions))
        self.combo_typeOptions.Select(guiFunctions.configMe("virtuals", "type", integer=True))
        sizer.Add(self.combo_typeOptions, pos=(xIndex, 1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        xIndex += 1
    # --------------------------------------------------------------------------
    # [1] Virtuals Title     ---------------------------------------------------
        label_Title = wx.StaticText(panel, label="Title:")
        sizer.Add(label_Title, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_title = "Title is the base name of the work or virtual (can be overridden in scan.ini)"
        self.tc_Title = wx.TextCtrl(panel)
        self.tc_Title.SetToolTip(wx.ToolTip(help_title))
        self.tc_Title.Value = guiFunctions.configMe("virtuals", "title")
        sizer.Add(self.tc_Title, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1
    # --------------------------------------------------------------------------
    # [2] Virtuals Artist    ---------------------------------------------------
        label_Artist = wx.StaticText(panel, label="Artist:")
        sizer.Add(label_Artist, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_artist = "Name of the artist for the Virtual."
        self.tc_Artist = wx.TextCtrl(panel)
        self.tc_Artist.SetToolTip(wx.ToolTip(help_artist))
        self.tc_Artist.Value = guiFunctions.configMe("virtuals", "artist")
        sizer.Add(self.tc_Artist, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [3] Virtuals Album Artist ------------------------------------------------
        label_AlbumArtist = wx.StaticText(panel, label="Album Artist:")
        sizer.Add(label_AlbumArtist, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_albumartist = "Name of the album artist for the Virtual."
        self.tc_AlbumArtist = wx.TextCtrl(panel)
        self.tc_AlbumArtist.SetToolTip(wx.ToolTip(help_albumartist))
        self.tc_AlbumArtist.Value = guiFunctions.configMe("virtuals", "albumartist")
        sizer.Add(self.tc_AlbumArtist, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [4] Virtuals Composer ------------------------------------------------
        label_Composer = wx.StaticText(panel, label="Composer:")
        sizer.Add(label_Composer, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_composer = "Name of the composer for the Virtual."
        self.tc_Composer = wx.TextCtrl(panel)
        self.tc_Composer.SetToolTip(wx.ToolTip(help_composer))
        self.tc_Composer.Value = guiFunctions.configMe("virtuals", "composer")
        sizer.Add(self.tc_Composer, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [5] Virtuals Year         ------------------------------------------------
        label_Year = wx.StaticText(panel, label="Year:")
        sizer.Add(label_Year, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Year = "The year for the Virtual."
        self.tc_Year = wx.TextCtrl(panel)
        self.tc_Year.SetToolTip(wx.ToolTip(help_Year))
        self.tc_Year.Value = guiFunctions.configMe("virtuals", "year")
        sizer.Add(self.tc_Year, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [6] Virtuals Genre         -----------------------------------------------
        label_Genre = wx.StaticText(panel, label="Genre:")
        sizer.Add(label_Genre, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Genre = "The Genre for the Virtual."
        self.tc_Genre = wx.TextCtrl(panel)
        self.tc_Genre.SetToolTip(wx.ToolTip(help_Genre))
        self.tc_Genre.Value = guiFunctions.configMe("virtuals", "genre")
        sizer.Add(self.tc_Genre, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [7] Virtuals Cover         -----------------------------------------------
        label_Cover = wx.StaticText(panel, label="Cover:")
        sizer.Add(label_Cover, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Cover = "The Cover for the Virtual."
        self.tc_Cover = wx.TextCtrl(panel)
        self.tc_Cover.SetToolTip(wx.ToolTip(help_Cover))
        self.tc_Cover.Value = guiFunctions.configMe("virtuals", "cover")
        sizer.Add(self.tc_Cover, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [8] Virtuals Disc Number   -----------------------------------------------
        label_DiscNumber = wx.StaticText(panel, label="Disc Number:")
        sizer.Add(label_DiscNumber, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_DiscNumber = "The Disc Number for the Virtual."
        self.tc_DiscNumber = wx.TextCtrl(panel)
        self.tc_DiscNumber.SetToolTip(wx.ToolTip(help_DiscNumber))
        self.tc_DiscNumber.Value = guiFunctions.configMe("virtuals", "discnumber")
        sizer.Add(self.tc_DiscNumber, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # 9 inserted=
        xIndex += 1
    # 10 created=
        xIndex += 1
    # 11 lastmodified=
        xIndex += 1

    # --------------------------------------------------------------------------
    # [11] Folders and Tracks    -----------------------------------------------
        self.sb_FilesFolders = wx.StaticBox(panel, label="Files and Folders to Scan:", size=(200, 130))
        help_FilesFolders = "Tracks and folders for your virtual are listed here  Click ADD FOLDER to add a folder and ADD FILE(S) to add individual tracks."
        folderBoxSizer = wx.StaticBoxSizer(self.sb_FilesFolders, wx.VERTICAL)
        self.tc_FilesFolders = wx.TextCtrl(panel, -1,"",size=(300, 130), style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.tc_FilesFolders.SetToolTip(wx.ToolTip(help_FilesFolders))
        self.tc_FilesFolders.Value = guiFunctions.configMe("virtuals", "tracks", parse=True)
        self.tc_FilesFolders.SetInsertionPoint(0)

        folderBoxSizer.Add(self.tc_FilesFolders, flag=wx.EXPAND)
        sizer.Add(folderBoxSizer, pos=(xIndex, 0), span=(1, 6), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [2] Buttons to Add Folder, Files, Clear, Save Defaults -------------------
        # ADD FOLDER
        self.bt_FoldersToScanAdd = wx.Button(panel, label="Add Folder")
        help_FoldersToScanAdd = "Add a top-level folder to the above field. The scan will search any sub-folders beneath whatever folder you add."
        self.bt_FoldersToScanAdd.SetToolTip(wx.ToolTip(help_FoldersToScanAdd))
        self.bt_FoldersToScanAdd.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanAddClick, self.bt_FoldersToScanAdd)
        sizer.Add(self.bt_FoldersToScanAdd, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # ADD FILES
        self.bt_FilesToScanAdd = wx.Button(panel, label="Add Track(s)")
        help_FilesToScanAdd = "Add individual tracks to the above field."
        self.bt_FilesToScanAdd.SetToolTip(wx.ToolTip(help_FilesToScanAdd))
        self.bt_FilesToScanAdd.Bind(wx.EVT_BUTTON, self.bt_FilesToScanAddClick, self.bt_FilesToScanAdd)
        sizer.Add(self.bt_FilesToScanAdd, pos=(xIndex, 1), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # CLEAR SCAN AREA
        self.bt_FoldersToScanClear = wx.Button(panel, label="Clear")
        help_FoldersToScanClear = "Clear the Tracks and Folders listed."
        self.bt_FoldersToScanClear.SetToolTip(wx.ToolTip(help_FoldersToScanClear))
        sizer.Add(self.bt_FoldersToScanClear, pos=(xIndex,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        self.bt_FoldersToScanClear.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanClearClick, self.bt_FoldersToScanClear)

        # SAVE VIRTUAL
        self.bt_SaveVirtual = wx.Button(panel, label="Save as File")
        help_SaveVirtual = "Save current settings .sp file."
        self.bt_SaveVirtual.SetToolTip(wx.ToolTip(help_SaveVirtual))
        self.bt_SaveVirtual.Bind(wx.EVT_BUTTON, self.bt_SavePlaylistClick, self.bt_SaveVirtual)
        sizer.Add(self.bt_SaveVirtual, pos=(xIndex,3), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick, self.bt_SaveDefaults)
        sizer.Add(self.bt_SaveDefaults, pos=(xIndex,4), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 14
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)
        self.currentDirectory = os.getcwd()

    # [0] Main Database Text, Entry and Browse Button --------------------------
        label_MainDatabase = wx.StaticText(panel, label="Source Database:")
        help_MainDatabase = "Select the source database to extract from.  This is most commonly your main database/index. Enter it into the text field, or click BROWSE to select a .db file."
        label_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))
        sizer.Add(label_MainDatabase, pos=(0, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        self.tc_MainDatabase = wx.TextCtrl(panel)
        self.tc_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))
        self.tc_MainDatabase.Value = guiFunctions.configMe("extract", "database_source")
        sizer.Add(self.tc_MainDatabase, pos=(0, 1), span=(1, 3), flag=wx.TOP|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)

        self.bt_MainDatabase = wx.Button(panel, label="Browse...")
        self.bt_MainDatabase.SetToolTip(wx.ToolTip(help_MainDatabase))
        sizer.Add(self.bt_MainDatabase, pos=(0, 4), flag=wx.LEFT|wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)
        self.bt_MainDatabase.Bind(wx.EVT_BUTTON, self.bt_MainDatabaseClick, self.bt_MainDatabase)
    # --------------------------------------------------------------------------
    # [1] Target Database Label, Entry and Browse Button -----------------------

        # Create the label, text control and button
        label_TargetDatabase = wx.StaticText(panel, label="Target Database:")
        help_TargetDatabase = "Select the database you wish to create or update.  Enter it into the text field, or click BROWSE to select a previously created .db file."
        label_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))

        self.tc_TargetDatabase = wx.TextCtrl(panel)
        self.tc_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))
        self.tc_TargetDatabase.Value = guiFunctions.configMe("extract", "database_target")

        self.bt_TargetDatabase = wx.Button(panel, label="Browse...")
        self.bt_TargetDatabase.SetToolTip(wx.ToolTip(help_TargetDatabase))

        # Add them to the sizer.
        sizer.Add(label_TargetDatabase, pos=(1, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
        sizer.Add(self.tc_TargetDatabase, pos=(1, 1), span=(1, 3), flag=wx.TOP|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_TargetDatabase, pos=(1, 4), flag=wx.LEFT|wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)

        # Bind the button to a click event
        self.bt_TargetDatabase.Bind(wx.EVT_BUTTON, self.bt_TargetDatabaseClick,self.bt_TargetDatabase)
    # --------------------------------------------------------------------------
    # [2] Options Static Box ---------------------------------------------------

        # Create static box
        self.sb_ExtractOptions = wx.StaticBox(panel, label="Options for Extract", size=(100,100))
        sbs_ExtractOptions = wx.StaticBoxSizer(self.sb_ExtractOptions, wx.VERTICAL)
        OptionBoxSizer = wx.GridBagSizer(4, 9)

        # Create the options
        logicList = ['<', '<=', '=', '>', '>=']

        sizerIndexX = 0

        # Created
        label_OptionsCreated = wx.StaticText(panel, label="Created:")
        help_Created = "Extract files to the Target Database based on the CREATION DATE of the music files in the Source Database."
        label_OptionsCreated.SetToolTip(wx.ToolTip(help_Created))

        self.combo_LogicalCreated = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalCreated.SetToolTip(wx.ToolTip(help_Created))
        self.combo_LogicalCreated.Select(guiFunctions.configMe("extract", "createdidx", integer=True))

        self.tc_DaysAgoCreated = wx.TextCtrl(panel)
        self.tc_DaysAgoCreated.SetToolTip(wx.ToolTip(help_Created))
        self.tc_DaysAgoCreated.Value = guiFunctions.configMe("extract", "createdVal")

        label_DaysAgoCreated = wx.StaticText(panel, label="days ago")
        label_DaysAgoCreated.SetToolTip(wx.ToolTip(help_Created))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsCreated, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalCreated, pos=(sizerIndexX,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoCreated, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(label_DaysAgoCreated, pos=(sizerIndexX,3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Inserted
        sizerIndexX += 1
        label_OptionsInserted = wx.StaticText(panel, label="Inserted:")
        help_Inserted = "Extract files to the Target Database based on the INSERTED DATE (i.e. when the file was first added to the database) of the entries in the Source Database."
        label_OptionsInserted.SetToolTip(wx.ToolTip(help_Inserted))

        self.combo_LogicalInserted = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalInserted.SetToolTip(wx.ToolTip(help_Inserted))
        self.combo_LogicalInserted.Select(guiFunctions.configMe("extract", "insertedIdx", integer=True))
        self.tc_DaysAgoInserted = wx.TextCtrl(panel)
        self.tc_DaysAgoInserted.SetToolTip(wx.ToolTip(help_Inserted))
        self.tc_DaysAgoInserted.Value = guiFunctions.configMe("extract", "insertedVal")
        
        label_DaysAgoInserted = wx.StaticText(panel, label="days ago")
        label_DaysAgoInserted.SetToolTip(wx.ToolTip(help_Inserted))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsInserted, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalInserted, pos=(sizerIndexX,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoInserted, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(label_DaysAgoInserted, pos=(sizerIndexX,3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Modified
        sizerIndexX += 1
        label_OptionsModified = wx.StaticText(panel, label="Modified:")
        help_Modified= "Extract files to the Target Database based on the LAST MODIFIED DATE of the music files in the Source Database."
        label_OptionsModified.SetToolTip(wx.ToolTip(help_Modified))

        self.combo_LogicalModified = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalModified.SetToolTip(wx.ToolTip(help_Modified))
        self.combo_LogicalModified.Select(guiFunctions.configMe("extract", "modifiedidx", integer=True))

        self.tc_DaysAgoModified = wx.TextCtrl(panel)
        self.tc_DaysAgoModified.SetToolTip(wx.ToolTip(help_Modified))

        label_DaysAgoModified = wx.StaticText(panel, label="days ago")
        label_DaysAgoModified.SetToolTip(wx.ToolTip(help_Modified))
        self.tc_DaysAgoModified.Value = guiFunctions.configMe("extract", "modifiedval")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsModified, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalModified, pos=(sizerIndexX,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoModified, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(label_DaysAgoModified, pos=(sizerIndexX,3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Accessed
        sizerIndexX += 1
        label_OptionsAccessed = wx.StaticText(panel, label="Accessed:")
        help_Accessed= "Extract files to the Target Database based on the LAST ACCESSED DATE of the music files in the Source Database."
        label_OptionsAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        self.combo_LogicalAccessed = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalAccessed.Select(guiFunctions.configMe("extract", "accessedIdx", integer=True))
        self.combo_LogicalAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        self.tc_DaysAgoAccessed = wx.TextCtrl(panel)
        self.tc_DaysAgoAccessed.SetToolTip(wx.ToolTip(help_Accessed))
        self.tc_DaysAgoAccessed.Value = guiFunctions.configMe("extract", "accessedVal")

        label_DaysAgoAccessed = wx.StaticText(panel, label="days ago")
        label_DaysAgoAccessed.SetToolTip(wx.ToolTip(help_Accessed))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsAccessed, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalAccessed, pos=(sizerIndexX,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=1)
        OptionBoxSizer.Add(self.tc_DaysAgoAccessed, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(label_DaysAgoAccessed, pos=(sizerIndexX,3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Year
        sizerIndexX += 1
        label_OptionsYear = wx.StaticText(panel, label="Year Recorded:")
        help_Year = "Extract files to the Target Database based on the YEAR RECORDED tag of the music files in the Source Database."
        label_OptionsYear.SetToolTip(wx.ToolTip(help_Year))

        self.combo_LogicalYear = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalYear.Select(guiFunctions.configMe("extract", "yearIdx", integer=True))
        self.combo_LogicalYear.SetToolTip(wx.ToolTip(help_Year))

        self.tc_Year = wx.TextCtrl(panel)
        self.tc_Year.SetToolTip(wx.ToolTip(help_Year))
        self.tc_Year.Value = guiFunctions.configMe("extract", "yearVal")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsYear, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalYear, pos=(sizerIndexX,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=1)
        OptionBoxSizer.Add(self.tc_Year, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Genre
        sizerIndexX += 1
        label_OptionsGenre = wx.StaticText(panel, label="Genre:")
        help_Genre = "Extract files to the Target Database based on the GENRE tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsGenre.SetToolTip(wx.ToolTip(help_Genre))

        self.tc_Genre = wx.TextCtrl(panel)
        self.tc_Genre.SetToolTip(wx.ToolTip(help_Genre))
        self.tc_Genre.Value = guiFunctions.configMe("extract", "genre")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsGenre, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.tc_Genre, pos=(sizerIndexX, 1), span=(1,2), flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=0)

        # Artist
        sizerIndexX += 1
        label_OptionsArtist = wx.StaticText(panel, label="Artist:")
        help_Artist = "Extract files to the Target Database based on the ARTIST tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsArtist.SetToolTip(wx.ToolTip(help_Artist))

        self.tc_Artist = wx.TextCtrl(panel)
        self.tc_Artist.SetToolTip(wx.ToolTip(help_Artist))
        self.tc_Artist.Value = guiFunctions.configMe("extract", "artist")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsArtist, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.tc_Artist, pos=(sizerIndexX, 1), span=(1,2), flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=0)

        # Composer
        sizerIndexX += 1
        label_OptionsComposer = wx.StaticText(panel, label="Composer:")
        help_Composer = "Extract files to the Target Database based on the COMPOSER tag of the music files in the Source Database.  This is case sensitive."
        label_OptionsComposer.SetToolTip(wx.ToolTip(help_Composer))

        self.tc_Composer = wx.TextCtrl(panel)
        self.tc_Composer.SetToolTip(wx.ToolTip(help_Composer))
        self.tc_Composer.Value = guiFunctions.configMe("extract", "composer")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsComposer, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.tc_Composer, pos=(sizerIndexX, 1), span=(1,2), flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=0)

        # Bit-rate
        sizerIndexX += 1
        label_OptionsBitrate = wx.StaticText(panel, label="Bitrate:")
        help_Bitrate = "Extract files to the Target Database based on the BIT-RATE of the music files in the Source Database."
        label_OptionsBitrate.SetToolTip(wx.ToolTip(help_Bitrate))

        self.combo_LogicalBitrate = wx.ComboBox(panel, 1, "", (25, 25), (60, 25), logicList, wx.CB_DROPDOWN)
        self.combo_LogicalBitrate.Select(guiFunctions.configMe("extract", "bitrateIdx", integer=True))
        self.combo_LogicalBitrate.SetToolTip(wx.ToolTip(help_Bitrate))

        self.tc_Bitrate = wx.TextCtrl(panel)
        self.tc_Bitrate.SetToolTip(wx.ToolTip(help_Bitrate))
        self.tc_Bitrate.Value = guiFunctions.configMe("extract", "bitrateVal")

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_OptionsBitrate, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.combo_LogicalBitrate, pos=(sizerIndexX, 1), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(self.tc_Bitrate, pos=(sizerIndexX, 2), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        # Last X Albums
        sizerIndexX += 1
        label_Last = wx.StaticText(panel, label="Last:")
        help_Last = "[EXPERIMENTAL] Extract files to the Target Database based on the MOST RECENT <#> OF ALBUMS in the Source Database."
        label_Last.SetToolTip(wx.ToolTip(help_Last))

        self.tc_Last = wx.TextCtrl(panel)
        self.tc_Last.SetToolTip(wx.ToolTip(help_Last))
        self.tc_Last.Value = guiFunctions.configMe("extract", "last")

        label_Albums = wx.StaticText(panel, label="Albums")
        label_Albums.SetToolTip(wx.ToolTip(help_Last))

        # Add them to the sizer (optionBoxSizer)
        OptionBoxSizer.Add(label_Last, pos=(sizerIndexX, 0), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=0)
        OptionBoxSizer.Add(self.tc_Last, pos=(sizerIndexX, 1), span=(1,2), flag=wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)
        OptionBoxSizer.Add(label_Albums, pos=(sizerIndexX, 3), flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, border=0)

        OptionBoxSizer.AddGrowableCol(4)
        sbs_ExtractOptions.Add(OptionBoxSizer, flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(sbs_ExtractOptions, pos=(2, 0), span=(1,6),flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)

    # --------------------------------------------------------------------------
    # [3] Add Scan Options and Scan Button -------------------------------------
        self.bt_Extract = wx.Button(panel, label="Extract")
        help_Extract = "Click to start the extract process based on the options chosen above."
        self.bt_Extract.SetToolTip(wx.ToolTip(help_Extract))
        self.bt_Extract.Bind(wx.EVT_BUTTON, self.bt_ExtractClick, self.bt_Extract)

        self.ck_ExtractVerbose = wx.CheckBox(panel, label="Verbose")
        help_ExtractVerbose = "Select this checkbox if you want to turn on the verbose settings during the extract."
        self.ck_ExtractVerbose.SetToolTip(wx.ToolTip(help_ExtractVerbose))
        self.ck_ExtractVerbose.Value = guiFunctions.configMe("extract", "verbose", bool=True)

        self.bt_SaveLog = wx.Button(panel, label="Save to Log")
        help_SaveLogToFile = "Save the log below to a file."
        self.bt_SaveLog.SetToolTip(wx.ToolTip(help_SaveLogToFile))
        self.bt_SaveLog.Bind(wx.EVT_BUTTON, self.bt_SaveLogClick, self.bt_SaveLog)

        self.ck_OverwriteExisting = wx.CheckBox(panel, label="Overwrite")
        help_Overwrite = "Select this checkbox if you want to overwrite the Target Database."
        self.ck_OverwriteExisting.SetToolTip(wx.ToolTip(help_Overwrite))
        self.ck_OverwriteExisting.Value = guiFunctions.configMe("extract", "overwrite", bool=True)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick, self.bt_SaveDefaults)

        sizer.Add(self.bt_Extract, pos=(3,0), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_SaveLog, pos=(3,1), flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.RIGHT, border=10)
        sizer.Add(self.ck_ExtractVerbose, pos=(3,2), flag=wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.ck_OverwriteExisting, pos=(3,3), flag=wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.bt_SaveDefaults, pos=(3,4), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

    # --------------------------------------------------------------------------
    # [4] Separator line ------------------------------------------------------
        hl_SepLine2 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine2, pos=(4, 0), span=(1, 6), flag=wx.EXPAND, border=10)
    # --------------------------------------------------------------------------
    # [5] Output/Log Box -------------------------------------------------------
        self.LogWindow = wx.TextCtrl(panel, -1,"",size=(100, 100), style=wx.TE_MULTILINE|wx.TE_READONLY)
        LogFont = wx.Font(7.5, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
        self.LogWindow.SetFont(LogFont)
        help_LogWindow = "Results of a extract will appear here."
        self.LogWindow.SetToolTip(wx.ToolTip(help_LogWindow))
        self.LogWindow.SetInsertionPoint(0)
        self.LogWindow.Disable()
        sizer.Add(self.LogWindow, pos=(5,0), span=(1,6), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # Indicate we don't have a worker thread yet
        EVT_RESULT(self,self.onResult)
        self.worker = None

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 15
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)

        xIndex = 0
    # [0] Main Database Text, Entry and Browse Button --------------------------
        label_MainDatabase = wx.StaticText(panel, label="Database:")
        help_Database = "The 'Database' is the main collection of music you will create or update. Click BROWSE to select a previously created database, or enter a new name here."
        label_MainDatabase.SetToolTip(wx.ToolTip(help_Database))
        sizer.Add(label_MainDatabase, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        self.tc_MainDatabase = wx.TextCtrl(panel)
        self.tc_MainDatabase.SetToolTip(wx.ToolTip(help_Database))
        self.tc_MainDatabase.Value = guiFunctions.configMe("scan", "database")
        sizer.Add(self.tc_MainDatabase, pos=(xIndex, 1), span=(1, 4), flag=wx.TOP|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)

        self.bt_MainDatabase = wx.Button(panel, label="Browse...")
        self.bt_MainDatabase.SetToolTip(wx.ToolTip(help_Database))
        sizer.Add(self.bt_MainDatabase, pos=(xIndex, 5), flag=wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)
        self.bt_MainDatabase.Bind(wx.EVT_BUTTON, self.bt_MainDatabaseClick,self.bt_MainDatabase)
        xIndex += 1
    # [0] INI Overide ----------------------------------------------------------
#        label_INI = wx.StaticText(panel, label="INI File:")
#        help_INI = "Override scan.ini with your own INI file."
#        label_INI.SetToolTip(wx.ToolTip(help_Database))
#        sizer.Add(label_INI, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
#
#        self.tc_INI = wx.TextCtrl(panel)
#        self.tc_INI.SetToolTip(wx.ToolTip(help_INI))
#        self.tc_INI.Value = guiFunctions.configMe("scan", "inioverride")
#        sizer.Add(self.tc_INI, pos=(xIndex, 1), span=(1, 4), flag=wx.TOP|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, border=10)
#
#        self.bt_INI = wx.Button(panel, label="Browse...")
#        self.bt_INI.SetToolTip(wx.ToolTip(help_INI))
#        sizer.Add(self.bt_INI, pos=(xIndex, 5), flag=wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)
#        self.bt_INI.Bind(wx.EVT_BUTTON, self.bt_INIClick,self.bt_INI)
#        xIndex += 1
    # --------------------------------------------------------------------------
    # [1] Paths to scan for new Music ------------------------------------------
        self.sb_FoldersToScan = wx.StaticBox(panel, label="Folders to Scan:", size=(200, 100))
        help_FoldersToScan = "Folders you will scan for music files are listed here. Click ADD to browse for a *top-level* folder. Scan will search all sub-folders for valid music."
        folderBoxSizer = wx.StaticBoxSizer(self.sb_FoldersToScan, wx.VERTICAL)
        self.multiText = wx.TextCtrl(panel, -1,"",size=(300, 100), style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.multiText.SetToolTip(wx.ToolTip(help_FoldersToScan))
        self.multiText.SetInsertionPoint(0)
        self.multiText.Value = guiFunctions.configMe("scan", "folder", parse=True)
        folderBoxSizer.Add(self.multiText, flag=wx.EXPAND)
        sizer.Add(folderBoxSizer, pos=(xIndex, 0), span=(1, 6), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=10)
        xIndex += 1
    # --------------------------------------------------------------------------
    # [2] Buttons to Add Folder, Clear Scan Area -------------------------------
        # ADD FOLDER
        self.bt_FoldersToScanAdd = wx.Button(panel, label="Add")
        help_FoldersToScanAdd = "Add a top-level folder to the 'Folders to Scan' field. The scan will search any sub-folders beneath whatever folder you add."
        self.bt_FoldersToScanAdd.SetToolTip(wx.ToolTip(help_FoldersToScanAdd))
        self.bt_FoldersToScanAdd.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanAddClick, self.bt_FoldersToScanAdd)
        sizer.Add(self.bt_FoldersToScanAdd, pos=(xIndex,0), span=(1,2), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # CLEAR SCAN AREA
        self.bt_FoldersToScanClear = wx.Button(panel, label="Clear")
        help_FoldersToScanClear = "Clear the Folders to Scan field."
        self.bt_FoldersToScanClear.SetToolTip(wx.ToolTip(help_FoldersToScanClear))
        sizer.Add(self.bt_FoldersToScanClear, pos=(xIndex,5), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)
        self.bt_FoldersToScanClear.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanClearClick, self.bt_FoldersToScanClear)
        xIndex += 1
    # --------------------------------------------------------------------------
    # [3] Separator line -------------------------------------------------------
        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine1, pos=(xIndex, 0), span=(1, 6), flag=wx.EXPAND, border=10)
        xIndex += 1
    # --------------------------------------------------------------------------
    # [4] Add Scan Options and Scan Button -------------------------------------
        # SCAN/UPDATE
        self.bt_ScanUpdate = wx.Button(panel, label="Scan/Update")
        help_ScanUpdate = "Click here to begin your scan of the folders listed above. This will create a new database if one doesn't exist. Otherwise it will update the database with any new music it finds."
        self.bt_ScanUpdate.SetToolTip(wx.ToolTip(help_ScanUpdate))
        self.bt_ScanUpdate.Bind(wx.EVT_BUTTON, self.bt_ScanUpdateClick, self.bt_ScanUpdate)
        sizer.Add(self.bt_ScanUpdate, pos=(xIndex,0), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # REPAIR
        self.bt_ScanRepair = wx.Button(panel, label="Repair")
        help_ScanRepair = "Click here to repair the 'Database' listed above."
        self.bt_ScanRepair.SetToolTip(wx.ToolTip(help_ScanRepair))
        self.bt_ScanRepair.Bind(wx.EVT_BUTTON, self.bt_ScanRepairClick, self.bt_ScanRepair)
        sizer.Add(self.bt_ScanRepair, pos=(xIndex,1), span=(1,2), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # VERBOSE
        self.ck_ScanVerbose = wx.CheckBox(panel, label="Verbose")
        help_ScanVerbose = "Select this checkbox if you want to turn on the verbose settings during the scan."
        self.ck_ScanVerbose.SetToolTip(wx.ToolTip(help_ScanVerbose))
        self.ck_ScanVerbose.Value = guiFunctions.configMe("scan", "verbose", bool=True)
        sizer.Add(self.ck_ScanVerbose, pos=(xIndex,3), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # SAVE LOG TO FILE
        self.bt_SaveLog = wx.Button(panel, label="Save Log")
        help_SaveLogToFile = "Save the log below to a file."
        self.bt_SaveLog.SetToolTip(wx.ToolTip(help_SaveLogToFile))
        self.bt_SaveLog.Bind(wx.EVT_BUTTON, self.bt_SaveLogClick, self.bt_SaveLog)
        sizer.Add(self.bt_SaveLog, pos=(xIndex,4), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=5)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick, self.bt_SaveDefaults)
        sizer.Add(self.bt_SaveDefaults, pos=(xIndex,5), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        xIndex += 1
    # --------------------------------------------------------------------------
    # [5] Separator line ------------------------------------------------------
        hl_SepLine2 = wx.StaticLine(panel, 0, (250, 50), (330,1))
        sizer.Add(hl_SepLine2, pos=(xIndex, 0), span=(1, 6), flag=wx.EXPAND, border=10)
        xIndex += 1
    # --------------------------------------------------------------------------
    # [6] Output/Log Box -------------------------------------------------------
        self.LogWindow = wx.TextCtrl(panel, -1,"",size=(100, 310), style=wx.TE_MULTILINE|wx.TE_READONLY)
        LogFont = wx.Font(7.5, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
        self.LogWindow.SetFont(LogFont)
        self.LogWindow.Disable()
        help_LogWindow = "Results of a scan or repair will appear here."
        self.LogWindow.SetToolTip(wx.ToolTip(help_LogWindow))
        self.LogWindow.SetInsertionPoint(0)
        sizer.Add(self.LogWindow, pos=(xIndex,0), span=(1,6), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        xIndex += 1

        # Indicate we don't have a worker thread yet
        EVT_RESULT(self,self.onResult)
        self.worker = None

        Publisher().subscribe(self.setScanPanel, 'setScanPanel')

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 16
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)
        self.currentDirectory = os.getcwd()

        xIndex = 0

    # [0] Make Header Columns --------------------------
        label_CmdToRun = wx.StaticText(panel, label="Command to Run")
        label_HrToRun = wx.StaticText(panel, label="Hour")
        label_MinToRun = wx.StaticText(panel, label="Minute")

        sizer.Add(label_CmdToRun, pos=(xIndex, 0), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        sizer.Add(label_HrToRun, pos=(xIndex, 4), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        sizer.Add(label_MinToRun, pos=(xIndex, 5), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, border=10)

        xIndex += 1
    # --------------------------------------------------------------------------
    # [1] Schedule 1-12          -----------------------------------------------
        self.tc_S1 = wx.TextCtrl(panel)
        self.tc_S1hr = wx.TextCtrl(panel)
        self.tc_S1hr.Value = guiFunctions.configMe("schedule", "cmd1hr")
        self.tc_S1.Value = guiFunctions.configMe("schedule", "cmd1")
        self.tc_S1min = wx.TextCtrl(panel)
        self.tc_S1min.Value = guiFunctions.configMe("schedule", "cmd1min")

        sizer.Add(self.tc_S1, pos=(xIndex,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S1hr, pos=(xIndex,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S1min, pos=(xIndex, 5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

        self.tc_S2 = wx.TextCtrl(panel)
        self.tc_S2hr = wx.TextCtrl(panel)
        self.tc_S2hr.Value = guiFunctions.configMe("schedule", "cmd2hr")
        self.tc_S2.Value = guiFunctions.configMe("schedule", "cmd2")
        self.tc_S2min = wx.TextCtrl(panel)
        self.tc_S2min.Value = guiFunctions.configMe("schedule", "cmd2min")

        sizer.Add(self.tc_S2, pos=(xIndex,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S2hr, pos=(xIndex,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S2min, pos=(xIndex, 5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

        self.tc_S3 = wx.TextCtrl(panel)
        self.tc_S3hr = wx.TextCtrl(panel)
        self.tc_S3hr.Value = guiFunctions.configMe("schedule", "cmd3hr")
        self.tc_S3.Value = guiFunctions.configMe("schedule", "cmd3")
        self.tc_S3min = wx.TextCtrl(panel)
        self.tc_S3min.Value = guiFunctions.configMe("schedule", "cmd3min")

        sizer.Add(self.tc_S3, pos=(xIndex,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S3hr, pos=(xIndex,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S3min, pos=(xIndex, 5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

        self.tc_S4 = wx.TextCtrl(panel)
        self.tc_S4hr = wx.TextCtrl(panel)
        self.tc_S4hr.Value = guiFunctions.configMe("schedule", "cmd4hr")
        self.tc_S4.Value = guiFunctions.configMe("schedule", "cmd4")
        self.tc_S4min = wx.TextCtrl(panel)
        self.tc_S4min.Value = guiFunctions.configMe("schedule", "cmd4min")

        sizer.Add(self.tc_S4, pos=(xIndex,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S4hr, pos=(xIndex,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.tc_S4min, pos=(xIndex, 5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

        Publisher().subscribe(self.setSchedulePanel, 'setSchedulePanel')

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 17
0
    def bt_LoadVirtualClick(self, event):
        filters = guiFunctions.configMe("general", "playlist_extensions")
        defDir = guiFunctions.configMe("general", "default_sp_path")
        wildcards = "Virtual/Work Playlists (" + filters + ")|" + filters.replace(" ", ";") + "|All files (*.*)|*.*"

        # back up to the folder below our current one.  save cwd in variable
        owd = os.getcwd()
        os.chdir(os.pardir)

        dialog = wx.FileDialog ( None, message = 'Select Virtual/Works Playlist File...', defaultDir=defDir, wildcard = wildcards, style = wxOPEN)

        
        # Open Dialog Box and get Selection
        if dialog.ShowModal() == wxID_OK:
            selected = dialog.GetPaths()
            for selection in selected:
                # All the hard work goes here...
                file = open(selection, 'r')
                lines = file.readlines()
                guiFunctions.statusText(self, "Playlist: " + selection + " selected...")
                tracksStart = False
                
            for line in lines:
                if tracksStart == True:
                    if line != "\n":
                        if line[0] != "#":
                            self.tc_FilesFolders.AppendText(line)
                if "type=" in line:
                    if "virtual" in line.lower():
                        self.combo_typeOptions.Select(1)
                    else:
                        self.combo_typeOptions.Select(0)
                if "title=" in line:
                    newLine = line.replace("title=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Title.Value = newLine
                if "artist=" in line:
                    newLine = line.replace("artist=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Artist.Value = newLine
                if "albumartist=" in line:
                    newLine = line.replace("albumartist=","")
                    newLine = newLine.replace("\n","")
                    self.tc_AlbumArtist.Value = newLine
                if "composer=" in line:
                    newLine = line.replace("composer=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Composer.Value = newLine
                if "year=" in line:
                    newLine = line.replace("year=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Year.Value = newLine
                if "genre=" in line:
                    newLine = line.replace("genre=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Genre.Value = newLine
                if "cover=" in line:
                    newLine = line.replace("cover=","")
                    newLine = newLine.replace("\n","")
                    self.tc_Cover.Value = newLine
                if "discnumber=" in line:
                    newLine = line.replace("discnumber=","")
                    newLine = newLine.replace("\n","")
                    self.tc_DiscNumber.Value = newLine
                if "inserted=" in line:
                    pass
                if "created=" in line:
                    pass
                if "lastmodified" in line:
                    tracksStart = True
                    pass
        dialog.Destroy()

        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 18
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)
        self.currentDirectory = os.getcwd()

        xIndex = 0
    # --------------------------------------------------------------------------
    # [0] Virtuals Type      ---------------------------------------------------
        label_Type = wx.StaticText(panel, label="Type:")
        sizer.Add(label_Type, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        typeOptions = ['work', 'virtual']
        help_typeOptions = "Select the type of virtual you want to create."

        self.combo_typeOptions = wx.ComboBox(panel, 1, "", (25, 25), (290, 25), typeOptions, wx.CB_DROPDOWN)
        self.combo_typeOptions.SetToolTip(wx.ToolTip(help_typeOptions))
        self.combo_typeOptions.Select(guiFunctions.configMe("virtuals", "type", integer=True))
        sizer.Add(self.combo_typeOptions, pos=(xIndex, 1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        xIndex += 1
    # --------------------------------------------------------------------------
    # [1] Virtuals Title     ---------------------------------------------------
        label_Title = wx.StaticText(panel, label="Title:")
        sizer.Add(label_Title, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_title = "Title is the base name of the work or virtual (can be overridden in scan.ini)"
        self.tc_Title = wx.TextCtrl(panel)
        self.tc_Title.SetToolTip(wx.ToolTip(help_title))
        self.tc_Title.Value = guiFunctions.configMe("virtuals", "title")
        sizer.Add(self.tc_Title, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1
    # --------------------------------------------------------------------------
    # [2] Virtuals Artist    ---------------------------------------------------
        label_Artist = wx.StaticText(panel, label="Artist:")
        sizer.Add(label_Artist, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_artist = "Name of the artist for the Virtual."
        self.tc_Artist = wx.TextCtrl(panel)
        self.tc_Artist.SetToolTip(wx.ToolTip(help_artist))
        self.tc_Artist.Value = guiFunctions.configMe("virtuals", "artist")
        sizer.Add(self.tc_Artist, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [3] Virtuals Album Artist ------------------------------------------------
        label_AlbumArtist = wx.StaticText(panel, label="Album Artist:")
        sizer.Add(label_AlbumArtist, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_albumartist = "Name of the album artist for the Virtual."
        self.tc_AlbumArtist = wx.TextCtrl(panel)
        self.tc_AlbumArtist.SetToolTip(wx.ToolTip(help_albumartist))
        self.tc_AlbumArtist.Value = guiFunctions.configMe("virtuals", "albumartist")
        sizer.Add(self.tc_AlbumArtist, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [4] Virtuals Composer ------------------------------------------------
        label_Composer = wx.StaticText(panel, label="Composer:")
        sizer.Add(label_Composer, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_composer = "Name of the composer for the Virtual."
        self.tc_Composer = wx.TextCtrl(panel)
        self.tc_Composer.SetToolTip(wx.ToolTip(help_composer))
        self.tc_Composer.Value = guiFunctions.configMe("virtuals", "composer")
        sizer.Add(self.tc_Composer, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [5] Virtuals Year         ------------------------------------------------
        label_Year = wx.StaticText(panel, label="Year:")
        sizer.Add(label_Year, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Year = "The year for the Virtual."
        self.tc_Year = wx.TextCtrl(panel)
        self.tc_Year.SetToolTip(wx.ToolTip(help_Year))
        self.tc_Year.Value = guiFunctions.configMe("virtuals", "year")
        sizer.Add(self.tc_Year, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [6] Virtuals Genre         -----------------------------------------------
        label_Genre = wx.StaticText(panel, label="Genre:")
        sizer.Add(label_Genre, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Genre = "The Genre for the Virtual."
        self.tc_Genre = wx.TextCtrl(panel)
        self.tc_Genre.SetToolTip(wx.ToolTip(help_Genre))
        self.tc_Genre.Value = guiFunctions.configMe("virtuals", "genre")
        sizer.Add(self.tc_Genre, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [7] Virtuals Cover         -----------------------------------------------
        label_Cover = wx.StaticText(panel, label="Cover:")
        sizer.Add(label_Cover, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_Cover = "The Cover for the Virtual."
        self.tc_Cover = wx.TextCtrl(panel)
        self.tc_Cover.SetToolTip(wx.ToolTip(help_Cover))
        self.tc_Cover.Value = guiFunctions.configMe("virtuals", "cover")
        sizer.Add(self.tc_Cover, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [8] Virtuals Disc Number   -----------------------------------------------
        label_DiscNumber = wx.StaticText(panel, label="Disc Number:")
        sizer.Add(label_DiscNumber, pos=(xIndex, 0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        help_DiscNumber = "The Disc Number for the Virtual."
        self.tc_DiscNumber = wx.TextCtrl(panel)
        self.tc_DiscNumber.SetToolTip(wx.ToolTip(help_DiscNumber))
        self.tc_DiscNumber.Value = guiFunctions.configMe("virtuals", "discnumber")
        sizer.Add(self.tc_DiscNumber, pos=(xIndex,1), span=(1,5), flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1

    # 9 inserted=
        xIndex += 1
    # 10 created=
        xIndex += 1
    # 11 lastmodified=
    #    xIndex += 1

    # --------------------------------------------------------------------------
    # [11] Folders and Tracks    -----------------------------------------------
        self.sb_FilesFolders = wx.StaticBox(panel, label="Files and Folders to Scan:", size=(200, 130))
        help_FilesFolders = "Tracks and folders for your virtual are listed here  Click ADD FOLDER to add a folder and ADD FILE(S) to add individual tracks."
        folderBoxSizer = wx.StaticBoxSizer(self.sb_FilesFolders, wx.VERTICAL)
        self.tc_FilesFolders = wx.TextCtrl(panel, -1,"",size=(300, 130), style=wx.TE_MULTILINE|wx.TE_READONLY)
        self.tc_FilesFolders.SetToolTip(wx.ToolTip(help_FilesFolders))
        self.tc_FilesFolders.Value = guiFunctions.configMe("virtuals", "tracks", parse=True)
        self.tc_FilesFolders.SetInsertionPoint(0)

        folderBoxSizer.Add(self.tc_FilesFolders, flag=wx.EXPAND)
        sizer.Add(folderBoxSizer, pos=(xIndex, 0), span=(1, 6), flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=10)

        xIndex += 1

    # --------------------------------------------------------------------------
    # [2] Buttons to Add Folder, Files, Clear, Save Defaults -------------------
        # ADD FOLDER
        self.bt_FoldersToScanAdd = wx.Button(panel, label="Add Folder")
        help_FoldersToScanAdd = "Add a top-level folder to the above field. The scan will search any sub-folders beneath whatever folder you add."
        self.bt_FoldersToScanAdd.SetToolTip(wx.ToolTip(help_FoldersToScanAdd))
        self.bt_FoldersToScanAdd.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanAddClick, self.bt_FoldersToScanAdd)
        sizer.Add(self.bt_FoldersToScanAdd, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # ADD FILES
        self.bt_FilesToScanAdd = wx.Button(panel, label="Add Track(s)")
        help_FilesToScanAdd = "Add individual tracks to the above field."
        self.bt_FilesToScanAdd.SetToolTip(wx.ToolTip(help_FilesToScanAdd))
        self.bt_FilesToScanAdd.Bind(wx.EVT_BUTTON, self.bt_FilesToScanAddClick, self.bt_FilesToScanAdd)
        sizer.Add(self.bt_FilesToScanAdd, pos=(xIndex, 1), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # CLEAR SCAN AREA
        self.bt_FoldersToScanClear = wx.Button(panel, label="Clear")
        help_FoldersToScanClear = "Clear the Tracks and Folders listed."
        self.bt_FoldersToScanClear.SetToolTip(wx.ToolTip(help_FoldersToScanClear))
        sizer.Add(self.bt_FoldersToScanClear, pos=(xIndex,3), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        self.bt_FoldersToScanClear.Bind(wx.EVT_BUTTON, self.bt_FoldersToScanClearClick, self.bt_FoldersToScanClear)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick, self.bt_SaveDefaults)
        sizer.Add(self.bt_SaveDefaults, pos=(xIndex,4), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        xIndex += 1
        # SAVE VIRTUAL
        self.bt_SaveVirtual = wx.Button(panel, label="Save Virtual")
        help_SaveVirtual = "Save current settings .sp file."
        self.bt_SaveVirtual.SetToolTip(wx.ToolTip(help_SaveVirtual))
        self.bt_SaveVirtual.Bind(wx.EVT_BUTTON, self.bt_SavePlaylistClick, self.bt_SaveVirtual)
        sizer.Add(self.bt_SaveVirtual, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)

        # LOAD VIRTUAL
        self.bt_LoadVirtual = wx.Button(panel, label="Load Virtual")
        help_LoadVirtual = "Load existing .sp file."
        self.bt_LoadVirtual.SetToolTip(wx.ToolTip(help_LoadVirtual))
        self.bt_LoadVirtual.Bind(wx.EVT_BUTTON, self.bt_LoadVirtualClick, self.bt_LoadVirtual)
        sizer.Add(self.bt_LoadVirtual, pos=(xIndex,4), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, border=10)


        Publisher().subscribe(self.setVirtualPanel, 'setVirtualPanel')

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 19
0
    def initialize(self):

        global sizer

        panel = self
        sizer = wx.GridBagSizer(11, 3)

        xIndex = 0
        yIndex = 0

        # [0] Make Header Columns --------------------------
        self.label_ProxyName = wx.StaticText(panel, label="Display Name")
        self.ck_EnableAll = wxCheckBox(panel, label="Enable All ")
        help_EnableAll = "Click here to enable or disable all the databases below."
        self.ck_EnableAll.SetToolTip(wx.ToolTip(help_EnableAll))
        self.bt_AutoPopulate = wx.Button(panel, label="Auto Populate")
        help_AutoPopulate = "Autopopulate with up to 8 found databases."
        self.bt_AutoPopulate.SetToolTip(wx.ToolTip(help_AutoPopulate))
        self.bt_AutoPopulate.Bind(wx.EVT_BUTTON, self.bt_AutoPopulateClick,
                                  self.bt_AutoPopulate)

        self.bt_Clear = wx.Button(panel, label="Clear")
        help_Clear = "Clear database fields."
        self.bt_Clear.SetToolTip(wx.ToolTip(help_Clear))
        self.bt_Clear.Bind(wx.EVT_BUTTON, self.bt_ClearClick, self.bt_Clear)

        self.ck_EnableAll.Bind(wx.EVT_CHECKBOX, self.enableAllChecks,
                               self.ck_EnableAll)
        sizer.Add(self.label_ProxyName,
                  pos=(xIndex, 1),
                  flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP,
                  border=10)
        sizer.Add(self.ck_EnableAll,
                  pos=(xIndex, 0),
                  flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.TOP,
                  border=10)
        sizer.Add(self.bt_AutoPopulate,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.TOP,
                  border=10)
        sizer.Add(self.bt_Clear,
                  pos=(xIndex, 2),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.TOP
                  | wx.ALIGN_RIGHT,
                  border=10)

        xIndex += 1
        # --------------------------------------------------------------------------
        # [1] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300, 1))
        sizer.Add(hl_SepLine1, pos=(xIndex, 0), span=(1, 3), flag=wx.EXPAND)
        xIndex += 1

        # --------------------------------------------------------------------------
        # [2-9] Checkbox, database name and proxy name field, plus browse button
        #   [2]
        self.ck_DB1 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB1.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB1 = wx.TextCtrl(panel)
        self.tc_DB1.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))

        self.bt_DB1 = wx.Button(self, label="Browse")
        self.bt_DB1.tc = self.tc_DB1
        self.bt_DB1.ck = self.ck_DB1

        sizer.Add(self.ck_DB1,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB1,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB1,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB1.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB1)
        self.bt_DB1.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB1)

        # Read in config
        self.ck_DB1.Value = guiFunctions.configMe("launch",
                                                  "db1_check",
                                                  bool=True)
        self.ck_DB1.Label = guiFunctions.configMe("launch", "db1_dbname")
        self.tc_DB1.Value = guiFunctions.configMe("launch", "db1_proxyname")

        if self.ck_DB1.Label == "":
            self.ck_DB1.Label = "<add database>"

        if self.ck_DB1.Label == "<add database>":
            self.ck_DB1.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB1.GetId())
        list_checkboxLabel.append(self.ck_DB1.GetLabel())
        list_txtctrlID.append(self.tc_DB1.GetId())
        list_txtctrlLabel.append(self.tc_DB1.Value)

        xIndex += 1

        #   [3]
        self.ck_DB2 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB2.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB2 = wx.TextCtrl(panel)
        self.tc_DB2.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB2 = wx.Button(self, label="Browse")
        self.bt_DB2.tc = self.tc_DB2
        self.bt_DB2.ck = self.ck_DB2

        sizer.Add(self.ck_DB2,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB2,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB2,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB2.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB2)
        self.bt_DB2.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB2)

        # Read in config
        self.ck_DB2.Value = guiFunctions.configMe("launch",
                                                  "db2_check",
                                                  bool=True)
        self.ck_DB2.Label = guiFunctions.configMe("launch", "db2_dbname")
        self.tc_DB2.Value = guiFunctions.configMe("launch", "db2_proxyname")

        if self.ck_DB2.Label == "":
            self.ck_DB2.Label = "<add database>"

        if self.ck_DB2.Label == "<add database>":
            self.ck_DB2.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB2.GetId())
        list_checkboxLabel.append(self.ck_DB2.GetLabel())
        list_txtctrlID.append(self.tc_DB2.GetId())
        list_txtctrlLabel.append(self.tc_DB2.Value)

        xIndex += 1

        #   [4]
        self.ck_DB3 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB3.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB3 = wx.TextCtrl(panel)
        self.tc_DB3.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB3 = wx.Button(self, label="Browse")
        self.bt_DB3.tc = self.tc_DB3
        self.bt_DB3.ck = self.ck_DB3

        sizer.Add(self.ck_DB3,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB3,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB3,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB3.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB3)
        self.bt_DB3.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB3)

        # Read in config
        self.ck_DB3.Value = guiFunctions.configMe("launch",
                                                  "db3_check",
                                                  bool=True)
        self.ck_DB3.Label = guiFunctions.configMe("launch", "db3_dbname")
        self.tc_DB3.Value = guiFunctions.configMe("launch", "db3_proxyname")

        if self.ck_DB3.Label == "":
            self.ck_DB3.Label = "<add database>"

        if self.ck_DB3.Label == "<add database>":
            self.ck_DB3.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB3.GetId())
        list_checkboxLabel.append(self.ck_DB3.GetLabel())
        list_txtctrlID.append(self.tc_DB3.GetId())
        list_txtctrlLabel.append(self.tc_DB3.Value)

        xIndex += 1

        #   [5]
        self.ck_DB4 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB4.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB4 = wx.TextCtrl(panel)
        self.tc_DB4.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB4 = wx.Button(self, label="Browse")
        self.bt_DB4.tc = self.tc_DB4
        self.bt_DB4.ck = self.ck_DB4

        sizer.Add(self.ck_DB4,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB4,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB4,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB4.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB4)
        self.bt_DB4.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB4)

        # Read in config
        self.ck_DB4.Value = guiFunctions.configMe("launch",
                                                  "db4_check",
                                                  bool=True)
        self.ck_DB4.Label = guiFunctions.configMe("launch", "db4_dbname")
        self.tc_DB4.Value = guiFunctions.configMe("launch", "db4_proxyname")

        if self.ck_DB4.Label == "":
            self.ck_DB4.Label = "<add database>"

        if self.ck_DB4.Label == "<add database>":
            self.ck_DB4.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB4.GetId())
        list_checkboxLabel.append(self.ck_DB4.GetLabel())
        list_txtctrlID.append(self.tc_DB4.GetId())
        list_txtctrlLabel.append(self.tc_DB4.Value)

        xIndex += 1

        #   [6]
        self.ck_DB5 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB5.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB5 = wx.TextCtrl(panel)
        self.tc_DB5.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB5 = wx.Button(self, label="Browse")
        self.bt_DB5.tc = self.tc_DB5
        self.bt_DB5.ck = self.ck_DB5

        sizer.Add(self.ck_DB5,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB5,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB5,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB5.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB5)
        self.bt_DB5.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB5)

        # Read in config
        self.ck_DB5.Value = guiFunctions.configMe("launch",
                                                  "db5_check",
                                                  bool=True)
        self.ck_DB5.Label = guiFunctions.configMe("launch", "db5_dbname")
        self.tc_DB5.Value = guiFunctions.configMe("launch", "db5_proxyname")

        if self.ck_DB5.Label == "":
            self.ck_DB5.Label = "<add database>"

        if self.ck_DB5.Label == "<add database>":
            self.ck_DB5.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB5.GetId())
        list_checkboxLabel.append(self.ck_DB5.GetLabel())
        list_txtctrlID.append(self.tc_DB5.GetId())
        list_txtctrlLabel.append(self.tc_DB5.Value)

        xIndex += 1

        #   [7]
        self.ck_DB6 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB6.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB6 = wx.TextCtrl(panel)
        self.tc_DB6.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB6 = wx.Button(self, label="Browse")
        self.bt_DB6.tc = self.tc_DB6
        self.bt_DB6.ck = self.ck_DB6

        sizer.Add(self.ck_DB6,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB6,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB6,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB6.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB6)
        self.bt_DB6.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB6)

        # Read in config
        self.ck_DB6.Value = guiFunctions.configMe("launch",
                                                  "db6_check",
                                                  bool=True)
        self.ck_DB6.Label = guiFunctions.configMe("launch", "db6_dbname")
        self.tc_DB6.Value = guiFunctions.configMe("launch", "db6_proxyname")

        if self.ck_DB6.Label == "":
            self.ck_DB6.Label = "<add database>"

        if self.ck_DB6.Label == "<add database>":
            self.ck_DB6.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB6.GetId())
        list_checkboxLabel.append(self.ck_DB6.GetLabel())
        list_txtctrlID.append(self.tc_DB6.GetId())
        list_txtctrlLabel.append(self.tc_DB6.Value)

        xIndex += 1

        #   [8]
        self.ck_DB7 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB7.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB7 = wx.TextCtrl(panel)
        self.tc_DB7.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB7 = wx.Button(self, label="Browse")
        self.bt_DB7.tc = self.tc_DB7
        self.bt_DB7.ck = self.ck_DB7

        sizer.Add(self.ck_DB7,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB7,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB7,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB7.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB7)
        self.bt_DB7.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB7)

        # Read in config
        self.ck_DB7.Value = guiFunctions.configMe("launch",
                                                  "db7_check",
                                                  bool=True)
        self.ck_DB7.Label = guiFunctions.configMe("launch", "db7_dbname")
        self.tc_DB7.Value = guiFunctions.configMe("launch", "db7_proxyname")

        if self.ck_DB7.Label == "":
            self.ck_DB7.Label = "<add database>"

        if self.ck_DB7.Label == "<add database>":
            self.ck_DB7.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB7.GetId())
        list_checkboxLabel.append(self.ck_DB7.GetLabel())
        list_txtctrlID.append(self.tc_DB7.GetId())
        list_txtctrlLabel.append(self.tc_DB7.Value)

        xIndex += 1

        #   [9]
        self.ck_DB8 = wx.CheckBox(self, -1, "<add database>")
        self.ck_DB8.SetToolTip(
            wx.ToolTip(
                "Click here to enable/disable this database for launch."))

        self.tc_DB8 = wx.TextCtrl(panel)
        self.tc_DB8.SetToolTip(
            wx.ToolTip("Enter a name for display on your Sonos Controller."))
        self.bt_DB8 = wx.Button(self, label="Browse")
        self.bt_DB8.tc = self.tc_DB8
        self.bt_DB8.ck = self.ck_DB8

        sizer.Add(self.ck_DB8,
                  pos=(xIndex, 0),
                  flag=wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_DB8,
                  pos=(xIndex, 1),
                  span=(1, 2),
                  flag=wx.EXPAND | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_DB8,
                  pos=(xIndex, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT,
                  border=10)

        self.ck_DB8.Bind(wx.EVT_CHECKBOX, self.OnCheck, self.ck_DB8)
        self.bt_DB8.Bind(wx.EVT_BUTTON, self.browseDB, self.bt_DB8)

        # Read in config
        self.ck_DB8.Value = guiFunctions.configMe("launch",
                                                  "db8_check",
                                                  bool=True)
        self.ck_DB8.Label = guiFunctions.configMe("launch", "db8_dbname")
        self.tc_DB8.Value = guiFunctions.configMe("launch", "db8_proxyname")

        if self.ck_DB8.Label == "":
            self.ck_DB8.Label = "<add database>"

        if self.ck_DB8.Label == "<add database>":
            self.ck_DB8.Disable()

        # Add items to lists
        list_checkboxID.append(self.ck_DB8.GetId())
        list_checkboxLabel.append(self.ck_DB8.GetLabel())
        list_txtctrlID.append(self.tc_DB8.GetId())
        list_txtctrlLabel.append(self.tc_DB8.Value)

        xIndex += 1

        # --------------------------------------------------------------------------
        # [12] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300, 1))
        sizer.Add(hl_SepLine1, pos=(10, 0), span=(1, 3), flag=wx.EXPAND)

        # --------------------------------------------------------------------------
        # [13] Create and add a launch button and radios for Proxy vs. Web
        # Eventually add "Use Sorts" and "Remove Dupes"
        self.bt_Launch = wx.Button(panel, label="Launch")
        help_bt_Launch = "Click here to launch the Sonospy service."
        self.bt_Launch.SetToolTip(wx.ToolTip(help_bt_Launch))
        self.bt_Launch.Bind(wx.EVT_BUTTON, self.bt_LaunchClick, self.bt_Launch)
        self.rd_Proxy = wx.RadioButton(panel, label="Proxy")
        help_rd_Proxy = "Run only as a proxy service in the background."
        self.rd_Proxy.SetToolTip(wx.ToolTip(help_rd_Proxy))
        self.rd_Web = wx.RadioButton(panel, label="Web")
        help_rd_Web = "Run as the web interface to Sonospy."
        self.rd_Web.SetToolTip(wx.ToolTip(help_rd_Web))

        if guiFunctions.configMe("launch", "proxy", bool=True) == True:
            self.rd_Proxy.SetValue(True)
        else:
            self.rd_Web.SetValue(True)

        self.rd_Proxy.Bind(wx.EVT_RADIOBUTTON, self.updateScratchPad,
                           self.rd_Proxy)
        self.rd_Web.Bind(wx.EVT_RADIOBUTTON, self.updateScratchPad,
                         self.rd_Web)

        # SAVE AS DEFAULTS
        self.bt_SaveDefaults = wx.Button(panel, label="Save Defaults")
        help_SaveDefaults = "Save current settings as default."
        self.bt_SaveDefaults.SetToolTip(wx.ToolTip(help_SaveDefaults))
        self.bt_SaveDefaults.Bind(wx.EVT_BUTTON, self.bt_SaveDefaultsClick,
                                  self.bt_SaveDefaults)

        sizer.Add(self.bt_Launch,
                  pos=(11, 0),
                  flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.rd_Proxy,
                  pos=(11, 1),
                  flag=wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.rd_Web,
                  pos=(11, 2),
                  flag=wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.bt_SaveDefaults,
                  pos=(11, 3),
                  flag=wx.RIGHT | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        # --------------------------------------------------------------------------
        # [13] Create Scratch Pad

        self.sb_Scratchpad = wx.StaticBox(panel,
                                          label="Scratchpad:",
                                          size=(200, 140))
        help_Scratchpad = "You can cut and paste this into a command/shell window..."
        scratchpadSizer = wx.StaticBoxSizer(self.sb_Scratchpad, wx.VERTICAL)
        self.tc_Scratchpad = wx.TextCtrl(panel,
                                         -1,
                                         "",
                                         size=(300, 130),
                                         style=wx.TE_MULTILINE
                                         | wx.TE_READONLY)
        self.tc_Scratchpad.SetToolTip(wx.ToolTip(help_Scratchpad))
        self.tc_Scratchpad.SetInsertionPoint(0)
        LogFont = wx.Font(7.5, wx.SWISS, wx.NORMAL, wx.NORMAL, False)
        self.tc_Scratchpad.SetFont(LogFont)

        scratchpadSizer.Add(self.tc_Scratchpad, flag=wx.EXPAND)
        sizer.Add(scratchpadSizer,
                  pos=(12, 0),
                  span=(1, 5),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM
                  | wx.ALIGN_BOTTOM,
                  border=10)

        # Bind a text event to autoupdate the scratchpad if the user decides
        # to edit the proxy name manually.
        self.tc_DB1.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB1)
        self.tc_DB2.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB2)
        self.tc_DB3.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB3)
        self.tc_DB4.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB4)
        self.tc_DB5.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB5)
        self.tc_DB6.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB6)
        self.tc_DB7.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB7)
        self.tc_DB8.Bind(wx.EVT_TEXT, self.updateScratchPad, self.tc_DB8)

        Publisher().subscribe(self.setLaunchPanel, 'setLaunchPanel')

        panel.Refresh()
        panel.Update()

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)

        # self.populateMe()
        self.buildLaunch()
Exemplo n.º 20
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(6, 5)
        self.currentDirectory = os.getcwd()

        xIndex = 0

        # [0] Make Header Columns --------------------------
        label_CmdToRun = wx.StaticText(panel, label="Command to Run")
        label_HrToRun = wx.StaticText(panel, label="Hour")
        label_MinToRun = wx.StaticText(panel, label="Minute")

        sizer.Add(label_CmdToRun,
                  pos=(xIndex, 0),
                  flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP,
                  border=10)
        sizer.Add(label_HrToRun,
                  pos=(xIndex, 4),
                  flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP,
                  border=10)
        sizer.Add(label_MinToRun,
                  pos=(xIndex, 5),
                  flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP,
                  border=10)

        xIndex += 1
        # --------------------------------------------------------------------------
        # [1] Schedule 1-12          -----------------------------------------------
        self.tc_S1 = wx.TextCtrl(panel)
        self.tc_S1hr = wx.TextCtrl(panel)
        self.tc_S1hr.Value = guiFunctions.configMe("schedule", "cmd1hr")
        self.tc_S1.Value = guiFunctions.configMe("schedule", "cmd1")
        self.tc_S1min = wx.TextCtrl(panel)
        self.tc_S1min.Value = guiFunctions.configMe("schedule", "cmd1min")

        sizer.Add(self.tc_S1,
                  pos=(xIndex, 0),
                  span=(1, 3),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S1hr,
                  pos=(xIndex, 4),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S1min,
                  pos=(xIndex, 5),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        xIndex += 1

        self.tc_S2 = wx.TextCtrl(panel)
        self.tc_S2hr = wx.TextCtrl(panel)
        self.tc_S2hr.Value = guiFunctions.configMe("schedule", "cmd2hr")
        self.tc_S2.Value = guiFunctions.configMe("schedule", "cmd2")
        self.tc_S2min = wx.TextCtrl(panel)
        self.tc_S2min.Value = guiFunctions.configMe("schedule", "cmd2min")

        sizer.Add(self.tc_S2,
                  pos=(xIndex, 0),
                  span=(1, 3),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S2hr,
                  pos=(xIndex, 4),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S2min,
                  pos=(xIndex, 5),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        xIndex += 1

        self.tc_S3 = wx.TextCtrl(panel)
        self.tc_S3hr = wx.TextCtrl(panel)
        self.tc_S3hr.Value = guiFunctions.configMe("schedule", "cmd3hr")
        self.tc_S3.Value = guiFunctions.configMe("schedule", "cmd3")
        self.tc_S3min = wx.TextCtrl(panel)
        self.tc_S3min.Value = guiFunctions.configMe("schedule", "cmd3min")

        sizer.Add(self.tc_S3,
                  pos=(xIndex, 0),
                  span=(1, 3),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S3hr,
                  pos=(xIndex, 4),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S3min,
                  pos=(xIndex, 5),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        xIndex += 1

        self.tc_S4 = wx.TextCtrl(panel)
        self.tc_S4hr = wx.TextCtrl(panel)
        self.tc_S4hr.Value = guiFunctions.configMe("schedule", "cmd4hr")
        self.tc_S4.Value = guiFunctions.configMe("schedule", "cmd4")
        self.tc_S4min = wx.TextCtrl(panel)
        self.tc_S4min.Value = guiFunctions.configMe("schedule", "cmd4min")

        sizer.Add(self.tc_S4,
                  pos=(xIndex, 0),
                  span=(1, 3),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S4hr,
                  pos=(xIndex, 4),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)
        sizer.Add(self.tc_S4min,
                  pos=(xIndex, 5),
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT
                  | wx.ALIGN_CENTER_VERTICAL,
                  border=10)

        xIndex += 1

        Publisher().subscribe(self.setSchedulePanel, 'setSchedulePanel')

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
Exemplo n.º 21
0
    def populateMe(self):
        filters = guiFunctions.configMe("general", "database_extensions").split()

        # Set Original Working Directory so we can get back to here.
        owd = os.getcwd()
        os.chdir(os.pardir)

        #   Get a count of *database from the filesystem
        numDB = guiFunctions.scrubDB(os.getcwd(), filters)
        curCount = 0
        # Checkbox (enable, disable for launch)
        # textCtrl (for Proxy name in controller)
        # database name (based on *database)
        for db in numDB:

            if curCount > 7:
                pass
            else:
                if curCount == 0:
                    ck = self.ck_DB1
                    tc = self.tc_DB1
                if curCount == 1:
                    ck = self.ck_DB2
                    tc = self.tc_DB2
                if curCount == 2:
                    ck = self.ck_DB3
                    tc = self.tc_DB3
                if curCount == 3:
                    ck = self.ck_DB4
                    tc = self.tc_DB4
                if curCount == 4:
                    ck = self.ck_DB5
                    tc = self.tc_DB5
                if curCount == 5:
                    ck = self.ck_DB6
                    tc = self.tc_DB6
                if curCount == 6:
                    ck = self.ck_DB7
                    tc = self.tc_DB7
                if curCount == 7:
                    ck = self.ck_DB8
                    tc = self.tc_DB8

                basename, extension = os.path.splitext(db)
                tc.Value = basename
                ck.Label = db
                ck.Enable()
                ck.Value = True

            curCount +=1
            
#            #-------------------------------------------------------
#            # Save references to the widgets created dynamically
#                list_checkboxID.append(check.GetId())
#                list_checkboxLabel.append(check.GetLabel())
#                list_txtctrlID.append(name.GetId())
#                list_txtctrlLabel.append(name.Value)
#
#            # Bind to event for later (DEBUG)
#                check.Bind(wx.EVT_CHECKBOX, self.OnCheck, check)

        self.buildLaunch()
        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 22
0
    def populateMe(self):
        filters = guiFunctions.configMe("general",
                                        "database_extensions").split()

        # Set Original Working Directory so we can get back to here.
        owd = os.getcwd()
        os.chdir(os.pardir)

        #   Get a count of *database from the filesystem
        numDB = guiFunctions.scrubDB(os.getcwd(), filters)
        curCount = 0
        # Checkbox (enable, disable for launch)
        # textCtrl (for Proxy name in controller)
        # database name (based on *database)
        for db in numDB:

            if curCount > 7:
                pass
            else:
                if curCount == 0:
                    ck = self.ck_DB1
                    tc = self.tc_DB1
                if curCount == 1:
                    ck = self.ck_DB2
                    tc = self.tc_DB2
                if curCount == 2:
                    ck = self.ck_DB3
                    tc = self.tc_DB3
                if curCount == 3:
                    ck = self.ck_DB4
                    tc = self.tc_DB4
                if curCount == 4:
                    ck = self.ck_DB5
                    tc = self.tc_DB5
                if curCount == 5:
                    ck = self.ck_DB6
                    tc = self.tc_DB6
                if curCount == 6:
                    ck = self.ck_DB7
                    tc = self.tc_DB7
                if curCount == 7:
                    ck = self.ck_DB8
                    tc = self.tc_DB8

                basename, extension = os.path.splitext(db)
                tc.Value = basename
                ck.Label = db
                ck.Enable()
                ck.Value = True

            curCount += 1

#            #-------------------------------------------------------
#            # Save references to the widgets created dynamically
#                list_checkboxID.append(check.GetId())
#                list_checkboxLabel.append(check.GetLabel())
#                list_txtctrlID.append(name.GetId())
#                list_txtctrlLabel.append(name.Value)
#
#            # Bind to event for later (DEBUG)
#                check.Bind(wx.EVT_CHECKBOX, self.OnCheck, check)

        self.buildLaunch()
        # set back to original working directory
        os.chdir(owd)
Exemplo n.º 23
0
    def __init__(self, parent):
        """"""
        wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)

        panel = self
        sizer = wx.GridBagSizer(11, 3)
        
        xIndex = 0
        yIndex = 0

    # [0] Make Header Columns --------------------------
        label_ProxyName = wx.StaticText(panel, label="Display Name")
        self.ck_EnableAll = wxCheckBox(panel, label="Enable All ")
        help_EnableAll = "Click here to enable or disable all the databases below."
        self.ck_EnableAll.SetToolTip(wx.ToolTip(help_EnableAll))
        self.ck_EnableAll.Bind(wx.EVT_CHECKBOX, self.enableAllChecks, self.ck_EnableAll)
        sizer.Add(label_ProxyName, pos=(xIndex, 2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)
        sizer.Add(self.ck_EnableAll, pos=(xIndex, 0), span=(1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=10)

        xIndex +=1
    # --------------------------------------------------------------------------
    # [1] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine1, pos=(xIndex, 0), span=(1, 3), flag=wx.EXPAND)
        xIndex +=1

    # --------------------------------------------------------------------------
    # [2-9] Checkbox, database name and proxy name field, plus browse button
    #   [2]
        ck_DB1 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB1.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB1 = wx.TextCtrl(panel)
        tc_DB1.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB1 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB1, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB1, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB1, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB1.GetId())
        list_checkboxLabel.append(ck_DB1.GetLabel())
        list_txtctrlID.append(tc_DB1.GetId())
        list_txtctrlLabel.append(tc_DB1.Value)
        list_buttonID.append(bt_DB1.GetId())

        ck_DB1.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB1)
        bt_DB1.Bind(wx.EVT_BUTTON, self.browseDB, bt_DB1)

        xIndex +=1

    #   [3]
        ck_DB2 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB2.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB2 = wx.TextCtrl(panel)
        tc_DB2.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB2 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB2, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB2, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB2, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB2.GetId())
        list_checkboxLabel.append(ck_DB2.GetLabel())
        list_txtctrlID.append(tc_DB2.GetId())
        list_txtctrlLabel.append(tc_DB2.Value)
        list_buttonID.append(bt_DB2.GetId())

        ck_DB2.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB2)
#        bt_DB2.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB2, tc_DB2), bt_DB2)

        xIndex +=1

    #   [4]
        ck_DB3 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB3.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB3 = wx.TextCtrl(panel)
        tc_DB3.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB3 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB3, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB3, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB3, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB3.GetId())
        list_checkboxLabel.append(ck_DB3.GetLabel())
        list_txtctrlID.append(tc_DB3.GetId())
        list_txtctrlLabel.append(tc_DB3.Value)
        list_buttonID.append(bt_DB3.GetId())

        ck_DB3.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB3)
#        bt_DB3.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB3, tc_DB3), bt_DB3)

        xIndex +=1

    #   [5]
        ck_DB4 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB4.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB4 = wx.TextCtrl(panel)
        tc_DB4.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB4 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB4, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB4, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB4, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB4.GetId())
        list_checkboxLabel.append(ck_DB4.GetLabel())
        list_txtctrlID.append(tc_DB4.GetId())
        list_txtctrlLabel.append(tc_DB4.Value)
        list_buttonID.append(bt_DB4.GetId())

        ck_DB4.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB4)
#        bt_DB4.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB4, tc_DB4), bt_DB4)

        xIndex +=1

    #   [6]
        ck_DB5 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB5.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB5 = wx.TextCtrl(panel)
        tc_DB5.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB5 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB5, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB5, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB5, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB5.GetId())
        list_checkboxLabel.append(ck_DB5.GetLabel())
        list_txtctrlID.append(tc_DB5.GetId())
        list_txtctrlLabel.append(tc_DB5.Value)
        list_buttonID.append(bt_DB5.GetId())

        ck_DB5.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB5)
#        bt_DB5.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB5, tc_DB5), bt_DB5)

        xIndex +=1

    #   [7]
        ck_DB6 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB6.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB6 = wx.TextCtrl(panel)
        tc_DB6.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB6 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB6, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB6, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB6, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB6.GetId())
        list_checkboxLabel.append(ck_DB6.GetLabel())
        list_txtctrlID.append(tc_DB6.GetId())
        list_txtctrlLabel.append(tc_DB6.Value)
        list_buttonID.append(bt_DB6.GetId())

        ck_DB6.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB6)
#        bt_DB6.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB6, tc_DB6), bt_DB6)

        xIndex +=1

    #   [8]
        ck_DB7 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB7.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB7 = wx.TextCtrl(panel)
        tc_DB7.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB7 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB7, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB7, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB7, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB7.GetId())
        list_checkboxLabel.append(ck_DB7.GetLabel())
        list_txtctrlID.append(tc_DB7.GetId())
        list_txtctrlLabel.append(tc_DB7.Value)
        list_buttonID.append(bt_DB7.GetId())

        ck_DB7.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB7)
#        bt_DB7.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB7, tc_DB7), bt_DB7)

        xIndex +=1

    #   [9]
        ck_DB8 = wx.CheckBox(self, -1, "<add .db file>")
        ck_DB8.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
        tc_DB8 = wx.TextCtrl(panel)
        tc_DB8.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
        bt_DB8 = wx.Button(self, label="Browse")

        sizer.Add(ck_DB8, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(tc_DB8, pos=(xIndex,1), span=(1,2),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(bt_DB8, pos=(xIndex, 3), flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)

        #-------------------------------------------------------
        # Save references to the widgets created dynamically
        list_checkboxID.append(ck_DB8.GetId())
        list_checkboxLabel.append(ck_DB8.GetLabel())
        list_txtctrlID.append(tc_DB8.GetId())
        list_txtctrlLabel.append(tc_DB8.Value)
        list_buttonID.append(bt_DB8.GetId())

        ck_DB8.Bind(wx.EVT_CHECKBOX, self.OnCheck, ck_DB8)
#        bt_DB8.Bind(wx.EVT_BUTTON, self.browseDB(ck_DB8, tc_DB8), bt_DB8)

        xIndex +=1

#   If you want to autogenerate DB list and increment sizer Index, uncomment
#   the below

#     Get a count of *.db from the filesystem
#        numDB = guiFunctions.scrubDB(os.getcwd())
#
#        # Checkbox (enable, disable for launch)
#        # textCtrl (for Proxy name in controller)
#        # database name (based on *.db)
#        for db in numDB:
#            if xIndex >= 12:
#                pass
#                xIndex += 1
#            else:
#                check = wx.CheckBox(self, -1, db)
#                check.SetToolTip(wx.ToolTip("Click here to enable/disable this database for launch."))
#                sizer.Add(check, pos=(xIndex,0), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
#                label = wx.StaticText(panel, label="")
#                sizer.Add(label, pos=(xIndex,1), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=10)
#                name = wx.TextCtrl(panel)
#                name.SetToolTip(wx.ToolTip("Enter a name for display on your Sonos Controller."))
#                #Set Temp Name
#                if db.endswith('.db'):
#                    name.Value = db[:-3]
#                sizer.Add(name, pos=(xIndex,2), span=(1,3),flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
#                xIndex +=1
#
#            #-------------------------------------------------------
#            # Save references to the widgets created dynamically
#                list_checkboxID.append(check.GetId())
#                list_checkboxLabel.append(check.GetLabel())
#                list_txtctrlID.append(name.GetId())
#                list_txtctrlLabel.append(name.Value)
#
#            # Bind to event for later (DEBUG)
#                check.Bind(wx.EVT_CHECKBOX, self.OnCheck, check)

    # --------------------------------------------------------------------------
    # [12] Separator line ------------------------------------------------------

        hl_SepLine1 = wx.StaticLine(panel, 0, (250, 50), (300,1))
        sizer.Add(hl_SepLine1, pos=(12, 0), span=(1, 3), flag=wx.EXPAND)

    # --------------------------------------------------------------------------
    # [13] Create and add a launch button and radios for Proxy vs. Web
    # Eventually add "Use Sorts" and "Remove Dupes"
        self.bt_Launch = wx.Button(panel, label="Launch")
        help_bt_Launch = "Click here to launch the Sonospy service."
        self.bt_Launch.SetToolTip(wx.ToolTip(help_bt_Launch))
        self.bt_Launch.Bind(wx.EVT_BUTTON, self.bt_LaunchClick, self.bt_Launch)
        self.rd_Proxy = wx.RadioButton(panel, label="Proxy")
        help_rd_Proxy = "Run only as a proxy service in the background."
        self.rd_Proxy.SetToolTip(wx.ToolTip(help_rd_Proxy))
        self.rd_Web = wx.RadioButton(panel, label="Web")
        help_rd_Web = "Run as the web interface to Sonospy."
        self.rd_Web.SetToolTip(wx.ToolTip(help_rd_Web))

        if guiFunctions.configMe("launch", "proxy", bool=True) == True:
            self.rd_Proxy.SetValue(True)
        else:
            self.rd_Web.SetValue(True)

        sizer.Add(self.bt_Launch, pos=(13,0), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.rd_Proxy, pos=(13,1), flag=wx.ALIGN_CENTER_VERTICAL, border=10)
        sizer.Add(self.rd_Web, pos=(13,2), flag=wx.ALIGN_CENTER_VERTICAL, border=10)

        sizer.AddGrowableCol(2)
        panel.SetSizer(sizer)
        panel.Refresh()