Exemple #1
0
    def _show_backup_decision(self, error=None):
        text = '<p>{0}</p><p>{1}</p>'.format(
            self.BACKUP_INTRO_TEXT if error is None else error,
            self.BACKUP_PROMPT_TEXT,
        )

        dialog = QMessageBox(
            QMessageBox.Question if error is None else QMessageBox.Critical,
            self.BACKUP_DIALOG_CAPTION if error is None else self.BACKUP_DIALOG_ERROR_CAPTION,
            text,
        )

        revert_button = dialog.addButton(self.REVERT_BACKUP_BUTTON_TEXT, QMessageBox.AcceptRole)
        delete_button = dialog.addButton(self.DELETE_BACKUP_BUTTON_TEXT, QMessageBox.DestructiveRole)
        examine_button = dialog.addButton(self.EXAMINE_BACKUP_BUTTON_TEXT, QMessageBox.ActionRole)
        dialog.addButton(self.QUIT_BUTTON_TEXT, QMessageBox.RejectRole)

        dialog.exec()
        clicked_button = dialog.clickedButton()

        if clicked_button == examine_button:
            QMetaObject.invokeMethod(self, '_examine_backup', Qt.QueuedConnection)
        elif clicked_button == revert_button:
            self._progress_dialog = QProgressDialog(None)
            self._progress_dialog.setLabelText(self.REVERT_BACKUP_PROGRESS_TEXT)
            self._progress_dialog.setCancelButton(None)
            self._progress_dialog.setRange(0, 0)
            self._progress_dialog.forceShow()

            self.request_revert_backup.emit()
        elif clicked_button == delete_button:
            self.request_delete_backup.emit()
        else:
            self.quit()
    def Render(self, frame=None):
        """ Render an images sequence of the current template using Blender 2.62+ and the
        Blender Python API. """

        # Enable the Render button again
        self.disable_interface()

        # Init blender paths
        blend_file_path = os.path.join(info.PATH, "blender", "blend", self.selected_template)
        source_script = os.path.join(info.PATH, "blender", "scripts", self.selected_template.replace(".blend", ".py"))
        target_script = os.path.join(info.BLENDER_PATH, self.unique_folder_name,
                                     self.selected_template.replace(".blend", ".py"))

        # Copy the .py script associated with this template to the temp folder.  This will allow
        # OpenShot to inject the user-entered params into the Python script.
        shutil.copy(source_script, target_script)

        # Open new temp .py file, and inject the user parameters
        self.inject_params(target_script, frame)

        # Create new thread to launch the Blender executable (and read the output)
        if frame:
            # preview mode
            QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, True))
        else:
            # render mode
            # self.my_blender = BlenderCommand(self, blend_file_path, target_script, False)
            QMetaObject.invokeMethod(self.worker, 'Render', Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, False))
Exemple #3
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.dbm_obj = Dbm()
        self.curFile = ''
        self.textEdit = QTextEdit()
        self.sectionTreeWidget = QTreeWidget()

        self.notesListWidget = QListWidget()
        self.createHorizontalGroupBox()
        self.setCentralWidget(self.horizontalGroupBox)

        self.createActions()
        self.createMenus()
        # self.createToolBars()
        self.createStatusBar()
        self.readSettings()

        [self.hierarchy_dict, self.notebook_dict, self.section_dict, self.page_dict] = [{}, {}, {}, {}]

        self.setCurrentFile('')

        # For binding slots and signals
        self.fetchPageThread = FetchPage()
        self.fetchPageThread.setObjectName('fetchPageThread')
        self.syncAllThread = SyncAllThread()
        self.syncAllThread.setObjectName('syncAllThread')
        self.textEdit.document().contentsChanged.connect(self.documentWasModified)
        self.sectionTreeWidget.setObjectName("sectionTreeWidget")
        self.notesListWidget.setObjectName("notesListWidget")
        QMetaObject.connectSlotsByName(self)
        self.readDB()
Exemple #4
0
    def setup_ui(self):
        self.battleWindow.setWindowTitle(self.battleWindow.config.get_text('battle.window.title') + ' v' + str(self.battleWindow.config.version))
        background = self.battleWindow.config.theme_selected.get_background_pixmap()
        palette = QPalette()
        palette.setBrush(QPalette.Background, QBrush(background))
        self.battleWindow.setMinimumSize(constants.get_min_resolution_qsize())
        self.battleWindow.setAutoFillBackground(True)
        self.gridLayout.setVerticalSpacing(0)

        self.setup_hint_label()  # Labels
        self.setup_turn_label()  # Labels
        self.setup_space()  # Space item

        self.setup_help_button()  # Help Push Button
        self.setup_next_target_button()  # Next Target Button
        self.setup_end_unit_button()  # End Unit Button
        self.setup_retreat_button()  # Retreat Button
        self.setup_auto_combat_button()  # Automatic battle button

        self.setup_targeted_unit_view()  # Targeted Unit view
        self.setup_current_unit_view()  # Current Unit View
        self.setup_coat_of_arms_view()  # Coat of Arm view

        self.setup_map()  # Main view
        self.battleWindow.setPalette(palette)
        self.battleWindow.setCentralWidget(self.centralWidget)

        # noinspection PyArgumentList
        QMetaObject.connectSlotsByName(self.battleWindow)
Exemple #5
0
    def processFrame(self, frame):
        if self.m_isBusy:
            return

        self.m_isBusy = True
        QMetaObject.invokeMethod(self.m_processor, 'processFrame',
                Qt.QueuedConnection, Q_ARG(QVideoFrame, frame),
                Q_ARG(int, self.m_levels))
Exemple #6
0
    def resizeEvent(self, event):
        super().resizeEvent(event)

        win_w = event.size().width() * self.devicePixelRatio()
        win_h = event.size().height() * self.devicePixelRatio()

        self._updateViewportGeometry(win_w, win_h)

        QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
Exemple #7
0
    def resizeEvent(self, event):
        super().resizeEvent(event)
        
        w = event.size().width() * self.devicePixelRatio()
        h = event.size().height() * self.devicePixelRatio()
        for camera in self._app.getController().getScene().getAllCameras():
            camera.setViewportSize(w, h)
            proj = Matrix()
            if camera.isPerspective():
                proj.setPerspective(30, w/h, 1, 500)
            else:
                proj.setOrtho(-w / 2, w / 2, -h / 2, h / 2, -500, 500)
            camera.setProjectionMatrix(proj)

        self._app.getRenderer().setViewportSize(w, h)

        QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
Exemple #8
0
    def setupUi(self, Form):
        Form.setObjectName("seal")
        Form.resize(314, 188)
        Form.setWindowFlags(Qt.WindowStaysOnTopHint
                            | Qt.FramelessWindowHint)  # 设置无边框、置顶
        Form.setWindowOpacity(0.9)  # 设置透明度
        Form.raise_()
        Form.setStyleSheet("#seal{\
                              background-color: rgba(0, 0, 0, 0);\
                              border-image:url(./Resource/Pic/入纸确认/背景1.png);}")

        self.Seal_type = QComboBox(Form)
        self.Seal_type.setObjectName("seal_type")
        self.Seal_type.setGeometry(QRect(70, 46, 160, 30))
        self.Seal_type.addItem("Seal_1", self.Seal_enum['Seal_1'])
        self.Seal_type.addItem("Seal_2", self.Seal_enum['Seal_2'])
        self.Seal_type.addItem("Seal_3", self.Seal_enum['Seal_3'])
        self.Seal_type.addItem("Seal_4", self.Seal_enum['Seal_4'])
        self.Seal_type.adjustSize()

        self.verify_btn = QPushButton(Form)
        self.verify_btn.setObjectName("verify_btn")
        self.verify_btn.setGeometry(QRect(10, 120, 140, 60))
        self.verify_btn.setStyleSheet("#verify_btn{\
                                          border-image:url(./Resource/Pic/入纸确认/btn_up.png);\
                                          text-align:center;\
                                          font-weight:Regular; \
                                          font-family:SourceHanSansCN-Regular;\
                                          font-size:18px;\
                                          color:#7B7B7B;}")
        self.verify_btn.setText("确认")

        self.cancel_btn = QPushButton(Form)
        self.cancel_btn.setObjectName("cancel_btn")
        self.cancel_btn.setGeometry(QRect(160, 120, 140, 60))
        self.cancel_btn.setStyleSheet("#cancel_btn{\
                                          border-image:url(./Resource/Pic/入纸确认/btn_up.png);\
                                          text-align:center;\
                                          font-weight:Regular; \
                                          font-family:SourceHanSansCN-Regular;\
                                          font-size:18px;\
                                          color:#7B7B7B;}")
        self.cancel_btn.setText("取消")

        self.retranslateUi(Form)
        QMetaObject.connectSlotsByName(Form)
    def _build_ui(self):
        """Builds the UI on dialog startup"""

        for provider_entry in self.temp_config['providers']:
            self._add_box(provider_entry['name'],
                          provider_entry['base_url'],
                          provider_entry['key'],
                          provider_entry['limit'],
                          provider_entry['unit'],
                          new=False)

        self.gridLayout.addWidget(self.providers, 0, 0, 1, 3)

        QMetaObject.connectSlotsByName(self)

        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
