<gh_stars>0
"""Subclass of testFrame2, which is generated by wxFormBuilder."""

import wx
import opg
#from astropy.coordinates import Angle
import obsPlanGraphs


# Implementing testFrame2
class opg_testFrame2( opg.testFrame2 ):
    def __init__( self, parent ):
        opg.testFrame2.__init__( self, parent )

	# Handlers for testFrame2 events.
    def setObsCoords( self, event ):
        siteNum = int(self.obs_box.GetSelection())
        if siteNum == 1: #RIT Observatory
            self.lat_box.SetValue("43.0758")
            self.NS_box.SetSelection(0) #N
            self.long_box.SetValue("77.6647")
            self.EW_box.SetSelection(1) #W
            self.elev_box.SetValue("168")
        elif siteNum == 2: #Kitt Peak 0.9m
            self.lat_box.SetValue("31.9599")
            self.NS_box.SetSelection(0) #N
            self.long_box.SetValue("111.5997")
            self.EW_box.SetSelection(1) #W
            self.elev_box.SetValue("2077")
        """
        if siteNum != 0:
            self.lat_box.SetEditable(False)
            self.long_box.SetEditable(False)
            self.elev_box.SetEditable(False)
        else:
            self.lat_box.SetEditable(True)
            self.long_box.SetEditable(True)
            self.elev_box.SetEditable(True)
        """

    def getInfo( self, event ):
        #Get the coordinates of the target
        isDegrees = int(self.RaDec_unit_box.GetSelection()) #0 is sexagesimal, 1 is degrees
        if isDegrees == 0:
            """
            ra = Angle(str(self.ra_box.GetValue()) + " hours")
            dec = Angle(str(self.dec_box.GetValue()) + " degrees")
            targetCoords = (float(ra.degree), float(dec.degree))
            """
            print("DON'T DO THIS YET, NEED TO NOT USE ASTROPY.")
        else:
            ra = float(self.ra_box.GetValue())
            dec = float(self.dec_box.GetValue())
            targetCoords = (ra, dec)
        print(targetCoords)
        #Get observing site location
        lat_select = int(self.NS_box.GetSelection())
        lon_select = int(self.EW_box.GetSelection())
        if lat_select == 0:
            latSign = 1
        else:
            latSign = -1
        if lon_select == 0:
            lonSign = 1
        else:
            lonSign = -1
        lat = latSign * float(self.lat_box.GetValue())
        long = lonSign * float(self.long_box.GetValue())
        elev = float(self.elev_box.GetValue())
        obsCoords = (lat, long, elev)
        print(obsCoords)
        #Get starting date for observations
        wxStartDate = self.startDate_box.GetValue()
        startDate = wxStartDate.FormatISODate()
        print(startDate)
        #Get number of days and graphs to be made
        numDays = int(self.numDays_box.GetString(self.numDays_box.GetSelection()))
        print(numDays)
        if numDays == 1:
            numRows = 0
        else:
            numRows = int(numDays / 3)
        print(numRows)
        #Get other important values
        tName = str(self.tName_box.GetValue())
        period = float(self.period_box.GetValue())
        initialHJD = float(self.initialHJD_box.GetValue())
        utc_offset = int(self.utc_box.GetValue())
        alt_lim = float(self.altLim_box.GetValue())
        print("Got other values!")
        fig_isSave = self.saveFig_check.IsChecked()
        file_isSave = self.saveFile_check.IsChecked()
        savePath = str(self.filePath_box.GetPath())
        figName = str(self.saveFig_box.GetValue())
        fileName = str(self.saveFile_box.GetValue())
        figPath = savePath + figName
        filePath = savePath + fileName
        #Make the graphs and files!
        if numRows == 0:
            if fig_isSave: 
                obsPlanGraphs.obsPlanGraph(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, targetName=tName, saveFig=figPath)
            else:
                obsPlanGraphs.obsPlanGraph(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, targetName=tName)
        else:
            if fig_isSave and file_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFig=figPath, saveFile=filePath)
            elif fig_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFig=figPath)
            elif file_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFile=filePath)
            else:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName)
        #Open the new window
        newFrame = opg.figFrame(self)
        newFrame.Show()
        
        
    def setObsCustom( self, event ):
        wasMod = False
        if self.lat_box.IsModified():
            wasMod = True
        elif self.long_box.IsModified():
            wasMod = True
        elif self.elev_box.IsModified():
            wasMod = True
        """
        elif self.NS_box.GetSelection() != 0: #wait, actually? That's not right either... what if we added a default place where it was S, or W? Oh... is that actually the issue then...?
            wasMod = True
        elif self.EW_box.GetSelection() != 0:
            wasMod = True
        """
        if wasMod:
            self.obs_box.SetSelection(0) #Set the box to "custom"

app = wx.App()
frame = opg_testFrame2(None).Show()
app.MainLoop()
"""Subclass of testFrame2, which is generated by wxFormBuilder."""

import wx
import opg
#from astropy.coordinates import Angle
import obsPlanGraphs


