Example #1
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Energy-scan")

        # Data attributes
        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox("Available elements", self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)

        h_box.setMaximumWidth(470)
        h_box.setMaximumHeight(310)

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )

        qt.QObject.connect(
            self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked
        )
    def __init__(self, parent=None, name="energy_scan_tab_widget"):
        qt.QWidget.__init__(self, parent, name)

        # Data Attributes
        self.energy_scan = queue_model_objects.EnergyScan()
        self._tree_view_item = None

        # Layout
        h_layout = qt.QHBoxLayout(self, 0, 0, "main_v_layout")
        col_one_vlayout = qt.QVBoxLayout(h_layout, 0, "row_one")

        periodic_table_gbox = qt.QHGroupBox("Available Elements", self)
        self.periodic_table = PeriodicTableBrick(periodic_table_gbox)
        #QPeriodicTable.QPeriodicTable(periodic_table_gbox)
        self.periodic_table.setFixedHeight(341)
        self.periodic_table.setFixedWidth(650)
        #font = periodic_table.font()
        #font.setPointSize(8)
        #periodic_table.setFont(font)
        #scan_plot_gbox = qt.QHGroupBox("Scan plot", self)
        #spec_scan_plot_brick = SpecScanPlotBrick(scan_plot_gbox)
        self.data_path_widget = DataPathWidget(self)
        self.data_path_widget.data_path_widget_layout.child(
            'file_name_label').setText('')
        self.data_path_widget.data_path_widget_layout.child(
            'file_name_value_label').hide()

        col_one_vlayout.add(periodic_table_gbox)
        col_one_vlayout.add(self.data_path_widget)
        col_one_vlayout.addStretch(10)

        qt.QObject.connect(self.periodic_table, qt.PYSIGNAL('edgeSelected'),
                           self.element_clicked)

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child(
                'prefix_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change)

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child(
                'run_number_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change)

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'),
                           self.tab_changed)
    def __init__(self, parent=None, name="energy_scan_tab_widget"):
        qt.QWidget.__init__(self, parent, name)

        # Data Attributes
        self.energy_scan = queue_model_objects.EnergyScan()
        self._tree_view_item = None

        # Layout
        h_layout = qt.QHBoxLayout(self, 0, 0, "main_v_layout")
        col_one_vlayout = qt.QVBoxLayout(h_layout, 0, "row_one")

        periodic_table_gbox = qt.QHGroupBox("Available Elements", self)
        self.periodic_table = PeriodicTableBrick(periodic_table_gbox)
        # QPeriodicTable.QPeriodicTable(periodic_table_gbox)
        self.periodic_table.setFixedHeight(341)
        self.periodic_table.setFixedWidth(650)
        # font = periodic_table.font()
        # font.setPointSize(8)
        # periodic_table.setFont(font)
        # scan_plot_gbox = qt.QHGroupBox("Scan plot", self)
        # spec_scan_plot_brick = SpecScanPlotBrick(scan_plot_gbox)
        self.data_path_widget = DataPathWidget(self)
        self.data_path_widget.data_path_widget_layout.child("file_name_label").setText(
            ""
        )
        self.data_path_widget.data_path_widget_layout.child(
            "file_name_value_label"
        ).hide()

        col_one_vlayout.add(periodic_table_gbox)
        col_one_vlayout.add(self.data_path_widget)
        col_one_vlayout.addStretch(10)

        qt.QObject.connect(
            self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked
        )

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL("tab_changed"), self.tab_changed)
    def __init__(self, parent = None, name = None, fl = 0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Energy-scan')

        # Data attributes
        self.init_models()

        #Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox('Available elements', self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)
        
        h_box.setMaximumWidth(454)
        h_box.setMaximumHeight(300)

        self._data_path_gbox = qt.QVGroupBox('Data location', self, 'data_path_gbox')
        self._data_path_widget = DataPathWidget(self._data_path_gbox, 
                                               data_model = self._path_template,
                                               layout = DataPathWidgetVerticalLayout)

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()


        self.connect(self._data_path_widget.data_path_widget_layout.prefix_ledit, 
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._prefix_ledit_change)


        self.connect(self._data_path_widget.data_path_widget_layout.run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._run_number_ledit_change)
        
        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
class EnergyScanParametersWidget(qt.QWidget):
    def __init__(self, parent = None, name = "energy_scan_tab_widget"):
        qt.QWidget.__init__(self, parent, name)

        # Data Attributes
        self.energy_scan = queue_model_objects.EnergyScan()
        self._tree_view_item = None

        # Layout
        h_layout = qt.QHBoxLayout(self, 0, 0, "main_v_layout")
        col_one_vlayout = qt.QVBoxLayout(h_layout, 0, "row_one")

        periodic_table_gbox = qt.QHGroupBox("Available Elements", self)
        self.periodic_table =  PeriodicTableBrick(periodic_table_gbox)
        #QPeriodicTable.QPeriodicTable(periodic_table_gbox)
        self.periodic_table.setFixedHeight(341)
        self.periodic_table.setFixedWidth(650)
        #font = periodic_table.font()
        #font.setPointSize(8)
        #periodic_table.setFont(font)
        #scan_plot_gbox = qt.QHGroupBox("Scan plot", self)
        #spec_scan_plot_brick = SpecScanPlotBrick(scan_plot_gbox)
        self.data_path_widget = DataPathWidget(self)
        self.data_path_widget.data_path_widget_layout.child('file_name_label').setText('')
        self.data_path_widget.data_path_widget_layout.child('file_name_value_label').hide()

        col_one_vlayout.add(periodic_table_gbox)
        col_one_vlayout.add(self.data_path_widget)
        col_one_vlayout.addStretch(10)

        qt.QObject.connect(self.periodic_table, qt.PYSIGNAL('edgeSelected'), 
                           self.element_clicked)

        qt.QObject.connect(self.data_path_widget.data_path_widget_layout.child('prefix_ledit'), 
                           qt.SIGNAL("textChanged(const QString &)"), 
                           self._prefix_ledit_change)


        qt.QObject.connect(self.data_path_widget.data_path_widget_layout.child('run_number_ledit'), 
                           qt.SIGNAL("textChanged(const QString &)"), 
                           self._run_number_ledit_change)
        
        qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'),
                           self.tab_changed)

    def _prefix_ledit_change(self, new_value):
        self.energy_scan.set_name(str(new_value))
        self._tree_view_item.setText(0, self.energy_scan.get_name())

    def _run_number_ledit_change(self, new_value):
        if str(new_value).isdigit():
            self.energy_scan.set_number(int(new_value))
            self._tree_view_item.setText(0, self.energy_scan.get_name())
        
    def tab_changed(self):
        if self._tree_view_item:
            self.populate_widget(self._tree_view_item)

    def populate_widget(self, item):
        self._tree_view_item = item
        self.energy_scan = item.get_model()
        executed = self.energy_scan.is_executed()

        self.data_path_widget.setEnabled(not executed)
        self.periodic_table.setEnabled(not executed)
        self.scan_plot.setEnabled(not executed)
        self.results_plot.setEnabled(not executed)

        if self.energy_scan.is_executed():
            self.data_path_widget.setEnabled(False)
            self.periodic_table.setEnabled(False)
        else:
            self.data_path_widget.setEnabled(True)
            self.periodic_table.setEnabled(True)
            self.data_path_widget.update_data_model(self.energy_scan.path_template)
            self.periodic_table.setTableElement(self.energy_scan.element_symbol, \
                                                    self.energy_scan.edge)

    def element_clicked(self, symbol, energy):
        self.energy_scan.element_symbol = symbol
        self.energy_scan.edge = energy