Exemple #10
0
    def setupUi(self):
        self.setObjectName("MainWindow")
        self.centralwidget = QWidget(self)
        self.centralwidget.setObjectName("centralwidget")

        self.tableWidget = QTableWidget(self.centralwidget)
        self.tableWidget.setGeometry(QtCore.QRect(30, 50, 825, 520))
        self.tableWidget.setRowCount(50)
        self.tableWidget.setColumnCount(2)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setHorizontalHeaderLabels(["Id Role", "Nama Role"])
        self.tableWidget.setEditTriggers(QTreeView.NoEditTriggers)
        self.tableWidget.setStyleSheet("background-color:#ECEBE4")
        data_df = self.load_data()

        for data in data_df:
            pprint(data[2])
            self.tableWidget.setItem(data[0], data[1], data[2])

        self.btnHapus = QPushButton(self.centralwidget)
        self.btnHapus.setGeometry(QtCore.QRect(28, 600, 90, 30))
        self.btnHapus.setObjectName("btnHapus")
        self.setCentralWidget(self.centralwidget)
        self.btnHapus.clicked.connect(self.hapus)

        self.btnEdit = QPushButton(self.centralwidget)
        self.btnEdit.setGeometry(QtCore.QRect(650, 600, 90, 30))
        self.btnEdit.setStyleSheet("background-color:#4DAE4E")
        self.btnEdit.setObjectName("btnEdit")
        self.setCentralWidget(self.centralwidget)
        self.btnEdit.clicked.connect(self.editData)

        self.btnKembali = QPushButton(self.centralwidget)
        self.btnKembali.setGeometry(QtCore.QRect(750, 600, 90, 30))
        self.btnKembali.setStyleSheet("background-color:#3498DB")
        self.btnKembali.setObjectName("btnKembali")
        self.setCentralWidget(self.centralwidget)
        self.btnKembali.clicked.connect(self.handleBack)

        self.statusbar = QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

        self.retranslateUi()
        QMetaObject.connectSlotsByName(self)
    def setupUi(self, Form):
        Form.setObjectName("wait")
        # Form.resize(450, 140)
        Form.resize(1024, 768)
        # Form.move(0, 0)
        Form.setWindowOpacity(0.6)  # 虚化 0.7
        Form.raise_()

        screenResolution = QApplication.desktop()
        x = (screenResolution.width() - Form.geometry().width()) / 2
        y = (screenResolution.height() - Form.geometry().height()) / 2
        self.move(x, y)

        # 设置无边框、置顶
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
        # 设置背景透明而控件不透明
        self.setWindowOpacity(1)
        self.setAttribute(Qt.WA_TranslucentBackground)

        self.setStyleSheet('#wait{\
                                background-color: rgba(0, 0, 0, 0);\
                                border-image:url(' + back_img + ');}')

        self.wait_lab = QLabel(Form)
        self.wait_lab.setObjectName("wait_lab")
        self.wait_lab.setGeometry(QRect(300, 300, 440, 130))
        self.wait_lab.setStyleSheet("#wait_lab{\
                                        background-color: rgba(0, 0, 0, 0);\
                                        font-weight:Regular; \
                                        font-family:SourceHanSansCN-Regular;\
                                        font-size:36px;\
                                        line-height:7px;\
                                        color:#FFFFFF;\
                                        text-align:center; \
                                        border-image:url(" + wait_img + ")\
                                        }")
        self.wait_lab.setWordWrap(True)

        # 该AlignCenter标志不属于该PyQt5.Qt模块,而属于PyQt5.QtCore.Qt该类。设置文字水平垂直居中
        self.wait_lab.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

        self.wait_lab.setText("识别中,请稍候...")

        self.retranslateUi(Form)
        QMetaObject.connectSlotsByName(Form)
Exemple #12
0
    def setupUi(self):
        self.centralwidget = QWidget(self)
        self.verticalLayoutWidget = QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QRect(10, 10, 221, 81))
        self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.label_logo = QLabel(self.verticalLayoutWidget)
        self.pixmap = QPixmap('icon.ico')
        self.pixmap = self.pixmap.scaledToWidth(30, Qt.SmoothTransformation)
        self.label_logo.setPixmap(self.pixmap)
        self.verticalLayout.addWidget(self.label_logo, 0, Qt.AlignHCenter)
        self.label_name = QLabel(self.verticalLayoutWidget)
        font = QFont()
        font.setPointSize(13)
        font.setStyleStrategy(QFont.PreferAntialias)
        self.label_name.setFont(font)
        self.label_name.setLayoutDirection(Qt.LeftToRight)
        self.verticalLayout.addWidget(self.label_name, 0, Qt.AlignHCenter)
        self.label_version = QLabel(self.verticalLayoutWidget)
        font = QFont()
        font.setPointSize(10)
        self.label_version.setFont(font)
        self.label_version.setLayoutDirection(Qt.LeftToRight)
        self.verticalLayout.addWidget(self.label_version, 0, Qt.AlignHCenter)
        self.verticalLayoutWidget_2 = QWidget(self.centralwidget)
        self.verticalLayoutWidget_2.setGeometry(QRect(10, 100, 221, 41))
        self.verticalLayout_2 = QVBoxLayout(self.verticalLayoutWidget_2)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.label_copyright = QLabel(self.verticalLayoutWidget_2)
        font = QFont()
        font.setPointSize(10)
        self.label_copyright.setFont(font)
        self.label_copyright.setLayoutDirection(Qt.LeftToRight)
        self.verticalLayout_2.addWidget(self.label_copyright, 0,
                                        Qt.AlignHCenter)
        self.label_author = QLabel(self.verticalLayoutWidget_2)
        font = QFont()
        font.setPointSize(10)
        self.label_author.setFont(font)
        self.label_author.setLayoutDirection(Qt.LeftToRight)
        self.verticalLayout_2.addWidget(self.label_author, 0, Qt.AlignHCenter)
        self.setCentralWidget(self.centralwidget)

        self.retranslateUi()
        QMetaObject.connectSlotsByName(self)
Exemple #13
0
    def __init__(self, parent=None, *args, **kwargs):
        super(Demo, self).__init__(parent, *args, **kwargs)
        # 整体垂直盒子布局
        self.vbox = QVBoxLayout()
        self.setLayout(self.vbox)

        self.tab = QTabWidget()
        self.vbox.addWidget(self.tab)

        self.lab1 = QLabel('页面1')
        self.lab2 = QLabel('页面2')
        self.lab3 = QLabel('页面3')

        self.tab.addTab(self.lab1, '页面1')
        self.tab.addTab(self.lab2, '页面2')
        self.tab.addTab(self.lab3, '页面3')

        QMetaObject.connectSlotsByName(self)
Exemple #14
0
    def setupUi(self, general_vidloader):
        """ Sets up UI"""
        general_vidloader.setObjectName("general_vidloader")
        self.centralwidget = QWidget(general_vidloader)
        self.centralwidget.setObjectName("centralwidget")
        self.progressBar = QProgressBar(self.centralwidget)
        self.progressBar.setGeometry(QRect(110, 150, 381, 25))
        self.progressBar.setProperty("value", 24)
        self.progressBar.setObjectName("progressBar")
        self.progressBar.setVisible(False)
        self.progressBar.setValue(0)
        self.Title_label = QLabel(self.centralwidget)
        self.Title_label.setGeometry(QRect(170, 10, 261, 51))
        self.label_forSize = QLabel(self.centralwidget)
        self.label_forSize.setGeometry(QRect(220, 200, 180, 41))
        self.label_forSize.setObjectName("label_for_SizeDisplay")
        self.label_forSize.setVisible(False)
        self.Title_label = QLabel(self.centralwidget)
        self.Title_label.setGeometry(QRect(230, 20, 230, 41))
        font = QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.Title_label.setFont(font)
        self.Title_label.setObjectName("Title_label")
        self.label_info = QLabel(self.centralwidget)
        self.label_info.setGeometry(QRect(30, 300, 271, 17))
        self.label_info.setObjectName("label_info")
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QRect(430, 220, 88, 33))
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(lambda: self.download())
        general_vidloader.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(general_vidloader)
        self.menubar.setGeometry(QRect(0, 0, 586, 25))
        self.menubar.setObjectName("menubar")
        general_vidloader.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(general_vidloader)
        self.statusbar.setObjectName("statusbar")
        general_vidloader.setStatusBar(self.statusbar)

        self.retranslateUi(general_vidloader)
        QMetaObject.connectSlotsByName(general_vidloader)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 300)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QLabel(self.centralwidget)
        self.label.setGeometry(QRect(100, 10, 200, 31))
        font = QFont()
        font.setFamily("Georgia")
        font.setPointSize(16)
        self.label.setFont(font)
        self.label.setAlignment(Qt.AlignCenter)
        self.label.setObjectName("label")
        self.splitter = QSplitter(self.centralwidget)
        self.splitter.setGeometry(QRect(20, 70, 351, 151))
        self.splitter.setOrientation(Qt.Vertical)
        self.splitter.setObjectName("splitter")
        self.label_2 = QLabel(self.splitter)
        font = QFont()
        font.setFamily("Georgia")
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setAlignment(Qt.AlignCenter)
        self.label_2.setWordWrap(True)
        self.label_2.setObjectName("label_22")
        self.label_3 = QLabel(self.splitter)
        font = QFont()
        font.setFamily("Georgia")
        font.setPointSize(12)
        self.label_3.setFont(font)
        self.label_3.setAlignment(Qt.AlignCenter)
        self.label_3.setWordWrap(True)
        self.label_3.setObjectName("label_3")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 400, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
