Exemplo n.º 1
0
    def __init__(self, parent, universe):
        wx.Panel.__init__(self, parent)

        self.moving = False
        self.movingFleet = ()

        self.universe = universe

        self.sm = StarmapPanel(self, universe.starmap)

        self.notebook = wx.Notebook(self)
        self.starpanel = StarPanel(self.notebook)
        self.fleetpanel = FleetPanel(self.notebook)
        self.notebook.AddPage(self.starpanel, "Star")
        self.notebook.AddPage(self.fleetpanel, "Fleets")

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(self.sm, 4, flag=wx.EXPAND | wx.ALL)
        hsizer.Add(self.notebook, 1, flag=wx.EXPAND | wx.ALL, border=2)

        bottombar = MenuPanel(self, self.universe)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        vsizer.Add(hsizer, 15, flag=wx.EXPAND | wx.ALL, border=1)
        vsizer.Add(bottombar, 1, flag=wx.ALIGN_CENTER, border=1)

        self.SetSizer(vsizer)

        wx.EVT_BUTTON(self, TURN_ID, self.doNextTurn)
        wx.EVT_TOGGLEBUTTON(self, MOVE_ID, self.doMove)
Exemplo n.º 2
0
    def __init__(self, parent, id, title, **kwds):
        wx.Frame.__init__(self, parent, id, title, **kwds)

        self.points = []
        self.selectionPoints = []
        self.plotPanel = wxmpl.PlotPanel(self, -1)
        self.regionButton = wx.ToggleButton(self, -1, 'Pick Region')
        self.pointButton = wx.ToggleButton(self, -1, 'Pick Point')

        wx.EVT_TOGGLEBUTTON(self, self.regionButton.GetId(),
                            self._on_regionButton)

        wxmpl.EVT_POINT(self, self.plotPanel.GetId(), self._on_point)
        wxmpl.EVT_SELECTION(self, self.plotPanel.GetId(), self._on_selection)

        self._layout()
        self._replot()
Exemplo n.º 3
0
    def __init__(self, parent, id, choices=[], value=0):
        wx.Panel.__init__(self, parent, id)
        self.buttons = [wx.ToggleButton(self, -1, c) for c in choices]
        self.selected = None
        self.SetValue(value)
        for b in self.buttons:

            def handler(event, b=b):
                self.on_toggle(b, event)

            wx.EVT_TOGGLEBUTTON(self, b.GetId(), handler)
        sizer = wx.BoxSizer(wx.VERTICAL)
        for b in self.buttons:
            sizer.Add(b, 0, wx.ALL | wx.EXPAND, 1)
        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        sizer.SetSizeHints(self)
Exemplo n.º 4
0
    def __init__(self, parent, wxId, id, style):
        # Create a wxButton of the appropriate type.
        if style != Button.STYLE_MINI:
            widget = wx.Button(parent, wxId, uniConv(language.translate(id)))
        else:
            widget = wx.ToggleButton(parent, wxId,
                                     uniConv(language.translate(id)))

        # Default buttons are usually a bit different visually.
        if style == Button.STYLE_DEFAULT:
            widget.SetDefault()

        base.Widget.__init__(self, widget)
        self.widgetId = id

        if style == Button.STYLE_MINI:
            # The mini buttons use the small style.
            self.setSmallStyle()
            # The size of the mini buttons is configurable.
            bestSize = widget.GetBestSize()
            width = 30
            height = bestSize[1]
            try:
                width = st.getSystemInteger('button-mini-width')
                if st.getSystemInteger('button-mini-height'):
                    height = st.getSystemInteger('button-mini-height')
            except:
                pass
            widget.SetMinSize((width, height))

        if style != Button.STYLE_MINI:
            # We will handle the click event ourselves.
            wx.EVT_BUTTON(parent, wxId, self.onClick)
            #self.updateDefaultSize()
        else:
            # Pop back up when toggled down.
            wx.EVT_TOGGLEBUTTON(parent, wxId, self.onToggle)
