Exemplo n.º 1
0
 def toggleCursor(self):
     if self.cursor().shape() == QCursor(Qt.ArrowCursor).shape():
         raw = QPixmap(":/gui/pics/pardusman-icon.png")
         raw.setMask(raw.mask())
         self.setCursor(QCursor(raw, 2, 2))
     else:
         self.unsetCursor()
Exemplo n.º 2
0
 def __init__(self, parent=None):
     screen_size = QDesktopWidget().screenGeometry(-1)
     pixmap = QPixmap(self.imagen).scaledToWidth(screen_size.width() / 3)
     super().__init__(parent, pixmap, Qt.SplashScreen)
     self.setMask(pixmap.mask())
     self.set_texto("Loading")
     self.show()
Exemplo n.º 3
0
 def __init__(self, parent=None):
     screen_size = QDesktopWidget().screenGeometry(-1)
     pixmap = QPixmap(self.imagen).scaledToWidth(screen_size.width() / 3)
     super().__init__(parent, pixmap, Qt.SplashScreen)
     self.setMask(pixmap.mask())
     mensaje = QCoreApplication.translate("splash", "Cargando...")
     self.set_texto(mensaje)
Exemplo n.º 4
0
class ShapeWidget(QWidget):
    def __init__(self, parent=None):
        super(ShapeWidget, self).__init__(parent)
        self.i = 1
        self.mypix()
        self.timer = QTimer()
        self.timer.setInterval(500)  # 500毫秒
        self.timer.timeout.connect(self.timeChange)
        self.timer.start()

# 顯示不規則 pic

    def mypix(self):
        self.update()
        if self.i == 5:
            self.i = 1
        self.mypic = {
            1: './images/left.png',
            2: "./images/up.png",
            3: './images/right.png',
            4: './images/down.png'
        }
        self.pix = QPixmap(
            self.mypic[self.i], "0",
            Qt.AvoidDither | Qt.ThresholdDither | Qt.ThresholdAlphaDither)
        self.resize(self.pix.size())
        self.setMask(self.pix.mask())
        self.dragPosition = None

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = event.globalPos() - self.pos()
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor))

    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.m_drag:
            self.move(QMouseEvent.globalPos() - self.m_DragPosition)
            QMouseEvent.accept()

    def mouseReleaseEvent(self, QMouseEvent):
        self.m_drag = False
        self.setCursor(QCursor(Qt.ArrowCursor))

    def paintEvent(self, event):
        painter = QPainter(self)
        painter.drawPixmap(0, 0, self.pix.width(), self.pix.height(), self.pix)

    # 按兩下滑鼠事件
    def mouseDoubleClickEvent(self, event):
        if event.button() == 1:
            self.i += 1
            self.mypix()

# 每500毫秒修改paint

    def timeChange(self):
        self.i += 1
        self.mypix()
Exemplo n.º 5
0
def run():

    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(':/icons/windows/deeplisten-logo.png'))

    # splash screen
    # Create and display the splash screen
    splash_pix = QPixmap(':/icons/windows/start.png')
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    # Simulate something that takes time
    time.sleep(1)

    mw = MainWindow()
    mw.show()
    splash.finish(mw)

    ##setup stylesheet
    # import qdarkstyle
    # app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())

    sys.exit(app.exec_())
Exemplo n.º 6
0
def bootstrap0():
    # enable highdpi scaling
    QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
    QApplication.setAttribute(
        QtCore.Qt.AA_UseHighDpiPixmaps, True)  # use highdpi icons
    app = QtWidgets.QApplication(sys.argv)

    app.setStyle('Breeze')
    app.setStyleSheet(darkstylesheet())

    window = QtWidgets.QMainWindow()  # Create windwo
    prog = InterfaceGuiscrcpy(window)

    splash_pix = QPixmap(":/res/ui/guiscrcpy-branding.png")
    splash = QtWidgets.QSplashScreen(splash_pix)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    adb.devices(adb.path)

    app.processEvents()

    window.show()
    splash.hide()
    app.exec_()
    sys.exit()
Exemplo n.º 7
0
def welcomeExactDialog(app, settingsObject, mainwindow):

        # Create and display the about screen
        splash_pix = QPixmap(ARTWORK_DIR_NAME+'ExactWelcomeScreen.png')
        splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)

        btn = QPushButton('Enable EXACT', splash)
        btn.move(140, 320)
        btn.clicked.connect(partial(enableAndClose, splash, settingsObject,mainwindow))

        btn = QPushButton('Disable EXACT',splash)
        btn.move(350, 320)
        btn.clicked.connect(partial(disableAndClose, splash, settingsObject,mainwindow))
      #  layout.addWidget(btn, 1,1)

#        splash.showMessage('Version %s\n'%version, alignment = Qt.AlignHCenter + Qt.AlignBottom, color=Qt.black)
        splash.setMask(splash_pix.mask())
        splash.show()

        splash.mousePressEvent = partial(closeDlg, splash)

        start = time()
        while splash.isActiveWindow() & (time() - start < 10):
            sleep(0.001)
            app.processEvents()
        
        if (splash.isActiveWindow()):
            splash.close()
Exemplo n.º 8
0
def run(image_path = None):
    # Global exceptions
    sys.excepthook = excepthook

    app = QApplication(sys.argv) 

    # Splash screen
    splash_pix = QPixmap('resources/splash.jpg')
    splash = QSplashScreen(splash_pix)
    splash.setMask(splash_pix.mask())
    splash.show()
    
    app.processEvents()
    
    # Load translation
    locale_code = SettingsModel().get('Language', 'code')
    if locale_code != "en_US": # Standard language
        # Standard translator for the generated GUI
        translator = QTranslator()
        translator.load('localization/' + locale_code + '.qm')
        app.installTranslator(translator)

        # Translator for various GUI elements
        translator_2 = QTranslator()
        translator_2.load('localization/' + locale_code + '_2.qm')
        app.installTranslator(translator_2)

    # Start
    m = Hitagi(image_path) # Pass image path
    
    splash.finish(m)
    sys.exit(app.exec())
Exemplo n.º 9
0
def main():
    app = QApplication(sys.argv)
    app.setStyle('cleanlooks')
    app.setApplicationName("Linguistica")

    # Get screen resolution
    # Why do we need to know screen resolution?
    # Because this information is useful for setting the size of particular
    # widgets, e.g., the webview for visualizing the word neighbor manifold
    # (the bigger the webview size, the better it is for visualization!)
    resolution = app.desktop().screenGeometry()
    screen_width = resolution.width()
    screen_height = resolution.height()

    # create and display splash screen
    splash_image_path = os.path.join(os.path.dirname(__file__),
                                     'lxa_splash_screen.png')
    splash_image = QPixmap(splash_image_path)
    splash_screen = QSplashScreen(splash_image, Qt.WindowStaysOnTopHint)
    splash_screen.setMask(splash_image.mask())
    splash_screen.show()
    app.processEvents()
    time.sleep(2)

    # launch graphical user interface
    form = MainWindow(screen_height, screen_width, __version__)
    form.show()
    splash_screen.finish(form)
    app.exec_()