Exemple #16
0
        def _qNotify(self, observable, change, **kwargs):
            """Notify the Observer about some change. This will
            initiate an asynchronous notification by queueing an
            invocation of :py:meth:_qAsyncNotify in the Qt main event
            loop. If there are already pending notifications, instead
            of adding more notifications, the changes are simply
            accumulated.

            Arguments
            ---------
            observable: Observable
                The observable that triggered the notification.
            self: QObserverHelper
                This QObserverHelper.
            change:
                The change that caused this notification.
            """
            # LOG.debug("%s._qNotify: change=%s [%s]",
            #           self._observer, change, self._change)
            if self._change is None:
                # Currently, there is no change event pending for this
                # object. So we will queue a new one and remember the
                # change:
                self._change = change
                self._kwargs = kwargs
                # This will use Qt.AutoConnection: the member is invoked
                # synchronously if obj lives in the same thread as the caller;
                # otherwise it will invoke the member asynchronously.
                try:
                    # LOG.debug("%s._qNotify: invokeMethod(_qAsyncNotify, %s)"
                    #           "in QThread %s",
                    #           self._observer, observable, self.thread())
                    argument = Q_ARG("PyQt_PyObject", observable)
                    QMetaObject.invokeMethod(self, '_qAsyncNotify', argument)
                    #     Q_ARG("PyQt_PyObject", change))
                    #   RuntimeError: QMetaObject.invokeMethod() call failed
                except Exception as ex:
                    handle_exception(ex)
            else:
                # There is already one change pending in the event loop.
                # We will just update the change, but not queue another
                # event.
                self._change |= change
Exemple #17
0
    def __init__(self):
        super().__init__()

        self.setObjectName('Main')
        QMetaObject.connectSlotsByName(self)

        self.view = QWebEngineView()
        self.view.settings().setAttribute(QWebEngineSettings.LocalStorageEnabled, True)
        self.view.setObjectName('MapWidget')

        self.window = QWidget()
        self.window.setObjectName('MainWidget')
        self.layout = QGridLayout(self.window)
        self.layout.addWidget(self.view)
        self.setCentralWidget(self.window)

        self.channel = QWebChannel(self.view.page())
        self.view.page().setWebChannel(self.channel)
        self.channel.registerObject("jshelper", self)

        principal = Figure()
        js = JavascriptLink(QUrl.fromLocalFile(self.htmlPath.absoluteFilePath("qwebchannel.js")).toString())
        principal.header.add_child(Element(js.render()))
        map = folium.Map(location=[36, -108],
                             zoom_start=5, tiles='StamenWatercolor').add_to(principal)
        fastestRoute = folium.PolyLine(((40, -110), (50, -110)),
                                       weight=5, color='blue').add_to(map)

        f = Figure()
        f.html.add_child(Element('<button id="myBtn">Try it</button>'))
        f.html.add_child(Element('<p>\n TEST \n</p>'))

        link = JavascriptLink(QUrl.fromLocalFile(self.htmlPath.absoluteFilePath("popup.js")).toString())
        f.html.add_child(Element(link.render()))

        iframe = branca.element.IFrame(html=f.render(), width=500, height=300)
        popup = folium.Popup(iframe, max_width=500)
        fastestRoute.add_child(popup)

        principal.save(self.htmlPath.absoluteFilePath("test.html"))
        self.view.load(QUrl().fromLocalFile(self.htmlPath.absoluteFilePath("test.html")))
        self.setGeometry(100, 100, 1200, 900)
        self.show()
Exemple #18
0
 def addButtons(self, frm: QWidget, btns, styleName='Layout_Button'):
     """给窗体中Layout_Button的布局添加按钮"""
     layout = frm.findChild((QHBoxLayout, QWidget), styleName)
     if not (layout is None):
         layout.setSpacing(2)
         for m in btns:
             btn = QPushButton(m['fMenuText'])
             btn.NMID = m['fNMID']
             btn.setObjectName(m['fObjectName'])
             self.addOneButtonIcon(btn, m['fIcon'])
             btn.setEnabled(m['fHasRight'])
             layout.addWidget(btn)
         else:
             errStr = "窗体【{}】中没有找到名为'【Layout_Button】'的布局".format(
                 frm.objectName())
             errStr = errStr + ",无法添加按钮。"
             logging.getLogger().warning(errStr)
         # 设置按名称执行槽函数
         QMetaObject.connectSlotsByName(frm)
Exemple #19
0
    def setupUi(self, facebook_dwn):
        facebook_dwn.setObjectName("facebook_dwn")
        facebook_dwn.resize(586, 379)
        self.centralwidget = QWidget(facebook_dwn)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QLabel(self.centralwidget)
        self.label.setGeometry(QRect(220, 10, 250, 61))
        font = QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName("Title_label")
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QRect(460, 290, 88, 33))
        self.pushButton.setObjectName("pushButton")
        self.pushButton.clicked.connect(lambda: self.Selector())
        self.groupBox_forQuality = QGroupBox(self.centralwidget)
        self.groupBox_forQuality.setGeometry(QRect(200, 90, 141, 111))
        self.groupBox_forQuality.setObjectName("groupBox_for_videoFormats")
        self.HighQual_radioButton = QRadioButton(self.groupBox_forQuality)
        self.HighQual_radioButton.setGeometry(QRect(20, 30, 104, 23))
        self.HighQual_radioButton.setObjectName("mp4_radioButton")
        self.LowQual_radioButton = QRadioButton(self.groupBox_forQuality)
        self.LowQual_radioButton.setGeometry(QRect(20, 60, 104, 23))
        self.LowQual_radioButton.setObjectName("webm_radioButton")
        self.progressBar = QProgressBar(self.centralwidget)
        self.progressBar.setGeometry(QRect(110, 180, 391, 23))
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName("progressBar")
        self.progressBar.setVisible(False)
        facebook_dwn.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(facebook_dwn)
        self.menubar.setGeometry(QRect(0, 0, 586, 25))
        self.menubar.setObjectName("menubar")
        facebook_dwn.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(facebook_dwn)
        self.statusbar.setObjectName("statusbar")
        facebook_dwn.setStatusBar(self.statusbar)

        self.retranslateUi(facebook_dwn)
        QMetaObject.connectSlotsByName(facebook_dwn)
    def __init__(self, parent=None) -> None:
        super().__init__(parent)

        self.mylayout = QVBoxLayout()
        self.setLayout(self.mylayout)
        self.btn1 = QPushButton('点我')
        self.btn1.setObjectName('btn1')
        self.browser = QTextBrowser()
        self.mylayout.addWidget(self.btn1)
        self.mylayout.addWidget(self.browser)

        # 自动连接信号与槽
        QMetaObject.connectSlotsByName(self)
        # 创建异步任务并启监听
        self.worker = MyTask()
        self.worker.mySignal.connect(self.handle_mysignal)
        # 启一个定时器监听异步任务是否结束
        self.timer = QTimer()
        self.timer.timeout.connect(self.handle_timer)
Exemple #21
0
    def setupUi(self):
        # self.frame = QtWidgets.QFrame(self.scrollAreaWidgetContents)
        self.setObjectName("Room")
        # self.setGeometry(QRect(30, 40, 221, 121))
        self.setFrameShape(QFrame.StyledPanel)
        self.setFrameShadow(QFrame.Raised)
        self.setStyleSheet(
            "/*background-image: url(./img/bg.bmp);*/border:none;")
        self.roomTop = QLabel(self)
        self.roomTop.setGeometry(QRect(80, 10, 110, 20))
        self.roomTop.setObjectName("roomTop")
        self.roomTop.setStyleSheet("text-align:center;")
        self.roomTop.setAlignment(Qt.AlignCenter)

        self.roomVSLeft = QPushButton(self)
        self.roomVSLeft.setGeometry(QRect(10, 70, 60, 60))
        self.roomVSLeft.setObjectName("roomVSLeft")
        self.roomVSLabelL = QLabel(self)
        self.roomVSLabelL.setGeometry(QRect(0, 130, 80, 20))
        self.roomVSLabelL.setObjectName("label")
        self.roomVSLabelL.setScaledContents(True)
        self.roomVSLabelL.setAlignment(Qt.AlignCenter)
        # self.roomVSLeft.setScaledContents(True)
        self.roomVSRight = QPushButton(self)
        self.roomVSRight.setGeometry(QRect(200, 70, 60, 60))
        self.roomVSRight.setObjectName("roomVSRight")
        self.roomVSLabelR = QLabel(self)
        self.roomVSLabelR.setGeometry(QRect(190, 130, 80, 20))
        self.roomVSLabelR.setObjectName("label")
        self.roomVSLabelR.setScaledContents(True)
        self.roomVSLabelR.setAlignment(Qt.AlignCenter)
        self.label = QLabel(self)
        self.label.setGeometry(QRect(80, 40, 110, 110))
        self.label.setObjectName("label")
        self.label.setScaledContents(True)
        # self.label.setStyleSheet("border:1px solid;")

        self.roomWatch = QPushButton(self)
        self.roomWatch.setGeometry(QRect(105, 160, 60, 30))
        self.roomWatch.setObjectName("roomWatch")

        self.retranslateUi()
        QMetaObject.connectSlotsByName(self)
