예제 #1
0
    def initAppletDrawerUi(self):
        localDir = os.path.split(__file__)[0]
        self._drawer = self._cropControlUi

        data_has_z_axis = True
        if self.topLevelOperatorView.InputImage.ready():
            tShape = self.topLevelOperatorView.InputImage.meta.getTaggedShape()
            if not "z" in tShape or tShape["z"] == 1:
                data_has_z_axis = False

        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMaxZ.setVisible(data_has_z_axis)

        self._cropControlUi.AddCropButton.clicked.connect(bind(self.newCrop))
        self._cropControlUi.SetCropButton.setVisible(False)
        self.editor.cropModel.mouseRelease.connect(bind(self.setCrop))

        self.topLevelOperatorView.MinValueT.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueT.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueX.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueX.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueY.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueY.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueZ.notifyDirty(
            self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueZ.notifyDirty(
            self.apply_operator_settings_to_gui)

        self.topLevelOperatorView.InputImage.notifyDirty(self.setDefaultValues)
        self.topLevelOperatorView.PredictionImage.notifyDirty(
            self.setDefaultValues)

        layout = QVBoxLayout()
        layout.setSpacing(0)
        layout.addWidget(self._cropControlUi)
        layout.addSpacerItem(QSpacerItem(0, 0, vPolicy=QSizePolicy.Expanding))

        self.setDefaultValues()
        self.apply_operator_settings_to_gui()

        self.editor.showCropLines(True)
        self.editor.cropModel.setEditable(True)
        self.editor.cropModel.changed.connect(self.onCropModelChanged)
        self.editor.posModel.timeChanged.connect(self.updateTime)
        self._cropControlUi._minSliderT.valueChanged.connect(
            self._onMinSliderTMoved)
        self._cropControlUi._maxSliderT.valueChanged.connect(
            self._onMaxSliderTMoved)
        self._cropControlUi._minSliderX.valueChanged.connect(
            self._onMinSliderXMoved)
        self._cropControlUi._maxSliderX.valueChanged.connect(
            self._onMaxSliderXMoved)
        self._cropControlUi._minSliderY.valueChanged.connect(
            self._onMinSliderYMoved)
        self._cropControlUi._maxSliderY.valueChanged.connect(
            self._onMaxSliderYMoved)
        self._cropControlUi._minSliderZ.valueChanged.connect(
            self._onMinSliderZMoved)
        self._cropControlUi._maxSliderZ.valueChanged.connect(
            self._onMaxSliderZMoved)

        self._cropControlUi.cropListView.deleteCrop.connect(self.onDeleteCrop)
        self._cropControlUi.cropListView.colorsChanged.connect(
            self.onColorsChanged)

        self._initCropListView()
예제 #2
0
    def init_ui(self):
        left_group_box = QGroupBox()
        left_grid_layout = QGridLayout()

        i = 0
        for device in self.devices:
            self.left_line_edit_list.append(QLineEdit(self.devices[device][0]))
            self.left_line_edit_list[i].setFixedWidth(100)

            self.left_line_edit_list[i].setToolTip(device)
            self.left_line_edit_hints.append(device)

            self.left_combo_list.append(QComboBox())
            self.left_combo_list[i].addItems(
                ['Media/media1.mp4', 'Media/media2.mp4', 'Media/media3.mp4'])

            if self.devices[device][1] == 'online':
                self.left_status_list.append(QLabel('online'))
                self.left_status_list[i].setObjectName('status_label_%d' % i)
                self.left_status_list[i].setStyleSheet(
                    'QLabel#status_label_%d {color: green}' % i)
            else:
                self.left_status_list.append(QLabel('offline'))
                self.left_status_list[i].setObjectName('status_label_%d' % i)
                self.left_status_list[i].setStyleSheet(
                    'QLabel#status_label_%d {color: red}' % i)
            self.left_status_list[i].setFixedWidth(50)
            self.left_status_list[i].setFrameShape(QFrame.Panel)
            self.left_status_list[i].setToolTip(self.devices[device][2])
            self.left_status_list[i].setAlignment(Qt.AlignCenter)

            self.left_checkbox_list.append(QCheckBox())
            self.left_checkbox_list[i].setFixedWidth(14)

            left_grid_layout.addWidget(self.left_line_edit_list[i], i, 0)
            left_grid_layout.addWidget(self.left_combo_list[i], i, 1)
            left_grid_layout.addWidget(self.left_status_list[i], i, 2)
            left_grid_layout.addWidget(self.left_checkbox_list[i], i, 3)

            i += 1

        left_scroll = QScrollArea()
        left_scroll.setWidget(left_group_box)
        left_scroll.setWidgetResizable(True)

        left_group_box.setLayout(left_grid_layout)

        # Right Group Box
        right_group_box = QGroupBox()
        right_vbox_layout = QVBoxLayout()
        right_vbox_layout.setSpacing(10)

        update_button = QPushButton('Update')
        upload_button = QPushButton('Upload')
        save_button = QPushButton('Save')
        update_button.clicked.connect(self.update)
        upload_button.clicked.connect(self.upload_file)
        save_button.clicked.connect(self.save)
        vertical_spacer = QSpacerItem(40, 20, QSizePolicy.Minimum,
                                      QSizePolicy.Expanding)
        sign_label = QLabel('By: Treysen Zobell')

        right_vbox_layout.addWidget(update_button, alignment=Qt.AlignTop)
        right_vbox_layout.addWidget(upload_button, alignment=Qt.AlignTop)
        right_vbox_layout.addWidget(save_button, alignment=Qt.AlignTop)
        right_vbox_layout.addSpacerItem(vertical_spacer)
        right_vbox_layout.addWidget(sign_label, alignment=Qt.AlignBottom)

        right_group_box.setLayout(right_vbox_layout)

        main_layout = QGridLayout()
        main_layout.setSpacing(20)
        main_layout.addWidget(left_scroll, 0, 0)
        main_layout.addWidget(right_group_box, 0, 1)

        self.setLayout(main_layout)
        self.setGeometry(300, 300, 600, 300)
        self.setWindowTitle('Advertising Manager')
        self.show()
예제 #3
0
    def __init__(self, mem, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        self.mem = mem

        c = wdgCuriosity(self.mem)
        c.setTitle(self.tr("Since when there is data in the database?"))
        c.setText("The first data is from {}".format(
            self.mem.con.cursor_one_field(
                "select min(datetime) from meals where users_id=%s",
                (self.mem.user.id, ))))
        self.layout.addWidget(c)

        self.addSeparator()

        c = wdgCuriosity(self.mem)
        c.setTitle(
            self.tr(
                "Which is the product with highest calories in 100 gramos?"))
        selected = None
        amount = 0
        for product in self.mem.data.products.arr:
            productamount = product.component_in_100g(
                eProductComponent.Calories)
            if productamount > amount:
                selected = product
                amount = productamount
        c.setText(
            self.tr(
                "The product with highest calories is {} with {} calories.".
                format(selected.fullName(),
                       selected.component_in_100g(
                           eProductComponent.Calories))))
        self.layout.addWidget(c)

        c = wdgCuriosity(self.mem)
        c.setTitle(
            self.tr("Which is the meal with highest calories I had eaten?"))
        print(*self.query_meal_with_the_highest_calories())
        c.setText(
            self.
            tr("The meal with the highest calories I ate was '{}' with '{}' calories. I ate at {}."
               ).format(*self.query_meal_with_the_highest_calories()))
        self.layout.addWidget(c)

        c = wdgCuriosity(self.mem)
        c.setTitle(
            self.tr("When did I take the highest calories amount in a day?"))
        c.setText(
            self.
            tr("The day I took the highest amount of calories was {} and I took {}."
               ).format(
                   *self.query_day_i_took_the_highest_amount_of_calories()))
        self.layout.addWidget(c)

        self.addSeparator()

        c = wdgCuriosity(self.mem)
        dt, weight = self.mem.con.cursor_one_row(
            "select datetime, max(weight) from biometrics where users_id=%s group by datetime order by max(weight) desc limit 1",
            (self.mem.user.id, ))
        c.setTitle(self.tr("When did I have my highest weight?"))
        c.setText(self.tr("My highest weight was {} at {}").format(weight, dt))
        self.layout.addWidget(c)

        c = wdgCuriosity(self.mem)
        dt, weight = self.mem.con.cursor_one_row(
            "select datetime, min(weight) from biometrics where users_id=%s group by datetime order by min(weight) limit 1",
            (self.mem.user.id, ))
        c.setTitle(self.tr("When did I have my lowest weight?"))
        c.setText(self.tr("My lowest weight was {} at {}").format(weight, dt))
        self.layout.addWidget(c)

        c = wdgCuriosity(self.mem)
        weight = self.mem.con.cursor_one_field(
            "select percentile_disc(0.5) within group (order by weight) from biometrics where users_id=%s;",
            (self.mem.user.id, ))
        c.setTitle(self.tr("Which is my median weight?"))
        c.setText(self.tr("My median weight is {}").format(weight))
        self.layout.addWidget(c)

        self.layout.addSpacerItem(
            QSpacerItem(10, 10, QSizePolicy.Expanding, QSizePolicy.Expanding))
예제 #4
0
    def update_layout_categories(self, force=False):
        # if we are classifying, Select current Container
        if self.behaviour == "classification":
            if self.current_container is None:
                return
            if not (isinstance(self.current_container, Segment)
                    or isinstance(self.current_container, Annotation)
                    or isinstance(self.current_container, Screenshot)):
                return

            if len(self.sorted_containers) > self.current_idx:
                if self.classification_mode == "Sequential":
                    self.current_container = self.sorted_containers[
                        self.current_idx]
                    self.main_window.project.set_selected(
                        None, selected=[self.current_container])
                self.lbl_CurrentContainer.setText(
                    self.current_container.__class__.__name__ + " " +
                    self.current_container.get_name())
                self.progressBar.setValue(
                    (self.current_idx + 1) / len(self.sorted_containers) * 100)
            else:
                self.current_container = None
            if self.current_container is None:
                return

            # Check if we need to rebuild the layout or if the checkboxes stay the same,
            # if so apply the classification of the current container
            if not force and set(self.all_checkboxes.keys()) == set(
                    itm.unique_id
                    for itm in self.current_experiment.get_unique_keywords(
                        self.current_container.get_parent_container())):
                for checkbox in self.all_checkboxes.values():
                    checkbox.stateChanged.disconnect()
                    checkbox.setChecked(
                        self.current_experiment.has_tag(
                            self.current_container, checkbox.word))
                    checkbox.stateChanged.connect(
                        partial(self.current_experiment.toggle_tag,
                                self.current_container, checkbox.word))
                return

        self.tab_widget.clear()
        self.tabs = []
        self.tab_categories = []
        self.checkbox_groups = []
        self.all_checkboxes = dict()
        self.checkbox_names = []

        if self.current_container is not None or self.behaviour == "query":
            if self.behaviour == "query":
                keywords = self.current_experiment.get_unique_keywords()
            else:
                keywords = self.current_experiment.get_unique_keywords(
                    self.current_container.get_parent_container(),
                    return_all_if_none=True)

            keywords = sorted(keywords,
                              key=lambda x:
                              (x.class_obj.name, x.voc_obj.name, x.word_obj.
                               organization_group, x.word_obj.name))
            for k in keywords:
                if not k.voc_obj.is_visible and not self.a_hidden.isChecked():
                    continue

                if self.a_only_active.isChecked() and \
                        not self.current_experiment.has_tag(self.current_container, k):
                    continue

                if self.complexity_settings is not None:
                    try:
                        if self.complexity_settings[
                                k.word_obj.
                                complexity_group] < k.word_obj.complexity_lvl:
                            continue
                    except Exception as e:
                        print("Exception in Classification Complexity Redraw",
                              e)

                if k.voc_obj.category not in self.tab_categories:
                    tab = QScrollArea()
                    tab.setWidget(QWidget())
                    tab.widget().setLayout(QVBoxLayout())
                    tab.setWidgetResizable(True)

                    self.tabs.append(tab)
                    self.tab_categories.append(k.voc_obj.category)
                    self.tab_widget.addTab(tab, k.voc_obj.category)
                else:
                    tab = self.tabs[self.tab_categories.index(
                        k.voc_obj.category)]
                if k.voc_obj.name + ":" + k.class_obj.name not in self.checkbox_names:
                    self.checkbox_names.append(k.voc_obj.name + ":" +
                                               k.class_obj.name)
                    group = CheckBoxGroupWidget(
                        tab, k.class_obj.name + ":" + k.voc_obj.name)
                    tab.widget().layout().addWidget(group)
                    self.checkbox_groups.append(group)
                else:
                    group = self.checkbox_groups[self.checkbox_names.index(
                        k.voc_obj.name + ":" + k.class_obj.name)]

                checkbox = WordCheckBox(group, k)
                if self.behaviour == "classification":
                    checkbox.setChecked(
                        self.current_experiment.has_tag(
                            self.current_container, checkbox.word))
                    checkbox.stateChanged.connect(
                        partial(self.current_experiment.toggle_tag,
                                self.current_container, checkbox.word))
                else:
                    checkbox.setChecked(k in self.current_query_keywords)
                    checkbox.stateChanged.connect(
                        partial(self.on_query_changed, checkbox))
                self.all_checkboxes[k.unique_id] = checkbox
                group.items.append(checkbox)
            for g in self.checkbox_groups:
                g.finalize()

        for t in self.tabs:
            t.widget().layout().addItem(
                QSpacerItem(1, 1, QSizePolicy.Preferred,
                            QSizePolicy.Expanding))

        if self.classification_mode == "Sequential":
            self.frame_container(self.current_container)
예제 #5
0
    def __init__(self,
                 title,
                 message,
                 item,
                 *args,
                 ntype=0,
                 callback=None,
                 **kwargs):
        super(NotificationItem, self).__init__(*args, **kwargs)
        self.item = item
        self.callback = callback
        layout = QHBoxLayout(self, spacing=0)
        layout.setContentsMargins(0, 0, 0, 0)
        self.bgWidget = QWidget(self)  # 背景控件, 用于支持动画效果
        layout.addWidget(self.bgWidget)

        layout = QGridLayout(self.bgWidget)
        layout.setHorizontalSpacing(15)
        layout.setVerticalSpacing(10)

        # 标题左边图标
        layout.addWidget(QLabel(self, pixmap=NotificationIcon.icon(ntype)), 0,
                         0)

        # 标题
        self.labelTitle = QLabel(title, self)
        font = self.labelTitle.font()
        font.setBold(True)
        font.setPixelSize(20)
        self.labelTitle.setFont(font)

        # 关闭按钮
        self.labelClose = QLabel(self,
                                 cursor=Qt.PointingHandCursor,
                                 pixmap=NotificationIcon.icon(
                                     NotificationIcon.Close))

        # 消息内容
        self.labelMessage = QLabel(message,
                                   self,
                                   cursor=Qt.PointingHandCursor,
                                   wordWrap=True,
                                   alignment=Qt.AlignRight | Qt.AlignTop)
        self.labelMessage.setStyleSheet(
            'QLabel{font-size:18; color:#00BFFF; text-decoration:underline}')
        self.labelMessage.adjustSize()

        # 添加到布局
        layout.addWidget(self.labelTitle, 0, 1)
        layout.addItem(
            QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum), 0,
            2)
        layout.addWidget(self.labelClose, 0, 3)
        layout.addWidget(self.labelMessage, 1, 1, 1, 2)

        # 边框阴影
        effect = QGraphicsDropShadowEffect(self)
        effect.setBlurRadius(12)
        effect.setColor(QColor(0, 0, 0, 25))
        effect.setOffset(0, 2)
        self.setGraphicsEffect(effect)

        self.adjustSize()

        # 5秒自动关闭
        self._timer = QTimer(self, timeout=self.doClose)
        self._timer.setSingleShot(True)  # 只触发一次
        self._timer.start(5000)
예제 #6
0
파일: ui_avatar.py 프로젝트: suvari/kaptan
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setSubTitle(self.tr("<h2>Create Your Avatar</h2>"))

        vlayout = QVBoxLayout(self)

        labelLayout = QHBoxLayout()
        labelImage = QLabel()
        labelImage.setPixmap(
            QIcon.fromTheme("preferences-desktop-user").pixmap(64, 64))
        labelImage.setMaximumSize(64, 64)
        labelLayout.addWidget(labelImage)

        label = QLabel(self)
        label.setWordWrap(True)
        label.setText(
            self.
            tr("<p>This screen helps you set your <strong>user picture</strong>. You can either choose an image from a \
        file or you can capture an image from your camera. Select an option from the <strong>options</strong> menu.</p>"
               ))
        labelLayout.addWidget(label)
        vlayout.addLayout(labelLayout)

        vlayout.addItem(
            QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        centerLayout = QHBoxLayout()
        centerLayout.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))

        groupBox = QGroupBox()
        groupBox.setMaximumWidth(500)
        vlayout2 = QVBoxLayout(groupBox)
        hlayout = QHBoxLayout()

        comboBox = QComboBox()
        comboBox.setMinimumWidth(250)
        comboBox.addItems([self.tr("Options"), self.tr("Choose an image...")])

        #Camera control
        self.cameraInfo = None
        self.camera = None
        self.cameraImageCapture = None
        cameras = QCameraInfo.availableCameras()

        if len(cameras):
            self.cameraInfo = cameras[0]
            comboBox.addItem(self.tr("Camera ") + self.cameraInfo.deviceName())
            self.camera = QCamera(self.cameraInfo)
            self.camera.setCaptureMode(QCamera.CaptureStillImage)
            self.cameraImageCapture = QCameraImageCapture(self.camera)
            self.imageProcessing = self.camera.imageProcessing()
            self.imageProcessing.setWhiteBalanceMode(
                QCameraImageProcessing.WhiteBalanceSunlight)
            self.imageProcessing.setContrast(1)
            self.imageProcessing.setSaturation(1)
            self.imageProcessing.setSharpeningLevel(1)
            self.imageProcessing.setDenoisingLevel(1)
            #self.imageProcessing.setColorFilter(QCameraImageProcessing.ColorFilterWhiteboard) #FIXME Qt5.5
            self.cameraImageCapture.imageCaptured.connect(self.imageCapture)

        self.buttonCam = QPushButton()
        self.buttonCam.setText(self.tr("Capture"))
        self.buttonCam.setIcon(QIcon.fromTheme("camera-web"))
        self.buttonCam.setVisible(False)

        self.buttonReplay = QPushButton()
        self.buttonReplay.setText(self.tr("Recapture"))
        self.buttonReplay.setIcon(QIcon.fromTheme("view-refresh"))
        self.buttonReplay.setVisible(False)

        hlayout.addWidget(comboBox)
        hlayout.addItem(
            QSpacerItem(300, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))
        hlayout.addWidget(self.buttonCam)
        hlayout.addWidget(self.buttonReplay)

        vlayout2.addLayout(hlayout)

        hlayout2 = QHBoxLayout()

        hlayout2.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))

        self.cameraLabel = QLabel()
        self.cameraLabel.setScaledContents(True)
        self.cameraLabel.setStyleSheet("background-color: black;")
        self.cameraLabel.setMinimumSize(320, 240)
        self.cameraLabel.setMaximumSize(320, 240)

        self.cameraView = QCameraViewfinder()
        self.cameraView.setMaximumSize(320, 240)
        self.cameraView.setMinimumSize(320, 240)
        self.cameraView.hide()

        hlayout2.addWidget(self.cameraLabel)
        hlayout2.addWidget(self.cameraView)

        hlayout2.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))
        vlayout2.addLayout(hlayout2)

        centerLayout.addWidget(groupBox)
        centerLayout.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))
        vlayout.addLayout(centerLayout)
        vlayout.addItem(
            QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        comboBox.currentIndexChanged.connect(self.avatarSelect)
        self.buttonCam.clicked.connect(self.buttonCamChanged)
        self.buttonReplay.clicked.connect(self.buttonReplayChanged)

        self.userAvatar = None
예제 #7
0
    def edit(self):
        logging.debug('edit() called ExecBranch')

        self.branchEditLayout = QVBoxLayout()

        self.branchEdit = ElementEditor(self)
        self.branchEdit.setWindowTitle(QC.translate('', 'Edit Branch'))

        self.branch_image = QLabel()
        self.branch_image.setPixmap(QPixmap(self.pixmap_path))

        self.branch_yes = QLabel()
        self.branch_yes.setText(QC.translate('', 'Yes'))
        self.branch_yes.setAlignment(Qt.AlignCenter)

        self.branch_no = QLabel()
        self.branch_no.setText(QC.translate('', 'No'))

        self.help_text = QWidget()
        self.help_text_layout = QVBoxLayout(self.help_text)

        self.help_text_1 = QLabel()
        self.help_text_1.setText(QC.translate('', 'Leads the execution path'))

        self.help_text_2 = QLabel()
        self.help_text_2.setText(
            QC.translate('', 'according to the defined condition.'))

        self.help_text_3 = QLabel()
        self.help_text_3.setText(
            QC.translate('', 'Put strings in quotation marks:'))

        self.help_text_4 = QLabel()
        self.help_text_4.setText(QC.translate('', 'e.g. "state_x"'))

        self.help_text_layout.addWidget(self.help_text_1)
        self.help_text_layout.addWidget(self.help_text_2)
        self.help_text_layout.addWidget(self.help_text_3)
        self.help_text_layout.addWidget(self.help_text_4)

        self.spacer = QSpacerItem(0, 30)
        self.picto_spacer = QSpacerItem(40, 0)

        self.confirm_button = QPushButton(QC.translate('', 'Ok'))

        self.picto_widget = QWidget()
        self.pictogram_layout = QGridLayout(self.picto_widget)
        self.pictogram_layout.addWidget(self.branch_image, 0, 0)
        self.pictogram_layout.addWidget(self.branch_yes, 1, 0)
        self.pictogram_layout.addWidget(self.branch_no, 0, 1)
        self.pictogram_layout.addItem(self.picto_spacer, 0, 2)
        self.pictogram_layout.addWidget(self.help_text, 0, 3)
        self.pictogram_layout.setColumnStretch(4, 1)

        self.checkNegate = QCheckBox(
            QC.translate('', 'Negate query (if NOT ... )'))
        # try to load status
        try:
            compare_with, operation, op_index, negate, log_state = self.config
        except TypeError as e:
            pass

        self.selectCondition.setCurrentIndex(op_index)

        if negate:
            self.checkNegate.setChecked(True)

        self.if_text_1 = QLabel()
        self.if_text_1.setText(QC.translate('', 'if INPUT is ...'))

        self.user_input = QLineEdit()
        if compare_with:
            self.user_input.setText(compare_with)

        # hier logging option einfügen
        self.log_line = QWidget()
        self.ask_for_logging = QLabel()
        self.ask_for_logging.setText(QC.translate('', 'Log output?'))
        self.log_checkbox = QCheckBox()
        self.log_line_layout = QHBoxLayout(self.log_line)
        self.log_line_layout.addWidget(self.ask_for_logging)
        self.log_line_layout.addWidget(self.log_checkbox)
        self.log_line_layout.addStretch(1)

        if log_state:
            self.log_checkbox.setChecked(True)

        self.branchEditLayout.addWidget(self.checkNegate)
        self.branchEditLayout.addWidget(self.if_text_1)
        self.branchEditLayout.addWidget(self.selectCondition)
        self.branchEditLayout.addWidget(self.user_input)
        self.branchEditLayout.addWidget(self.log_line)
        self.branchEditLayout.addSpacerItem(self.spacer)
        self.branchEditLayout.addWidget(self.picto_widget)
        self.branchEditLayout.addStretch(1)
        self.branchEditLayout.addWidget(self.confirm_button)
        self.branchEdit.setLayout(self.branchEditLayout)

        # signals and slots
        self.confirm_button.clicked.connect(self.branchEdit.closeEvent)
        self.branchEdit.window_closed.connect(self.edit_done)

        self.branchEdit.show()
예제 #8
0
    def setupUi(self):
        mainw = QWidget()
        layout = QHBoxLayout()
        grid = QGridLayout()
        lay2 = QVBoxLayout()
        layout.addLayout(grid)
        layout.addLayout(lay2)
        mainw.setLayout(layout)
        self.setCentralWidget(mainw)
        mainw.setFixedHeight(200)

        # from PyQt5.QtCore import QTextCodec
        # QTextCodec.setCodecForTr(QTextCodec.codecForName("UTF-8"))无效
        self.__reverseCheckbox = QCheckBox(self.tr("reverse"))  # ,"反向查找"))
        caseSensitiveCheckbox = QCheckBox(
            self.tr("case sensitive"))  # ,"匹配大小写"))
        wordCheckbox = QCheckBox(self.tr("match word"))  # ,"单词匹配"))
        # ,r'支持反义字符"\n,\r,\t,\0,\x..."'))
        escapeCheckbox = QCheckBox(
            self.tr(r"support escape char'\n,\r,\t,\0,\x...'"))
        regCheckbox = QCheckBox(self.tr("regular expression"))  # ,"正则表达式"))
        label1 = QLabel(self.tr("Search Text"))  # ,"查找内容:"))
        self.__label2 = QLabel(self.tr("Replace to:"))  # ,"替换为:"))
        self.__searchTextBox = QLineEdit()
        self.__replaceTextBox = QLineEdit()
        # self.__searchTextBox.setMinimumWidth(120)
        grid.addWidget(label1, 0, 0, 1, 1, Qt.AlignRight)
        grid.addWidget(self.__label2, 1, 0, 1, 1, Qt.AlignRight)
        grid.addWidget(self.__searchTextBox, 0, 1)
        grid.addWidget(self.__replaceTextBox, 1, 1)
        grid.addItem(QSpacerItem(20, 5), 2, 0)
        grid.setRowStretch(2, 1)
        grid.addWidget(self.__reverseCheckbox, 3, 0)
        grid.addWidget(caseSensitiveCheckbox, 4, 0)
        grid.addWidget(wordCheckbox, 5, 0)
        grid.addWidget(escapeCheckbox, 6, 0, 1, 2)
        grid.addWidget(regCheckbox, 7, 0)
        if not self.isReplace:
            self.__label2.setVisible(False)
            self.__replaceTextBox.setVisible(False)
            self.__reverseCheckbox.setVisible(False)

        self.__searchTextBox.textChanged.connect(self.chText)
        self.__replaceTextBox.textChanged.connect(self.chText)
        self.__reverseCheckbox.stateChanged.connect(self.setReverse)
        caseSensitiveCheckbox.stateChanged.connect(self.setCase)
        wordCheckbox.stateChanged.connect(self.setWord)
        escapeCheckbox.stateChanged.connect(self.setEscape)
        regCheckbox.stateChanged.connect(self.setRe)

        findNextBtn = QPushButton(self.tr("Find Next"))  # ,"查找下一个"))
        findNextBtn.setShortcut(Qt.Key_Return)
        self.__findPreBtn = QPushButton(self.tr("Find previous"))  # ,"查找上一个"))
        self.__findPreBtn.setMinimumWidth(150)
        self.__findPreBtn.setSizePolicy(
            QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding))
        self.__findPreBtn.resize(self.__findPreBtn.sizeHint())
        countBtn = QPushButton(self.tr("Count"))  # ,"计数"))
        cancelBtn = QPushButton(self.tr("Cancel"))  # ,"取消"))
        self.__replaceBtn = QPushButton(self.tr("Replace"))  # ,"替换"))
        self.__replaceAllBtn = QPushButton(self.tr("Replace All"))  # ,"替换全部"))
        self.__replaceAllBtn.setVisible(False)
        lay2.addWidget(findNextBtn)
        lay2.addWidget(self.__findPreBtn)
        lay2.addWidget(countBtn)
        lay2.addWidget(self.__replaceBtn)
        lay2.addWidget(self.__replaceAllBtn)
        lay2.addWidget(cancelBtn)
        lay2.addStretch(1)
        countBtn.setVisible(False)
        if self.isReplace:
            self.__findPreBtn.setVisible(False)
        else:
            self.__replaceBtn.setVisible(False)
            self.__replaceAllBtn.setVisible(False)

        findNextBtn.clicked.connect(
            lambda: (self.setReverse(False), self.findreplace()))
        self.__findPreBtn.clicked.connect(
            lambda: (self.setReverse(True), self.findreplace()))
        self.__replaceBtn.clicked.connect(lambda: self.findreplace(True))

        cancelBtn.clicked.connect(self.close)
        cancelBtn.setShortcut(Qt.Key_Escape)
