Esempio n. 1
1
    def __init__(self):
        QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle("application main window")

        self.file_menu = QMenu('&File', self)
        self.file_menu.addAction('&Quit', self.fileQuit,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.menuBar().addMenu(self.file_menu)

        self.help_menu = QMenu('&Help', self)
        self.menuBar().addSeparator()
        self.menuBar().addMenu(self.help_menu)

        self.help_menu.addAction('&About', self.about)



        self.filename = "Fields_global.h5"
        self.f=h5.File(self.filename)
        dset = self.f["/1d_global/potential"]

        print "Attention: the dataset must be 4 dimensions"

        #> the main layout: left part (for the hdf5 tree view) and right part (for the plot area)
        self.main_widget = QWidget(self)

        #> if not putting splitter into a layout, the widgets in splitter do not fill the main windows
        #> (may exceed the app windows, so that the figures are partially shown ).
        layout = QVBoxLayout(self.main_widget)
        hSplitter = QSplitter(self.main_widget)
        layout.addWidget(hSplitter)


        #> the left part: the hdf5 tree view
        h5tree = QWidget()
        treeview = QTreeView(h5tree)
        self.model = HDFTreeModel([])
        self.model.openFile(self.filename, 'r+')
        treeview.setModel(self.model)

        treeview.doubleClicked.connect(self.redraw)

        hSplitter.addWidget(treeview)


        #> the right part: the plot area
        plotArea = QWidget(self.main_widget)
        sizePolicy = QSizePolicy();
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding);
        sizePolicy.setVerticalPolicy(QSizePolicy.Expanding);
        plotArea.setSizePolicy(sizePolicy);

        hSplitter.addWidget(plotArea)



        plotVboxlayout = QVBoxLayout(plotArea)
        self.sc = MyStaticMplCanvas(self.main_widget, dset, width=5, height=4, dpi=100)
        self.dc = MyDynamicMplCanvas(self.main_widget, dset, width=5, height=4, dpi=100)
        plotVboxlayout.addWidget(self.sc)
        plotVboxlayout.addWidget(self.dc)


        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

        self.statusBar().showMessage("All hail matplotlib!", 2000)
Esempio n. 2
0
    def __init__(self, parent, binpath):
        super().__init__(parent)
        sizePolicy = QSizePolicy()
        sizePolicy.setHorizontalPolicy(QSizePolicy.Maximum)
        sizePolicy.setVerticalPolicy(QSizePolicy.Maximum)
        #self.setSizePolicy(sizePolicy)
        self.setMouseTracking(True)

        self.on_selection = False
        self.selected = False
        self.c = Communicate()

        self.start_position = QPoint(0,0)
        self.last_position = QPoint(0,0)

        image = (
            b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
            b"\x00\x00\xFF\xFF\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00"
            b"\x00\x00\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x00\x00"
            b"\x00\x00\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x00\x00"
            b"\x00\x00\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x00\x00"
            b"\x00\x00\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x00\x00"
            b"\x00\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\xFF\xFF\x00\x00"
            b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
        im = QImage(image, 8,8, QImage.Format_RGB16)
        im = im.scaled(64,64)
        self.crop = QPixmap()
        self.crop.convertFromImage(im)
Esempio n. 3
0
class BatchStepList(QWidget):
    """List displayed to the left of the main Batch widgets to show the
    user which tracking setup step they are on."""
    active_style = "QLabel { background-color : #eff0f1; color : #31363b; }"
    inactive_style = "QLabel { background-color : #31363b; color : #eff0f1; }"

    def __init__(self, highlight=0, parent=None):
        super(BatchStepList, self).__init__(parent)

        self.layout = QVBoxLayout()
        self.highlight = highlight
        self.size_policy = QSizePolicy()
        self.size_policy.setHorizontalPolicy(QSizePolicy.Minimum)
        self.size_policy.setVerticalPolicy(QSizePolicy.Expanding)

        self.labels = [QLabel(l) for l in \
            ['1. Select Files',
            '2. Define Arena',
            '3. Define Female',
            '4. Set Tight Threshold',
            '5. Set Loose Threshold',
            '6. Track']]

        self.update_layout()
        
    def update_layout(self):
        for i, label in enumerate(self.labels):
            if i == self.highlight:
                label.setStyleSheet(self.active_style)
            else:
                label.setStyleSheet(self.inactive_style)
            label.setSizePolicy(self.size_policy)
            label.setFixedWidth(160)
            self.layout.addWidget(label)
        self.setLayout(self.layout)
Esempio n. 4
0
 def __init__(self):
     super().__init__()
     self.bundle = None
     self.manual_change = True
     size_policy = QSizePolicy()
     size_policy.setHorizontalPolicy(QSizePolicy.Expanding)
     size_policy.setVerticalPolicy(QSizePolicy.Expanding)
     self.setSizePolicy(size_policy)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 4, 0, 0)
     this_row = QHBoxLayout()
     this_row.addSpacing(4)
     selection_label = QLabel()
     selection_label.setText("Dieses Bild: ")
     this_row.addWidget(selection_label)
     self.keep_button = QRadioButton()
     self.keep_button.setText("behalten")
     self.keep_button.setMaximumHeight(14)
     self.keep_button.toggled.connect(self.mark_bundle)
     this_row.addWidget(self.keep_button)
     self.discard_button = QRadioButton()
     self.discard_button.setText("löschen")
     self.discard_button.setMaximumHeight(14)
     this_row.addWidget(self.discard_button)
     this_row.addStretch(1)
     layout.addLayout(this_row)
     img_scroll_area = QScrollArea()
     img_scroll_area.setSizePolicy(
         QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
     self.img_widget = ImageWidget(None)
     img_scroll_area.setWidget(self.img_widget)
     layout.addWidget(img_scroll_area, stretch=1)
     layout.addStretch()
     self.setLayout(layout)
Esempio n. 5
0
    def __init__(self, url, *args, **kwargs):
        QWebEngineView.__init__(self, *args, **kwargs)

        self._page = QWebEnginePage(get_profile())
        self.setPage(self._page)
        self.load(url)

        # Shortcut to manually reload
        self.reload_shortcut = QShortcut('CTRL+R', self)
        self.reload_shortcut.activated.connect(self.reload)

        # Check if pages is correctly loaded
        self.loadFinished.connect(self._load_finished)

        # Shortcut to close
        self.quit_shortcut = QShortcut('CTRL+ALT+DELETE', self)
        self.quit_shortcut.activated.connect(lambda: self.close())

        # Stretch the browser
        policy = QSizePolicy()
        policy.setVerticalStretch(1)
        policy.setHorizontalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Preferred)
        policy.setHorizontalPolicy(QSizePolicy.Preferred)
        self.setSizePolicy(policy)
Esempio n. 6
0
    def __init__(self, parent=None):
        super(PlotWidget1D, self).__init__()
        self.parent = parent

        # data4d has four dimensions, the first is time
        self.prefix = 'data'
        self.data4d = collect("/Fields/", "Phi_global_avg", prefix=self.prefix)
        self.dataName = "electric potential"

        sizePolicy = QSizePolicy()
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        sizePolicy.setVerticalPolicy(QSizePolicy.Expanding)
        self.setSizePolicy(sizePolicy)

        self.plotVboxlayout = QVBoxLayout(self)

        self.tab_widget = QTabWidget(self)
        self.plotVboxlayout.addWidget(self.tab_widget)

        # matplotlib figure tab

        self.sc = MyStaticMplCanvas1D(self, self.data4d, title=self.dataName)
        self.sc.draw()
        self.tab_widget.addTab(self.sc, "Figures")

        # data tab
        self.data_widget = QTableWidget(self)
        self.set_data_widget(self.data4d[0, 0, :, :])
        self.tab_widget.addTab(self.data_widget, "data")

        #> The slider
        self.sp_widget = QWidget(self)
        self.sp_layout = QHBoxLayout(self.sp_widget)

        self.label = QLabel("time")
        self.plainTextEdit = QTextEdit("0")
        self.plainTextEdit.setMaximumHeight(20)
        self.plainTextEdit.setMaximumWidth(100)
        self.sp = QSlider(QtCore.Qt.Horizontal)
        self.sp.setMinimum(0)
        self.sp.setMaximum(self.data4d.shape[0] - 1)
        self.sp.setTickPosition(QSlider.TicksBelow)
        self.sp.setTickInterval(1)
        self.sp.valueChanged.connect(self.timeChange)
        self.sp_layout.addWidget(self.label)
        self.sp_layout.addWidget(self.plainTextEdit)
        self.sp_layout.addWidget(self.sp)

        self.save_widget = QWidget(self)
        self.save_layout = QHBoxLayout(self.save_widget)
        self.button_saveFig = QPushButton("Save Figure")
        self.button_saveAnimation = QPushButton("Save Animation")
        self.save_layout.addWidget(self.button_saveFig)
        self.save_layout.addWidget(self.button_saveAnimation)
        self.button_saveAnimation.clicked.connect(self.save_animation)
        self.button_saveFig.clicked.connect(self.save_fig)

        #self.plotVboxlayout.addWidget(self.sc)
        self.plotVboxlayout.addWidget(self.sp_widget)
        self.plotVboxlayout.addWidget(self.save_widget)