Exemple #22
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        form_widget = load_ui_file(self)

        self.ui_find_button = self.findChild(QPushButton, name='findButton')
        self.ui_text_edit = self.findChild(QTextEdit, name='textEdit')
        self.ui_line_edit = self.findChild(QLineEdit, name='lineEdit')
        self.found = False

        QMetaObject.connectSlotsByName(self)

        self.ui_text_edit.setText(load_text_file())

        layout = QVBoxLayout()
        layout.addWidget(form_widget)
        self.setLayout(layout)

        self.setWindowTitle("Text Finder")
    def setupUi(self, PropertyWidget):
        PropertyWidget.setObjectName("PropertyWidget")
        PropertyWidget.resize(400, 300)
        self.widget_property = QWidget()
        self.setFeatures(QDockWidget.AllDockWidgetFeatures | \
            QDockWidget.DockWidgetVerticalTitleBar)
        self.widget_property.setObjectName("widget_property")
        self.verticalLayout = QVBoxLayout(self.widget_property)
        self.verticalLayout.setContentsMargins(2, 2, 2, 2)
        self.verticalLayout.setObjectName("verticalLayout")
        self.line_path = QLineEdit(self.widget_property)
        self.line_path.setObjectName("line_path")
        self.verticalLayout.addWidget(self.line_path)
        self.prop_browser = QtTreePropertyBrowser()
        self.verticalLayout.addWidget(self.prop_browser)
        PropertyWidget.setWidget(self.widget_property)

        self.retranslateUi(PropertyWidget)
        QMetaObject.connectSlotsByName(PropertyWidget)
Exemple #24
0
    def serviceDetailsDiscovered(self, newState: QtBt.QLowEnergyService.ServiceState):
        if newState != QtBt.QLowEnergyService.ServiceDiscovered:
            if newState != QtBt.QLowEnergyService.DiscoveringServices:
                QMetaObject.invokeMethod(self, "characteristicsUpdated", Qt.QueuedConnection)
            return

        # hoe de casting als in C++  ?
        # service = QtBt.QLowEnergyService.sender()
        service = self.sender()
        if not service:
            return

        chars = service.characteristics()
        for ch in chars:
            cInfo = CharacteristicsInfo(ch)
            # print(f'Characteristics name {cInfo.getName()},  value {cInfo.getValue()},  Uuid {cInfo.getUuid()},  Handle {cInfo.getHandle()},  Permission {cInfo.getPermission()}')
            self.m_characteristics.append(cInfo)

        self.characteristicsUpdated.emit()
Exemple #25
0
    def __init__(self, title, widget=None, closeButton=True, keySequence=None, isDialog=False, icon=None):
        QDialog.__init__(self, ctx.mainScreen)
        self.setObjectName("dialog")

        self.isDialog = isDialog
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        self.wlayout= QHBoxLayout()

        if icon:
            self.setStyleSheet("""QDialog QLabel{ margin-left:16px;margin-right:10px}
                                  QDialog#dialog {background-image:url(':/images/%s.png');
                                                  background-repeat:no-repeat;
                                                  background-position: top left; padding-left:500px;} """ % icon)

        self.windowTitle = windowTitle(self, closeButton)
        self.setTitle(title)
        #self.layout.setMargin(0)
        self.layout.addWidget(self.windowTitle)

        if widget:
            self.addWidget(widget)
            try:
                widget.finished[int].connect(self.reject)
            except:
                pass
            finally:
                try:
                    widget.resizeDialog[int,int].connect(self.resize)
                except:
                    pass
            

        if closeButton:
            self.windowTitle.pushButton.clicked.connect(self.reject)

        if keySequence:
            shortCut = QShortcut(keySequence, self)
            shortCut.activated.connect(self.reject)

        QMetaObject.connectSlotsByName(self)
        self.resize(10,10)
 def setupUi(self, MainWindow):
     MainWindow.setObjectName("Extractor of French Medical Codes")
     MainWindow.resize(758, 270)
     MainWindow.setWindowTitle("Extractor of French Medical Codes")
     self.centralwidget = QtWidgets.QWidget(MainWindow)
     self.centralwidget.setObjectName("centralwidget")
     self.pushButton = QtWidgets.QPushButton(self.centralwidget)
     self.pushButton.setGeometry(QRect(610, 10, 131, 31))
     self.pushButton.setObjectName("pushButton")
     self.pushButton.clicked.connect(self.openfile)
     self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
     self.pushButton_2.setGeometry(QRect(610, 70, 131, 31))
     self.pushButton_2.setObjectName("pushButton_2")
     self.pushButton_2.clicked.connect(self.multithread)
     self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
     self.lineEdit.setGeometry(QRect(30, 10, 551, 31))
     self.lineEdit.setObjectName("lineEdit")
     self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
     self.progressBar.setGeometry(QRect(30, 70, 551, 31))
     self.progressBar.setProperty("value", 0)
     self.progressBar.setObjectName("progressBar")
     self.progressBar.setAlignment(Qt.AlignCenter)
     self.progressBar1 = QtWidgets.QProgressBar(self.centralwidget)
     self.progressBar1.setGeometry(QRect(30, 130, 551, 31))
     self.progressBar1.setProperty("value", 0)
     self.progressBar1.setObjectName("progressBar")
     self.progressBar1.setAlignment(Qt.AlignCenter)
     self.progressBar2 = QtWidgets.QProgressBar(self.centralwidget)
     self.progressBar2.setGeometry(QRect(30, 190, 551, 31))
     self.progressBar2.setProperty("value", 0)
     self.progressBar2.setObjectName("progressBar")
     self.progressBar2.setAlignment(Qt.AlignCenter)
     MainWindow.setCentralWidget(self.centralwidget)
     self.menubar = QtWidgets.QMenuBar(MainWindow)
     self.menubar.setGeometry(QRect(0, 0, 758, 21))
     self.menubar.setObjectName("menubar")
     MainWindow.setMenuBar(self.menubar)
     self.statusbar = QtWidgets.QStatusBar(MainWindow)
     self.statusbar.setObjectName("statusbar")
     MainWindow.setStatusBar(self.statusbar)
     self.retranslateUi(MainWindow)
     QMetaObject.connectSlotsByName(MainWindow)
Exemple #27
0
    def Render(self, frame=None):
        """ Render an images sequence of the current template using Blender 2.62+ and the
        Blender Python API. """

        # Enable the Render button again
        self.disable_interface()

        # Init blender paths
        blend_file_path = os.path.join(info.PATH, "blender", "blend",
                                       self.selected_template)
        source_script = os.path.join(
            info.PATH, "blender", "scripts",
            self.selected_template.replace(".blend", ".py"))
        target_script = os.path.join(
            info.BLENDER_PATH, self.unique_folder_name,
            self.selected_template.replace(".blend", ".py"))

        # Copy the .py script associated with this template to the temp folder.  This will allow
        # OpenShot to inject the user-entered params into the Python script.
        # XXX: Note that copyfile() is used instead of copy(), as the original
        #      file may be readonly, and we don't want to duplicate those permissions
        shutil.copyfile(source_script, target_script)

        # Open new temp .py file, and inject the user parameters
        self.inject_params(target_script, frame)

        # Create new thread to launch the Blender executable (and read the output)
        if frame:
            # preview mode
            QMetaObject.invokeMethod(self.worker, 'Render',
                                     Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, True))
        else:
            # render mode
            # self.my_blender = BlenderCommand(self, blend_file_path, target_script, False)
            QMetaObject.invokeMethod(self.worker, 'Render',
                                     Qt.QueuedConnection,
                                     Q_ARG(str, blend_file_path),
                                     Q_ARG(str, target_script),
                                     Q_ARG(bool, False))
    def parseData(self, data):
        self._expandGui("projectsessions" in data.keys())
        self.setState(True)

        if "sessionpath" in data.keys():
            self.lbl_sessionpath.setText("Sessionpath: \t" +
                                         data["sessionpath"])
        if "trainOnHW" in data.keys():
            name = ""
            if "hardware" in data.keys():
                if len(data["hardware"]) >= data["trainOnHW"] and len(
                        data["hardware"]) is not 0:
                    name = data["hardware"][data["trainOnHW"]]
            self._setHardware(data["trainOnHW"], name)
        if "sessioncount" in data.keys():
            self.lbl_sessioncount.setText("Sessions on server: \t" +
                                          str(data["sessioncount"]))
        if "connections" in data.keys():
            self.lbl_connectioncount.setText("Connections open: \t" +
                                             str(data["connections"]))
        if "config" in data.keys():
            self._setConfig(data["config"])
        if "training" in data.keys():
            self._setTraining(data["training"])
        if "projectsessions" in data.keys():
            pdat = data["projectsessions"]
            self.lbl_projectsession.setText("Sessions of this project: \t" +
                                            str(pdat["count"]))
            self.lbl_projectsession_running.setText("    running/paused: \t" +
                                                    str(pdat["running"]))
            self.lbl_projectsession_finished.setText("    finished: \t\t" +
                                                     str(pdat["finished"]))
            self.lbl_projectsession_waiting.setText("    waiting: \t\t" +
                                                    str(pdat["waiting"]))
            other = pdat["count"] - pdat["finished"] - pdat["waiting"] - pdat[
                "running"]
            self.lbl_projectsession_other.setText("    other: \t\t" +
                                                  str(other))
        else:
            self.lbl_projectsession.setText("Sessions of this project: \t0")
        QMetaObject.invokeMethod(self.manager, "_updateSizeHint",
                                 Qt.QueuedConnection)