Exemplo n.º 10
0
    def setup_attention_image(self) -> None:
        vm = self.image_vm

        service = PredictionServiceFactory.create()
        attention = service.attention(vm.image)
        pixmap = QPixmap(attention.path.as_posix())
        self.attentionImageLabel.setPixmap(pixmap)
        self.srcImageLabel.setMask(pixmap.mask())
Exemplo n.º 11
0
 def __init__(self):
     path_here = os.path.realpath(__file__)
     imfile = os.path.join(os.path.split(path_here)[0], 'loading.png')
     splash_pix = QPixmap(imfile)
     self.splash = QSplashScreen(splash_pix)  #, Qt.WindowStaysOnTopHint)
     self.splash.setMask(splash_pix.mask())
     self.splash.show()
     QApplication.processEvents()
Exemplo n.º 12
0
def main(args=None):

    # supply path to qgis install location
    QgsApplication.setPrefixPath("/usr", True)

    # create a reference to the QgsApplication
    # setting the second argument to True enables the IquaView GUI,
    # which we need to do since this is a custom application
    qgs = QgsApplication([], True)

    # init splash screen
    splash_pix = QPixmap(':/resources/iquaview.png')
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())

    light_blue = QColor(165, 197, 192)
    dark_blue = QColor(11, 52, 70)
    # adding progress bar
    progress_bar = QProgressBar(splash)
    p = progress_bar.palette()
    p.setColor(QPalette.Highlight, light_blue)
    p.setColor(QPalette.HighlightedText, dark_blue)
    progress_bar.setPalette(p)
    progress_bar.setMaximum(10)
    progress_bar.setGeometry(0,
                             splash_pix.height() - 50, splash_pix.width(), 20)

    splash.show()
    splash.showMessage("Initializing interface...",
                       Qt.AlignBottom | Qt.AlignCenter, light_blue)

    # progress bar...
    for i in range(1, 11):
        progress_bar.setValue(i)
        t = time()
        if i == 5:
            splash.showMessage("Loading providers...",
                               Qt.AlignBottom | Qt.AlignCenter, light_blue)
            # load providers
            qgs.initQgis()
            LOGGER.info(qgs.showSettings())
        if i == 10:
            # exec iquaview window
            window = MainWindow()
            window.setWindowIcon(QIcon(":/resources/iquaview_vector.svg"))
            splash.showMessage("IQUAview ready!",
                               Qt.AlignBottom | Qt.AlignCenter, light_blue)

        while time() < t + 0.1:
            qgs.processEvents()

    window.showMaximized()
    splash.finish(window)

    qgs.exec_()
    window.deleteLater()
    # when app terminates, call exitQgis() to remove the provider and layer registries from memory
    qgs.exitQgis()
Exemplo n.º 13
0
 def __init__(self, parent, image=None, after=None):
     self.app = parent
     image = QPixmap(image)
     image = image.scaled(500, 500, Qt.KeepAspectRatio,
                          Qt.SmoothTransformation)
     self.splash = QSplashScreen(
         image, Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
     self.splash.setMask(image.mask())
     self.after = after
Exemplo n.º 14
0
 def __init__(self, name, parent=None):
     super(CloudWidget, self).__init__(parent)
     self.ui = uic.loadUi(ui_full_path('cloud_view.ui'), self)
     self.ui.cloudName.setText(name)
     pixmap = QPixmap(":/images/" + name + ".png")
     self.ui.cloudImage.setPixmap(pixmap)
     self.ui.cloudImage.setMask(pixmap.mask())
     self.ui.cloudAction.clicked.connect(self.pushed)
     self.name = name
Exemplo n.º 15
0
 def __init__(self, name, parent=None):
     super(CloudWidget, self).__init__(parent)
     self.ui = uic.loadUi(ui_full_path('cloud_view.ui'), self)
     self.ui.cloudName.setText(name)
     pixmap = QPixmap(":/images/" + name + ".png")
     self.ui.cloudImage.setPixmap(pixmap)
     self.ui.cloudImage.setMask(pixmap.mask())
     self.ui.cloudAction.clicked.connect(self.pushed)
     self.name = name
Exemplo n.º 16
0
class ShapeWidget(QWidget):
    def __init__(self, parent=None):
        super(ShapeWidget, self).__init__(parent)
        self.i = 1
        self.mypix()
        self.timer = QTimer()
        self.timer.setInterval(500) #定时器每500毫秒更新一次
        self.timer.timeout.connect(self.timeChange)
        self.timer.start()
        
     #显示不规则图片
    def mypix(self):
        self.update()
        if self.i  == 5:
            self.i = 1
        self.mypic = {1:'./images/left.png', 2:'./images/up.png', \
                            3:'./images/right.png',4:'./images/down.png'}
        self.pix = QPixmap(self.mypic[self.i], "0", Qt.AvoidDither | Qt.ThresholdDither | Qt.ThresholdAlphaDither)
        self.resize(self.pix.size())
        self.setMask(self.pix.mask())
        self.dragPosition = None
    
    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_drag = True
            #鼠标位置距离窗口左上角的坐标
            #globalPos鼠标位置
            #selfPos窗口位置
            self.m_DragPosition = event.globalPos() - self.pos()
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor))
    
    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.m_drag:
            #当前鼠标位置减上一次鼠标距离窗口左上角的位置等于当前窗口左上角的坐标
            self.move(QMouseEvent.globalPos()-self.m_DragPosition)
            QMouseEvent.accept()
            
    def mouseReleaseEvent(self, QMouseEvent):
        self.m_drag = False
        self.setCursor(QCursor(Qt.ArrowCursor))
    
    def paintEvent(self, event):
        painter = QPainter(self)
        painter.drawPixmap(0, 0, self.pix.width(), self.pix.height(), self.pix)
    
    def mouseDoubleClickEvent(self, event):
        if event.button() == 1:
            self.i += 1
            self.mypix()
    
    #每500毫秒窗口执行一次更新操作,重绘窗口
    def timeChange(self):
        self.i += 1
        self.mypix()
Exemplo n.º 17
0
def paint(pic):
    pixmap = QPixmap(pic)
    # pixmap = QPixmap("sunflower1096.png")
    palette = window.palette()
    palette.setBrush(QPalette.Normal, QPalette.Window, QBrush(pixmap))
    palette.setBrush(QPalette.Inactive, QPalette.Window, QBrush(pixmap))
    window.setPalette(palette)
    window.setMask(pixmap.mask())
    # pic_b.clicked.connect(lambda: paint(pic))
    set_b.clicked.connect(lambda: set_pic(pic))
    print("Push paint; pic:", pic)
Exemplo n.º 18
0
    def show_splash(self):
        image = QPixmap(':/loading_image')
        splash = QSplashScreen(image)
        splash.setAttribute(Qt.WA_DeleteOnClose)
        splash.setMask(image.mask())
        splash.show()

        QCoreApplication.processEvents()
        Parser([])

        splash.finish(self)