Esempio n. 7
0
    def __init__(self, parent, args):
        super(CentralWidget, self).__init__(parent)
        self.layout = QHBoxLayout()
        self.setLayout(self.layout)

        self.annotator_config = AnnotatorConfigurationModel(args.config)
        self.annotation = AnnotationModel(args.video, args.output,
                                          self.annotator_config)

        splitter = QSplitter(Qt.Horizontal)

        self.canvas = ImageCanvas(self, self.annotator_config, self.annotation)
        splitter.addWidget(self.canvas)

        self.sidebar = QWidget(self)
        self.sidebar.setMinimumWidth(450)
        splitter.addWidget(self.sidebar)
        self.sidebar_layout = QVBoxLayout()
        self.sidebar.setLayout(self.sidebar_layout)

        self.video_control = VideoControl(self, self.annotation, self.canvas)
        self.sidebar_layout.addWidget(self.video_control)
        self.config_editor = ConfigurationEditor(self, self.annotator_config)
        self.sidebar_layout.addWidget(self.config_editor)
        self.ann_editor = AnnotationEditor(self, self.annotation, self.canvas)
        self.sidebar_layout.addWidget(self.ann_editor)

        policy = QSizePolicy()
        policy.setHorizontalPolicy(QSizePolicy.Maximum)
        policy.setVerticalPolicy(QSizePolicy.Maximum)
        self.canvas.setSizePolicy(policy)
        splitter.setStretchFactor(0, 1)
        splitter.setStretchFactor(1, 0)

        self.layout.addWidget(splitter)
Esempio n. 8
0
    def view_options_layout(self):

        sizepolicy = QSizePolicy()
        sizepolicy.setVerticalPolicy(QSizePolicy.Expanding)
        sizepolicy.setVerticalPolicy(QSizePolicy.Preferred)

        btn_list = QPushButton()
        btn_list.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/Bulleted List-50.png')))
        btn_list.setCheckable(True)
        btn_list.toggle()
        btn_list.setSizePolicy(sizepolicy)
        btn_list.clicked[bool].connect(lambda: self.change_view('list'))
        self.list_view_btn = btn_list

        btn_thumb = QPushButton()
        btn_thumb.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + 'img/Picture-64.png')))
        btn_thumb.setCheckable(True)
        btn_thumb.setSizePolicy(sizepolicy)
        btn_thumb.clicked[bool].connect(lambda: self.change_view('thumb'))
        self.thumb_view_btn = btn_thumb

        layout = QVBoxLayout()

        layout.addWidget(self.list_view_btn)
        layout.addWidget(self.thumb_view_btn)

        return layout
Esempio n. 9
0
    def __init__(self):
        super().__init__()

        visualize_button = PushButton("Visualization")
        visualize_button.clicked.connect(self.visualize_button_clicked)
        # to style it in our stylesheet
        visualize_button.setObjectName("bigButton")

        bulk_investigation_button = PushButton("Investigation / Settings")
        bulk_investigation_button.clicked.connect(
            self.bulk_investigation_button_clicked)
        bulk_investigation_button.setObjectName("bigButton")

        for button in [visualize_button, bulk_investigation_button]:
            font = button.font()
            font.setPointSize(30)
            button.setFont(font)

            expanding = QSizePolicy()
            expanding.setHorizontalPolicy(QSizePolicy.Expanding)
            expanding.setVerticalPolicy(QSizePolicy.Expanding)
            button.setSizePolicy(expanding)

        layout = QHBoxLayout()
        layout.addWidget(visualize_button)
        layout.addWidget(bulk_investigation_button)
        layout.setContentsMargins(15, 15, 15, 10)
        self.setLayout(layout)
    def on_add_button_to_list(self, button_group, layout, textedit, overide_str=None):
        """
        Adds a button to a specified button group and layout.
        :param button_group: QButtonGroup button is to be added to.
        :param layout: QLayout button is to be added to.
        :param lineedit: QLineEdit containing the new button string.
        :return:
        """
        if overide_str is not None:
            new_btn_str = overide_str
        else:
            new_btn_str = textedit.toPlainText()
            textedit.clear()
        new_btn = QPushButton(new_btn_str)
        new_btn.setFont(self.edit_font)
        new_btn.setFlat(True)
        new_btn.setCheckable(True)
        new_btn.toggle()
        size_policy = QSizePolicy()
        size_policy.setHorizontalPolicy(QSizePolicy.Expanding)
        size_policy.setVerticalPolicy(QSizePolicy.Preferred)
        new_btn.setSizePolicy(size_policy)

        button_group.addButton(new_btn)
        inset_pos = layout.count() - 2
        layout.insertWidget(inset_pos, new_btn)
Esempio n. 11
0
 def __init__(self):
     super().__init__()
     self.frame = 0
     self.image = QImage(QPixmap(500, 500).toImage())
     self.lumen = ([], [])
     self.plaque = ([], [])
     self.hide = True
     sizePolicy = QSizePolicy()
     sizePolicy.setHorizontalPolicy(QSizePolicy.Fixed)
     sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
     self.setSizePolicy(sizePolicy)
     self.setMinimumSize(QSize(500, 500))
     self.setMaximumSize(QSize(500, 500))
Esempio n. 12
0
 def __init__(self, orientation):
     super().__init__()
     self.setOrientation(orientation)
     self.setRange(0, 0)
     self.setValue(0)
     self.setFocusPolicy(Qt.StrongFocus)
     sizePolicy = QSizePolicy()
     sizePolicy.setHorizontalPolicy(QSizePolicy.Fixed)
     sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
     self.setSizePolicy(sizePolicy)
     self.setMinimumSize(QSize(800, 25))
     self.setMaximumSize(QSize(800, 25))
     self.gatedFrames = []
    def file_specific_info_layout(self, article_dicts):

        window_size = self.geometry()

        # Fonts
        # - Label Font
        s = window_size.height() / 20
        min_s = 10
        if s < min_s:
            lbl_font_size = min_s
        else:
            lbl_font_size = s
        lbl_font = QFont('SansSerif', lbl_font_size)
        lbl_font.setBold(True)

        # - Edit Font
        s = window_size.height() / 25
        min_s = 7
        if s < min_s:
            edit_font_size = min_s
        else:
            edit_font_size = s
        edit_font = QFont('SansSerif', edit_font_size)

        # - Expand Horizontally
        horSizePolicy = QSizePolicy()
        horSizePolicy.setVerticalPolicy(QSizePolicy.Preferred)
        horSizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)

        file_info_widget = QWidget()
        vbox = QVBoxLayout(file_info_widget)

        for dictionary in article_dicts:

            for key, value in dictionary.items():
                lbl = QLabel(str(key))
                lbl.setFont(lbl_font)
                lbl.setSizePolicy(horSizePolicy)
                vbox.addWidget(lbl)

                edit = QLineEdit()
                edit.setFont(edit_font)
                edit.setText(str(value))
                edit.setSizePolicy(horSizePolicy)
                vbox.addWidget(edit)

        scroll_area = QScrollArea()
        scroll_area.setWidget(file_info_widget)
        scroll_area.setWidgetResizable(True)

        return scroll_area
Esempio n. 14
0
    def __init__(self):
        super().__init__()
        self._cg = None
        self.visualizer = None
        self.old_api_key = get_setting("api_key")
        self.loadables_q = Queue()
        # this thread continually checks for new loadables to load
        self.cg_load_thread = threading.Thread(target=self._load_loadables)
        # we never kill this thread, so allow the application to quit while it's
        # still alive
        self.cg_load_thread.daemon = True
        self.cg_load_thread.start()
        self.loadable_loaded = threading.Event()
        self.show_visualizer_window.connect(self.show_visualizer)
        self.show_exception_signal.connect(self.show_exception)

        expanding = QSizePolicy()
        expanding.setHorizontalPolicy(QSizePolicy.Expanding)
        expanding.setVerticalPolicy(QSizePolicy.Expanding)

        self.drop_area = ReplayDropArea()
        self.drop_area.setSizePolicy(expanding)
        da_scroll_area = QScrollArea(self)
        da_scroll_area.setWidget(self.drop_area)
        da_scroll_area.setWidgetResizable(True)
        da_scroll_area.setFrameShape(QFrame.NoFrame)

        self.replay_map_creation = ReplayMapCreation()
        self.replay_map_creation.setSizePolicy(expanding)
        rmc_scroll_area = QScrollArea(self)
        rmc_scroll_area.setWidget(self.replay_map_creation)
        rmc_scroll_area.setWidgetResizable(True)
        rmc_scroll_area.setFrameShape(QFrame.NoFrame)

        visualize_button = PushButton("Visualize")
        visualize_button.setObjectName("bigButton")
        visualize_button.clicked.connect(self.visualize)
        font = visualize_button.font()
        font.setPointSize(30)
        visualize_button.setFont(font)
        expanding = QSizePolicy()
        expanding.setHorizontalPolicy(QSizePolicy.Expanding)
        expanding.setVerticalPolicy(QSizePolicy.Expanding)
        visualize_button.setSizePolicy(expanding)

        layout = QGridLayout()
        layout.addWidget(da_scroll_area, 0, 0, 6, 1)
        layout.addWidget(rmc_scroll_area, 0, 1, 6, 1)
        layout.addWidget(visualize_button, 6, 0, 2, 2)
        self.setLayout(layout)