예제 #9
0
    def __init__(self, persepolis_setting):
        super().__init__()
        icon = QtGui.QIcon()
        self.setWindowIcon(QIcon.fromTheme('persepolis', QIcon(':/icon.svg')))
        self.setWindowTitle('Preferences')

        global icons
        icons = ':/' + str(persepolis_setting.value('settings/icons')) + '/'

        self.verticalLayout_2 = QVBoxLayout(self)
        self.setting_tabWidget = QTabWidget(self)
        #download_options_tab
        self.download_options_tab = QWidget()
        self.layoutWidget = QWidget(self.download_options_tab)
        self.download_options_verticalLayout = QVBoxLayout(self.layoutWidget)
        self.download_options_verticalLayout.setContentsMargins(21, 21, 0, 0)
        self.download_options_verticalLayout.setObjectName(
            "download_options_verticalLayout")
        self.horizontalLayout_5 = QHBoxLayout()
        #tries_label
        self.tries_label = QLabel(self.layoutWidget)
        self.horizontalLayout_5.addWidget(self.tries_label)
        #tries_spinBox
        self.tries_spinBox = QSpinBox(self.layoutWidget)
        self.tries_spinBox.setMinimum(1)

        self.horizontalLayout_5.addWidget(self.tries_spinBox)
        self.download_options_verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_4 = QHBoxLayout()
        #wait_label
        self.wait_label = QLabel(self.layoutWidget)
        self.horizontalLayout_4.addWidget(self.wait_label)
        #wait_spinBox
        self.wait_spinBox = QSpinBox(self.layoutWidget)
        self.horizontalLayout_4.addWidget(self.wait_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_3 = QHBoxLayout()
        #time_out_label
        self.time_out_label = QLabel(self.layoutWidget)
        self.horizontalLayout_3.addWidget(self.time_out_label)
        #time_out_spinBox
        self.time_out_spinBox = QSpinBox(self.layoutWidget)
        self.horizontalLayout_3.addWidget(self.time_out_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2 = QHBoxLayout()
        #connections_label
        self.connections_label = QLabel(self.layoutWidget)
        self.horizontalLayout_2.addWidget(self.connections_label)
        #connections_spinBox
        self.connections_spinBox = QSpinBox(self.layoutWidget)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        self.horizontalLayout_2.addWidget(self.connections_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_2)
        #rpc_port_label
        self.rpc_port_label = QLabel(self.layoutWidget)
        self.rpc_horizontalLayout = QHBoxLayout()
        self.rpc_horizontalLayout.addWidget(self.rpc_port_label)
        #rpc_port_spinbox
        self.rpc_port_spinbox = QSpinBox(self.layoutWidget)
        self.rpc_port_spinbox.setMinimum(1024)
        self.rpc_port_spinbox.setMaximum(65535)
        self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox)
        self.download_options_verticalLayout.addLayout(
            self.rpc_horizontalLayout)

        self.setting_tabWidget.addTab(self.download_options_tab, "")
        #save_as_tab
        self.save_as_tab = QWidget()

        self.layoutWidget1 = QWidget(self.save_as_tab)

        self.save_as_verticalLayout = QVBoxLayout(self.layoutWidget1)
        self.save_as_verticalLayout.setContentsMargins(20, 30, 0, 0)

        self.download_folder_horizontalLayout = QHBoxLayout()
        #download_folder_label
        self.download_folder_label = QLabel(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_label)
        #download_folder_lineEdit
        self.download_folder_lineEdit = QLineEdit(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_lineEdit)
        #download_folder_pushButton
        self.download_folder_pushButton = QPushButton(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_pushButton)

        self.save_as_verticalLayout.addLayout(
            self.download_folder_horizontalLayout)
        self.temp_horizontalLayout = QHBoxLayout()
        #temp_download_label
        self.temp_download_label = QLabel(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_label)
        #temp_download_lineEdit
        self.temp_download_lineEdit = QLineEdit(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit)
        #temp_download_pushButton
        self.temp_download_pushButton = QPushButton(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_pushButton)

        self.save_as_verticalLayout.addLayout(self.temp_horizontalLayout)
        self.setting_tabWidget.addTab(self.save_as_tab, "")
        #notifications_tab
        self.notifications_tab = QWidget()
        self.layoutWidget2 = QWidget(self.notifications_tab)
        self.verticalLayout_4 = QVBoxLayout(self.layoutWidget2)
        self.verticalLayout_4.setContentsMargins(21, 21, 0, 0)
        #enable_notifications_checkBox
        self.enable_notifications_checkBox = QCheckBox(self.layoutWidget2)
        self.verticalLayout_4.addWidget(self.enable_notifications_checkBox)
        #sound_frame
        self.sound_frame = QFrame(self.layoutWidget2)
        self.sound_frame.setFrameShape(QFrame.StyledPanel)
        self.sound_frame.setFrameShadow(QFrame.Raised)

        self.verticalLayout = QVBoxLayout(self.sound_frame)
        #volume_label
        self.volume_label = QLabel(self.sound_frame)
        self.verticalLayout.addWidget(self.volume_label)
        #volume_dial
        self.volume_dial = QDial(self.sound_frame)
        self.volume_dial.setProperty("value", 100)
        self.verticalLayout.addWidget(self.volume_dial)

        self.verticalLayout_4.addWidget(self.sound_frame)
        self.setting_tabWidget.addTab(self.notifications_tab, "")
        #style_tab
        self.style_tab = QWidget()
        self.layoutWidget3 = QWidget(self.style_tab)
        self.verticalLayout_3 = QVBoxLayout(self.layoutWidget3)
        self.verticalLayout_3.setContentsMargins(21, 21, 0, 0)
        self.horizontalLayout_8 = QHBoxLayout()
        #style_label
        self.style_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_8.addWidget(self.style_label)
        #style_comboBox
        self.style_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_8.addWidget(self.style_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_8)
        self.horizontalLayout_7 = QHBoxLayout()
        #color_label
        self.color_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.color_label)
        #color_comboBox
        self.color_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.color_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_7)
        #icon_label
        self.horizontalLayout_12 = QHBoxLayout()
        self.icon_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_12.addWidget(self.icon_label)
        #icon_comboBox
        self.icon_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_12.addWidget(self.icon_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_12)
        self.horizontalLayout_6 = QHBoxLayout()
        #notification_label
        self.horizontalLayout_13 = QHBoxLayout()
        self.notification_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_13.addWidget(self.notification_label)
        #notification_comboBox
        self.notification_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_13.addWidget(self.notification_comboBox)
        self.verticalLayout_3.addLayout(self.horizontalLayout_13)
        #font_label
        self.font_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.font_label)
        #fontComboBox
        self.fontComboBox = QFontComboBox(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.fontComboBox)
        #font_size_label
        self.font_size_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.font_size_label)
        #font_size_spinBox
        self.font_size_spinBox = QSpinBox(self.layoutWidget3)
        self.font_size_spinBox.setMinimum(1)
        self.horizontalLayout_6.addWidget(self.font_size_spinBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_6)
        self.setting_tabWidget.addTab(self.style_tab, "")
        self.verticalLayout_2.addWidget(self.setting_tabWidget)
        self.horizontalLayout = QHBoxLayout()
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        #Enable system tray icon
        self.enable_system_tray_checkBox = QCheckBox(self.layoutWidget3)
        self.verticalLayout_3.addWidget(self.enable_system_tray_checkBox)
        #after_download dialog
        self.after_download_checkBox = QCheckBox()
        self.verticalLayout_3.addWidget(self.after_download_checkBox)

        #show_menubar_checkbox
        self.show_menubar_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_menubar_checkbox)

        #show_sidepanel_checkbox
        self.show_sidepanel_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_sidepanel_checkbox)

        #hide progress window
        self.show_progress_window_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_progress_window_checkbox)

        #add persepolis to startup
        self.startup_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.startup_checkbox)

        #defaults_pushButton
        self.defaults_pushButton = QPushButton(self)
        self.horizontalLayout.addWidget(self.defaults_pushButton)
        #cancel_pushButton
        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))
        self.horizontalLayout.addWidget(self.cancel_pushButton)
        #ok_pushButton
        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
        self.horizontalLayout.addWidget(self.ok_pushButton)

        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.setting_tabWidget.setCurrentIndex(3)

        self.setWindowTitle("Preferences")
        self.tries_label.setToolTip(
            "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
        )
        self.tries_label.setText("Number of tries : ")
        self.tries_spinBox.setToolTip(
            "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
        )
        self.wait_label.setToolTip(
            "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
        )
        self.wait_label.setText("Wait between retries (seconds) : ")
        self.wait_spinBox.setToolTip(
            "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
        )
        self.time_out_label.setToolTip(
            "<html><head/><body><p>Set timeout in seconds. </p></body></html>")
        self.time_out_label.setText("Time out (seconds) : ")
        self.time_out_spinBox.setToolTip(
            "<html><head/><body><p>Set timeout in seconds. </p></body></html>")
        self.connections_label.setToolTip(
            "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
        )
        self.connections_label.setText("Number of connections : ")
        self.connections_spinBox.setToolTip(
            "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
        )
        self.rpc_port_label.setText("RPC port number : ")
        self.rpc_port_spinbox.setToolTip(
            "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>"
        )
        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.download_options_tab),
            "Download Options")

        self.download_folder_label.setText("Download Folder : ")
        self.download_folder_pushButton.setText("Change")
        self.temp_download_label.setText("Temporary Download Folder : ")
        self.temp_download_pushButton.setText("Change")
        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.save_as_tab), "Save as")
        self.enable_notifications_checkBox.setText(
            "Enable notification sounds")
        self.volume_label.setText("Volume : ")
        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.notifications_tab),
            "Notifications")
        self.style_label.setText("Style : ")
        self.color_label.setText("Color scheme : ")
        self.icon_label.setText("Icons : ")
        self.notification_label.setText("Notification type : ")
        self.font_label.setText("Font : ")
        self.font_size_label.setText("Size : ")
        self.enable_system_tray_checkBox.setText("Enable system tray icon.")
        self.after_download_checkBox.setText(
            "Show download complete dialog,when download has finished.")
        self.show_menubar_checkbox.setText("Show menubar.")
        self.show_sidepanel_checkbox.setText("Show side panel.")
        self.show_progress_window_checkbox.setText(
            "Show download's progress window")
        self.startup_checkbox.setText("Run Persepolis at startup")

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.style_tab), "Preferences")
        self.defaults_pushButton.setText("Defaults")
        self.cancel_pushButton.setText("Cancel")
        self.ok_pushButton.setText("OK")
