Esempio n. 1
0
    def updateSettings(self, event):
        diag = settingsDialog(None,-1,"Settings",defaultDir = self.xlightDir,
                              tempDir = self.tempDir)
        status = diag.ShowModal()
        if status == wx.ID_OK:
            self.xlightDir = diag.defaultDir
            self.tempDir = diag.tempDir
            if len(self.sequences) != 0:
                dial = wx.MessageDialog(None, 'Currently converted sequencs will need to be'+
                                ' reconverted to follow new xlight network definitions',
                                'Sequences not updated', wx.OK | wx.ICON_EXCLAMATION)
                dial.Destroy()

            self.xnetFile = self.xlightDir + '\\xlights_networks.xml'
            if os.path.exists(self.xnetFile):
                self.netInfo = xNetwork(self.xnetFile)
                self.miAddSeq.Enable(True)
            else:
                dlg = wx.MessageBox('xlights_network.xml file not found at %s'%(self.xnetFile)
                    + ' if you already have a configured xlights network make sure options->Settings->'+
                    'xlights directory is set properly' )
                self.miAddSeq.Enable(False)

        elif status == wx.ID_CANCEL:
            print "Cancel was hit"
        else:
            print "Neither one hit the value"


        diag.Destroy()
        pass
Esempio n. 2
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: LightingElf.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.maxProc = cpu_count() # * 2
        self.activeProc = 0
        self.execPath = os.path.dirname(os.path.realpath(__file__))

        ico = wx.Icon('tree.ico',wx.BITMAP_TYPE_ICO)
        self.SetLabel("Lighting elf")
        self.SetIcon(ico)

        #set Config File
        self.cfgFile = self.execPath +"\\elf.cfg"

        ## Menu Bar
        self.menuBar = wx.MenuBar()

        #file Menu setup
        fileMenu = wx.Menu()
        fileMenu.Append(101,"&Export Sequence","Export currently processed sequences.")
        fileMenu.AppendSeparator()
        fileMenu.Append(103,"E&xit", "Say good bye to the elf")
        self.menuBar.Append(fileMenu, "&File")

        #Sequences Menu setup
        seqMenu = wx.Menu()
        self.miAddSeq = seqMenu.Append(201,"&Add Sequences",
                                       "Select LSP Sequences to convert")
        seqMenu.Append(202, "&Clear Sequences", "Delete current Sequences")
        self.menuBar.Append(seqMenu,"&Sequences")

        #Options menu setup
        optionsMenu = wx.Menu()
        optionsMenu.Append(301,"&Individual Sequence",
                           "Proces each sequence as an individual sequence.",
                           wx.ITEM_RADIO)
        optionsMenu.Append(302,"&Combine Sequences",
                           "Combine all selected sequences into one seamless sequence",
                           wx.ITEM_RADIO )
        optionsMenu.AppendSeparator()
        optionsMenu.Append(303,"&Settings", "Set directories used by the elf",
                           wx.ITEM_NORMAL)
        self.menuBar.Append(optionsMenu,"&Options")

        #Help Menu Setup
        helpMenu = wx.Menu()
        helpMenu.Append(401, "&About", "", wx.ITEM_NORMAL)
        self.menuBar.Append(helpMenu, "&Help")
        self.SetMenuBar(self.menuBar)
        ## Menu Bar end
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        ## Menu event connections
        self.Bind(wx.EVT_MENU, self.exportSequence, id=101)
        self.Bind(wx.EVT_MENU, self.CloseWindow, id=103)

        self.Bind(wx.EVT_MENU, self.addSequences, id=201)
        self.Bind(wx.EVT_MENU, self.clearSequences, id=202)

        self.Bind(wx.EVT_MENU, self.seqOptionIndividual, id=301)
        self.Bind(wx.EVT_MENU, self.seqOptionCombine, id=302)
        self.Bind(wx.EVT_MENU, self.updateSettings, id=303)

        self.Bind(wx.EVT_MENU, self.aboutElf, id=401)
        ## Menu event connections end

        #need to read default config and set this correctly... For now hard code it
        self.seqOptionIndividual(None)

        self.frame_1_statusbar = self.CreateStatusBar(1, 0)
        self.sequencesPanel = scrolled.ScrolledPanel(self, -1,
                              style=wx.DOUBLE_BORDER | wx.TAB_TRAVERSAL, size=(650,300))
        self.lbSequenceName = wx.StaticText(self.sequencesPanel, -1,
                            " Sequence Name",
                            style = wx.RAISED_BORDER | wx.ALL |
                             wx.ALIGN_LEFT,
                            size=(400,20)
                            )
        self.lbSequenceStatusText = wx.StaticText(self.sequencesPanel, -1, " Activity",
                                  style = wx.RAISED_BORDER,
                                  size=(100,20)
                                  )
        self.lbStatusGauge = wx.StaticText(self.sequencesPanel, -1, " Import Status",
                           style = wx.RAISED_BORDER,
                           size=(100,20)
                           )
##        self.lbComplete = wx.StaticText(self.sequencesPanel, -1, "Complete",
##                        style = wx.RAISED_BORDER,
##                        size=(100,20))


        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)

        self.tempDir = ''
        self.xlightDir = ''
        self.xnetFile = ''
        if os.path.exists(self.cfgFile):
            config = pickle.load(open(self.cfgFile,'rb'))
            if config['SEQ_MODE'] == 'combine':
                self.seqOptionCombine(None)
                optionsMenu.Check(302,True)
            if config.has_key(self.SEQUENCE_TEMPDIR):
                self.tempDir = config[self.SEQUENCE_TEMPDIR]
                self.xlightDir = config[self.SEQUENCE_XDIR]

        self.xnetFile = 'C:\\xLights\\xlights_networks.xml' if self.xlightDir == '' else self.xlightDir + '\\xlights_networks.xml'
        if os.path.exists(self.xnetFile):
           self.netInfo = xNetwork(self.xnetFile)
        else:
            dlg = wx.MessageBox('xlights_network.xml file not found at %s'%(self.xlightDir)
                + ' if you already have a configured xlights network make sure options->xlights directory is '
                + 'set properly' )
            self.miAddSeq.Enable(False)
        self.__set_properties()
        self.__do_layout()