Esempio n. 15
0
def _createExpandingSizePolicy(horizontal=True, vertical=True) -> QSizePolicy:
    """Creates a size policy that expands based on the given parameters

    Args:
        horizontal: When 'True', the returned size policy expands horizontally
        vertical: When 'True', the returned size policy expands vertically.

    Returns:
        A QSizePolicy representative of the given parameters.
    """
    sizePolicy = QSizePolicy()
    if horizontal:
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
    if vertical:
        sizePolicy.setVerticalPolicy(QSizePolicy.Expanding)
    return sizePolicy
Esempio n. 16
0
    def upload_layout(self):

        sizepolicy = QSizePolicy()
        sizepolicy.setVerticalPolicy(QSizePolicy.Expanding)
        sizepolicy.setVerticalPolicy(QSizePolicy.Preferred)

        btn_upload = QPushButton()
        btn_upload.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/figshare_upload.png')))
        btn_upload.setSizePolicy(sizepolicy)
        btn_upload.pressed.connect(self.upload_selection)
        self.upload_btn = btn_upload

        layout = QVBoxLayout()

        layout.addWidget(self.upload_btn)

        return layout
Esempio n. 17
0
    def __init__(self, parent = None, dataset = None):
        super(PlotWidget, self).__init__()

        self.parent = parent

        sizePolicy = QSizePolicy();
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding);
        sizePolicy.setVerticalPolicy(QSizePolicy.Expanding);
        self.setSizePolicy(sizePolicy);

        self.plotVboxlayout = QVBoxLayout(self)

        #> the up part, including sc and slider
        self.sc = None
        if (dataset.shape[2] == 1):
            self.sc = MyStaticMplCanvas1D(self, dataset, width=10, height=4, dpi=100)
        elif (dataset.shape[1] == 1):
            self.sc = MyStaticMplCanvas2D(self, dataset, width=5, height=4, dpi=100)

        #> The slider
        self.sp_widget = QWidget(self)
        self.sp_layout = QHBoxLayout(self.sp_widget)

        self.label = QLabel("time")
        self.plainTextEdit = QTextEdit("0")
        self.plainTextEdit.setMaximumHeight(20)
        self.plainTextEdit.setMaximumWidth(100)
        self.sp = QSlider(QtCore.Qt.Horizontal)
        self.sp.setMinimum(0)
        self.sp.setMaximum(dataset[...].shape[0]-1)
        self.sp.setTickPosition(QSlider.TicksBelow)
        self.sp.setTickInterval(1)
        self.sp.valueChanged.connect(self.timeChange)
        self.sp_layout.addWidget(self.label)
        self.sp_layout.addWidget(self.plainTextEdit)
        self.sp_layout.addWidget(self.sp)

        self.button_saveAnimation = QPushButton("Save Animation")
        self.button_saveAnimation.clicked.connect(self.save_animation)


        self.plotVboxlayout.addWidget(self.sc)
        self.plotVboxlayout.addWidget(self.sp_widget)
        self.plotVboxlayout.addWidget(self.button_saveAnimation)
Esempio n. 18
0
 def createSizePolicy(hPolicy=QSizePolicy.Expanding,
                      vPolicy=QSizePolicy.Expanding,
                      hStretch=1,
                      vStretch=1):
     """
     创建QSizePolicy
     :param hPolicy: 水平缩放策略
     :param vPolicy: 垂直缩放策略
     :param hStretch: 水平缩放因子
     :param vStretch: 垂直缩放因子
     :return: QSizePolicy
     """
     sizePolicy = QSizePolicy()
     # 水平和垂直方向的大小策略
     sizePolicy.setHorizontalPolicy(hPolicy)
     sizePolicy.setVerticalPolicy(vPolicy)
     # 缩放因子
     sizePolicy.setHorizontalStretch(hStretch)
     sizePolicy.setVerticalStretch(vStretch)
     return sizePolicy
    def confirmation_layout(self):
        sizepolicy = QSizePolicy()
        sizepolicy.setVerticalPolicy(QSizePolicy.Expanding)
        sizepolicy.setVerticalPolicy(QSizePolicy.Preferred)

        btn_exit = QPushButton()
        btn_exit.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/exit.png')))
        btn_exit.setSizePolicy(sizepolicy)
        btn_exit.pressed.connect(self.on_exit_pressed)

        btn_save = QPushButton()
        btn_save.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/figshare_upload.png')))
        btn_save.setSizePolicy(sizepolicy)
        btn_save.pressed.connect(self.on_save_pressed)

        vbox = QVBoxLayout()

        vbox.addWidget(btn_exit)
        vbox.addWidget(btn_save)

        return vbox
Esempio n. 20
0
    def __init__(self, url, get_current_proxy, *args, **kwargs):
        QWebEngineView.__init__(self, *args, **kwargs)

        # Register proxy authentication handler
        self.page().proxyAuthenticationRequired.connect(
            lambda url, auth, proxyHost: self._proxy_auth(
                get_current_proxy, url, auth, proxyHost))

        # Override user agent
        self.page().profile().setHttpUserAgent(
            user_agent_with_system(
                user_agent=self.page().profile().httpUserAgent(),
                system_name=system.NAME,
                system_version=system.VERSION))

        # Allow sound playback without user gesture
        self.page().settings().setAttribute(
            QWebEngineSettings.PlaybackRequiresUserGesture, False)

        # Load url
        self.page().setUrl(url)

        # Shortcut to manually reload
        self.reload_shortcut = QShortcut('CTRL+R', self)
        self.reload_shortcut.activated.connect(self.reload)

        # Check if pages is correctly loaded
        self.loadFinished.connect(self._load_finished)

        # Shortcut to close
        self.quit_shortcut = QShortcut('CTRL+ALT+DELETE', self)
        self.quit_shortcut.activated.connect(lambda: self.close())

        # Stretch the browser
        policy = QSizePolicy()
        policy.setVerticalStretch(1)
        policy.setHorizontalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Preferred)
        policy.setHorizontalPolicy(QSizePolicy.Preferred)
        self.setSizePolicy(policy)
Esempio n. 21
0
    def _create_style_view(self, style_path, path_to_icon, style_name):
        pixmap = self._read_input_pixmap(path_to_icon)
        if pixmap is not None:

            # create a scene which will handle the graphical image
            scene = QGraphicsScene(self)
            scene.addPixmap(pixmap)

            # create the the widget which will display the image
            graphics_view = SelectableGraphicsView(scene, self, style_path, path_to_icon)

            # set its maximum size to 100 by 100 pixels
            graphics_view.setMaximumSize(QSize(90, 90))

            # set the size policy to fixed so the widgets wont change their size
            size_policy = QSizePolicy()
            size_policy.setHorizontalPolicy(QSizePolicy.Fixed)
            size_policy.setVerticalPolicy(QSizePolicy.Fixed)
            graphics_view.setSizePolicy(size_policy)

            # disable the scrollbars for the graphics view
            graphics_view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
            graphics_view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

            # display the widget with a label indicating the stlye name
            frame = QFrame(self.ui.scrollArea)
            vertical_layout = QVBoxLayout(frame)
            frame.setLayout(vertical_layout)
            frame.setMaximumSize(QSize(120, 150))
            vertical_layout.addWidget(graphics_view)
            title_label = QLabel(style_name, frame)
            title_label.setAlignment(Qt.AlignHCenter)
            vertical_layout.addWidget(title_label)
            self.ui.horizontalLayout_2.addWidget(frame)

            # connect the signal and slots
            graphics_view.on_focus.connect(self._style_selector)

            return graphics_view
Esempio n. 22
0
 def __init__(self):
     super().__init__()
     self.images_list = InferencingList()
     self.selected = 0
     self.thumb_width = 128
     size_policy = QSizePolicy()
     size_policy.setVerticalPolicy(QSizePolicy.MinimumExpanding)
     self.setSizePolicy(size_policy)
     self.layout = QVBoxLayout()
     self.layout.setContentsMargins(4, 4, 4, 0)
     size_row = QHBoxLayout()
     slider_label = QLabel()
     slider_label.setText("Thumbnailgröße:")
     slider_label.setMinimumHeight(12)
     size_row.addWidget(slider_label, alignment=Qt.AlignLeading)
     slider = QSlider()
     slider.setOrientation(Qt.Horizontal)
     slider.setMinimum(64)
     slider.setMaximum(512)
     size_row.addWidget(slider, alignment=Qt.AlignLeading)
     self.thumb_size_label = QLabel()
     size_row.addWidget(self.thumb_size_label, alignment=Qt.AlignLeading)
     self.layout.addLayout(size_row)
     self.t_list = QListView()
     self.t_list.setMinimumWidth(self.thumb_width)
     self.t_list.setSizePolicy(
         QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding))
     self.t_list.setMouseTracking(True)
     self.t_list.setItemDelegate(
         ImageableStyledItemDelegate(parent=self.t_list))
     self.t_list.setSpacing(1)
     self.t_list.setModel(self.images_list)
     self.layout.addWidget(self.t_list, stretch=1)
     slider.valueChanged.connect(self.slider_changed)
     slider.setValue(self.thumb_width)
     self.setLayout(self.layout)
    def add_dropdownlist(self, layout, label, values, row=None, column=None, rowspan=None, columnspan=None):
        """
        Adds a drop down list to the given layout.
        :param layout: QLayout to add widget to.
        :param label: String containing the list title.
        :param values: List containing dropdown items.
        Optional
        :param row: int. If layout is a QGridLayout then the row must be given.
        :param column: int. If the layout is a QGridLayout then the column must be given.
        :param rowspan: int. For how many rows widget will span in QGridLayout.
        :param columnspan: int. For how many columns widget will span in QGridLayout.
        :return:
        """
        size_policy = QSizePolicy()
        size_policy.setHorizontalPolicy(QSizePolicy.Expanding)
        size_policy.setVerticalPolicy(QSizePolicy.Preferred)

        lbl = QLabel(label)
        lbl.setFont(self.label_font)
        lbl.setSizePolicy(size_policy)

        drop_menu = QComboBox()
        drop_menu.addItems(values)
        drop_menu.setFont(self.edit_font)
        drop_menu.setSizePolicy(size_policy)

        if type(layout) is QGridLayout:
            if rowspan is not None and columnspan is not None:
                layout.addWidget(lbl, row, column, rowspan, columnspan)
                layout.addWidget(drop_menu, row + rowspan + 1, column, rowspan, columnspan)
            else:
                layout.addWidget(lbl, row, column)
                layout.addWidget(drop_menu, row + 1, column)
        else:
            layout.addWidget(lbl)
            layout.addWidget(drop_menu)