예제 #10
0
    def __init__(self, parent=None):  # pylint: disable=too-many-statements
        super(BookmarksWidget, self).__init__(parent=parent)

        self._app_window = parent

        if self._app_window.dwarf is None:
            print('BookmarksPanel created before Dwarf exists')
            return

        self.bookmarks = {}

        self._bookmarks_list = DwarfListView()
        self._bookmarks_list.doubleClicked.connect(self._on_double_clicked)
        self._bookmarks_list.setContextMenuPolicy(Qt.CustomContextMenu)
        self._bookmarks_list.customContextMenuRequested.connect(
            self._on_contextmenu)

        self._bookmarks_model = QStandardItemModel(0, 2)
        self._bookmarks_model.setHeaderData(0, Qt.Horizontal, 'Address')
        self._bookmarks_model.setHeaderData(1, Qt.Horizontal, 'Notes')

        self._bookmarks_list.setModel(self._bookmarks_model)

        self._bookmarks_list.header().setStretchLastSection(False)
        self._bookmarks_list.header().setSectionResizeMode(
            0, QHeaderView.ResizeToContents | QHeaderView.Interactive)
        self._bookmarks_list.header().setSectionResizeMode(
            1, QHeaderView.Stretch | QHeaderView.Interactive)

        v_box = QVBoxLayout(self)
        v_box.setContentsMargins(0, 0, 0, 0)
        v_box.addWidget(self._bookmarks_list)
        #header = QHeaderView(Qt.Horizontal, self)

        h_box = QHBoxLayout()
        h_box.setContentsMargins(5, 2, 5, 5)
        self.btn1 = QPushButton(
            QIcon(utils.resource_path('assets/icons/plus.svg')), '')
        self.btn1.setFixedSize(20, 20)
        self.btn1.clicked.connect(lambda: self._create_bookmark(-1))
        btn2 = QPushButton(QIcon(utils.resource_path('assets/icons/dash.svg')),
                           '')
        btn2.setFixedSize(20, 20)
        btn2.clicked.connect(self.delete_items)
        btn3 = QPushButton(
            QIcon(utils.resource_path('assets/icons/trashcan.svg')), '')
        btn3.setFixedSize(20, 20)
        btn3.clicked.connect(self.clear_list)
        h_box.addWidget(self.btn1)
        h_box.addWidget(btn2)
        h_box.addSpacerItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Preferred))
        h_box.addWidget(btn3)
        # header.setLayout(h_box)
        # header.setFixedHeight(25)
        # v_box.addWidget(header)
        v_box.addLayout(h_box)
        self.setLayout(v_box)

        self._bold_font = QFont(self._bookmarks_list.font())
        self._bold_font.setBold(True)

        shortcut_addnative = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_B),
                                       self._app_window, self._create_bookmark)
        shortcut_addnative.setAutoRepeat(False)
예제 #11
0
    def __init__(self, filename=None, parent=None, name=None):
        """
        Constructor
        
        @param filename name of a UI file to load
        @param parent parent widget of this window (QWidget)
        @param name name of this window (string)
        """
        self.mainWidget = None
        self.currentFile = QDir.currentPath()

        super(UIPreviewer, self).__init__(parent)
        if not name:
            self.setObjectName("UIPreviewer")
        else:
            self.setObjectName(name)

        self.setStyle(Preferences.getUI("Style"),
                      Preferences.getUI("StyleSheet"))

        self.resize(QSize(600, 480).expandedTo(self.minimumSizeHint()))
        self.statusBar()

        self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
        self.setWindowTitle(self.tr("UI Previewer"))

        self.cw = QWidget(self)
        self.cw.setObjectName("centralWidget")

        self.UIPreviewerLayout = QVBoxLayout(self.cw)
        self.UIPreviewerLayout.setContentsMargins(6, 6, 6, 6)
        self.UIPreviewerLayout.setSpacing(6)
        self.UIPreviewerLayout.setObjectName("UIPreviewerLayout")

        self.styleLayout = QHBoxLayout()
        self.styleLayout.setContentsMargins(0, 0, 0, 0)
        self.styleLayout.setSpacing(6)
        self.styleLayout.setObjectName("styleLayout")

        self.styleLabel = QLabel(self.tr("Select GUI Theme"), self.cw)
        self.styleLabel.setObjectName("styleLabel")
        self.styleLayout.addWidget(self.styleLabel)

        self.styleCombo = QComboBox(self.cw)
        self.styleCombo.setObjectName("styleCombo")
        self.styleCombo.setEditable(False)
        self.styleCombo.setToolTip(self.tr("Select the GUI Theme"))
        self.styleLayout.addWidget(self.styleCombo)
        self.styleCombo.addItems(sorted(QStyleFactory().keys()))
        currentStyle = Preferences.Prefs.settings.value('UIPreviewer/style')
        if currentStyle is not None:
            self.styleCombo.setCurrentIndex(int(currentStyle))

        styleSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.styleLayout.addItem(styleSpacer)
        self.UIPreviewerLayout.addLayout(self.styleLayout)

        self.previewSV = QScrollArea(self.cw)
        self.previewSV.setObjectName("preview")
        self.previewSV.setFrameShape(QFrame.NoFrame)
        self.previewSV.setFrameShadow(QFrame.Plain)
        self.previewSV.setSizePolicy(QSizePolicy.Expanding,
                                     QSizePolicy.Expanding)
        self.UIPreviewerLayout.addWidget(self.previewSV)

        self.setCentralWidget(self.cw)

        self.styleCombo.activated[str].connect(self.__guiStyleSelected)

        self.__initActions()
        self.__initMenus()
        self.__initToolbars()

        self.__updateActions()

        # defere loading of a UI file until we are shown
        self.fileToLoad = filename
예제 #12
0
    def createLeiturasGroupBox(self):

        self.leiturasGroupBox = QGroupBox("Leituras")

        self.leiturasLabel = {}
        self.leiturasPadrao = {}
        self.leiturasObjeto = {}
  
        for i in ['Ac1','Dcp','Ac2','Dcm','Ac3']:
            self.leiturasLabel[i] = QLabel(self)
            self.leiturasPadrao[i] = QLineEdit(self)
            self.leiturasPadrao[i].setReadOnly(True)
            self.leiturasObjeto[i] = QLineEdit(self)
            self.leiturasObjeto[i].setReadOnly(True)

        self.leiturasLabel['Ac1'].setText(" AC")
        self.leiturasLabel['Dcp'].setText("+DC")
        self.leiturasLabel['Ac2'].setText(" AC")
        self.leiturasLabel['Dcm'].setText("-DC")
        self.leiturasLabel['Ac3'].setText(" AC")

        # padrao
        self.leiturasPadraoLabel = QLabel(self)
        self.leiturasPadraoLabel.setText("Padrão [mV]")

        # objeto
        self.leiturasObjetoLabel = QLabel(self)
        self.leiturasObjetoLabel.setText("Objeto [mV]")

        # tempo de espera
        self.esperaCounterLabel = QLabel(self)
        self.esperaCounterLabel.setText("Espera")
        self.esperaCounter = QLineEdit(self)
        self.esperaCounter.setReadOnly(True)
        self.esperaTotal = QLineEdit(self)
        self.esperaTotal.setReadOnly(True)

        # repeticoes
        self.repeticoesCounterLabel = QLabel(self)
        self.repeticoesCounterLabel.setText("Repetições")
        self.repeticoesCounter = QLineEdit(self)
        self.repeticoesCounter.setReadOnly(True)
        self.repeticoesTotal = QLineEdit(self)
        self.repeticoesTotal.setReadOnly(True)

        # coeficiente n
        self.coeficienteNLabel = QLabel(self)
        self.coeficienteNLabel.setText("Coeficiente n")
        self.nPadraoLabel = QLabel(self)
        self.nPadraoLabel.setText("Padrão")
        self.nObjetoLabel = QLabel(self)
        self.nObjetoLabel.setText("Objeto")
        self.nPadrao = QLineEdit(self)
        self.nPadrao.setReadOnly(True)
        self.nObjeto = QLineEdit(self)
        self.nObjeto.setReadOnly(True)

        verticalSpacer = QSpacerItem(20, 40)

        # layout

        leiturasGroupBoxLayout = QGridLayout()

        leiturasGroupBoxLayout.addWidget(self.leiturasPadraoLabel, 0, 1)
        leiturasGroupBoxLayout.addWidget(self.leiturasObjetoLabel, 0, 2)

        j = 1
        for i in ['Ac1','Dcp','Ac2','Dcm','Ac3']:
            leiturasGroupBoxLayout.addWidget(self.leiturasLabel[i], j, 0)
            leiturasGroupBoxLayout.addWidget(self.leiturasPadrao[i], j, 1)
            leiturasGroupBoxLayout.addWidget(self.leiturasObjeto[i], j, 2)
            j += 1
        
        leiturasGroupBoxLayout.addItem(verticalSpacer)

        leiturasGroupBoxLayout.addWidget(self.esperaCounterLabel, 7, 0)
        leiturasGroupBoxLayout.addWidget(self.esperaCounter, 7, 1)
        leiturasGroupBoxLayout.addWidget(self.esperaTotal, 7, 2)

        leiturasGroupBoxLayout.addWidget(self.repeticoesCounterLabel, 8, 0)
        leiturasGroupBoxLayout.addWidget(self.repeticoesCounter, 8, 1)
        leiturasGroupBoxLayout.addWidget(self.repeticoesTotal, 8, 2)

        leiturasGroupBoxLayout.addItem(verticalSpacer)

        leiturasGroupBoxLayout.addWidget(self.nPadraoLabel, 10, 1)
        leiturasGroupBoxLayout.addWidget(self.nObjetoLabel, 10, 2)

        leiturasGroupBoxLayout.addWidget(self.coeficienteNLabel, 11, 0)
        leiturasGroupBoxLayout.addWidget(self.nPadrao, 11, 1)
        leiturasGroupBoxLayout.addWidget(self.nObjeto, 11, 2)        

        self.leiturasGroupBox.setLayout(leiturasGroupBoxLayout)
예제 #13
0
    def __init__(self, main):
        """
        Search movie by title.

        :param main: Reference for main windows.
        """
        super(SearchMovieTitle, self).__init__()

        self.session = DB.get_session()
        self.main = main
        self.row_select = -1

        windows_title = texts.search + ' ' + texts.movie_s + ' ' + \
                        texts.for_ + ' ' + texts.title_p

        self.setWindowTitle(windows_title)
        self.width = int(0.9 * main.frameSize().width())
        self.height = int(0.8 * main.frameSize().height())
        self.setGeometry(0, 0, self.width, self.height)

        self.subwindow = QWidget()
        p = self.palette()
        p.setColor(self.backgroundRole(), QColor(230, 230, 250))
        self.setPalette(p)
        self.setWidget(self.subwindow)

        self.vbox_main = QVBoxLayout(self.subwindow)
        self.vbox_main.setContentsMargins(20, 20, 20, 20)

        # Title
        self.lb_title = QLabel(texts.title_s)
        self.lb_title.setMaximumSize(QSize(100, 25))
        movie = db_select_all(self.session, Movie)
        self.cb_title = cb_create()
        populate_combobox(self.cb_title, movie)

        # Words
        text = texts.or_s + ' ' + texts.with_the_p + ' ' + texts.term_p
        self.lb_term = QLabel(text)
        self.le_term = le_create(30, texts.with_term_tt)
        self.le_term.setPlaceholderText('pressione enter')
        self.le_term.editingFinished.connect(self.query_term)

        # HBoxSearch
        self.hbox_search = hbox_create([self.lb_title, self.cb_title,
                                        self.lb_term, self.le_term])
        spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.hbox_search.addItem(spacer)

        self.vbox_main.addLayout(self.hbox_search)

        # total
        self.lb_total = QLabel(texts.lb_total)
        self.le_total = le_create(255)
        self.le_total.setMaximumWidth(100)

        # Buttons
        self.pb_clear = pb_create(texts.pb_clear, 11, 30)
        self.pb_clear.setMaximumWidth(100)
        self.pb_clear.setShortcut('Ctrl+L')
        self.pb_clear.clicked.connect(self.clear)
        self.pb_leave = pb_create(texts.pb_leave, 11, 30)
        self.pb_leave.setMaximumWidth(100)
        self.pb_leave.setShortcut('Ctrl+Q')
        self.pb_leave.clicked.connect(self.close)

        # Hbox_result
        self.hbox_result = hbox_create([self.lb_total, self.le_total,
                                        self.pb_clear, self.pb_leave])
        spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.hbox_result.addItem(spacer)

        self.vbox_main.addLayout(self.hbox_result)

        # Table
        self.table = QTableWidget()
        self.table.setObjectName('table-search')
        self.rows = 0
        self.clear_table()
        query = self.session.query(Movie).all()
        self.set_table(query)

        self.vbox_main.addWidget(self.table)

        self.cb_title.currentIndexChanged.connect(self.query_title)