Exemplo n.º 19
0
def launch_data_downloader(path):
    app = QApplication(sys.argv)
    splash_pix = QPixmap('icons/xigmanas_conf_backup_icon.svg')
    splash = QSplashScreen(splash_pix)
    splash.setMask(splash_pix.mask())
    splash.show()
    config_dict = configparser.ConfigParser()
    if not os.path.exists(os.path.join(path, 'xigmanas_backup.ini')):
        config_dict['LOG'] = {'level': 'INFO', 'path': ''}
        config_dict['OPTIONS'] = {
            'language': 'english',
            'check_update': 'False'
        }
        config_dict['CREDENTIALS'] = {
            'password': '',
            'username': '',
            'folder': '',
            'target': '',
            'target_port': '22'
        }
        with open(os.path.join(path, 'xigmanas_backup.ini'),
                  'w') as configfile:
            config_dict.write(configfile)
    config_dict.read(os.path.join(path, 'xigmanas_backup.ini'))
    path_exist = True
    if not config_dict.get('LOG', 'path'):
        log_filename = os.path.join(path, 'xigmanas_backup_log.out')
    else:
        path_exist = os.path.isdir(config_dict.get('LOG', 'path'))
        if path_exist:
            log_filename = os.path.join(config_dict.get('LOG', 'path'),
                                        'xigmanas_backup_log.out')
        else:
            log_filename = os.path.join(path, 'xigmanas_backup_log.out')
    logging.getLogger('').handlers = []
    logging.basicConfig(filename=log_filename,
                        level=getattr(logging, config_dict.get('LOG',
                                                               'level')),
                        filemode='w',
                        format='%(asctime)s : %(levelname)s : %(message)s')
    formatter = logging.Formatter('%(levelname)s : %(message)s')
    console = logging.StreamHandler()
    console.setLevel(logging.DEBUG)
    console.setFormatter(formatter)
    logging.getLogger('').addHandler(console)
    logging.info('*****************************************')
    logging.info('XigmaNAS Conf Backup ' + _backup_version +
                 ' is starting ...')
    logging.info('*****************************************')
    ui = MainWindow(path, config_dict)
    ui.show()
    splash.finish(ui)
    sys.exit(app.exec_())
Exemplo n.º 20
0
 def set_image(self, image_filename):
     size = 800
     pixmap = QPixmap(image_filename)
     if pixmap.width() > pixmap.height():
         if pixmap.width() > size:
             pixmap = pixmap.scaledToWidth(size)
     else:
         if pixmap.height() > size:
             pixmap = pixmap.scaledToHeight(size)
     self.ui.label.setPixmap(pixmap)
     self.ui.label.setMask(pixmap.mask())
     self.ui.label.show()
Exemplo n.º 21
0
class Face_Label(QLabel):
    """
    定义人脸显示QLabel
    """
    def __init__(self, parent=None):
        super(Face_Label, self).__init__(parent=parent)

        # 获取图片size
        self.pixmap = QPixmap(face_img)
        self.resize(self.pixmap.size())
        # 设置mask
        self.setMask(QBitmap(self.pixmap.mask()))
Exemplo n.º 22
0
class ShapeWidget(QWidget):  
	def __init__(self,parent=None):  
		super(ShapeWidget,self).__init__(parent)
		self.i = 1
		self.mypix()
		self.timer = QTimer()
		self.timer.setInterval(500)  # 500毫秒
		self.timer.timeout.connect(self.timeChange)   
		self.timer.start()

    # 显示不规则 pic
	def mypix(self):
		self.update()
		if self.i == 5:
			self.i = 1
		self.mypic = {1: './images/left.png', 2: "./images/up.png", 3: './images/right.png', 4: './images/down.png'}
		self.pix = QPixmap(self.mypic[self.i], "0", Qt.AvoidDither | Qt.ThresholdDither | Qt.ThresholdAlphaDither)   
		self.resize(self.pix.size())
		self.setMask(self.pix.mask())  
		self.dragPosition = None

	def mousePressEvent(self, event):
		if event.button() == Qt.LeftButton:
			self.m_drag=True
			self.m_DragPosition=event.globalPos()-self.pos()
			event.accept()
			self.setCursor(QCursor(Qt.OpenHandCursor))

	def mouseMoveEvent(self, QMouseEvent):
		if Qt.LeftButton and self.m_drag:
			self.move(QMouseEvent.globalPos()- self.m_DragPosition )
			QMouseEvent.accept()
	
	def mouseReleaseEvent(self, QMouseEvent):
		self.m_drag=False
		self.setCursor(QCursor(Qt.ArrowCursor))
        
	def paintEvent(self, event):
		painter = QPainter(self)
		painter.drawPixmap(0, 0, self.pix.width(),self.pix.height(),self.pix)
    
	# 鼠标双击事件
	def mouseDoubleClickEvent(self, event):
		if event.button() == 1:
			self.i += 1
			self.mypix()

    # 每500毫秒修改paint
	def timeChange(self):
		self.i += 1
		self.mypix()
Exemplo n.º 23
0
 def initAppearance(self):
     # 设置窗口的样式
     self.pix = QPixmap('Loginbeijing.jpg')  # 蒙版
     windowWidth = 960
     windowHeight = 450
     self.resize(windowWidth, windowHeight)
     self.setFixedSize(self.width(), self.height())
     self.pix = self.pix.scaled(int(windowWidth), int(windowHeight))
     self.center()
     # 设置按钮的样式
     self.pushButton.setStyleSheet(
         'QPushButton{border-image:url(button.png)}')
     tempPixmap = QPixmap("button.png").scaled(self.pushButton.size())
     self.pushButton.setMask(tempPixmap.mask())
Exemplo n.º 24
0
class WelcomeWindow(QWidget):
    fade_over = pyqtSignal()

    def __init__(self, parent=None):
        super(WelcomeWindow, self).__init__(parent)
        self.initPix()

        self.setWindowTitle('初始化中...')
        # self.setWindowFlags(Qt.SplashScreen | Qt.FramelessWindowHint)
        self.setWindowFlags(Qt.FramelessWindowHint)

        # 设置透明度
        self.opa = 0

        self.fade_in_Timer = QTimer()
        self.fade_out_Timer = QTimer()

        self.fade_in_Timer.timeout.connect(self.fade_in)
        self.fade_out_Timer.timeout.connect(self.fade_out)

        self.fade_in_Timer.start(10)

    def initPix(self):
        self.pix = QPixmap(
            ":/trans/pic/logo.png", '0',
            Qt.AvoidDither | Qt.ThresholdDither | Qt.ThresholdAlphaDither)
        self.resize(self.pix.size())
        self.setMask(self.pix.mask())

    def fade_in(self):
        self.opa += 0.01
        self.setWindowOpacity(self.opa)
        if self.opa >= 1.0:
            self.fade_in_Timer.stop()
            QTimer.singleShot(2000, self.fade_out_start)

    def fade_out_start(self):
        self.fade_out_Timer.start(10)

    def fade_out(self):
        self.opa += -0.01
        self.setWindowOpacity(self.opa)
        if self.opa < 0:
            self.fade_out_Timer.stop()
            self.fade_over.emit()
            self.close()

    def paintEvent(self, *args, **kwargs):
        painter = QPainter(self)
        painter.drawPixmap(0, 0, self.pix.width(), self.pix.height(), self.pix)