Exemple #29
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(748, 371)
        self.tableWidget = QTableWidget(Form)
        self.tableWidget.setGeometry(QRect(20, 60, 711, 291))
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.pushButton = QPushButton(Form)
        self.pushButton.setGeometry(QRect(360, 20, 89, 25))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QPushButton(Form)
        self.pushButton_2.setGeometry(QRect(480, 20, 89, 25))
        self.pushButton_2.setObjectName("pushButton_2")
        self.textEdit = QTextEdit(Form)
        self.textEdit.setGeometry(QRect(70, 20, 181, 31))
        self.textEdit.setObjectName("textEdit")

        self.retranslateUi(Form)
        QMetaObject.connectSlotsByName(Form)
Exemple #30
0
    def serviceDetailsDiscovered(
            self, newState: QtBt.QLowEnergyService.ServiceState):
        if newState != QtBt.QLowEnergyService.ServiceDiscovered:
            if newState != QtBt.QLowEnergyService.DiscoveringServices:
                print('Wordt dit gebruikt? En waarom?')
                QMetaObject.invokeMethod(self, "characteristicsUpdated",
                                         Qt.QueuedConnection)
            return

        service = self.sender()
        if not service:
            return

        chars = service.characteristics()
        for ch in chars:
            c = CharacteristicInfo(ch)
            # print(f'Characteristic name {c.getName()}, Permission {c.getPermission()}')
            self.m_characteristics.append(c)

        self.characteristicsUpdated.emit()
Exemple #31
0
    def __init__(self, parent):
        super(QCustomTitleBar, self).__init__(parent)
        # print ( "[create] QCustomTitleBar for parent", parent )
        self.dragging = False
        self.createFromDraging = False
        self.mouseStartPos = QCursor.pos()

        if parent.metaObject().indexOfSignal(
                QMetaObject.normalizedSignature("contentsChanged")) != -1:
            parent.contentsChanged.connect(self.onFrameContentsChanged)

        myLayout = QHBoxLayout(self)
        myLayout.setContentsMargins(0, 0, 0, 0)
        myLayout.setSpacing(0)

        self.setLayout(myLayout)

        self.caption = QLabel(self)
        self.caption.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
        self.caption.setSizePolicy(QSizePolicy.Expanding,
                                   QSizePolicy.Preferred)

        self.sysMenuButton = QToolButton(self)
        self.onIconChange()
        self.sysMenuButton.setObjectName("sysMenu")
        self.sysMenuButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.sysMenuButton.installEventFilter(self)
        myLayout.addWidget(self.sysMenuButton)
        myLayout.addWidget(self.caption, 1)

        self.minimizeButton = QToolButton(self)
        self.minimizeButton.setObjectName("minimizeButton")
        self.minimizeButton.setFocusPolicy(QtCore.Qt.NoFocus)
        # self.minimizeButton.clicked.connect ( parent.showMinimized )
        self.minimizeButton.clicked.connect(
            lambda: parent.setWindowState(Qt.WindowMinimized))
        myLayout.addWidget(self.minimizeButton)

        self.maximizeButton = QToolButton(self)
        self.maximizeButton.setObjectName("maximizeButton")
        self.maximizeButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.maximizeButton.clicked.connect(self.toggleMaximizedParent)
        myLayout.addWidget(self.maximizeButton)

        self.closeButton = QToolButton(self)
        self.closeButton.setObjectName("closeButton")
        self.closeButton.setFocusPolicy(QtCore.Qt.NoFocus)
        self.closeButton.clicked.connect(self.onCloseButtonClicked)
        myLayout.addWidget(self.closeButton)

        parent.windowTitleChanged.connect(self.caption.setText)
        parent.windowIconChanged.connect(self.onIconChange)

        self.onFrameContentsChanged(parent)
 def __init__(self, MainWin):
     # Main Window
     MainWin.setObjectName("AboutWindow")
     MainWin.setWindowIcon(QIcon(":/images/deriva-white.png"))
     MainWin.setWindowTitle(MainWin.tr(MainWin.window_title))
     MainWin.resize(640, 480)
     self.centralWidget = QWidget(MainWin)
     self.centralWidget.setObjectName("centralWidget")
     MainWin.setCentralWidget(self.centralWidget)
     self.verticalLayout = QVBoxLayout(self.centralWidget)
     self.verticalLayout.setContentsMargins(11, 11, 11, 11)
     self.verticalLayout.setSpacing(6)
     self.verticalLayout.setObjectName("verticalLayout")
     self.webview = QWebEngineView(MainWin)
     self.verticalLayout.addWidget(self.webview)
     data = get_resource_file_data()
     html = markdown.markdown(data.data().decode("utf-8"))
     self.webview.setHtml(html)
     # finalize UI setup
     QMetaObject.connectSlotsByName(MainWin)
Exemple #33
0
    def setupUi(self, Form):
        if not Form.objectName():
            Form.setObjectName(u"Form")
        Form.resize(315, 320)
        self.lblUno = QLabel(Form)
        self.lblUno.setObjectName(u"lblUno")
        self.lblUno.setGeometry(QRect(90, 20, 101, 19))
        self.lineUno = QLineEdit(Form)
        self.lineUno.setObjectName(u"lineUno")
        self.lineUno.setGeometry(QRect(60, 80, 181, 25))
        self.btnUno = QPushButton(Form)
        self.btnUno.setObjectName(u"btnUno")
        self.btnUno.setGeometry(QRect(70, 110, 161, 34))
        self.btnAbrir = QPushButton(Form)
        self.btnAbrir.setObjectName(u"btnAbrir")
        self.btnAbrir.setGeometry(QRect(70, 260, 171, 34))

        self.retranslateUi(Form)

        QMetaObject.connectSlotsByName(Form)
Exemple #34
0
    def __init__(self, parent, container: Container) -> None:
        super().__init__(parent)
        self.setMinimumHeight(50)
        self.setMaximumHeight(50)
        self.horizontalLayout = QHBoxLayout(self)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        _translate = QCoreApplication.translate

        img_name = container.name
        name_part = container.name.split('/')
        if len(name_part) > 1:
            img_name = name_part[1]
        self.pic = AppAvatar(text_utils.getSimpleName(img_name),
                             parent=self,
                             radius=22)
        self.horizontalLayout.addWidget(self.pic)

        self.infoWidget = QWidget(self)
        self.infoWidget.setObjectName("infoWidget")
        self.infoLayout = QVBoxLayout(self.infoWidget)
        self.infoLayout.setContentsMargins(5, 0, 0, 0)

        self.name = QLabel(self)
        self.name.setObjectName("name")
        self.infoLayout.addWidget(self.name)

        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(2)
        sizePolicy.setVerticalStretch(2)

        self.infoWidget.setSizePolicy(sizePolicy)
        self.horizontalLayout.addWidget(self.infoWidget)

        self.start = QPushButton(self)
        self.start.setObjectName("start")
        self.horizontalLayout.addWidget(self.start)
        self.start.setText(_translate("widget", "Start"))
        self.name.setText(_translate("widget", container.name))

        QMetaObject.connectSlotsByName(self)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(448, 640)
        MainWindow.setStyleSheet("backgoound-color: #f6f8fa")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QRect(140, 30, 131, 41))
        font = QFont()
        font.setPointSize(15)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEditName = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEditName.setGeometry(QRect(60, 100, 113, 20))
        self.lineEditName.setStyleSheet(
            "color: black; background-color:white ")
        self.lineEditName.setObjectName("lineEditName")
        self.lineEditPassword = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEditPassword.setGeometry(QRect(240, 100, 113, 20))
        self.lineEditPassword.setStyleSheet(
            "color: black; background-color:white ")
        self.lineEditPassword.setObjectName("lineEditPassword")
        self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget)
        self.textBrowser.setGeometry(QRect(60, 150, 301, 291))
        self.textBrowser.setStyleSheet("color: black; background-color:white ")
        self.textBrowser.setObjectName("textBrowser")
        self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
        self.textEdit.setGeometry(QRect(60, 460, 231, 61))
        self.textEdit.setStyleSheet("color: black; background-color:white ")
        self.textEdit.setObjectName("textEdit")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QRect(300, 462, 61, 61))
        self.pushButton.setStyleSheet("color: black; background-color:white ")
        self.pushButton.setObjectName("pushButton")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
    def setupUi(self):
        self.setObjectName("Dialog")
        self.setFixedSize(464, 257)
        icon = QIcon()
        icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.setSizeGripEnabled(False)
        self.setModal(True)
        self.textBrowser = QTextBrowser(self)
        self.textBrowser.setGeometry(QRect(0, 130, 491, 192))
        self.textBrowser.setObjectName("textBrowser")
        self.label = QLabel(self)
        self.label.setGeometry(QRect(0, 0, 641, 131))
        self.label.setText("")
        self.label.setPixmap(QPixmap("./resource/about.jpg"))
        self.label.setScaledContents(True)
        self.label.setObjectName("label")

        self.retranslateUi()
        QMetaObject.connectSlotsByName(self)
        self.show()
Exemple #37
0
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(452, 330)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setGeometry(QRect(150, 220, 161, 31))
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 452, 26))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
Exemple #38
0
    def setup_ui(self) -> None:
        self.widget_window.setObjectName("Form")
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout.setObjectName("gridLayout")

        self.widget_window.setFixedSize(650, 300)
        self.gridLayoutWidget.setGeometry(QRect(0, 0, 650, 300))
        self.gridLayout.setContentsMargins(5, 5, 5, 5)

        # noinspection PyArgumentList,PyCallByClass
        QMetaObject.connectSlotsByName(self.widget_window)

        font = QFont()
        font.setPointSize(10)
        self.gridLayoutWidget.setFont(font)

        # 背景色
        self.set_window_background()

        self.load_ui()
        self.show_ui()