예제 #14
0
    def __init__(self, persepolis_setting):
        super().__init__()
        icon = QtGui.QIcon()

        # add support for other languages
        locale = str(persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle(
            QCoreApplication.translate("setting_ui_tr", 'Preferences'))

        # set ui direction
        ui_direction = persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        global icons
        icons = ':/' + str(persepolis_setting.value('settings/icons')) + '/'

        self.verticalLayout_2 = QVBoxLayout(self)
        self.setting_tabWidget = QTabWidget(self)
        # download_options_tab
        self.download_options_tab = QWidget()
        self.layoutWidget = QWidget(self.download_options_tab)
        self.download_options_verticalLayout = QVBoxLayout(self.layoutWidget)
        self.download_options_verticalLayout.setContentsMargins(21, 21, 0, 0)
        self.download_options_verticalLayout.setObjectName(
            "download_options_verticalLayout")
        self.horizontalLayout_5 = QHBoxLayout()
        # tries_label
        self.tries_label = QLabel(self.layoutWidget)
        self.horizontalLayout_5.addWidget(self.tries_label)
        # tries_spinBox
        self.tries_spinBox = QSpinBox(self.layoutWidget)
        self.tries_spinBox.setMinimum(1)

        self.horizontalLayout_5.addWidget(self.tries_spinBox)
        self.download_options_verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_4 = QHBoxLayout()
        # wait_label
        self.wait_label = QLabel(self.layoutWidget)
        self.horizontalLayout_4.addWidget(self.wait_label)
        # wait_spinBox
        self.wait_spinBox = QSpinBox(self.layoutWidget)
        self.horizontalLayout_4.addWidget(self.wait_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_3 = QHBoxLayout()
        # time_out_label
        self.time_out_label = QLabel(self.layoutWidget)
        self.horizontalLayout_3.addWidget(self.time_out_label)
        # time_out_spinBox
        self.time_out_spinBox = QSpinBox(self.layoutWidget)
        self.horizontalLayout_3.addWidget(self.time_out_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2 = QHBoxLayout()
        # connections_label
        self.connections_label = QLabel(self.layoutWidget)
        self.horizontalLayout_2.addWidget(self.connections_label)
        # connections_spinBox
        self.connections_spinBox = QSpinBox(self.layoutWidget)
        self.connections_spinBox.setMinimum(1)
        self.connections_spinBox.setMaximum(16)
        self.horizontalLayout_2.addWidget(self.connections_spinBox)

        self.download_options_verticalLayout.addLayout(self.horizontalLayout_2)
        # rpc_port_label
        self.rpc_port_label = QLabel(self.layoutWidget)
        self.rpc_horizontalLayout = QHBoxLayout()
        self.rpc_horizontalLayout.addWidget(self.rpc_port_label)
        # rpc_port_spinbox
        self.rpc_port_spinbox = QSpinBox(self.layoutWidget)
        self.rpc_port_spinbox.setMinimum(1024)
        self.rpc_port_spinbox.setMaximum(65535)
        self.rpc_horizontalLayout.addWidget(self.rpc_port_spinbox)

        self.download_options_verticalLayout.addLayout(
            self.rpc_horizontalLayout)

        # wait_queue
        wait_queue_horizontalLayout = QHBoxLayout()

        self.wait_queue_label = QLabel(self.layoutWidget)
        wait_queue_horizontalLayout.addWidget(self.wait_queue_label)

        self.wait_queue_time = QDateTimeEdit(self.layoutWidget)
        self.wait_queue_time.setDisplayFormat('H:mm')
        wait_queue_horizontalLayout.addWidget(self.wait_queue_time)

        self.download_options_verticalLayout.addLayout(
            wait_queue_horizontalLayout)

        # change aria2 path
        aria2_path_verticalLayout = QVBoxLayout()

        self.aria2_path_checkBox = QCheckBox(self.layoutWidget)
        aria2_path_verticalLayout.addWidget(self.aria2_path_checkBox)

        aria2_path_horizontalLayout = QHBoxLayout()

        self.aria2_path_lineEdit = QLineEdit(self.layoutWidget)
        aria2_path_horizontalLayout.addWidget(self.aria2_path_lineEdit)

        self.aria2_path_pushButton = QPushButton(self.layoutWidget)
        aria2_path_horizontalLayout.addWidget(self.aria2_path_pushButton)

        aria2_path_verticalLayout.addLayout(aria2_path_horizontalLayout)

        self.download_options_verticalLayout.addLayout(
            aria2_path_verticalLayout)

        self.setting_tabWidget.addTab(self.download_options_tab, "")
        # save_as_tab
        self.save_as_tab = QWidget()

        self.layoutWidget1 = QWidget(self.save_as_tab)

        self.save_as_verticalLayout = QVBoxLayout(self.layoutWidget1)
        self.save_as_verticalLayout.setContentsMargins(20, 30, 0, 0)

        self.download_folder_horizontalLayout = QHBoxLayout()
        # download_folder_label
        self.download_folder_label = QLabel(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_label)
        # download_folder_lineEdit
        self.download_folder_lineEdit = QLineEdit(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_lineEdit)
        # download_folder_pushButton
        self.download_folder_pushButton = QPushButton(self.layoutWidget1)
        self.download_folder_horizontalLayout.addWidget(
            self.download_folder_pushButton)

        self.save_as_verticalLayout.addLayout(
            self.download_folder_horizontalLayout)
        self.temp_horizontalLayout = QHBoxLayout()
        # temp_download_label
        self.temp_download_label = QLabel(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_label)
        # temp_download_lineEdit
        self.temp_download_lineEdit = QLineEdit(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_lineEdit)
        # temp_download_pushButton
        self.temp_download_pushButton = QPushButton(self.layoutWidget1)
        self.temp_horizontalLayout.addWidget(self.temp_download_pushButton)

        self.save_as_verticalLayout.addLayout(self.temp_horizontalLayout)

        # create subfolder checkBox
        self.subfolder_checkBox = QCheckBox(self.layoutWidget1)
        self.save_as_verticalLayout.addWidget(self.subfolder_checkBox)

        self.setting_tabWidget.addTab(self.save_as_tab, "")
        # notifications_tab
        self.notifications_tab = QWidget()
        self.layoutWidget2 = QWidget(self.notifications_tab)
        self.verticalLayout_4 = QVBoxLayout(self.layoutWidget2)
        self.verticalLayout_4.setContentsMargins(21, 21, 0, 0)
        # enable_notifications_checkBox
        self.enable_notifications_checkBox = QCheckBox(self.layoutWidget2)
        self.verticalLayout_4.addWidget(self.enable_notifications_checkBox)
        # sound_frame
        self.sound_frame = QFrame(self.layoutWidget2)
        self.sound_frame.setFrameShape(QFrame.StyledPanel)
        self.sound_frame.setFrameShadow(QFrame.Raised)

        self.verticalLayout = QVBoxLayout(self.sound_frame)
        # volume_label
        self.volume_label = QLabel(self.sound_frame)
        self.verticalLayout.addWidget(self.volume_label)
        # volume_dial
        self.volume_dial = QDial(self.sound_frame)
        self.volume_dial.setProperty("value", 100)
        self.verticalLayout.addWidget(self.volume_dial)

        self.verticalLayout_4.addWidget(self.sound_frame)
        self.setting_tabWidget.addTab(self.notifications_tab, "")
        # style_tab
        self.style_tab = QWidget()
        self.layoutWidget3 = QWidget(self.style_tab)
        self.verticalLayout_3 = QVBoxLayout(self.layoutWidget3)
        self.verticalLayout_3.setContentsMargins(21, 21, 0, 0)
        self.horizontalLayout_8 = QHBoxLayout()
        # style_label
        self.style_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_8.addWidget(self.style_label)
        # style_comboBox
        self.style_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_8.addWidget(self.style_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_8)
        self.horizontalLayout_7 = QHBoxLayout()
        # language_combox
        self.lang_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.lang_label)
        self.lang_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.lang_comboBox)

        # language_label
        self.verticalLayout_3.addLayout(self.horizontalLayout_7)
        self.horizontalLayout_7 = QHBoxLayout()
        self.lang_label.setText(
            QCoreApplication.translate("setting_ui_tr", "language :"))
        # color_label
        self.color_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.color_label)
        # color_comboBox
        self.color_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_7.addWidget(self.color_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_7)
        # icon_label
        self.horizontalLayout_12 = QHBoxLayout()
        self.icon_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_12.addWidget(self.icon_label)

        # icon_comboBox
        self.icon_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_12.addWidget(self.icon_comboBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_12)

        # icons_size_comboBox
        self.icons_size_horizontalLayout = QHBoxLayout()
        self.icons_size_label = QLabel(self.layoutWidget3)
        self.icons_size_horizontalLayout.addWidget(self.icons_size_label)

        self.icons_size_comboBox = QComboBox(self.layoutWidget3)
        self.icons_size_horizontalLayout.addWidget(self.icons_size_comboBox)

        self.verticalLayout_3.addLayout(self.icons_size_horizontalLayout)

        self.horizontalLayout_6 = QHBoxLayout()
        # notification_label
        self.horizontalLayout_13 = QHBoxLayout()
        self.notification_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_13.addWidget(self.notification_label)
        # notification_comboBox
        self.notification_comboBox = QComboBox(self.layoutWidget3)
        self.horizontalLayout_13.addWidget(self.notification_comboBox)
        self.verticalLayout_3.addLayout(self.horizontalLayout_13)
        # font_checkBox
        self.font_checkBox = QCheckBox(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.font_checkBox)
        # fontComboBox
        self.fontComboBox = QFontComboBox(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.fontComboBox)
        # font_size_label
        self.font_size_label = QLabel(self.layoutWidget3)
        self.horizontalLayout_6.addWidget(self.font_size_label)
        # font_size_spinBox
        self.font_size_spinBox = QSpinBox(self.layoutWidget3)
        self.font_size_spinBox.setMinimum(1)
        self.horizontalLayout_6.addWidget(self.font_size_spinBox)

        self.verticalLayout_3.addLayout(self.horizontalLayout_6)
        self.setting_tabWidget.addTab(self.style_tab, "")
        self.verticalLayout_2.addWidget(self.setting_tabWidget)
        self.horizontalLayout = QHBoxLayout()
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        # Enable system tray icon
        self.enable_system_tray_checkBox = QCheckBox(self.layoutWidget3)
        self.verticalLayout_3.addWidget(self.enable_system_tray_checkBox)
        # after_download dialog
        self.after_download_checkBox = QCheckBox()
        self.verticalLayout_3.addWidget(self.after_download_checkBox)

        # show_menubar_checkbox
        self.show_menubar_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_menubar_checkbox)

        # show_sidepanel_checkbox
        self.show_sidepanel_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_sidepanel_checkbox)

        # hide progress window
        self.show_progress_window_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.show_progress_window_checkbox)

        # add persepolis to startup
        self.startup_checkbox = QCheckBox()
        self.verticalLayout_3.addWidget(self.startup_checkbox)

        # keep system awake
        self.keep_awake_checkBox = QCheckBox()
        self.verticalLayout_3.addWidget(self.keep_awake_checkBox)

        # columns_tab
        self.columns_tab = QWidget()
        layoutWidget4 = QWidget(self.columns_tab)

        column_verticalLayout = QVBoxLayout(layoutWidget4)
        column_verticalLayout.setContentsMargins(21, 21, 0, 0)

        # creating checkBox for columns
        self.show_column_label = QLabel()
        self.column0_checkBox = QCheckBox()
        self.column1_checkBox = QCheckBox()
        self.column2_checkBox = QCheckBox()
        self.column3_checkBox = QCheckBox()
        self.column4_checkBox = QCheckBox()
        self.column5_checkBox = QCheckBox()
        self.column6_checkBox = QCheckBox()
        self.column7_checkBox = QCheckBox()
        self.column10_checkBox = QCheckBox()
        self.column11_checkBox = QCheckBox()
        self.column12_checkBox = QCheckBox()

        column_verticalLayout.addWidget(self.show_column_label)
        column_verticalLayout.addWidget(self.column0_checkBox)
        column_verticalLayout.addWidget(self.column1_checkBox)
        column_verticalLayout.addWidget(self.column2_checkBox)
        column_verticalLayout.addWidget(self.column3_checkBox)
        column_verticalLayout.addWidget(self.column4_checkBox)
        column_verticalLayout.addWidget(self.column5_checkBox)
        column_verticalLayout.addWidget(self.column6_checkBox)
        column_verticalLayout.addWidget(self.column7_checkBox)
        column_verticalLayout.addWidget(self.column10_checkBox)
        column_verticalLayout.addWidget(self.column11_checkBox)
        column_verticalLayout.addWidget(self.column12_checkBox)

        self.setting_tabWidget.addTab(self.columns_tab, '')

        # youtube_tab
        self.youtube_tab = QWidget()
        self.layoutWidgetYTD = QWidget(self.youtube_tab)
        self.youtube_layout = QVBoxLayout(self.layoutWidgetYTD)
        self.youtube_layout.setContentsMargins(20, 30, 0, 0)

        self.youtube_verticalLayout = QVBoxLayout()

        # Whether to enable video link capturing.
        self.enable_ytd_checkbox = QCheckBox(self.layoutWidgetYTD)
        self.youtube_layout.addWidget(self.enable_ytd_checkbox)

        # If we should hide videos with no audio
        self.hide_no_audio_checkbox = QCheckBox(self.layoutWidgetYTD)
        self.youtube_verticalLayout.addWidget(self.hide_no_audio_checkbox)

        # If we should hide audios without video
        self.hide_no_video_checkbox = QCheckBox(self.layoutWidgetYTD)
        self.youtube_verticalLayout.addWidget(self.hide_no_video_checkbox)

        self.max_links_horizontalLayout = QHBoxLayout()

        # max_links_label
        self.max_links_label = QLabel(self.layoutWidgetYTD)

        self.max_links_horizontalLayout.addWidget(self.max_links_label)
        # max_links_spinBox
        self.max_links_spinBox = QSpinBox(self.layoutWidgetYTD)
        self.max_links_spinBox.setMinimum(1)
        self.max_links_spinBox.setMaximum(16)
        self.max_links_horizontalLayout.addWidget(self.max_links_spinBox)
        self.youtube_verticalLayout.addLayout(self.max_links_horizontalLayout)

        self.youtube_dl_path_horizontalLayout = QHBoxLayout()

        self.youtube_frame = QFrame(self.youtube_tab)
        self.youtube_frame.setLayout(self.youtube_verticalLayout)

        self.youtube_layout.addWidget(self.youtube_frame)

        self.setting_tabWidget.addTab(self.youtube_tab, "")

        # defaults_pushButton
        self.defaults_pushButton = QPushButton(self)
        self.horizontalLayout.addWidget(self.defaults_pushButton)
        # cancel_pushButton
        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))
        self.horizontalLayout.addWidget(self.cancel_pushButton)
        # ok_pushButton
        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
        self.horizontalLayout.addWidget(self.ok_pushButton)

        self.verticalLayout_2.addLayout(self.horizontalLayout)
        self.setting_tabWidget.setCurrentIndex(3)

        self.setWindowTitle(
            QCoreApplication.translate("setting_ui_tr", "Preferences"))

        self.tries_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
            ))
        self.tries_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Number of tries : "))
        self.tries_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set number of tries if download failed.</p></body></html>"
            ))

        self.wait_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
            ))
        self.wait_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Wait between retries (seconds) : "))
        self.wait_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set the seconds to wait between retries. Download manager will  retry  downloads  when  the  HTTP  server  returns  a  503 response.</p></body></html>"
            ))

        self.time_out_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set timeout in seconds. </p></body></html>"
            ))
        self.time_out_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Time out (seconds) : "))
        self.time_out_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Set timeout in seconds. </p></body></html>"
            ))

        self.connections_label.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
            ))
        self.connections_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Number of connections : "))
        self.connections_spinBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html>"
            ))

        self.rpc_port_label.setText(
            QCoreApplication.translate("setting_ui_tr", "RPC port number : "))
        self.rpc_port_spinbox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html>"
            ))

        self.wait_queue_label.setText(
            QCoreApplication.translate(
                "setting_ui_tr", 'Wait between every downloads in queue:'))

        self.aria2_path_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       'Change aria2 default path'))
        self.aria2_path_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", 'Change'))
        aria2_path_tooltip = QCoreApplication.translate(
            "setting_ui_tr",
            "<html><head/><body><p>Attention: Wrong path may have caused problem! Do it carefully or don't change default setting!</p></body></html>"
        )
        self.aria2_path_checkBox.setToolTip(aria2_path_tooltip)
        self.aria2_path_lineEdit.setToolTip(aria2_path_tooltip)
        self.aria2_path_pushButton.setToolTip(aria2_path_tooltip)

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.download_options_tab),
            QCoreApplication.translate("setting_ui_tr", "Download Options"))

        self.download_folder_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Download Folder : "))
        self.download_folder_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Change"))

        self.temp_download_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Temporary Download Folder : "))
        self.temp_download_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Change"))

        self.subfolder_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr",
                "Create subfolders for Music,Videos,... in default download folder"
            ))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.save_as_tab),
            QCoreApplication.translate("setting_ui_tr", "Save as"))

        self.enable_notifications_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Enable notification sounds"))

        self.volume_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Volume : "))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.notifications_tab),
            QCoreApplication.translate("setting_ui_tr", "Notifications"))

        self.style_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Style : "))
        self.color_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Color scheme : "))
        self.icon_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Icons : "))

        self.icons_size_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "ToolBar's icons size : "))

        self.notification_label.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Notification type : "))

        self.font_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", "Font : "))
        self.font_size_label.setText(
            QCoreApplication.translate("setting_ui_tr", "Size : "))

        self.enable_system_tray_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Enable system tray icon."))
        self.after_download_checkBox.setText(
            QCoreApplication.translate(
                "setting_ui_tr",
                "Show download complete dialog,when download has finished."))

        self.show_menubar_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr", "Show menubar."))
        self.show_sidepanel_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr", "Show side panel."))
        self.show_progress_window_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Show download's progress window"))

        self.startup_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       "Run Persepolis at startup"))

        self.keep_awake_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", "Keep system awake!"))
        self.keep_awake_checkBox.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>This option is preventing system from going to sleep.\
            This is necessary if your power manager is suspending system automatically. </p></body></html>"
            ))

        self.wait_queue_time.setToolTip(
            QCoreApplication.translate(
                "setting_ui_tr",
                "<html><head/><body><p>Format HH:MM</p></body></html>"))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.style_tab),
            QCoreApplication.translate("setting_ui_tr", "Preferences"))

        # columns_tab
        self.show_column_label.setText(
            QCoreApplication.translate("setting_ui_tr", 'Show this columns:'))
        self.column0_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'File Name'))
        self.column1_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Status'))
        self.column2_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Size'))
        self.column3_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Downloaded'))
        self.column4_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Percentage'))
        self.column5_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Connections'))
        self.column6_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Transfer rate'))
        self.column7_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Estimated time left'))
        self.column10_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'First try date'))
        self.column11_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Last try date'))
        self.column12_checkBox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Category'))

        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.columns_tab),
            QCoreApplication.translate("setting_ui_tr",
                                       "Columns customization"))

        # Video Finder options tab
        self.setting_tabWidget.setTabText(
            self.setting_tabWidget.indexOf(self.youtube_tab),
            QCoreApplication.translate("setting_ui_tr",
                                       "Video Finder Options"))

        self.enable_ytd_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr", 'Enable Video Finder'))

        self.hide_no_audio_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       'Hide videos with no audio'))

        self.hide_no_video_checkbox.setText(
            QCoreApplication.translate("setting_ui_tr",
                                       'Hide audios with no video'))
        self.max_links_label.setText(
            QCoreApplication.translate(
                "setting_ui_tr", 'Maximum number of links to capture :<br/>'
                '<small>(If browser sends multiple video links at a time)</small>'
            ))

        # window buttons
        self.defaults_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Defaults"))
        self.cancel_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Cancel"))
        self.ok_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "OK"))
예제 #15
0
    def __setupUi(self):
        """
        Private method to perform the general setup of the configuration
        widget.
        """
        self.setObjectName("ConfigurationDialog")
        self.resize(900, 650)
        self.verticalLayout_2 = QVBoxLayout(self)
        self.verticalLayout_2.setSpacing(6)
        self.verticalLayout_2.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.configSplitter = QSplitter(self)
        self.configSplitter.setOrientation(Qt.Horizontal)
        self.configSplitter.setObjectName("configSplitter")

        self.configListWidget = QWidget(self.configSplitter)
        self.leftVBoxLayout = QVBoxLayout(self.configListWidget)
        self.leftVBoxLayout.setContentsMargins(0, 0, 0, 0)
        self.leftVBoxLayout.setSpacing(0)
        self.leftVBoxLayout.setObjectName("leftVBoxLayout")
        self.configListSearch = E5ClearableLineEdit(
            self, self.tr("Enter search text..."))
        self.configListSearch.setObjectName("configListSearch")
        self.leftVBoxLayout.addWidget(self.configListSearch)
        self.configList = QTreeWidget()
        self.configList.setObjectName("configList")
        self.leftVBoxLayout.addWidget(self.configList)
        self.configListSearch.textChanged.connect(self.__searchTextChanged)

        self.scrollArea = QScrollArea(self.configSplitter)
        self.scrollArea.setFrameShape(QFrame.NoFrame)
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.scrollArea.setWidgetResizable(False)
        self.scrollArea.setObjectName("scrollArea")

        self.configStack = QStackedWidget()
        self.configStack.setFrameShape(QFrame.Box)
        self.configStack.setFrameShadow(QFrame.Sunken)
        self.configStack.setObjectName("configStack")
        self.scrollArea.setWidget(self.configStack)

        self.emptyPage = QWidget()
        self.emptyPage.setGeometry(QRect(0, 0, 372, 591))
        self.emptyPage.setObjectName("emptyPage")
        self.vboxlayout = QVBoxLayout(self.emptyPage)
        self.vboxlayout.setSpacing(6)
        self.vboxlayout.setContentsMargins(6, 6, 6, 6)
        self.vboxlayout.setObjectName("vboxlayout")
        spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.vboxlayout.addItem(spacerItem)
        self.emptyPagePixmap = QLabel(self.emptyPage)
        self.emptyPagePixmap.setAlignment(Qt.AlignCenter)
        self.emptyPagePixmap.setObjectName("emptyPagePixmap")
        self.emptyPagePixmap.setPixmap(
            QPixmap(os.path.join(getConfig('ericPixDir'), 'eric.png')))
        self.vboxlayout.addWidget(self.emptyPagePixmap)
        self.textLabel1 = QLabel(self.emptyPage)
        self.textLabel1.setAlignment(Qt.AlignCenter)
        self.textLabel1.setObjectName("textLabel1")
        self.vboxlayout.addWidget(self.textLabel1)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.vboxlayout.addItem(spacerItem1)
        self.configStack.addWidget(self.emptyPage)

        self.verticalLayout_2.addWidget(self.configSplitter)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Apply
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.Ok
                                          | QDialogButtonBox.Reset)
        self.buttonBox.setObjectName("buttonBox")
        if not self.fromEric and \
                self.displayMode == ConfigurationWidget.DefaultMode:
            self.buttonBox.button(QDialogButtonBox.Apply).hide()
        self.buttonBox.button(QDialogButtonBox.Apply).setEnabled(False)
        self.buttonBox.button(QDialogButtonBox.Reset).setEnabled(False)
        self.verticalLayout_2.addWidget(self.buttonBox)

        self.setWindowTitle(self.tr("Preferences"))

        self.configList.header().hide()
        self.configList.header().setSortIndicator(0, Qt.AscendingOrder)
        self.configList.setSortingEnabled(True)
        self.textLabel1.setText(
            self.tr("Please select an entry of the list \n"
                    "to display the configuration page."))

        QMetaObject.connectSlotsByName(self)
        self.setTabOrder(self.configList, self.configStack)

        self.configStack.setCurrentWidget(self.emptyPage)

        self.configList.setFocus()
예제 #16
0
def verticalSpacer(size=None):
    if size:
        return QSpacerItem(1, size, QSizePolicy.Fixed, QSizePolicy.Fixed)
    else:
        return QSpacerItem(1, 1, QSizePolicy.Fixed,
                           QSizePolicy.MinimumExpanding)
예제 #17
0
    def createDrawerControls(self):
        op = self.topLevelOperatorView

        def configure_update_handlers(qt_signal, op_slot):
            qt_signal.connect(self.configure_operator_from_gui)
            cleanup_fn = op_slot.notifyDirty(self.configure_gui_from_operator,
                                             defer=True)
            self.__cleanup_fns.append(cleanup_fn)

        # Controls
        feature_selection_button = QPushButton(
            text="Select Features",
            icon=QIcon(ilastikIcons.AddSel),
            toolTip=
            "Select edge/superpixel features to use for classification.",
            clicked=self._open_feature_selection_dlg)
        self.train_from_gt_button = QPushButton(
            text="Auto-label",
            icon=QIcon(ilastikIcons.Segment),
            toolTip=
            "Automatically label all edges according to your pre-loaded groundtruth volume.",
            clicked=self._handle_label_from_gt_clicked)
        self.clear_labels_button = QPushButton(
            text="Clear Labels",
            icon=QIcon(ilastikIcons.Clear),
            toolTip="Remove all edge labels. (Start over on this image.)",
            clicked=self._handle_clear_labels_clicked)
        self.live_update_button = QPushButton(
            text="Live Predict",
            checkable=True,
            icon=QIcon(ilastikIcons.Play),
            toolTip="Update the edge classifier predictions",
            clicked=self._handle_live_update_clicked,
            enabled=False)
        configure_update_handlers(self.live_update_button.toggled,
                                  op.FreezeCache)

        self.train_from_gt_button.clicked.connect(
            lambda: op.FreezeClassifier.setValue(False))

        def enable_live_update_on_edges_available(*args, **kwargs):
            have_edges = (op.EdgeLabelsDict.ready()
                          and bool(op.EdgeLabelsDict.value))
            self.live_update_button.setEnabled(have_edges)

        cleanup_fn = op.EdgeLabelsDict.notifyDirty(
            enable_live_update_on_edges_available)
        self.__cleanup_fns.append(cleanup_fn)

        # Layout
        label_layout = QHBoxLayout()
        label_layout.addWidget(self.clear_labels_button)
        label_layout.addWidget(self.train_from_gt_button)
        label_layout.setSpacing(1)

        layout = QVBoxLayout()
        layout.addWidget(feature_selection_button)
        layout.setSpacing(1)
        layout.addLayout(label_layout)
        layout.addWidget(self.live_update_button)
        layout.addSpacerItem(
            QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))

        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Edge Training"
        mgr.register(
            "l",
            ActionInfo(shortcut_group, "Live Predict",
                       "Toggle live edge classifier update mode",
                       self.live_update_button.toggle, self.live_update_button,
                       self.live_update_button))

        return drawer