class CreateEnergyScanWidget(CreateTaskBase):
    def __init__(self, parent = None, name = None, fl = 0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Energy-scan')

        # Data attributes
        self.init_models()

        #Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox('Available elements', self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)
        
        h_box.setMaximumWidth(454)
        h_box.setMaximumHeight(300)

        self._data_path_gbox = qt.QVGroupBox('Data location', self, 'data_path_gbox')
        self._data_path_widget = DataPathWidget(self._data_path_gbox, 
                                               data_model = self._path_template,
                                               layout = DataPathWidgetVerticalLayout)

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()


        self.connect(self._data_path_widget.data_path_widget_layout.prefix_ledit, 
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._prefix_ledit_change)


        self.connect(self._data_path_widget.data_path_widget_layout.run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"), 
                     self._run_number_ledit_change)
        
        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)


    def init_models(self):
        CreateTaskBase.init_models(self)
        self.enery_scan = queue_model_objects.EnergyScan()
        self._path_template.start_num = 1
        self._path_template.num_files = 1
        self._path_template.suffix = 'raw'


    def set_energy_scan_hwobj(self, energy_hwobj):
        self.periodic_table.periodicTable.\
            setElements(energy_hwobj.getElements())


    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        escan_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.EnergyScanQueueItem):
            self.setDisabled(False)

            if escan_model.get_path_template():
                self._path_template = escan_model.get_path_template()

            self._data_path_widget.update_data_model(self._path_template)
        elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)


    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)
        
        selected_edge = False
        
        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.") 

        return base_result and selected_edge


    # Called by the owning widget (task_toolbox_widget) to create
    # a collection. When a data collection group is selected.
    def _create_task(self, sample):
        data_collections = []

        if self.periodic_table.current_edge:
            path_template = copy.deepcopy(self._path_template)

            if '<sample_name>' in path_template.directory:
                name = sample.get_name().replace(':', '-')
                path_template.directory = path_template.directory.\
                                          replace('<sample_name>', name)

                path_template.process_directory = path_template.process_directory.\
                                                  replace('<sample_name>', name)
                
            if '<acronym>-<name>' in path_template.base_prefix:
                path_template.base_prefix = self.get_default_prefix(sample)
                path_template.run_numer = self._beamline_setup_hwobj.queue_model_hwobj.\
                                          get_next_run_number(path_template)

            energy_scan = queue_model_objects.EnergyScan(sample,
                                                         path_template)
            energy_scan.set_name(path_template.get_prefix())
            energy_scan.set_number(path_template.run_number)
            energy_scan.element_symbol = self.periodic_table.current_element
            energy_scan.edge = self.periodic_table.current_edge

            data_collections.append(energy_scan)
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.") 

        return data_collections