Esempio n. 24
0
    def _createView(self):

        layout = QVBoxLayout()

        self.le_league = MonitoredLineEdit()
        self.le_league.setText("League TBD")
        self.le_league.setAlignment(Qt.AlignCenter)
        self.le_league.setPlaceholderText("League TBD")
        self.le_league.textModified.connect(self.league_changed)
        policy = QSizePolicy()
        policy.setHorizontalStretch(3)
        policy.setHorizontalPolicy(QSizePolicy.Expanding)
        policy.setVerticalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Fixed)
        self.le_league.setSizePolicy(policy)

        self.le_team = [MonitoredLineEdit() for y in range(2)]
        self.le_player = [[MonitoredLineEdit() for x in range(
            self.max_no_sets)] for y in range(2)]
        self.cb_race = [[QComboBox() for x in range(self.max_no_sets)]
                        for y in range(2)]
        self.sl_score = [QSlider(Qt.Horizontal)
                         for y in range(self.max_no_sets)]
        self.le_map = [MapLineEdit() for y in range(self.max_no_sets)]
        self.label_set = [QPushButton('#{}'.format(y + 1), self)
                          for y in range(self.max_no_sets)]
        self.setContainer = [QHBoxLayout()
                             for y in range(self.max_no_sets)]

        container = QHBoxLayout()
        for team_idx in range(2):
            self.le_team[team_idx].setText("TBD")
            self.le_team[team_idx].setAlignment(
                Qt.AlignCenter)
            self.le_team[team_idx].setPlaceholderText(
                "Team " + str(team_idx + 1))
            policy = QSizePolicy()
            policy.setHorizontalStretch(4)
            policy.setHorizontalPolicy(
                QSizePolicy.Expanding)
            policy.setVerticalStretch(1)
            policy.setVerticalPolicy(QSizePolicy.Fixed)
            self.le_team[team_idx].setSizePolicy(policy)
            self.le_team[team_idx].setMinimumWidth(self.mimumLineEditWidth)
            self.le_team[team_idx].textModified.connect(
                lambda team_idx=team_idx: self.team_changed(team_idx))

        self.qb_logo1 = IconPushButton()
        self.qb_logo1.setFixedWidth(self.raceWidth)
        self.qb_logo1.clicked.connect(lambda: self.parent.logoDialog(1, self))
        logo = self.controller.logoManager.getTeam1(self._ctrlID)
        self.qb_logo1.setIcon(QIcon(logo.provideQPixmap()))

        self.qb_logo2 = IconPushButton()
        self.qb_logo2.setFixedWidth(self.raceWidth)
        self.qb_logo2.clicked.connect(lambda: self.parent.logoDialog(2, self))
        logo = self.controller.logoManager.getTeam2(self._ctrlID)
        self.qb_logo2.setIcon(QIcon(logo.provideQPixmap()))

        self.sl_team = QSlider(Qt.Horizontal)
        self.sl_team.setTracking(False)
        self.sl_team.setMinimum(-1)
        self.sl_team.setMaximum(1)
        self.sl_team.setValue(0)
        self.sl_team.setTickPosition(
            QSlider.TicksBothSides)
        self.sl_team.setTickInterval(1)
        self.sl_team.valueChanged.connect(lambda x: self.sl_changed(-1, x))
        self.sl_team.setToolTip(_('Choose your team'))
        self.sl_team.setMinimumHeight(5)
        self.sl_team.setFixedWidth(self.scoreWidth)
        policy = QSizePolicy()
        policy.setHorizontalStretch(0)
        policy.setHorizontalPolicy(QSizePolicy.Fixed)
        policy.setVerticalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Fixed)
        self.sl_team.setSizePolicy(policy)

        container = QGridLayout()

        button = QPushButton()
        pixmap = QIcon(
            scctool.settings.getResFile('update.png'))
        button.setIcon(pixmap)
        button.clicked.connect(
            lambda: self.controller.swapTeams())
        button.setFixedWidth(self.labelWidth)
        button.setToolTip(_("Swap teams and logos."))
        container.addWidget(button, 0, 0, 2, 1)

        label = QLabel(_("League:"))
        label.setAlignment(Qt.AlignCenter)
        policy = QSizePolicy()
        policy.setHorizontalStretch(4)
        policy.setHorizontalPolicy(QSizePolicy.Expanding)
        policy.setVerticalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Fixed)
        label.setSizePolicy(policy)
        container.addWidget(label, 0, 1, 1, 1)

        label = QLabel(_("Maps \ Teams:"))
        label.setAlignment(Qt.AlignCenter)
        policy = QSizePolicy()
        policy.setHorizontalStretch(4)
        policy.setHorizontalPolicy(QSizePolicy.Expanding)
        policy.setVerticalStretch(1)
        policy.setVerticalPolicy(QSizePolicy.Fixed)
        label.setSizePolicy(policy)
        container.addWidget(label, 1, 1, 1, 1)

        container.addWidget(self.qb_logo1, 0, 2, 2, 1)
        container.addWidget(self.le_league, 0, 3, 1, 3)
        container.addWidget(self.le_team[0], 1, 3, 1, 1)
        container.addWidget(self.sl_team, 1, 4, 1, 1)
        container.addWidget(self.le_team[1], 1, 5, 1, 1)
        container.addWidget(self.qb_logo2, 0, 6, 2, 1)

        layout.addLayout(container)

        for player_idx in range(self.max_no_sets):
            self.le_map[player_idx].textModified.connect(
                lambda player_idx=player_idx: self.map_changed(player_idx))
            for team_idx in range(2):
                self.cb_race[team_idx][player_idx].\
                    currentIndexChanged.connect(
                    lambda idx,
                    t=team_idx,
                    p=player_idx: self.race_changed(t, p))
                self.le_player[team_idx][player_idx].textModified.connect(
                    lambda t=team_idx,
                    p=player_idx: self.player_changed(t, p))
                self.le_player[team_idx][player_idx].setText("TBD")
                self.le_player[team_idx][player_idx].setAlignment(
                    Qt.AlignCenter)
                self.le_player[team_idx][player_idx].setPlaceholderText(
                    _("Player {} of team {}").format(player_idx + 1,
                                                     team_idx + 1))
                self.le_player[team_idx][player_idx].setMinimumWidth(
                    self.mimumLineEditWidth)
                self.le_player[team_idx][player_idx].setContextMenuPolicy(
                    Qt.CustomContextMenu)
                self.le_player[team_idx][player_idx].\
                    customContextMenuRequested.connect(
                    lambda x, team_idx=team_idx,
                    player_idx=player_idx:
                    self.openPlayerContextMenu(team_idx, player_idx))

                for i in range(4):
                    self.cb_race[team_idx][player_idx].addItem(
                        QIcon(scctool.settings.getResFile(
                            str(i) + ".png")), "")

                self.cb_race[team_idx][player_idx].setFixedWidth(
                    self.raceWidth)

            self.sl_score[player_idx].setMinimum(-1)
            self.sl_score[player_idx].setMaximum(1)
            self.sl_score[player_idx].setValue(0)
            self.sl_score[player_idx].setTickPosition(
                QSlider.TicksBothSides)
            self.sl_score[player_idx].setTickInterval(1)
            self.sl_score[player_idx].setTracking(False)
            self.sl_score[player_idx].valueChanged.connect(
                lambda x,
                player_idx=player_idx: self.sl_changed(player_idx, x))
            self.sl_score[player_idx].setToolTip(_('Set the score'))
            self.sl_score[player_idx].setFixedWidth(self.scoreWidth)

            self.le_map[player_idx].setText("TBD")
            self.le_map[player_idx].setAlignment(
                Qt.AlignCenter)
            self.le_map[player_idx].setPlaceholderText(
                _("Map {}").format(player_idx + 1))
            self.le_map[player_idx].setMinimumWidth(
                self.mimumLineEditWidth)

            # self.le_map[player_idx].setReadOnly(True)

            self.setContainer[player_idx] = QHBoxLayout()
            # self.label_set[player_idx].setText("#" + str(player_idx + 1))
            # self.label_set[player_idx].setAlignment(
            #    Qt.AlignCenter)
            self.label_set[player_idx].setToolTip(
                _("Select map on Mapstats Browser Source."))
            self.label_set[player_idx].setEnabled(False)
            self.label_set[player_idx].clicked.connect(
                lambda x,
                player_idx=player_idx:
                self.showMap(player_idx))
            self.label_set[player_idx].setFixedWidth(self.labelWidth)
            self.setContainer[player_idx].addWidget(
                self.label_set[player_idx], 0)
            self.setContainer[player_idx].addWidget(
                self.le_map[player_idx], 4)
            self.setContainer[player_idx].addWidget(
                self.cb_race[0][player_idx], 0)
            self.setContainer[player_idx].addWidget(
                self.le_player[0][player_idx], 4)
            self.setContainer[player_idx].addWidget(
                self.sl_score[player_idx], 0)
            self.setContainer[player_idx].addWidget(
                self.le_player[1][player_idx], 4)
            self.setContainer[player_idx].addWidget(
                self.cb_race[1][player_idx], 0)
            layout.addLayout(self.setContainer[player_idx])

        layout.addItem(QSpacerItem(
            0, 0, QSizePolicy.Minimum,
            QSizePolicy.Expanding))
        self.setLayout(layout)

        self.updateMapCompleters()
        self.updatePlayerCompleters()
        self.updateTeamCompleters()