예제 #18
0
def horizontalSpacer(size=None):
    if size:
        return QSpacerItem(size, 1, QSizePolicy.Fixed, QSizePolicy.Fixed)
    else:
        return QSpacerItem(1, 1, QSizePolicy.MinimumExpanding,
                           QSizePolicy.Fixed)
예제 #19
0
파일: ui_other.py 프로젝트: KaOSx/kaptan
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setSubTitle(self.tr("<h2>Congratulations!</h2>"))

        self.homepage_url = "https://kaosx.us/"
        self.forum_url = "http://kaosx.us/about/contact/"
        self.wiki_url = "http://kaosx.us/docs/"

        vlayout = QVBoxLayout(self)

        label = QLabel(self)
        label.setWordWrap(True)
        label.setText(
            self.
            tr("<p><strong>Your settings have been applied.</strong> Now you can start enjoying KaOS. \
        Don't forget to <strong>join our community!</strong></p>"))
        vlayout.addWidget(label)

        vlayout.addItem(
            QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        groupBox1 = QGroupBox()
        groupBox1.setTitle(self.tr("System Settings"))
        groupBox1.setMinimumHeight(150)

        groupHLayout1 = QHBoxLayout(groupBox1)
        groupLabelImage = QLabel()
        groupLabelImage.setPixmap(
            QIcon.fromTheme("preferences-system").pixmap(64, 64))
        groupLabelImage.setMaximumSize(64, 64)
        groupHLayout1.addWidget(groupLabelImage)
        groupLabel1 = QLabel()
        groupLabel1.setWordWrap(True)
        groupLabel1.setText(
            self.
            tr("<p>Configuration tools for KaOS such as the display, network, keyboard, user manager...</p>"
               ))
        groupButton1 = QPushButton()
        groupButton1.setMaximumWidth(200)
        groupButton1.setText(self.tr("System Settings"))

        groupHLayout1.addWidget(groupLabel1)
        groupHLayout1.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))
        groupHLayout1.addWidget(groupButton1)

        vlayout.addWidget(groupBox1)

        vlayout.addItem(
            QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        groupBox2 = QGroupBox()
        groupBox2.setTitle(self.tr("Help and Support"))
        groupBox2.setMinimumHeight(150)

        groupHLayout2 = QHBoxLayout(groupBox2)
        groupLabelImage2 = QLabel()
        groupLabelImage2.setPixmap(
            QIcon.fromTheme("system-help").pixmap(64, 64))
        groupHLayout2.addWidget(groupLabelImage2)
        groupLabelImage2.setMaximumSize(64, 64)
        groupLabel2 = QLabel()
        groupLabel2.setWordWrap(True)
        groupLabel2.setText(
            self.
            tr("<p>KaOS community, mailing lists, chat rooms, documents, help and support pages...</p>"
               ))
        groupButton2 = QPushButton()
        groupButton2.setMaximumWidth(200)
        groupButton2.setText(self.tr("Help and Support"))

        groupHLayout2.addWidget(groupLabel2)
        groupHLayout2.addItem(
            QSpacerItem(40, 20, QSizePolicy.Preferred, QSizePolicy.Preferred))
        groupHLayout2.addWidget(groupButton2)

        vlayout.addWidget(groupBox2)

        vlayout.addItem(
            QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        groupButton2.clicked.connect(self.helpPagesOpen)
        groupButton1.clicked.connect(self.systemSettingsOpen)
예제 #20
0
    def __init__(self, gateway, gui):
        super(StatusPanel, self).__init__()
        self.gateway = gateway
        self.gui = gui

        self.num_connected = 0
        self.num_known = 0
        self.available_space = 0

        self.checkmark_icon = QLabel()
        self.checkmark_icon.setPixmap(Pixmap("checkmark.png", 20))

        self.syncing_icon = QLabel()

        self.sync_movie = QMovie(resource("sync.gif"))
        self.sync_movie.setCacheMode(True)
        self.sync_movie.updated.connect(
            lambda: self.syncing_icon.setPixmap(
                self.sync_movie.currentPixmap().scaled(
                    20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation
                )
            )
        )

        self.status_label = QLabel()
        p = self.palette()
        dimmer_grey = BlendedColor(
            p.windowText().color(), p.window().color(), 0.6
        ).name()
        self.status_label.setStyleSheet("color: {}".format(dimmer_grey))
        self.status_label.setFont(Font(10))

        self.on_sync_state_updated(0)

        self.setStyleSheet("QToolButton { border: none }")
        # self.setStyleSheet("""
        #    QToolButton { color: dimgrey; border: none; }
        #    QToolButton:hover {
        #        background-color: #FAFAFA;
        #        border: 1px solid grey;
        #        border-radius: 2px;
        #    }
        # """)

        self.tor_button = QToolButton()
        self.tor_button.setIconSize(QSize(20, 20))
        self.tor_action = QAction(
            QIcon(resource("tor-onion.png")),
            "This connection is being routed through the Tor network",
        )
        self.tor_button.setDefaultAction(self.tor_action)
        if not self.gateway.use_tor:
            self.tor_button.hide()

        self.globe_button = QToolButton()
        self.globe_button.setIconSize(QSize(20, 20))
        self.globe_action = QAction(QIcon(resource("globe.png")), "")
        self.globe_button.setDefaultAction(self.globe_action)

        preferences_button = QToolButton(self)
        preferences_button.setIcon(QIcon(resource("preferences.png")))
        preferences_button.setIconSize(QSize(20, 20))
        preferences_button.setMenu(Menu(self.gui, show_open_action=False))
        preferences_button.setPopupMode(2)
        preferences_button.setStyleSheet(
            "QToolButton::menu-indicator { image: none }"
        )

        layout = QGridLayout(self)
        left, _, right, bottom = layout.getContentsMargins()
        layout.setContentsMargins(left, 0, right, bottom - 2)
        layout.addWidget(self.checkmark_icon, 1, 1)
        layout.addWidget(self.syncing_icon, 1, 1)
        layout.addWidget(self.status_label, 1, 2)
        layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, 0), 1, 3)
        layout.addWidget(self.tor_button, 1, 4)
        layout.addWidget(self.globe_button, 1, 5)
        layout.addWidget(preferences_button, 1, 6)

        self.gateway.monitor.total_sync_state_updated.connect(
            self.on_sync_state_updated
        )
        self.gateway.monitor.space_updated.connect(self.on_space_updated)
        self.gateway.monitor.nodes_updated.connect(self.on_nodes_updated)
예제 #21
0
    def update_layout_class_obj(self, force=False):
        # if we are classifying, Select current Container
        if self.behaviour == "classification":
            if self.classification_mode == "Sequential":
                if len(self.sorted_containers) > self.current_idx:
                    self.current_container = self.sorted_containers[
                        self.current_idx]
                    self.main_window.project.set_selected(
                        self, selected=[self.current_container])
                    self.progressBar.setValue(
                        (self.current_idx + 1) / len(self.sorted_containers) *
                        100)
                else:
                    self.current_container = None

            if self.current_container is None:
                return
            if not (isinstance(self.current_container, Segment)
                    or isinstance(self.current_container, Annotation)
                    or isinstance(self.current_container, Screenshot)):
                return

            # print("Current Container", self.current_container)
            self.lbl_CurrentContainer.setText(
                self.current_container.__class__.__name__ + " " +
                self.current_container.get_name())
            # Check  if we need to rebuild the layout or if the checkboxes stay the same,
            # if so apply the classification of the current container
            if not force:
                s1 = set(self.all_checkboxes.keys())
                s2 = []
                for k in self.current_experiment.get_unique_keywords(
                        self.current_container.get_parent_container(),
                        return_all_if_none=True):
                    if not k.voc_obj.is_visible and not self.a_hidden.isChecked(
                    ):
                        continue
                    s2.append(k.unique_id)

                s2 = set(s2)
                if s1 == s2:
                    for checkbox in self.all_checkboxes.values():
                        checkbox.stateChanged.disconnect()
                        checkbox.setChecked(
                            self.current_experiment.has_tag(
                                self.current_container, checkbox.word))
                        checkbox.stateChanged.connect(
                            partial(self.current_experiment.toggle_tag,
                                    self.current_container, checkbox.word))
                    return

        # last_sorting_arrangement = dict()
        # for k, v in self.tab_widgets_class_objs.items():
        #     last_sorting_arrangement[k] = v.index()
        #
        # last_cl_obj_arrangement = dict()
        # for class_name, v in self.tab_widget_tree.items():
        #     last_cl_obj_arrangement[class_name] = dict()
        #     for category_name, w in self.tab_widget_tree[class_name]:
        #         if class_name in self.tab_widgets_class_objs and category_name in self.tab_widget_tree[class_name]:
        #             last_cl_obj_arrangement[class_name][category_name] = \
        #                 self.tab_widgets_class_objs[class_name].indexOf(self.tab_widget_tree[class_name][category_name])

        self.tab_widget.clear()
        self.tab_widget.setMovable(True)
        self.tabs = []
        self.all_checkboxes = dict()
        self.tab_categories = []
        self.checkbox_groups = []
        self.checkbox_names = []

        self.tab_widget_tree = dict()

        tab_widgets_class_objs_index = []
        tab_widgets_class_objs = dict()

        # Create outer tabs for Classification Objects
        ctabs = self.current_experiment.get_classification_objects_plain()
        try:
            ctabs = sorted(ctabs, key=lambda x: CLASS_OBJ_SORTING_ERC[x.name])
        except Exception as e:
            ctabs = sorted(ctabs, key=lambda x: x.name)
        for c in ctabs:  #type:ClassificationObject
            visible_keywords = 0
            for kwd in c.unique_keywords:  #type:UniqueKeyword
                if kwd.voc_obj.is_visible or self.a_hidden.isChecked():
                    visible_keywords += 1
            if visible_keywords == 0:
                continue

            tab = QTabWidget(self.tab_widget)
            tab.setMovable(True)
            try:
                self.tab_widget.insertTab(CLASS_OBJ_SORTING_ERC[c.name], tab,
                                          c.name)
            except Exception as e:
                self.tab_widget.addTab(tab, c.get_name())

            tab_widgets_class_objs[str(c.unique_id)] = tab
            tab_widgets_class_objs_index.append(c.unique_id)
            self.tab_widget_tree[c.name] = dict()

            self.tab_categories.append([])
            self.tabs.append([])
        self.tab_widgets_class_objs = tab_widgets_class_objs

        # Draw Fields
        if self.current_container is not None or self.behaviour == "query":
            try:
                if self.behaviour == "query":
                    keywords = self.current_experiment.get_unique_keywords()
                else:
                    keywords = self.current_experiment.get_unique_keywords(
                        self.current_container.get_parent_container(),
                        return_all_if_none=True)

                try:
                    keywords = sorted(
                        keywords,
                        key=lambda x: (CATEGORY_SORTING_ERC[
                            x.voc_obj.category], not "Significance" in x.
                                       voc_obj.name, x.word_obj.name))
                except Exception as e:
                    print("Exception in Classification Redraw", e)
                    keywords = sorted(
                        keywords,
                        key=lambda x:
                        (x.class_obj.name, x.voc_obj.name, x.word_obj.name))
                for k in keywords:
                    if not k.voc_obj.is_visible and not self.a_hidden.isChecked(
                    ):
                        continue

                    if self.a_only_active.isChecked() and \
                            not self.current_experiment.has_tag(self.current_container, k):
                        continue

                    if self.complexity_settings is not None:
                        try:
                            if self.complexity_settings[
                                    k.word_obj.
                                    complexity_group] < k.word_obj.complexity_lvl:
                                continue
                        except Exception as e:
                            print(
                                "Exception in Classification Complexity Redrwa",
                                e)

                    idx = tab_widgets_class_objs_index.index(
                        k.class_obj.unique_id)
                    if k.voc_obj.category not in self.tab_categories[idx]:
                        tab = QScrollArea()
                        tab.setWidget(QWidget())
                        tab.widget().setLayout(QVBoxLayout())
                        tab.setWidgetResizable(True)

                        self.tabs[idx].append(tab)
                        self.tab_categories[idx].append(k.voc_obj.category)
                        self.tab_widget_tree[k.class_obj.name][
                            k.voc_obj.category] = tab
                        try:
                            tab_widgets_class_objs[str(
                                k.class_obj.unique_id)].insertTab(
                                    CATEGORY_SORTING_ERC[k.voc_obj.category],
                                    tab, k.voc_obj.category)
                        except Exception as e:
                            tab_widgets_class_objs[str(
                                k.class_obj.unique_id)].addTab(
                                    tab, k.voc_obj.category)

                    else:
                        tab = self.tabs[idx][self.tab_categories[idx].index(
                            k.voc_obj.category)]

                    if k.voc_obj.name + ":" + k.class_obj.name not in self.checkbox_names:
                        self.checkbox_names.append(k.voc_obj.name + ":" +
                                                   k.class_obj.name)
                        group = CheckBoxGroupWidget(tab, k.voc_obj.name)
                        tab.widget().layout().addWidget(group)
                        self.checkbox_groups.append(group)
                    else:
                        group = self.checkbox_groups[self.checkbox_names.index(
                            k.voc_obj.name + ":" + k.class_obj.name)]

                    checkbox = WordCheckBox(group, k)
                    if self.behaviour == "classification":
                        checkbox.setChecked(
                            self.current_experiment.has_tag(
                                self.current_container, checkbox.word))
                        checkbox.stateChanged.connect(
                            partial(self.current_experiment.toggle_tag,
                                    self.current_container, checkbox.word))
                    else:
                        checkbox.setChecked(k in self.current_query_keywords)
                        checkbox.stateChanged.connect(
                            partial(self.on_query_changed, checkbox))
                    group.items.append(checkbox)
                    self.all_checkboxes[k.unique_id] = checkbox

                for g in self.checkbox_groups:
                    g.finalize()
            except Exception as e:
                log_error(e)
                raise e
        for g in self.tabs:
            for t in g:
                t.widget().layout().addItem(
                    QSpacerItem(1, 1, QSizePolicy.Preferred,
                                QSizePolicy.Expanding))

        if self.classification_mode == "Sequential":
            self.frame_container(self.current_container)
예제 #22
0
파일: ui.py 프로젝트: JulianOrteil/Helix
    def _setup_navbar(self) -> None:
        # Create the navbar
        self.navbar = QFrame(self.central_widget)
        self.navbar.setFrameShadow(QFrame.Raised)
        self.navbar.setFrameShape(QFrame.StyledPanel)
        self.navbar.setMinimumSize(QSize(45, 0))
        self.navbar.setObjectName("navbar")

        size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        size_policy.setHorizontalStretch(1)
        size_policy.setVerticalStretch(23)
        size_policy.setHeightForWidth(
            self.navbar.sizePolicy().hasHeightForWidth())

        self.navbar.setSizePolicy(size_policy)

        # Create the navbar layout
        self.navbar_layout = QVBoxLayout(self.navbar)
        self.navbar_layout.setContentsMargins(0, 0, 0, 0)
        self.navbar_layout.setObjectName("navbar_layout")

        # Create the home btn
        self.home_btn = QToolButton(self.navbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/home_icon_sml.png"),
                       QIcon.Normal, QIcon.Off)

        self.home_btn.setIcon(icon)
        self.home_btn.setIconSize(QSize(45, 45))
        self.home_btn.setMinimumSize(QSize(45, 45))
        self.home_btn.setObjectName("home_btn")

        size_policy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.home_btn.sizePolicy().hasHeightForWidth())

        self.home_btn.setSizePolicy(size_policy)
        self.home_btn.setText('')

        # Create the annotation btn
        self.annotation_btn = QToolButton(self.navbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/annotate_icon.png"),
                       QIcon.Normal, QIcon.Off)
        self.annotation_btn.setIcon(icon)
        self.annotation_btn.setIconSize(QSize(45, 45))
        self.annotation_btn.setMinimumSize(QSize(45, 45))
        self.annotation_btn.setObjectName("annotation_btn")

        size_policy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.annotation_btn.sizePolicy().hasHeightForWidth())

        self.annotation_btn.setSizePolicy(size_policy)
        self.annotation_btn.setText('')

        # Create the train btn
        self.train_btn = QToolButton(self.navbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/train_icon.png"), QIcon.Normal,
                       QIcon.Off)
        self.train_btn.setIcon(icon)
        self.train_btn.setIconSize(QSize(45, 45))
        self.train_btn.setMinimumSize(QSize(45, 45))
        self.train_btn.setObjectName("train_btn")

        size_policy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.train_btn.sizePolicy().hasHeightForWidth())

        self.train_btn.setSizePolicy(size_policy)
        self.train_btn.setText('')

        # Create the eval btn
        self.eval_btn = QToolButton(self.navbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/evaluate_icon.png"),
                       QIcon.Normal, QIcon.Off)
        self.eval_btn.setIcon(icon)
        self.eval_btn.setIconSize(QSize(45, 45))
        self.eval_btn.setMinimumSize(QSize(45, 45))
        self.eval_btn.setObjectName("eval_btn")

        size_policy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            self.eval_btn.sizePolicy().hasHeightForWidth())

        self.eval_btn.setSizePolicy(size_policy)
        self.eval_btn.setText('')

        # Create the bottom spacer
        self.navbar_spacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                         QSizePolicy.Expanding)

        # Add the widgets to the navbar layout
        self.navbar_layout.addWidget(self.home_btn)
        self.navbar_layout.addWidget(self.annotation_btn)
        self.navbar_layout.addWidget(self.train_btn)
        self.navbar_layout.addWidget(self.eval_btn)
        self.navbar_layout.addItem(self.navbar_spacer)

        # Add the navbar to the central laytout
        self.central_layout.addWidget(self.navbar, 1, 0, 1, 1)
    def __init__(self, variables, parent=None):
        """
        Constructor
        
        @param variables list of template variable names (list of strings)
        @param parent parent widget of this dialog (QWidget)
        """
        super(TemplateMultipleVariablesDialog, self).__init__(parent)

        self.TemplateMultipleVariablesDialogLayout = QVBoxLayout(self)
        self.TemplateMultipleVariablesDialogLayout.setContentsMargins(
            6, 6, 6, 6)
        self.TemplateMultipleVariablesDialogLayout.setSpacing(6)
        self.TemplateMultipleVariablesDialogLayout.setObjectName(
            "TemplateMultipleVariablesDialogLayout")
        self.setLayout(self.TemplateMultipleVariablesDialogLayout)

        # generate the scrollarea
        self.variablesView = QScrollArea(self)
        self.variablesView.setObjectName("variablesView")
        self.TemplateMultipleVariablesDialogLayout.addWidget(
            self.variablesView)

        self.variablesView.setWidgetResizable(True)
        self.variablesView.setFrameStyle(QFrame.NoFrame)

        self.top = QWidget(self)
        self.variablesView.setWidget(self.top)
        self.grid = QGridLayout(self.top)
        self.grid.setContentsMargins(0, 0, 0, 0)
        self.grid.setSpacing(6)
        self.top.setLayout(self.grid)

        # populate the scrollarea with labels and text edits
        self.variablesEntries = {}
        row = 0
        for var in variables:
            label = QLabel("{0}:".format(var), self.top)
            self.grid.addWidget(label, row, 0, Qt.Alignment(Qt.AlignTop))
            if var.find(":") >= 0:
                formatStr = var[1:-1].split(":")[1]
                if formatStr in ["ml", "rl"]:
                    t = QTextEdit(self.top)
                    t.setTabChangesFocus(True)
                else:
                    t = QLineEdit(self.top)
            else:
                t = QLineEdit(self.top)
            self.grid.addWidget(t, row, 1)
            self.variablesEntries[var] = t
            row += 1
        # add a spacer to make the entries aligned at the top
        spacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                             QSizePolicy.Expanding)
        self.grid.addItem(spacer, row, 1)
        self.variablesEntries[variables[0]].setFocus()
        self.top.adjustSize()

        # generate the buttons
        layout1 = QHBoxLayout()
        layout1.setContentsMargins(0, 0, 0, 0)
        layout1.setSpacing(6)
        layout1.setObjectName("layout1")

        spacer1 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
        layout1.addItem(spacer1)

        self.okButton = QPushButton(self)
        self.okButton.setObjectName("okButton")
        self.okButton.setDefault(True)
        layout1.addWidget(self.okButton)

        self.cancelButton = QPushButton(self)
        self.cancelButton.setObjectName("cancelButton")
        layout1.addWidget(self.cancelButton)

        spacer2 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                              QSizePolicy.Minimum)
        layout1.addItem(spacer2)

        self.TemplateMultipleVariablesDialogLayout.addLayout(layout1)

        # set the texts of the standard widgets
        self.setWindowTitle(self.tr("Enter Template Variables"))
        self.okButton.setText(self.tr("&OK"))
        self.cancelButton.setText(self.tr("&Cancel"))

        # polish up the dialog
        self.resize(QSize(400, 480).expandedTo(self.minimumSizeHint()))

        self.okButton.clicked.connect(self.accept)
        self.cancelButton.clicked.connect(self.reject)
