Beispiel #1
0
 def __init__(self, NetworkTable, frontProcessor, backProcessor):
     
     self.netTable = NetworkTable
     util.initialize_from_xml(self)
     
     #  ----- Begin Cameras -----
     self.BackCameraImage = util.replace_widget(self.BackCameraImage, target_widget.TargetWidget((320,240), self.netTable))
     #  ----- End Cameras -----
     
     backProcessor.set_camera_widget(self.BackCameraImage)
         
     self.imageProcessors = [backProcessor]
     
     self.tuning_widget = util.replace_widget(self.tuning_widget, detector_tuning_widget.DetectorTuningWidget(backProcessor))
     self.tuning_widget.initialize()
     
     # get notified when the robot switches modes
     network_tables.attach_fn(self.netTable, 'RobotMode', self.on_robot_mode_update, self.window)
     
     # show the window AND all of its child widgets. If you don't call show_all, the
     # children may not show up
     self.window.show_all()
     
     # make sure the UI kills itself when the UI window exits
     self.window.connect('destroy', self.on_destroy)
Beispiel #2
0
    def __init__(self, NetworkTable):

        util.initialize_from_xml(self)

        self.dead = False
        self.plots = []

        self.count = 0

        self.netTable = NetworkTable
        self.netTable.PutBoolean('EnableTuning', True)

        self.figure = Figure(figsize=(5, 4), dpi=100)
        self.axes = self.figure.add_subplot(111)

        self.canvas = FigureCanvas(self.figure)  # a gtk.DrawingArea

        self.graphImage = util.replace_widget(self.graphImage, self.canvas)
        self.toolbar = util.replace_widget(
            self.toolbar, NavigationToolbar(self.canvas, self.window))

        self.window.show_all()

        # listen to network tables variables
        network_tables.attach_fn(self.netTable, "Catapult Values",
                                 self.on_update_CatapultValues, self.window)
        network_tables.attach_fn(self.netTable, "EnableTuning",
                                 self.on_update_EnableTuning, self.window)
Beispiel #3
0
 def __init__(self, NetworkTable):
     
     util.initialize_from_xml(self)
     
     self.dead = False
     self.plots = []
     
     self.count = 0
     
     self.netTable = NetworkTable
     self.netTable.PutBoolean('EnableTuning',True)
     
     self.figure = Figure(figsize=(5,4), dpi=100)
     self.axes = self.figure.add_subplot(111)
      
     self.canvas = FigureCanvas(self.figure)  # a gtk.DrawingArea
     
     self.graphImage = util.replace_widget(self.graphImage, self.canvas)
     self.toolbar = util.replace_widget(self.toolbar, NavigationToolbar(self.canvas, self.window))
                        
     self.window.show_all()
     
     # listen to network tables variables
     network_tables.attach_fn(self.netTable, "Catapult Values", self.on_update_CatapultValues, self.window)
     network_tables.attach_fn(self.netTable, "EnableTuning", self.on_update_EnableTuning, self.window)
Beispiel #4
0
    def __init__(self, NetworkTable, frontProcessor, backProcessor):

        self.netTable = NetworkTable
        util.initialize_from_xml(self)

        #  ----- Begin Cameras -----
        self.BackCameraImage = util.replace_widget(
            self.BackCameraImage,
            target_widget.TargetWidget((320, 240), self.netTable))
        #  ----- End Cameras -----

        backProcessor.set_camera_widget(self.BackCameraImage)

        self.imageProcessors = [backProcessor]

        self.tuning_widget = util.replace_widget(
            self.tuning_widget,
            detector_tuning_widget.DetectorTuningWidget(backProcessor))
        self.tuning_widget.initialize()

        # get notified when the robot switches modes
        network_tables.attach_fn(self.netTable, 'RobotMode',
                                 self.on_robot_mode_update, self.window)

        # show the window AND all of its child widgets. If you don't call show_all, the
        # children may not show up
        self.window.show_all()

        # make sure the UI kills itself when the UI window exits
        self.window.connect('destroy', self.on_destroy)