Esempio n. 25
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     
     sp = QSizePolicy()
     sp.setHorizontalPolicy(QSizePolicy.Expanding)
     sp.setVerticalPolicy(QSizePolicy.Expanding)
     sp.setVerticalStretch(1)
     
     wb_city_data = load_workbook(filename=r'DSTU-H_B_V.1.1-27_2010.xlsx', 
                                  read_only=True, data_only=True)
     self.__ws_city_I_ser_m_sj = wb_city_data['Лист1']
     self.__ws_city_t_z = wb_city_data['Т2. Температура зовн. пов.']
     
     self.__cityChoice = QComboBox()
     self.__cityChoice.addItems(c[0].value for c in 
                                self.__ws_city_I_ser_m_sj['A6':'A605'] if c[0].value)
     
     self.__q_0Edit = KwNumberEdit(.5)
     self.__V_budEdit = KwNumberEdit(480)
     
     self.__NEdit = QSpinBox()
     self.__NEdit.setRange(1, 999)
     self.__NEdit.setSuffix(' чол')
     self.__NEdit.setValue(6)
     
     self.__t_gvEdit = QSpinBox()
     self.__t_gvEdit.setRange(25, 70)
     self.__t_gvEdit.setSingleStep(5)
     self.__t_gvEdit.setSuffix(' \N{DEGREE CELSIUS}')
     self.__t_gvEdit.setValue(45)
     
     self.__a_gvEdit = QSpinBox()
     self.__a_gvEdit.setRange(15, 99)
     self.__a_gvEdit.setSuffix(' л/добу')
     self.__a_gvEdit.setValue(35)
     
     self.__f_zEdit = KwNumberEdit(.8)
     self.__varthetaEdit = KwNumberEdit(1.7)
     self.__S_0Edit = KwNumberEdit(1.723)
     self.__F_rEdit = KwNumberEdit(1)
     self.__eta_0Edit = KwNumberEdit(0.813)
     self.__ULEdit = KwNumberEdit(4.6)
     self.__aEdit = KwNumberEdit(.007)
     self.__bEdit = KwNumberEdit(1.27E-5)
     self.__c_paEdit = KwNumberEdit(3.16)
     
     self.__P_tpEdit = KwNumberEdit(14.1)
     self.__epsilon_tpEdit = KwNumberEdit(5.5)
     self.__epsilon_elEdit = KwNumberEdit(.88)
     self.__P_elEdit = KwNumberEdit(2.6)
     
     self.__t_co_1Edit = QSpinBox()
     self.__t_co_1Edit.setRange(25, 70)
     self.__t_co_1Edit.setSingleStep(5)
     self.__t_co_1Edit.setSuffix(' \N{DEGREE CELSIUS}')
     self.__t_co_1Edit.setValue(35)
     
     self.__t_co_2Edit = QSpinBox()
     self.__t_co_2Edit.setRange(20, 60)
     self.__t_co_2Edit.setSingleStep(5)
     self.__t_co_2Edit.setSuffix(' \N{DEGREE CELSIUS}')
     self.__t_co_2Edit.setValue(30)
     
     self.__eta_KEdit = KwNumberEdit(.93)
     self.__Q_n_rEdit = KwNumberEdit(35600)
     self.__c_gazEdit = KwNumberEdit(.55)
     self.__c_elEdit = KwNumberEdit(.25)
     
     self.__q_gruEdit = KwNumberEdit(21)
     
     self.__d_gruEdit = QSpinBox()
     self.__d_gruEdit.setRange(5, 99)
     self.__d_gruEdit.setSuffix('  мм')
     self.__d_gruEdit.setValue(25)
     
     self.__l_0_gruEdit = KwNumberEdit(1.7)
     
     calcButton = QPushButton('Визначити')
     calcButton.setObjectName('calcButton')
     
     self.__outputConsoleBrowser = KwConsoleBrowser(setup={'font': {'name': 
           QFont('Hack').family(), 'size': 8}, 'color': 'rgb(255, 255, 255)', 
           'background_color': 'rgba(0, 0, 0, 218)', 'line_wrap': False})
     self.__outputConsoleBrowser.setSizePolicy(sp)
     
     graphWidget = QMainWindow()
     graphWidget.setMinimumWidth(380)
     
     self.__graphCanvas = self.__createFigureCanvas()
     self.__graphNavigationToolbar = NavigationToolbar(self.__graphCanvas, self)
     graphWidget.addToolBar(Qt.TopToolBarArea, self.__graphNavigationToolbar)
     
     graphWidget.setCentralWidget(self.__graphCanvas)
     
     cityLayout = QFormLayout()
     cityLayout.addRow('Місто:', self.__cityChoice)
     
     soGroup = QGroupBox('Для системи опалення (СО):')
     soInputLayout = QFormLayout(soGroup)
     
     soInputLayout.addRow('Питома потужність тепловтрат, q<sub>0</sub>, '
                          'Вт/(м<sup>3</sup>\N{MIDDLE DOT}\N{DEGREE CELSIUS}):', 
                          self.__q_0Edit)
     soInputLayout.addRow("Об'єм будинку по зовнішніх обмірах, V<sub>буд</sub>, "
                          "м<sup>3</sup>:", self.__V_budEdit)
     
     sgvGroup = QGroupBox(u'Для системи гарячого водопостачання (СГК):')
     sgvInputLayout = QFormLayout(sgvGroup)
     sgvInputLayout.addRow('Кількість мешканців у будинку, N:', self.__NEdit)
     sgvInputLayout.addRow('Температура гарячої води, t<sub>гв</sub>:', self.__t_gvEdit)
     sgvInputLayout.addRow('Добова витрата гарячої води на 1 особу, a<sub>гв</sub>:',
                           self.__a_gvEdit)
     
     sgkGroup = QGroupBox('Для системи геліоколекторів (СГК):')
     sgkInputLayout = QFormLayout(sgkGroup)
     sgkInputLayout.addRow('Ступінь заміщення тепловтрат СГВ, f<sub>з</sub>:', self.__f_zEdit)
     sgkInputLayout.addRow('Параметр, \u03D1:', self.__varthetaEdit)
     sgkInputLayout.addRow('Площа 1-го геліоколектора, S<sub>0</sub>, м<sup>2</sup>:',
                           self.__S_0Edit)
     sgkInputLayout.addRow('F<sub>r</sub>:', self.__F_rEdit)
     sgkInputLayout.addRow('Оптичний ККД, \N{GREEK SMALL LETTER ETA}:', self.__eta_0Edit)
     sgkInputLayout.addRow('Коефіцієнт тепловтрат, UL, Вт/(м<sup>2</sup>)'
                           '\N{MIDDLE DOT}\N{DEGREE CELSIUS}):', self.__ULEdit)
     sgkInputLayout.addRow('a:', self.__aEdit)
     sgkInputLayout.addRow('b:', self.__bEdit)
     sgkInputLayout.addRow('c<sub>pa</sub>, кДж/(кг\N{MIDDLE DOT}\N{DEGREE CELSIUS}):',
                           self.__c_paEdit)
     
     tpGroup = QGroupBox('Для теплової помпи (ТП):')
     tpInputLayout = QFormLayout(tpGroup)
     tpInputLayout.addRow('Теплова потужність, P<sub>тп</sub>, кВт:', self.__P_tpEdit)
     tpInputLayout.addRow('Тепловий к.к.д, \N{GREEK SMALL LETTER EPSILON}'
                          '<sub>тп</sub>', self.__epsilon_tpEdit)
     tpInputLayout.addRow('Електричний к.к.д., \N{GREEK SMALL LETTER EPSILON}'
                          '<sub>ел</sub>:', self.__epsilon_elEdit)
     tpInputLayout.addRow('Електрична потужність, P<sub>ел</sub>, кВт:', self.__P_elEdit)
     tpInputLayout.addRow('Т-ра нагрітої води для СО підлоги, t<sub>co 1</sub>:',
                          self.__t_co_1Edit)
     tpInputLayout.addRow('Т-ра охолодженої води для СО підлоги, t<sub>co 2</sub>:',
                          self.__t_co_2Edit)
     tpInputLayout.addRow('К.к.д. згоряння палива, eta_K:', self.__eta_KEdit)
     tpInputLayout.addRow('Нижча теплота згоряння палива, Q<sub>n r</sub>, кДж/м<sup>3</sup>:',
                          self.__Q_n_rEdit)
     tpInputLayout.addRow('Вартість 1 м<sup>3</sup> газу, c<sub>газ</sub>, грн/м<sup>3</sup>:',
                          self.__c_gazEdit)
     tpInputLayout.addRow('Вартість 1 кВт\N{MIDDLE DOT}год, c<sub>ел</sub>, '
                          'грн/м<sup>3</sup>:', self.__c_elEdit)
     
     gruGroup = QGroupBox('Для ґрунту і контуру СО підлоги:')
     gruInputEdit = QFormLayout(gruGroup)
     gruInputEdit.addRow('Питома тепловіддача ґрунту, q<sub>ґр</sub>, '
                         'Вт/м<sup>2</sup>:', self.__q_gruEdit)
     gruInputEdit.addRow('Внутрішній діаметр, d, мм:', self.__d_gruEdit)
     gruInputEdit.addRow('Питома довжина тепловідбору, l<sub>0</sub>, '
                         'м/м<sup>2</sup>:', self.__l_0_gruEdit)
     
     inputScrollArea = QScrollArea()
     inputScrollArea.setWidgetResizable(True)
     inputScrollArea.setSizePolicy(sp)
     
     inputDataPanel = QWidget()
     inputDataLayout = QVBoxLayout(inputDataPanel)
     
     inputDataLayout.addLayout(cityLayout)
     inputDataLayout.addWidget(soGroup)
     inputDataLayout.addWidget(sgvGroup)
     inputDataLayout.addWidget(sgkGroup)
     inputDataLayout.addWidget(tpGroup)
     inputDataLayout.addWidget(gruGroup)
     
     inputScrollArea.setWidget(inputDataPanel)
     
     inputWidget = QWidget()
     inputLayout = QFormLayout(inputWidget)
     #inputLayout.setContentsMargins(0, 0, 0, 0)
     inputLayout.setRowWrapPolicy(QFormLayout.WrapAllRows)
     inputLayout.addRow('Вхідні дані:', inputScrollArea)
     inputLayout.addWidget(calcButton)
     
     consoleViewWidget = QWidget()
     consoleViewLayout = QFormLayout(consoleViewWidget)
     consoleViewLayout.setRowWrapPolicy(QFormLayout.WrapAllRows)
     consoleViewLayout.addRow(u'Результати:', self.__outputConsoleBrowser)
     
     contentSplitter = QSplitter(Qt.Horizontal)
     contentSplitter.setStretchFactor(0, 1)
     contentSplitter.setStretchFactor(1, 0)
     contentSplitter.setSizes([350, 380])
     contentSplitter.setChildrenCollapsible(False)
     
     ioSplitter = QSplitter(Qt.Vertical)
     ioSplitter.setStretchFactor(0, 1)
     ioSplitter.setStretchFactor(1, 0)
     ioSplitter.setSizes([200, 320])
     ioSplitter.setChildrenCollapsible(False)
     ioSplitter.setMinimumWidth(380)
     
     ioSplitter.addWidget(inputWidget)
     ioSplitter.addWidget(consoleViewWidget)
     
     contentSplitter.addWidget(ioSplitter)
     contentSplitter.addWidget(graphWidget)
     
     self.setCentralWidget(contentSplitter)
     
     self.resize(1200, 640)
     
     # <<<
     for inputValueWidget in inputWidget.findChildren((QAbstractSpinBox,
                                                       KwNumberEdit)):
         inputValueWidget.valueChanged.connect(self._reset_output_data)
     
     for inputValueWidget in inputWidget.findChildren(QComboBox):
         inputValueWidget.activated.connect(self._reset_output_data)
     
     calcButton.clicked.connect(self.calc_script)