예제 #24
0
파일: ui.py 프로젝트: JulianOrteil/Helix
    def _setup_topbar(self) -> None:
        # Create the topbar
        self.topbar = QFrame(self.central_widget)
        self.topbar.setFrameShadow(QFrame.Raised)
        self.topbar.setFrameShape(QFrame.StyledPanel)
        self.topbar.setMinimumSize(QSize(0, 45))
        self.topbar.setObjectName("topbar")

        size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(1)
        size_policy.setHeightForWidth(
            self.topbar.sizePolicy().hasHeightForWidth())

        self.topbar.setSizePolicy(size_policy)

        # Create the topbar layout
        self.topbar_layout = QHBoxLayout(self.topbar)
        self.topbar_layout.setContentsMargins(0, 0, 0, 0)
        self.topbar_layout.setObjectName("topbar_layout")

        # Create the Helix logo
        self.helix_logo = QLabel(self.topbar)
        self.helix_logo.setAlignment(Qt.AlignCenter)
        self.helix_logo.setMinimumSize(QSize(45, 45))
        self.helix_logo.setObjectName("helix_logo")
        self.helix_logo.setPixmap(
            QPixmap(":/images/images/helix_icon_sml.png"))
        self.helix_logo.setScaledContents(True)
        self.helix_logo.setText('')
        self.helix_logo.setWordWrap(False)

        # Create the Helix logo text
        self.helix_logo_text = QLabel(self.topbar)
        self.helix_logo_text.setAlignment(Qt.AlignLeading | Qt.AlignLeft
                                          | Qt.AlignVCenter)

        font = QFont()
        font.setFamily("Arial Black")
        font.setItalic(True)
        font.setPointSize(16)
        font.setWeight(50)

        self.helix_logo_text.setFont(font)
        self.helix_logo_text.setObjectName("helix_logo_text")
        self.helix_logo_text.setStyleSheet('')

        # Create the topbar spacer
        self.topbar_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                         QSizePolicy.Minimum)

        # Create the minimize btn
        self.minimize_btn = QToolButton(self.topbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/minimize_icon.png"),
                       QIcon.Normal, QIcon.Off)

        self.minimize_btn.setIcon(icon)
        self.minimize_btn.setIconSize(QSize(20, 20))
        self.minimize_btn.setMinimumSize(QSize(45, 45))
        self.minimize_btn.setObjectName("minimize_btn")
        self.minimize_btn.setText('')

        # Create the maximize btn
        self.maximize_btn = QToolButton(self.topbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/maximize_icon.png"),
                       QIcon.Normal, QIcon.Off)

        self.maximize_btn.setIcon(icon)
        self.maximize_btn.setIconSize(QSize(20, 20))
        self.maximize_btn.setMinimumSize(QSize(45, 45))
        self.maximize_btn.setObjectName("maximize_btn")
        self.maximize_btn.setText('')

        # Create the close btn
        self.close_btn = QToolButton(self.topbar)

        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/images/close_icon.png"), QIcon.Normal,
                       QIcon.Off)

        self.close_btn.setIcon(icon)
        self.close_btn.setIconSize(QSize(20, 20))
        self.close_btn.setMinimumSize(QSize(45, 45))
        self.close_btn.setObjectName("close_btn")
        self.close_btn.setText('')

        # Add the widgets to the topbar layout
        self.topbar_layout.addWidget(self.helix_logo)
        self.topbar_layout.addWidget(self.helix_logo_text)
        self.topbar_layout.addItem(self.topbar_spacer)
        self.topbar_layout.addWidget(self.minimize_btn)
        self.topbar_layout.addWidget(self.maximize_btn)
        self.topbar_layout.addWidget(self.close_btn)

        # Add the topbar to the central layout
        self.central_layout.addWidget(self.topbar, 0, 0, 1, 2)