Beispiel #5
0
    def image_button(self, active, inactive, state, replaceMe, actionType, connectionFunction):

        tempButton = self.make_image_button(active, inactive, state)

        tempButton.connect(actionType, connectionFunction)

        return util.replace_widget(replaceMe, tempButton)
Beispiel #6
0
    def image_button(self, active, inactive, state, replaceMe, actionType,
                     connectionFunction):

        tempButton = self.make_image_button(active, inactive, state)

        tempButton.connect(actionType, connectionFunction)

        return util.replace_widget(replaceMe, tempButton)
Beispiel #7
0
    def __init__(self, processor, table, competition, no_cam = False):
        
        self.processor = processor
        self.no_cam = no_cam
        if no_cam == False:
            
            camera = camera_widget.CameraWidget((640,480))
            self.processor.set_camera_widget(camera)
        else:    
            self.ui_filename = 'dashboard_no_cam.ui'
        
        util.initialize_from_xml(self)
        
        if no_cam != True:
            self.camera_widget = util.replace_widget(self.camera_widget, camera)
        #util.replace_widget(self.targeting_tuning_widget, self.targeting_tuner.get_widget())

        self.robot_widget = util.replace_widget(self.robot_widget, robot_widget.RobotWidget(table))

        #self.targeting_tuner.initialize()
       
        self.table = table
        
        self.window.set_title("Kwarqs Dashboard")
        self.window.connect('realize', self.on_realize)
       
        if competition:
            self.window.move(0,0)
            self.window.resize(1356, 515)
            
        # load the status buttons
        active_pixbuf = util.pixbuf_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON)
        inactive_pixbuf = util.pixbuf_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_BUTTON)
        
        for name in ['shuttle_status','ready_status','angle_status']:
            old_widget = getattr(self, name)
            text = old_widget.get_label()
            setattr(self, name, util.replace_widget(old_widget, toggle_button.ToggleButton(active_pixbuf, inactive_pixbuf, text, clickable=False, default=False)))
            
        #load the angle buttons
        for mode in ['truss', 'shoot', 'max']:
            active = util.pixbuf_from_file('angle_' + mode + '_active.png')
            inactive = util.pixbuf_from_file('angle_' + mode + '_inactive.png')
            name = '%s_angle_button' % mode
            setattr(self, name, util.replace_widget(getattr(self, name), toggle_button.ToggleButton(active, inactive, clickable=True, default=False)))
            
        # setup the mode buttons
        for mode in ['passing', 'loading', 'manual', 'shooting']:
            active = util.pixbuf_from_file(mode + '-on.png')
            inactive = util.pixbuf_from_file(mode + '-off.png')
            name =  '%s_mode_button' % mode
            setattr(self, name, util.replace_widget(getattr(self, name), toggle_button.ToggleButton(active, inactive, clickable=True, default=False)))
            
        # setup the fire button
        active = util.pixbuf_from_file('fire-on.png')
        inactive = util.pixbuf_from_file('fire-off.png')
        self.fire_button = util.replace_widget(self.fire_button, image_button.ImageButton(inactive))
        self.fire_button.connect('clicked', self.on_fire_clicked)
        
        # save these for later
        self.fire_button.active_pixbuf = active
        self.fire_button.inactive_pixbuf = inactive
        
        # setup the toggle buttons
        active = util.pixbuf_from_file('toggle-on.png')
        inactive = util.pixbuf_from_file('toggle-off.png')
        
        for name in [ 'auto_scam_button','auto_load_button','auto_retract_button',]:
            setattr(self, name, util.replace_widget(getattr(self, name), toggle_button.ToggleButton(active, inactive, clickable=True, default=False)))
        
        
            
        # connect widgets to pynetworktables
        if self.table is not None:
            
            # don't import this unless we have a table, so we can support running
            # on a laptop without networktables
            import ui.widgets.network_tables as nt
            
            nt.attach_toggle(table, 'auto load', self.auto_load_button)
            nt.attach_toggle(table, 'auto scam', self.auto_scam_button)
            nt.attach_toggle(table, 'auto igus', self.auto_retract_button)
            
            #angle chooser
            angle_select_widgets = {'shoot angle': self.shoot_angle_button,
                                    'truss angle': self.truss_angle_button,
                                    'max angle': self.max_angle_button}
            
            nt.attach_chooser_buttons(table, 'Shooting Goal', angle_select_widgets)
            
            # other chooser
            widgets = {'Passing Mode': self.passing_mode_button, 
                       'Loading Mode': self.loading_mode_button,
                       'Manual Mode': self.manual_mode_button,
                       'Shooting Mode': self.shooting_mode_button }
            
            nt.attach_chooser_buttons(table, 'Operator Control Mode', widgets)
            
            # robot widget
            nt.attach_fn(table, 'Scam Angle', lambda k, v: self.robot_widget.set_angle(v), self.robot_widget)
            nt.attach_fn(table, 'robot distance', lambda k, v: self.robot_widget.set_distance(v),self.robot_widget)
            
            # modes
            nt.attach_fn(table, 'Robot Mode', self.on_robot_mode_update, self.window)
            
            # connection listener
            nt.attach_connection_listener(table, self.on_connection_connect, self.on_connection_disconnect, self.window)