Exemplo n.º 25
0
class TDPushButton(QLabel):
    '''
    自定义按钮,通过图片参数切换显示,支持信号和槽的回调机制
    '''
    click_signal = pyqtSignal()

    def __init__(self, *args, parent=None):
        super().__init__(parent)
        if len(args) != 4:
            raise InvailidArguementsException(
                '构造按钮的参数错误,请按照'
                '(self,常规显示图片路径,鼠标悬停图片路径,鼠标按下图片路径)传递参数\n '
                '参数个数:{}'.format(len(args)))
        self.pic_normal = QPixmap(args[1])  # args[0]是self
        self.pic_hover = QPixmap(args[2])
        self.pic_press = QPixmap(args[3])
        self.resize(self.pic_normal.size())
        self.is_press = False
        self.setPixmap(self.pic_normal)
        self.setMask(self.pic_hover.mask())

    def enterEvent(self, a0: QtCore.QEvent):
        '''
        鼠标经过进入到控件的事件
        '''
        self.setPixmap(self.pic_hover)

    def leaveEvent(self, a0: QtCore.QEvent):
        '''
        鼠标离开控件时触发事件
        '''
        self.setPixmap(self.pic_normal)

    def mousePressEvent(self, ev: QtGui.QMouseEvent):
        '''
        鼠标按下时执行的操作
        '''
        if ev.buttons() == QtCore.Qt.LeftButton:
            self.is_press = True
            self.setPixmap(self.pic_press)

    def mouseReleaseEvent(self, ev: QtGui.QMouseEvent):
        '''
        鼠标抬起时执行的操作
        '''
        if self.is_press == True:
            self.is_press = False
            self.setPixmap(self.pic_hover)
            # 发射点击信号
            self.click_signal.emit()
Exemplo n.º 26
0
class showalarm(QDialog):
    windowWidth = 350
    windowHeight = 132

    def __init__(self):
        super().__init__()

        self.pix = QPixmap('alarmbg.png')
        self.resize(350, 132)
        self.pix = self.pix.scaled(int(350), int(132))
        self.setMask(self.pix.mask())
        self.setWindowFlags(Qt.FramelessWindowHint
                            | QtCore.Qt.WindowStaysOnTopHint)  # 设置无边框和置顶窗口样式
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.setWindowOpacity(0.5)
        self.move((screen.width() - size.width()) / 2, (screen.height() - 210))
        self.setWindowFlags(Qt.FramelessWindowHint
                            | QtCore.Qt.WindowStaysOnTopHint)
        #self.init_ui()

    def paintEvent(self, event):
        paint = QPainter(self)
        paint.drawPixmap(0, 0, self.pix.width(), self.pix.height(), self.pix)

    def init_ui(self, h, m):
        self.alarmtime = QLabel(self)
        self.alarmtime.setFont(QFont('Comic Sans MS', 36, QFont.Bold))
        self.alarmtime.setText("<font color=%s>%s</font>" %
                               ('#FFFFFF', h + " : " + m))
        self.alarmtime.setGeometry(40, 10, 300, 100)

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_flag = True
            self.m_Position = event.globalPos() - self.pos()  #獲取滑鼠相對視窗的位置
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor))  #更改滑鼠圖示
        if event.button() == Qt.RightButton:
            self.close()

    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.m_flag:
            self.move(QMouseEvent.globalPos() - self.m_Position)  #更改視窗位置
            QMouseEvent.accept()

    def mouseReleaseEvent(self, QMouseEvent):
        self.m_flag = False
        self.setCursor(QCursor(Qt.ArrowCursor))
Exemplo n.º 27
0
class Messagebox(QWidget):
    def __init__(self):
        super().__init__()
        msg_box_bk_pic_path = './source/pic/MessageBox.png'
        hgzy_font_path = './source/font/HGZY_CNKI.TTF'
        rem_ico_path = './source/pic/rem.png'
        fontId = QFontDatabase.addApplicationFont(hgzy_font_path)
        fontName = QFontDatabase.applicationFontFamilies(fontId)[0]
        self.pix = QPixmap(msg_box_bk_pic_path)
        self.resize(self.pix.width(), self.pix.height())
        self.pix = self.pix.scaled(int(self.pix.width()),
                                   int(self.pix.height()))
        #self.move(parent.x()+(parent.width()-self.pix.width())/2,self.y()+(parent.height()-self.pix.height())/2)
        self.setMask(self.pix.mask())
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setAttribute(Qt.WA_TranslucentBackground)
        rem_icon = QIcon(QPixmap(rem_ico_path))
        self.setWindowIcon(rem_icon)
        self.msgtext = QLabel(self)
        self.msgtext.setObjectName('MsgLabel')
        self.msgtext.setFont(QFont(fontName, 10, QFont.Light))
        self.msgtext.setGeometry(40, 78, self.width(), self.height() - 100)
        self.msgtext.setStyleSheet('#MsgLabel{color:#e368b9}')
        self.m_DragPosition = None
        self.m_drag = False

    def paintEvent(self, event):
        paint = QPainter(self)
        paint.drawPixmap(0, 0, self.pix.width(), self.pix.height(), self.pix)

    def mouseDoubleClickEvent(self, event):
        self.close()

    def mousePressEvent(self, event):
        if event.button() == Qt.LeftButton:
            self.m_drag = True
            self.m_DragPosition = event.globalPos() - self.pos()
            event.accept()

    def mouseMoveEvent(self, event):
        if Qt.LeftButton and self.m_drag:
            self.move(event.globalPos() - self.m_DragPosition)
            event.accept()

    def mouseReleaseEvent(self, event):
        self.m_drag = False

    def setText(self, msg):
        self.msgtext.setText('       ' + msg + '\n\n' + '<<双击窗口关闭提示框>>')
Exemplo n.º 28
0
    def showSplash(self):
        # Create and display the splash screen
        splash_pix = QPixmap(
            'C:\\Users\\vcone\\Desktop\\Cosas\\CS\\Software2\\GUI test\\pick-tool-team13-the-bombs\\loading.png'
        )
        splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
        splash.setMask(splash_pix.mask())
        # Show a message at the center of the dialog
        splash.showMessage("Cleansing", 0x0084)
        splash.show()
        app.processEvents()

        # Simulate something that takes time
        time.sleep(2)
        splash.finish(self)
Exemplo n.º 29
0
 def initAppearance(self):
     # 设置窗口的样式
     self.pix = QPixmap('next.jpg')
     windowWidth = 432
     windowHeight = 768
     self.resize(windowWidth, windowHeight)
     self.pix = self.pix.scaled(int(windowWidth), int(windowHeight))
     # 设置无边框
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.center()
     # 设置按钮的样式
     self.pushButton.setStyleSheet(
         'QPushButton{border-image:url(beijing.png)}')
     tempPixmap = QPixmap("beijing.png").scaled(self.pushButton.size())
     self.pushButton.setMask(tempPixmap.mask())