Exemplo n.º 5
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)

        # Menu Bar
        self.frame_1_menubar = wx.MenuBar()
        self.SetMenuBar(self.frame_1_menubar)
        wxglade_tmp_menu = wx.Menu()
        self.Exit = wx.MenuItem(wxglade_tmp_menu, ID_EXIT, "Exit", "Exit",
                                wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.Exit)
        self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
        # Menu Bar end
        self.panel_1 = wx.Panel(self, -1)
        self.button_1 = wx.Button(self, ID_BUTTON_1, "LSB")
        self.button_2 = wx.Button(self, ID_BUTTON_2, "USB")
        self.button_3 = wx.Button(self, ID_BUTTON_3, "AM")
        self.button_4 = wx.Button(self, ID_BUTTON_4, "CW")
        self.button_5 = wx.ToggleButton(self, ID_BUTTON_5, "Upper")
        self.slider_fcutoff_hi = wx.Slider(self,
                                           ID_SLIDER_1,
                                           0,
                                           -15798,
                                           15799,
                                           style=wx.SL_HORIZONTAL
                                           | wx.SL_LABELS)
        self.button_6 = wx.ToggleButton(self, ID_BUTTON_6, "Lower")
        self.slider_fcutoff_lo = wx.Slider(self,
                                           ID_SLIDER_2,
                                           0,
                                           -15799,
                                           15798,
                                           style=wx.SL_HORIZONTAL
                                           | wx.SL_LABELS)
        self.panel_5 = wx.Panel(self, -1)
        self.label_1 = wx.StaticText(self, -1, " Band\nCenter")
        self.text_ctrl_1 = wx.TextCtrl(self, ID_TEXT_1, "")
        self.panel_6 = wx.Panel(self, -1)
        self.panel_7 = wx.Panel(self, -1)
        self.panel_2 = wx.Panel(self, -1)
        self.button_7 = wx.ToggleButton(self, ID_BUTTON_7, "Freq")
        self.slider_3 = wx.Slider(self, ID_SLIDER_3, 3000, 0, 6000)
        self.spin_ctrl_1 = wx.SpinCtrl(self, ID_SPIN_1, "", min=0, max=100)
        self.button_8 = wx.ToggleButton(self, ID_BUTTON_8, "Vol")
        self.slider_4 = wx.Slider(self, ID_SLIDER_4, 0, 0, 500)
        self.slider_5 = wx.Slider(self, ID_SLIDER_5, 0, 0, 20)
        self.button_9 = wx.ToggleButton(self, ID_BUTTON_9, "Time")
        self.button_11 = wx.Button(self, ID_BUTTON_11, "Rew")
        self.button_10 = wx.Button(self, ID_BUTTON_10, "Fwd")
        self.panel_3 = wx.Panel(self, -1)
        self.label_2 = wx.StaticText(self, -1, "PGA               ")
        self.panel_4 = wx.Panel(self, -1)
        self.panel_8 = wx.Panel(self, -1)
        self.panel_9 = wx.Panel(self, -1)
        self.label_3 = wx.StaticText(self, -1, "AM Sync\nCarrier")
        self.slider_6 = wx.Slider(self,
                                  ID_SLIDER_6,
                                  50,
                                  0,
                                  200,
                                  style=wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.label_4 = wx.StaticText(self, -1, "Antenna Tune")
        self.slider_7 = wx.Slider(self,
                                  ID_SLIDER_7,
                                  1575,
                                  950,
                                  2200,
                                  style=wx.SL_HORIZONTAL | wx.SL_LABELS)
        self.panel_10 = wx.Panel(self, -1)
        self.button_12 = wx.ToggleButton(self, ID_BUTTON_12, "Auto Tune")
        self.button_13 = wx.Button(self, ID_BUTTON_13, "Calibrate")
        self.button_14 = wx.Button(self, ID_BUTTON_14, "Reset")
        self.panel_11 = wx.Panel(self, -1)
        self.panel_12 = wx.Panel(self, -1)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        parser = OptionParser(option_class=eng_option)
        parser.add_option("",
                          "--address",
                          type="string",
                          default="addr=192.168.10.2",
                          help="Address of UHD device, [default=%default]")
        parser.add_option("-c",
                          "--ddc-freq",
                          type="eng_float",
                          default=3.9e6,
                          help="set Rx DDC frequency to FREQ",
                          metavar="FREQ")
        parser.add_option(
            "-s",
            "--samp-rate",
            type="eng_float",
            default=256e3,
            help="set sample rate (bandwidth) [default=%default]")
        parser.add_option("-a",
                          "--audio_file",
                          default="",
                          help="audio output file",
                          metavar="FILE")
        parser.add_option("-r",
                          "--radio_file",
                          default="",
                          help="radio output file",
                          metavar="FILE")
        parser.add_option("-i",
                          "--input_file",
                          default="",
                          help="radio input file",
                          metavar="FILE")
        parser.add_option(
            "-O",
            "--audio-output",
            type="string",
            default="",
            help="audio output device name. E.g., hw:0,0, /dev/dsp, or pulse")

        (options, args) = parser.parse_args()

        self.usrp_center = options.ddc_freq
        input_rate = options.samp_rate
        self.slider_range = input_rate * 0.9375
        self.f_lo = self.usrp_center - (self.slider_range / 2)
        self.f_hi = self.usrp_center + (self.slider_range / 2)
        self.af_sample_rate = 32000
        fir_decim = long(input_rate / self.af_sample_rate)

        # data point arrays for antenna tuner
        self.xdata = []
        self.ydata = []

        self.tb = gr.top_block()

        # radio variables, initial conditions
        self.frequency = self.usrp_center
        # these map the frequency slider (0-6000) to the actual range
        self.f_slider_offset = self.f_lo
        self.f_slider_scale = 10000
        self.spin_ctrl_1.SetRange(self.f_lo, self.f_hi)
        self.text_ctrl_1.SetValue(str(int(self.usrp_center)))
        self.slider_5.SetValue(0)
        self.AM_mode = False

        self.slider_3.SetValue(
            (self.frequency - self.f_slider_offset) / self.f_slider_scale)
        self.spin_ctrl_1.SetValue(int(self.frequency))

        POWERMATE = True
        try:
            self.pm = powermate.powermate(self)
        except:
            sys.stderr.write("Unable to find PowerMate or Contour Shuttle\n")
            POWERMATE = False

        if POWERMATE:
            powermate.EVT_POWERMATE_ROTATE(self, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self, self.on_pmButton)
        self.active_button = 7

        # command line options
        if options.audio_file == "": SAVE_AUDIO_TO_FILE = False
        else: SAVE_AUDIO_TO_FILE = True
        if options.radio_file == "": SAVE_RADIO_TO_FILE = False
        else: SAVE_RADIO_TO_FILE = True
        if options.input_file == "": self.PLAY_FROM_USRP = True
        else: self.PLAY_FROM_USRP = False

        if self.PLAY_FROM_USRP:
            self.src = uhd.usrp_source(device_addr=options.address,
                                       io_type=uhd.io_type.COMPLEX_FLOAT32,
                                       num_channels=1)
            self.src.set_samp_rate(input_rate)
            input_rate = self.src.get_samp_rate()

            self.src.set_center_freq(self.usrp_center, 0)
            self.tune_offset = 0

        else:
            self.src = gr.file_source(gr.sizeof_short, options.input_file)
            self.tune_offset = 2200  # 2200 works for 3.5-4Mhz band

            # convert rf data in interleaved short int form to complex
            s2ss = gr.stream_to_streams(gr.sizeof_short, 2)
            s2f1 = gr.short_to_float()
            s2f2 = gr.short_to_float()
            src_f2c = gr.float_to_complex()
            self.tb.connect(self.src, s2ss)
            self.tb.connect((s2ss, 0), s2f1)
            self.tb.connect((s2ss, 1), s2f2)
            self.tb.connect(s2f1, (src_f2c, 0))
            self.tb.connect(s2f2, (src_f2c, 1))

        # save radio data to a file
        if SAVE_RADIO_TO_FILE:
            radio_file = gr.file_sink(gr.sizeof_short, options.radio_file)
            self.tb.connect(self.src, radio_file)

# 2nd DDC
        xlate_taps = gr.firdes.low_pass ( \
           1.0, input_rate, 16e3, 4e3, gr.firdes.WIN_HAMMING )
        self.xlate = gr.freq_xlating_fir_filter_ccf ( \
           fir_decim, xlate_taps, self.tune_offset, input_rate )

        # Complex Audio filter
        audio_coeffs = gr.firdes.complex_band_pass(
            1.0,  # gain
            self.af_sample_rate,  # sample rate
            -3000,  # low cutoff
            0,  # high cutoff
            100,  # transition
            gr.firdes.WIN_HAMMING)  # window
        self.slider_fcutoff_hi.SetValue(0)
        self.slider_fcutoff_lo.SetValue(-3000)

        self.audio_filter = gr.fir_filter_ccc(1, audio_coeffs)

        # Main +/- 16Khz spectrum display
        self.fft = fftsink2.fft_sink_c(self.panel_2,
                                       fft_size=512,
                                       sample_rate=self.af_sample_rate,
                                       average=True,
                                       size=(640, 240))

        # AM Sync carrier
        if AM_SYNC_DISPLAY:
            self.fft2 = fftsink.fft_sink_c(self.tb,
                                           self.panel_9,
                                           y_per_div=20,
                                           fft_size=512,
                                           sample_rate=self.af_sample_rate,
                                           average=True,
                                           size=(640, 240))

        c2f = gr.complex_to_float()

        # AM branch
        self.sel_am = gr.multiply_const_cc(0)
        # the following frequencies turn out to be in radians/sample
        # gr.pll_refout_cc(alpha,beta,min_freq,max_freq)
        # suggested alpha = X, beta = .25 * X * X
        pll = gr.pll_refout_cc(.5, .0625,
                               (2. * math.pi * 7.5e3 / self.af_sample_rate),
                               (2. * math.pi * 6.5e3 / self.af_sample_rate))
        self.pll_carrier_scale = gr.multiply_const_cc(complex(10, 0))
        am_det = gr.multiply_cc()
        # these are for converting +7.5kHz to -7.5kHz
        # for some reason gr.conjugate_cc() adds noise ??
        c2f2 = gr.complex_to_float()
        c2f3 = gr.complex_to_float()
        f2c = gr.float_to_complex()
        phaser1 = gr.multiply_const_ff(1)
        phaser2 = gr.multiply_const_ff(-1)

        # filter for pll generated carrier
        pll_carrier_coeffs = gr.firdes.complex_band_pass(
            2.0,  # gain
            self.af_sample_rate,  # sample rate
            7400,  # low cutoff
            7600,  # high cutoff
            100,  # transition
            gr.firdes.WIN_HAMMING)  # window

        self.pll_carrier_filter = gr.fir_filter_ccc(1, pll_carrier_coeffs)

        self.sel_sb = gr.multiply_const_ff(1)
        combine = gr.add_ff()

        #AGC
        sqr1 = gr.multiply_ff()
        intr = gr.iir_filter_ffd([.004, 0], [0, .999])
        offset = gr.add_const_ff(1)
        agc = gr.divide_ff()

        self.scale = gr.multiply_const_ff(0.00001)
        dst = audio.sink(long(self.af_sample_rate), options.audio_output)

        if self.PLAY_FROM_USRP:
            self.tb.connect(self.src, self.xlate, self.fft)
        else:
            self.tb.connect(src_f2c, self.xlate, self.fft)

        self.tb.connect(self.xlate, self.audio_filter, self.sel_am,
                        (am_det, 0))
        self.tb.connect(self.sel_am, pll, self.pll_carrier_scale,
                        self.pll_carrier_filter, c2f3)
        self.tb.connect((c2f3, 0), phaser1, (f2c, 0))
        self.tb.connect((c2f3, 1), phaser2, (f2c, 1))
        self.tb.connect(f2c, (am_det, 1))
        self.tb.connect(am_det, c2f2, (combine, 0))
        self.tb.connect(self.audio_filter, c2f, self.sel_sb, (combine, 1))

        if AM_SYNC_DISPLAY:
            self.tb.connect(self.pll_carrier_filter, self.fft2)

        self.tb.connect(combine, self.scale)
        self.tb.connect(self.scale, (sqr1, 0))
        self.tb.connect(self.scale, (sqr1, 1))
        self.tb.connect(sqr1, intr, offset, (agc, 1))
        self.tb.connect(self.scale, (agc, 0))
        self.tb.connect(agc, dst)

        if SAVE_AUDIO_TO_FILE:
            f_out = gr.file_sink(gr.sizeof_short, options.audio_file)
            sc1 = gr.multiply_const_ff(64000)
            f2s1 = gr.float_to_short()
            self.tb.connect(agc, sc1, f2s1, f_out)

        self.tb.start()

        # for mouse position reporting on fft display
        self.fft.win.Bind(wx.EVT_LEFT_UP, self.Mouse)
        # and left click to re-tune
        self.fft.win.Bind(wx.EVT_LEFT_DOWN, self.Click)

        # start a timer to check for web commands
        if WEB_CONTROL:
            self.timer = UpdateTimer(self, 1000)  # every 1000 mSec, 1 Sec

        wx.EVT_BUTTON(self, ID_BUTTON_1, self.set_lsb)
        wx.EVT_BUTTON(self, ID_BUTTON_2, self.set_usb)
        wx.EVT_BUTTON(self, ID_BUTTON_3, self.set_am)
        wx.EVT_BUTTON(self, ID_BUTTON_4, self.set_cw)
        wx.EVT_BUTTON(self, ID_BUTTON_10, self.fwd)
        wx.EVT_BUTTON(self, ID_BUTTON_11, self.rew)
        wx.EVT_BUTTON(self, ID_BUTTON_13, self.AT_calibrate)
        wx.EVT_BUTTON(self, ID_BUTTON_14, self.AT_reset)
        wx.EVT_TOGGLEBUTTON(self, ID_BUTTON_5, self.on_button)
        wx.EVT_TOGGLEBUTTON(self, ID_BUTTON_6, self.on_button)
        wx.EVT_TOGGLEBUTTON(self, ID_BUTTON_7, self.on_button)
        wx.EVT_TOGGLEBUTTON(self, ID_BUTTON_8, self.on_button)
        wx.EVT_TOGGLEBUTTON(self, ID_BUTTON_9, self.on_button)
        wx.EVT_SLIDER(self, ID_SLIDER_1, self.set_filter)
        wx.EVT_SLIDER(self, ID_SLIDER_2, self.set_filter)
        wx.EVT_SLIDER(self, ID_SLIDER_3, self.slide_tune)
        wx.EVT_SLIDER(self, ID_SLIDER_4, self.set_volume)
        wx.EVT_SLIDER(self, ID_SLIDER_5, self.set_pga)
        wx.EVT_SLIDER(self, ID_SLIDER_6, self.am_carrier)
        wx.EVT_SLIDER(self, ID_SLIDER_7, self.antenna_tune)
        wx.EVT_SPINCTRL(self, ID_SPIN_1, self.spin_tune)

        wx.EVT_MENU(self, ID_EXIT, self.TimeToQuit)
Exemplo n.º 6
0
 def create_widget(self):
     self.widget = wx.ToggleButton(self.parent.widget, self.id, self.label)
     self.widget.SetValue(self.value)
     wx.EVT_TOGGLEBUTTON(self.widget, self.id, self.on_set_focus)
Exemplo n.º 7
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self,
                           id=wxID_WXDIALOG1,
                           name='',
                           parent=prnt,
                           pos=wx.Point(394, 138),
                           size=wx.Size(320, 103),
                           style=wx.DEFAULT_DIALOG_STYLE,
                           title='Dump')
        self._init_utils()
        self.SetClientSize(wx.Size(320, 103))
        self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, false, ''))
        self.SetForegroundColour(wx.Colour(0, 0, 0))

        self.staticText1 = wx.StaticText(id=wxID_WXDIALOG1STATICTEXT1,
                                         label='Filename:',
                                         name='staticText1',
                                         parent=self,
                                         pos=wx.Point(4, 10),
                                         size=wx.Size(54, 16),
                                         style=0)

        self.Filename = wx.TextCtrl(id=wxID_WXDIALOG1FILENAME,
                                    name='Filename',
                                    parent=self,
                                    pos=wx.Point(60, 8),
                                    size=wx.Size(160, 22),
                                    style=wx.TE_PROCESS_ENTER,
                                    value='')

        self.Browser = wx.Button(id=wxID_WXDIALOG1BROWSER,
                                 label='Browse',
                                 name='Browser',
                                 parent=self,
                                 pos=wx.Point(230, 8),
                                 size=wx.Size(80, 22),
                                 style=0)
        wx.EVT_BUTTON(self.Browser, wxID_WXDIALOG1BROWSER,
                      self.OnBrowserButton)

        self.staticText2 = wx.StaticText(id=wxID_WXDIALOG1STATICTEXT2,
                                         label='Attributes:',
                                         name='staticText2',
                                         parent=self,
                                         pos=wx.Point(4, 40),
                                         size=wx.Size(55, 16),
                                         style=0)

        self.Attributes = wx.TextCtrl(id=wxID_WXDIALOG1ATTRIBUTES,
                                      name='Attributes',
                                      parent=self,
                                      pos=wx.Point(60, 38),
                                      size=wx.Size(100, 22),
                                      style=wx.TE_PROCESS_ENTER,
                                      value='dump')

        self.Pyvars = wx.ToggleButton(id=wxID_WXDIALOG1PYVARS,
                                      label='Save python variables',
                                      name='Pyvars',
                                      parent=self,
                                      pos=wx.Point(170, 38),
                                      size=wx.Size(140, 22),
                                      style=0)
        self.Pyvars.SetValue(true)
        wx.EVT_TOGGLEBUTTON(self.Pyvars, wxID_WXDIALOG1PYVARS,
                            self.OnPyvarsTogglebutton)

        self.Text3 = wx.StaticText(id=wxID_WXDIALOG1TEXT3,
                                   label='Suffix:',
                                   name='Text3',
                                   parent=self,
                                   pos=wx.Point(4, 70),
                                   size=wx.Size(33, 16),
                                   style=0)

        self.Varsuffix = wx.TextCtrl(id=wxID_WXDIALOG1VARSUFFIX,
                                     name='Varsuffix',
                                     parent=self,
                                     pos=wx.Point(60, 68),
                                     size=wx.Size(100, 22),
                                     style=wx.TE_PROCESS_ENTER,
                                     value='')

        self.Dump = wx.Button(id=wxID_WXDIALOG1DUMP,
                              label='DUMP',
                              name='Dump',
                              parent=self,
                              pos=wx.Point(170, 68),
                              size=wx.Size(140, 22),
                              style=0)
        self.Dump.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, false, ''))
        self.Dump.SetForegroundColour(wx.Colour(230, 0, 0))
        wx.EVT_BUTTON(self.Dump, wxID_WXDIALOG1DUMP, self.OnDumpButton)