Beispiel #8
0
    def __init__(self, NetworkTable, frontProcessor, backProcessor, competition):

        self.netTable = NetworkTable
        util.initialize_from_xml(self)

        self.shootPower = [10, 30, 50, 70, 90]
        self.currentShootPower = 4

        # starts the timer
        self.starttime = None

        # self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#aaaaaa'))

        import pango

        self.font = pango.FontDescription("bold 18")

        self.fontMono = pango.FontDescription("Monospace 14")

        self.fontDistanceBig = pango.FontDescription("bold 100")

        # from wpilib import DriverStation

        # DriverStation.GetInstance()

        """# demo: load the images into pixbufs so that Gtk can use them
        active = util.pixbuf_from_file('toggle-on.png')
        inactive = util.pixbuf_from_file('toggle-off.png')
        
        # demo: create a ToggleButton widget. There are lots of widgets you can create
        real_widget = toggle_button.ToggleButton(active, inactive, clickable=True)
        
        # demo: replace a fake widget in the glade file with a 'real' widget
        util.replace_widget(self.toggleButton, real_widget)
        
        # demo: connect to the toggled event of the real widget, so that our
        #       function gets called when the button state is changed
        real_widget.connect('toggled', self.on_toggleButton_toggled)
        """
        #  ----- Begin Position Set -----
        self.netTable.PutNumber("position", 0)
        #  ----- End Position Set-----

        #  ----- Begin Fire Button -----
        self.netTable.PutBoolean("BallLoaded", False)
        self.FireButton = self.image_button(
            "fire_good.png", "fire_bad.png", False, self.FireButton, "clicked", self.on_fire_clicked
        )

        network_tables.attach_fn(self.netTable, "BallLoaded", self.on_ball_loaded, self.FireButton)
        #  ----- End Fire Button -----

        # ------ Begin Compressor Label -----
        network_tables.attach_fn(self.netTable, "Compressor", self.update_compressor_image, self.compressoronoff)
        self.on = util.pixbuf_from_file("compressoron.jpg")
        self.off = util.pixbuf_from_file("compressoroff.jpg")
        # ------ End Compressor Label -----

        # ----- Begin AutoWinch Toggle -----
        active = util.pixbuf_from_file("booleanT.png")
        inactive = util.pixbuf_from_file("booleanF.png")

        real_widget = toggle_button.ToggleButton(active, inactive, clickable=True)

        util.replace_widget(self.autoWinchToggle, real_widget)

        real_widget.connect("toggled", self.on_autoWinch_toggled)

        #  ----- End AutoWinch Toggle -----

        #  ----- Begin Cameras -----
        self.BackCameraImage = util.replace_widget(
            self.BackCameraImage, target_widget.TargetWidget((320, 240), self.netTable)
        )
        #  ----- End Cameras -----

        #  ----- Begin Distance Bar -----

        self.distanceBar.modify_font(self.fontMono)

        self.distanceBar.configure(2.5, 0, 2.5)

        self.netTable.PutNumber("Distance", 0)

        self.update_distance(None, 0)
        network_tables.attach_fn(self.netTable, "Distance", self.update_distance, self.distanceBar)
        #  ----- End Distance Bar -----

        #  ----- Begin Arm -----

        self.netTable.PutNumber("ArmSet", 0)
        self.netTable.PutNumber("ArmState", 0)

        self.armStateButtonLockDown = self.image_button(
            "armDownSel.png",
            "armDown.png",
            False,
            self.armStateButtonLockDown,
            "clicked",
            self.on_ArmStateLockedDown_pressed,
        )
        self.armStateButtonUnlock = self.image_button(
            "armUnlockedSel.png",
            "armUnlocked.png",
            False,
            self.armStateButtonUnlock,
            "clicked",
            self.on_ArmStateUnlocked_pressed,
        )
        self.armStateButtonLockUp = self.image_button(
            "armUpSel.png", "armUp.png", False, self.armStateButtonLockUp, "clicked", self.on_ArmStateLockedUp_pressed
        )

        network_tables.attach_fn(self.netTable, "ArmState", self.update_arm_indicator, self.armStateButtonLockDown)

        #  ----- End Arm -----

        #  ----- Begin Timer -----
        self.timer.modify_font(self.font)
        self.on_timer()
        #  ----- Begin Timer -----

        #  ----- Begin Robot State Image -----
        self.netTable.PutBoolean("BallLoaded", False)
        self.RobotStateImage = util.replace_widget(self.RobotStateImage, robot_widget.RobotStateImage())
        network_tables.attach_fn(self.netTable, "ArmState", self.RobotStateImage.updatearm, self.RobotStateImage)
        network_tables.attach_fn(self.netTable, "BallLoaded", self.RobotStateImage.updateball, self.RobotStateImage)
        # this is for whatever the catapult's angle is.
        network_tables.attach_fn(self.netTable, "ShootAngle", self.RobotStateImage.updatecatapult, self.RobotStateImage)
        # self.update_robot_state_image(None,None)
        #  ----- End Robot State Image -----

        #  ----- Begin Robot Angle Widget -----
        self.RobotAngleWidget = util.replace_widget(self.RobotAngleWidget, robot_angle_widget.RobotAngleWidget())
        self.netTable.PutNumber("GyroAngle", 0)
        # robot angle widget sending the variable to itself
        network_tables.attach_fn(self.netTable, "GyroAngle", self.RobotAngleWidget.update, self.window)
        network_tables.attach_fn(self.netTable, "GyroEnabled", self.on_gyro_enabled, self.window)

        self.RobotAngleWidget.connect(
            "angle-enabled-changed", lambda w: self.netTable.PutBoolean("GyroEnabled", w.angle_enabled)
        )

        #  ----- End Robot Angle Widget -----

        # ------ Begin Power Bar Slider -----
        powerslider = self.PowerBarSlider.get_value()

        # ------ End Power Bar Slider -------

        # ------ Begin Graph Window -----
        self.GraphOpener = graphwindow.GraphOpener(self.netTable)
        # self.GraphPlot=graphwindow.GraphPlot(self.netTable)

        # ------ End Graph Window -------

        """
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        this is to help Matt navigate the code, and he apologizes.
        """

        if competition:
            self.window.move(0, 0)
            self.window.resize(1356, 525)

        backProcessor.set_camera_widget(self.BackCameraImage)

        self.imageProcessors = [backProcessor]

        self.tuning_widget = util.replace_widget(
            self.tuning_widget, detector_tuning_widget.DetectorTuningWidget(backProcessor)
        )
        self.tuning_widget.initialize()

        # get notified when the robot switches modes
        network_tables.attach_fn(self.netTable, "RobotMode", self.on_robot_mode_update, self.window)

        # setup the autonomous chooser
        self.autonomous_tuner = util.replace_widget(
            self.autonomous_tuner, autonomous_tuning_widget.AutonomousTuningWidget(self.netTable)
        )

        # show the window AND all of its child widgets. If you don't call show_all, the
        # children may not show up
        self.window.show_all()
        self.setup_background()

        # make sure the UI kills itself when the UI window exits
        self.window.connect("destroy", self.on_destroy)