Esempio n. 26
0
    def __init__(self, parent=None):
        super(PlotWidget3D, self).__init__()
        self.parent = parent

        # data4d has four dimensions, the first is time
        try:
            self.prefix = 'data'
            self.data4d = collect("/Fields/",
                                  "Phi_global_avg",
                                  prefix=self.prefix)
            self.dataName = "electric potential"
        except:
            self.prefix = 'grid'
            self.data4d = collect("is_wall", prefix=self.prefix)
            self.dataName = "geometry"

        sizePolicy = QSizePolicy()
        sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        sizePolicy.setVerticalPolicy(QSizePolicy.Expanding)
        self.setSizePolicy(sizePolicy)

        self.plotVboxlayout = QVBoxLayout(self)

        self.tab_widget = QTabWidget(self)
        self.plotVboxlayout.addWidget(self.tab_widget)

        self.i_time = 0
        self.i_direction = 0
        self.i_position = 0

        # matplotlib figure tab
        self.sc = MyStaticMplCanvas3D(self, self.data4d, title=self.dataName)
        self.sc.draw()
        self.tab_widget.addTab(self.sc, "Figures")

        # data tab
        self.data_widget = QTableWidget(self)
        self.set_data_widget(self.data4d[0, 0, :, :])
        self.tab_widget.addTab(self.data_widget, "data")

        # buttons to selection directions
        self.direction_selection_widget = QWidget(self)
        self.direction_selection_layout = QHBoxLayout(
            self.direction_selection_widget)

        self.button_xy_plane = QPushButton("xy plane")
        self.button_yz_plane = QPushButton("yz plane")
        self.button_zx_plane = QPushButton("zx plane")
        self.direction_selection_layout.addWidget(self.button_xy_plane)
        self.direction_selection_layout.addWidget(self.button_yz_plane)
        self.direction_selection_layout.addWidget(self.button_zx_plane)
        self.button_xy_plane.setCheckable(True)
        self.button_xy_plane.toggle()
        self.button_xy_plane.clicked.connect(self.xy_plane_selected)
        self.button_yz_plane.setCheckable(True)
        self.button_yz_plane.clicked.connect(self.yz_plane_selected)
        self.button_zx_plane.setCheckable(True)
        self.button_zx_plane.clicked.connect(self.zx_plane_selected)

        # slider widget for one direction of space dimension
        self.position_widget = QWidget(self)
        self.position_layout = QHBoxLayout(self.position_widget)

        self.position_label = QLabel("space direction")
        self.position_plainTextEdit = QTextEdit("0")
        self.position_plainTextEdit.setMaximumHeight(20)
        self.position_plainTextEdit.setMaximumWidth(100)
        self.position_slider = QSlider(QtCore.Qt.Horizontal)
        self.position_slider.setMinimum(0)
        self.position_slider.setMaximum(self.data4d.shape[3] - 1)
        self.position_slider.setTickPosition(QSlider.TicksBelow)
        self.position_slider.setTickInterval(1)
        self.position_slider.valueChanged.connect(self.positionChange)
        self.position_layout.addWidget(self.position_label)
        self.position_layout.addWidget(self.position_plainTextEdit)
        self.position_layout.addWidget(self.position_slider)

        # The slider widget for time dimension
        self.sp_widget = QWidget(self)
        self.sp_layout = QHBoxLayout(self.sp_widget)

        self.label = QLabel("time")
        self.plainTextEdit = QTextEdit("0")
        self.plainTextEdit.setMaximumHeight(20)
        self.plainTextEdit.setMaximumWidth(100)
        self.sp = QSlider(QtCore.Qt.Horizontal)
        self.sp.setMinimum(0)
        self.sp.setMaximum(self.data4d.shape[0] - 1)
        self.sp.setTickPosition(QSlider.TicksBelow)
        self.sp.setTickInterval(1)
        self.sp.valueChanged.connect(self.timeChange)
        self.sp_layout.addWidget(self.label)
        self.sp_layout.addWidget(self.plainTextEdit)
        self.sp_layout.addWidget(self.sp)

        # save widget
        self.save_widget = QWidget(self)
        self.save_layout = QHBoxLayout(self.save_widget)
        self.button_saveFig = QPushButton("Save Figure")
        self.button_saveAnimation = QPushButton("Save Animation")
        self.save_layout.addWidget(self.button_saveFig)
        self.save_layout.addWidget(self.button_saveAnimation)
        self.button_saveAnimation.clicked.connect(self.save_animation)
        self.button_saveFig.clicked.connect(self.save_fig)

        #self.plotVboxlayout.addWidget(self.sc)
        self.plotVboxlayout.addWidget(self.direction_selection_widget)
        self.plotVboxlayout.addWidget(self.position_widget)
        self.plotVboxlayout.addWidget(self.sp_widget)
        self.plotVboxlayout.addWidget(self.save_widget)
    def add_buttonlist(self, layout, label, values, key=None, row=None, column = None, rowspan=None,
                       columnspan=None):
        """
        Add an array of buttons to a layout that can be used to display arrays of data, e.g. tags or categories.
        The ability to add and remove items from the array is also added.
        :param layout: QLayout. Layout to add widgets to.
        :param label: String. Name of the field, e.g. tags, or categories.
        :param values: list. List of either strings or dictionary objects.
        Optional
        :param key: Dictionary Key. If the values given are in a dictionary object a dictionary key must also be provided.
        :param row: int. QGridLayout row from which to add widgets.
        :param column: int. QGridLayout column to add widgets to.
        :param rowspan: int. Number of rows to span widgets.
        :param columnspan: int. Number of columns to span widgets.
        :return:
        """
        # Create Qlabel for edit field.
        lbl = QLabel(label)
        lbl.setFont(self.label_font)
        # Create layout for buttons.
        hbox = QHBoxLayout()
        # Define a size policy for the buttons
        btn_sizePolicy = QSizePolicy()
        btn_sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding)
        btn_sizePolicy.setVerticalPolicy(QSizePolicy.Preferred)
        # Create a QButtonGroup
        btn_group = QButtonGroup()
        self.button_groups[label] = btn_group
        btn_group_id = 1
        # Create buttons and add to group and layout.
        list_element_type = type(values[0])
        if list_element_type is dict:
            for element in values:
                btn_str = str(element[key])
                btn = QPushButton(btn_str)
                btn.setFont(self.edit_font)
                btn.setFlat(True)
                btn.setSizePolicy(btn_sizePolicy)
                btn_group.addButton(btn, btn_group_id)
                hbox.addWidget(btn)
                btn_group_id += 1
        elif list_element_type is list:
            for element in values:
                btn_str = str(element)
                btn = QPushButton(btn_str)
                btn.setFont(self.edit_font)
                btn.setSizePolicy(btn_sizePolicy)
                btn_group.addButton(btn, btn_group_id)
                hbox.addWidget(btn)
                btn_group_id += 1

        txt_sizePolicy = QSizePolicy()
        txt_sizePolicy.setVerticalPolicy(QSizePolicy.Preferred)
        txt_sizePolicy.setHorizontalPolicy(QSizePolicy.Preferred)

        new_btn = QTextEdit()
        new_btn.setFont(self.edit_font)
        new_btn.setSizePolicy(txt_sizePolicy)
        hbox.addWidget(new_btn)

        options_layout = QVBoxLayout()

        options_btn_size_policy = QSizePolicy()
        options_btn_size_policy.setHorizontalPolicy(QSizePolicy.Preferred)
        options_btn_size_policy.setVerticalPolicy(QSizePolicy.Expanding)

        delete_btn = QPushButton()
        delete_btn.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/exit.png')))
        delete_btn.setSizePolicy(options_btn_size_policy)
        delete_btn.pressed.connect(lambda: self.on_delete_button_from_list(btn_group, hbox))
        options_layout.addWidget(delete_btn)

        add_btn = QPushButton()
        add_btn.setIcon(QIcon(os.path.abspath(__file__ + '/../..' + '/img/Plus-50.png')))
        add_btn.setSizePolicy(options_btn_size_policy)
        add_btn.pressed.connect(lambda: self.on_add_button_to_list(btn_group, hbox, new_btn))
        options_layout.addWidget(add_btn)

        hbox.addLayout(options_layout)

        if type(layout) is QGridLayout:
            if rowspan is not None and columnspan is not None:
                layout.addWidget(lbl, row, column, rowspan, columnspan)
                layout.addLayout(hbox, row + rowspan + 1, column, rowspan, columnspan)
            else:
                layout.addWidget(lbl, row, column)
                layout.addLayout(hbox, row + 1, column)
        else:
            layout.addWidget(lbl)
            layout.addLayout(hbox)