Exemple #39
0
	def __init__ ( self, parent, startingLayout ):
		super ().__init__ ( parent )
		self.owner = parent
		self.startingLayout = startingLayout
		self.toolManager = None
		self.defaultLayoutCallback = None
		self.menu = None
		self.registry = {}
		self.spawned = {}
		self.layoutChangedConnection = QMetaObject.Connection ()
		self.owner = None
		parent.installEventFilter ( self )
    def __init__(self):
        super(Widget, self).__init__()

        layout = QVBoxLayout(self)

        self.gif = GifWidget(self, "../images/yin.gif")

        startBtn = QPushButton("开始", self)
        startBtn.setObjectName("startBtn")

        stopBtn = QPushButton("停止", self)
        stopBtn.setObjectName("stopBtn")

        changeBtn = QPushButton("改变第二个图", self)
        changeBtn.setObjectName("changeBtn")

        layout.addWidget(self.gif)
        layout.addWidget(startBtn)
        layout.addWidget(stopBtn)
        layout.addWidget(changeBtn)

        QMetaObject.connectSlotsByName(self)    # 通过objectname注册信号
    def __init__(self):
        super(TestNinePatchLabel, self).__init__()
        self.resize(400, 600)

        self.listWidget = QListWidget(self)
        self.listWidget.setObjectName("listWidget")
        self.listWidget.setStyleSheet("""
            QListWidget::item:selected {
                background: rgba(0,0,0,0);
            }
            QListWidget::item:hover {
                background: rgba(0,0,0,0);
            }
        """)

        self.textEdit = QTextEdit(self)
        self.textEdit.setMaximumHeight(100)
        self.textEdit.setObjectName("textEdit")

        self.sendBtn = QPushButton("发送", self)
        self.sendBtn.setObjectName("sendBtn")

        hlayout = QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)
        hlayout.setSpacing(0)
        hlayout.addWidget(self.textEdit)
        hlayout.addWidget(self.sendBtn)

        vlayout = QVBoxLayout(self)
        vlayout.setContentsMargins(0, 0, 0, 0)
        vlayout.setSpacing(0)
        vlayout.addWidget(self.listWidget)
        vlayout.addItem(hlayout)

        QMetaObject.connectSlotsByName(self)    # 通过objectname注册信号
        self.init()
        self.setStyleSheet(SCROLLBARSTYLE)
 def wrapper(obj, *args):
     # XXX: support kwargs?
     qargs = [Q_ARG(t, v) for t, v in zip(self.args, args)]
     invoke_args = [obj._instance, self.name]
     invoke_args.append(Qt.DirectConnection)
     rtype = self.returnType
     if rtype:
         invoke_args.append(Q_RETURN_ARG(rtype))
     invoke_args.extend(qargs)
     try:
         result = QMetaObject.invokeMethod(*invoke_args)
         error_msg = str(qApp.property("MIKRO_EXCEPTION").toString())
         if error_msg:
             # clear message
             qApp.setProperty("MIKRO_EXCEPTION", "") # TODO: "" was QVariant(): check that it's correct (ale/20141002)
             raise Exception(error_msg)
     except RuntimeError as e:
         raise TypeError(
             "%s.%s(%r) call failed: %s" % (obj, self.name, args, e))
     return wrap(result)
 def __signatures(self):
     """
     Private slot to get the signatures.
     
     @return list of signatures (list of strings)
     """
     if self.__module is None:
         return []
         
     signatures = []
     clsName = self.classNameCombo.currentText()
     if clsName:
         cls = self.__module.classes[clsName]
         for meth in list(cls.methods.values()):
             if meth.name.startswith("on_"):
                 if meth.pyqtSignature is not None:
                     sig = ", ".join(
                         [bytes(QMetaObject.normalizedType(t)).decode()
                          for t in meth.pyqtSignature.split(",")])
                     signatures.append("{0}({1})".format(meth.name, sig))
                 else:
                     signatures.append(meth.name)
     return signatures
Exemple #44
0
def use_qml_fun(root_view, fun_parent_name, fun_name, args):
    parent_view = root_view.findChild(QObject, fun_parent_name)
    q_arg = QVariant(args)
    QMetaObject.invokeMethod(parent_view, fun_name, Qt.DirectConnection, Q_ARG(QVariant, q_arg))
Exemple #45
0
    def ping(self, arg):
        QMetaObject.invokeMethod(QCoreApplication.instance(), 'quit')

        return "ping(\"%s\") got called" % arg