Exemplo n.º 30
0
def splashScreen(app, version) -> QSplashScreen:

    # This first part is for loading the splash screen before anything else

    # Create and display the splash screen
    splash_pix = QPixmap(ARTWORK_DIR_NAME + 'SplashScreen.png')
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.showMessage('Version %s\n' % version,
                       alignment=Qt.AlignHCenter + Qt.AlignBottom,
                       color=Qt.black)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    return splash
Exemplo n.º 31
0
def get_icon(invert):

    # https://stackoverflow.com/questions/13350631/simple-color-fill-qicons-in-qt
    pixmap = QPixmap(':icon.png')
    assert(pixmap is not None)

    if invert:
        log.debug('inverting icon')
        mask = pixmap.mask()
        pixmap.fill((QColor('white')))
        pixmap.setMask(mask)

    icon = QIcon(pixmap)

    return icon
Exemplo n.º 32
0
def main():
    app = QApplication(sys.argv)

    # Create and display the splash screen
    splash_pix = QPixmap("./res/logo.png")
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()

    time.sleep(2)

    registration_window = RegistrationWindow()
    registration_window.show()
    splash.finish(registration_window)
    sys.exit(app.exec_())
Exemplo n.º 33
0
def initStartupProgressBar():
    splash_pix = QPixmap(300, 100)
    splash_pix.fill(QtCore.Qt.white)
    painter = QPainter(splash_pix)
    font = QFont("Times", 30)
    painter.setFont(font)
    painter.drawText(20, 65, "Loading all libs")
    painter.end()
    splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    progressBar = QProgressBar(splash)
    progressBar.setGeometry(splash.width() / 10, 8 * splash.height() / 10,
                            8 * splash.width() / 10,
                            splash.height() / 10)
    splash.setMask(splash_pix.mask())
    splash.show()
    return splash, progressBar
Exemplo n.º 34
0
def update_image(widget, dir, name, scale_width=64):
    if name is not None:
        img_file = os.path.join(dir, name + '.png')
        if os.path.exists(img_file):
            pixelmap = QPixmap(img_file)
            width = pixelmap.width()
            height = pixelmap.height()
            if width > height:
                pixelmap = pixelmap.scaledToWidth(scale_width)
            else:
                pixelmap = pixelmap.scaledToHeight(scale_width)
            widget.setPixmap(pixelmap)
            widget.setMask(pixelmap.mask())
            return True
    widget.clear()
    return False
Exemplo n.º 35
0
    def __init__(self, parent=None):
        super(SplashScreen, self).__init__(parent)

        self.setWindowModality(Qt.ApplicationModal)

        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.setObjectName(self.__class__.__name__)
        self.setContextMenuPolicy(Qt.PreventContextMenu)

        pixmap = QPixmap(":/images/Pyqt.jpg")
        self.setPixmap(pixmap)
        self.setMask(pixmap.mask())

        self.start_splashscreen.connect(self.fade_opacity)
Exemplo n.º 36
0
    def refreshInfo(self):
        #setup avata
        pixmap = QPixmap()
        pixmap.load("res/avata_mask")
        pixmap.scaled(115, 115)
        self.ui.lb_avata.setMask(pixmap.mask())
        pixmap.load(self.settings["avata"])
        self.ui.lb_avata.setPixmap(pixmap)

#        self.ui.lb_avata2.setMask(pixmap.mask())
#        pixmap.load(self.settings["avata"])
#        self.ui.lb_avata2.setPixmap(pixmap)


        #setup the name
        self.ui.lb_welcomname.setText(self.settings["name"])
        self.ui.lb_nick.setText(self.settings["name"])
Exemplo n.º 37
0
Arquivo: main.py Projeto: sergeqwe/vk
    def downloading(self, msg):
        # print('downloading...')
        # self.modalWindowDownloading = QWidget(window, Qt.Window)
        # self.modalWindowDownloading.setWindowModality(Qt.WindowModal)
        # Ui_FormDownload.setupUi(self, self.modalWindowDownloading)
        # Ui_FormDownload.retranslateUi(self, self.modalWindowDownloading)
        # self.modalWindowDownloading.show()

        image = QPixmap('./pic/loading1.jpg')
        self.splash = QSplashScreen(image)
        self.splash.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.splash = QSplashScreen(image, Qt.WindowStaysOnTopHint)
        self.splash.setMask(image.mask())
        font = QFont(self.splash.font())
        font.setPointSize(font.pointSize() + 3)
        self.splash.setFont(font)
        self.splash.showMessage(msg, QtCore.Qt.AlignTop | QtCore.Qt.AlignCenter, QtCore.Qt.black)
        self.splash.show()
Exemplo n.º 38
0
class SplashScreen(QSplashScreen):
    """
    This class implements the splash screen.
    It can be used with the context manager, i.e:

    >>> import sys
    >>> from PyQt5.QtWidgets import QApplication
    >>> app = QApplication(sys.argv)
    >>> with SplashScreen(min_splash_time=5):
    >>>     pass

    In the Example above a 5 seconds (at least) splash screen is drawn on the screen.
    The with statement body can be used to initialize the main widget and process heavy stuff.
    """
    def __init__(self, min_splash_time=2):
        """
        Initialize the B3 splash screen.
        :param min_splash_time: the minimum amount of seconds the splash screen should be drawn.
        """
        self.splash_pix = QPixmap(B3_SPLASH)
        self.min_splash_time = time() + min_splash_time
        QSplashScreen.__init__(self, self.splash_pix, Qt.WindowStaysOnTopHint)
        self.setMask(self.splash_pix.mask())

    def __enter__(self):
        """
        Draw the splash screen.
        """
        self.show()

    def __exit__(self, exc_type, exc_value, traceback):
        """
        Remove the splash screen from the screen.
        This will make sure that the splash screen is displayed for at least min_splash_time seconds.
        """
        now = time()
        if now < self.min_splash_time:
            sleep(self.min_splash_time - now)
        self.close()