Esempio n. 28
0
    def createFormMatchDataBox(self):
        """Create the froms for the match data."""
        try:

            self.max_no_sets = hwctool.settings.max_no_sets
            self.scoreWidth = 35
            self.raceWidth = 100
            self.labelWidth = 25
            self.mimumLineEditWidth = 130

            self.fromMatchDataBox = QGroupBox(_("Match Data"))
            layout2 = QVBoxLayout()

            self.le_league = MonitoredLineEdit()
            self.le_league.setText("League TBD")
            self.le_league.setAlignment(Qt.AlignCenter)
            self.le_league.setPlaceholderText("League TBD")
            self.le_league.textModified.connect(self.league_changed)
            policy = QSizePolicy()
            policy.setHorizontalStretch(3)
            policy.setHorizontalPolicy(QSizePolicy.Expanding)
            policy.setVerticalStretch(1)
            policy.setVerticalPolicy(QSizePolicy.Fixed)
            self.le_league.setSizePolicy(policy)
            self.le_player = [[
                MonitoredLineEdit() for x in range(self.max_no_sets)
            ] for y in range(2)]
            self.cb_race = [[QComboBox() for x in range(self.max_no_sets)]
                            for y in range(2)]
            self.sl_score = [
                QSlider(Qt.Horizontal) for y in range(self.max_no_sets)
            ]
            self.label_set = [
                QLabel('#{}'.format(y + 1), self)
                for y in range(self.max_no_sets)
            ]
            self.setContainer = [
                QHBoxLayout() for y in range(self.max_no_sets)
            ]

            container = QGridLayout()

            button = QPushButton()
            pixmap = QIcon(hwctool.settings.getResFile('update.png'))
            button.setIcon(pixmap)
            button.clicked.connect(lambda: self.controller.swapTeams())
            button.setFixedWidth(self.labelWidth)
            button.setToolTip(_("Swap players."))
            container.addWidget(button, 0, 0, 1, 1)

            label = QLabel(_("League:"))
            label.setAlignment(Qt.AlignCenter)
            label.setFixedWidth(self.raceWidth)
            container.addWidget(label, 0, 1, 1, 1)

            container.addWidget(self.le_league, 0, 2, 1, 3)

            label = QLabel("")
            label.setFixedWidth(self.raceWidth)
            container.addWidget(label, 0, 5, 1, 1)

            layout2.addLayout(container)

            for player_idx in range(self.max_no_sets):
                for team_idx in range(2):
                    self.cb_race[team_idx][player_idx].\
                        currentIndexChanged.connect(
                        lambda idx,
                        t=team_idx,
                        p=player_idx: self.race_changed(t, p))
                    self.le_player[team_idx][player_idx].textModified.connect(
                        lambda t=team_idx, p=player_idx: self.player_changed(
                            t, p))
                    self.le_player[team_idx][player_idx].setText("TBD")
                    self.le_player[team_idx][player_idx].setAlignment(
                        Qt.AlignCenter)
                    self.le_player[team_idx][player_idx].setPlaceholderText(
                        _("Player {} of team {}").format(
                            player_idx + 1, team_idx + 1))
                    self.le_player[team_idx][player_idx].setMinimumWidth(
                        self.mimumLineEditWidth)

                    for race in hwctool.settings.races:
                        self.cb_race[team_idx][player_idx].addItem(race)

                    self.cb_race[team_idx][player_idx].setFixedWidth(
                        self.raceWidth)

                self.sl_score[player_idx].setMinimum(-1)
                self.sl_score[player_idx].setMaximum(1)
                self.sl_score[player_idx].setValue(0)
                self.sl_score[player_idx].setTickPosition(
                    QSlider.TicksBothSides)
                self.sl_score[player_idx].setTickInterval(1)
                self.sl_score[player_idx].setTracking(False)
                self.sl_score[player_idx].valueChanged.connect(
                    lambda x, player_idx=player_idx: self.sl_changed(
                        player_idx, x))
                self.sl_score[player_idx].setToolTip(_('Set the score'))
                self.sl_score[player_idx].setFixedWidth(self.scoreWidth)

                self.setContainer[player_idx] = QHBoxLayout()
                # self.label_set[player_idx].setText("#" + str(player_idx + 1))
                self.label_set[player_idx].setAlignment(Qt.AlignCenter)
                self.label_set[player_idx].setFixedWidth(self.labelWidth)
                self.setContainer[player_idx].addWidget(
                    self.label_set[player_idx], 0)
                self.setContainer[player_idx].addWidget(
                    self.cb_race[0][player_idx], 0)
                self.setContainer[player_idx].addWidget(
                    self.le_player[0][player_idx], 4)
                self.setContainer[player_idx].addWidget(
                    self.sl_score[player_idx], 0)
                self.setContainer[player_idx].addWidget(
                    self.le_player[1][player_idx], 4)
                self.setContainer[player_idx].addWidget(
                    self.cb_race[1][player_idx], 0)
                layout2.addLayout(self.setContainer[player_idx])

            layout2.addItem(
                QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
            self.fromMatchDataBox.setLayout(layout2)

            self.updatePlayerCompleters()

        except Exception as e:
            module_logger.exception("message")
Esempio n. 29
0
    def initUI(self):
        self.setGeometry(300, 100, 1000, 750)
        self.lumen = ()
        self.plaque = ()
        layout = QHBoxLayout()
        vbox1 = QVBoxLayout()
        vbox2 = QVBoxLayout()
        vbox1.setContentsMargins(0, 0, 100, 100)
        vbox2.setContentsMargins(100, 0, 0, 100)
        vbox2hbox1 = QHBoxLayout()
        vbox2.addLayout(vbox2hbox1)
        layout.addLayout(vbox1)
        layout.addLayout(vbox2)

        dicomButton = QPushButton('Read DICOM')
        contoursButton = QPushButton('Read Contours')
        gatingButton = QPushButton('Extract Diastolic Frames')
        segmentButton = QPushButton('Segment')
        writeButton = QPushButton('Write Report')

        self.infoTable = QTableWidget()
        self.infoTable.setRowCount(8)
        self.infoTable.setColumnCount(2)
        self.infoTable.setItem(0, 0, QTableWidgetItem('Patient Name'))
        self.infoTable.setItem(1, 0, QTableWidgetItem('Patient DOB'))
        self.infoTable.setItem(2, 0, QTableWidgetItem('Patient Sex'))
        self.infoTable.setItem(3, 0, QTableWidgetItem('Pullback Speed'))
        self.infoTable.setItem(4, 0, QTableWidgetItem('Resolution'))
        self.infoTable.setItem(5, 0, QTableWidgetItem('Dimensions'))
        self.infoTable.setItem(6, 0, QTableWidgetItem('Manufacturer'))
        self.infoTable.setItem(7, 0, QTableWidgetItem('Model'))

        dicomButton.clicked.connect(self.readDICOM)
        contoursButton.clicked.connect(self.readContours)
        segmentButton.clicked.connect(self.segment)
        gatingButton.clicked.connect(self.gate)
        """
        self.lumen, self.plaque, self.stent, self.resolution, frames = read_xml.read('/home/ubuntu/Documents/Qt/1-63/1-63.xml')
        self.lumen = self.mapToList(self.lumen)
        self.plaque = self.mapToList(self.plaque)
        self.stent = self.mapToList(self.stent)
        dicom = dcm.read_file('/home/ubuntu/Documents/Qt/1-63/2.16.840.1.114380.1.1.347327.186.1.1.20100506085134890.3.dcm')
        self.images = dicom.pixel_array
        """

        self.slider = QSlider(Qt.Horizontal)
        #self.slider.setRange(0, self.images.shape[0])
        self.slider.setRange(0, 100)
        self.slider.setValue(0)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        sizePolicy = QSizePolicy()
        sizePolicy.setHorizontalPolicy(QSizePolicy.Fixed)
        sizePolicy.setVerticalPolicy(QSizePolicy.Fixed)
        self.slider.setSizePolicy(sizePolicy)
        self.slider.setMinimumSize(QSize(500, 25))
        self.slider.setMaximumSize(QSize(500, 25))
        self.slider.valueChanged[int].connect(self.changeValue)
        #self.slider.keyPressEvent = self.keyPressEvent()

        self.hideBox = QCheckBox('Hide Contours')
        self.hideBox.setChecked(True)
        self.hideBox.stateChanged[int].connect(self.changeState)
        self.useGatedBox = QCheckBox('Display Gated Frames')
        self.useGatedBox.stateChanged[int].connect(self.useGated)

        self.wid = Display()
        #self.wid.setData(self.lumen, self.plaque, self.images)

        self.c = Communicate()
        self.c.updateBW[int].connect(self.wid.setFrame)
        self.c.updateBool[bool].connect(self.wid.setDisplay)

        self.text = QLabel()
        self.text.setAlignment(Qt.AlignCenter)
        self.text.setText("Frame {}".format(self.slider.value()))

        vbox1.addWidget(self.wid)
        vbox1.addWidget(self.slider)
        vbox1.addWidget(self.text)

        vbox2.addWidget(self.hideBox)
        vbox2.addWidget(self.useGatedBox)
        vbox2.addWidget(dicomButton)
        vbox2.addWidget(contoursButton)
        vbox2.addWidget(gatingButton)
        vbox2.addWidget(segmentButton)
        vbox2.addWidget(writeButton)
        vbox2hbox1.addWidget(self.infoTable)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)
        self.setCentralWidget(centralWidget)
        self.show()