Exemple #46
0
    def setupUi(self, Tip, name = "", head = "", mood = "", pic1 = "", pic2 = "", pic3 = ""):
        Tip.setObjectName("Tip")
        Tip.resize(275, 180)
        size = QSize(275, 180)
        Tip.setMinimumSize(size)
        Tip.setMaximumSize(size)
        Tip.setWindowTitle("")
        self.name = name
        self.head = head
        self.mood = mood
        self.pic1 = pic1
        self.pic2 = pic2
        self.pic3 = pic3

        self.mainWidget = QWidget(Tip)
        self.mainWidget.setObjectName("tip")

        self.verticalLayout = QVBoxLayout(self.mainWidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.widget = QWidget(self.mainWidget)
        self.widget.setObjectName("widget")
        self.widget.setMinimumHeight(80)
        self.widget.setMaximumHeight(80)

        self.horizontalLayout_2 = QHBoxLayout(self.widget)
        self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.itemHeadLabel = QLabel(self.widget)
        self.itemHeadLabel.setMinimumSize(QSize(80, 80))
        self.itemHeadLabel.setMaximumSize(QSize(80, 80))
        self.itemHeadLabel.setOpenExternalLinks(True)
        self.itemHeadLabel.setObjectName("itemHeadLabel")
        self.horizontalLayout_2.addWidget(self.itemHeadLabel)
        self.widget_3 = QWidget(self.widget)

        self.verticalLayout_2 = QVBoxLayout(self.widget_3)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.itemNameLabel = QLabel(self.widget_3)

        # self.itemNameLabel.setOpenExternalLinks(True)
        self.itemNameLabel.setObjectName("itemNameLabel")
        self.verticalLayout_2.addWidget(self.itemNameLabel)
        self.itemMoodLabel = QLabel(self.widget_3)

        # self.itemMoodLabel.setOpenExternalLinks(True)
        self.itemMoodLabel.setObjectName("itemMoodLabel")
        self.verticalLayout_2.addWidget(self.itemMoodLabel)
        self.horizontalLayout_2.addWidget(self.widget_3)
        self.verticalLayout.addWidget(self.widget)
        self.widget_2 = QWidget(self.mainWidget)
        self.widget_2.setMinimumSize(QSize(0, 80))
        self.widget_2.setMaximumSize(QSize(16777215, 80))
        self.widget_2.setObjectName("widget_2")
        self.horizontalLayout = QHBoxLayout(self.widget_2)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.itemPicLabel_1 = QLabel(self.widget_2)
        self.itemPicLabel_1.setObjectName("itemPicLabel_1")
        self.horizontalLayout.addWidget(self.itemPicLabel_1)
        self.itemPicLabel_2 = QLabel(self.widget_2)
        self.itemPicLabel_2.setObjectName("itemPicLabel_2")
        self.horizontalLayout.addWidget(self.itemPicLabel_2)
        self.itemPicLabel_3 = QLabel(self.widget_2)
        self.itemPicLabel_3.setObjectName("itemPicLabel_3")
        self.horizontalLayout.addWidget(self.itemPicLabel_3)
        self.verticalLayout.addWidget(self.widget_2)

        self.mainWidget.setLayout(self.verticalLayout)

        self.retranslateUi(self.mainWidget)
        QMetaObject.connectSlotsByName(Tip)
Exemple #47
0
    if func is not None:
        _qInstallMessageHandler(wrapped)
    else:
        _qInstallMessageHandler(None)
    qInstallMsgHandler._handler = func
    return old


def _QMetaMethod_signature(self):
    # Return the method signature as bytes
    return bytes(self.methodSignature())


QMetaMethod.signature = _QMetaMethod_signature

SIGNAL = lambda str: QMetaObject.normalizedSignature(str)
SLOT = lambda str: QMetaObject.normalisedSignature(str)


def _QObject_emit(self, sig, *args):
    warnings.warn(
        "QObject.emit is obsolete and is removed in PyQt5. "
        "Use new style signal.emit(...)",
        stacklevel=2
    )
    meta = self.metaObject()
    sindex = meta.indexOfSignal(sig)

    if sindex == -1:
        warnings.warn(
            "No signal '{}' defined in {}".format(sig, type(self).__name__),
Exemple #48
0
app.setOrganizationName("BOGUS_NAME")
app.setOrganizationDomain("bogosity.com")
app.setApplicationName("BOGUS")
print("OK.")

# This test is using signals and will only work if PySide properly accepts
# compiled functions as callables.

from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QMetaObject

class Communicate(QObject):
    speak = pyqtSignal(int)
    def __init__(self,name = "",parent = None):
        QObject.__init__(self,parent)
        self.setObjectName(name)

class Speaker(QObject):
    @pyqtSlot(int)
    def on_communicator_speak(self, stuff):
        print(stuff)

speaker = Speaker()
someone = Communicate(name = "communicator",parent = speaker)

QMetaObject.connectSlotsByName(speaker)

print("The answer is:",end = "")
# emit  'speak' signal
someone.speak.emit(42)
print("Slot should have made output by now.")
Exemple #49
0
 def asyncSetProgress(self, progress):
     QMetaObject.invokeMethod(self.progressBar, 'setValue', Qt.QueuedConnection, Q_ARG(int, progress))
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(820, 760)
        MainWindow.setMinimumSize(QSize(720, 560))
        MainWindow.setWindowTitle("BW-MapEdit")
        #MainWindow.setWindowTitle("Nep-Nep")


        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        MainWindow.setCentralWidget(self.centralwidget)

        self.horizontalLayout = QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")


        self.scrollArea = QScrollArea(self.centralwidget)
        self.scrollArea.setWidgetResizable(True)

        self.bw_map_screen = BWMapViewer(self.centralwidget)
        self.scrollArea.setWidget(self.bw_map_screen)
        self.horizontalLayout.addWidget(self.scrollArea)

        #self.horizontalLayout.addWidget(self.bw_map_screen)

        self.entity_list_widget = BWEntityListWidget(self.centralwidget)
        self.entity_list_widget.setMaximumSize(QSize(300, 16777215))
        self.entity_list_widget.setObjectName("entity_list_widget")
        self.horizontalLayout.addWidget(self.entity_list_widget)

        spacerItem = QSpacerItem(10, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.horizontalLayout.addItem(spacerItem)

        self.vertLayoutWidget = QWidget(self.centralwidget)
        self.vertLayoutWidget.setMaximumSize(QSize(250, 1200))
        self.verticalLayout = QVBoxLayout(self.vertLayoutWidget)
        self.verticalLayout.setObjectName("verticalLayout")
        #self.verticalLayout.
        self.button_clone_entity = QPushButton(self.centralwidget)
        self.button_clone_entity.setObjectName("button_clone_entity")
        self.verticalLayout.addWidget(self.button_clone_entity)

        self.button_remove_entity = QPushButton(self.centralwidget)
        self.button_remove_entity.setObjectName("button_remove_entity")
        self.verticalLayout.addWidget(self.button_remove_entity)

        self.button_move_entity = QPushButton(self.centralwidget)
        self.button_move_entity.setObjectName("button_move_entity")
        self.verticalLayout.addWidget(self.button_move_entity)

        self.button_show_passengers = QPushButton(self.centralwidget)
        self.button_show_passengers.setObjectName("button_move_entity")
        self.verticalLayout.addWidget(self.button_show_passengers)


        self.gridLayout = QGridLayout()
        self.gridLayout.setObjectName("gridLayout")

        self.button_zoom_in = QPushButton(self.centralwidget)
        self.button_zoom_in.setObjectName("button_zoom_in")
        self.gridLayout.addWidget(self.button_zoom_in, 0, 0, 0, 1)

        self.button_zoom_out = QPushButton(self.centralwidget)
        self.button_zoom_out.setObjectName("button_zoom_out")
        self.gridLayout.addWidget(self.button_zoom_out, 0, 1, 0, 1)

        self.button_edit_xml = QPushButton(self.centralwidget)
        self.button_edit_xml.setObjectName("button_edit_xml")

        self.button_edit_base_xml = QPushButton(self.centralwidget)
        self.button_edit_base_xml.setObjectName("button_edit_base_xml")


        self.verticalLayout.addLayout(self.gridLayout)
        self.verticalLayout.addWidget(self.button_edit_xml)
        self.verticalLayout.addWidget(self.button_edit_base_xml)

        spacerItem1 = QSpacerItem(10, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.verticalLayout.addItem(spacerItem1)

        self.verticalLayout_2 = QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")


        self.lineedit_angle = QLineEdit(self.centralwidget)
        self.lineedit_angle.setObjectName("lineedit_angle")
        self.lineedit_angle.setPlaceholderText("Angle")

        self.label_object_id = QLabel(self.centralwidget)
        self.label_object_id.setObjectName("label_object_id")
         #TextSelectableByCursor

        self.label_position = QLabel(self.centralwidget)
        self.label_position.setObjectName("label_position")

        self.label_model_name = QLabel(self.centralwidget)
        self.label_model_name.setObjectName("label_model_name")

        self.label_4 = QLabel(self.centralwidget)
        self.label_4.setObjectName("label_4")

        self.label_5 = QLabel(self.centralwidget)
        self.label_5.setObjectName("label_5")

        for label in (self.label_object_id, self.label_position, self.label_model_name, self.label_4, self.label_5):
            label.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)

        self.verticalLayout_2.addWidget(self.lineedit_angle)
        self.verticalLayout_2.addWidget(self.label_object_id)
        self.verticalLayout_2.addWidget(self.label_position)
        self.verticalLayout_2.addWidget(self.label_model_name)
        self.verticalLayout_2.addWidget(self.label_4)
        self.verticalLayout_2.addWidget(self.label_5)


        self.verticalLayout.addLayout(self.verticalLayout_2)

        self.horizontalLayout.addWidget(self.vertLayoutWidget)

        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QRect(0, 0, 820, 29))
        self.menubar.setObjectName("menubar")
        self.file_menu = QMenu(self.menubar)
        self.file_menu.setObjectName("menuLoad")



        self.file_load_action = QAction("Load", self)
        self.file_load_action.triggered.connect(self.button_load_level)
        self.file_menu.addAction(self.file_load_action)
        self.file_save_action = QAction("Save", self)
        self.file_save_action.triggered.connect(self.button_save_level)
        self.file_menu.addAction(self.file_save_action)

        self.visibility_menu = MenuDontClose(self.menubar)#QMenu(self.menubar)
        self.visibility_menu.setObjectName("visibility")



        #self.visibility_menu.addAction(self.toggle_action)
        self.visibility_actions = []

        self.terrain_menu = QMenu(self.menubar)
        self.terrain_menu.setObjectName("terrain")

        self.terrain_load_action = QAction("Load Terrain", self)
        self.terrain_load_action.triggered.connect(self.button_terrain_load_action)
        self.terrain_menu.addAction(self.terrain_load_action)
        self.terrain_display_actions = []
        self.setup_terrain_display_toggles()

        #self.menuLoad_2 = QMenu(self.menubar)
        #self.menuLoad_2.setObjectName("menuLoad_2")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.menubar.addAction(self.file_menu.menuAction())
        #self.menubar.addAction(self.menuLoad_2.menuAction())
        self.menubar.addAction(self.visibility_menu.menuAction())
        self.menubar.addAction(self.terrain_menu.menuAction())
        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
Exemple #51
0
 def asyncSetSummary(self, summary):
     QMetaObject.invokeMethod(self.summaryLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, summary))
Exemple #52
0
    def paintEvent(self, event):
        option = QStyleOption()
        option.initFrom(self)

        contents_rect = self.style().subElementRect(QStyle.SE_FrameContents, option, self) or self.contentsRect()  # the SE_FrameContents rect is Null unless the stylesheet defines decorations

        if self.graphStyle == self.BarStyle:
            graph_width = self.__dict__['graph_width'] = int(ceil(float(contents_rect.width()) / self.horizontalPixelsPerUnit))
        else:
            graph_width = self.__dict__['graph_width'] = int(ceil(float(contents_rect.width() - 1) / self.horizontalPixelsPerUnit) + 1)

        max_value = self.__dict__['max_value'] = max(chain([0], *(islice(reversed(graph.data), graph_width) for graph in self.graphs if graph.enabled)))

        if self.graphHeight == self.AutomaticHeight or self.graphHeight < 0:
            graph_height = self.__dict__['graph_height'] = max(self.scaler.get_height(max_value), self.minHeight)
        else:
            graph_height = self.__dict__['graph_height'] = max(self.graphHeight, self.minHeight)

        if self.graphStyle == self.BarStyle:
            height_scaling = float(contents_rect.height()) / graph_height
        else:
            height_scaling = float(contents_rect.height() - self.lineThickness) / graph_height

        painter = QStylePainter(self)
        painter.drawPrimitive(QStyle.PE_Widget, option)

        painter.setClipRect(contents_rect)

        painter.save()
        painter.translate(contents_rect.x() + contents_rect.width() - 1, contents_rect.y() + contents_rect.height() - 1)
        painter.scale(-1, -1)

        painter.setRenderHint(QStylePainter.Antialiasing, self.graphStyle != self.BarStyle)

        for graph in (graph for graph in self.graphs if graph.enabled and graph.data):
            if self.boundary is not None and 0 < self.boundary < graph_height:
                boundary_width = min(5.0/height_scaling, self.boundary-0, graph_height-self.boundary)
                pen_color = QLinearGradient(0, (self.boundary - boundary_width) * height_scaling, 0, (self.boundary + boundary_width) * height_scaling)
                pen_color.setColorAt(0, graph.color)
                pen_color.setColorAt(1, graph.over_boundary_color)
                brush_color = QLinearGradient(0, (self.boundary - boundary_width) * height_scaling, 0, (self.boundary + boundary_width) * height_scaling)
                brush_color.setColorAt(0, self.color_with_alpha(graph.color, self.fillTransparency))
                brush_color.setColorAt(1, self.color_with_alpha(graph.over_boundary_color, self.fillTransparency))
            else:
                pen_color = graph.color
                brush_color = self.color_with_alpha(graph.color, self.fillTransparency)
            dataset = islice(reversed(graph.data), graph_width)
            if self.graphStyle == self.BarStyle:
                lines = [QLineF(x*self.horizontalPixelsPerUnit, 0, x*self.horizontalPixelsPerUnit, y*height_scaling) for x, y in enumerate(dataset)]
                painter.setPen(QPen(pen_color, self.lineThickness))
                painter.drawLines(lines)
            else:
                painter.translate(0, +self.lineThickness/2 - 1)

                if self.smoothEnvelope and self.smoothFactor > 0:
                    min_value = 0
                    max_value = graph_height * height_scaling
                    cx_offset = self.horizontalPixelsPerUnit / 3.0
                    smoothness = self.smoothFactor

                    last_values = deque(3*[next(dataset) * height_scaling], maxlen=3)  # last 3 values: 0 last, 1 previous, 2 previous previous

                    envelope = QPainterPath()
                    envelope.moveTo(0, last_values[0])
                    for x, y in enumerate(dataset, 1):
                        x = x * self.horizontalPixelsPerUnit
                        y = y * height_scaling * (1 - smoothness) + last_values[0] * smoothness
                        last_values.appendleft(y)
                        c1x = x - cx_offset * 2
                        c2x = x - cx_offset
                        c1y = limit((1 + smoothness) * last_values[1] - smoothness * last_values[2], min_value, max_value)  # same gradient as previous previous value to previous value
                        c2y = limit((1 - smoothness) * last_values[0] + smoothness * last_values[1], min_value, max_value)  # same gradient as previous value to last value
                        envelope.cubicTo(c1x, c1y, c2x, c2y, x, y)
                else:
                    envelope = QPainterPath()
                    envelope.addPolygon(QPolygonF([QPointF(x*self.horizontalPixelsPerUnit, y*height_scaling) for x, y in enumerate(dataset)]))

                if self.fillEnvelope or graph.fill_envelope:
                    first_element = envelope.elementAt(0)
                    last_element = envelope.elementAt(envelope.elementCount() - 1)
                    fill_path = QPainterPath()
                    fill_path.moveTo(last_element.x, last_element.y)
                    fill_path.lineTo(last_element.x + 1, last_element.y)
                    fill_path.lineTo(last_element.x + 1, -self.lineThickness)
                    fill_path.lineTo(-self.lineThickness, -self.lineThickness)
                    fill_path.lineTo(-self.lineThickness, first_element.y)
                    fill_path.connectPath(envelope)
                    painter.fillPath(fill_path, brush_color)

                painter.strokePath(envelope, QPen(pen_color, self.lineThickness, join=Qt.RoundJoin))

                painter.translate(0, -self.lineThickness/2 + 1)

        if self.boundary is not None and self.boundaryColor:
            painter.setRenderHint(QStylePainter.Antialiasing, False)
            painter.setPen(QPen(self.boundaryColor, 1.0))
            painter.drawLine(0, self.boundary*height_scaling, contents_rect.width(), self.boundary*height_scaling)

        painter.restore()

        # queue the 'updated' signal to be emitted after returning to the main loop
        QMetaObject.invokeMethod(self, 'updated', Qt.QueuedConnection)
Exemple #53
0
 def asyncSetStatus(self, status, maxProgress = 0):
     QMetaObject.invokeMethod(self.statusLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, status))
     QMetaObject.invokeMethod(self.progressBar, 'setMaximum', Qt.QueuedConnection, Q_ARG(int, maxProgress))