Example #7
0
class CreateEnergyScanWidget(CreateTaskBase):
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, "Energy-scan")

        # Data attributes
        self.init_models()

        # Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox("Available elements", self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)

        h_box.setMaximumWidth(470)
        h_box.setMaximumHeight(310)

        self._data_path_gbox = qt.QVGroupBox("Data location", self, "data_path_gbox")
        self._data_path_widget = DataPathWidget(
            self._data_path_gbox, data_model=self._path_template, layout="vertical"
        )

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        self.connect(
            self._data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        self.connect(
            self._data_path_widget,
            qt.PYSIGNAL("path_template_changed"),
            self.handle_path_conflict,
        )

        qt.QObject.connect(
            self.periodic_table, qt.PYSIGNAL("edgeSelected"), self.element_clicked
        )

    def init_models(self):
        CreateTaskBase.init_models(self)
        self.energy_scan = queue_model_objects.EnergyScan()
        self._path_template.start_num = 1
        self._path_template.num_files = 1
        self._path_template.suffix = "raw"

    def set_energy_scan_hwobj(self, energy_scan_hwobj):
        self.periodic_table.periodicTable.setElements(energy_scan_hwobj.getElements())

    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        escan_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.EnergyScanQueueItem):
            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if escan_model.get_path_template():
                self._path_template = escan_model.get_path_template()

            symbol, edge = escan_model.element_symbol, escan_model.edge
            self.periodic_table.setTableElement(symbol, edge)

            self._data_path_widget.update_data_model(self._path_template)
        elif isinstance(tree_item, queue_item.BasketQueueItem):
            self.setDisabled(False)
        elif not (
            isinstance(tree_item, queue_item.SampleQueueItem)
            or isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)
        ):
            self.setDisabled(True)

    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)

        selected_shapes = self._shape_history.selected_shapes
        for shape in selected_shapes:
            if isinstance(shape, shape_history.Line):
                base_result = False

        selected_edge = False

        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").info(
                "No element selected, please select an element."
            )

        return base_result and selected_edge

    # Called by the owning widget (task_toolbox_widget) to create
    # a collection. When a data collection group is selected.

    def _create_task(self, sample, shape):
        data_collections = []

        if self.periodic_table.current_edge:

            if not shape:
                cpos = queue_model_objects.CentredPosition()
                cpos.snapshot_image = self._shape_history.get_snapshot([])
            else:
                # Shapes selected and sample is mounted, get the
                # centred positions for the shapes
                if isinstance(shape, shape_history.Point):
                    snapshot = self._shape_history.get_snapshot([shape.qub_point])

                    cpos = copy.deepcopy(shape.get_centred_positions()[0])
                    cpos.snapshot_image = snapshot

            path_template = self._create_path_template(sample, self._path_template)

            energy_scan = queue_model_objects.EnergyScan(sample, path_template, cpos)
            energy_scan.set_name(path_template.get_prefix())
            energy_scan.set_number(path_template.run_number)
            energy_scan.element_symbol = self.periodic_table.current_element
            energy_scan.edge = self.periodic_table.current_edge

            data_collections.append(energy_scan)
            self._path_template.run_number += 1
        else:
            logging.getLogger("user_level_log").info(
                "No element selected, please select an element."
            )

        return data_collections

    # Called by the owning widget (task_toolbox_widget) when
    # one or several centred positions are selected.
    def centred_position_selection(self, positions):
        self._selected_positions = positions

        if len(self._current_selected_items) == 1 and len(positions) == 1:
            item = self._current_selected_items[0]
            pos = positions[0]
            if isinstance(pos, shape_history.Point):
                if isinstance(item, queue_item.EnergyScanQueueItem):
                    cpos = pos.get_centred_positions()[0]
                    snapshot = self._shape_history.get_snapshot([pos.qub_point])
                    cpos.snapshot_image = snapshot
                    item.get_model().centred_position = cpos

    def element_clicked(self, symbol, energy):
        if len(self._current_selected_items) == 1:
            item = self._current_selected_items[0]
            if isinstance(item, queue_item.EnergyScanQueueItem):
                item.get_model().element_symbol = symbol
                item.get_model().edge = energy