예제 #25
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(533, 388)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.gridLayout = QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.mainGridLayout = QGridLayout()
        self.mainGridLayout.setObjectName(_fromUtf8("mainGridLayout"))
        self.z_Spin = QSpinBox(self.centralwidget)
        self.z_Spin.setMinimum(1)
        self.z_Spin.setObjectName(_fromUtf8("z_Spin"))
        self.mainGridLayout.addWidget(self.z_Spin, 2, 0, 1, 2)
        self.time_Spin = QSpinBox(self.centralwidget)
        self.time_Spin.setMinimum(1)
        self.time_Spin.setObjectName(_fromUtf8("time_Spin"))
        self.mainGridLayout.addWidget(self.time_Spin, 2, 2, 1, 1)
        self.openFile_Button = QPushButton(self.centralwidget)
        self.openFile_Button.setObjectName(_fromUtf8("openFile_Button"))
        self.mainGridLayout.addWidget(self.openFile_Button, 0, 0, 1, 1)
        self.DIC_Spin = QSpinBox(self.centralwidget)
        self.DIC_Spin.setMinimum(1)
        self.DIC_Spin.setObjectName(_fromUtf8("DIC_Spin"))
        self.mainGridLayout.addWidget(self.DIC_Spin, 2, 4, 1, 1)
        self.Z_Label = QLabel(self.centralwidget)
        self.Z_Label.setObjectName(_fromUtf8("Z_Label"))
        self.mainGridLayout.addWidget(self.Z_Label, 1, 0, 1, 2)
        self.correctAtt_Check = QCheckBox(self.centralwidget)
        self.correctAtt_Check.setObjectName(_fromUtf8("correctAtt_Check"))
        self.mainGridLayout.addWidget(self.correctAtt_Check, 3, 4, 1, 1)
        self.Ch_label = QLabel(self.centralwidget)
        self.Ch_label.setObjectName(_fromUtf8("Ch_label"))
        self.mainGridLayout.addWidget(self.Ch_label, 1, 3, 1, 1)
        self.Bkgd_horizontalLayout = QHBoxLayout()
        self.Bkgd_horizontalLayout.setObjectName(
            _fromUtf8("Bkgd_horizontalLayout"))
        self.removeBG_Check = QCheckBox(self.centralwidget)
        self.removeBG_Check.setObjectName(_fromUtf8("removeBG_Check"))
        self.Bkgd_horizontalLayout.addWidget(self.removeBG_Check)
        self.customize_Check = QCheckBox(self.centralwidget)
        self.customize_Check.setObjectName(_fromUtf8("customize_Check"))
        self.Bkgd_horizontalLayout.addWidget(self.customize_Check)
        self.mainGridLayout.addLayout(self.Bkgd_horizontalLayout, 3, 2, 1, 2)
        self.comboBox = QComboBox(self.centralwidget)
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        self.comboBox.addItem(_fromUtf8(""))
        self.comboBox.addItem(_fromUtf8(""))
        self.mainGridLayout.addWidget(self.comboBox, 4, 0, 3, 2)
        self.fileName_Line = QLineEdit(self.centralwidget)
        self.fileName_Line.setObjectName(_fromUtf8("fileName_Line"))
        self.mainGridLayout.addWidget(self.fileName_Line, 0, 1, 1, 4)
        self.correctDrift_Check = QCheckBox(self.centralwidget)
        self.correctDrift_Check.setObjectName(_fromUtf8("correctDrift_Check"))
        self.mainGridLayout.addWidget(self.correctDrift_Check, 3, 0, 1, 2)
        self.T_Label = QLabel(self.centralwidget)
        self.T_Label.setObjectName(_fromUtf8("T_Label"))
        self.mainGridLayout.addWidget(self.T_Label, 1, 2, 1, 1)
        self.DIC_label = QLabel(self.centralwidget)
        self.DIC_label.setObjectName(_fromUtf8("DIC_label"))
        self.mainGridLayout.addWidget(self.DIC_label, 1, 4, 1, 1)
        self.channel_Spin = QSpinBox(self.centralwidget)
        self.channel_Spin.setMinimum(1)
        self.channel_Spin.setMaximum(5)
        self.channel_Spin.setObjectName(_fromUtf8("channel_Spin"))
        self.mainGridLayout.addWidget(self.channel_Spin, 2, 3, 1, 1)
        self.run_Button = QPushButton(self.centralwidget)
        self.run_Button.setObjectName(_fromUtf8("run_Button"))
        self.mainGridLayout.addWidget(self.run_Button, 9, 0, 1, 1)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.resolution_Spin = QDoubleSpinBox(self.centralwidget)
        self.resolution_Spin.setSingleStep(0.01)
        self.resolution_Spin.setProperty("value", 0.21)
        self.resolution_Spin.setObjectName(_fromUtf8("resolution_Spin"))
        self.horizontalLayout.addWidget(self.resolution_Spin)
        self.resolution_Label = QLabel(self.centralwidget)
        self.resolution_Label.setObjectName(_fromUtf8("resolution_Label"))
        self.horizontalLayout.addWidget(self.resolution_Label)
        self.mainGridLayout.addLayout(self.horizontalLayout, 7, 0, 2, 2)
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.correctAtt_Spin = QDoubleSpinBox(self.centralwidget)
        self.correctAtt_Spin.setMaximum(1.0)
        self.correctAtt_Spin.setMinimum(0.01)
        self.correctAtt_Spin.setValue(0.1)
        self.correctAtt_Spin.setSingleStep(0.01)
        self.correctAtt_Spin.setObjectName(_fromUtf8("correctAtt_Spin"))
        self.verticalLayout.addWidget(self.correctAtt_Spin)
        spacerItem = QSpacerItem(88, 37, QSizePolicy.Minimum,
                                 QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.mainGridLayout.addLayout(self.verticalLayout, 4, 4, 5, 1)
        self.featureSize_verticalLayout = QVBoxLayout()
        self.featureSize_verticalLayout.setObjectName(
            _fromUtf8("featureSize_verticalLayout"))
        self.horizontalLayout_1 = QHBoxLayout()
        self.horizontalLayout_1.setObjectName(_fromUtf8("horizontalLayout_1"))
        self.featureSize1_Label = QLabel(self.centralwidget)
        self.featureSize1_Label.setEnabled(True)
        self.featureSize1_Label.setObjectName(_fromUtf8("featureSize1_Label"))
        self.horizontalLayout_1.addWidget(self.featureSize1_Label)
        self.featureSize1_Spin = oddSpinBox(self.centralwidget)
        self.featureSize1_Spin.setEnabled(True)
        self.featureSize1_Spin.setMaximum(999)
        self.featureSize1_Spin.setSingleStep(2)
        self.featureSize1_Spin.setObjectName(_fromUtf8("featureSize1_Spin"))
        self.horizontalLayout_1.addWidget(self.featureSize1_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_1)
        self.horizontalLayout_2 = QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.featureSize2_Label = QLabel(self.centralwidget)
        self.featureSize2_Label.setEnabled(True)
        self.featureSize2_Label.setObjectName(_fromUtf8("featureSize2_Label"))
        self.horizontalLayout_2.addWidget(self.featureSize2_Label)
        self.featureSize2_Spin = oddSpinBox(self.centralwidget)
        self.featureSize2_Spin.setEnabled(True)
        self.featureSize2_Spin.setMaximum(999)
        self.featureSize2_Spin.setSingleStep(2)
        self.featureSize2_Spin.setObjectName(_fromUtf8("featureSize2_Spin"))
        self.horizontalLayout_2.addWidget(self.featureSize2_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.featureSize3_Label = QLabel(self.centralwidget)
        self.featureSize3_Label.setEnabled(True)
        self.featureSize3_Label.setObjectName(_fromUtf8("featureSize3_Label"))
        self.horizontalLayout_3.addWidget(self.featureSize3_Label)
        self.featureSize3_Spin = oddSpinBox(self.centralwidget)
        self.featureSize3_Spin.setEnabled(True)
        self.featureSize3_Spin.setMaximum(999)
        self.featureSize3_Spin.setSingleStep(2)
        self.featureSize3_Spin.setObjectName(_fromUtf8("featureSize3_Spin"))
        self.horizontalLayout_3.addWidget(self.featureSize3_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.featureSize4_Label = QLabel(self.centralwidget)
        self.featureSize4_Label.setEnabled(True)
        self.featureSize4_Label.setObjectName(_fromUtf8("featureSize4_Label"))
        self.horizontalLayout_5.addWidget(self.featureSize4_Label)
        self.featureSize4_Spin = oddSpinBox(self.centralwidget)
        self.featureSize4_Spin.setEnabled(True)
        self.featureSize4_Spin.setMaximum(999)
        self.featureSize4_Spin.setSingleStep(2)
        self.featureSize4_Spin.setObjectName(_fromUtf8("featureSize4_Spin"))
        self.horizontalLayout_5.addWidget(self.featureSize4_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_8 = QHBoxLayout()
        self.horizontalLayout_8.setObjectName(_fromUtf8("horizontalLayout_8"))
        self.featureSize5_Label = QLabel(self.centralwidget)
        self.featureSize5_Label.setEnabled(True)
        self.featureSize5_Label.setObjectName(_fromUtf8("featureSize5_Label"))
        self.horizontalLayout_8.addWidget(self.featureSize5_Label)
        self.featureSize5_Spin = oddSpinBox(self.centralwidget)
        self.featureSize5_Spin.setEnabled(True)
        self.featureSize5_Spin.setMaximum(999)
        self.featureSize5_Spin.setSingleStep(2)
        self.featureSize5_Spin.setObjectName(_fromUtf8("featureSize5_Spin"))
        self.horizontalLayout_8.addWidget(self.featureSize5_Spin)
        self.featureSize_verticalLayout.addLayout(self.horizontalLayout_8)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.featureSize_verticalLayout.addItem(spacerItem1)
        self.mainGridLayout.addLayout(self.featureSize_verticalLayout, 4, 2, 5,
                                      2)
        self.gridLayout.addLayout(self.mainGridLayout, 0, 0, 1, 1)
        self.resolution_Label.raise_()
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusBar = QStatusBar(MainWindow)
        self.statusBar.setObjectName(_fromUtf8("statusBar"))
        MainWindow.setStatusBar(self.statusBar)

        self.featureSpins = [
            self.featureSize1_Spin, self.featureSize2_Spin,
            self.featureSize3_Spin, self.featureSize4_Spin,
            self.featureSize5_Spin
        ]
        self.featureLabels = [
            self.featureSize1_Label, self.featureSize2_Label,
            self.featureSize3_Label, self.featureSize4_Label,
            self.featureSize5_Label
        ]
        self.defaultFeatureValue = 301
        self.initialSetup()

        self.retranslateUi(MainWindow)
        self.connectUI()
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
예제 #26
0
파일: ui.py 프로젝트: JulianOrteil/Helix
    def _setup_central_content(self) -> None:
        # Create the main content container
        self.main_content = QFrame(self.central_widget)
        self.main_content.setFrameShadow(QFrame.Raised)
        self.main_content.setFrameShape(QFrame.StyledPanel)
        self.main_content.setObjectName("main_content")

        size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        size_policy.setHorizontalStretch(42)
        size_policy.setHeightForWidth(
            self.main_content.sizePolicy().hasHeightForWidth())
        size_policy.setVerticalStretch(0)

        self.main_content.setSizePolicy(size_policy)
        self.main_content.setStyleSheet('')

        # Create the main content layout
        self.main_content_layout = QHBoxLayout(self.main_content)
        self.main_content_layout.setContentsMargins(0, 0, 0, 0)
        self.main_content_layout.setObjectName("main_content_layout")
        self.main_content_layout.setSpacing(0)

        # Create the content_bar
        self.content_bar = QFrame(self.main_content)
        self.content_bar.setFrameShadow(QFrame.Raised)
        self.content_bar.setFrameShape(QFrame.StyledPanel)
        self.content_bar.setObjectName("content_bar")

        size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(1)
        size_policy.setHeightForWidth(
            self.content_bar.sizePolicy().hasHeightForWidth())
        size_policy.setVerticalStretch(0)

        self.content_bar.setSizePolicy(size_policy)

        # Create the content_bar layout
        self.content_bar_layout = QVBoxLayout(self.content_bar)
        self.content_bar_layout.setObjectName("content_bar_layout")

        # Create the open single file btn
        # self.open_file_btn = QToolButton(self.content_bar)
        # self.open_file_btn.setAutoRaise(False)
        # self.open_file_btn.setEnabled(False)

        # font = QFont()
        # font.setFamilies("Segoe UI")
        # font.setPointSize(10)

        # self.open_file_btn.setFont(font)

        # icon = QIcon()
        # icon.addPixmap(
        #     QPixmap(":/images/images/open_file_icon_sml.png"),
        #     QIcon.Normal,
        #     QIcon.Off
        # )

        # self.open_file_btn.setIcon(icon)
        # self.open_file_btn.setIconSize(QSize(60, 60))
        # # self.open_file_btn.setObjectName("open_file_btn")
        # self.open_file_btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Create the open dataset btn
        # self.open_dataset_btn = QToolButton(self.content_bar)
        # self.open_dataset_btn.setAutoRaise(False)
        # self.open_dataset_btn.setEnabled(False)

        # font = QFont()
        # font.setFamilies("Segoe UI")
        # font.setPointSize(10)

        # self.open_dataset_btn.setFont(font)

        # icon = QIcon()
        # icon.addPixmap(
        #     QPixmap(":/images/images/open_directory_icon_sml.png"),
        #     QIcon.Normal,
        #     QIcon.Off
        # )

        # self.open_dataset_btn.setIcon(icon)
        # self.open_dataset_btn.setIconSize(QSize(60, 60))
        # # self.open_dataset_btn.setObjectName("open_dataset_btn")
        # self.open_dataset_btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Create the next image btn
        # self.next_image_btn = QToolButton(self.content_bar)
        # self.next_image_btn.setAutoRaise(False)
        # self.next_image_btn.setEnabled(False)

        # font = QFont()
        # font.setFamilies("Segoe UI")
        # font.setPointSize(10)

        # self.next_image_btn.setFont(font)

        # icon = QIcon()
        # icon.addPixmap(
        #     QPixmap(":/images/images/arrow_right_sml.png"),
        #     QIcon.Normal,
        #     QIcon.Off
        # )

        # self.next_image_btn.setIcon(icon)
        # self.next_image_btn.setIconSize(QSize(60, 60))
        # # self.next_image_btn.setObjectName("next_image_btn")
        # self.next_image_btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Create the previous image btn
        # self.previous_image_btn = QToolButton(self.content_bar)
        # self.previous_image_btn.setAutoRaise(False)
        # self.previous_image_btn.setEnabled(False)

        # font = QFont()
        # font.setFamilies("Segoe UI")
        # font.setPointSize(10)

        # self.previous_image_btn.setFont(font)

        # icon = QIcon()
        # icon.addPixmap(
        #     QPixmap(":/images/images/arrow_left_sml.png"),
        #     QIcon.Normal,
        #     QIcon.Off
        # )

        # self.previous_image_btn.setIcon(icon)
        # self.previous_image_btn.setIconSize(QSize(60, 60))
        # # self.previous_image_btn.setObjectName("previous_image_btn")
        # self.previous_image_btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        # Create the content_bar spacer
        self.content_bar_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                              QSizePolicy.Minimum)

        # Create the content
        self.content = QLabel(self.main_content)
        self.content.setAlignment(Qt.AlignCenter)

        font = QFont()
        font.setFamily("Arial Black")
        font.setItalic(True)
        font.setKerning(True)
        font.setPointSize(20)

        self.content.setFont(font)
        self.content.setObjectName("content")

        size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(6)
        size_policy.setHeightForWidth(
            self.content.sizePolicy().hasHeightForWidth())
        size_policy.setVerticalStretch(0)

        self.content.setSizePolicy(size_policy)

        # Add the widgets to the content_bar layout
        # self.content_bar_layout.addWidget(self.open_file_btn)
        # self.content_bar_layout.addWidget(self.open_dataset_btn)
        # self.content_bar_layout.addWidget(self.next_image_btn)
        # self.content_bar_layout.addWidget(self.previous_image_btn)
        self.content_bar_layout.addItem(self.content_bar_spacer)

        # Add the widgets to the main content layout
        self.main_content_layout.addWidget(self.content_bar)
        self.main_content_layout.addWidget(self.content)

        # Add the main content container to the central layout
        self.central_layout.addWidget(self.main_content, 1, 1, 1, 1)
예제 #27
0
    def __init__(self):
        super().__init__(None)
        self.setWindowTitle("Captivox")
        layout = QVBoxLayout(self)
        self.dotwid = DotsWidget()
        self.dotwid.timer = QTimer(self)
        self.dotwid.timer.timeout.connect(self.dotwid.next_animation_frame)
        layout.addWidget(self.dotwid)
        controls_box = QFormLayout()

        angle_factor_box = QHBoxLayout()
        self.angle_factor_slider = QSlider(Qt.Horizontal)
        self.angle_factor_slider.setMaximum(1080)
        self.angle_factor_slider.setValue(ANGLE_FACTOR_DEF)
        self.a_f_slider_val_label = QLabel(str(self.angle_factor_slider.value()))
        self.angle_factor_slider.valueChanged.connect(self.dotwid.change_angle_factor)
        angle_factor_box.addWidget(self.angle_factor_slider)
        angle_factor_box.addWidget(self.a_f_slider_val_label)
        controls_box.addRow("Angle Factor", angle_factor_box)

        num_dots_box = QHBoxLayout()
        self.num_dots_slider = QSlider(Qt.Horizontal)
        self.num_dots_slider.setMinimum(2)
        self.num_dots_slider.setMaximum(200)
        self.num_dots_slider.setValue(NUM_DOTS_DEF)
        self.num_dots_slider.valueChanged.connect(self.dotwid.change_num_dots)
        self.num_dots_slider_val_label = QLabel(str(self.num_dots_slider.value()))
        num_dots_box.addWidget(self.num_dots_slider)
        num_dots_box.addWidget(self.num_dots_slider_val_label)
        controls_box.addRow("Dot number", num_dots_box)

        dot_size_box = QHBoxLayout()
        self.dot_size_slider = QSlider(Qt.Horizontal)
        self.dot_size_slider.setMaximum(40)
        self.dot_size_slider.setValue(DOT_SIZE_DEF)
        self.dot_size_slider.valueChanged.connect(self.dotwid.change_dot_size)
        self.dot_size_slider_val_label = QLabel(str(self.dot_size_slider.value()))
        dot_size_box.addWidget(self.dot_size_slider)
        dot_size_box.addWidget(self.dot_size_slider_val_label)
        controls_box.addRow("Dot size", dot_size_box)

        x_multiplier_box = QHBoxLayout()
        self.x_multiplier_slider = QSlider(Qt.Horizontal)
        self.x_multiplier_slider.setMaximum(10)
        self.x_multiplier_slider.setValue(X_MULT_DEF)
        self.x_multiplier_slider.valueChanged.connect(self.dotwid.change_x_multiplier)
        self.x_multiplier_slider_val_label = QLabel(str(self.x_multiplier_slider.value()))
        x_multiplier_box.addWidget(self.x_multiplier_slider)
        x_multiplier_box.addWidget(self.x_multiplier_slider_val_label)
        controls_box.addRow("X Multiplier", x_multiplier_box)

        y_multiplier_box = QHBoxLayout()
        self.y_multiplier_slider = QSlider(Qt.Horizontal)
        self.y_multiplier_slider.setMaximum(10)
        self.y_multiplier_slider.setValue(Y_MULT_DEF)
        self.y_multiplier_slider.valueChanged.connect(self.dotwid.change_y_multiplier)
        self.y_multiplier_slider_val_label = QLabel(str(self.y_multiplier_slider.value()))
        y_multiplier_box.addWidget(self.y_multiplier_slider)
        y_multiplier_box.addWidget(self.y_multiplier_slider_val_label)
        controls_box.addRow("Y Multiplier", y_multiplier_box)

        halfmax_box = QHBoxLayout()
        self.halfmax_slider = QSlider(Qt.Horizontal)
        self.halfmax_slider.setMinimum(1)
        self.halfmax_slider.setMaximum(720)
        self.halfmax_slider.setValue(HALFMAX_DEF)
        self.halfmax_slider.valueChanged.connect(self.dotwid.change_halfmax)
        self.halfmax_slider_val_label = QLabel(str(self.halfmax_slider.value()))
        halfmax_box.addWidget(self.halfmax_slider)
        halfmax_box.addWidget(self.halfmax_slider_val_label)
        controls_box.addRow("Period", halfmax_box)

        delay_box = QHBoxLayout()
        self.delay_slider = QSlider(Qt.Horizontal)
        self.delay_slider.setMinimum(1)
        self.delay_slider.setMaximum(100)
        self.delay_slider.setValue(DELAY_DEF)
        self.delay_slider.valueChanged.connect(self.change_delay)
        self.delay_slider_val_label = QLabel(str(self.delay_slider.value()))
        delay_box.addWidget(self.delay_slider)
        delay_box.addWidget(self.delay_slider_val_label)
        controls_box.addRow("Delay (ms)", delay_box)

        speedmult_box = QHBoxLayout()
        self.speedmult_slider = QSlider(Qt.Horizontal)
        # self.speedmult_slider.setMinimum(1)
        self.speedmult_slider.setMaximum(12)
        self.speedmult_slider.setValue(SPEED_MULT_DEF)
        self.speedmult_slider.valueChanged.connect(self.dotwid.change_speedmult)
        self.speedmult_slider_val_label = QLabel(str(self.speedmult_slider.value()))
        speedmult_box.addWidget(self.speedmult_slider)
        speedmult_box.addWidget(self.speedmult_slider_val_label)
        controls_box.addRow("Speed", speedmult_box)

        self.draw_axes_checkbox = QCheckBox("Show axes")
        self.draw_axes_checkbox.setChecked(DRAW_AXES_DEF)
        self.draw_axes_checkbox.stateChanged.connect(self.dotwid.change_draw_axes)

        self.join_end_dots_checkbox = QCheckBox("Join end dots")
        self.draw_axes_checkbox.setChecked(JOIN_ENDS_DEF)
        self.join_end_dots_checkbox.stateChanged.connect(self.dotwid.change_join_end_dots)

        self.change_col1_button = QPushButton("")
        self.change_col1_button.setFlat(True)
        pal = QPalette()
        pal.setColor(QPalette.Button, COL1_DEF)
        self.change_col1_button.setPalette(pal)
        self.change_col1_button.setAutoFillBackground(True)
        self.change_col1_button.pressed.connect(self.change_col1)

        self.change_col2_button = QPushButton("")
        self.change_col2_button.setFlat(True)
        pal = QPalette()
        pal.setColor(QPalette.Button, COL2_DEF)
        self.change_col2_button.setPalette(pal)
        self.change_col2_button.setAutoFillBackground(True)
        self.change_col2_button.pressed.connect(self.change_col2)

        smaller_options_box = QHBoxLayout()
        smaller_options_box.addWidget(self.draw_axes_checkbox)
        smaller_options_box.addWidget(self.join_end_dots_checkbox)
        smaller_options_box.addSpacerItem(QSpacerItem(2, 2, QSizePolicy.MinimumExpanding))
        smaller_options_box.addWidget(self.change_col1_button)
        smaller_options_box.addWidget(self.change_col2_button)
        controls_box.addRow(smaller_options_box)

        # colour_options_box = QHBoxLayout()
        # colour_options_box.addSpacerItem(QSpacerItem(2, 2, QSizePolicy.MinimumExpanding))
        # colour_options_box.addWidget(self.change_col1_button)
        # colour_options_box.addWidget(self.change_col2_button)
        # colour_options_box.addSpacerItem(QSpacerItem(2, 2, QSizePolicy.MinimumExpanding))
        # controls_box.addRow(colour_options_box)

        reset_button = QPushButton("Reset values")
        reset_button.pressed.connect(self.reset_controls)

        export_button = QPushButton("Export a video")
        export_button.pressed.connect(self.dotwid.export_video)

        # controls_box.addWidget(reset_button)
        last_controls = QHBoxLayout()
        # last_controls.addWidget(self.draw_axes_checkbox)
        # last_controls.addWidget(self.join_end_dots_checkbox)
        last_controls.addSpacerItem(QSpacerItem(2, 2, QSizePolicy.MinimumExpanding))
        last_controls.addWidget(reset_button)
        last_controls.addSpacerItem(QSpacerItem(2, 2, QSizePolicy.MinimumExpanding))
        last_controls.addWidget(export_button)
        controls_box.addRow(last_controls)

        controls_widget = QWidget(self)
        controls_widget.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Maximum)
        pal = QPalette()
        pal.setColor(QPalette.Background, QColor("#fff"))
        controls_widget.setPalette(pal)
        controls_widget.setAutoFillBackground(True)
        controls_widget.setLayout(controls_box)

        layout.addWidget(controls_widget)
        self.dotwid.timer.start(DELAY_DEF)

        # icon used for the Window
        self.setWindowIcon(QIcon(resource_path("icon.png")))
    def __init__(self, *args, **kwargs):
        self.app = QApplication(sys.argv)
        super().__init__(*args, **kwargs)

        # Some good colors:
        # #afbcc6, #b9afc6, #afb0c6
        self.title = "Equation Database"
        self.left = WINDOW_LEFT_START
        # self.left = 0
        self.top = WINDOW_TOP_START
        self.height = WINDOW_HEIGHT
        self.width = int(self.height * golden_ratio)

        # region ToolBar
        self.toolbar = self.addToolBar('Save')
        self.toolbar.setIconSize(QSize(128, 128))

        save_action = QAction(QIcon('Icons/save_button_256x256.png'), '&Save', self)
        save_action.setShortcut('Ctrl+S')
        save_action.setStatusTip('Save Equation Group')

        analyze_action = QAction(QIcon('Icons/analyze_cog_512x512.png'), '&Analyze', self)
        analyze_action.setShortcut('Alt+A')
        analyze_action.setStatusTip('Analyze Equation Group')

        new_eqn_action = QAction(QIcon('Icons/sigma_icon_256x256.png'), '&New Equation', self)
        new_eqn_action.setShortcut('Ctrl+N')
        new_eqn_action.setStatusTip('New Equation')

        new_eqn_group_action = QAction(QIcon('Icons/new_eq_group_1000x1000.png'), '&New Equation Group', self)
        new_eqn_group_action.setShortcut('Alt+N')
        new_eqn_group_action.setStatusTip('New Equation Group')
        new_eqn_group_action.triggered.connect(self.new_equation_group)

        eqn_group_info_action = QAction(QIcon('Icons/info_icon256x256.png'), '&Equation Group Information', self)
        eqn_group_info_action.setShortcut('Alt+I')
        eqn_group_info_action.setStatusTip('Equation Group Information')

        self.toolbar.addAction(save_action)
        self.toolbar.addAction(new_eqn_action)
        empty1 = QWidget(self.toolbar)
        ew: int = 50  # pylint: disable=invalid-name
        empty1.setFixedWidth(ew)
        empty2 = QWidget(self.toolbar)
        empty2.setFixedWidth(ew)
        self.toolbar.addWidget(empty1)
        self.toolbar.addSeparator()
        self.toolbar.addWidget(empty2)
        self.toolbar.addAction(new_eqn_group_action)
        self.toolbar.addAction(analyze_action)
        self.toolbar.addAction(eqn_group_info_action)

        # endregion
        t_log = TimeLogger()

        verbose = True
        my_conn = my_connect(t_log=t_log, verbose=verbose)
        self.my_conn = my_conn

        t_log.new_event("Start Gui Build: ")

        # region Equation Group - Left Frame
        # -----------------------------------------------------------------------------------------------------------
        self.eq_group_gbox = QGroupBox("Equation Group")
        self.eq_group_gbox.setMinimumWidth(200)
        self.eq_group_v_layout = QVBoxLayout(self.eq_group_gbox)
        self.eq_group_v_layout.setSpacing(5)

        self.eq_group_cbox = QComboBox(self.eq_group_gbox)
        self.eq_group_cbox.activated.connect(self.populate_equation_listbox)

        self.eq_group_v_layout.addWidget(self.eq_group_cbox)

        self.analyze_frame = QFrame(self.eq_group_gbox)
        self.analyze_h_layout = QHBoxLayout(self.analyze_frame)
        self.analyze_h_layout.setContentsMargins(10, 0, 10, 15)
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.analyze_frame.setSizePolicy(size_policy)

        self.equation_filter_list = EDFilterListWidget(self.eq_group_gbox)
        self.equation_listbox = self.equation_filter_list.list
        # self.equation_listbox = QListWidget(self.eq_group_gbox)
        self.equation_listbox.setSelectionBehavior(QAbstractItemView.SelectItems)
        self.equation_listbox.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.equation_listbox.selectionModel().selectionChanged.connect(self.select_one_equation)
        self.equation_filter_list.add.connect(self.add_equation)
        self.equation_filter_list.remove.connect(self.remove_equation)

        self.eq_group_v_layout.addWidget(self.equation_filter_list)
        # endregion

        # region Equation Details - Right Frame
        # -----------------------------------------------------------------------------------------------------------
        self.eq_details_gbox = QGroupBox("Equation Details")  # Entire encapsulating Gbox
        self.eq_details_v_layout = QVBoxLayout(self.eq_details_gbox)

        # region Equation Header added to Equation Details
        # **********************************************************
        self.eq_header_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.eq_header_frame.setSizePolicy(size_policy)
        self.eq_header_g_layout = QGridLayout(self.eq_header_frame)
        self.eq_details_v_layout.addWidget(self.eq_header_frame)

        self.name_label = QLabel("Equation Name")
        self.name_l_edit = QLineEdit()
        self.eq_header_g_layout.addWidget(self.name_label, 0, 0)
        self.eq_header_g_layout.addWidget(self.name_l_edit, 0, 1)

        self.codefile_label = QLabel("Code File")
        self.codefile_l_edit = QLineEdit()
        self.eq_header_g_layout.addWidget(self.codefile_label, 1, 0)
        self.eq_header_g_layout.addWidget(self.codefile_l_edit, 1, 1)

        self.type_label = QLabel("Type")
        self.type_cbox = QComboBox()
        self.type_cbox.setMinimumWidth(700)
        self.eq_header_g_layout.addWidget(self.type_label, 0, 2)
        self.eq_header_g_layout.addWidget(self.type_cbox, 0, 3)

        self.associated_eq_groups_btn = EquationButton("Associated Eq Groups")
        self.eq_header_g_layout.addWidget(self.associated_eq_groups_btn, 1, 3)
        self.eq_header_g_layout.setAlignment(self.associated_eq_groups_btn, Qt.AlignLeft)
        self.details_btn = EquationButton("Other Details")
        self.eq_header_g_layout.addWidget(self.details_btn, 1, 3)
        self.eq_header_g_layout.setAlignment(self.details_btn, Qt.AlignRight)
        # endregion

        # region LaTeX added to Equation Details
        # **********************************************************

        self.latex_gbox = QGroupBox("LaTeX")
        size_policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.latex_gbox.setSizePolicy(size_policy)
        self.latex_v_layout = QVBoxLayout(self.latex_gbox)

        # This would be great for when one wants to filter content based on what is being typed
        # self.latex_textbox.textChanged.connect(self.update_latex_image)

        self.latex_graphicbox = QGraphicsView(self.latex_gbox)
        self.scene = QGraphicsScene()
        self.latex_graphicbox.setScene(self.scene)
        # self.latex_graphicbox.setMinimumSize(QSize(907, 369))

        self.latex_textbox = LaTexTextEdit(my_conn=my_conn, parent=self.latex_gbox, t_log=t_log, scene=self.scene,
                                           graphics_view=self.latex_graphicbox, verbose=verbose)

        self.latex_splitter = Customsplitter(Qt.Vertical)  # Note Handle for a vert splitter is oriented Horizontally
        self.latex_splitter.addWidget(self.latex_textbox)
        self.latex_splitter.addWidget(self.latex_graphicbox)
        self.latex_v_layout.addWidget(self.latex_splitter)

        self.latex_btn_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.latex_btn_frame.setSizePolicy(size_policy)
        self.latex_btn_h_layout = QHBoxLayout(self.latex_btn_frame)
        self.latex_btn_h_layout.setContentsMargins(0, 0, 1, 10)
        self.latex_template_btn = EquationButton("Template")
        self.latex_update_btn = EquationButton("Update")
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.latex_btn_h_layout.addWidget(self.latex_template_btn)
        self.latex_btn_h_layout.addItem(h_spacer)
        self.latex_btn_h_layout.addWidget(self.latex_update_btn)
        self.latex_v_layout.addWidget(self.latex_btn_frame)

        # endregion

        # region Variables Notes
        self.var_notes_frame = QFrame(self.eq_details_gbox)
        self.var_notes_v_layout = QVBoxLayout(self.var_notes_frame)
        # self.var_notes_frame.setLayout(self.var_notes_v_layout)

        self.variables_gbox = QGroupBox("Variables")
        self.variables_v_layout = QVBoxLayout(self.variables_gbox)
        self.variables_v_layout.setSpacing(5)
        # self.variables_gbox.setLayout(self.var_notes_v_layout)
        self.variables_tbl = QTableWidget(self.variables_gbox)
        self.variables_v_layout.addWidget(self.variables_tbl)

        self.var_add_btn = QPushButton("+")
        self.var_add_btn.setObjectName("add_rm_btn")
        ar_w = 50
        self.var_add_btn.setFixedSize(QSize(ar_w, int(ar_w)))
        self.var_add_btn.clicked.connect(self.add_variable)

        self.var_rm_btn = QPushButton("-")
        self.var_rm_btn.setObjectName("add_rm_btn")
        self.var_rm_btn.clicked.connect(self.remove_variable)
        self.var_rm_btn.setFixedSize(QSize(ar_w, int(ar_w)))

        self.var_add_rm_frame = QFrame(self.variables_gbox)
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.var_add_rm_frame.setSizePolicy(size_policy)
        self.var_add_rm_h_layout = QHBoxLayout(self.var_add_rm_frame)
        self.var_add_rm_h_layout.setSpacing(2)
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.var_add_rm_h_layout.addItem(h_spacer)
        self.var_add_rm_h_layout.addWidget(self.var_add_btn)
        self.var_add_rm_h_layout.addWidget(self.var_rm_btn)
        self.variables_v_layout.addWidget(self.var_add_rm_frame)

        self.notes_gbox = QGroupBox("Notes")
        self.notes_v_layout = QVBoxLayout(self.notes_gbox)
        # self.notes_gbox.setLayout(self.notes_v_layout)
        self.notes_textbox = QTextEdit(self.notes_gbox)
        self.notes_v_layout.addWidget(self.notes_textbox)

        self.notes_btn_frame = QFrame()
        size_policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        self.notes_btn_frame.setSizePolicy(size_policy)
        self.notes_btn_h_layout = QHBoxLayout(self.notes_btn_frame)
        self.notes_btn_h_layout.setContentsMargins(0, 0, 1, 10)
        self.notes_update_btn = EquationButton("Update")
        h_spacer = QSpacerItem(20, 40, QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
        self.notes_btn_h_layout.addItem(h_spacer)
        self.notes_btn_h_layout.addWidget(self.notes_update_btn)
        self.notes_v_layout.addWidget(self.notes_btn_frame)

        self.var_notes_vsplt = Customsplitter(Qt.Vertical)
        self.var_notes_vsplt.addWidget(self.variables_gbox)
        self.var_notes_vsplt.addWidget(self.notes_gbox)
        self.var_notes_v_layout.addWidget(self.var_notes_vsplt)

        # endregion

        self.detail_v_splitter = Customsplitter()
        self.detail_v_splitter.addWidget(self.latex_gbox)
        self.detail_v_splitter.addWidget(self.var_notes_frame)
        self.detail_v_splitter.setSizes([int(self.width * 0.7 * 0.5), int(self.width * 0.7 * 0.5)])
        self.eq_details_v_layout.addWidget(self.detail_v_splitter)

        # endregion

        # region Main Splitter splits the equation groups list view from the details view
        # -----------------------------------------------------------------------------------------------------------
        self.main_splitter = Customsplitter()
        self.main_splitter.addWidget(self.eq_group_gbox)
        self.main_splitter.addWidget(self.eq_details_gbox)
        self.main_splitter.setSizes([int(self.width * 0.3), int(self.width * 0.7)])
        # endregion

        # region Main Window Creation
        self.main_frame = QFrame()
        self.main_layout = QVBoxLayout(self.main_frame)
        self.main_layout.addWidget(self.main_splitter)

        self.setCentralWidget(self.main_frame)

        self.setGeometry(self.left, self.top, self.width, self.height)

        self.setWindowTitle(self.title)
        app_icon = QIcon("Icons/sigma_icon.png")
        self.setWindowIcon(app_icon)
        self.app.setStyle('Oxygen')
        # endregion

        # region Data members

        t_log.new_event("End GUI Build")

        self.state_data = dict()
        # t_log.new_event("Equation Group Load")
        self.eqn_grp = EquationGroup(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.eq = GroupedEquations(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.var = GroupedVariables(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.unit = Unit(my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.eq_type = TypeTable(name='equation_type', my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.var_type = TypeTable(name='variable_type', my_conn=my_conn, t_log=t_log, verbose=verbose)
        self.unit_type = TypeTable(name='unit_type', my_conn=my_conn, t_log=t_log, verbose=verbose)

        t_log.new_event("Data Finished Loading")

        self.eq_grp_id: int = 1  # Can envision it pulling user specified state information someday
        self.eqn_records_for_eqn_group = None  # Gets Populated when equations are present
        self.eq_id: tuple = (1,)  # Same comment as eq_grp_id
        self.var_records_for_eqns = None  # Gets populated when eqn_group_gets selected
        self.selected_equation = None  # Stores the selected equation
        self.latex_textbox.db_ref = self.eq
        self.equation_taken: bool = False

        t_log.new_event("Populating Boxes")
        self.refresh_eqn_group_combo_box()
        self.populate_equation_listbox()
        t_log.new_event("Populating Boxes")
        self.app.setStyleSheet(open('equation_db.css').read())
        t_log.new_event("Finished Style Sheet")
        print()
        print('Total Time: ', t_log.total_time())
예제 #29
0
    def __init__(self, parent=None):
        super().__init__()
        self.setWindowTitle(self.tr("Welcome Pisi GNU/Linux"))
        self.setFixedSize(700, 475)
        self.setWindowIcon(QIcon(":/images/pisilinux-welcome.svg"))
        self.setLayout(QVBoxLayout())
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.setStyleSheet("QPushButton {border: none; text-align: left; color:\
        black;} QLabel {color:black;}")

        x = (QDesktopWidget().width() - self.width()) // 2
        y = (QDesktopWidget().height() - self.height()) // 2
        self.move(x, y)

        # The header code:

        self.headerWidget = QWidget()
        self.headerWidget.setFixedHeight(80)
        self.headerWidget.setLayout(QHBoxLayout())
        self.headerWidget.setStyleSheet("background-image:\
        url(:/images/background.png);")
        self.layout().addWidget(self.headerWidget)

        self.pisiWhiteLogo = QLabel()
        self.pisiWhiteLogo.setFixedSize(64, 64)
        self.pisiWhiteLogo.setScaledContents(True)
        self.pisiWhiteLogo.setPixmap(
            QIcon(":/images/pisi-white.svg").pixmap(self.pisiWhiteLogo.size()))
        self.headerWidget.layout().addWidget(self.pisiWhiteLogo)

        self.pisiTextLabel = QLabel()
        self.pisiTextLabel.setFixedSize(157, 48)
        self.pisiTextLabel.setScaledContents(True)
        self.pisiTextLabel.setPixmap(QPixmap(":/images/pisi-text.png"))
        self.headerWidget.layout().addWidget(self.pisiTextLabel)

        self.headerWidget.layout().addItem(
            QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding))

        self.versionLabel = QLabel()
        font = self.versionLabel.font()
        font.setPointSize(12)
        self.versionLabel.setFont(font)
        self.versionLabel.setText(
            "{} - {}".format(
                QSysInfo.productVersion(), QSysInfo.currentCpuArchitecture()))
        self.versionLabel.setStyleSheet("color: white; font-weight: bold;")
        self.headerWidget.layout().addWidget(self.versionLabel)

        # The middle area code:

        self.contentWidget = QWidget()
        self.contentWidget.setLayout(QVBoxLayout())
        self.contentWidget.setStyleSheet("background-color: white;")
        self.layout().addWidget(self.contentWidget)

        self.meetingLabel = QLabel()
        self.meetingLabel.setText(
            self.tr("Welcome to Pisi GNU/Linux!"
                    " Thank you for joining our community!\n\n"
                    "As Pisi GNU/Linux developers,"
                    " we hope you enjoy using Pisi GNU/Linux."
                    " The following links will guide you while"
                    " using Pisi GNU/Linux. Please do not"
                    " hesitate to inform about your experiences,"
                    " suggestions and errors you have encountered."))

        self.meetingLabel.setWordWrap(True)
        font = self.meetingLabel.font()
        font.setPointSize(10)
        self.meetingLabel.setFont(font)
        self.meetingLabel.setAlignment(Qt.AlignHCenter)
        self.meetingLabel.setStyleSheet("color: black;")
        self.contentWidget.layout().addWidget(self.meetingLabel)

        self.mainLayout = QHBoxLayout()
        self.contentWidget.layout().addLayout(self.mainLayout)

        vlayoutI = QVBoxLayout()

        self.docsHeader = QLabel()
        font = self.docsHeader.font()
        font.setPointSize(14)
        font.setBold(True)
        self.docsHeader.setFont(font)
        self.docsHeader.setAlignment(Qt.AlignHCenter)
        self.docsHeader.setText(self.tr("Documents"))
        vlayoutI.addWidget(self.docsHeader)

        self.installationDocButton = QPushButton()
        self.installationDocButton.setFixedWidth(160)
        self.installationDocButton.setCursor(Qt.PointingHandCursor)
        self.installationDocButton.setText(self.tr("Installation Guide"))
        self.installationDocButton.setIcon(QIcon(":/images/guide.svg"))
        self.installationDocButton.setIconSize(QSize(32, 32))
        vlayoutI.addWidget(self.installationDocButton)

        self.releaseNotesButton = QPushButton()
        self.releaseNotesButton.setFixedWidth(160)
        self.releaseNotesButton.setCursor(Qt.PointingHandCursor)
        self.releaseNotesButton.setText(self.tr("Release Notes"))
        self.releaseNotesButton.setIcon(QIcon(":/images/info.svg"))
        self.releaseNotesButton.setIconSize(QSize(32, 32))
        vlayoutI.addWidget(self.releaseNotesButton)

        self.wikiButton = QPushButton()
        self.wikiButton.setFixedWidth(160)
        self.wikiButton.setCursor(Qt.PointingHandCursor)
        self.wikiButton.setText(self.tr("Pisi GNU/Linux Wiki"))
        self.wikiButton.setIcon(QIcon(":/images/wikipedia-logo.svg"))
        self.wikiButton.setIconSize(QSize(32, 32))
        vlayoutI.addWidget(self.wikiButton)

        vlayoutII = QVBoxLayout()

        self.supportHeader = QLabel()
        font = self.supportHeader.font()
        font.setPointSize(14)
        font.setBold(True)
        self.supportHeader.setFont(font)
        self.supportHeader.setAlignment(Qt.AlignHCenter)
        self.supportHeader.setText(self.tr("Support"))
        vlayoutII.addWidget(self.supportHeader)

        self.forumButton = QPushButton()
        self.forumButton.setFixedWidth(160)
        self.forumButton.setCursor(Qt.PointingHandCursor)
        self.forumButton.setText(self.tr("Forum"))
        self.forumButton.setIconSize(QSize(32, 32))
        self.forumButton.setIcon(QIcon(":/images/forum.svg"))
        vlayoutII.addWidget(self.forumButton)

        self.chatButton = QPushButton()
        self.chatButton.setFixedWidth(160)
        self.chatButton.setCursor(Qt.PointingHandCursor)
        self.chatButton.setText(self.tr("Chat Rooms"))
        self.chatButton.setIcon(QIcon(":/images/chat.svg"))
        self.chatButton.setIconSize(QSize(32, 32))
        vlayoutII.addWidget(self.chatButton)

        self.bugsButton = QPushButton()
        self.bugsButton.setFixedWidth(160)
        self.bugsButton.setCursor(Qt.PointingHandCursor)
        self.bugsButton.setText(self.tr("Bug Report"))
        self.bugsButton.setIcon(QIcon(":/images/bug.svg"))
        self.bugsButton.setIconSize(QSize(32, 32))
        vlayoutII.addWidget(self.bugsButton)

        vlayoutIII = QVBoxLayout()

        self.installationHeader = QLabel()
        font = self.installationHeader.font()
        font.setPointSize(14)
        font.setBold(True)
        self.installationHeader.setFont(font)
        self.installationHeader.setAlignment(Qt.AlignHCenter)
        self.installationHeader.setText(self.tr("Installation"))
        vlayoutIII.addWidget(self.installationHeader)

        # TODO: Also for YALI
        self.calamaresButton = QPushButton()
        self.calamaresButton.setFixedWidth(160)
        self.calamaresButton.setCursor(Qt.PointingHandCursor)
        self.calamaresButton.setText(self.tr("Start Installation"))
        self.calamaresButton.setIcon(QIcon(":/images/calamares.svg"))
        self.calamaresButton.setIconSize(QSize(32, 32))
        vlayoutIII.addWidget(self.calamaresButton)

        self.joinUsButton = QPushButton()
        self.joinUsButton.setFixedWidth(160)
        self.joinUsButton.setCursor(Qt.PointingHandCursor)
        self.joinUsButton.setText(self.tr("Join Us"))
        self.joinUsButton.setIcon(QIcon(":/images/joinus.svg"))
        self.joinUsButton.setIconSize(QSize(32, 32))
        vlayoutIII.addWidget(self.joinUsButton)

        self.donateButton = QPushButton()
        self.donateButton.setFixedWidth(160)
        self.donateButton.setCursor(Qt.PointingHandCursor)
        self.donateButton.setText(self.tr("Ev"))
        self.donateButton.setIcon(QIcon(":/images/ev.svg"))
        self.donateButton.setIconSize(QSize(32, 32))
        vlayoutIII.addWidget(self.donateButton)

        self.mainLayout.addLayout(vlayoutI)
        self.mainLayout.addLayout(vlayoutII)
        self.mainLayout.addLayout(vlayoutIII)

        self.noteLabel = QLabel()
        font = self.noteLabel.font()
        font.setPointSize(12)
        font.setBold(True)
        self.noteLabel.setFont(font)
        self.noteLabel.setText(self.tr("Note: The password is \"live\"."))
        self.noteLabel.setAlignment(Qt.AlignHCenter)
        self.noteLabel.setMinimumSize(250, 50)
        self.noteLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
        self.contentWidget.layout().addWidget(self.noteLabel)

        # The footer code:

        self.footerWidget = QWidget()
        self.footerWidget.setFixedHeight(50)
        self.footerWidget.setLayout(QHBoxLayout())
        self.footerWidget.setStyleSheet(
            "background-image: url(:/images/background.png);")
        self.layout().addWidget(self.footerWidget)

        self.facebookButton = QPushButton()
        self.facebookButton.setFixedSize(36, 36)
        self.facebookButton.setIconSize(QSize(36, 36))
        self.facebookButton.setIcon(QIcon(":/images/facebook.svg"))
        self.facebookButton.setCursor(Qt.PointingHandCursor)
        self.facebookButton.setToolTip(self.tr("Facebook Page"))
        self.footerWidget.layout().addWidget(self.facebookButton)

        self.twitterButton = QPushButton()
        self.twitterButton.setFixedSize(36, 36)
        self.twitterButton.setIconSize(QSize(36, 36))
        self.twitterButton.setIcon(QIcon(":/images/twitter.svg"))
        self.twitterButton.setCursor(Qt.PointingHandCursor)
        self.twitterButton.setToolTip(self.tr("Twitter Page"))
        self.footerWidget.layout().addWidget(self.twitterButton)

        self.googleButton = QPushButton()
        self.googleButton.setFixedSize(36, 36)
        self.googleButton.setIconSize(QSize(36, 36))
        self.googleButton.setIcon(QIcon(":/images/google-plus.svg"))
        self.googleButton.setCursor(Qt.PointingHandCursor)
        self.googleButton.setToolTip(self.tr("Google+ Page"))
        self.footerWidget.layout().addWidget(self.googleButton)

        self.instagramButton = QPushButton()
        self.instagramButton.setFixedSize(36, 36)
        self.instagramButton.setIconSize(QSize(36, 36))
        self.instagramButton.setIcon(QIcon(":/images/instagram.svg"))
        self.instagramButton.setCursor(Qt.PointingHandCursor)
        self.instagramButton.setToolTip(self.tr("Instagram Page"))
        self.footerWidget.layout().addWidget(self.instagramButton)

        self.githubButton = QPushButton()
        self.githubButton.setFixedSize(36, 36)
        self.githubButton.setIconSize(QSize(36, 36))
        self.githubButton.setIcon(QIcon(":/images/github-logo.svg"))
        self.githubButton.setCursor(Qt.PointingHandCursor)
        self.githubButton.setToolTip(self.tr("GitHub Page"))
        self.footerWidget.layout().addWidget(self.githubButton)

        self.slackButton = QPushButton()
        self.slackButton.setFixedSize(36, 36)
        self.slackButton.setIconSize(QSize(36, 36))
        self.slackButton.setIcon(QIcon(":/images/Slack.png"))
        self.slackButton.setCursor(Qt.PointingHandCursor)
        self.slackButton.setToolTip(self.tr("Slack Page"))
        self.footerWidget.layout().addWidget(self.slackButton)

        self.footerWidget.layout().addItem(
            QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding))

        self.startupCheckBox = QCheckBox()
        self.startupCheckBox.setChecked(
            os.path.exists(os.path.join(os.environ["HOME"],
                                        ".config",
                                        "autostart",
                                        "pisilinux-welcome.desktop")))
        font = self.startupCheckBox.font()
        font.setBold(True)
        self.startupCheckBox.setFont(font)
        self.startupCheckBox.setText(self.tr("Show on startup"))
        self.startupCheckBox.setStyleSheet("color: white;")
        self.footerWidget.layout().addWidget(self.startupCheckBox)

        self.facebookButton.clicked.connect(self.facebookPage)
        self.twitterButton.clicked.connect(self.twitterPage)
        self.googleButton.clicked.connect(self.googlePage)
        self.instagramButton.clicked.connect(self.instagramPage)
        self.githubButton.clicked.connect(self.githubPage)
        #self.slackButton.clicked.connect(self.slackPage)

        #self.releaseNotesButton.clicked.connect(self.releaseNotes)
        self.wikiButton.clicked.connect(self.wikiPage)
        self.forumButton.clicked.connect(self.forumPage)
        self.chatButton.clicked.connect(self.chatPages)
        #self.joinUsButton.clicked.connect(self.joinUsPage)
        #self.donateButton.clicked.connect(self.donatePage)
        self.startupCheckBox.clicked.connect(self.startupState)
        self.bugsButton.clicked.connect(self.issuesPage)
예제 #30
0
    def initUI(self):
        self.setWindowTitle('Practica Vocabulario 1.0')
        self.size = 800, 600
        self.setMinimumSize(self.size[0], self.size[1])
        self.setMaximumSize(self.size[0], self.size[1])
        centralWidget = QWidget()
        self.verticalspace = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                         QSizePolicy.Expanding)
        self.columnas = QHBoxLayout()
        self.colRadios = QHBoxLayout()

        self.groupColform = QGroupBox("Add Words")
        self.groupColInit = QGroupBox("Init Practice")

        self.groupColWords = QGroupBox("Words Registed")
        self.filasCol1 = QVBoxLayout()

        self.filasForm1 = QVBoxLayout()
        self.filasForm2 = QVBoxLayout()

        self.filasWords = QVBoxLayout()

        self.lblEnglish = QLabel("English")
        self.lblSpanish = QLabel("Spanish")
        self.lbltime = QLabel("Next question in: 0s")
        self.lbltime.setFont(QFont('Arial', 28))
        self.txtEnglish = QLineEdit()
        self.txtSpanish = QLineEdit()
        self.btnAdd = QPushButton('Add')
        self.btnInit = QPushButton('Start!')

        self.filasForm1.addWidget(self.lblEnglish)
        self.filasForm1.addWidget(self.txtEnglish)
        self.filasForm1.addWidget(self.lblSpanish)
        self.filasForm1.addWidget(self.txtSpanish)
        self.filasForm1.addWidget(self.btnAdd)

        self.RadioIdioma = QRadioButton("In English")
        self.RadioIdioma.setChecked(True)
        self.RadioIdioma.idioma = "english"
        self.RadioIdioma.toggled.connect(self.changeMode)
        self.colRadios.addWidget(self.RadioIdioma)
        self.RadioIdioma = QRadioButton("In Spanish")
        self.RadioIdioma.setChecked(False)
        self.RadioIdioma.idioma = "spanish"
        self.RadioIdioma.toggled.connect(self.changeMode)
        self.colRadios.addWidget(self.RadioIdioma)
        self.filasForm2.addLayout(self.colRadios)

        self.filasForm2.addWidget(self.btnInit)
        self.filasForm2.addItem(self.verticalspace)
        self.filasForm2.addWidget(self.lbltime)

        self.listWords = QListWidget()
        self.filasWords.addWidget(self.listWords)
        self.groupColform.setLayout(self.filasForm1)
        self.groupColInit.setLayout(self.filasForm2)
        self.filasCol1.addWidget(self.groupColform)
        self.filasCol1.addWidget(self.groupColInit)

        self.groupColWords.setLayout(self.filasWords)

        self.columnas.addLayout(self.filasCol1)

        self.columnas.addWidget(self.groupColWords)

        centralWidget.setLayout(self.columnas)
        self.setCentralWidget(centralWidget)
        self.show()