Esempio n. 30
0
    def __init__(self, cbf_clr, cbf_run):
        super().__init__()

        # Store call back functions
        self.cbf_clear = cbf_clr
        self.cbf_run = cbf_run

        # Widgets for the input data A
        label_a = QLabel("Input A")
        dec_input_a = QLineEdit("0")
        dec_input_a.setInputMask(
            "999")  # Acceptable string is [0-9][0-9][0-9] in regexp.
        dec_input_a.setMaximumWidth(100)
        f = dec_input_a.font()
        _modify_number_font(f)
        dec_input_a.setFont(f)

        # Widgets for the input data B
        label_b = QLabel("Input B")
        dec_input_b = QLineEdit("0")
        dec_input_b.setInputMask(
            "999")  # Acceptable string is [0-9][0-9][0-9] in regexp.
        dec_input_b.setMaximumWidth(100)
        f = dec_input_b.font()
        _modify_number_font(f)
        dec_input_b.setFont(f)

        hl = QHBoxLayout()
        btn_clr = QPushButton("CLR")
        btn_clr.clicked.connect(self.cbf_clear)
        btn_clr.setStyleSheet(
            "QPushButton {background:blue; color: white; font: bold 12pt} "
            "QPushButton:pressed {background:darkblue}")
        sp = QSizePolicy()
        sp.setVerticalPolicy(QSizePolicy.Expanding)
        btn_clr.setSizePolicy(sp)

        btn_add = QPushButton("RUN\n+")
        btn_add.clicked.connect(lambda: self.cbf_run(is_plus=True))
        btn_add.setStyleSheet(
            "QPushButton {background:crimson; color: white; font: bold 12pt} "
            "QPushButton:pressed {background:darkred}")

        btn_sub = QPushButton("RUN\n-")
        btn_sub.clicked.connect(lambda: self.cbf_run(is_plus=False))
        btn_sub.setStyleSheet(
            "QPushButton {background:crimson; color: white; font: bold 12pt}"
            "QPushButton:pressed {background:darkred}")
        hl.addWidget(btn_clr)
        hl.addWidget(btn_add)
        hl.addWidget(btn_sub)

        vl = QVBoxLayout()
        vl.addWidget(label_a)
        vl.addWidget(dec_input_a)
        vl.addWidget(label_b)
        vl.addWidget(dec_input_b)
        vl.addLayout(hl)
        self.setLayout(vl)

        self.setFrameShape(QFrame.Box)
        self.setFrameShadow(QFrame.Sunken)
        self.setLineWidth(1)
        self.setMidLineWidth(1)

        self.dec_input_a = dec_input_a
        self.dec_input_b = dec_input_b
    def load_settings_widgets_from_pipeline_groupbox(self, position):
        """
        Extracts all widgets from a single algorithm and returns a QBoxLayout
        Args:
            alg: the alg instance we extract from

        Returns: a QBoxLayout containing all widgets for this particular alg.

        """

        alg = self.pipeline.executed_cats[position].active_algorithm

        print("alg " + str(alg))
        print("cat " + str(self.pipeline.executed_cats[position]))

        empty_flag = True

        groupOfSliders = QGroupBox()
        sp = QSizePolicy()
        sp.setVerticalPolicy(QSizePolicy.Preferred)
        # groupOfSliders.setSizePolicy(sp)
        groupOfSliderssLayout = QBoxLayout(QBoxLayout.TopToBottom)
        groupOfSliderssLayout.setContentsMargins(0, -0, -0, 0)
        groupOfSliderssLayout.setAlignment(Qt.AlignTop)
        groupOfSliderssLayout.setSpacing(0)

        print("Build Slider @ "+ str(position))

        # create integer sliders
        for slider in alg.integer_sliders:
            empty_flag = False
            print("slider.value " + str(slider.value))
            print("slider " + str(slider))
            #print(alg.get_name() + ": add slider (int).")
            groupOfSliderssLayout.addWidget(
                SliderWidget(slider.name, slider.lower, slider.upper, slider.step_size, slider.value,
                             slider.set_value, False))

        # create float sliders
        for slider in alg.float_sliders:
            empty_flag = False
            #print(alg.get_name() + ": add slider (float).")
            groupOfSliderssLayout.addWidget(
                SliderWidget(slider.name, slider.lower, slider.upper, slider.step_size, slider.value,
                             slider.set_value, True), 0, Qt.AlignTop)

        # create checkboxes
        for checkbox in alg.checkboxes:
            empty_flag = False
            #print(alg.get_name() + ": add checkbox.")
            groupOfSliderssLayout.addWidget(CheckBoxWidget(checkbox.name, checkbox.value, checkbox.set_value), 0,
                                            Qt.AlignTop)

        # create dropdowns
        for combobox in alg.drop_downs:
            empty_flag = False
            #print(alg.get_name() + ": add combobox.")
            groupOfSliderssLayout.addWidget(
                ComboBoxWidget(combobox.name, combobox.options, combobox.set_value, combobox.value), 0, Qt.AlignTop)

        if empty_flag:
            label = QLabel()
            label.setText("This algorithm has no Settings.")
            groupOfSliderssLayout.addWidget(label, 0, Qt.AlignHCenter)

        groupOfSliders.setLayout(groupOfSliderssLayout)

        return groupOfSliders