Exemplo n.º 8
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: frmRipper.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.lblTempPath = wx.StaticText(self,
                                         -1,
                                         "Working path:",
                                         style=wx.ALIGN_RIGHT)
        self.txtTempPath = wx.TextCtrl(self, -1, "/tmp")
        self.cmdTempPath = wx.Button(self,
                                     ID_CHOOSETMPPATH,
                                     "...",
                                     style=wx.BU_LEFT)
        self.lblOutPath = wx.StaticText(self,
                                        -1,
                                        "Final output path:",
                                        style=wx.ALIGN_RIGHT)
        self.txtOutPath = wx.TextCtrl(self, -1, "")
        self.cmdOutPath = wx.Button(self,
                                    ID_CHOOSEOUTPATH,
                                    "...",
                                    style=wx.BU_LEFT)
        self.chkEject = wx.CheckBox(self, -1, "Eject CD when done")
        self.lblCoverArt = wx.StaticText(self, -1,
                                         "Cover Art (APPLICATION blocks):")
        self.bmpCoverArt = wx.StaticBitmap(self,
                                           -1,
                                           wx.EmptyBitmap(120, 120),
                                           style=wx.SIMPLE_BORDER)
        self.lblCoverArtFilename = wx.StaticText(self, -1, "None Selected")
        self.lblMimeType = wx.StaticText(self, -1, "application/unknown")
        self.lblCoverArtSize = wx.StaticText(self, -1, "0 bytes")
        self.cmdCoverArt = wx.Button(self,
                                     ID_CHOOSECOVERART,
                                     "...",
                                     style=wx.BU_LEFT)
        self.cmdDetectCD = wx.ToggleButton(self, ID_DETECTCD, "Detect CD")
        self.cmdRip = wx.ToggleButton(self, ID_RIP, "Rip")
        #self.cmdWebBrowser = wx.Button(self, ID_WEBBROWSER, "Look Up")
        self.cmdClose = wx.Button(self, ID_CLOSE, "Close")
        self.lblTags = wx.StaticText(self, -1, "Tags (VORBIS_COMMENT block):")
        self.txtTags = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
        self.lblMessages = wx.StaticText(self, -1, "Messages:")
        self.txtMessages = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
        self.lblProgress = wx.StaticText(self, -1, "Idle")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        wx.Log.SetActiveTarget(wx.LogTextCtrl(self.txtMessages))

        wx.EVT_BUTTON(self, ID_CHOOSECOVERART, self.OnChooseCoverArt)
        wx.EVT_BUTTON(self, ID_CHOOSETMPPATH, self.OnChooseTmpPath)
        wx.EVT_BUTTON(self, ID_CHOOSEOUTPATH, self.OnChooseOutPath)
        wx.EVT_TOGGLEBUTTON(self, ID_DETECTCD, self.OnDetectCD)
        wx.EVT_TOGGLEBUTTON(self, ID_RIP, self.OnRip)
        wx.EVT_BUTTON(self, ID_CLOSE, self.OnClose)
        wx.EVT_BUTTON(self, ID_WEBBROWSER, self.OnWebBrowser)

        self.timer = wx.Timer(self, ID_TIMER)
        wx.EVT_TIMER(self, ID_TIMER, self.OnIdle)
        #wx.EVT_IDLE(self, self.OnIdle)

        self.coverart = None
        self.workdir = None
        self.cancelled = False
        self.cddevice = None

        self.txtTags.SetValue("Click Detect CD to fill in tag information\n" \
                              "automatically using the MusicBrainz database.\n\n" \
                              "Click Rip to start ripping.  You may still edit\n" \
                              "tags and select cover art after ripping has\n" \
                              "started.")

        self.setUIState(STATE_IDLE)
        self.CheckBinaries()
    def __init__(self, parent=None, id=-1, title="Access Grid Launcher",agtk_location=None):
        wx.Frame.__init__(self,parent,id,title,size=wx.Size(400,125),style=wx.DEFAULT_FRAME_STYLE&(~wx.MAXIMIZE_BOX))

        self.processManager=ProcessManager();
        self.browser=None;
        
        if IsOSX():
            self.mainButton=wx.RadioButton(self,self.BUTTON_MAIN_ID,"Main",style=wx.RB_GROUP);
            wx.EVT_RADIOBUTTON(self,self.BUTTON_MAIN_ID,self.OnToggle);
        else:
            self.mainButton=wx.ToggleButton(self,self.BUTTON_MAIN_ID,"Main");
            wx.EVT_TOGGLEBUTTON(self,self.BUTTON_MAIN_ID,self.OnToggle);
        self.mainButton.SetValue(True);

        if IsOSX():
            self.docButton=wx.RadioButton(self,self.BUTTON_DOCS_ID,"Documentation");
            wx.EVT_RADIOBUTTON(self,self.BUTTON_DOCS_ID,self.OnToggle);
        else:
            self.docButton=wx.ToggleButton(self,self.BUTTON_DOCS_ID,"Documentation");
            wx.EVT_TOGGLEBUTTON(self,self.BUTTON_DOCS_ID,self.OnToggle);
        self.docButton.SetValue(False);
        
        if IsOSX():
            self.confButton=wx.RadioButton(self,self.BUTTON_CONFIG_ID,"Configuration");
            wx.EVT_RADIOBUTTON(self,self.BUTTON_CONFIG_ID,self.OnToggle);
        else:
            self.confButton=wx.ToggleButton(self,self.BUTTON_CONFIG_ID,"Configuration");
            wx.EVT_TOGGLEBUTTON(self,self.BUTTON_CONFIG_ID,self.OnToggle);
        self.confButton.SetValue(False);

        if IsOSX():
            self.servButton=wx.RadioButton(self,self.BUTTON_SERVICE_ID,"Services");
            wx.EVT_RADIOBUTTON(self,self.BUTTON_SERVICE_ID,self.OnToggle);
        else:
            self.servButton=wx.ToggleButton(self,self.BUTTON_CONFIG_ID,"Services");
            wx.EVT_TOGGLEBUTTON(self,self.BUTTON_SERVICE_ID,self.OnToggle);
        self.servButton.SetValue(False);
        
        
        if IsOSX():
            self.debugButton=wx.RadioButton(self,self.BUTTON_DEBUG_ID,"Debug");
            wx.EVT_RADIOBUTTON(self,self.BUTTON_DEBUG_ID,self.OnToggle);
        else:
            self.debugButton=wx.ToggleButton(self,self.BUTTON_DEBUG_ID,"Debug");
            wx.EVT_TOGGLEBUTTON(self,self.BUTTON_DEBUG_ID,self.OnToggle);
        self.debugButton.SetValue(False)
        self.debugButton.Disable()
        self.debugButton.Show(False)
        
        if not agtk_location:
            agtk_location=".."
            
        self.mainButtonList=[];
        self.mainButtonActions=[];
        self.mainButtonList.append(wx.Button(self,self.BUTTON_VC_ID,"Venue Client"));
        venueClientPath = "%s/bin/VenueClient3.py"%(agtk_location)
        if not os.path.exists("%s/bin/VenueClient3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueClient.py"%(agtk_location)):
            venueClientPath = "%s/bin/VenueClient.py"%(agtk_location)
        self.mainButtonActions.append([self.RunPython,venueClientPath,[]]);
        for button in self.mainButtonList:
            button.Show(False);
        
        self.docsButtonList=[];
        self.docsButtonActions=[];
        self.docsButtonList.append(wx.Button(self,self.BUTTON_README_ID,"Read Me"));
        self.docsButtonActions.append([self.LoadURL,"file://%s/doc/README"%(agtk_location),[]]);
        self.docsButtonList.append(wx.Button(self,self.BUTTON_VCM_ID,"Venue Client Manual"));
        self.docsButtonActions.append([self.LoadURL,"http://www.mcs.anl.gov/fl/research/accessgrid/documentation/manuals/VenueClient/3_0",[]]);
        self.docsButtonList.append(wx.Button(self,self.BUTTON_VMCM_ID,"Venue Management Manual"));
        self.docsButtonActions.append([self.LoadURL,"http://www.mcs.anl.gov/fl/research/accessgrid/documentation/manuals/VenueManagement/3_0",[]]);
        self.docsButtonList.append(wx.Button(self,self.BUTTON_LIC_ID,"License"));
        self.docsButtonActions.append([self.LoadURL,"file://%s/COPYING.txt"%(agtk_location),[]]);
        for button in self.docsButtonList:
            button.Show(False);
        
        self.configButtonList=[];
        self.configButtonActions=[];
        self.configButtonList.append(wx.Button(self,self.BUTTON_NM_ID,"Node Management"));
        nodeManagementPath = "%s/bin/NodeManagement3.py"%(agtk_location)
        if not os.path.exists("%s/bin/NodeManagement3.py"%(agtk_location)) and os.path.exists("%s/bin/NodeManagement.py"%(agtk_location)):
            nodeManagementPath = "%s/bin/NodeManagement.py"%(agtk_location)
        self.configButtonActions.append([self.RunPython,nodeManagementPath,[]]);
        self.configButtonList.append(wx.Button(self,self.BUTTON_VM_ID,"Venue Management"));
        venueManagementPath = "%s/bin/VenueManagement3.py"%(agtk_location)
        if not os.path.exists("%s/bin/VenueManagement3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueManagement.py"%(agtk_location)):
            venueManagementPath = "%s/bin/VenueManagement.py"%(agtk_location)
        self.configButtonActions.append([self.RunPython,venueManagementPath,[]]);
        self.configButtonList.append(wx.Button(self,self.BUTTON_NSW_ID,"Node Setup Wizard"));
        nodeSetupWizardPath = "%s/bin/NodeSetupWizard3.py"%(agtk_location)
        if not os.path.exists("%s/bin/NodeSetupWizard3.py"%(agtk_location)) and os.path.exists("%s/bin/NodeSetupWizard.py"%(agtk_location)):
            nodeSetupWizardPath = "%s/bin/NodeSetupWizard.py"%(agtk_location)
        self.configButtonActions.append([self.RunPython,nodeSetupWizardPath,[]]);
        #self.configButtonList.append(wx.Button(self,self.BUTTON_CRW_ID,"Certificate Request Wizard"));
        #self.configButtonActions.append([self.RunPython,"%s/bin/CertificateRequestTool.py"%(agtk_location),[]]);
        self.configButtonList.append(wx.Button(self,self.BUTTON_CM_ID,"Certificate Management"));
        certManagerPath = "%s/bin/CertificateManager3.py"%(agtk_location)
        if not os.path.exists("%s/bin/CertificateManager3.py"%(agtk_location)) and os.path.exists("%s/bin/CertificateManager.py"%(agtk_location)):
            certManagerPath = "%s/bin/CertificateManager.py"%(agtk_location)
        self.configButtonActions.append([self.RunPython,certManagerPath,[]]);
        for button in self.configButtonList:
            button.Show(False);

        self.serviceButtonList=[];
        self.serviceButtonActions=[];
        self.serviceButtonList.append(wx.Button(self,self.BUTTON_NS_ID,"Node Service"));
        if IsOSX():
            self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runns.sh"]]);
        else:
            serviceManagerPath = "%s/bin/AGServiceManager3.py"%(agtk_location)
            if not os.path.exists("%s/bin/AGServiceManager3.py"%(agtk_location)) and os.path.exists("%s/bin/AGServiceManager.py"%(agtk_location)):
                serviceManagerPath = "%s/bin/AGServiceManager.py"%(agtk_location)
            self.serviceButtonActions.append([self.RunPython,serviceManagerPath,["-n"]]);
        self.serviceButtonList.append(wx.Button(self,self.BUTTON_SM_ID,"Service Manager"));
        if IsOSX():
            self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runsm.sh"]]);
        else:
            self.serviceButtonActions.append([self.RunPython,serviceManagerPath,[]]);
        self.serviceButtonList.append(wx.Button(self,self.BUTTON_VS_ID,"Venue Server"));
        if IsOSX():
            self.serviceButtonActions.append([self.RunCommandline,"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", ["-ps", "-e", "/Applications/AccessGridToolkit3.app/Contents/MacOS/runvs.sh"]]);
        else:
            venueserverPath = "%s/bin/VenueServer3.py"%(agtk_location)
            if not os.path.exists("%s/bin/VenueServer3.py"%(agtk_location)) and os.path.exists("%s/bin/VenueServer.py"%(agtk_location)):
                venueserverPath = "%s/bin/VenueServer.py"%(agtk_location)
            self.serviceButtonActions.append([self.RunPython,venueserverPath,[]]);
        for button in self.serviceButtonList:
            button.Show(False);
        
        self.debugButtonList=[];
        self.debugButtonActions=[];
        self.debugButtonList.append(wx.Button(self,self.BUTTON_VCD_ID,"Venue Client (Debug)"));
        self.debugButtonActions.append([self.RunPythonDebug,venueClientPath,["-d"]]);
        self.debugButtonList.append(wx.Button(self,self.BUTTON_CMD_ID,"Certificate Management (Debug)"));
        self.debugButtonActions.append([self.RunPythonDebug,certManagerPath,["-d"]]);
        self.debugButtonList.append(wx.Button(self,self.BUTTON_NSD_ID,"Node Service (Debug)"));
        self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/AGNodeService.py"%(agtk_location),["-d"]]);
        self.debugButtonList.append(wx.Button(self,self.BUTTON_SMD_ID,"Service Manager (Debug)"));
        self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/AGServiceManager.py"%(agtk_location),["-d"]]);
        self.debugButtonList.append(wx.Button(self,self.BUTTON_VSD_ID,"Venue Server (Debug)"));
        self.debugButtonActions.append([self.RunPythonDebug,"%s/bin/VenueServer.py"%(agtk_location),["-d"]]);
        for button in self.debugButtonList:
            button.Show(False);
        
        wx.EVT_BUTTON(self,self.BUTTON_VC_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_CM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_NS_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_SM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VS_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_README_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VCM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VMCM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_LIC_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_NM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VM_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_NSW_ID,self.OnButton);
        #wx.EVT_BUTTON(self,self.BUTTON_CRW_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VCD_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_CMD_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_NSD_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_SMD_ID,self.OnButton);
        wx.EVT_BUTTON(self,self.BUTTON_VSD_ID,self.OnButton);
        
        self.myLine=wx.StaticLine(self,-1,style=wx.LI_VERTICAL);
        
        self.__doLayout();