Esempio n. 1
0
class PlotImportComponent:
    """
    Scheme workflow manager plot import component
    """
    def __init__(self):
        config = PlotImportButtonsConfig().buttons
        self._widgets = Widgets()
        self.components = OrderedDict()
        toolbar_buttons = self._create_buttons(config['toolbar'])
        self.components.update(toolbar_buttons)
        self.components.update({"stretcher": None})
        self.layout = self._add_to_layout(self.components, QHBoxLayout)

    def _create_buttons(self, options):
        """
        Dynamically creates QPushButton from options
        :param options: QPushButton configurations
        :type options: List
        :return: Dictionary of buttons - QPushButtons
        :rtype: OrderedDict
        """
        return self._widgets.create_buttons(options)

    def _add_to_layout(self, widgets, layout):
        """
        Adds QWidgets to QBoxLayout
        :param widgets: Widgets to be added to the layout
        :param widgets: QWidget
        :param layout: Widget layout
        :type layout: QBoxLayout
        :return: Layout of QPushButton(s)
        :rtype: QBoxLayout
        """
        return self._widgets.add_to_layout(widgets, layout)
Esempio n. 2
0
 def __init__(self):
     config = PlotImportButtonsConfig().buttons
     self._widgets = Widgets()
     self.components = OrderedDict()
     toolbar_buttons = self._create_buttons(config['toolbar'])
     self.components.update(toolbar_buttons)
     self.components.update({"stretcher": None})
     self.layout = self._add_to_layout(self.components, QHBoxLayout)
Esempio n. 3
0
 def __init__(self):
     config = PaginationButtonsConfig().buttons
     self._widgets = Widgets()
     components = OrderedDict()
     previous_buttons = self._create_buttons(config['previousButtons'])
     next_buttons = self._create_buttons(config['nextButtons'])
     line_editor = self._create_line_editor()
     components.update(previous_buttons)
     components[line_editor.objectName()] = line_editor
     components.update(next_buttons)
     self.layout = self._add_to_layout(components, QHBoxLayout)
Esempio n. 4
0
class ToolbarComponent:
    """
    Scheme workflow manager toolbar component
    """
    def __init__(self):
        self.config = ToolbarButtonsConfig().buttons
        self.widgets = Widgets()
        self.search = SearchComponent()
        self.components = OrderedDict()

    def create_component(self, options):
        """
        Dynamically creates component widget
        :param options: QPushButton configurations
        :type options: List
        :return components: Toolbar widget components
        :rtype components: OrderedDict
        """
        buttons = self.create_buttons(options)
        search_widget = self.create_search()
        self.components.update(buttons)
        self.components.update({"stretcher": None})
        self.components.update(search_widget)
        return self.components

    def create_buttons(self, options):
        """
        Dynamically creates QPushButton from options
        :param options: QPushButton configurations
        :type options: List
        :return: Dictionary of buttons - QPushButtons
        :rtype: OrderedDict
        """
        return self.widgets.create_buttons(options)

    def create_search(self):
        """
        Creates search component widget
        :return components: Search widget components
        :rtype components: OrderedDict
        """
        return self.search.create_component(self.config['searchButton'])

    def add_to_layout(self, widgets, layout):
        """
        Adds QWidgets to QBoxLayout
        :param widgets: Widgets to be added to the layout
        :param widgets: QWidget
        :param layout: Widget layout
        :type layout: QBoxLayout
        :return: Layout of QPushButton(s)
        :rtype: QBoxLayout
        """
        return self.widgets.add_to_layout(widgets, layout)
Esempio n. 5
0
class PaginationComponent:
    """
    Scheme workflow manager pagination component
    """
    def __init__(self):
        config = PaginationButtonsConfig().buttons
        self._widgets = Widgets()
        components = OrderedDict()
        previous_buttons = self._create_buttons(config['previousButtons'])
        next_buttons = self._create_buttons(config['nextButtons'])
        line_editor = self._create_line_editor()
        components.update(previous_buttons)
        components[line_editor.objectName()] = line_editor
        components.update(next_buttons)
        self.layout = self._add_to_layout(components, QHBoxLayout)

    def _create_buttons(self, options):
        """
        Dynamically creates QPushButton from options
        :param options: QPushButton configurations
        :type options: List
        :return: Dictionary of buttons - QPushButtons
        :rtype: OrderedDict
        """
        return self._widgets.create_buttons(options)

    @staticmethod
    def _create_line_editor():
        """
        Creates pagination QLineEditor
        :return editor: Line text editor
        :rtype editor: QLineEdit
        """
        line_editor = QLineEdit("No Records")
        line_editor.setAlignment(Qt.AlignCenter)
        line_editor.setObjectName("paginationRecords")
        return line_editor

    def _add_to_layout(self, widgets, layout):
        """
        Adds QWidgets to QBoxLayout
        :param widgets: Widgets to be added to the layout
        :param widgets: QWidget
        :param layout: Widget layout
        :type layout: QBoxLayout
        :return: Layout of QPushButton(s)
        :rtype: QBoxLayout
        """
        return self._widgets.add_to_layout(widgets, layout)
Esempio n. 6
0
class SearchComponent:
    """
    Scheme workflow manager search component
    """
    def __init__(self):
        self.widgets = Widgets()

    def create_component(self, options):
        """
        Creates search component widget
        :param options: QPushButton configurations
        :type options: List
        :return components: Search widget components
        :rtype components: OrderedDict
        """
        search = OrderedDict()
        line_editor = self.create_line_editor()
        search[line_editor.objectName()] = line_editor
        combobox = self.create_combobox()
        search[combobox.objectName()] = combobox
        buttons = self.create_buttons(options)
        search.update(buttons)
        return search

    @staticmethod
    def create_line_editor():
        """
        Creates toolbar QLineEditor
        :return editor: Line text editor
        :rtype editor: QLineEdit
        """
        line_editor = QLineEdit()
        line_editor.setPlaceholderText("Type to search...")
        line_editor.setObjectName("searchEdit")
        return line_editor

    @staticmethod
    def create_combobox():
        """
        Creates toolbar QComboBox
        :return combobox: Combobox
        :rtype combobox: QComboBox
        """
        combobox = QComboBox()
        combobox.setObjectName("filterComboBox")
        combobox.addItems(["Apply Filter"])
        return combobox

    def create_buttons(self, options):
        """
        Dynamically creates QPushButton from options
        :param options: QPushButton configurations
        :type options: List
        :return: Dictionary of buttons - QPushButtons
        :rtype: OrderedDict
        """
        return self.widgets.create_buttons(options)
Esempio n. 7
0
 def __init__(self):
     self.config = ToolbarButtonsConfig().buttons
     self.widgets = Widgets()
     self.search = SearchComponent()
     self.components = OrderedDict()
Esempio n. 8
0
 def __init__(self):
     self.widgets = Widgets()