Exemplo n.º 39
0
def start(filenames=None, projects_path=None,
          extra_plugins=None, linenos=None):
    app = QApplication(sys.argv)
    QCoreApplication.setOrganizationName('NINJA-IDE')
    QCoreApplication.setOrganizationDomain('NINJA-IDE')
    QCoreApplication.setApplicationName('NINJA-IDE')
    app.setWindowIcon(QIcon(resources.IMAGES['icon']))

    # Check if there is another session of ninja-ide opened
    # and in that case send the filenames and projects to that session
    running = ipc.is_running()
    start_server = not running[0]
    if running[0] and (filenames or projects_path):
        sended = ipc.send_data(running[1], filenames, projects_path, linenos)
        running[1].close()
        if sended:
            sys.exit()
    else:
        running[1].close()

    # Create and display the splash screen
    splash_pix = QPixmap(resources.IMAGES['splash'])
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    # Set the cursor to unblinking
    if sys.platform != 'win32':
        app.setCursorFlashTime(0)

    #Set the codec for strings (QString)
    print("codec:", QTextCodec.codecForName('utf-8'))
    #QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))

    #Translator
    #qsettings = QSettings()
    qsettings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
    language = QLocale.system().name()
    lang = qsettings.value('preferences/interface/language',
        defaultValue=language, type='QString') + '.qm'
    lang_path = file_manager.create_path(resources.LANGS, lang)
    if file_manager.file_exists(lang_path):
        settings.LANGUAGE = lang_path
    elif file_manager.file_exists(file_manager.create_path(
      resources.LANGS_DOWNLOAD, lang)):
        settings.LANGUAGE = file_manager.create_path(
            resources.LANGS_DOWNLOAD, lang)
    translator = QTranslator()
    if settings.LANGUAGE:
        translator.load(settings.LANGUAGE)
        app.installTranslator(translator)

        qtTranslator = QTranslator()
        qtTranslator.load("qt_" + language,
            QLibraryInfo.location(QLibraryInfo.TranslationsPath))
        app.installTranslator(qtTranslator)

    #Loading Syntax
    splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
    json_manager.load_syntax()

    #Read Settings
    splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop,
        Qt.black)
    settings.load_settings()

    #Set Stylesheet
    style_applied = False
    if settings.NINJA_SKIN not in ('Default', 'Classic Theme'):
        file_name = ("%s.qss" % settings.NINJA_SKIN)
        qss_file = file_manager.create_path(resources.NINJA_THEME_DOWNLOAD,
            file_name)
        if file_manager.file_exists(qss_file):
            with open(qss_file) as f:
                qss = f.read()
                app.setStyleSheet(qss)
                style_applied = True
    if not style_applied:
        if settings.NINJA_SKIN == 'Default':
            with open(resources.NINJA_THEME) as f:
                qss = f.read()
        else:
            with open(resources.NINJA__THEME_CLASSIC) as f:
                qss = f.read()
        app.setStyleSheet(qss)

    #Loading Schemes
    splash.showMessage("Loading Schemes",
        Qt.AlignRight | Qt.AlignTop, Qt.black)
    scheme = qsettings.value('preferences/editor/scheme', "default",
        type='QString')
    if scheme != 'default':
        scheme = file_manager.create_path(resources.EDITOR_SKINS,
            scheme + '.color')
        if file_manager.file_exists(scheme):
            resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))

    #Loading Shortcuts
    resources.load_shortcuts()
    #Loading GUI
    splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
    ide = IDE(start_server)

    #Showing GUI
    ide.show()

    #Loading Session Files
    splash.showMessage("Loading Files and Projects",
        Qt.AlignRight | Qt.AlignTop, Qt.black)
    #Files in Main Tab
    main_files = qsettings.value('openFiles/mainTab', [])
    if main_files is not None:
        mainFiles = list(main_files)
    else:
        mainFiles = list()
    tempFiles = []
    for file_ in mainFiles:
        fileData = list(file_)
        if fileData:
            lineno = fileData[1]
            tempFiles.append((fileData[0], lineno))
    mainFiles = tempFiles
    #Files in Secondary Tab
    sec_files = qsettings.value('openFiles/secondaryTab', [])
    if sec_files is not None:
        secondaryFiles = list(sec_files)
    else:
        secondaryFiles = list()
    tempFiles = []
    for file_ in secondaryFiles:
        fileData = list(file_)
        lineno = fileData[1]
        tempFiles.append((fileData[0], lineno))
    secondaryFiles = tempFiles
    # Recent Files
    recent = qsettings.value('openFiles/recentFiles', [])
    if recent is not None:
        recent_files = list(recent)
    else:
        recent_files = list()
    recent_files = [file_ for file_ in recent_files]
    #Current File
    current_file = qsettings.value('openFiles/currentFile', '', type='QString')
    #Projects
    projects_list = qsettings.value('openFiles/projects', [])
    if projects_list is not None:
        projects = list(projects_list)
    else:
        projects = list()
    projects = [project for project in projects]
    #Include files received from console args
    file_with_nro = list([(f[0], f[1] - 1) for f in zip(filenames, linenos)])
    file_without_nro = list([(f, 0) for f in filenames[len(linenos):]])
    mainFiles += file_with_nro + file_without_nro
    #Include projects received from console args
    if projects_path:
        projects += projects_path
    ide.load_session_files_projects(mainFiles, secondaryFiles, projects,
        current_file, recent_files)
    #Load external plugins
    if extra_plugins:
        ide.load_external_plugins(extra_plugins)

    splash.finish(ide)
    ide.notify_plugin_errors()
    ide.show_python_detection()
    sys.exit(app.exec_())
Exemplo n.º 40
0
class tempapp(QMainWindow, tempwin):
    def __init__(self,parent=None):
        #splash screen initialisation
        self.splash_pix = QPixmap('data/loading.jpg')
        self.splash = QSplashScreen(self.splash_pix, QtCore.Qt.WindowStaysOnTopHint)
        self.splash.setMask(self.splash_pix.mask())
        self.splash.show()

        super(tempapp, self).__init__(parent)
        self.setupUi(self)
    def main(self):
        #launching program
        self.hide()
        self.launch()
    def launch(self):
        #reading configuration
        config=open('data/configure')
        config=config.readlines()
        envir=main.principal
        self.result={}
        for info in range(len(config)) :
            temp=config[info].split('=')
            temp[1]=temp[1].split('\n')[0]
            self.result[temp[0]]=temp[1]

        if self.result['db']=='' :
            #if no databatse, asking user for creating/pointing
            h=QMessageBox(parent=self, text="No DB has been pointed. \nDo you want to create a new database or to load an existing database ?")
            h.addButton(QPushButton('Close'), QMessageBox.YesRole)
            h.addButton(QPushButton('Load an Existing DB'), QMessageBox.NoRole)
            h.addButton(QPushButton('New DB'), QMessageBox.HelpRole)
            self.splash.hide()
            tot = h.exec_()
            if tot==0 :
                self.terminer()
            if tot==1 :
                self.loaddb()
            if tot==2 :
                self.newdb()
        else :
            #if already configured : checking if the DB still exist
            if os.path.exists(self.result['db'])==True :
                None
            else :
                #if db do not exist : delete configuration and reboot program
                self.splash.hide()
                h=QMessageBox(parent=self, text="Corrupted file or non existent : Deleting configuration")
                self.result['db']=""
                new_conf=''
                for i in self.result :
                    new_conf+='%s=%s\n' % (i,self.result[i])
                config=open('data/configure','w')
                config.write(new_conf)
                config.close()
                h.exec_()
                python = sys.executable
                os.execl(python, python, * sys.argv)
            #launching program if all checkpoints are ok
            self.splash.hide()
            prog=main.principal()
            prog.main()
            sys.exit(app.exec_())
    def loaddb (self) :
        #loading db file
        fname=QFileDialog.getOpenFileName(self, 'Choose a DB', '/','SQLite Databse (*.sqlite)')[0]
        if fname=='' :
            z=QMessageBox(parent=self, text="No DB has been selected, closing program")
            z.exec_()
            z.exec_()
            self.terminer()
        isvalid=cursor.verif(str(fname))
        #checking is the DB is valid
        if isvalid==False :
            z=QMessageBox(parent=self, text="Wrong File/File Corruption. \nClosing programm")
            z.exec_()
            self.terminer()
        else :
            #writiing new configuration
            self.result['db']=str(fname)
            new_conf=''
            for i in self.result :
                new_conf+='%s=%s\n' % (i,self.result[i])
            config=open('data/configure','w')
            config.write(new_conf)
            config.close()
            python = sys.executable
            os.execl(python, python, * sys.argv)
    def terminer (self) :
        #QApplication.quit()
        #sys.exit(app.exec_())
        sys.exit(0)

    def newdb (self) :
        #new db creation
        fname=QFileDialog.getSaveFileName(self, 'Create a DB', '/','SQLite Databse (*.sqlite)')[0]
        shutil.copy('data/model.sqlite',fname)
        self.result['db']=str(fname)
        new_conf=''
        for i in self.result :
            new_conf+='%s=%s\n' % (i,self.result[i])
        config=open('data/configure','w')
        config.write(new_conf)
        config.close()
        python = sys.executable
        os.execl(python, python, * sys.argv)