Beispiel #9
0
    def __init__(self, processor, table, competition):
        
        self.processor = processor
        t = targeter.Targeter((640,480), table)
        self.targeting_tuner = targeting_tuning_widget.TargetingTuningWidget(processor, t)
        
        util.initialize_from_xml(self)
        
        self.camera_widget = util.replace_widget(self.camera_widget, t)
        util.replace_widget(self.targeting_tuning_widget, self.targeting_tuner.get_widget())

        self.robot_widget = util.replace_widget(self.robot_widget, robot_widget.RobotWidget(table))

        self.targeting_tuner.initialize()
       
        self.table = table
        
        self.window.set_title("Kwarqs Dashboard")
        self.window.connect('realize', self.on_realize)
       
        if competition:
            self.window.move(0,0)
            self.window.resize(1356, 525)
            
        # load the status buttons
        active_pixbuf = util.pixbuf_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON)
        inactive_pixbuf = util.pixbuf_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_BUTTON)
        
        for name in ['wheel_status', 'ready_status', 'horizontal_status', 'vertical_status', 'target_status']:
            old_widget = getattr(self, name)
            text = old_widget.get_label()
            setattr(self, name, util.replace_widget(old_widget, toggle_button.ToggleButton(active_pixbuf, inactive_pixbuf, text, clickable=False, default=False)))
            
        # wheel status is special
        self.wheel_status.connect('toggled', self.on_wheel_status_toggled)
            
        # setup the mode buttons
        for mode in ['climbing', 'loading', 'manual', 'shooting']:
            active = util.pixbuf_from_file(mode + '-on.png')
            inactive = util.pixbuf_from_file(mode + '-off.png')
            name =  '%s_mode_button' % mode
            setattr(self, name, util.replace_widget(getattr(self, name), toggle_button.ToggleButton(active, inactive, clickable=True, default=False)))
            
        # setup the fire button
        active = util.pixbuf_from_file('fire-on.png')
        inactive = util.pixbuf_from_file('fire-off.png')
        self.fire_button = util.replace_widget(self.fire_button, image_button.ImageButton(inactive))
        self.fire_button.connect('clicked', self.on_fire_clicked)
        
        # save these for later
        self.fire_button.active_pixbuf = active
        self.fire_button.inactive_pixbuf = inactive
        
        # setup the toggle buttons
        active = util.pixbuf_from_file('toggle-on.png')
        inactive = util.pixbuf_from_file('toggle-off.png')
        
        for name in ['wheel_on_button', 'auto_feed_button', 'auto_target_button', 'unused_1']:
            setattr(self, name, util.replace_widget(getattr(self, name), toggle_button.ToggleButton(active, inactive, clickable=True, default=False)))
            
        # attach to the targeter widget
        self.camera_widget.connect('target-update', self.on_target_update)
        
        # setup the auto target stuff
        # -> all of these buttons/RadioButtons use the same callback
        for name in ['top', 'mid', 'low', 'button']:
            getattr(self, 'auto_target_%s' % name).connect('toggled', self.on_auto_target_toggled)
            
        self.auto_target_button.set_active(True)
        
        self.shooting_mode_button.connect('toggled', self.on_shooting_mode_toggled)
        
            
        # connect widgets to pynetworktables
        if self.table is not None:
            
            # don't import this unless we have a table, so we can support running
            # on a laptop without networktables
            import ui.widgets.network_tables as nt
            
            nt.attach_toggle(table, 'Wheel On', self.wheel_on_button)
            nt.attach_toggle(table, 'Wheel OK', self.wheel_status)
            
            nt.attach_toggle(table, 'Auto Feeder', self.auto_feed_button)
            
            nt.attach_chooser_combo(table, 'Autonomous Mode', self.autonomous_chooser)
            
            # other chooser
            widgets = {'Climbing Mode': self.climbing_mode_button, 
                       'Loading Mode': self.loading_mode_button,
                       'Manual Mode': self.manual_mode_button,
                       'Auto Target Mode': self.shooting_mode_button }
            
            nt.attach_chooser_buttons(table, 'Operator Control Mode', widgets)
            
            # robot widget
            nt.attach_fn(table, 'Angle', lambda k, v: self.robot_widget.set_angle(v), self.robot_widget)
            nt.attach_fn(table, 'Frisbees', lambda k, v: self.robot_widget.set_frisbee_count(v), self.robot_widget)
            
            # modes
            nt.attach_fn(table, 'Robot Mode', self.on_robot_mode_update, self.window)
            
            # connection listener
            nt.attach_connection_listener(table, self.on_connection_connect, self.on_connection_disconnect, self.window)