# Implementing testFrame2
class opg_testFrame2( opg.testFrame2 ):
    def __init__( self, parent ):
        opg.testFrame2.__init__( self, parent )

	# Handlers for testFrame2 events.
    def setObsCoords( self, event ):
        siteNum = int(self.obs_box.GetSelection())
        if siteNum == 1: #RIT Observatory
            self.lat_box.SetValue("43.0758")
            self.NS_box.SetSelection(0) #N
            self.long_box.SetValue("77.6647")
            self.EW_box.SetSelection(1) #W
            self.elev_box.SetValue("168")
        elif siteNum == 2: #Kitt Peak 0.9m
            self.lat_box.SetValue("31.9599")
            self.NS_box.SetSelection(0) #N
            self.long_box.SetValue("111.5997")
            self.EW_box.SetSelection(1) #W
            self.elev_box.SetValue("2077")
        """
        if siteNum != 0:
            self.lat_box.SetEditable(False)
            self.long_box.SetEditable(False)
            self.elev_box.SetEditable(False)
        else:
            self.lat_box.SetEditable(True)
            self.long_box.SetEditable(True)
            self.elev_box.SetEditable(True)
        """

    def getInfo( self, event ):
        #Get the coordinates of the target
        isDegrees = int(self.RaDec_unit_box.GetSelection()) #0 is sexagesimal, 1 is degrees
        if isDegrees == 0:
            """
            ra = Angle(str(self.ra_box.GetValue()) + " hours")
            dec = Angle(str(self.dec_box.GetValue()) + " degrees")
            targetCoords = (float(ra.degree), float(dec.degree))
            """
            print("DON'T DO THIS YET, NEED TO NOT USE ASTROPY.")
        else:
            ra = float(self.ra_box.GetValue())
            dec = float(self.dec_box.GetValue())
            targetCoords = (ra, dec)
        print(targetCoords)
        #Get observing site location
        lat_select = int(self.NS_box.GetSelection())
        lon_select = int(self.EW_box.GetSelection())
        if lat_select == 0:
            latSign = 1
        else:
            latSign = -1
        if lon_select == 0:
            lonSign = 1
        else:
            lonSign = -1
        lat = latSign * float(self.lat_box.GetValue())
        long = lonSign * float(self.long_box.GetValue())
        elev = float(self.elev_box.GetValue())
        obsCoords = (lat, long, elev)
        print(obsCoords)
        #Get starting date for observations
        wxStartDate = self.startDate_box.GetValue()
        startDate = wxStartDate.FormatISODate()
        print(startDate)
        #Get number of days and graphs to be made
        numDays = int(self.numDays_box.GetString(self.numDays_box.GetSelection()))
        print(numDays)
        if numDays == 1:
            numRows = 0
        else:
            numRows = int(numDays / 3)
        print(numRows)
        #Get other important values
        tName = str(self.tName_box.GetValue())
        period = float(self.period_box.GetValue())
        initialHJD = float(self.initialHJD_box.GetValue())
        utc_offset = int(self.utc_box.GetValue())
        alt_lim = float(self.altLim_box.GetValue())
        print("Got other values!")
        fig_isSave = self.saveFig_check.IsChecked()
        file_isSave = self.saveFile_check.IsChecked()
        savePath = str(self.filePath_box.GetPath())
        figName = str(self.saveFig_box.GetValue())
        fileName = str(self.saveFile_box.GetValue())
        figPath = savePath + figName
        filePath = savePath + fileName
        #Make the graphs and files!
        if numRows == 0:
            if fig_isSave: 
                obsPlanGraphs.obsPlanGraph(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, targetName=tName, saveFig=figPath)
            else:
                obsPlanGraphs.obsPlanGraph(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, targetName=tName)
        else:
            if fig_isSave and file_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFig=figPath, saveFile=filePath)
            elif fig_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFig=figPath)
            elif file_isSave:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName, saveFile=filePath)
            else:
                obsPlanGraphs.obsPlanGraphs(targetCoords, obsCoords, utc_offset, period, initialHJD, startDate, altLim=alt_lim, nRows=numRows, targetName=tName)
        #Open the new window
        newFrame = opg.figFrame(self)
        newFrame.Show()
        
        
    def setObsCustom( self, event ):
        wasMod = False
        if self.lat_box.IsModified():
            wasMod = True
        elif self.long_box.IsModified():
            wasMod = True
        elif self.elev_box.IsModified():
            wasMod = True
        """
        elif self.NS_box.GetSelection() != 0: #wait, actually? That's not right either... what if we added a default place where it was S, or W? Oh... is that actually the issue then...?
            wasMod = True
        elif self.EW_box.GetSelection() != 0:
            wasMod = True
        """
        if wasMod:
            self.obs_box.SetSelection(0) #Set the box to "custom"

app = wx.App()
frame = opg_testFrame2(None).Show()
app.MainLoop()
Subclass of testFrame2, which is generated by wxFormBuilder. #from astropy.coordinates import Angle # Implementing testFrame2 # Handlers for testFrame2 events. #RIT Observatory #N #W #Kitt Peak 0.9m #N #W if siteNum != 0:             self.lat_box.SetEditable(False)             self.long_box.SetEditable(False)             self.elev_box.SetEditable(False)         else:             self.lat_box.SetEditable(True)             self.long_box.SetEditable(True)             self.elev_box.SetEditable(True) #Get the coordinates of the target #0 is sexagesimal, 1 is degrees ra = Angle(str(self.ra_box.GetValue()) + " hours")             dec = Angle(str(self.dec_box.GetValue()) + " degrees")             targetCoords = (float(ra.degree), float(dec.degree)) #Get observing site location #Get starting date for observations #Get number of days and graphs to be made #Get other important values #Make the graphs and files! #Open the new window elif self.NS_box.GetSelection() != 0: #wait, actually? That's not right either... what if we added a default place where it was S, or W? Oh... is that actually the issue then...?             wasMod = True         elif self.EW_box.GetSelection() != 0:             wasMod = True #Set the box to "custom"