Example #8
0
class CreateEnergyScanWidget(CreateTaskBase):
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Energy-scan')

        # Data attributes
        self.init_models()

        #Layout
        v_layout = qt.QVBoxLayout(self, 2, 5, "main_v_layout")
        h_box = qt.QHGroupBox('Available elements', self)
        self.periodic_table = PeriodicTableBrick(h_box)
        font = self.periodic_table.font()
        font.setPointSize(8)
        self.periodic_table.setFont(font)

        h_box.setMaximumWidth(470)
        h_box.setMaximumHeight(310)

        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')
        self._data_path_widget = DataPathWidget(self._data_path_gbox,
                                                data_model=self._path_template,
                                                layout='vertical')

        v_layout.addWidget(h_box)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addStretch()

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                'prefix_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change)

        self.connect(
            self._data_path_widget.data_path_widget_layout.child(
                'run_number_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)

    def init_models(self):
        CreateTaskBase.init_models(self)
        self.enery_scan = queue_model_objects.EnergyScan()
        self._path_template.start_num = 1
        self._path_template.num_files = 1
        self._path_template.suffix = 'raw'

    def set_energy_scan_hwobj(self, energy_hwobj):
        self.periodic_table.periodicTable.\
            setElements(energy_hwobj.getElements())

    def single_item_selection(self, tree_item):
        CreateTaskBase.single_item_selection(self, tree_item)
        escan_model = tree_item.get_model()

        if isinstance(tree_item, queue_item.EnergyScanQueueItem):
            if tree_item.get_model().is_executed():
                self.setDisabled(True)
            else:
                self.setDisabled(False)

            if escan_model.get_path_template():
                self._path_template = escan_model.get_path_template()

            # JN,20140829, fix the bug-periodicTable not updated when selecting task
            self._data_path_widget.update_data_model(self._path_template)
            self.periodic_table.periodicTable.tableElementChanged(
                escan_model.element_symbol)

        elif not(isinstance(tree_item, queue_item.SampleQueueItem) or \
                     isinstance(tree_item, queue_item.DataCollectionGroupQueueItem)):
            self.setDisabled(True)

    def approve_creation(self):
        base_result = CreateTaskBase.approve_creation(self)

        selected_edge = False

        if self.periodic_table.current_edge:
            selected_edge = True
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.")

        return base_result and selected_edge

    # Called by the owning widget (task_toolbox_widget) to create
    # a collection. When a data collection group is selected.
    def _create_task(self, sample, shape):
        data_collections = []

        if self.periodic_table.current_edge:
            path_template = copy.deepcopy(self._path_template)

            if '<sample_name>' in path_template.directory:
                name = sample.get_name().replace(':', '-')
                path_template.directory = path_template.directory.\
                                          replace('<sample_name>', name)

                path_template.process_directory = path_template.process_directory.\
                                                  replace('<sample_name>', name)

            if '<acronym>-<name>' in path_template.base_prefix:
                path_template.base_prefix = self.get_default_prefix(sample)
                path_template.run_numer = self._beamline_setup_hwobj.queue_model_hwobj.\
                                          get_next_run_number(path_template)

            energy_scan = queue_model_objects.EnergyScan(sample, path_template)
            energy_scan.set_name(path_template.get_prefix())
            energy_scan.set_number(path_template.run_number)
            energy_scan.element_symbol = self.periodic_table.current_element
            energy_scan.edge = self.periodic_table.current_edge

            data_collections.append(energy_scan)
        else:
            logging.getLogger("user_level_log").\
                info("No element selected, please select an element.")

        return data_collections
class EnergyScanParametersWidget(qt.QWidget):
    def __init__(self, parent=None, name="energy_scan_tab_widget"):
        qt.QWidget.__init__(self, parent, name)

        # Data Attributes
        self.energy_scan = queue_model_objects.EnergyScan()
        self._tree_view_item = None

        # Layout
        h_layout = qt.QHBoxLayout(self, 0, 0, "main_v_layout")
        col_one_vlayout = qt.QVBoxLayout(h_layout, 0, "row_one")

        periodic_table_gbox = qt.QHGroupBox("Available Elements", self)
        self.periodic_table = PeriodicTableBrick(periodic_table_gbox)
        #QPeriodicTable.QPeriodicTable(periodic_table_gbox)
        self.periodic_table.setFixedHeight(341)
        self.periodic_table.setFixedWidth(650)
        #font = periodic_table.font()
        #font.setPointSize(8)
        #periodic_table.setFont(font)
        #scan_plot_gbox = qt.QHGroupBox("Scan plot", self)
        #spec_scan_plot_brick = SpecScanPlotBrick(scan_plot_gbox)
        self.data_path_widget = DataPathWidget(self)
        self.data_path_widget.data_path_widget_layout.child(
            'file_name_label').setText('')
        self.data_path_widget.data_path_widget_layout.child(
            'file_name_value_label').hide()

        col_one_vlayout.add(periodic_table_gbox)
        col_one_vlayout.add(self.data_path_widget)
        col_one_vlayout.addStretch(10)

        qt.QObject.connect(self.periodic_table, qt.PYSIGNAL('edgeSelected'),
                           self.element_clicked)

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child(
                'prefix_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change)

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child(
                'run_number_ledit'), qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change)

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'),
                           self.tab_changed)

    def _prefix_ledit_change(self, new_value):
        self.energy_scan.set_name(str(new_value))
        self._tree_view_item.setText(0, self.energy_scan.get_name())

    def _run_number_ledit_change(self, new_value):
        if str(new_value).isdigit():
            self.energy_scan.set_number(int(new_value))
            self._tree_view_item.setText(0, self.energy_scan.get_name())

    def tab_changed(self):
        if self._tree_view_item:
            self.populate_widget(self._tree_view_item)

    def populate_widget(self, item):
        self._tree_view_item = item
        self.energy_scan = item.get_model()

        if self.energy_scan.is_executed():
            self.data_path_widget.setEnabled(False)
            self.periodic_table.setEnabled(False)
        else:
            self.data_path_widget.setEnabled(True)
            self.periodic_table.setEnabled(True)
            self.data_path_widget.update_data_model(
                self.energy_scan.path_template)
            self.periodic_table.periodicTable.\
                tableElementChanged(self.energy_scan.element_symbol)

    def element_clicked(self, symbol, energy):
        self.energy_scan.element_symbol = symbol
        self.energy_scan.edge = energy