Example #1
0
    def __init__(self):
        # Initialize
        app = QApplication(sys.argv)
        app.setApplicationName("eKalappai")
        app.setApplicationVersion("4.0.0")
        shared = QSharedMemory("59698760-43bb-44d9-8121-181ecbb70e4d")

        # Check if already another instance of app is running and quit if it is
        if not shared.create(512, QSharedMemory.ReadWrite):
            qWarning("Cannot start more than one instance of eKalappai any time.")
            exit(0)

        # Splash Screen init
        splashImage = QPixmap(':intro/splash_screen')
        splashScreen = QSplashScreen(splashImage)
        splashScreen.show()
        # Time wait for splash screen to be shown
        time.sleep(2)
        splashScreen.hide()

        # Main application starting
        QApplication.setQuitOnLastWindowClosed(False)
        ekWindow = EKWindow(app)

        # EK Engine start
        ekWindow.engine.start()
        
        sys.exit(app.exec_())
Example #2
0
def test_err_dialog(request, qapp):
    global dialog_result

    dialog_result = {}

    splash = QSplashScreen()
    splash.show()
    text = None

    try:
        file_name = "not_exist_file.txt"
        file_d = open(file_name, 'r')
        text = file_d.read()
        file_d.close()
    except (RuntimeError, IOError) as err:
        assert text is None
        err_dialog = gm_base.geomop_dialogs.GMErrorDialog(splash)
        timer = QTimer(splash)
        timer.timeout.connect(lambda: start_dialog(err_dialog))
        timer.start(1000)
        err_dialog.open_error_dialog("Can't open file", err)

    del splash

    #button tests
    assert dialog_result['button_count'] == 1
    assert dialog_result['button_text'] in ('&OK', 'OK')
    #text test
    assert dialog_result['text'] == "Can't open file"
    assert dialog_result['informativeText'][:12] == "FileNotFound"
    assert dialog_result['title'] == "GeoMop Error"
Example #3
0
 def show_splash_screen(self):
     self.splash_pixmap = QPixmap()
     self.splash_pixmap.load(I('library.png'))
     self.splash_screen = QSplashScreen(self.splash_pixmap)
     self.splash_screen.showMessage(
         _('Starting %s: Loading books...') % __appname__)
     self.splash_screen.show()
     QApplication.instance().processEvents()
Example #4
0
    def on_pushButton_clicked(self):  # 检索按钮
        """
        Slot documentation goes here.
        """

        if self.lineEdit.text() == '':  # 如果检索输入栏为空
            QMessageBox.information(self, "提示", "没有输入检索内容")
            return

        self.listWidget.clear()
        self.names.clear()
        self.sizes.clear()
        self.times.clear()
        self.mages.clear()
        # 开始检索

        # self.names,self.sizes,self.times,self.mages = GetInfo(self.lineEdit.text())
        if self.FindingThread.isAlive() is False:
            self.FindingThread = threading.Thread(target=GetInfo,
                                                  args=(self.lineEdit.text(),
                                                        self))
        self.pushButton.setDisabled(True)

        splash = QSplashScreen(QPixmap(":/pic/waiting.png"))
        splash.show()
        app.processEvents()
        self.FindingThread.start()
        while self.FindingThread.isAlive():
            continue
        self.pushButton.setDisabled(False)
        splash.finish(self)
        QMessageBox.information(self, "检索完毕",
                                "共检索到" + str(len(self.names)) + "个结果")

        # 添加结果到listWidget
        for i in self.names:
            self.listWidget.addItem(i)
Example #5
0
    if getattr(sys, 'frozen', False):
        # running in a bundle
        imgDir = os.path.join(sys._MEIPASS, 'img')

    else:
        # running live
        imgDir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                              'img')

    ### -- style stuff
    spmtLogo_file = os.path.join(imgDir, 'splashscreen.png')
    labelstyle = "QLabel { font-size: 14px; color: purple; font-style: italic; text-align: center;}"
    barStyle = "QProgressBar::chunk {background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #372f43,stop: 0.6 #5c4c7a, stop: 0.8 #663399);border-bottom-right-radius: 7px;border-bottom-left-radius: 7px;border-top: 2px solid #8A2BE2;}"

    splash_pix = QPixmap(spmtLogo_file)
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)

    progressBar = QProgressBar(splash)
    progressBar.setGeometry(0,
                            splash_pix.height() - 13, splash_pix.width(), 13)
    progressBar.setStyleSheet(barStyle)
    progressBar.setAlignment(Qt.AlignRight)

    label = QLabel(splash)
    label.setStyleSheet(labelstyle)
    label.setGeometry((splash_pix.width() - 500) / 2,
                      splash_pix.height() - 40, 500, 20)
    label.setAlignment(Qt.AlignCenter)

    progressText = "loading..."
    label.setText(progressText)
Example #6
0
                      left,
                      top,
                      textColor=(0, 255, 0),
                      textSize=20):
        if (isinstance(img, numpy.ndarray)):  #判断是否OpenCV图片类型
            img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
        draw = ImageDraw.Draw(img)
        fontText = ImageFont.truetype(
            # 参数1:字体文件路径,默认设定好,避免后期增加传参复杂度
            "msyh.ttf",
            textSize,
            encoding="utf-8")
        draw.text((left, top), text, textColor, font=fontText)
        return cv2.cvtColor(numpy.asarray(img), cv2.COLOR_RGB2BGR)


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    # 启动界面
    splash = QSplashScreen(QPixmap("./static/liuliuzhulogo.png"))
    splash.show()
    splash.showMessage(
        u'正在加载资源……\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t',
        Qt.AlignCenter, Qt.white)
    app.processEvents()
    ui = MainWindow()
    ui.show()
    splash.finish(ui)
    sys.exit(app.exec_())