Exemplo n.º 41
0
    parser = argparse.ArgumentParser(\
        description='Test script for tiled graphicview widget')
    parser.add_argument('--file', '-f', help='hdf file to load', default=None)
    args = parser.parse_args()

    if args.file is not None and not os.path.isfile(args.file):
        raise SystemExit("File does not exist!")

    app = QApplication(sys.argv)

    # windows always sucks!!
    if sys.platform.startswith("win"):
        sqldrivers = join(dirname(QtGui.__file__), "plugins")
        app.addLibraryPath(sqldrivers)


    splash_pix = QPixmap(':annotationtool_about.png')
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    splash.showMessage(version.information,
                       alignment=Qt.AnchorHorizontalCenter|
                       Qt.AnchorVerticalCenter)
    app.processEvents()
    mw = AtMainWindow(args.file)
    mw.show()
    app.thread().msleep(1000)
    splash.finish(mw)

    sys.exit(app.exec_())
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(430, 486)
        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8("images/icon.ico")), QIcon.Normal, QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.formLayoutWidget_2 = QWidget(Dialog)
        self.formLayoutWidget_2.setGeometry(QRect(230, 80, 181, 131))
        self.formLayoutWidget_2.setObjectName(_fromUtf8("formLayoutWidget_2"))
        self.formLayout_2 = QFormLayout(self.formLayoutWidget_2)
        self.formLayout_2.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
        self.label_5 = QLabel(self.formLayoutWidget_2)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.label_5)
        self.ball_box = QComboBox(self.formLayoutWidget_2)
        self.ball_box.setObjectName(_fromUtf8("ball_box"))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.ball_box.addItem(_fromUtf8(""))
        self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.ball_box)
        self.label_6 = QLabel(self.formLayoutWidget_2)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.formLayout_2.setWidget(2, QFormLayout.LabelRole, self.label_6)
        self.status_box = QComboBox(self.formLayoutWidget_2)
        self.status_box.setObjectName(_fromUtf8("status_box"))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.status_box.addItem(_fromUtf8(""))
        self.formLayout_2.setWidget(2, QFormLayout.FieldRole, self.status_box)
        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_2.setItem(1, QFormLayout.FieldRole, spacerItem)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_2.setItem(3, QFormLayout.FieldRole, spacerItem1)
        self.captured_edit = QLineEdit(self.formLayoutWidget_2)
        self.captured_edit.setObjectName(_fromUtf8("captured_edit"))
        self.formLayout_2.setWidget(4, QFormLayout.FieldRole, self.captured_edit)
        self.label = QLabel(self.formLayoutWidget_2)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout_2.setWidget(4, QFormLayout.LabelRole, self.label)
        self.formLayoutWidget_3 = QWidget(Dialog)
        self.formLayoutWidget_3.setGeometry(QRect(20, 80, 171, 131))
        self.formLayoutWidget_3.setObjectName(_fromUtf8("formLayoutWidget_3"))
        self.formLayout_3 = QFormLayout(self.formLayoutWidget_3)
        self.formLayout_3.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout_3.setObjectName(_fromUtf8("formLayout_3"))
        self.label_8 = QLabel(self.formLayoutWidget_3)
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.label_8)
        self.pokemon_Name_box = QComboBox(self.formLayoutWidget_3)
        self.pokemon_Name_box.setObjectName(_fromUtf8("pokemon_Name_box"))
        self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.pokemon_Name_box)
        spacerItem2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.formLayout_3.setItem(1, QFormLayout.FieldRole, spacerItem2)
        self.label_9 = QLabel(self.formLayoutWidget_3)
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.formLayout_3.setWidget(2, QFormLayout.LabelRole, self.label_9)
        self.level_edit = QLineEdit(self.formLayoutWidget_3)
        self.level_edit.setObjectName(_fromUtf8("level_edit"))
        self.formLayout_3.setWidget(2, QFormLayout.FieldRole, self.level_edit)
        self.label_10 = QLabel(self.formLayoutWidget_3)
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.formLayout_3.setWidget(3, QFormLayout.LabelRole, self.label_10)
        self.hp_edit = QLineEdit(self.formLayoutWidget_3)
        self.hp_edit.setObjectName(_fromUtf8("hp_edit"))
        self.formLayout_3.setWidget(3, QFormLayout.FieldRole, self.hp_edit)
        self.spriteLabel = QLabel(self.formLayoutWidget_3)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.spriteLabel.sizePolicy().hasHeightForWidth())
        self.spriteLabel.setSizePolicy(sizePolicy)
        self.spriteLabel.setText(_fromUtf8(""))
        self.spriteLabel.setObjectName(_fromUtf8("spriteLabel"))
        self.formLayout_3.setWidget(1, QFormLayout.LabelRole, self.spriteLabel)
        self.textBrowser = QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QRect(20, 260, 391, 192))
        self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
        self.label_3 = QLabel(Dialog)
        self.label_3.setGeometry(QRect(335, 460, 71, 20))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.label_4 = QLabel(Dialog)
        self.label_4.setGeometry(QRect(20, 30, 251, 16))
        font = QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.label_4.setFont(font)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.logolabel = QLabel(Dialog)
        self.logolabel.setGeometry(QRect(280, 20, 121, 51))
        self.logolabel.setText(_fromUtf8(""))
        self.logolabel.setObjectName(_fromUtf8("logolabel"))
        pixmap = QPixmap("images/logo.png")
        self.logolabel.setPixmap(pixmap)
        self.logolabel.setMask(pixmap.mask())
        self.calculateButton = QPushButton(Dialog)
        self.calculateButton.setGeometry(QRect(340, 230, 72, 23))
        self.calculateButton.setObjectName(_fromUtf8("calculateButton"))

        self.retranslateUi(Dialog)
        QMetaObject.connectSlotsByName(Dialog)
Exemplo n.º 43
0
Arquivo: main.py Projeto: ajoros/ves
        self.schlumbergerLayout = False
        self.wennerLayout = True


    def schlumberger(self):
        """Define Schlumberger layout is True"""
        self.schlumbergerLayout = True
        self.wennerLayout = False


if __name__ == '__main__':

    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon('hand_drill.png'))

    splashPix = QPixmap('splash.png')
    splashScreen = QSplashScreen(splashPix, Qt.WindowStaysOnTopHint)

    splashScreen.setMask(splashPix.mask())
    splashScreen.show()
    app.processEvents()

    time.sleep(3)

    startup = StartupWindow(tableData, headers, colors, old_coefficients)
    startup.show()

    splashScreen.finish(startup)

    sys.exit(app.exec_())
