def update_selection(self, message):
        """Updates the GUI to reflect all the selected positions in the latest parameters.
        If message is set, this is the handler for an external change in selection.
        The message.data dictionary is used instead of latestparams.
        """
        # Re-check the previously checked items.
        if message is None:
            pos_dict = display_thread.get_positions_dict()
        else:
            pos_dict = message.data

        for i in range(self.panel.checkListPositions.GetCount()):
            # Get the position from the instruments' list.
            pos = model.instrument.inst.positions[i]
            # Check it if you find it, and it's true.
            val = False
            if pos_dict.has_key(id(pos)):
                val = pos_dict[id(pos)]
            self.panel.checkListPositions.Check(i, val)
    def update_selection(self, message):
        """Updates the GUI to reflect all the selected positions in the latest parameters.
        If message is set, this is the handler for an external change in selection.
        The message.data dictionary is used instead of latestparams.
        """
        #Re-check the previously checked items.
        if message is None:
            pos_dict = display_thread.get_positions_dict()
        else:
            pos_dict = message.data

        for i in range(self.panel.checkListPositions.GetCount()):
            #Get the position from the instruments' list.
            pos = model.instrument.inst.positions[i]
            #Check it if you find it, and it's true.
            val = False
            if pos_dict.has_key(id(pos)):
                val = pos_dict[id(pos)]
            self.panel.checkListPositions.Check(i, val)
Exemplo n.º 3
0
    def update_selection(self, message=None):
        """Updates the GUI to reflect all the selected positions in the latest parameters.
        If message is set, this is the handler for an external change in selection.
        The message.data dictionary is used instead of latestparams.
        """
        #Re-check the previously checked items.
        if message is None:
            pos_dict = display_thread.get_positions_dict()
        else:
            pos_dict = message.data

        grid = self.panel.gridExp

        all_selected = True
        for i in range( grid.GetNumberRows() ):
            #Get the position from the instruments' list.
            if i < len(model.instrument.inst.positions):
                pos = model.instrument.inst.positions[i]
                #Default to False
                this_one_is_selected = pos_dict.get(id(pos), False)
                #Show a space for False.
                val = [" ", "X"][this_one_is_selected]
                #Count if all are selected
                all_selected = all_selected and this_one_is_selected
            else:
                val = "?"
                all_selected = False

            #Check it if you find it, and it's true.
            grid.SetCellValue(i, 0, val )
            grid.SetCellAlignment(i, 0, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
            
        #If the selection changes, the estimated time will change too
        self.update_estimated_time()

        #And the "use all" checkbox
        self.inside_set_checkUseAll = True
        self.panel.checkUseAll.SetValue(all_selected)
        self.inside_set_checkUseAll = False
    def update_selection(self, message=None):
        """Updates the GUI to reflect all the selected positions in the latest parameters.
        If message is set, this is the handler for an external change in selection.
        The message.data dictionary is used instead of latestparams.
        """
        #Re-check the previously checked items.
        if message is None:
            pos_dict = display_thread.get_positions_dict()
        else:
            pos_dict = message.data

        grid = self.panel.gridExp

        all_selected = True
        for i in range(grid.GetNumberRows()):
            #Get the position from the instruments' list.
            if i < len(model.instrument.inst.positions):
                pos = model.instrument.inst.positions[i]
                #Default to False
                this_one_is_selected = pos_dict.get(id(pos), False)
                #Show a space for False.
                val = [" ", "X"][this_one_is_selected]
                #Count if all are selected
                all_selected = all_selected and this_one_is_selected
            else:
                val = "?"
                all_selected = False

            #Check it if you find it, and it's true.
            grid.SetCellValue(i, 0, val)
            grid.SetCellAlignment(i, 0, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE)

        #If the selection changes, the estimated time will change too
        self.update_estimated_time()

        #And the "use all" checkbox
        self.inside_set_checkUseAll = True
        self.panel.checkUseAll.SetValue(all_selected)
        self.inside_set_checkUseAll = False
Exemplo n.º 5
0
    def delete_several(self, row_list):
        """Deletes several entries in the position list.

        Parameter:
            row_list: list of row numbers to delete.
        """
        #Get the current selection dictionary
        poscov_dict = display_thread.get_positions_dict().copy()
        #Delete entries, starting from the end
        row_list.sort()
        row_list.reverse()
        for index in row_list:
            #Remove from the selection list too
            poscov = model.instrument.inst.positions[index]
            if poscov_dict.has_key(id(poscov)):
                del poscov_dict[id(poscov)]
            #And from the data
            del model.instrument.inst.positions[index]

        #Remove the extra entries from the list
        display_thread.select_position_coverage(poscov_dict, update_gui=False)

        #Update the display.
        self.update_grid()
    def delete_several(self, row_list):
        """Deletes several entries in the position list.

        Parameter:
            row_list: list of row numbers to delete.
        """
        #Get the current selection dictionary
        poscov_dict = display_thread.get_positions_dict().copy()
        #Delete entries, starting from the end
        row_list.sort()
        row_list.reverse()
        for index in row_list:
            #Remove from the selection list too
            poscov = model.instrument.inst.positions[index]
            if poscov_dict.has_key(id(poscov)):
                del poscov_dict[id(poscov)]
            #And from the data
            del model.instrument.inst.positions[index]

        #Remove the extra entries from the list
        display_thread.select_position_coverage(poscov_dict, update_gui=False)

        #Update the display.
        self.update_grid()