Exemple #54
0
 def asyncSetStudyLabelText(self, text):
     QMetaObject.invokeMethod(self.studyLabel, 'setText', Qt.QueuedConnection, Q_ARG(str, text))
 def login_result(self, string):
     # print("got result", string)
     obj = self.engine.rootObjects()[0]
     myObj = obj.findChild(QObject, "loginHandle")
     QMetaObject.invokeMethod(myObj, "loginResult", Qt.QueuedConnection, Q_ARG(QVariant, string))
    def __init__(self, parent=None, arguments=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

        self.ctimer = QTimer()
        #self.stimer = QTimer()

        self.null_extra_arg = False

        if arguments.title:
            self.setWindowTitle(arguments.title)
        if arguments.icon:
            icon = QIcon(arguments.icon)
            self.setWindowIcon(icon)
        if not arguments.progressbar:
            self.progressBar.hide()
        else:
            self.constant()
            self.ctimer.timeout.connect(self.constantUpdate)
            QMetaObject.connectSlotsByName(self)


        self.button_ids = ["details_button", "ok_button", "yes_button", "no_button", "continue_button", "cancel_button"]
        self.button_names = {
            "details_button":_("Details"), 
            "ok_button":_("Ok"), 
            "yes_button":_("Yes"), 
            "no_button":_("No"), 
            "continue_button":_("Continue"),
            "cancel_button":_("Cancel")
        }
        self.active_buttons = dict((e, False) for e in self.button_names)
        self.null_extra_arg = True

        if arguments.yesno or arguments.warningyesno:
            self.enable_buttons(["yes_button", "no_button"])
            if arguments.yesno:
                self.label.setText(arguments.yesno)
            else:
                self.label.setText(arguments.warningyesno)

        elif arguments.yesnocancel or arguments.warningyesnocancel:
            self.enable_buttons(["yes_button", "no_button", "cancel_button"])
            if arguments.yesnocancel:
                self.label.setText(arguments.yesnocancel)
            else:
                self.label.setText(arguments.warningyesnocancel)

        elif arguments.sorry or arguments.error or arguments.msgbox:
            self.enable_buttons(["ok_button"])
            if arguments.sorry:
                self.label.setText(arguments.sorry)
            elif arguments.error:
                self.label.setText(arguments.error)
            else:
                self.label.setText(arguments.msgbox)

        elif arguments.detailedsorry or arguments.detailederror:
            self.enable_buttons(["details_button", "ok_button"])
            if arguments.detailedsorry:
                self.label.setText(arguments.detailedsorry[0])
                self.details = arguments.detailedsorry[1]
            else:
                self.label.setText(arguments.detailederror[0])
                self.details = arguments.detailederror[1]

        elif arguments.warningcontinuecancel:
            self.enable_buttons(["continue_button", "cancel_button"])
            self.label.setText(arguments.warningcontinuecancel)
        
        elif arguments.progressbar:
            self.label.setText(arguments.progressbar[0])
            

        if not self.null_extra_arg:
            if not arguments.extra_arguments:
                sys.exit(_("There is no extra argument!"))

        self.create_buttons()

        if arguments.yeslabel and self.active_buttons["yes_button"]:
            self.buttons["yes_button"].setText(arguments.yeslabel)
        if arguments.nolabel and self.active_buttons["no_button"]:
            self.buttons["no_button"].setText(arguments.nolabel)
        if arguments.cancellabel and self.active_buttons["cancel_button"]:
            self.buttons["cancel_button"].setText(arguments.cancellabel)
        if arguments.continuelabel and self.active_buttons["continue_button"]:
            self.buttons["continue_button"].setText(arguments.continuelabel)
Exemple #57
0
 def asyncUnlockUi(self, status = ''):
     QMetaObject.invokeMethod(self, 'setEnabled', Qt.QueuedConnection, Q_ARG(bool, True))
     QMetaObject.invokeMethod(self.progressBar, 'setVisible', Qt.QueuedConnection, Q_ARG(bool, False))
     self.asyncSetStatus(status)
Exemple #58
0
 def moveEvent(self, event):
     QMetaObject.invokeMethod(self, "_onWindowGeometryChanged", Qt.QueuedConnection);
    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()
Exemple #60
0
def messageHandler(msgType, *args):
    """
    Module function handling messages.
    
    @param msgType type of the message (integer, QtMsgType)
    @param args message handler arguments, for PyQt4 message to be shown
        (bytes), for PyQt5 context information (QMessageLogContext) and
        message to be shown (bytes)
    """
    if len(args) == 2:
        context = args[0]
        message = args[1]
    else:
        message = args[0]
    if __msgHandlerDialog:
        try:
            if msgType == QtDebugMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Debug Message:")
            elif msgType == QtWarningMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Warning:")
            elif msgType == QtCriticalMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Critical:")
            elif msgType == QtFatalMsg:
                messageType = QCoreApplication.translate(
                    "E5ErrorMessage", "Fatal Error:")
            if isinstance(message, bytes):
                message = Utilities.decodeBytes(message)
            message = message.replace("\r\n", "<br/>")\
                             .replace("\n", "<br/>")\
                             .replace("\r", "<br/>")
            if len(args) == 2:
                msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \
                    "<p>Line: {3}</p><p>Function: {4}</p>".format(
                        messageType, Utilities.html_uencode(message),
                        context.file, context.line, context.function)
            else:
                msg = "<p><b>{0}</b></p><p>{1}</p>".format(
                    messageType, Utilities.html_uencode(message))
            if QThread.currentThread() == qApp.thread():
                __msgHandlerDialog.showMessage(msg)
            else:
                QMetaObject.invokeMethod(
                    __msgHandlerDialog,
                    "showMessage",
                    Qt.QueuedConnection,
                    Q_ARG(str, msg))
            return
        except RuntimeError:
            pass
    elif __origMsgHandler:
        __origMsgHandler(msgType, message)
        return
    
    if msgType == QtDebugMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Debug Message")
    elif msgType == QtWarningMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Warning")
    elif msgType == QtCriticalMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Critical")
    elif msgType == QtFatalMsg:
        messageType = QCoreApplication.translate(
            "E5ErrorMessage", "Fatal Error")
    if isinstance(message, bytes):
        message = message.decode()
    if len(args) == 2:
        print("{0}: {1} in {2} at line {3} ({4})".format(
            messageType, message, context.file, context.line,
            context.function))
    else:
        print("{0}: {1}".format(messageType, message))