Exemplo n.º 44
0
Arquivo: test2.py Projeto: sergeqwe/vk
from PyQt5.QtCore import Qt, QCoreApplication
# from PyQt5.QtWidgets import QToolTip
from PyQt5.QtGui import QPixmap, QImage, QFont
# from urllib.request import Request, urlopen
# from urllib.error import URLError, HTTPError
from vk_ui import Ui_MainWindow
from vk_settings_ui import Ui_Form
from add_ui import Ui_FormUrl
from downloading_ui import Ui_FormDownload

app = QApplication(sys.argv)
image = QPixmap('./pic/111.jpg')
splash = QSplashScreen(image)
splash.setAttribute(QtCore.Qt.WA_DeleteOnClose)
splash = QSplashScreen(image, Qt.WindowStaysOnTopHint)
splash.setMask(image.mask())
font = QFont(splash.font())
font.setPointSize(font.pointSize() + 5)
splash.setFont(font)
splash.show()
app.processEvents()
# time.sleep(2)

# splash.showMessage(splash.tr('Processing %1...{0}'),QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeft, QtCore.Qt.white)
# QtCore.QThread.msleep(1000)
# QApplication.processEvents()
for count in range(1, 6):
    # splash.showMessage(splash, str(count),QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeft, QtCore.Qt.blue)
    splash.showMessage('Loading: ' + str(count), QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft, QtCore.Qt.white)
#     print(str(count))
#
Exemplo n.º 45
0
def start_ide(app, filenames, projects_path, extra_plugins, linenos):
    """Load all the settings necessary before loading the UI, and start IDE."""
    QCoreApplication.setOrganizationName('NINJA-IDE')
    QCoreApplication.setOrganizationDomain('NINJA-IDE')
    QCoreApplication.setApplicationName('NINJA-IDE')
    app.setWindowIcon(QIcon(":img/icon"))

    # Check if there is another session of ninja-ide opened
    # and in that case send the filenames and projects to that session
    running = ipc.is_running()
    start_server = not running[0]
    if running[0] and (filenames or projects_path):
        sended = ipc.send_data(running[1], filenames, projects_path, linenos)
        running[1].close()
        if sended:
            sys.exit()
    else:
        running[1].close()

    # Create and display the splash screen
    splash_pix = QPixmap(":img/splash")
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setMask(splash_pix.mask())
    splash.show()
    app.processEvents()

    # Set the cursor to unblinking
    #if not settings.IS_WINDOWS:
        #app.setCursorFlashTime(0)

    #Set the codec for strings (QString)
    ##QTextCodec.setCodecForCStrings(QTextCodec.codecForName('utf-8'))

    #Translator
    qsettings = ide.IDE.ninja_settings()
    data_qsettings = ide.IDE.data_settings()
    language = QLocale.system().name()
    lang = qsettings.value('preferences/interface/language',
                           defaultValue=language, type='QString') + '.qm'
    lang_path = file_manager.create_path(resources.LANGS, lang)
    if file_manager.file_exists(lang_path):
        settings.LANGUAGE = lang_path
    translator = QTranslator()
    if settings.LANGUAGE:
        translator.load(settings.LANGUAGE)
        app.installTranslator(translator)

        qtTranslator = QTranslator()
        qtTranslator.load(
            "qt_" + language,
            QLibraryInfo.location(QLibraryInfo.TranslationsPath))
        app.installTranslator(qtTranslator)

    #Loading Syntax
    splash.showMessage("Loading Syntax", Qt.AlignRight | Qt.AlignTop, Qt.black)
    json_manager.load_syntax()

    #Read Settings
    splash.showMessage("Loading Settings", Qt.AlignRight | Qt.AlignTop,
                       Qt.black)

    #Set Stylesheet
    style_applied = False
    print(settings.NINJA_SKIN)
    if settings.NINJA_SKIN not in ('Default'):
        file_name = ("%s.qss" % settings.NINJA_SKIN)
        qss_file = file_manager.create_path(resources.NINJA_THEME_DOWNLOAD,
                                            file_name)
        if file_manager.file_exists(qss_file):
            with open(qss_file) as fileaccess:
                qss = fileaccess.read()
                app.setStyleSheet(qss)
                style_applied = True
    if not style_applied:
        if settings.NINJA_SKIN == 'Default':
            with open(resources.NINJA_THEME) as fileaccess:
                qss = fileaccess.read()
        app.setStyleSheet(qss)

    #Loading Schemes
    splash.showMessage("Loading Schemes",
                       Qt.AlignRight | Qt.AlignTop, Qt.black)
    scheme = qsettings.value('preferences/editor/scheme', "default",
                             type='QString')
    if scheme != 'default':
        scheme = file_manager.create_path(resources.EDITOR_SKINS,
                                          scheme + '.color')
        if file_manager.file_exists(scheme):
            resources.CUSTOM_SCHEME = json_manager.parse(open(scheme))

    #Loading Shortcuts
    resources.load_shortcuts()
    #Loading GUI
    splash.showMessage("Loading GUI", Qt.AlignRight | Qt.AlignTop, Qt.black)
    ninjaide = ide.IDE(start_server)

    #Showing GUI
    ninjaide.show()
    #OSX workaround for ninja window not in front
    try:
        ninjaide.raise_()
    except:
        pass  # I really dont mind if this fails in any form
    #Loading Session Files
    splash.showMessage("Loading Files and Projects",
                       Qt.AlignRight | Qt.AlignTop, Qt.black)

    #First check if we need to load last session files
    if qsettings.value('preferences/general/loadFiles', True, type=bool):
        #Files in Main Tab
        files = data_qsettings.value('lastSession/openedFiles', [])
        tempFiles = []
        if files:
            for file_ in files:
                fileData = tuple(file_)
                if fileData:
                    tempFiles.append(fileData)
        files = tempFiles

        # Recent Files
        recent_files = data_qsettings.value('lastSession/recentFiles', [])
        #Current File
        current_file = data_qsettings.value(
            'lastSession/currentFile', '', type='QString')
        #Projects
        projects = data_qsettings.value('lastSession/projects', [])
    else:
        files = []
        recent_files = []
        current_file = ''
        projects = []

    #Include files received from console args
    file_with_nro = list([(f[0], (f[1] - 1, 0), 0)
                         for f in zip(filenames, linenos)])
    file_without_nro = list([(f, (0, 0), 0) for f in filenames[len(linenos):]])
    files += file_with_nro + file_without_nro
    #Include projects received from console args
    if projects_path:
        projects += projects_path
    #FIXME: IMPROVE THIS WITH THE NEW WAY OF DO IT
    ninjaide.load_session_files_projects(files, projects,
                                         current_file, recent_files)
    #Load external plugins
    #if extra_plugins:
        #ninjaide.load_external_plugins(extra_plugins)

    splash.finish(ninjaide)
    ninjaide.notify_plugin_errors()
    ninjaide.show_python_detection()