Beispiel #10
0
    def __init__(self, NetworkTable, frontProcessor, backProcessor,
                 competition):

        self.netTable = NetworkTable
        util.initialize_from_xml(self)

        self.shootPower = [10, 30, 50, 70, 90]
        self.currentShootPower = 4

        #starts the timer
        self.starttime = None

        #self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#aaaaaa'))

        import pango

        self.font = pango.FontDescription("bold 18")

        self.fontMono = pango.FontDescription("Monospace 14")

        self.fontDistanceBig = pango.FontDescription("bold 100")

        #from wpilib import DriverStation

        #DriverStation.GetInstance()
        '''# demo: load the images into pixbufs so that Gtk can use them
        active = util.pixbuf_from_file('toggle-on.png')
        inactive = util.pixbuf_from_file('toggle-off.png')
        
        # demo: create a ToggleButton widget. There are lots of widgets you can create
        real_widget = toggle_button.ToggleButton(active, inactive, clickable=True)
        
        # demo: replace a fake widget in the glade file with a 'real' widget
        util.replace_widget(self.toggleButton, real_widget)
        
        # demo: connect to the toggled event of the real widget, so that our
        #       function gets called when the button state is changed
        real_widget.connect('toggled', self.on_toggleButton_toggled)
        '''
        #  ----- Begin Position Set -----
        self.netTable.PutNumber('position', 0)
        #  ----- End Position Set-----

        #  ----- Begin Fire Button -----
        self.netTable.PutBoolean("BallLoaded", False)
        self.FireButton = self.image_button('fire_good.png', 'fire_bad.png',
                                            False, self.FireButton, 'clicked',
                                            self.on_fire_clicked)

        network_tables.attach_fn(self.netTable, "BallLoaded",
                                 self.on_ball_loaded, self.FireButton)
        #  ----- End Fire Button -----

        #------ Begin Compressor Label -----
        network_tables.attach_fn(self.netTable, "Compressor",
                                 self.update_compressor_image,
                                 self.compressoronoff)
        self.on = util.pixbuf_from_file('compressoron.jpg')
        self.off = util.pixbuf_from_file('compressoroff.jpg')
        #------ End Compressor Label -----

        #----- Begin AutoWinch Toggle -----
        active = util.pixbuf_from_file('booleanT.png')
        inactive = util.pixbuf_from_file('booleanF.png')

        real_widget = toggle_button.ToggleButton(active,
                                                 inactive,
                                                 clickable=True)

        util.replace_widget(self.autoWinchToggle, real_widget)

        real_widget.connect('toggled', self.on_autoWinch_toggled)

        #  ----- End AutoWinch Toggle -----

        #  ----- Begin Cameras -----
        self.BackCameraImage = util.replace_widget(
            self.BackCameraImage,
            target_widget.TargetWidget((320, 240), self.netTable))
        #  ----- End Cameras -----

        #  ----- Begin Distance Bar -----

        self.distanceBar.modify_font(self.fontMono)

        self.distanceBar.configure(2.5, 0, 2.5)

        self.netTable.PutNumber("Distance", 0)

        self.update_distance(None, 0)
        network_tables.attach_fn(self.netTable, "Distance",
                                 self.update_distance, self.distanceBar)
        #  ----- End Distance Bar -----

        #  ----- Begin Arm -----

        self.netTable.PutNumber("ArmSet", 0)
        self.netTable.PutNumber("ArmState", 0)

        self.armStateButtonLockDown = self.image_button(
            'armDownSel.png', 'armDown.png', False,
            self.armStateButtonLockDown, 'clicked',
            self.on_ArmStateLockedDown_pressed)
        self.armStateButtonUnlock = self.image_button(
            'armUnlockedSel.png', 'armUnlocked.png', False,
            self.armStateButtonUnlock, 'clicked',
            self.on_ArmStateUnlocked_pressed)
        self.armStateButtonLockUp = self.image_button(
            'armUpSel.png', 'armUp.png', False, self.armStateButtonLockUp,
            'clicked', self.on_ArmStateLockedUp_pressed)

        network_tables.attach_fn(self.netTable, "ArmState",
                                 self.update_arm_indicator,
                                 self.armStateButtonLockDown)

        #  ----- End Arm -----

        #  ----- Begin Timer -----
        self.timer.modify_font(self.font)
        self.on_timer()
        #  ----- Begin Timer -----

        #  ----- Begin Robot State Image -----
        self.netTable.PutBoolean("BallLoaded", False)
        self.RobotStateImage = util.replace_widget(
            self.RobotStateImage, robot_widget.RobotStateImage())
        network_tables.attach_fn(self.netTable, "ArmState",
                                 self.RobotStateImage.updatearm,
                                 self.RobotStateImage)
        network_tables.attach_fn(self.netTable, "BallLoaded",
                                 self.RobotStateImage.updateball,
                                 self.RobotStateImage)
        #this is for whatever the catapult's angle is.
        network_tables.attach_fn(self.netTable, "ShootAngle",
                                 self.RobotStateImage.updatecatapult,
                                 self.RobotStateImage)
        #self.update_robot_state_image(None,None)
        #  ----- End Robot State Image -----

        #  ----- Begin Robot Angle Widget -----
        self.RobotAngleWidget = util.replace_widget(
            self.RobotAngleWidget, robot_angle_widget.RobotAngleWidget())
        self.netTable.PutNumber("GyroAngle", 0)
        # robot angle widget sending the variable to itself
        network_tables.attach_fn(self.netTable, 'GyroAngle',
                                 self.RobotAngleWidget.update, self.window)
        network_tables.attach_fn(self.netTable, 'GyroEnabled',
                                 self.on_gyro_enabled, self.window)

        self.RobotAngleWidget.connect(
            'angle-enabled-changed',
            lambda w: self.netTable.PutBoolean('GyroEnabled', w.angle_enabled))

        #  ----- End Robot Angle Widget -----

        # ------ Begin Power Bar Slider -----
        powerslider = self.PowerBarSlider.get_value()

        # ------ End Power Bar Slider -------

        # ------ Begin Graph Window -----
        self.GraphOpener = graphwindow.GraphOpener(self.netTable)
        #self.GraphPlot=graphwindow.GraphPlot(self.netTable)

        # ------ End Graph Window -------
        '''
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        code starts here code starts here code starts here code starts here code starts here code starts here code starts here 
        this is to help Matt navigate the code, and he apologizes.
        '''

        if competition:
            self.window.move(0, 0)
            self.window.resize(1356, 525)

        backProcessor.set_camera_widget(self.BackCameraImage)

        self.imageProcessors = [backProcessor]

        self.tuning_widget = util.replace_widget(
            self.tuning_widget,
            detector_tuning_widget.DetectorTuningWidget(backProcessor))
        self.tuning_widget.initialize()

        # get notified when the robot switches modes
        network_tables.attach_fn(self.netTable, 'RobotMode',
                                 self.on_robot_mode_update, self.window)

        # setup the autonomous chooser
        self.autonomous_tuner = util.replace_widget(
            self.autonomous_tuner,
            autonomous_tuning_widget.AutonomousTuningWidget(self.netTable))

        # show the window AND all of its child widgets. If you don't call show_all, the
        # children may not show up
        self.window.show_all()
        self.setup_background()

        # make sure the UI kills itself when the UI window exits
        self.window.connect('destroy', self.on_destroy)